Class: Database
Source Location: /main/inc/lib/database.lib.php
Class Details
Class Methods
method affected_rows [line 701]
void affected_rows(
[resource
$r = null])
|
|
Returns the number of affected rows
Parameters:
method count_rows [line 566]
int count_rows(
string
$table)
|
|
Count the number of rows in a table
Tags:
Parameters:
method error [line 716]
method escape_string [line 591]
string escape_string(
string
$string)
|
|
Escapes a string to insert into the database as text
Tags:
Parameters:
method fetch_array [line 606]
array fetch_array(
resource
$res, [string
$option = 'BOTH'])
|
|
Gets the array from a SQL result (as returned by api_sql_query) - help achieving database independence
Tags:
Parameters:
method fetch_object [line 632]
object Object fetch_object(
resource
$res, [string
$class = null], [array
$params = null])
|
|
Gets the next row of the result of the SQL query (as returned by api_sql_query) in an object form
Tags:
Parameters:
method fetch_row [line 650]
array fetch_row(
resource
$res)
|
|
Gets the array from a SQL result (as returned by api_sql_query) - help achieving database independence
Tags:
Parameters:
method fix_database_parameter [line 529]
the fix_database_parameter(
$database_name, string
$database_name,)
|
|
Tags:
Parameters:
method format_glued_course_table_name [line 547]
void format_glued_course_table_name(
$database_name_with_glue,
$table)
|
|
Structures a course database and table name to ready them for querying. The course database parameter is considered glued: e.g. COURSE001`.`
Parameters:
method format_table_name [line 557]
void format_table_name(
$database,
$table)
|
|
Structures a database and table name to ready them for querying. The database parameter is considered not glued, just plain e.g. COURSE001
Parameters:
method generate_abstract_course_field_names [line 448]
void generate_abstract_course_field_names(
$result_array)
|
|
This creates an abstraction layer between database field names and field names expected in code. This helps when changing database names. It's also useful now to get rid of the 'franglais'.
Tags:
Parameters:
method generate_abstract_user_field_names [line 494]
void generate_abstract_user_field_names(
$result_array)
|
|
This creates an abstraction layer between database field names and field names expected in code. This helps when changing database names. It's also useful now to get rid of the 'franglais'.
Tags:
Parameters:
method get_course_chat_connected_table [line 665]
void get_course_chat_connected_table(
[
$database_name = ''])
|
|
Parameters:
method get_course_info [line 400]
void get_course_info(
the
$course_code)
|
|
Returns an array with all database fields for the specified course.
Tags:
Parameters:
method get_course_list [line 385]
method get_course_table [line 317]
void get_course_table(
$short_table_name, [
$database_name = ''], string
$short_table_name,, string
$database_name,)
|
|
A more generic function than the older get_course_xxx_table functions, this one can return the correct complete name of any course table of which you pass the short name as a parameter. Please define table names as constants in this library and use them instead of directly using magic words in your tool code.
Parameters:
method get_course_table_prefix [line 270]
void get_course_table_prefix(
)
|
|
Returns the course table prefix for single database. Not certain exactly when this is used. Do research. It's used in local.inc.php.
method get_current_course_database [line 227]
void get_current_course_database(
)
|
|
Returns the name of the main Dokeos database.
method get_current_course_glued_database [line 235]
void get_current_course_glued_database(
)
|
|
Returns the glued name of the current course database.
method get_database_glue [line 247]
void get_database_glue(
)
|
|
The glue is the string needed between database and table. The trick is: in multiple databases, this is a period (with backticks) In single database, this can be e.g. an underscore so we just fake there are multiple databases and the code can be written independent of the single / multiple database setting.
method get_database_name_prefix [line 259]
void get_database_name_prefix(
)
|
|
Returns the database prefix. All created COURSE databases are prefixed with this string. TIP: this can be convenient e.g. if you have multiple Dokeos installations on the same physical server.
method get_language_isocode [line 364]
void get_language_isocode(
$lang_folder)
|
|
Returns the isocode corresponding to the language directory given.
Parameters:
method get_last_insert_id [line 580]
integer get_last_insert_id(
)
|
|
Gets the ID of the last item inserted into the database
Tags:
method get_main_database [line 195]
void get_main_database(
)
|
|
Returns the name of the main Dokeos database.
method get_main_table [line 301]
void get_main_table(
$short_table_name, string
$short_table_name,)
|
|
A more generic function than the other get_main_xxx_table functions, this one can return the correct complete name of any table of the main database of which you pass the short name as a parameter. Please define table names as constants in this library and use them instead of directly using magic words in your tool code.
Parameters:
method get_scorm_database [line 211]
void get_scorm_database(
)
|
|
Returns the name of the Dokeos SCORM database.
method get_scorm_table [line 343]
void get_scorm_table(
$short_table_name, string
$short_table_name,)
|
|
This generic function returns the correct and complete name of any scorm table of which you pass the short name as a parameter. Please define table names as constants in this library and use them instead of directly using magic words in your tool code.
Parameters:
method get_statistic_database [line 203]
void get_statistic_database(
)
|
|
Returns the name of the Dokeos statistics database.
method get_statistic_table [line 330]
void get_statistic_table(
$short_table_name, string
$short_table_name,)
|
|
This generic function returns the correct and complete name of any statistic table of which you pass the short name as a parameter. Please define table names as constants in this library and use them instead of directly using magic words in your tool code.
Parameters:
method get_user_info_from_id [line 418]
$user_info get_user_info_from_id(
[$user_id
$user_id = ''])
|
|
find all the information about a specified user. Without parameter this is the current user.
Tags:
Parameters:
method get_user_personal_database [line 219]
void get_user_personal_database(
)
|
|
Returns the name of the database where all the personal stuff of the user is stored
method get_user_personal_table [line 356]
void get_user_personal_table(
$short_table_name, string
$short_table_name,)
|
|
This generic function returns the correct and complete name of any scorm table of which you pass the short name as a parameter. Please define table names as constants in this library and use them instead of directly using magic words in your tool code.
Parameters:
method glue_course_database_name [line 516]
void glue_course_database_name(
$database_name)
|
|
Glues a course database. glue format from local.inc.php.
Parameters:
method insert_id [line 693]
Recovers the last ID of any insert query executed over this SQL connection
Tags:
method num_rows [line 660]
integer num_rows(
resource
$res)
|
|
Gets the number of rows from the last query result - help achieving database independence
Tags:
Parameters:
method query [line 712]
void query(
$sql, [
$file = ''], [
$line = 0])
|
|
Parameters:
method result [line 678]
void result(
resource
$resource, integer
$row, [string
$field = ''])
|
|
Acts as the relative *_result() function of most DB drivers and fetches a specific line and a field
Parameters:
|
|