[Serdev] [Tracker] Created: (SER-204) [Patch] MySQL: Support VARBINARY fields as a replacement for BLOBs

Anonymous (JIRA) tracker at iptel.org
Wed Jan 10 08:48:25 UTC 2007


[Patch] MySQL: Support VARBINARY fields as a replacement for BLOBs
------------------------------------------------------------------

                 Key: SER-204
                 URL: http://tracker.iptel.org/browse/SER-204
             Project: SER
          Issue Type: Improvement
          Components: MySQL
    Affects Versions: Ottendorf
         Environment: not relevant here
            Priority: Minor


It is sometimes useful to use MySQL heap tables (ENGINE=MEMORY) for some of SER's tables. Unfortunately, MySQL does not allow BLOB columns in heap tables. As long as the values are not too large, VARBINARY is a good replacement, but the problem is that SER cannot distinguish VARBINARY from VARCHAR and will return VARBINARY values in SELECTs as DB_STRING (which is a null-terminated string, obviously useless for a binary value).

This patch allows SER to recognize [VAR]BINARY fields and treat them similar to DB_BLOBs.

--- modules/mysql/res.c (revision 38634)
+++ modules/mysql/res.c (working copy)
@@ -106,6 +106,16 @@
                        RES_TYPES(_r)[i] = DB_BITMAP;
                        break;
 
+               case FIELD_TYPE_STRING:
+               case FIELD_TYPE_VAR_STRING:
+                       /* If the field is a BINARY or VARBINARY field, treat it
 as a
+                        * DB_BLOB. Null-terminated strings don't make sense the
re. */
+                       if (fields[i].flags & BINARY_FLAG)
+                               RES_TYPES(_r)[i] = DB_BLOB;
+                       else
+                               RES_TYPES(_r)[i] = DB_STRING;
+                       break;
+
                default:
                        RES_TYPES(_r)[i] = DB_STRING;
                        break;


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://tracker.iptel.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the Serdev mailing list