Subject | Dynamic SQL Error SQL error code = -804 |
---|---|
Author | Kurt Federspiel |
Post date | 2008-10-11T22:05:39Z |
Greets:
I'm on Ubuntu using 2.1-super (Marius install).
I know I'm missing something very mundane, but I've been at this for a couple days, and I can't seem to get my hands around why I'm having this issue. I added a STATUS table that maintains the current Status for Devices (PK to the Device table).
Thanks in advance...
Kurt.
All I want to know is if device 212 is on, and it looks like this:
int IS_ON = -1;
memset( szStatement, 0, sizeof(szStatement) );
sprintf( szStatement, "select IS_ON "
"from STATUS where DEVICE=%d ", iDevice );
#ifdef __DEBUG
// IF WE'RE DEBUGGING, KEEP A COPY...
strcpy( FACSDBQuery, szStatement );
#endif
SQLDA1 = (XSQLDA*)malloc( XSQLDA_LENGTH(1) );
SQLDA1->version = 1;
SQLDA1->sqln = 1;
// SET UP THE FIELDS RETURNED BY QUERY....
SQLDA1->sqlvar[0].sqldata = (char *) &IS_ON;
SQLDA1->sqlvar[0].sqltype = SQL_LONG;
SQLDA1->sqlvar[0].sqllen = sizeof(int);
// START THE TRANSATION....
bRetVal = StartQuery(STAT1, SQLDA1, szStatement, ErrorMsg );
// PROCESS THE RESULTS...
if( bRetVal == true )
{
memset( &ThisAHU, 0, sizeof(ThisAHU) );
if( 0 == isc_dsql_fetch(STAT1, &STMT1, 1, SQLDA1) )
{
ThisDEVICE.DEVICE = iDevice;
ThisDEVICE.IS_ON = IS_ON;
}
else
{
bRetVal = false;
}
}
// CHECK FOR AN ERROR MESSAGE...
StatError( STAT1, ErrorMsg );
isc_commit_transaction( STAT1, &TR1 );
isc_dsql_free_statement(STAT1, &STMT1, DSQL_drop);
free( SQLDA1 );
return bRetVal;
}
I'm on Ubuntu using 2.1-super (Marius install).
I know I'm missing something very mundane, but I've been at this for a couple days, and I can't seem to get my hands around why I'm having this issue. I added a STATUS table that maintains the current Status for Devices (PK to the Device table).
Thanks in advance...
Kurt.
All I want to know is if device 212 is on, and it looks like this:
int IS_ON = -1;
memset( szStatement, 0, sizeof(szStatement) );
sprintf( szStatement, "select IS_ON "
"from STATUS where DEVICE=%d ", iDevice );
#ifdef __DEBUG
// IF WE'RE DEBUGGING, KEEP A COPY...
strcpy( FACSDBQuery, szStatement );
#endif
SQLDA1 = (XSQLDA*)malloc( XSQLDA_LENGTH(1) );
SQLDA1->version = 1;
SQLDA1->sqln = 1;
// SET UP THE FIELDS RETURNED BY QUERY....
SQLDA1->sqlvar[0].sqldata = (char *) &IS_ON;
SQLDA1->sqlvar[0].sqltype = SQL_LONG;
SQLDA1->sqlvar[0].sqllen = sizeof(int);
// START THE TRANSATION....
bRetVal = StartQuery(STAT1, SQLDA1, szStatement, ErrorMsg );
// PROCESS THE RESULTS...
if( bRetVal == true )
{
memset( &ThisAHU, 0, sizeof(ThisAHU) );
if( 0 == isc_dsql_fetch(STAT1, &STMT1, 1, SQLDA1) )
{
ThisDEVICE.DEVICE = iDevice;
ThisDEVICE.IS_ON = IS_ON;
}
else
{
bRetVal = false;
}
}
// CHECK FOR AN ERROR MESSAGE...
StatError( STAT1, ErrorMsg );
isc_commit_transaction( STAT1, &TR1 );
isc_dsql_free_statement(STAT1, &STMT1, DSQL_drop);
free( SQLDA1 );
return bRetVal;
}