Base class for MySQL database drivers.

package core_database_drivers

 Methods

Find whether the database may run GROUP BY unfettered with restrictions on the SELECT'd fields having to be represented in it or aggregate functions

can_arbitrary_groupby() : boolean

Returns

booleanWhether it can

Change the primary key of a table.

db_change_primary_key(\ID_TEXT $table_name, array $new_key, array $db) 

Parameters

$table_name

\ID_TEXT

The name of the table to create the index on

$new_key

array

A list of fields to put in the new key

$db

array

The DB connection to make on

Close the database connections. We don't really need to close them (will close at exit), just disassociate so we can refresh them.

db_close_connections() 

Create a table index.

db_create_index(\ID_TEXT $table_name, \ID_TEXT $index_name, string $_fields, array $db) 

Parameters

$table_name

\ID_TEXT

The name of the table to create the index on

$index_name

\ID_TEXT

The index name (not really important at all)

$_fields

string

Part of the SQL query: a comma-separated list of fields to use on the index

$db

array

The DB connection to make on

Create a new table.

db_create_table(\ID_TEXT $table_name, array $fields, array $db, \ID_TEXT $raw_table_name, boolean $save_bytes = false

Parameters

$table_name

\ID_TEXT

The table name

$fields

array

A map of field names to Composr field types (with *#? encodings)

$db

array

The DB connection to make on

$raw_table_name

\ID_TEXT

The table name with no table prefix

$save_bytes

boolean

Whether to use lower-byte table storage, with tradeoffs of not being able to support all unicode characters; use this if key length is an issue

Get the default password for making db connections (used by the installer as a default).

db_default_password() : string

Returns

stringThe default password for db connections

Get the default user for making db connections (used by the installer as a default).

db_default_user() : string

Returns

stringThe default user for db connections

Delete a table.

db_drop_table_if_exists(\ID_TEXT $table, array $db) 

Parameters

$table

\ID_TEXT

The table name

$db

array

The DB connection to delete on

This function is internal to the database system, allowing SQL statements to be build up appropriately. Some databases require IS NULL to be used to check for blank strings.

db_empty_is_null() : boolean

Returns

booleanWhether a blank string IS NULL

Encode a LIKE string comparision fragement for the database system. The pattern is a mixture of characters and ? and % wilcard symbols.

db_encode_like(string $pattern) : string

Parameters

$pattern

string

The pattern

Returns

stringThe encoded pattern

Assemble part of a WHERE clause for doing full-text search

db_full_text_assemble(string $content, boolean $boolean) : string

Parameters

$content

string

Our match string (assumes "?" has been stripped already)

$boolean

boolean

Whether to do a boolean full text search

Returns

stringPart of a WHERE clause for doing full-text search

Get the ID of the first row in an auto-increment table (used whenever we need to reference the first).

db_get_first_id() : integer

Returns

integerFirst ID used

Get a map of Composr field types, to actual database types.

db_get_type_remap() : array

Returns

arrayThe map

Find whether expression ordering support is present

db_has_expression_ordering(array $db) : boolean

Parameters

$db

array

A DB connection

Returns

booleanWhether it is

Determine whether the database is a flat file database, and thus not have a meaningful connect username and password.

db_is_flat_file_simple() : boolean

Returns

booleanWhether the database is a flat file database

Encode an SQL statement fragment for a conditional to see if two strings are equal.

db_string_equal_to(\ID_TEXT $attribute, string $compare) : string

Parameters

$attribute

\ID_TEXT

The attribute

$compare

string

The comparison

Returns

stringThe SQL

Encode an SQL statement fragment for a conditional to see if two strings are not equal.

db_string_not_equal_to(\ID_TEXT $attribute, string $compare) : string

Parameters

$attribute

\ID_TEXT

The attribute

$compare

string

The comparison

Returns

stringThe SQL

Whether to use InnoDB for MySQL. Change this function by hand - official only MyISAM supported

using_innodb() : boolean

Returns

booleanAnswer