Getting Started

Downloading and exploring the code behind the The Getting Started Application is a good way to see STSdb R3.5 in action. You can create and fill a table with sample data and use some predefined functions for inserting, updating, reading, sorting and inserting a blob data.

Examples

 Open the database and create a simple table

using (StorageEngine engine = StorageEngine.FromFile("test.stsdb"))
{
    //create the table
    var table = engine.Scheme.CreateOrOpenXTable(new Locator("table_name"));

    //commit changes to the scheme
    engine.Scheme.Commit();
 
    //add records to the table
    for (int i = 0; i < 10000; i++)
    {
        table[i] = i.ToString();
    }
 
    //commit table changes
    table.Commit();
}
Read the table
using (StorageEngine engine = StorageEngine.FromFile("test.stsdb"))
{
    var table = engine.Scheme.CreateOrOpenXTable(new Locator("table_name"));
 
    foreach (var row in table.Forward()) //table.Backward()
    {
        Console.WriteLine("{0} {1}", row.Key, row.Record);
    }
}

Last edited Aug 17, 2013 at 9:16 AM by SvetoslavMateev, version 5

Comments

No comments yet.