Re: mdb-export with -I and -N

"George L. Emigh" <[email protected]> Mon, 30 Jan 2012 17:54 -0500
Newsgroups gmane.comp.db.mdb-tools.devel
Message-ID <[email protected]>
Nirgal wrote:

> On Friday 27 January 2012 19:32:58 George L. Emigh wrote:
>> (...) ran into another problem, wanted
>> to add a prefix to the table names using the -N <namespace> option.
>> 
>> for -N qp mdb-schema gives:
>> DROP TABLE [qp_Customer Table];
>> CREATE TABLE [qp_Customer Table]
>> 
>> which is what I expected, but mdb-export -I mysql -N qp gives:
>> INSERT INTO qp`Customer Table` (
>> 
>> Namespaces is not mentioned in the man pages but is when you run the
>> command without any options, is Namespaces going to be removed?
> 
> Ops. My mistake. I just comited a fix regarding namespaces:
> 
> $ src/util/mdb-export -I mysql ~/Desktop/uuid.mdb table1I
> INSERT INTO `table1` (`test2`, `test`) VALUES ("OK",NULL);
> INSERT INTO `table1` (`test2`, `test`) VALUES ("OK",NULL);
> 
> $ src/util/mdb-export -I mysql -N qp ~/Desktop/uuid.mdb table1I
> INSERT INTO `qp_table1` (`test2`, `test`) VALUES ("OK",NULL);
> INSERT INTO `qp_table1` (`test2`, `test`) VALUES ("OK",NULL);
> 
> $ src/util/mdb-export -I postgres ~/Desktop/uuid.mdb table1
> INSERT INTO "table1" ("test2", "test") VALUES ("OK",NULL);
> INSERT INTO "table1" ("test2", "test") VALUES ("OK",NULL);
> 
> $ src/util/mdb-export -I postgres -N qp ~/Desktop/uuid.mdb table1
> INSERT INTO "qp"."table1" ("test2", "test") VALUES ("OK",NULL);
> INSERT INTO "qp"."table1" ("test2", "test") VALUES ("OK",NULL);
> 
> Patch is available at:
> 
https://github.com/brianb/mdbtools/commit/7e34078bcc9a7b23ab028db969cdf77c0b283752

Excellent, thanks.

> 
>> Also I see the sanitize option is gone, will that option to convert
>> spaces
>> to underscores be coming back?  I liked the feature, convert all fields
>> and table names to lowercase would be nice too, but for now I'll just
>> alter my tables after the conversion.
> 
> I don't plan to work on sanitizing again (but maybe someone else will).
> Non-ascii tables results in duplicate names. For exemple, chinese names
> will create tables "___" "___". One need to add something to diferentiate
> them, such as a number: "___1" "___2". Then you need to store new names
> for handling foreign contraints, and so on. Not trivial at all.
> With the proper escape now working, I don't see the point.
> Removing spaces from table names after mysql conversion seems a bit out of
> scope, in my opinion.


That part was not and should never actually a big problem, I am an old guy 
who dislikes spaces in things like table and field names and prefer them 
lower case as well, so it was just an issue of preference, and I changed 
everything to my liking with a little php scripting and I'm moving forward 
on my project.

So it's obviously not necessary to have those things part of mdbtools.

Thanks again for a fantastic tool.


> 
> Cheers
> 
> 
------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
-- 
George L. Emigh - AB4BD




------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2