TScript Basic Write Queries

Update table_1 set UInt = ObjectID

In this query it shows how TScript handles the basic - update table_1 set UInt = ID64. The main thing to note is the use of the "Copy" method, this allows you to access directly the memory buffer pointed to by the "fixed" pointer, the offset and length of the UInt field is coming from the cashed table scheme.

The second main difference between a read and write query is the use of the methods RewriteObject and CommitTransaction. Both of these methods must be called to update an object, the RewriteObject tells the ODBMS that all modifications on the object have been complete and CommitTransaction tells the ODBMS to write all database modification to disk.

#include "ODBPP.ts"

public main(variable parameters = null : Structure results) {
   ODBPP database;
   ODBPP.Object objectHandle;
   if(database.ReadIndex(1,CODBPP::FIRST,0: objectHandle)){
      for(Reference fields = database.schemata[1].fields; true;){		
         if(!database.ReadIndex(1,CODBPP::NEXT,0: objectHandle)){
            if((error & 0xffff) != CODBPP::NOT_FOUND_INDEX_KEY) return error;
   else if((error & 0xffff) != CODBPP::NOT_FOUND_INDEX_KEY) return error;