[DB-SIG] dBase III and VFP tables

Ethan Furman ethan at stoneleaf.us
Wed Jul 20 18:33:39 CEST 2011

Chris Clark wrote:
> Take a look at engine (formally SnakeSQL) and squawk for ideas on adding 
> both SQL and a dbapi interface.
> http://pypi.python.org/pypi/engine/
> http://pypi.python.org/pypi/SnakeSQL/
> http://pypi.python.org/pypi/squawk/

Thanks, I'll check them out.

> My 2 cents, it looks like the "type" number "n(6,2)" is really a string 
> with some restrictions on formatting (i.e. only contains digits, a 
> single period, and spaces). You could simple return strings for 
> everything. An optional (and configurable) type conversion layer could 
> then be used on top of that.

I'm going for the configurable route.  VFP and dBase IV and above have 
binary fields as well as text fields, so just returning what I find in 
the table doesn't feel very friendly.  By default I'll be returning 
ints/floats, bools, dates, and Char (another custom type that treats 
whitespace as false, as well as ignoring trailing white space for 
comparisons) with a mechanism for overriding either on a by type basis 
(any Number) or a field basis (only Age).

> Ingres has an old (non ANSI-) date type that we still support, this old 
> date can be empty (empty string '' rather than blank padded as described 
> in earlier in the thread). IMHO dbapi drivers can't go returning empty 
> strings for dates (as this is wildly incompatible with other DBMSs), we 
> return a "magic" date for empty dates (the year 9999). It is reasonable 
> to add an extension return type that supports empty, e.g. one could then 
> do checks like:
> if my_result is empty:
>    ....
> But I'd suggest that empty support NOT be enabled by default. So lots of 
> options :-S

Yes, that's the conclusion I have come to.

Thanks for the links and your comments!


More information about the DB-SIG mailing list