Subject | Re: [firebird-support] Dynamic SQL Error SQL error code = -804 |
---|---|
Author | Kurt Federspiel |
Post date | 2008-10-13T15:51:39Z |
I'm just bumping to see if I can get some help...
Kurt.
----- Original Message ----
From: Kurt Federspiel <federonline@...>
To: firebird-support@yahoogroups.com
Sent: Saturday, October 11, 2008 3:05:39 PM
Subject: [firebird-support] Dynamic SQL Error SQL error code = -804
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_transact ion( STAT1, &TR1 );
isc_dsql_free_ statement( STAT1, &STMT1, DSQL_drop);
free( SQLDA1 );
return bRetVal;
}
[Non-text portions of this message have been removed]
Kurt.
----- Original Message ----
From: Kurt Federspiel <federonline@...>
To: firebird-support@yahoogroups.com
Sent: Saturday, October 11, 2008 3:05:39 PM
Subject: [firebird-support] Dynamic SQL Error SQL error code = -804
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_transact ion( STAT1, &TR1 );
isc_dsql_free_ statement( STAT1, &STMT1, DSQL_drop);
free( SQLDA1 );
return bRetVal;
}
[Non-text portions of this message have been removed]