[ Index ]

PHP Cross Reference of MyBB 1.8.38

title

Body

[close]

/inc/ -> db_base.php (summary)

MyBB 1.8 Copyright 2014 MyBB Group, All Rights Reserved Website: http://www.mybb.com License: http://www.mybb.com/about/license

File Size: 467 lines (14 kb)
Included or required: 4 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

DB_Base:: (53 methods):
  connect()
  query()
  write_query()
  explain_query()
  fetch_array()
  fetch_field()
  data_seek()
  num_rows()
  insert_id()
  close()
  error_number()
  error_string()
  error()
  affected_rows()
  num_fields()
  list_tables()
  table_exists()
  field_exists()
  shutdown_query()
  simple_select()
  insert_query()
  insert_query_multiple()
  update_query()
  delete_query()
  escape_string()
  free_result()
  escape_string_like()
  get_version()
  optimize_table()
  analyze_table()
  show_create_table()
  show_fields_from()
  is_fulltext()
  supports_fulltext()
  index_exists()
  supports_fulltext_boolean()
  create_fulltext_index()
  drop_index()
  drop_table()
  rename_table()
  replace_query()
  drop_column()
  add_column()
  modify_column()
  rename_column()
  set_table_prefix()
  fetch_size()
  fetch_db_charsets()
  fetch_charset_collation()
  build_create_table_collation()
  get_execution_time()
  escape_binary()
  unescape_binary()


Interface: DB_Base  - X-Ref


connect($config)   X-Ref
Connect to the database server.
return: resource|PDOStatement|mysqli_result The DB connection resource. Returns false on fail or -1 on a db connect failure.
param: array $config Array of DBMS connection details.

query($string, $hide_errors=0, $write_query=0)   X-Ref
Query the database.
return: resource|PDOStatement|mysqli_result The query data.
param: string $string The query SQL.
param: integer|bool $hide_errors 1 if hide errors, 0 if not.
param: integer 1 $write_query if executes on master database, 0 if not.

write_query($query, $hide_errors=0)   X-Ref
Execute a write query on the master database
return: resource|PDOStatement|mysqli_result The query data.
param: string $query The query SQL.
param: boolean|int $hide_errors 1 if hide errors, 0 if not.

explain_query($string, $qtime)   X-Ref
Explain a query on the database.
param: string $string The query SQL.
param: string $qtime The time it took to perform the query.

fetch_array($query, $resulttype=1)   X-Ref
Return a result array for a query.
return: array The array of results.
param: resource|PDOStatement|mysqli_result $query The query ID.
param: int $resulttype The type of array to return. Specified with the different constants for the type using

fetch_field($query, $field, $row=false)   X-Ref
Return a specific field from a query.
param: resource|PDOStatement|mysqli_result $query The query ID.
param: string $field The name of the field to return.
param: int|boolean $row The number of the row to fetch it from.

data_seek($query, $row)   X-Ref
Moves internal row pointer to the next row
param: resource|PDOStatement|mysqli_result $query The query ID.
param: int $row The pointer to move the row to.

num_rows($query)   X-Ref
Return the number of rows resulting from a query.
return: int The number of rows in the result.
param: resource|PDOStatement|mysqli_result $query The query ID.

insert_id()   X-Ref
Return the last id number of inserted data.
return: int The id number.

close()   X-Ref
Close the connection with the DBMS.

error_number()   X-Ref
Return an error number.
return: int The error number of the current error.

error_string()   X-Ref
Return an error string.
return: string The explanation for the current error.

error($string="")   X-Ref
Output a database error.
param: string $string The string to present as an error.

affected_rows()   X-Ref
Returns the number of affected rows in a query.
return: int The number of affected rows.

num_fields($query)   X-Ref
Return the number of fields.
return: int The number of fields.
param: resource|PDOStatement|mysqli_result $query The query ID.

list_tables($database, $prefix='')   X-Ref
Lists all functions in the database.
return: array The table list.
param: string $database The database name.
param: string $prefix Prefix of the table (optional)

table_exists($table)   X-Ref
Check if a table exists in a database.
return: boolean True when exists, false if not.
param: string $table The table name.

field_exists($field, $table)   X-Ref
Check if a field exists in a database.
return: boolean True when exists, false if not.
param: string $field The field name.
param: string $table The table name.

shutdown_query($query, $name='')   X-Ref
Add a shutdown query.
param: resource|PDOStatement|mysqli_result $query The query data.
param: string $name An optional name for the query.

