|
Hello Jim, hello David, I have had this problem and found 2 solutions 1. somewhere there is a read-only interface to .DBF's (vaults of parnassus I think). I think minor tweaking would make it read-write. indexes are not supported, but it's about 150 lines, so, basic, basic ! 2. installing visual foxpro with the odbc drivers lets you use mxODBC (and the native python odbc). The Vfox Odbc driver does understand compound index files (.CDX) and uses them properly to access records by index (i.e. c.execute("select * where id = ?id", ('xx',)) uses the cdx index if possible, not a table scan). I can't remember for sure if CDX indexes appeared after clipper 5.2, but I think they were there already. This allows you to use the original dbf format (which excel also can read, the one with no nulls, signature 0x03 in the header), and also the newer vfox format (which allows nulls, but neither excel nor clipper can read nor write, and has signature 0x83 in the first byte). I have found that I could write code that could read and write either a DBF or the same table on db2/oracle/postgres, pretty much with no change of code, just by opening a different ODBC dsn; that has helped me transition some DBF-dependent code to python and then to sql servers. Of course you have to go for the lower common standard of sql if you want interoperability. I've written a table module that allows tables to be treated like a mutable list of objects (and across vfox/db2/oracle/dbf), but it's not pretty (one of my first coding attemps): t = table(dsn, "select * from blah", pk=(id,id2,id3,etc)) for r in t: print r.id, r.name r.name = r.name.upper() will print and uppercase the name column in the table, committing at the del of r. Please get in touch if you'd like to discuss. -frederic vander elst jim wrote: David: Thanks for the reply.--- jim <[EMAIL PROTECTED]> wrote:I have bindings for the xbase-2.0.0 c++ library with the sip files and a python wrapper module. |
_______________________________________________ DB-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/db-sig
