
RemoveTable
RemoveTable removes a selected table from the ObjectDatabase++ control file.unsigned __int64 RemoveTable ( unsigned int tableID, bool deleteFiles = true );
Parameters
| tableID | the table ID defining the table's handle. |
| deleteFiles | If this variable is set to true, RemoveTable deletes the *.odt, *.odi and *.odm files associated with the selected table from the disk, otherwise this method just removes the table entry from the control file. |
Return Values
If the method succeeds, the return value is zero else see error codes for more details.Remarks
- RemoveTable does not delete the table or any of its indexes if deleteFiles is set to false.
- RemoveTable is not part of the a transaction and can not be aborted, however the database does need to be in exclusive mode.
- You can use the AddTable method to add back a table after it has been removed.
Example Use
- C++
#include "ODBPP.h"
int wmain(int argc, wchar_t* argv[])
{
unsigned __int64 error;
const char16_t *message;
CODBPP database;
if((error = database.OpenDatabase(u"YourDatabase")) == NO_ERROR
&& (error = database.BeginTransaction(CODBPP::EXCLUSIVE)) == NO_ERROR){
error = database.RemoveTable(1);
}
if(error && database.GetErrorMessage(&message) == NO_ERROR)
MessageBox(message);
database.CloseDatabase();
return NO_ERROR;
}Also See
AddTable, CloseTable, CreateTable, OpenTableListen All
Comments (0)

