Index Class |
Namespace: Telogis.GeoBase.Transactional
The Index type exposes the following members.
Name | Description | |
---|---|---|
Fields |
Gets a list of the fields in this Index.
| |
Table |
Gets the Table used for this Index.
|
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Query |
Performs a query of this table using a specified index. A set of filters
can also be specified to narrow the result set.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
static TransactionalRepository InitRepository(String fname) { // // if the repository file doesn't exist then it will be created // bool created = !System.IO.File.Exists(fname); TransactionalRepository tr = new TransactionalRepository(fname); // // If we created a new repository file then the repository is empty // and we must create the appropriate tables // if (created) { Console.WriteLine("Creating transactional repository structure"); // Creating tables and indexes must occur within a transaction tr.BeginTransaction(); // create table(s) and some columns... ... // // Create some indexes to allow us to query the table contents // myCustomerTable.CreateIndex("name_address", new IndexColumn[3] { new IndexColumn("CustomerName"), new IndexColumn("Address"), new IndexColumn("Phone") }); myVehicleTable.CreateIndex("vehicle_details", new IndexColumn[4] { new IndexColumn("Type"), new IndexColumn("Weight"), new IndexColumn("Axles"), new IndexColumn("Height") }); // at this point you may want to fill the table with some // initial data... tr.EndTransaction; } else { Console.WriteLine("Loaded transactional repository from disk."); Console.WriteLine("I didn't need to create any tables, columns or indexes."); } return tr; }
Index idx_customers = myCustomerTable.Indexes["name_address"]; ContainsFilter phoneContains = new ContainsFilter("Phone", "866"); EqualFilter nameIs = new EqualFilter("CustomerName", "My Corporate"); ColumnFilter[] filters = new ColumnFilter[2] { phoneContains, nameIs }; using (EnsureTransaction trans = new EnsureTransaction(myTransactionalRepository)) { // we can now display the address of each customer from 'My Corporate' whose phone // number contains '866' foreach (Record r in idx_customers.Query(filters)) { Console.WriteLine("{0}, {1}, {2}", r["CustomerName"], r["Address"], r["Phone"]); } ... }