Re: [pysqlite] Taking column affinity into account
Gerhard Häring <[email protected]> Sat, 18 Oct 2008 13:14:48 +0200
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Peter Jacobi wrote: > Dear All, > > > Is there any possibility to use the column affinity in adapters? > E.g. when storing datetime.date (1999, 12, 31) generate > "1999-12-31" if the column affinity is TEXT but "19991231" > if the column affinity is INTEGER? > > I assume this is impossible in out of the box pysqlite, but > I'm wondering how easy or hard it may be, to add this functionality. > > The corollary would be creating a mechanism for converters, > to let them know about the actual SQLITE data type. AFAIK there is no way to to inspect the column affinity of a certain column. And even if there was, it wouldn't help - bound parameters don't know which column they end up in or are compared to. In my opinion adapters and converters are best used for what they're used in out of the box pysqlite: emulating types that "bigger" databases have that SQLite doesn't like date and timestamp. - -- Gerhard -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFI+cUodIO4ozGCH14RAnW2AJ4mQuTKKFj+f9CuOfjNUHVIxeCSGACgoUOd 36BXT5pCpn/QG4CBHtlm7Sg= =IeKH -----END PGP SIGNATURE-----