programming.nbk: Home | Index | Next Page: Tcl Mk4Tcl: Defining the view | Previous Page: Tcl Mk4Tcl: Changing Views


 Tcl Mk4Tcl: Data Types

Data Types

Normally, every property you store in a view will be stored as a string. In MetaKit, you don't have to predefine the lengths of the strings you'll store; the data file will adjust to accommodate whatever length of strings you store.

If you want, you can specify that some properties are stored not as strings, but as other data types. This can be handy because it helps MetaKit store things more efficiently. If all values assigned to a property are fairly small integers, telling MetaKit that only integers will be stored in that property makes for more efficient storage. As with strings, MetaKit will attempt to use the smallest amount of storage possible. If you specify that a field will hold integers, and you only ever store values of 0 or 1, MetaKit will pack this integer property for eight different rows into a single byte.

Data types are specified by adding a "type specifier" to the name of the property when you specify it in the mk::view layout command. You can't have two properties with the same name but different type specifiers. For example, the type specifier for an integer property is ":I", so you might use something like:

    mk::view layout db.employees "name employeeid:I salary"

Here is the list of valid data types and the corresponding type specifiers:

Next: Tcl Mk4Tcl: Changing Views


programming.nbk: Home | Index | Next Page: Tcl Mk4Tcl: Defining the view | Previous Page: Tcl Mk4Tcl: Changing Views


Notebook exported on Monday, 7 July 2008, 18:56:06 PM Eastern Daylight Time