SetTableSchema
ODBPPLib.IODBPP.SetTableSchema changes the schema of a table.void SetTableSchema ( uint tableId, TableSchema schema, object fieldMapping );
Parameters
tableId | the table Id defining the table's handle. |
schema | pointer to a valid schema or null to rebuild table as is. |
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. |
Return Values
SearchTokenIndex returns the total amount of object found in the search.Remarks
- If fieldMapping parameter is missing, than SetTableSchema will map the first fixed field to the first fixed field, the second fixed field to the second and so on, plus the first variable field to the first variable field and so on.
- SetTableSchema is not part of the transaction.
- When schema equals NULL SetTableSchema attempts a rebuild and/or upgrade for the table file to its current standard and this will also open the table.
Example Use
- C#
public static uint FIRST_TABLE = 1; private void button1_Click(object sender, EventArgs e){ try{ ODBPPLib.ODBPP odbpp = new ODBPPLib.ODBPP(); odbpp.OpenDatabase("C:\\My\\Database\\Control\\File.odc"); odbpp.BeginTransaction(odbpp.SHARED, 60000); odbpp.OpenTable(FIRST_TABLE); ODBPPLib.TableSchema schema = odbpp.GetTableSchema(FIRST_TABLE); if(schema.indexes.Count > 0){ schema.indexes.Remove(schema.indexes.Count-1); odbpp.SetTableSchema(FIRST_TABLE,schema,null); } } catch (Exception e1) { MessageBox.Show(e1.Message); } }
Also See
GetTableSchemaListen All
Comments (0)