![]() |
![]() |
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| DelevopersObjectDatabase++ APISet Table Schema |
unsigned int SetTableSchema ( unsigned int tableID, const CODBPP::Schema *schema = NULL, const unsigned int *fieldMapping = NULL );
| tableID | The table ID defining the table's handle. |
| schema | Pointer to a valid schema. |
| fieldMapping | An array of int values allowing this method to map field from there old schema
to the new - eg. fieldMapping[0] = 2, will move the value in the first field of
the old table into the third field of the new table. Sub fields are appended to
the end so that <fields><sub fields 1><sub fields 2> and so
no.
|
int length;
CODBPP database;
CODBPP::Schema *schema;
if(database.OpenDatabase(_T"YourDatabase") == NO_ERROR
&& (error = database.BeginTransaction(CODBPP::EXCLUSIVE)) == NO_ERROR
&& (error = database.OpenTable(1)) == NO_ERROR
&& (error = database.GetTableSchema(1,NULL,&length)) == NO_ERROR){
schema = (CODBPP::Schema*) new BYTE[length];
if((error = database.GetTableSchema(1,schema)) == NO_ERROR){
//removes the last index if there is one
if(schema.indexCount > 0){
schema.indexCount--;
error = database.SetTableSchema(1,schema);
}
}
delete [] (LPBYTE)schema;
}
if(error && database.GetErrorMessage(&message) == NO_ERROR)
MessageBox(message);
database.EndTransaction();
Copyright © 2003-2008, Ekky Software Pty. Ltd.