Page 1 of 1

Runtime database create

Posted: 10.04.2006, 16:12
by Shomer
Hi there! I am new here and new to Zeos. I am trying to issue such statment but I even can imagine how:

CREATE DATABASE "dd01" WITH OWNER = "postgres" ENCODING = 'latin1' TABLESPACE = "pg_default" LOCATION = 'c:\teste' TEMPLATE = "postgres";

On that example, dd01 would be a parameterized name, also the location. How I can create a database programmatically? With Firebird it was a very easy function. What Zeos components I should use? I am working with the 6.5.1 alpha-version.

Thank you!

Magno

Posted: 10.04.2006, 18:43
by zippo
What's the error?

Posted: 11.04.2006, 09:52
by btrewern
I'd use a TZQuery and just ExecSQL the query. I doubt you can use parameters to create this type of query so just create the above string and use that.

Ben.

Posted: 03.05.2006, 16:30
by Shomer
Solved! I use ZProcessor with something such:

Add('CREATE DATABASE "'+myDatabaseName+'" WITH ENCODING = ''latin1'' TABLESPACE = "pg_default"; ');

Works fine! :)