From: | acordner <alan(dot)cordner(at)hartscientific(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Add Large Object support to database programmatically |
Date: | 2009-09-03 20:15:11 |
Message-ID: | 25283311.post@talk.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Edoardo Panfili | 2009-09-03 20:28:11 | Re: add a value to an ENUM type |
Previous Message | Tom Lane | 2009-09-03 20:14:40 | Re: Getting "insufficient data left in message" on copy with binary |