FETCH statement using a descriptor

This is a discussion on FETCH statement using a descriptor within the Ingres Database forums in Other Databases category; Having solved my previous problem I am currently creating an SQLDA to use as a descriptor when FETCHing data in ESQLC I'm passing in a User Class object from OpenROAD as a handle, along with a SELECT statement and creating an SQLDA based on the data types, lengths, nullability of the class attributes, but only for the columns I want to SELECT (every column is an attribute of the class) Using examples in the doco I get a buffer full of data for each FETCH and can extract chars, varchars and dates from the buffer (as in the code ...

Go Back   Database Forum > Other Databases > Ingres Database

Database Forums

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 06-23-2008, 09:55 AM
Default FETCH statement using a descriptor

Having solved my previous problem I am currently creating an SQLDA to use as
a descriptor when FETCHing data in ESQLC

I'm passing in a User Class object from OpenROAD as a handle, along with a
SELECT statement and creating an SQLDA based on the data types, lengths,
nullability of the class attributes, but only for the columns I want to
SELECT (every column is an attribute of the class)

Using examples in the doco I get a buffer full of data for each FETCH and
can extract chars, varchars and dates from the buffer (as in the code
snippet in the Dynamic SQL section of the ESQLC guide) using sqltype and
sqllen. However I am unable to work out how to convert the results in the
buffer into the respective integer or float columns

I'm also having trouble getting my program to determine which values are
null or not

If ANYONE has even done dynamic SQL in C then I could REALLY do with some
assistance

Regards

Colin




Reply With Quote
  #2  
Old 06-23-2008, 10:18 AM
Default Re: FETCH statement using a descriptor

"Colin Hay" wrote in message
news:S2N7k.13878$IK1.398-at-news-server.bigpond.net.au...
> Having solved my previous problem I am currently creating an SQLDA to use
> as a descriptor when FETCHing data in ESQLC
>
> I'm passing in a User Class object from OpenROAD as a handle, along with a
> SELECT statement and creating an SQLDA based on the data types, lengths,
> nullability of the class attributes, but only for the columns I want to
> SELECT (every column is an attribute of the class)
>
> Using examples in the doco I get a buffer full of data for each FETCH and
> can extract chars, varchars and dates from the buffer (as in the code
> snippet in the Dynamic SQL section of the ESQLC guide) using sqltype and
> sqllen. However I am unable to work out how to convert the results in the
> buffer into the respective integer or float columns


You don't have to convert anything. You map the buffer out with suitable
amounts of space in the appropriate position and the values are deposited
there in a directly usable form.

> I'm also having trouble getting my program to determine which values are
> null or not


The null indicator is returned at the location pointed to by the sqlind in
the element of sqlvar[] that you are looking at.

> If ANYONE has even done dynamic SQL in C then I could REALLY do with some
> assistance


It's been a few years but I should be able to dredge up something for you.
Can you post code?

Roy

--
UK IUA 2009 will be held on Tuesday June 9, 2009
Go to http://www.iua.org.uk/member/signup....de_paysys=free
to join the mailing list.


Reply With Quote
Reply


Thread Tools
Display Modes



All times are GMT -4. The time now is 10:23 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Integrated by bbpixel2009 :: jvbPlugin R1013.368.1

Search Engine Friendly URLs by vBSEO 3.1.0
vB Ad Management by =RedTyger=
In an effort to better serve ads to our visitors, cookies are used on Mydatabasesupport.com. For more information, check out our Privacy Policy.