Hi!

I'm making some test using SQLObject with MySQL and I found that BLOBCol
is using a TEXT column. When I take a look to the code (col.py) I see:

class SOBLOBCol(SOStringCol):
    def createValidators(self):
        return [BinaryValidator(name=self.name)] + \
            super(SOBLOBCol, self).createValidators()

    def _mysqlType(self):
        length = self.length
        varchar = self.varchar
        if length >= 2**24:
            return varchar and "LONGTEXT" or "LONGBLOB"
        if length >= 2**16:
            return varchar and "MEDIUMTEXT" or "MEDIUMBLOB"
        if length >= 2**8:
            return varchar and "TEXT" or "BLOB"
        return varchar and "TINYTEXT" or "TINYBLOB"

Since varchar is set to "auto"[1] by default, SQLObject is using TEXT as
a BLOBCol. Beside the "auto" thing which look like a bug (is it?), why it
is even the posibility to use a TEXT-like column with a BLOBCol in MySQL?
Is this a bug too?

For now, I'm using: blob = BLOBCol(length=2**24, varchar=False), but it
doesn't look natural at all.

[1] col.py again:
class SOStringLikeCol(SOCol):
    """A common ancestor for SOStringCol and SOUnicodeCol"""
    def __init__(self, **kw):
        self.length = popKey(kw, 'length')
        self.varchar = popKey(kw, 'varchar', 'auto')


-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
 .------------------------------------------------------------------------,
  \  GPG: 5F5A8D05 // F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05 /
   '--------------------------------------------------------------------'
MP: Qué tengo?                     B: 2 dedos de frente.
MP: No, en mi mano, Bellini.       B: Un acoplado!
MP: No, escuche bien, eh...        B: El pelo largo, Mario...
    Se usa en la espalda.
MP: No! Es para cargar.            B: Un hermano menor.
MP: No, Bellini! Se llena con      B: Un chancho, Mario...
    cualquier cosa.
MP: No, Bellini, no y no!
        -- El Gran Bellini (Mario Podestá con una mochila)

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to