--- bin/named/dlz_odbc_driver.c_ORIG	2005-03-25 20:25:12.000000000 +0100
+++ ./bin/named/dlz_odbc_driver.c	2005-03-25 20:24:31.000000000 +0100
@@ -534,6 +534,11 @@
 	unsigned int j = 0;
 	SQLRETURN sqlRes;
 
+    /* Extended Patch for Zone Extended Tag */
+    char *n_zone_domain;
+    char *n_zone_tld;
+    char n_buffer[strlen(zone)+1];
+	
 	REQUIRE(*r_dbi == NULL);
 
 		// get db instance / connection
@@ -614,10 +619,27 @@
 		// was a zone string passed?  If so, make it safe for use in queries.
 	if(zone != NULL){
 		dbi->zone = odbc_escape_string(zone);
+ 
+        // Extended Patch for Zone Extended Tag
+        snprintf(n_buffer, strlen(zone)+1, "%s", zone);
+        n_zone_domain = strtok(n_buffer, ".");
+        n_zone_tld    = strtok(NULL, "");
+        //
+        dbi->zone_domain = odbc_escape_string(n_zone_domain);
+        dbi->zone_tld    = odbc_escape_string(n_zone_tld);
+		
 		if(dbi->zone == NULL){
 			result = ISC_R_NOMEMORY;
 			goto cleanup;
 		}
+        if(dbi->zone_domain == NULL){
+            result = ISC_R_NOMEMORY;
+            goto cleanup;
+        }
+        if(dbi->zone_tld == NULL){
+            result = ISC_R_NOMEMORY;
+            goto cleanup;
+        }
 	} else {	// no string passed, set the string pointer to NULL
 		dbi->zone = NULL;
 	}
@@ -718,6 +740,14 @@
 	if(dbi->zone != NULL)
 		isc_mem_free(ns_g_mctx, dbi->zone);
 
+        // free dbi->zone_domain string
+    if(dbi->zone_domain != NULL)
+        isc_mem_free(ns_g_mctx, dbi->zone_domain);
+ 
+        // free dbi->zone_tld string
+    if(dbi->zone_tld != NULL)
+        isc_mem_free(ns_g_mctx, dbi->zone_tld);
+	
 		// free dbi->record string
 	if(dbi->record != NULL)
 		isc_mem_free(ns_g_mctx, dbi->record);
