dbTalk Databases Forums  

[Info-Ingres] nvarchar and OAPI

comp.databases.ingres comp.databases.ingres


Discuss [Info-Ingres] nvarchar and OAPI in the comp.databases.ingres forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Martin Bowes
 
Posts: n/a

Default [Info-Ingres] nvarchar and OAPI - 05-05-2010 , 04:48 AM






Hi All,



Does anyone have a demo of using nvarchar types with OAPI handy?



I've looked in $II_SYSTEM/ingres/demo/api with no success on a 9.2.0
installation.



Martin Bowes

Reply With Quote
  #2  
Old   
Martin Bowes
 
Posts: n/a

Default Re: [Info-Ingres] nvarchar and OAPI - 05-05-2010 , 07:05 AM






Hi Grant

Both would be nice.

Marty

-----Original Message-----
From: Grant Croker [mailto:grant.croker (AT) ingres (DOT) com]
Sent: 05 May 2010 12:49
To: Martin Bowes
Subject: Re: [Info-Ingres] nvarchar and OAPI

On 05/05/10 11:48, Martin Bowes wrote:
Quote:

Hi All,

Does anyone have a demo of using nvarchar types with OAPI handy?

I've looked in $II_SYSTEM/ingres/demo/api with no success on a 9.2.0
installation.
What are you looking for in particular? Fetching, putting or both?

g

--
Grant Croker, Ingres Corp
Ingres PHP and Ruby maintainer
http://planetingres.org
We talked about how easy it was to make the mistake of
anthropomorphising animals, and projecting our own feelings and
perceptions on to them, where they were inappropriate and didn't fit. We
simply had no idea what it was like being an extremely large lizard, and
neither for that matter did the lizard, because it was not
self-conscious about being an extremely large lizard, it just got on
with the business of being one. To react with revulsion to its behaviour
was to make the mistake of applying criteria that are only appropriate
to the business of being human.

Reply With Quote
  #3  
Old   
Ingres Forums
 
Posts: n/a

Default Re: [Info-Ingres] nvarchar and OAPI - 05-07-2010 , 12:59 PM



Hi Martin,

Yes, the demo OAPI programs don't use nvarchar data types... All that
you need to do is to modify the demo app to use the nvarchar types...
That's about it.... For example, I have modified one of the demo API
program (apisrept.c) as follows to work the nvarchar data types.... And
make sure the demo program connects to a unicode enabled Ingres
database....

%> diff apisrept.c $II_SYSTEM/ingres/demo/api/apisrept.c
35c35
< "create table api_demo_rept( name nvarchar(20) not null, age i4
not null )";
---
Quote:
"create table api_demo_rept( name char(20) not null, age i4 not
null )";
120c120
< setDescrParm.sd_descriptor[0].ds_dataType = IIAPI_NVCH_TYPE;
---
Quote:
setDescrParm.sd_descriptor[0].ds_dataType = IIAPI_CHA_TYPE;
230c230
< setDescrParm.sd_descriptor[1].ds_dataType = IIAPI_NVCH_TYPE;
---
Quote:
setDescrParm.sd_descriptor[1].ds_dataType = IIAPI_CHA_TYPE;
Hope this helps....

Regards,
Usha


--
rajus01

Reply With Quote
  #4  
Old   
Grant Croker
 
Posts: n/a

Default Re: [Info-Ingres] nvarchar and OAPI - 05-12-2010 , 09:57 AM



The following was sent privately to Marty but should have been posted here since it might be useful for others.

Your best bet is to look at the PHP driver as it does both, dynamically.
By that I mean most of the examples under demo/api are based on static
buffers, so even if you had an IIAPI_NVCH_TYPE example you might
struggle to understand it.

See http://svn.php.net/viewvc/pecl/ingre...34&view=markup
for the source code to the driver. The code makes the assumption that
all data from/to Ingres is in UTF-16. If
your application is dealing with ISO-Latin-1/UTF-8 then you have to
convert to UTF-16 when sending before OpenAPI/DBMS will do anything
useful, and vice versa for retrieval.

Fetching of data is handled php_ii_fetch(), sending/binding of params is
in php_ii_bind_params(). Like with IIAPI_VCH_TYPE the first 2 bytes of
dv_value contain the length in code points, to get the byte length
you'll need to multiply by 2. Consequently the reverse is the case when
sending data back to Ingres. If you search for IIAPI_NVCH_TYPE within
those two functions you should have what you need.

Feel free to email me any questions you might have.

g


On 05/05/10 14:05, Martin Bowes wrote:
Quote:
Hi Grant

Both would be nice.

Marty

-----Original Message-----
From: Grant Croker [mailto:grant.croker (AT) ingres (DOT) com]
Sent: 05 May 2010 12:49
To: Martin Bowes
Subject: Re: [Info-Ingres] nvarchar and OAPI

On 05/05/10 11:48, Martin Bowes wrote:


Hi All,

Does anyone have a demo of using nvarchar types with OAPI handy?

I've looked in $II_SYSTEM/ingres/demo/api with no success on a 9.2.0
installation.

What are you looking for in particular? Fetching, putting or both?

g


--
Grant Croker, Ingres Corp
Ingres PHP and Ruby maintainer
http://planetingres.org

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.