Add Large Object support to database programmatically

Поиск
Список
Период
Сортировка
От acordner
Тема Add Large Object support to database programmatically
Дата
Msg-id 25283311.post@talk.nabble.com
обсуждение исходный текст
Ответы Re: Add Large Object support to database programmatically  (Richard Huxton <dev@archonet.com>)
Re: Add Large Object support to database programmatically  (acordner <alan.cordner@hartscientific.com>)
Список pgsql-general
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-tp25283311p25283311.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


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

Предыдущее
От: Edoardo Panfili
Дата:
Сообщение: Re: add a value to an ENUM type
Следующее
От: Christopher Condit
Дата:
Сообщение: query speed question