Menu

#322 setByteIntParam does not works for predicate

V2.1 Beta
open
SQL API (45)
6
2009-02-06
2008-12-12
No

senario:

setByteIntParam does not works for predicate
CREATE TABLE T1(F1 INT,F2 SMALLINT,F3 CHAR(30),F4 FLOAT,F5 tinyint,F6 DATE,F7 TIME,F8 TIMESTAMP,F9 INT,F10 BIGINT, F11 BINARY(4));
Records are inserted . then records are fetch with out parametric condition ,it is working fine but for tinyint f5 giving parametric condition does not fetch any record.
some code for fetching record as below

strcpy(statement,"SELECT * FROM T1 where F5=?;");
rv = stmt->prepare(statement);
if(rv!=OK)
{
delete stmt;
delete con;
return 5;
}
stmt->setByteIntParam(1,f5var);
stmt->bindField(1,&f1var);
stmt->bindField(2,&f2var);
stmt->bindField(3,f3var);
stmt->bindField(4,&f4var);
stmt->bindField(5,&f5var);
stmt->bindField(6,&f6var);
stmt->bindField(7,&f7var);
stmt->bindField(8,&f8var);
stmt->bindField(9,&f9var);
stmt->bindField(10,&f10var);
stmt->bindField(11,f11var);
count=0;
rv = con->beginTrans();
if(rv!=OK)return 6;
stmt->execute(rows);
while(stmt->fetch() !=NULL)
{
for(int a=1;a<10;a++)
{
if(stmt->isFldNull(a)) printf("YES ");
else printf("NO ");
}
printf("\n");
printf("F1=%d | F2=%hd | F3=%s | F4=%f | F5=%d | DATE=%d-%d-%d | TIME=%d:%d:%d | TIMESTAMP=%d-%d-%d %d:%d:%d | F9=%d | F10=%lld ",f1var,f2var,f3var,f4var,f5var,f6var.year(),f6var.month(),f6var.dayOfMonth(),f7var.hours(),f7var.minutes(),f7var.seconds(),f8var.year(),f8var.month(),f8var.dayOfMonth(),f8var.hours(),f8var.minutes(),f8var.seconds(),f9var,f10var);
printf(" | ");
AllDataType::printVal(f11var,typeBinary,4);
printf("\n");
count++;
}

Discussion

  • Bijaya kumar Sahu

    In Gate way not working

     
  • Kishor Amballi

    Kishor Amballi - 2009-02-06
    • priority: 5 --> 6
    • assigned_to: nobody --> bijaya
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.