Converting DBNUMERIC to C type variable

Converting DBNUMERIC to C type variable

Post by Harry Whitehous » Mon, 06 Apr 1998 05:00:00



Using the C DB library, I'm having a bit of a problem accessing a numeric
column.  The column has a format of 9,3.  When I access this row and bind
it:

 DBNUMERIC descending;

// successful query
 dbbind (dbproc, 13, NUMERICBIND,  0, (BYTE *)&descending);

I don't know how to convert the result (a structure) to , say, a float or
double.  I looked at dbconvert, but that didn't seem to be what I need.

How do I go about this?

TIA

Harry

 
 
 

1. extended stored procedures with DBNUMERIC data type

I am trying to return a large DWORD64 value from an extended stored
procedure and cannot seem to make it work.

The following excerpt works successfully with SRVINT4 data types:

    DWORD64 dw64Number;

    wsprintf(colname, "Output");
    srv_describe(srvproc, 1, colname, SRV_NULLTERM, SRVINT4, 0, SRVINT4, 0,
NULL);

    dw64Number = 2147483647;

    srv_setcoldata(srvproc, 1, &dw64Number);
    srv_sendrow(srvproc);

BOL says "If desttype is SRVDECIMAL or SRVNUMERIC, the srcdata parameter
must be a pointer to a DBNUMERIC or DBDECIMAL structure with the precision
and scale fields of the structure already set to the values you want. You
can use DEFAULTPRECISION to specify a default precision, and DEFAULTSCALE to
specify a default scale."

On that note, I tried the following.

    DWORD64 dw64Number;
    DBNUMERIC dbNumeric;

    dbNumeric.precision = 38;
    dbNumeric.scale = 0;

    wsprintf(colname, "Output");
    srv_describe(srvproc, 1, colname, SRV_NULLTERM, SRVNUMERIC, 0,
SRVNUMERIC, 0, &dbNumeric);

    dw64Number = 14757395258967641292;

    srv_setcoldata(srvproc, 1, &dw64Number);
    srv_sendrow(srvproc);

I'm missing something as I get 0 rows returned.

What am I doing wrong?  Can someone show me the correct way of returning a
value like 14757395258967641292 from an extended stored procedure?

Thanks in advance,

Damon

2. help ! : date, time, msaccess, not the best solution I guess...

3. dbNumeric type: how to get p and s?

4. esql/C++

5. Convert char data type to Date type

6. Recordset lost form to form

7. Converting OLEDB data types to VC++ data types

8. quoting and EXECUTE in plpgsql function

9. convert a money type to a format char type

10. Converting Timestamp type to an other type.......

11. Functions to convert date type to string type?

12. convert CHAR type to TEXT type (BLOB) and insert in table

13. ODS Programming and DBNUMERIC