[Lazarus] TPQConnection.CreateDB: ENCODING, OWNER, TEMPLATE, LC_CTYPE, TABLESPACE

silvioprog silvioprog at gmail.com
Thu Oct 30 05:23:59 CET 2014


On Wed, Oct 29, 2014 at 8:26 AM, Joost van der Sluis <joost at cnoc.nl> wrote:
>
> 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.

hehe...

I tried using the PG driver (modifying the internal ExecuteDirectPG) and it
didn't work too. I'll send a small project showing all steps to reproduce
the problem.

With TProcess + PSQL worked only on Linux. I'll send this test too.

> 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.

Yes yes, I use that, and most of the time I send a diff to the bugtracker
lol.

ps. I'm so very glad for SQLdb allows me to create classes like
"TConnection.GetInstance.Insert/Update/Delete" that returns the record ID
instead of rowsaffected and a "TConnection.GetInstance.RawQuery/Query" that
returns my own TCursor or a TArrayList<TMyObject> instead of a tdataset. @.@

> Well, calling Java with a TProcess works also obviously...

=)

I love sqldb and fcl-*, but the problem needed to be solved urgently,
forcing me to a workaround. =D

-- 
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20141030/c97f0ea7/attachment-0003.html>


More information about the Lazarus mailing list