How to represent SQL Server type numeric(38,0) as IDL type (COM type library)?
Thanks a lot for the help!
P.S. For example, SQL Server type int is long type in IDL.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Numbers in COM could be:
Int64) – so up to 19 significant digits;double) – from 15 – 17 significant decimal digits precision.So for 38 digits, none of those types would match your request. You can achieve the best resolution with
Int64, but if your value is higher than 9,223,372,036,854,775,807, you will reach an overflow.I think the easier compliant type is a good old BSTR (
widestring), in which you can store as many digit as wished – but encoded as plain text. On the code side, you will need to have a BCD library to process your high-resolution numbers: no Delphi native type (evenextended) has such a resolution.Edit: Another option (thanks Ondrej for the proposal) is an array of bytes. IMHO a COM binary array is less easy than a text content (and less efficient about speed, even if it uses less memory). Encoding option could be good old BCD. You may be able to find libraries on both sides of the COM object.