Index: gw/sqlbox_mysql.c
===================================================================
--- gw/sqlbox_mysql.c	(revision 45)
+++ gw/sqlbox_mysql.c	(working copy)
@@ -172,6 +172,8 @@
 
 static Octstr *get_string_value_or_return_null(Octstr *str)
 {
+    static Octstr *nul = NULL;
+
     if (str == NULL) {
         return octstr_create("NULL");
     }
@@ -180,6 +182,11 @@
     }
     octstr_replace(str, octstr_imm("\\"), octstr_imm("\\\\"));
     octstr_replace(str, octstr_imm("\'"), octstr_imm("\\\'"));
+    if (NULL == nul) {
+        nul = octstr_create("");
+        octstr_append_char(nul, 0x00);
+    }
+    octstr_replace(str, nul, octstr_imm("\0"));
     return octstr_format("\'%S\'", str);
 }
 
