xSQL Sample TL

This sample demonstrates an in-memory database with eXtremeDB Transaction Logging (TL) enabled. The log is written to a file; it is possible to make snapshots of the current database state.

The config file looks like the following:

 
    #
    #  Simple In-Memory configuration
    #
    database_name : imdb,
    database_size    :  20m,
     
    runtime_configuration : {
        debug_library : false,
        disk_support : false,
        shared_memory : false,
        transaction_manager : mursiw
      },
    schema : "
    #define uint2     unsigned<2>
     
    declare database  locatedb;
    class Employee
    {
      string name;
      uint2 dept_no;
 
      unique tree<name> Iname;
      tree<dept_no>     Idept;
    };
    ",
    db_params: {
        mem_page_size : 512,
        disk_page_size : 8192
    },
     
    tl_params : {
      flags : [iterable],
      log_path : "imdb.log",
      snapshot_path : "imdb.img",
      disk_page_size : 4096,
      flush_depth : 1,
      max_size : 1m,
      apply : auto,
      stopped : false
      },
       
    sql_trace : false,
    sql_port : 5500
         

Note that section schema defines the database with inline DDL text and the sql_statements section specifies the SQL statements to be executed once the database has been created.

This sample can be run from directory samples\xsql\configs\TL with the following command:

 
    ..\..\..\..\target\bin\xsql -c xsql.cfg -f imdb.img -i
     

With xSQL started in interactive mode, we can now execute SQL statements. For example:

 
    XSQL>select * from Employee;
     

To make a TL snapshot, type:

 
    XSQL>select tl_save('tl_snapshot.img');