dbTalk Databases Forums  

Insert using SQLDA

comp.databases.ingres comp.databases.ingres


Discuss Insert using SQLDA in the comp.databases.ingres forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Donson March
 
Posts: n/a

Default Insert using SQLDA - 01-27-2004 , 09:32 AM






I have the following code to do a prepared insert with place
holders(?) using SQLDA:
exec sql prepare pstatement into :sqlda from
"insert into table1(col1) values(?)";
checkError();
sqlda->sqlvar[0].sqldata = "some text";
sqlda->sqlvar[0].sqltype = -21;
sqlda->sqlvar[0].sqllen = strlen(sqlda->sqlvar[0].sqldata);
sqlda->sqlvar[0].sqlname.sqlnamel = 4;
static short ind = 0;
sqlda->sqlvar[0].sqlind = &ind;
sprintf(sqlda->sqlvar[0].sqlname.sqlnamec, "col1");
exec sql execute pstatement using descriptor :sqlda;
checkError();

I am getting the following Ingres Error(code -32000) when executing
the prepared statmenet:
E_US08FC line 1, Argument(s) missing.

Any idea on what I am doing wrong here? Thanks.

Reply With Quote
  #2  
Old   
Karl & Betty Schendel
 
Posts: n/a

Default Re: Insert using SQLDA - 01-27-2004 , 10:54 AM






At 7:32 AM -0800 1/27/2004, Donson March wrote:
Quote:
I have the following code to do a prepared insert with place
holders(?) using SQLDA:
exec sql prepare pstatement into :sqlda from
"insert into table1(col1) values(?)";
[snip]
I am getting the following Ingres Error(code -32000) when executing
the prepared statmenet:
E_US08FC line 1, Argument(s) missing.

Any idea on what I am doing wrong here? Thanks.

There's a counter in the sqlda (sqln? sqld? something like that)
that you have to set, showing the number of sqlvar's that you have set
up. You need to set it to 1.

I'm too lazy to look in the manual for the counter name but it's in
the manual along with all the other sqlda stuff.

Karl



Reply With Quote
  #3  
Old   
Donson March
 
Posts: n/a

Default Re: Insert using SQLDA - 01-28-2004 , 12:57 PM



Thank you, Karl, for your input.

I did set the sqln to 1. sqld will be set to 0 after describe since it
is a non-select query.

I have another question on this subject. Is it possible to use SQLDA
for non-select statement with unknown column names? For example,
insert into tablename values(?,?,?,?);
Or do I have to set up the SQLDA with sqlvar->sqlname?

Sample code would be really helpful.

Don

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.