Runtime database create

Forum related to PostgreSQL

Moderators: gto, cipto_kh, EgonHugeist, olehs

Post Reply
Shomer
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 10.04.2006, 15:54

Runtime database create

Post 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
zippo
Silver Boarder
Silver Boarder
Posts: 322
Joined: 12.10.2005, 18:01
Location: Slovenia

Post by zippo »

What's the error?
btrewern
Expert Boarder
Expert Boarder
Posts: 193
Joined: 06.10.2005, 18:51

Post 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.
Shomer
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 10.04.2006, 15:54

Post by Shomer »

Solved! I use ZProcessor with something such:

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

Works fine! :)
Post Reply