simple_select($table, $fields="*", $conditions="", $options=array()   X-Ref
Performs a simple select query.
return: resource|PDOStatement|mysqli_result The query data.
param: string $table The table name to be queried.
param: string $fields Comma delimited list of fields to be selected.
param: string $conditions SQL formatted list of conditions to be matched.
param: array $options List of options: group by, order by, order direction, limit, limit start.

insert_query($table, $array)   X-Ref
Build an insert query from an array.
return: int The insert ID if available
param: string $table The table name to perform the query on.
param: array $array An array of fields and their values.

insert_query_multiple($table, $array)   X-Ref
Build one query for multiple inserts from a multidimensional array.
return: void
param: string $table The table name to perform the query on.
param: array $array An array of inserts.

update_query($table, $array, $where="", $limit="", $no_quote=false)   X-Ref
Build an update query from an array.
return: resource|PDOStatement|mysqli_result The query data.
param: string $table The table name to perform the query on.
param: array $array An array of fields and their values.
param: string $where An optional where clause for the query.
param: string $limit An optional limit clause for the query.
param: boolean $no_quote An option to quote incoming values of the array.

delete_query($table, $where="", $limit="")   X-Ref
Build a delete query.
return: resource|PDOStatement|mysqli_result The query data.
param: string $table The table name to perform the query on.
param: string $where An optional where clause for the query.
param: string $limit An optional limit clause for the query.

escape_string($string)   X-Ref
Escape a string according to the MySQL escape format.
return: string The escaped string.
param: string $string The string to be escaped.

free_result($query)   X-Ref
Frees the resources of a query.
return: boolean Returns true on success, false on faliure
param: resource|PDOStatement|mysqli_result $query The query to destroy.

escape_string_like($string)   X-Ref
Escape a string used within a like command.
return: string The escaped string.
param: string $string The string to be escaped.

get_version()   X-Ref
Gets the current version of MySQL.
return: string Version of MySQL.

optimize_table($table)   X-Ref
Optimizes a specific table.
param: string $table The name of the table to be optimized.

analyze_table($table)   X-Ref
Analyzes a specific table.
param: string $table The name of the table to be analyzed.

show_create_table($table)   X-Ref
Show the "create table" command for a specific table.
return: string The SQL command to create the specified table.
param: string $table The name of the table.

show_fields_from($table)   X-Ref
Show the "show fields from" command for a specific table.
return: array Field info for that table
param: string $table The name of the table.

is_fulltext($table, $index="")   X-Ref
Returns whether or not the table contains a fulltext index.
return: boolean True or false if the table has a fulltext index or not.
param: string $table The name of the table.
param: string $index Optionally specify the name of the index.

supports_fulltext($table)   X-Ref
Returns whether or not this database engine supports fulltext indexing.
return: boolean True or false if supported or not.
param: string $table The table to be checked.

index_exists($table, $index)   X-Ref
Checks to see if an index exists on a specified table
param: string $table The name of the table.
param: string $index The name of the index.

supports_fulltext_boolean($table)   X-Ref
Returns whether or not this database engine supports boolean fulltext matching.
return: boolean True or false if supported or not.
param: string $table The table to be checked.

create_fulltext_index($table, $column, $name="")   X-Ref
Creates a fulltext index on the specified column in the specified table with optional index name.
param: string $table The name of the table.
param: string $column Name of the column to be indexed.
param: string $name The index name, optional.

drop_index($table, $name)   X-Ref
Drop an index with the specified name from the specified table
param: string $table The name of the table.
param: string $name The name of the index.

drop_table($table, $hard=false, $table_prefix=true)   X-Ref
Drop an table with the specified table
param: string $table The name of the table.
param: boolean $hard Hard drop - no checking
param: boolean $table_prefix Use table prefix?

rename_table($old_table, $new_table, $table_prefix=true)   X-Ref
Renames a table
param: string $old_table The old table name
param: string $new_table the new table name
param: boolean $table_prefix Use table prefix?

replace_query($table, $replacements=array()   X-Ref
Replace contents of table with values
param: string $table The table
param: array $replacements The replacements
param: string|array $default_field The default field(s)
param: boolean $insert_id Whether or not to return an insert id. True by default

drop_column($table, $column)   X-Ref
Drops a column
param: string $table The table
param: string $column The column name

add_column($table, $column, $definition)   X-Ref
Adds a column
param: string $table The table
param: string $column The column name
param: string $definition The new column definition

modify_column($table, $column, $new_definition, $new_not_null=false, $new_default_value=false)   X-Ref
Modifies a column
return: bool Returns true if all queries are executed successfully or false if one of them failed
param: string $table The table
param: string $column The column name
param: string $new_definition the new column definition
param: boolean|string $new_not_null Whether to "drop" or "set" the NOT NULL attribute (no change if false)
param: boolean|string $new_default_value The new default value, or false to drop the attribute

rename_column($table, $old_column, $new_column, $new_definition, $new_not_null=false, $new_default_value=false)   X-Ref
Renames a column
return: bool Returns true if all queries are executed successfully
param: string $table The table
param: string $old_column The old column name
param: string $new_column the new column name
param: string $new_definition the new column definition
param: boolean|string $new_not_null Whether to "drop" or "set" the NOT NULL attribute (no change if false)
param: boolean|string $new_default_value The new default value, or false to drop the attribute

set_table_prefix($prefix)   X-Ref
Sets the table prefix used by the simple select, insert, update and delete functions
param: string $prefix The new table prefix

fetch_size($table='')   X-Ref
Fetched the total size of all mysql tables or a specific table
return: integer the total size of all mysql tables or a specific table
param: string $table The table (optional)

fetch_db_charsets()   X-Ref
Fetch a list of database character sets this DBMS supports
return: array|bool Array of supported character sets with array key being the name, array value being display name. False if unsupported

fetch_charset_collation($charset)   X-Ref
Fetch a database collation for a particular database character set
return: string|bool The matching database collation, false if unsupported
param: string $charset The database character set

build_create_table_collation()   X-Ref
Fetch a character set/collation string for use with CREATE TABLE statements. Uses current DB encoding
return: string The built string, empty if unsupported

get_execution_time()   X-Ref
Time how long it takes for a particular piece of code to run. Place calls above & below the block of code.

escape_binary($string)   X-Ref
Binary database fields require special attention.
return: string Encoded binary value
param: string $string Binary value

unescape_binary($string)   X-Ref
Unescape binary data.
return: string Encoded binary value
param: string $string Binary value



2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup Cross-referenced by PHPXref