Subject Re: [firebird-support] API problem with SQL_LONG
Author Dmitry Yemanov
burmair wrote:
>
> static char* create_tbl = "CREATE TABLE dbinfo (when_created
> TIMESTAMP, name VARCHAR(32) PRIMARY KEY, age INTEGER, stuff BLOB)";
>
> static char* insert_data = "INSERT INTO dbinfo (when_created, name,
> age, stuff) VALUES (?, ?, ?, ?)";
>
> #if 0
> // This WORKS
> float age = 99.0;
> in_sqlda->sqlvar[2].sqldata = (char *)&age;
> in_sqlda->sqlvar[2].sqllen = sizeof(float);
> in_sqlda->sqlvar[2].sqltype = SQL_FLOAT;
> in_sqlda->sqlvar[2].sqlind = &flag2;
> #else
> // This does NOT work
> long age = 99;
> in_sqlda->sqlvar[2].sqldata = (char *)&age;
> in_sqlda->sqlvar[2].sqllen = sizeof(long);
> in_sqlda->sqlvar[2].sqltype = SQL_LONG;
> in_sqlda->sqlvar[2].sqlind = &flag2;
> #endif

What about:
int age = 99;
in_sqlda->sqlvar[2].sqldata = (char *)&age;
in_sqlda->sqlvar[2].sqllen = sizeof(int);
?

SQL_LONG means a 32-bit integer and it looks like your compiler defines
"long" as 64-bit.


Dmitry