[Lazarus] TPQConnection.CreateDB: ENCODING, OWNER, TEMPLATE, LC_CTYPE, TABLESPACE
Joost van der Sluis
joost at cnoc.nl
Wed Oct 29 12:26:30 CET 2014
On 10/28/2014 02:03 AM, silvioprog wrote:
> On Wed, Oct 8, 2014 at 12:44 PM, Michael Van Canneyt
>
> Hello buddy, sorry for my long delay.
>
> Thanks for the great tip, I tried it too, but unfortunately the postgre
> rejected that talking something like "unrecognized param for this
> operation".
>
> Today I fixed that using a "mix of codes": creating the database using
> the original postgre driver for Java, and calling "java -jar create_mydb
> <params>" via TProcess. Now it worked like a charm!
Damn, that looks difficult. You know that the bindings for the postgres
driver are available for fpc? What you need is PQexec(Handle, 'create
mydb <params'); That's all.
And sqldb is not some magical tool, it's just a wrapper around this
driver. You could have looked at TPQConnection.CreateDB and
TPQConnection.ExecuteDirectPG. That way you could have added the
parameters that you want. (If I look at ExecuteDirectPG, the parameters
are only passed when a connection to the DB is made, not when it's
created. It's trivial to add, though)
Or you can just copy-paste the code and use a modified version of it in
your application.
Well, calling Java with a TProcess works also obviously...
Joost.
More information about the Lazarus
mailing list