An Open SQL Insert Example
This example shows how to use the Open SQL class
RWDBOSql in a Sybase Client-Library insert operation. The insert is done on a
foo table with an
int column and a
float column.
#define NUMBER_OF_ROWS 10
RWDBOSql openSql;
RWDBTBuffer<int> intBuffer(NUMBER_OF_ROWS); //1
RWDBTBuffer<float> floatBuffer(NUMBER_OF_ROWS);
FillupValues(intBuffer, floatBuffer, NUMBER_OF_ROWS); //2
RWCString sybaseSyntaxSql("INSERT INTO foo VALUES(@c1, @c2)"); //3
openSql.statement(sybaseSyntaxSql); //4
openSql << intBuffer; //5
openSql << floatBuffer;
openSql.execute(conn); //6
if( !openSql.isValid() ) //7
cout << “Insert Into Foo Has Failed” << endl;