From: | Raymond <tchikeon(at)dso(dot)org(dot)sg> |
---|---|
To: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | Large Object through ODBC |
Date: | 2001-03-02 09:22:03 |
Message-ID: | 4.3.2.7.0.20010302165758.00a91950@192.168.1.204 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
hi,
i'm a newbie to PostgresQL, currently trying to use the ODBC
driver. i'm connecting from my Win98 machine to a PostgresQL installation
on a Linux box. i'm trying out the sample code from the MSDN concerning
sending large objects through ODBC but i cannot get the code to work.
What i did is create a test table with (id int, obj lo) and then
just try to insert some data into it. The strange things is that after the
executestatement, it does not even return a SQL_NEED_DATA even though i
have binded the parameter to a SQL_LONGVARBINARY. it just finished with the
executino and over at the database side, an empty large object is created,
i've attached the code and logs from the ODBC driver below. Hope someone
can point out what am i doing wrong here. Thanks!
Code
-----------------------------
retcode = SQLPrepare ( hstmt, (unsigned char*)"INSERT INTO a (id , obj)
VALUES ( ? , ? ) ",SQL_NTS );
SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_ULONG, SQL_INTEGER, 0, 0,
&sID, 0, &cbID);
SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_BINARY,
SQL_LONGVARBINARY, 0, 0, (SQLPOINTER)2, 0, &cbObj);
cbObj = SQL_LEN_DATA_AT_EXEC(0);
sID = 1;
retcode = SQLExecute(hstmt);
if (retcode == SQL_NEED_DATA) {
printf("Need Data\n");
}
-----------------------------
Log
-----------------------------
conn=15272060, SQLDriverConnect( in)='DSN=POSTGRESQL;', DriverCompletion=0
DSN info:
DSN='POSTGRESQL',onlyread='0',protocol='6.4',showoid='1',fakeoidindex='0',showsystable='0'
conn_settings='' translation_dll='',translation_option=''
Global Options: Version='06.50.0000', fetch=100, socket=4096,
unknown_sizes=0, max_varchar_size=254, max_longvarchar_size=8190,
disable_optimizer=1, ksqo=1, unique_index=0, use_declarefetch=0,
text_as_longvarchar=1, unknowns_as_longvarchar=0, bools_as_char=1,
extra_systable_prefixes='dd_;', conn_settings=''
conn=15272060, query=' '
conn=15272060, query='set DateStyle to 'ISO''
conn=15272060, query='set geqo to 'OFF''
conn=15272060, query='set ksqo to 'ON''
conn=15272060, query='select oid from pg_type where typname='lo''
[ fetched 1 rows ]
[ Large Object oid = 350752 ]
conn=15272060,
SQLDriverConnect(out)='DSN=POSTGRESQL;DATABASE=test;READONLY=0;PROTOCOL=6.4;FAKEOIDINDEX=0;SHOWOIDCOLUMN=1;ROWVERSIONING=0;SHOWSYSTEMTABLES=0;CONNSETTINGS='
conn=15272060, query='BEGIN'
conn=15272060, query='COMMIT'
conn=15272060, query='BEGIN'
conn=15272060, query='INSERT INTO a (id , obj) VALUES ( 100 , '4157953' ) '
conn=15272060, query='COMMIT'
conn=15272060, SQLDisconnect
-----------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Max Khon | 2001-03-02 09:34:34 | Re: JDBC error codes to detect duplicates? |
Previous Message | Peter T Mount | 2001-03-02 09:09:35 | Re: JDBC error codes to detect duplicates? |