/sources/database_helper.php

Description
Functions
_check_sizes (line 32)

Check a set of fields aren't going to exceed key limits.

void _check_sizes (boolean $primary_key, array $fields, ID_TEXT $id_name, [boolean $skip_size_check = false], [boolean $skip_null_check = false])
  • boolean $primary_key: Whether this will be in a primary key
  • array $fields: The fields (a map between field name and field type [field type must start '*' if it is to be counted])
  • ID_TEXT $id_name: The name of what we are checking (only used to generate clear error messages)
  • boolean $skip_size_check: Whether to skip the size check for the table (only do this for addon modules that don't need to support anything other than mySQL)
  • boolean $skip_null_check: Whether to skip the check for NULL string fields
_helper_add_table_field (line 288)

Adds a field to an existing table.

void _helper_add_table_field (object Link $this_ref, ID_TEXT $table_name, ID_TEXT $name, ID_TEXT $_type, [?mixed $default = NULL])
  • object Link $this_ref: to the real database object
  • ID_TEXT $table_name: The table name
  • ID_TEXT $name: The field name
  • ID_TEXT $_type: The field type
  • ?mixed $default: The default value (NULL: no default)
_helper_alter_table_field (line 396)

Change the type of a DB field in a table. Note: this function does not support ascession/decession of translatability

void _helper_alter_table_field (object Link $this_ref, ID_TEXT $table_name, ID_TEXT $name, ID_TEXT $_type, [?ID_TEXT $new_name = NULL])
  • object Link $this_ref: to the real database object
  • ID_TEXT $table_name: The table name
  • ID_TEXT $name: The field name
  • ID_TEXT $_type: The new field type
  • ?ID_TEXT $new_name: The new field name (NULL: leave name)
_helper_change_primary_key (line 435)

Change the primary key of a table.

void _helper_change_primary_key (object Link $this_ref, ID_TEXT $table_name, array $new_key)
  • object Link $this_ref: to the real database object
  • ID_TEXT $table_name: The name of the table to create the index on
  • array $new_key: A list of fields to put in the new key
_helper_create_index (line 155)

Add an index to a table without disturbing the contents, after the table has been created.

void _helper_create_index (object Link $this_ref, ID_TEXT $table_name, ID_TEXT $index_name, array $fields, [ID_TEXT $unique_key_field = 'id'])
  • object Link $this_ref: to the real database object
  • ID_TEXT $table_name: The table name
  • ID_TEXT $index_name: The index name
  • array $fields: The fields
  • ID_TEXT $unique_key_field: The name of the unique key field for the table
_helper_create_table (line 115)

Create a table with the given name and the given array of field name to type mappings.

If a field type starts '*', then it is part of that field's key. If it starts '?', then it is an optional field.

void _helper_create_table (object Link $this_ref, ID_TEXT $table_name, array $fields, [boolean $skip_size_check = false], [boolean $skip_null_check = false])
  • object Link $this_ref: to the real database object
  • ID_TEXT $table_name: The table name
  • array $fields: The fields
  • boolean $skip_size_check: Whether to skip the size check for the table (only do this for addon modules that don't need to support anything other than mySQL)
  • boolean $skip_null_check: Whether to skip the check for NULL string fields
_helper_delete_index_if_exists (line 204)

Delete an index from a table.

void _helper_delete_index_if_exists (object Link $this_ref, ID_TEXT $table_name, ID_TEXT $index_name)
  • object Link $this_ref: to the real database object
  • ID_TEXT $table_name: The table name
  • ID_TEXT $index_name: The index name
_helper_delete_table_field (line 484)

Delete the specified field from the specified table.

void _helper_delete_table_field (object Link $this_ref, ID_TEXT $table_name, ID_TEXT $name)
  • object Link $this_ref: to the real database object
  • ID_TEXT $table_name: The table name
  • ID_TEXT $name: The field name
_helper_drop_if_exists (line 225)

Drop the given table, or if it doesn't exist, silently return.

void _helper_drop_if_exists (object Link $this_ref, ID_TEXT $table)
  • object Link $this_ref: to the real database object
  • ID_TEXT $table: The table name
_helper_promote_text_field_to_comcode (line 456)

If a text field has picked up Comcode support, we will need to run this.

void _helper_promote_text_field_to_comcode (object Link $this_ref, ID_TEXT $table_name, ID_TEXT $name, [ID_TEXT $key = 'id'], [integer $level = 2], [boolean $in_assembly = false])
  • object Link $this_ref: to the real database object
  • ID_TEXT $table_name: The table name
  • ID_TEXT $name: The field name
  • ID_TEXT $key: The tables key field name
  • integer $level: The translation level to use
  • boolean $in_assembly: Whether our data is already stored in Tempcode assembly format
_helper_refresh_field_definition (line 508)

If we've changed what $type is stored as, this function will need to be called to change the typing in the DB.

void _helper_refresh_field_definition (object Link $this_ref, ID_TEXT $type)
  • object Link $this_ref: to the real database object
  • ID_TEXT $type: The field type
_helper_rename_table (line 261)

Rename the given table.

void _helper_rename_table (object Link $this_ref, ID_TEXT $old, ID_TEXT $new)
  • object Link $this_ref: to the real database object
  • ID_TEXT $old: The old table name
  • ID_TEXT $new: The new table name

Documentation generated on Sun, 02 Jan 2011 23:12:52 +0000 by phpDocumentor 1.4.3