Re: Add Large Object support to database programmatically

Поиск
Список
Период
Сортировка
От acordner
Тема Re: Add Large Object support to database programmatically
Дата
Msg-id 25295203.post@talk.nabble.com
обсуждение исходный текст
Ответ на Add Large Object support to database programmatically  (acordner <alan.cordner@hartscientific.com>)
Список pgsql-general
Wow, do I feel stupid now! After creating the database, 15 tables and a
trigger using the same exact process, I somehow overlooked adding the spaces
to the front of each line. %-|

Thanks, that worked great! I guess I stared at the code too long to see it.



acordner wrote:
>
> I have been working to create a VB6 program to automatically create a
> PostgreSQL database, tables and triggers for an application I am updating.
> I have everything working great, except one of my tables needs to store a
> bitmap image. I am using the Large Object (lo) contrib module to do this.
> Using pgAdmin III, I can run the Query Tool and load the lo.sql file from
> the \share\contrib folder and execute it on my database and it succeeds.
>
> What I need to be able to do is load this contrib module on the fly from
> VB6 after creating my database. Using the content of the lo.sql file, I
> created the following code:
>
>
> Private Function AddLargeObjectDataType(connConnection As
> ADODB.Connection) As Boolean
> Dim cmdCommand As New ADODB.Command
>
>     With cmdCommand
>         .ActiveConnection = conConnection
>         .CommandType = adCmdText
>         .CommandText = "SET search_path = public; CREATE DOMAIN lo AS
> pg_catalog.oid;" _
>                         & "CREATE FUNCTION lo_oid(lo) RETURNS
> pg_catalog.oid AS" _
>                         & "'SELECT $1::pg_catalog.oid' LANGUAGE SQL STRICT
> IMMUTABLE;" _
>                         & "CREATE FUNCTION lo_manage() RETURNS
> pg_catalog.trigger" _
>                         & "AS '$libdir/lo' LANGUAGE C;"
>         Call .Execute
>     End With
>     Set cmdCommand = Nothing
> End Function
>
> However, when I execute this code, I get a SQL "syntax error at or near
> '$libdir/lo'" and the contrib module is not loaded. So I tried using a
> hard coded path 'C:\Program Files\PostgreSQL\8.1\lib\lo' instead of
> '$libdir/lo' and it also fails. I tried using double backslashes, same
> result. Forward slashes, same result.
>
> Any ideas?
>

--
View this message in context:
http://www.nabble.com/Add-Large-Object-support-to-database-programmatically-tp25283311p25295203.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


В списке pgsql-general по дате отправления:

Предыдущее
От: Alban Hertroys
Дата:
Сообщение: Re: where clause question
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: where clause question