pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Raymond <tchikeon@dso.org.sg>
To: pgsql-interfaces@postgresql.org
Subject: Large Object through ODBC
Date: Fri, 02 Mar 2001 17:22:03 +0800
Message-ID: <4.3.2.7.0.20010302165758.00a91950@192.168.1.204> (raw)
In-Reply-To: <Pine.LNX.4.21.0103021043570.28455-100000@nanu.visionforisr ael.com>
References: <200103012254.RAA25630@candle.pha.pa.us>

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

Message-ID: <4.3.2.7.0.20010302165758.00a91950@192.168.1.204>
Permalink:  ../4.3.2.7.0.20010302165758.00a91950@192.168.1.204/
Also on:    postgresql.org/message-id/4.3.2.7.0.20010302165758.00a91950@192.168.1.204

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: tchikeon@dso.org.sg
  Subject: Re: Large Object through ODBC
  In-Reply-To: <4.3.2.7.0.20010302165758.00a91950@192.168.1.204>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox