Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Use of numeric/decimal data type in C++ API

4 posts in Ultralite Last posting was on 2012-03-01 17:58:00.0Z
Andr=?ISO-8859-1?B?6Q==?= Freitas Posted on 2012-02-14 18:22:23.0Z
Sender: 6984.4f3aa528.1804289383@sybase.com
From: Andr=?ISO-8859-1?B?6Q==?= Freitas
Newsgroups: sybase.public.sqlanywhere.ultralite
Subject: Use of numeric/decimal data type in C++ API
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4f3aa65f.69b6.1681692777@sybase.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
NNTP-Posting-Host: 172.20.134.41
X-Original-NNTP-Posting-Host: 172.20.134.41
Date: 14 Feb 2012 10:22:23 -0800
X-Trace: forums-1-dub 1329243743 172.20.134.41 (14 Feb 2012 10:22:23 -0800)
X-Original-Trace: 14 Feb 2012 10:22:23 -0800, 172.20.134.41
Lines: 16
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.sqlanywhere.ultralite:12688
Article PK: 1048461

Hi,

How do I read/set a numeric/decimal field in the C++ API,
using the ULResultset or ULPreparedStatement? I don't see a
GetDecimal method in the docs.

I'm aware of the fact that the decimal is not a native C++
type. But it is supported, for example, in the Cocoa API
(NSDecimalNumber). Had the C++ API returned a struct
containing the mantissa, exponent and sign, we could
translate it directly to an NSDecimalNumber instance and
vice-versa.

Regards,

André


"Nick Elson [Sybase An SAP Company]" < Posted on 2012-02-23 20:40:31.0Z
From: "Nick Elson [Sybase An SAP Company]" <@nick@dot@elson@at@sybase@dot@com@>
Newsgroups: sybase.public.sqlanywhere.ultralite
References: <4f3aa65f.69b6.1681692777@sybase.com>
In-Reply-To: <4f3aa65f.69b6.1681692777@sybase.com>
Subject: Re: Use of numeric/decimal data type in C++ API
Lines: 30
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original
Content-Transfer-Encoding: 8bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Windows Mail 6.0.6002.18197
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6002.18463
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4f46a43f$1@forums-1-dub>
Date: 23 Feb 2012 12:40:31 -0800
X-Trace: forums-1-dub 1330029631 10.22.241.152 (23 Feb 2012 12:40:31 -0800)
X-Original-Trace: 23 Feb 2012 12:40:31 -0800, vip152.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.sqlanywhere.ultralite:12689
Article PK: 1048475

There is a GetDecimal( ) method documented here:

http://dcx.sybase.com/index.html#1101/en/uldotnet_en11/uldatareader-getdecima-12832057042-0.html

which should support the requirements as I understand the question.

See also:
http://msdn.microsoft.com/en-us/library/System.Decimal.aspx
http://msdn.microsoft.com/en-us/library/cc716729.aspx


"Andr é Freitas" wrote in message
news:4f3aa65f.69b6.1681692777@sybase.com...
Hi,

How do I read/set a numeric/decimal field in the C++ API,
using the ULResultset or ULPreparedStatement? I don't see a
GetDecimal method in the docs.

I'm aware of the fact that the decimal is not a native C++
type. But it is supported, for example, in the Cocoa API
(NSDecimalNumber). Had the C++ API returned a struct
containing the mantissa, exponent and sign, we could
translate it directly to an NSDecimalNumber instance and
vice-versa.

Regards,

André


Andre Freitas Posted on 2012-02-24 18:45:13.0Z
Sender: 7768.4f47da4d.1804289383@sybase.com
From: Andre Freitas
Newsgroups: sybase.public.sqlanywhere.ultralite
Subject: Re: Use of numeric/decimal data type in C++ API
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4f47dab9.7787.1681692777@sybase.com>
References: <4f46a43f$1@forums-1-dub>
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
NNTP-Posting-Host: 172.20.134.41
X-Original-NNTP-Posting-Host: 172.20.134.41
Date: 24 Feb 2012 10:45:13 -0800
X-Trace: forums-1-dub 1330109113 172.20.134.41 (24 Feb 2012 10:45:13 -0800)
X-Original-Trace: 24 Feb 2012 10:45:13 -0800, 172.20.134.41
Lines: 44
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.sqlanywhere.ultralite:12690
Article PK: 1048477

