![]() |
Bearsampp 2025.8.29
API Documentation for Bearsampp
|
Go to the source code of this file.
Functions | |
| db_close_database () | |
| db_create_database ($database, $server="", $username="", $password="") | |
| db_create_field ($tablename, $field, $type) | |
| db_create_record ($tablename, $fieldnames=null, $fieldvalues=null, $idfield="id") | |
| db_create_table ($tablename, $fieldnames, $fieldattrib, $idfield="id", $valarray=null) | |
| db_delete_field ($tablename, $field) | |
| db_delete_records ($tablename, $idarray, $idfield="id") | |
| db_delete_table ($tablename) | |
| db_edit_field ($tablename, $field, $type) | |
| db_edit_record ($tablename, $id=0, $fieldnames=null, $fieldvalues=null, $idfield="id") | |
| db_escape_string ($str) | |
| db_fetch_array ($result, $type=FETCH_NUM) | |
| db_free_result ($result) | |
| db_get_data ($tablename, $id=null, $col=null, $where="", $result_type=FETCH_NUM, $idfield="id", $orderby="") | |
| db_get_id ($tablename, $index, $idfield="id") | |
| db_get_index ($tablename, $id, $idfield="id") | |
| db_get_info ($info="") | |
| db_get_next_free_id ($tablename, $idfield="id") | |
| db_list_database_tables () | |
| db_list_table_fields ($tablename, $type=false) | |
| db_open_database ($database, $server="", $username="", $password="") | |
| db_query ($query) | |
| db_rename_field ($tablename, $field, $newname, $type) | |
| db_rename_table ($tablename, $newname) | |
| db_swap_records ($tablename, $id1, $id2, $idfield="id", $xchangeid=true) | |
| db_table_exists ($tablename) | |
Variables | |
| $_mainpath = pathinfo(__FILE__) | |
| const | DB_WRAPVERSION "db_v2b" |
| if (!defined("APPPREFIX")) define("APPPREFIX" | |
| db_close_database | ( | ) |
Definition at line 113 of file db_common.inc.php.
References raw_db_close_database().
| db_create_database | ( | $database, | |
| $server = "", | |||
| $username = "", | |||
| $password = "" ) |
db_create_database() Creates a database if it does not exist
| $database | ||
| string | $server | |
| string | $username | |
| string | $password |
Definition at line 77 of file db_common.inc.php.
References raw_db_create_database().
| db_create_field | ( | $tablename, | |
| $field, | |||
| $type ) |
| $tablename | |
| $field | |
| $type |
Definition at line 248 of file db_common.inc.php.
References raw_db_create_field().
| db_create_record | ( | $tablename, | |
| $fieldnames = null, | |||
| $fieldvalues = null, | |||
| $idfield = "id" ) |
Insert a new record in table $tablename.
| $tablename | Table name. If NULL uses the table used in last function call. | |
| unknown | $fieldnames | Array or CSV string with field names, one per line. |
| unknown | $fieldvalues | Array or CSV string with field values, one per line. |
| string | $idfield |
Definition at line 304 of file db_common.inc.php.
References $result, db_escape_string(), db_fetch_array(), db_list_table_fields(), FETCH_NUM, and raw_db_query().
Referenced by db_create_table(), and db_edit_record().
| db_create_table | ( | $tablename, | |
| $fieldnames, | |||
| $fieldattrib, | |||
| $idfield = "id", | |||
| $valarray = null ) |
| $tablename | ||
| $fieldnames | ( beside "id" ) | |
| $fieldattrib | ||
| string | $idfield | ( set to "id" ) |
| array | $valarray | ( $valarray[0] = 1.record, $valarray[1] = 2.record, ... ) |
Definition at line 144 of file db_common.inc.php.
References $result, db_create_record(), db_table_exists(), and raw_db_query().
| db_delete_field | ( | $tablename, | |
| $field ) |
| $tablename | |
| $field |
Definition at line 260 of file db_common.inc.php.
References raw_db_delete_field().
| db_delete_records | ( | $tablename, | |
| $idarray, | |||
| $idfield = "id" ) |
Delete record from table $tablename.
| $tablename | |
| $idarray | the id or id array |
Definition at line 363 of file db_common.inc.php.
References $result, and raw_db_query().
| db_delete_table | ( | $tablename | ) |
| $tablename |
Definition at line 196 of file db_common.inc.php.
References $result, db_table_exists(), and raw_db_query().
| db_edit_field | ( | $tablename, | |
| $field, | |||
| $type ) |
db_edit_field() edit field attribute
| $tablename | |
| $field | |
| $type |
Definition at line 288 of file db_common.inc.php.
References raw_db_edit_field().
| db_edit_record | ( | $tablename, | |
| $id = 0, | |||
| $fieldnames = null, | |||
| $fieldvalues = null, | |||
| $idfield = "id" ) |
Edits a record from table $tablename. If $id is null, zero or < 0, inserts a new record.
| $tablename | If NULL uses the table used in last function call. | |
| integer | $id | |
| unknown | $fieldnames | Array or CSV string with field names, one per line. If NULL, affects all fields. |
| unknown | $fieldvalues | Array or CSV string with field values, one per line. |
| string | $idfield |
Definition at line 400 of file db_common.inc.php.
References $result, db_create_record(), db_escape_string(), db_list_table_fields(), and raw_db_query().
Referenced by db_swap_records().
| db_escape_string | ( | $str | ) |
| $str |
string mysql_real_escape_string ( string unescaped_string [, resource link_identifier])
Definition at line 732 of file db_common.inc.php.
References raw_db_escape_string().
Referenced by db_create_record(), and db_edit_record().
| db_fetch_array | ( | $result, | |
| $type = FETCH_NUM ) |
| $result | |
| $type |
array mysql_fetch_array ( resource result [, int result_type]) int type MYSQL_ASSOC, MYSQL_NUM ( == fetch_row), and MYSQL_BOTH
Definition at line 705 of file db_common.inc.php.
References $result, FETCH_NUM, and raw_db_fetch_array().
Referenced by db_create_record(), db_get_data(), db_get_id(), db_get_next_free_id(), db_swap_records(), and raw_db_list_table_fields_def().
| db_free_result | ( | $result | ) |
| $result |
Definition at line 721 of file db_common.inc.php.
References $result, and raw_db_free_result().
Referenced by db_get_data(), and db_get_id().
| db_get_data | ( | $tablename, | |
| $id = null, | |||
| $col = null, | |||
| $where = "", | |||
| $result_type = FETCH_NUM, | |||
| $idfield = "id", | |||
| $orderby = "" ) |
Reads data from table $tablename.
$tablename Table name. If NULL uses the table used in last function call. $id Identifier(s). May be an array or a CSV string $col Column(s) or field(s). May be an array or a CSV string $where Additional WHERE clause $result_type May be FETCH_ASSOC, FETCH_BOTH or FETCH_NUM $idfield Name of id field $orderby Additional ORDER BY clause
int null array with the whole record $id int str the value of column $col from record $id int str[] array with column values in array $col of record $id int[] null array of arrays with values from all columns of the $id registers int[] str array with the values of column $col from the $id registers int[] str[] 2-D array with the values of columns $col from the $id registers null null array of arrays with the whole table null str array with values of the $col column from the whole table null str[] array of arrays with the values of the columns $col from all table
| $tablename | ||
| unknown | $id | |
| unknown | $col | |
| string | $where | |
| unknown | $result_type | |
| string | $idfield | |
| string | $orderby |
Definition at line 535 of file db_common.inc.php.
References $result, db_fetch_array(), db_free_result(), FETCH_NUM, and raw_db_query().
Referenced by db_get_index().
| db_get_id | ( | $tablename, | |
| $index, | |||
| $idfield = "id" ) |
Returns the id of the record indexed by $index
| $tablename | ||
| $index | ||
| string | $idfield |
Definition at line 629 of file db_common.inc.php.
References $result, db_fetch_array(), db_free_result(), FETCH_NUM, and raw_db_query().
| db_get_index | ( | $tablename, | |
| $id, | |||
| $idfield = "id" ) |
Returns the index of the record identified by $id
| $tablename | ||
| $id | ||
| string | $idfield |
Definition at line 612 of file db_common.inc.php.
References db_get_data().
| db_get_info | ( | $info = "" | ) |
db_get_info() Returns database and wrapper version information
| string | $what |
Definition at line 35 of file db_common.inc.php.
References DB_WRAPVERSION, and raw_get_db_version().
| db_get_next_free_id | ( | $tablename, | |
| $idfield = "id" ) |
Returns the next available id in table $tablename.
| $tablename | ||
| string | $idfield |
Definition at line 667 of file db_common.inc.php.
References $result, db_fetch_array(), FETCH_NUM, and raw_db_query().
Referenced by db_swap_records().
| db_list_database_tables | ( | ) |
db_list_database_tables() Returns an array with the list of tables of the current database
Definition at line 88 of file db_common.inc.php.
References raw_db_list_database_tables().
| db_list_table_fields | ( | $tablename, | |
| $type = false ) |
| $tablename |
Definition at line 228 of file db_common.inc.php.
References $result, and raw_db_list_table_fields_def().
Referenced by db_create_record(), and db_edit_record().
| db_open_database | ( | $database, | |
| $server = "", | |||
| $username = "", | |||
| $password = "" ) |
db_open_database() Opens and connects an existing database.
| $database | ||
| string | $server | |
| string | $username | |
| string | $password |
Definition at line 62 of file db_common.inc.php.
References raw_db_open_database().
| db_query | ( | $query | ) |
depricated exists only for compatibility to previous version is the same as raw_db_query does not handle APPPREFIX
Definition at line 693 of file db_common.inc.php.
References raw_db_query().
Referenced by raw_db_list_table_fields_def().
| db_rename_field | ( | $tablename, | |
| $field, | |||
| $newname, | |||
| $type ) |
| $tablename | |
| $field | |
| $newname | |
| $type |
Definition at line 274 of file db_common.inc.php.
References raw_db_rename_field().
| db_rename_table | ( | $tablename, | |
| $newname ) |
| $tablename | |
| $newname |
Definition at line 218 of file db_common.inc.php.
References raw_db_rename_table().
| db_swap_records | ( | $tablename, | |
| $id1, | |||
| $id2, | |||
| $idfield = "id", | |||
| $xchangeid = true ) |
Swaps values from two records, including the id field or not according to $xchangeid.
| $tablename | ||
| $id1 | ||
| $id2 | ||
| string | $idfield | |
| boolean | $xchangeid |
Definition at line 457 of file db_common.inc.php.
References $result, db_edit_record(), db_fetch_array(), db_get_next_free_id(), FETCH_ASSOC, and raw_db_query().
| db_table_exists | ( | $tablename | ) |
| $tablename | of an opened database |
Definition at line 124 of file db_common.inc.php.
References raw_db_table_exists().
Referenced by db_create_table(), and db_delete_table().
| $_mainpath = pathinfo(__FILE__) |
Definition at line 23 of file db_common.inc.php.
| const DB_WRAPVERSION "db_v2b" |
WINBINDER - The native Windows binding for PHP for PHP
Copyright Hypervisual - see LICENSE.TXT for details Authors: Rubem Pechansky and Hans Rebel
Database wrapper functions for WinBinder version 2b tested with SQLite and mySQL 7.mar
Definition at line 18 of file db_common.inc.php.
Referenced by db_get_info().
| if(!defined("DB_DATABASE")) define("DB_DATABASE" | ( | ! | defined"APPPREFIX" | ) |
Definition at line 20 of file db_common.inc.php.