Re: Converters for built-in types
Rich Shepard <[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[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 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)
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