Sorry Nick but the question is related to the C++ API
(documented here:
http://dcx.sybase.com/index.html#1101/en/ulc_en11/ulc-api.html)
, not the .NET API.

Regards,

Andre

> There is a GetDecimal( ) method documented here:
>
>
>
http://dcx.sybase.com/index.html#1101/en/uldotnet_en11/uldatareader-getdecima-12832057042-0.html
>
> which should support the requirements as I understand the
> question.
>
> See also:
>
>
http://msdn.microsoft.com/en-us/library/System.Decimal.aspx
> http://msdn.microsoft.com/en-us/library/cc716729.aspx
>
>
> "Andr é Freitas" wrote in message
> news:4f3aa65f.69b6.1681692777@sybase.com...
> Hi,
>
> How do I read/set a numeric/decimal field in the C++ API,
> using the ULResultset or ULPreparedStatement? I don't see
> a GetDecimal method in the docs.
>
> I'm aware of the fact that the decimal is not a native C++
> type. But it is supported, for example, in the Cocoa API
> (NSDecimalNumber). Had the C++ API returned a struct
> containing the mantissa, exponent and sign, we could
> translate it directly to an NSDecimalNumber instance and
> vice-versa.
>
> Regards,
>
> André
>


"Nick Elson [Sybase An SAP Company]" < Posted on 2012-03-01 17:58:00.0Z
From: "Nick Elson [Sybase An SAP Company]" <@nick@dot@elson@at@sybase@dot@com@>
Newsgroups: sybase.public.sqlanywhere.ultralite
References: <4f46a43f$1@forums-1-dub> <4f47dab9.7787.1681692777@sybase.com>
In-Reply-To: <4f47dab9.7787.1681692777@sybase.com>
Subject: Re: Use of numeric/decimal data type in C++ API
Lines: 83
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original
Content-Transfer-Encoding: 8bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Windows Mail 6.0.6002.18197
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6002.18463
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4f4fb8a8@forums-1-dub>
Date: 1 Mar 2012 09:58:00 -0800
X-Trace: forums-1-dub 1330624680 10.22.241.152 (1 Mar 2012 09:58:00 -0800)
X-Original-Trace: 1 Mar 2012 09:58:00 -0800, vip152.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.sqlanywhere.ultralite:12691
Article PK: 1048476

Yes indeed. You did say C++.
I guess that what happens when you do a rush post at the last
minute before heading out for a vacation. Also the reason for
the long delayed response.

The reason there is such a GetDecimal( ) method is because the
UL.Net implementation was written with the (specific) .Net framework
in mind.

The UL C++ API is more generic and does not target any frameworks
(neither from Apple/Next or MSoft or any other vendor) and the
C/C++ Language and standard libraries do not have such a targetted data
type ... so some manual mapping will be required. The only targetted type
supported currently are documented here
http://dcx.sybase.com/index.html#1201/en/ulc/ulc-ulcom-ulglobal-h-fil-ul-column-storage-type-enu.html
{I do appreciate we have done something to help out with GUIDs and
timestamps...}

Going to a char array with GetString( ) and parsing that is possibly the
best/easiest thing that can be done currently. Another option would
be to do your own manual multiplication by the column's scale
http://dcx.sybase.com/index.html#1201/en/ulc/ulc-ulcpp-ulresultsetschema-cla-getcolumnscale-met.html
in the select statement SQL and do the base-0 integer equivalent thing;
definitely awkward but a historical way of going.

O\W many times customer just tolerate floating point precision of a double
to cover their requirements.


It is possible the Apple/IOS/Objective-C target(s) may yet evolve still ...
so
do feel free to post your observations to the Product_Futures_Discussion
newsgroup.


HTH

"Andre Freitas" wrote in message news:4f47dab9.7787.1681692777@sybase.com...
Sorry Nick but the question is related to the C++ API
(documented here:
http://dcx.sybase.com/index.html#1101/en/ulc_en11/ulc-api.html)
, not the .NET API.

Regards,

Andre

> There is a GetDecimal( ) method documented here:
>
>
>
http://dcx.sybase.com/index.html#1101/en/uldotnet_en11/uldatareader-getdecima-12832057042-0.html
>
> which should support the requirements as I understand the
> question.
>
> See also:
>
>
http://msdn.microsoft.com/en-us/library/System.Decimal.aspx
> http://msdn.microsoft.com/en-us/library/cc716729.aspx
>
>
> "Andr é Freitas" wrote in message
> news:4f3aa65f.69b6.1681692777@sybase.com...
> Hi,
>
> How do I read/set a numeric/decimal field in the C++ API,
> using the ULResultset or ULPreparedStatement? I don't see
> a GetDecimal method in the docs.
>
> I'm aware of the fact that the decimal is not a native C++
> type. But it is supported, for example, in the Cocoa API
> (NSDecimalNumber). Had the C++ API returned a struct
> containing the mantissa, exponent and sign, we could
> translate it directly to an NSDecimalNumber instance and
> vice-versa.
>
> Regards,
>
> André
>