An Open SQL Insert Example
This example shows how to use the Open SQL class
RWDBOSql in an Oracle insert operation. The insert is done on a
foo table with an
int column and a
float column.
const size_t NUMBER_OF_ROWS = 10;
RWDBOSql openSql;
RWDBTBuffer<int> intBuffer(NUMBER_OF_ROWS); //1
RWDBTBuffer<float> floatBuffer(NUMBER_OF_ROWS); //2
RWCString oracleSyntaxSql("INSERT INTO foo VALUES(:c1, :c2)"); //3
openSql.statement(oracleSyntaxSql); //4
openSql << intBuffer; //5
openSql << floatBuffer; //6
while (FillupValues(intBuffer, floatBuffer, NUMBER_OF_ROWS)){ //7
openSql.execute(conn); //8
if (!openSql.isValid()) { //9
cout << "Insert Into foo Has Failed" << endl;
break;
}
}