Re: Converters for built-in types
"Antonio Valente" <[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
2006/9/25, Rich Shepard <[email protected]>: > > On Mon, 25 Sep 2006, Antonio Valente wrote: > > > Hi, all, I'm an italian (and quite happy, until today) pysqlite2 user, > so, > > please don't look at my bad english... > > Antonio, > > You have no reason to worry about your writing in English. It's better > than what I've read from many Americans. :-) I wish....:-) > I have a problem with pysqlite2: I need to use a custom data type for > > "varchar" columns. I tried to register a converter but it didn't work. > > Looking at the sources, I discovered that if I have, for example > > "varchar(20)", the converter getter tries to get a function for the > > "varchar(20)" key, that's of course not what I needed... How can I do? > By > > now, I changed the source file to cut the key at the first "(" or space > > character, but of course this is only a temporary solution. I hope you > > help me > > I don't understand what you're trying to store. If it's text and you > want > to ensure that the character string does not exceed 20 characters, you can > use a check constraint. For example, CHECK(LEN(col_name) <= 20) No, I need to have cursor's result wrapped in an object of mine and not in python's strings when datatype is "char" or "varchar". But if I install a converter function, it doesn't work for varchar since I declare the column as "some_column varchar(20)": it looks for a converter for "varchar(20)" type. Thanks Rich > > -- > Richard B. Shepard, Ph.D. | The Environmental Permitting > Applied Ecosystem Services, Inc.(TM) | Accelerator > <http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: > 503-667-8863 > _______________________________________________ > pysqlite mailing list > pysqlite-IAPFreCvJWPBWskQ1e/[email protected] > http://lists.initd.org/mailman/listinfo/pysqlite > _______________________________________________ pysqlite mailing list pysqlite-IAPFreCvJWPBWskQ1e/[email protected] http://lists.initd.org/mailman/listinfo/pysqlite