FileDb Represents an open FileDb database file. None of the FileDb classes are re-entrant - access to the class objects must be syncronised by the calling application. Return a List of custom objects filtered by the filter parameter. A FilterExpression representing the desired filter. A new List of custom objects with the requested Records Return a List of custom objects filtered by the filter parameter. Only the specified Fields will be in the Table. A FilterExpression representing the desired filter. The desired fields to be in the returned Table A new List of custom objects with the requested Records and Fields Return a List of custom objects filtered by the filter parameter. Only the specified Fields will be in the Table. A FilterExpression representing the desired filter. The desired fields to be in the returned Table A list of one or more fields to order the returned table by, or null for default order. If an orderByField is prefixed with "!", that field will sorted in reverse order. A new List of custom objects with the requested Records and Fields ordered by the specified fields. Get all records matching the search expression in the indicated order, if any. Represents a single search expression, such as ID = 3 The list of fields to return or null for all fields If true, an additional Field named "index" will be returned which is the ordinal index of the Record in the database, which can be used in GetRecordByIndex and UpdateRecordByIndex. A list of one or more fields to order the returned table by, or null for default order. If an orderByField is prefixed with "!", that field will sorted in reverse order. A new List of custom objects with the requested Records and Fields Return a List of custom objects filtered by the filter parameter. A FilterExpressionGroup representing the desired filter. A new List of custom objects with the requested Records Return a List of custom objects filtered by the filter parameter. Only the specified Fields will be in the Table. A FilterExpression representing the desired filter. The desired fields to be in the returned Table A new List of custom objects with the requested Records and Fields Return a List of custom objects filtered by the filter parameter. Only the specified Fields will be in the Table. A FilterExpression representing the desired filter. The desired fields to be in the returned Table A list of one or more fields to order the returned table by, or null for default order. If an orderByField is prefixed with "!", that field will sorted in reverse order. A new List of custom objects with the requested Records and Fields in the specified order Get all records matching the FilterExpressionGroup in the indicated order, if any. Represents a compound search expression, such as FirstName = "John" AND LastName = "Smith" The list of fields to return or null for all fields Specify whether to include the record index as one of the Fields A list of one or more fields to order the returned table by, or null for default order. If an orderByField is prefixed with "!", that field will sorted in reverse order. A new List of custom objects with the requested Records and Fields Return a List of custom objects filtered by the filter parameter. A string representing the desired filter, eg. LastName = 'Fuller' A new List of custom objects with the requested Records Return a List of custom objects filtered by the filter parameter. Only the specified Fields will be in the Table. A string representing the desired filter, eg. LastName = 'Fuller' The desired fields to be in the returned Table A new List of custom objects with the requested Records and Fields Return a List of custom objects filtered by the filter parameter. Only the specified Fields will be in the Table. A string representing the desired filter, eg. LastName = 'Fuller' The desired fields to be in the returned Table A list of one or more fields to order the returned table by, or null for default order. If an orderByField is prefixed with "!", that field will sorted in reverse order. A new List of custom objects with the requested Records and Fields ordered by the specified list Return a List of custom objects filtered by the filter parameter. A string representing the desired filter, eg. LastName = 'Fuller' The desired fields to be in the returned Table If true, an additional Field named "index" will be returned which is the ordinal index of the Record in the database, which can be used in GetRecordByIndex and UpdateRecordByIndex A list of one or more fields to order the returned table by, or null for default order. If an orderByField is prefixed with "!", that field will sorted in reverse order A new List of custom objects with the requested Records and Fields Return all records in the database (table). A table containing all Records and Fields. Return all records in the database (table). The list of Fields to return or null for all Fields A table containing all rows. Return all records in the database (table). The list of fields to return or null for all Fields A list of one or more fields to order the returned table by, or null for default order A table containing all rows. Return all records in the database (table). Specify whether to include the Record index as one of the Fields A table containing all rows. Return all records in the database (table). The list of fields to return or null for all fields Specify whether to include the record index as one of the Fields A list of one or more fields to order the returned table by, or null for default order A table containing all Records and the specified Fields. Returns a single custom object at the current location. Meant to be used ONLY in conjunction with the MoveFirst/MoveNext methods. The list of fields to return or null for all fields Specify whether to include the record index as one of the Fields A new object or null Returns a single custom object specified by the index. The index of the record to return. This value can be obtained from Record returning queries by specifying true for the includeIndex parameter. The list of fields to return or null for all fields A new object or null Returns a single custom object specified by the primary key value or record number. The primary key value. For databases without a primary key, 'key' is the zero-based record number in the table. The list of fields to return or null for all fields Specify whether to include the record index as one of the Fields A new object or null Open the indicated database file. The filename of the database file to open. It can be a fully qualified path or, if no path is specified the current folder will be used. Open the indicated database file for encryption. Encryption is "all or nothing", meaning all records are either encrypted or not. The filename of the database file to open. It can be a fully qualified path or, if no path is specified the current folder will be used. A string value to use as the encryption key Close an open database. Create a new database file. If the file exists, it will be overwritten. The full pathname of the file. Array of Fields for the new database. Delete an existing database. The pathname of the file to delete. Add a new record to the database using the name-value pairs in the FieldValues object. Note that not all fields must be represented. Missing fields will be set to default values (0, empty or null). Note that only Array datatypes can NULL. The name-value pairs to add. The volatile index of the newly added record. Return a Table of Records filtered by the filter parameter. A FilterExpression representing the desired filter. A new Table with the requested Records Return a Table of Records filtered by the filter parameter. Only the specified Fields will be in the Table. A FilterExpression representing the desired filter. The desired fields to be in the returned Table A new Table with the requested Records and Fields Return a Table of Records filtered by the filter parameter. Only the specified Fields will be in the Table. A FilterExpression representing the desired filter. The desired fields to be in the returned Table A list of one or more fields to order the returned table by, or null for default order. If an orderByField is prefixed with "!", that field will sorted in reverse order. A new Table with the requested Records and Fields ordered by the specified fields. Get all records matching the search expression in the indicated order, if any. Represents a single search expression, such as ID = 3 The list of fields to return or null for all fields If true, an additional Field named "index" will be returned which is the ordinal index of the Record in the database, which can be used in GetRecordByIndex and UpdateRecordByIndex. A list of one or more fields to order the returned table by, or null for default order. If an orderByField is prefixed with "!", that field will sorted in reverse order. A new Table with the requested Records and Fields Return a Table of Records filtered by the filter parameter. A FilterExpressionGroup representing the desired filter. A new Table with the requested Records Return a Table of Records filtered by the filter parameter. Only the specified Fields will be in the Table. A FilterExpression representing the desired filter. The desired fields to be in the returned Table A new Table with the requested Records and Fields Return a Table of Records filtered by the filter parameter. Only the specified Fields will be in the Table. A FilterExpression representing the desired filter. The desired fields to be in the returned Table A list of one or more fields to order the returned table by, or null for default order. If an orderByField is prefixed with "!", that field will sorted in reverse order. A new Table with the requested Records and Fields in the specified order Get all records matching the FilterExpressionGroup in the indicated order, if any. Represents a compound search expression, such as FirstName = "John" AND LastName = "Smith" The list of fields to return or null for all fields Specify whether to include the record index as one of the Fields A list of one or more fields to order the returned table by, or null for default order. If an orderByField is prefixed with "!", that field will sorted in reverse order. A new Table with the requested Records and Fields Return a Table of Records filtered by the filter parameter. A string representing the desired filter, eg. LastName = 'Fuller' A new Table with the requested Records Return a Table of Records filtered by the filter parameter. Only the specified Fields will be in the Table. A string representing the desired filter, eg. LastName = 'Fuller' The desired fields to be in the returned Table A new Table with the requested Records and Fields Return a Table of Records filtered by the filter parameter. Only the specified Fields will be in the Table. A string representing the desired filter, eg. LastName = 'Fuller' The desired fields to be in the returned Table A list of one or more fields to order the returned table by, or null for default order. If an orderByField is prefixed with "!", that field will sorted in reverse order. A new Table with the requested Records and Fields ordered by the specified list Return a Table of Records filtered by the filter parameter. A string representing the desired filter, eg. LastName = 'Fuller' The desired fields to be in the returned Table If true, an additional Field named "index" will be returned which is the ordinal index of the Record in the database, which can be used in GetRecordByIndex and UpdateRecordByIndex A list of one or more fields to order the returned table by, or null for default order. If an orderByField is prefixed with "!", that field will sorted in reverse order A new Table with the requested Records and Fields Return all records in the database (table). A table containing all Records and Fields. Return all records in the database (table). The list of Fields to return or null for all Fields A table containing all rows. Return all records in the database (table). The list of fields to return or null for all Fields A list of one or more fields to order the returned table by, or null for default order A table containing all rows. Return all records in the database (table). Specify whether to include the Record index as one of the Fields A table containing all rows. Return all records in the database (table). The list of fields to return or null for all fields Specify whether to include the record index as one of the Fields A list of one or more fields to order the returned table by, or null for default order A table containing all Records and the specified Fields. Returns a single Record object at the current location. Meant to be used ONLY in conjunction with the MoveFirst/MoveNext methods. The list of fields to return or null for all fields Specify whether to include the record index as one of the Fields A Record object or null Returns a single Record object specified by the index. The index of the record to return. This value can be obtained from Record returning queries by specifying true for the includeIndex parameter. The list of fields to return or null for all fields A Record object or null Returns a single Record object specified by the primary key value or record number. The primary key value. For databases without a primary key, 'key' is the zero-based record number in the table. The list of fields to return or null for all fields Specify whether to include the record index as one of the Fields A Record object or null Update the record at the indicated index. To get the index, you would need to first get a record from the database then use the index field from it. The index is only valid until a database operation which would invalidate it, such as adding/deleting a record, or changing the value of a primary key. The record values to update The index of the record to update Update the record with the indicated primary key value. The record values to update The primary key value of the record to update Update all records which match the search criteria using the values in record. The search expression, e.g. ID = 100 A list of name-value pairs to use to update the matching records The number of records which were updated. Update all records which match the compound search criteria using the values in record. The compound search expression, e.g. FirstName = "John" AND LastName = "Smith" A list of name-value pairs to use to update the matching records The number of records which were updated. Update all records which match the filter expression using the values in record. The filter to use, eg. "~LastName = 'peacock' OR ~FirstName = 'nancy'". This filter string will be parsed using FilterExpressionGroup.Parse. A list of name-value pairs to use to update the matching records The number of records which were updated. Delete the record at the specified index. You would normally get the index from a previous query. This index is only valid until a record has been deleted. The zero-based index of the record to delete. true if the record was deleted, false otherwise Delete the record with the specified primary key value The primary key value of the record to delete true if the record was deleted, false otherwise Delete all records which match the search criteria. The search expression, e.g. ID = 100 The number of records deleted Delete all records which match the compound search criteria. The compound search expression, e.g. FirstName = "John" AND LastName = "Smith" The number of records deleted Delete all records which match the filter criteria. The filter to use, eg. "~LastName = 'peacock' OR ~FirstName = 'nancy'". This filter string will be parsed using FilterExpressionGroup.Parse. The number of records deleted Move to the first record in the index. Use this in conjunction with MoveNext and GetCurrentRecord Move to the next record in the index. Use this in conjunction with MoveFirst and GetCurrentRecord Call this to remove deleted records from the file (compact). Call this to write the index and flush the stream buffer to disk. Flushing will be done automatically if AutoFlush is On (and only writes the index if necessary), whereas this call always writes the index. You can use this to periodically write everything to disk rather than each time as with AutoFlush. Flush is always called when the file is closed, however in that case the index is only written if AutoFlush is set to Off. Call this method to reindex the database if your index file should be deleted or corrupted. Allows you to set an encryption key after the database has been opened. You must set the encryption key before reading or writing to the database. Encryption is "all or nothing", meaning all records are either encrypted or not. A string value to use as the encryption key Encrypt a string value. Not syncronized. The key to use for encryption The value to encrypt The encrypted value as a string Decrypt a string value. Not syncronized. The key to use for decryption The value to decrypt The decrypted value as a string A string value which can be used to keep track of the database version for changes The fields of the database (table). The number of records in the database (table). Doesn't include deleted records. The number of deleted records which not yet cleaned from the file. Call the Clean method to remove all deleted records and compact the file. Configures autoclean. When an edit or delete is made, the record is normally not removed from the data file - only the index. After repeated edits/deletions, the data file may become very big with deleted (non-removed) records. A cleanup is normally done with the cleanup() method. Autoclean will do this automatically, keeping the number of deleted records to under the threshold value. To turn off autoclean, set threshold to a negative value. Specifies whether to automatically flush data buffers and write the index after each operation in which the file was updated. When AutoFlush is not On, the index is not written until the file is closed or Flush is called. You can set AutoFlush to Off just before performing a bulk operation to dramatically increase performance, then set it back On after. When you set it back On after it was Off, everything is flushed immediately because the assumption is that it was needed, so you don't need to call Flush in this case. Setting AutoFlush On is most useful for when you aren't able to guarantee that you will be able to call Close before the program closes. This way the file won't become corrupt in this case. Tests to see if a database is currently open. Allow ability to store meta data in the DB file. MetaData must be one of the supported DataTypes: String, Byte, Int, UInt, Float, Double, Bool, DateTime and also Byte[] Specifies the data type for database Fields Specifies the type of match for FilterExpressions with String data types Specifies the comparison operator to use for FilterExpressions Boolean operands to use to join FilterExpressions Use this class for single field searches. Create a FilterExpression with the indicated values The name of the Field to filter on The Field value to filter on The Equality operator to use in the value comparison Create a FilterExpression with the indicated values The name of the Field to filter on The Field value to filter on The Equality operator to use in the value comparison The match type, eg. MatchType.Exact Parse the expression string to create a FilterExpressionGroup representing a simple expression. The string expression. Example: LastName = 'Fuller' A new FilterExpression representing the simple expression Create a FilterExpression of type "IN". This type is a HashSet of the values which will be used to filter the query. The name of the Field which will be used in the FilterExpressions A Table to use to build the IN FilterExpressions The name of the Field in the Table which holds the value to be used to build the IN FilterExpressions A new FilterExpression Create a FilterExpression of type "IN". This type is a HashSet of the values which will be used to filter the query. The name of the Field which will be used in the FilterExpressions A List of custom objects to use to build the IN FilterExpression The name of the Property of the custom class which holds the value to be used to build the IN FilterExpression A new FilterExpression Use this class to group FilterExpression and FilterExpressionGroup to form compound search expressions. All expressions in the group will be evaluated by the same boolean And/Or operation. Use multiple FilterExpressionGroups to form any combination of And/Or logic. Parse the expression string to create a FilterExpressionGroup representing a compound expression. The string compound expression. Example: (FirstName ~= 'andrew' OR FirstName ~= 'nancy') AND LastName = 'Fuller' A new FilterExpressionGroup representing the compound expression Constructor Open the database files ---------------------------------------------------------------------------------------- record must have all fields ---------------------------------------------------------------------------------------- record must have all fields Configures autoclean. When an edit or delete is made, the record is normally not removed from the data file - only the index. After repeated edits/deletions, the data file may become very big with deleted (non-removed) records. A cleanup is normally done with the cleanup() method. Autoclean will do this automatically, keeping the number of deleted records to under the threshold value. To turn off autoclean, set threshold to a negative value. number of deleted records to have at any one time ---------------------------------------------------------------------------------------- Read all records to create new index. Remove all deleted records Removes an entry from the database INDEX only - it appears deleted, but the actual data is only removed from the file when a cleanup() is called. Int32 or string primary key used to identify record to remove. For databases without primary keys, it is the record number (zero based) in the table. true if a record was removed, false otherwise Removes an entry from the database INDEX only - it appears deleted, but the actual data is only removed from the file when a cleanup() is called. The record number (zero based) in the table to remove true on success, false otherwise Removes entries from the database INDEX only, based on the result of a regular expression match on a given field - records appear deleted, but the actual data is only removed from the file when a cleanup() is called. number of records removed move to the first index position Move the current index position to the next database item. true if advanced to a new item, false if there are none left Return the current record in the database. Note that the current iterator pointer is not moved in any way. retrieves a record based on the specified key primary key used to identify record to retrieve. For databases without primary keys, it is the record number (zero based) in the table. if true, an extra field called 'IFIELD' will be added to each record returned. It will contain an Int32 that specifies the original position in the database (zero based) that the record is positioned. It might be useful when an orderby is used, and a future operation on a record is required, given it's index in the table. record if found, or false otherwise retrieves a record based on the record number in the table (zero based) zero based record number to retrieve Searches the database for an item, and returns true if found, false otherwise. rimary key of record to search for, or the record number (zero based) for databases without a primary key true if found, false otherwise Returns the number of records in the database the number of records in the database Returns the number of deleted records in the database, that would be removed if cleanup() is called. the number of deleted records in the database Returns the current database schema in the same form as that used in the parameter for the create(...) method. Flush the in-memory buffers to disk Helper Helper Use this version if you will need to add/remove indices function to write the index values. We assume the database has been locked before calling this function. to keep track of null fields in written record Use this version only if all of the fields are present and in the correct order in the array Use this version only if all of the fields are present and in the correct order in the array Write a single field to the file ------------------------------------------------------------------------------ Private function to perform a binary search file offsets into the .dat file, it must be ordered by primary key. the left most index to start searching from the right most index to start searching from the search target we're looking for -[insert pos+1] when not found, or the array index+1 when found. Note that we don't return the normal position, because we can't differentiate between -0 and +0. Helper Private function to read a record from the database size does not include the 4 byte record length, but only the total size of the fields function to read a record KEY from the database. Note that this function relies on the fact that they key is ALWAYS the first item in the database record as stored on disk. Reads a data type from a file. Note that arrays can only consist of other arrays, ints, and strings. Write the database schema and other meta information. Helper Summary description for HexEncoding. Creates a byte array from the hexadecimal string. Each two characters are combined to create one byte. First two hexadecimal characters become first byte in returned array. Non-hexadecimal characters are ignored. string to convert to byte array number of characters in string ignored byte array, in the same left-to-right order as the hexString Determines if given string is in proper hexadecimal string format Returns true is c is a hexadecimal digit (A-F, a-f, 0-9) Character to test true if hex digit, false if not Converts 1 or 2 character string into equivalant byte value 1 or 2 character string byte Represents a column of the database (table). Use this constructor when creating a new database. The ordinal index of the field will be the order it was added to the field list, unless a primary key field is specified and wasn't the first in the list. In this case the primary key field will be moved to the first in the list so that its always first. The name of the field The data type of the field Use this constructor when you need to create a Records list manually rather than using one retured from a query. In this case, you must set the field ordinal index for each field, starting at zero. The name of the field The data type of the field The zero-based ordinal index of the field The name of the field. The type of the field. The zero-based ordinal index of the field. Indicates if this is the one and only primary key field Indicate if this is an Array type field Used for auto-increment fields. Set to the number which you want incrementing to begin. Set to -1 if not an auto-increment field. Returns true if this is an auto-increment field, false otherwise Comment for the field User property to associate a value with this Field Represents data for a row, a Record consists of name-value pairs. Used when adding data to the database and by the Record object to store data returned from queries. Represents a single row returned from a query. It will contain one or more fields of the database (table). The last column may be the index of the row (if requested), which is the zero-based position of the record in the index. If there is no primary key specified for the database (table), then the index is the record number in the order in which the row was added to the database. Create a Record object with the indicated Fields and values. If creating a list of Record objects (for a Records list) be sure to use the same Fields list for each Record. Tests to see if the indicated field is in this Record true if the field is in this Record Return the integer field value. The name of the field The integer field value Return the integer field value. The ordinal index of the field The integer field value Return the unsigned integer field value. The name of the field The unsigned integer field value Return the unsigned integer field value. The ordinal index of the field The unsigned integer field value Return the String field value. The name of the field The String field value Return the String field value. The ordinal index of the field The String field value Return the Byte field value. The name of the field The Byte field value Return the Byte field value. The ordinal index of the field The Byte field value Return the Single field value. The name of the field The Single field value Return the Single field value. The ordinal index of the field The Single field value Return the Double field value. The name of the field The Double field value Return the Double field value. The ordinal index of the field The Double field value Return the Boolean field value. The name of the field The Boolean field value Return the Boolean field value. The ordinal index of the field The Boolean field value Return the DateTime field value. The name of the field The DateTime field value Return the DateTime field value. The ordinal index of the field The DateTime field value The number of fields in the Record A property which is used for integrating with the binding framework. Used by the Record class for enumerating in foreach contructs A List of Records A list of Fields Represents a data table returned from a query. A table is made up of Fields and Records. Create a table with the indicated Fields and records. If copyFields is true, a new Fields list is created and a copy of each field is made and its ordinal adjusted. Otherwise the original Fields object is adopted. You should pass false for copyFields only if you created the Fields list and its Field objects yourself. The Fields list to use The record data Indicates whether to make a copy of the Fields object and each Field. Create a table with the indicated Fields and records. If copyFields is true, a new Fields list is created and a copy of each field is made and its ordinal adjusted. Otherwise the original Fields object is adopted. You should pass false for copyFields only if you created the Fields list and its Field objects yourself and the Fields in the Record objects match the data in the Record. The Fields list to use The record data Indicates whether to make a copy of the Fields object and each Field. Create a new Record with all of the fields of the Table. The Record is not added to the Table. To do this, call Records.Add. Save this Table to the indicated file as a new database. If the file exists it will be overwritten. The new database will be just as if you had created it from scratch. The full path and filename of the new database Return a Table of Records filtered by the filter parameter. A string representing the desired filter, eg. LastName = 'Fuller' A new Table with the requested Records Return a Table of Records filtered by the filter parameter. Only the specified Fields will be in the Table. A string representing the desired filter, eg. LastName = 'Fuller' The desired fields to be in the returned Table A new Table with the requested Records and Fields Return a Table of Records filtered by the filter parameter. Only the specified Fields will be in the Table. A string representing the desired filter, eg. LastName = 'Fuller' The desired fields to be in the returned Table A list of one or more fields to order the returned table by, or null for default order. If an orderByField is prefixed with "!", that field will sorted in reverse order. A new Table with the requested Records and Fields ordered by the specified list Return a Table of Records filtered by the filter parameter. A FilterExpression representing the desired filter. A new Table with the requested Records Return a Table of Records filtered by the filter parameter. Only the specified Fields will be in the Table. A FilterExpression representing the desired filter. The desired fields to be in the returned Table A new Table with the requested Records and Fields Return a Table of Records filtered by the filter parameter. Only the specified Fields will be in the Table. A FilterExpression representing the desired filter. The desired fields to be in the returned Table A list of one or more fields to order the returned table by, or null for default order. If an orderByField is prefixed with "!", that field will sorted in reverse order. A new Table with the requested Records and Fields ordered by the specified fields. Return a Table of Records filtered by the filter parameter. A FilterExpressionGroup representing the desired filter. A new Table with the requested Records Return a Table of Records filtered by the filter parameter. Only the specified Fields will be in the Table. A FilterExpression representing the desired filter. The desired fields to be in the returned Table A new Table with the requested Records and Fields Return a Table of Records filtered by the filter parameter. Only the specified Fields will be in the Table. A FilterExpression representing the desired filter. The desired fields to be in the returned Table A list of one or more fields to order the returned table by, or null for default order. If an orderByField is prefixed with "!", that field will sorted in reverse order. A new Table with the requested Records and Fields in the specified order The Fields of the Table A simple class used to communicate property value changes to a Record. Used by WPF databinding.