Ejemplo n.º 1
0
static
void BasicArray(){
  ndbout << "Testing basic array operations" << endl;
  
  // Basic insert
  DBA_ArrayInsertRows(EmpB, EMP_TABLE_DATA, Rows-2, insertCallback);
  NdbSleep_SecSleep(1);
  DBA_ArrayReadRows(EmpB, EMP_TABLE_DATA_READ, Rows-2, readCallback);
  NdbSleep_SecSleep(1);
  CompareRows(EMP_TABLE_DATA, Rows-2, EMP_TABLE_DATA_READ);
  
  // Basic update
  AlterRows(EMP_TABLE_DATA, Rows-2);
  DBA_ArrayUpdateRows(EmpB, EMP_TABLE_DATA, Rows-2, updateCallback);
  NdbSleep_SecSleep(1);
  DBA_ArrayReadRows(EmpB, EMP_TABLE_DATA_READ, Rows-2, readCallback);
  NdbSleep_SecSleep(1);
  CompareRows(EMP_TABLE_DATA, Rows-2, EMP_TABLE_DATA_READ);
  
  // Basic write
  AlterRows(EMP_TABLE_DATA, Rows);
  DBA_ArrayWriteRows(EmpB, EMP_TABLE_DATA, Rows, writeCallback);
  NdbSleep_SecSleep(1);
  DBA_ArrayReadRows(EmpB, EMP_TABLE_DATA_READ, Rows, readCallback);
  NdbSleep_SecSleep(1);
  CompareRows(EMP_TABLE_DATA, Rows, EMP_TABLE_DATA_READ);
  
  // Basic delete
  DBA_ArrayDeleteRows(EmpB, EMP_TABLE_DATA, Rows, deleteCallback);
  NdbSleep_SecSleep(1);
}
Ejemplo n.º 2
0
static
void Multi(){
  ndbout << "Testing multi operations" << endl;

  DBA_ArrayInsertRows(EmpB, EMP_TABLE_DATA, Rows-2, insertCallback);
  DBA_ArrayInsertRows(AddB, ADD_TABLE_DATA, Rows-2, insertCallback);
  NdbSleep_SecSleep(1);
  
  const int R2 = Rows + Rows;
  
  DBA_Binding_t * Bindings[2];
  DBA_BulkReadResultSet_t DataRead[R2];
  
  Bindings[0] = EmpB;
  Bindings[1] = AddB;
  
  for(int i = 0; i<Rows; i++)
    DataRead[i].DataPtr = &EMP_TABLE_DATA_READ[i];
  
  for(int i = 0; i<Rows; i++)
    DataRead[i+Rows].DataPtr = &ADD_TABLE_DATA_READ[i];
  
  NdbSleep_SecSleep(1);

  DBA_BulkMultiReadRows(Bindings, DataRead, 2, Rows, readCallback);
  NdbSleep_SecSleep(1);
  CompareRows(EMP_TABLE_DATA, Rows-2, EMP_TABLE_DATA_READ);
  CompareRows(ADD_TABLE_DATA, Rows-2, ADD_TABLE_DATA_READ);
  
  require(CountRows(DataRead, R2) == (R2-4));

  // Basic delete
  DBA_ArrayDeleteRows(EmpB, EMP_TABLE_DATA, Rows-2, deleteCallback);
  DBA_ArrayDeleteRows(AddB, ADD_TABLE_DATA, Rows-2, deleteCallback);
  NdbSleep_SecSleep(1);
}
Ejemplo n.º 3
0
static
void BasicPtr(){
  ndbout << "Testing array of pointer operations" << endl;
  
  // Basic insert
  DBA_ArrayInsertRows(EmpB, EMP_TABLE_DATA, Rows-2, insertCallback);
  NdbSleep_SecSleep(1);

  DBA_BulkReadResultSet_t EmpDataRead[Rows];
  for(int i = 0; i<Rows; i++){
    EmpDataRead[i].DataPtr = &EMP_TABLE_DATA_READ[i];
  }
  
  DBA_BulkReadRows(EmpB, EmpDataRead, Rows, readCallback);
  NdbSleep_SecSleep(1);
  CompareRows(EMP_TABLE_DATA, Rows-2, EMP_TABLE_DATA_READ);
  require(CountRows(EmpDataRead, Rows) == (Rows-2));
  
  // Basic delete
  DBA_ArrayDeleteRows(EmpB, EMP_TABLE_DATA, Rows-2, deleteCallback);
  NdbSleep_SecSleep(1);
}