| Class | KirbyBase::KBTable |
| In: |
lib/kirbybase.rb
|
| Parent: | Object |
| VALID_FIELD_TYPES | = | [:String, :Integer, :Float, :Boolean, :Date, :Time, :DateTime, :Memo, :Blob, :ResultSet, :YAML] | Make constructor private. KBTable instances should only be created from KirbyBase#get_table. | |
| VALID_DEFAULT_TYPES | = | [:String, :Integer, :Float, :Boolean, :Date, :Time, :DateTime, :YAML] | ||
| VALID_INDEX_TYPES | = | [:String, :Integer, :Float, :Boolean, :Date, :Time, :DateTime] |
| clear | -> | delete_all |
| Alias delete_all to clear method. | ||
| db | [R] | |
| filename | [R] | |
| lookup_key | [R] | |
| name | [R] | |
| table_class | [R] |
Return a new instance of KBTable. Should never be called directly by your application. Should only be called from KirbyBase#get_table.
This has been declared private so user‘s cannot create new instances of KBTable from their application. A user gets a handle to a KBTable instance by calling KirbyBase#get_table for an existing table or KirbyBase.create_table for a new table.
Return true if data is correct type, false otherwise.
| data_type: | Symbol specifying data type. |
| value: | Value to convert to String. |
Return the record(s) whose recno field is included in index.
| index: | Array of Integer(s) specifying recno(s) you wish to select. |
Update record whose recno field equals index.
| index: | Integer specifying recno you wish to select. |
| updates: | Hash, Struct, or Array containing updates. |
Add a column to table.
Make sure you are executing this method while in single-user mode (i.e. not running in client/server mode).
| col_name: | Symbol of column name to add. |
| col_type: | Symbol (or Hash if includes field extras) of column type to add. |
| after: | Symbol of column name that you want to add this column after. |
Add an index to a column.
Make sure you are executing this method while in single-user mode (i.e. not running in client/server mode).
| col_names: | Array containing column name(s) of new index. |
Change a column‘s default value.
Make sure you are executing this method while in single-user mode (i.e. not running in client/server mode).
| col_name: | Symbol of column name. |
| value: | New default value for column. |
Change whether a column is required.
Make sure you are executing this method while in single-user mode (i.e. not running in client/server mode).
| col_name: | Symbol of column name. |
| required: | true or false. |
Change a column‘s type.
Make sure you are executing this method while in single-user mode (i.e. not running in client/server mode).
| col_name: | Symbol of column name. |
| col_type: | Symbol of new column type. |
Delete all records from table. You can also use delete_all.
| reset_recno_ctr: | true/false specifying whether recno counter should be reset to 0. |
Delete records from table and return # deleted.
| select_cond: | Proc containing code to select records. |
Drop a column from table.
Make sure you are executing this method while in single-user mode (i.e. not running in client/server mode).
| col_name: | Symbol of column name to add. |
Drop an index on a column(s).
Make sure you are executing this method while in single-user mode (i.e. not running in client/server mode).
| col_names: | Array containing column name(s) of new index. |
Rename a column.
Make sure you are executing this method while in single-user mode (i.e. not running in client/server mode).
| old_col_name: | Symbol of old column name. |
| new_col_name: | Symbol of new column name. |
Return array of records (Structs) matching select conditions. Select condition block should not contain references to any table column except :recno. If you need to select by other table columns than just :recno, use select instead.
| filter: | List of field names (Symbols) to include in result set. |
| select_cond: | Proc containing select code. |
Set fields of records to updated values. Returns number of records updated.
| recs: | Array of records (Structs) that will be updated. |
| data: | Hash, Struct, Proc containing updates. |