From: Brian B. <bri...@gm...> - 2005-08-09 22:12:22
|
Hi, The problem is that mdb-export was designed to export to CSV format in which case " is the proper quoting character. Somewhere along the line somebody contributed the -I option. There is a -R option to set the row delimiter. So you could say something = like: mdb-export -I -R '; ' Northwind.mdb Shippers and get the desired results, although I find this sort of a kludge since mdb-export doesn't use the delimiter as a mask, everything is taken literaly, so the preferable version: mdb-export -I -R ';\n' Northwind.mdb Shippers doesn't work as one would hope....that should be a simple fix, I'll see if I can get to it this week. Third option is to use good old sed (which you alluded to) like so: mdb-export -I Northwind.mdb Shippers | sed -e 's/$/;/' which will produce the desired results. As for changing the quoting character, it should be configurable as well. Default should be " (double quote) when doing CSV style export and ' (single quote) when using the -I switch. I'll see if I can knock this out something this week too. Brian 2005/8/9, Markus Neteler <ne...@it...>: > Hi, >=20 > I am currently trying to get MDB data into a PostgreSQL database. > Running >=20 > mdb-export -S -I StazioniAutomatiche.mdb Misure > ... > INSERT INTO Misure (Id_Misura, Descrizione_Misura, UM) VALUES (236,"Tensi= one minima giornaliera batteria","V") > ... >=20 > To make PostgreSQL happy, a semicolon is needed at the end of each > line (also reported: > http://sourceforge.net/mailarchive/forum.php?thread_id=3D7234522&forum_i= d=3D5183 > ). I have patched src/util/mdb-export.c accordingly (line 185), but I fee= l > that this should go somehow into CVS. >=20 > A second problem is that all " (double) quotes need to be ' (single) quot= es, > otherwise PostgreSQL won't insert. Not sure where to fix this one in > the C code. >=20 > I have a shell workaround using tr and sed, but would prefer a fix in > the source code (to avoid future traps). >=20 > Thanks >=20 > Markus >=20 >=20 >=20 > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practic= es > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & Q= A > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > mdbtools-dev mailing list > mdb...@li... > https://lists.sourceforge.net/lists/listinfo/mdbtools-dev > |