claroline/claroline/inc/lib/sql.lib.php File Reference

Go to the source code of this file.

Namespaces

namespace  KERNEL

Functions

 claro_sql_get_tbl ($tableList, $contextData=null)
 claro_sql_get_main_tbl ()
 claro_sql_get_course_tbl ($dbNameGlued=null)
 claro_sql_query ($sqlQuery, $dbHandler= '#')
 claro_sql_errno ($dbHandler= '#')
 claro_sql_error ($dbHandler= '#')
 claro_sql_select_db ($dbName, $dbHandler= '#')
 claro_sql_affected_rows ($dbHandler= '#')
 claro_sql_insert_id ($dbHandler= '#')
 claro_sql_field_names ($sql, $resultPt=null)
 claro_sql_query_fetch_all_rows ($sqlQuery, $dbHandler= '#')
 claro_sql_query_fetch_all ($sqlQuery, $dbHandler= '#')
 claro_sql_query_fetch_all_cols ($sqlQuery, $dbHandler= '#')
 claro_sql_query_fetch_single_value ($sqlQuery, $dbHandler= '#')
 claro_sql_query_get_single_value ($sqlQuery, $dbHandler= '#')
 claro_sql_query_fetch_single_row ($sqlQuery, $dbHandler= '#')
 claro_sql_query_get_single_row ($sqlQuery, $dbHandler= '#')
 claro_sql_query_affected_rows ($sqlQuery, $dbHandler= '#')
 claro_sql_query_insert_id ($sqlQuery, $dbHandler= '#')
 claro_sql_escape ($statement, $db=null)
 get_context_db_discriminator ($toolId)

Function Documentation

claro_sql_affected_rows ( dbHandler = '#'  ) 

CLAROLINE mySQL affected rows wrapper.

Deprecated:
since Claroline 1.9, use Claroline::getDatabase() and new classes in database/database.lib.php instead

Definition at line 397 of file sql.lib.php.

claro_sql_errno ( dbHandler = '#'  ) 

CLAROLINE mySQL errno wrapper.

Deprecated:
since Claroline 1.9, use Claroline::getDatabase() and new classes in database/database.lib.php instead

Definition at line 346 of file sql.lib.php.

claro_sql_error ( dbHandler = '#'  ) 

CLAROLINE mySQL error wrapper.

Deprecated:
since Claroline 1.9, use Claroline::getDatabase() and new classes in database/database.lib.php instead

Definition at line 363 of file sql.lib.php.

claro_sql_escape ( statement,
db = null 
)

Protect Sql statment

Parameters:
unknown_type $statement
unknown_type $db
Returns:
unknown
Deprecated:
since Claroline 1.9, use Claroline::getDatabase() and new classes in database/database.lib.php instead

Definition at line 755 of file sql.lib.php.

claro_sql_field_names ( sql,
resultPt = null 
)

Get the name of the specified fields in a query result

Parameters:
string $sq - SQL query
ressource (optional) - result pointer
Returns:
names of the specified field index
Author:
Hugues Peeters <peeters@ipm.ucl.ac.be>
Deprecated:
since Claroline 1.9, use Claroline::getDatabase() and new classes in database/database.lib.php instead

Definition at line 437 of file sql.lib.php.

claro_sql_get_course_tbl ( dbNameGlued = null  ) 
Author:
Hugues Peeters <hugues.peeters@claroline.net>
Parameters:
string $dbNameGlued (optionnal) course database with its platform glue already append. If no db name are set, the current course db will be taken.
Returns:
array list of the current course database tables
Deprecated:
for module development since Claroline 1.9, use get_module_course_tbl instead

Definition at line 200 of file sql.lib.php.

claro_sql_get_main_tbl (  ) 

Get list of table names for central table.

Returns:
array list of the central claroline database tables
Author:
Hugues Peeters <hugues.peeters@claroline.net>
Deprecated:
for module development since Claroline 1.9, use get_module_main_tbl instead

Definition at line 146 of file sql.lib.php.

claro_sql_get_tbl ( tableList,
contextData = null 
)

Return the tablename for a tool, dependig on the execution context WARNING DO NOT USE THIS FUNCTION UNTIL THE deprecated TAG IS REMOVE

Parameters:
array $tableList
array $contextData id To discrim table. Do not add context Id of an context active but managed by tool.
Returns:
array
Deprecated:
for modules since Claroline 1.9, use get_module_main_tbl and get_module_course_tbl instead
Todo:
rewrite to use new Claroline core/context.lib.php

If it's in a course, $courseId is set or $courseId is null but not claro_get_current_course_id() if both are null, it's a main table

when

Tool Context capatibility

There is many context in claroline, a new tool can don't provide initially all field to discrim each context in fields. When a tool can't discrim a context, the table would be duplicated for each instance and the name of table (or db) contain the discriminator

This extreme modularity provide an easy growing and integration but easy

Easy can't mean slowly. If I prupose a blog tool wich can't discrim user I need to duplicate all blog table (in same or separate db).

Read this to understand chanche since previous version thant 1.8

Until 1.8 there was 2 functions

function claro_sql_get_main_tbl() function claro_sql_get_course_tbl($dbNameGlued = null)

both was using conf values claro_sql_get_main_tbl was using conf values * get_conf('mainDbName') * get_conf('mainTblPrefix')

Definition at line 35 of file sql.lib.php.

claro_sql_insert_id ( dbHandler = '#'  ) 

CLAROLINE mySQL insert id wrapper.

Deprecated:
since Claroline 1.9, use Claroline::getDatabase() and new classes in database/database.lib.php instead

Definition at line 414 of file sql.lib.php.

claro_sql_query ( sqlQuery,
dbHandler = '#' 
)

CLAROLINE mySQL query wrapper. It also provides a debug display which works when the CLARO_DEBUG_MODE constant flag is set to on (true)

Author:
Hugues Peeters <peeters@ipm.ucl.ac.be>,
Christophe GeschŽ <moosh@claroline.net>
Parameters:
string $sqlQuery - the sql query
handler $dbHandler - optional
Returns:
handler - the result handler
Deprecated:
since Claroline 1.9, use Claroline::getDatabase() and new classes in database/database.lib.php instead

Definition at line 289 of file sql.lib.php.

claro_sql_query_affected_rows ( sqlQuery,
dbHandler = '#' 
)

CLAROLINE SQL query wrapper returning the number of rows affected by the query

Parameters:
string $sqlQuery the sql query
handler $dbHandler optional
Returns:
int the number of rows affected by the query
See also:
claro_sql_query()
Author:
Hugues Peeters <hugues.peeters@claroline.net>,
Deprecated:
since Claroline 1.9, use Claroline::getDatabase() and new classes in database/database.lib.php instead

Definition at line 691 of file sql.lib.php.

claro_sql_query_fetch_all ( sqlQuery,
dbHandler = '#' 
)

Alias for claro_sql_query_fetch_all_rows

See also:
claro_sql_query_fetch_all_rows()
Deprecated:
since Claroline 1.9, use Claroline::getDatabase() and new classes in database/database.lib.php instead

Definition at line 521 of file sql.lib.php.

claro_sql_query_fetch_all_cols ( sqlQuery,
dbHandler = '#' 
)

CLAROLINE SQL query and fetch array wrapper. It returns all the result in associative array ARRANGED BY COLUMNS.

Parameters:
string $sqlQuery the sql query
handler $dbHandler optional
Returns:
associative array containing all the result arranged by columns
See also:
claro_sql_query()
Author:
Hugues Peeters <hugues.peeters@claroline.net>,
Deprecated:
since Claroline 1.9, use Claroline::getDatabase() and new classes in database/database.lib.php instead

Definition at line 539 of file sql.lib.php.

claro_sql_query_fetch_all_rows ( sqlQuery,
dbHandler = '#' 
)

CLAROLINE SQL query and fetch array wrapper. It returns all the result rows in an associative array.

Parameters:
string $sqlQuery the sql query
handler $dbHandler optional
Returns:
array associative array containing all the result rows
Author:
Hugues Peeters <hugues.peeters@claroline.net>
Deprecated:
since Claroline 1.9, use Claroline::getDatabase() and new classes in database/database.lib.php instead

Definition at line 482 of file sql.lib.php.

claro_sql_query_fetch_single_row ( sqlQuery,
dbHandler = '#' 
)

CLAROLINE SQL query wrapper returning only the first row of the result Useful in some cases because, it avoid nested arrays of results.

Parameters:
string $sqlQuery the sql query
handler $dbHandler optional
Returns:
associative array containing all the result column
Since:
1.9.*
See also:
claro_sql_query_get_single_row()
Deprecated:
since Claroline 1.9, use Claroline::getDatabase() and new classes in database/database.lib.php instead

Definition at line 647 of file sql.lib.php.

claro_sql_query_fetch_single_value ( sqlQuery,
dbHandler = '#' 
)

CLAROLINE SQL query wrapper returning only a single result value. Useful in some cases because, it avoid nested arrays of results.

Parameters:
string $sqlQuery the sql query
handler $dbHandler optional
Returns:
associative array containing all the result rows
Since:
1.9
See also:
claro_sql_query()
Author:
Hugues Peeters <hugues.peeters@claroline.net>,
Deprecated:
since Claroline 1.9, use Claroline::getDatabase() and new classes in database/database.lib.php instead

Definition at line 590 of file sql.lib.php.

claro_sql_query_get_single_row ( sqlQuery,
dbHandler = '#' 
)

Get a single row from a SQL query

Parameters:
string $sqlQuery
ressource $dbHandler
Returns:
array or false
Deprecated:
since Claroline 1.9, use Claroline::getDatabase() and new classes in database/database.lib.php instead

Definition at line 660 of file sql.lib.php.

claro_sql_query_get_single_value ( sqlQuery,
dbHandler = '#' 
)

CLAROLINE SQL query wrapper returning only a single result value. Useful in some cases because, it avoid nested arrays of results.

Parameters:
string $sqlQuery the sql query
handler $dbHandler optional
Returns:
associative array containing all the result column
Since:
1.5.1
See also:
claro_sql_query_fetch_single_value()
Author:
Hugues Peeters <hugues.peeters@claroline.net>,
Deprecated:
since Claroline 1.9, use Claroline::getDatabase() and new classes in database/database.lib.php instead

Definition at line 630 of file sql.lib.php.

claro_sql_query_insert_id ( sqlQuery,
dbHandler = '#' 
)

CLAROLINE mySQL query wrapper returning the last id generated by the last inserted row

Author:
Hugues Peeters <hugues.peeters@claroline.net>,
Parameters:
string $sqlQuery the sql query
handler $dbHandler optional
Returns:
integer the id generated by the previous insert query
See also:
claro_sql_query()
Deprecated:
since Claroline 1.9, use Claroline::getDatabase() and new classes in database/database.lib.php instead

Definition at line 731 of file sql.lib.php.

claro_sql_select_db ( dbName,
dbHandler = '#' 
)

CLAROLINE mySQL selectDb wrapper.

Deprecated:
since Claroline 1.9, use Claroline::getDatabase() and new classes in database/database.lib.php instead

Definition at line 380 of file sql.lib.php.

get_context_db_discriminator ( toolId  ) 

Return an array of 2 array containing context wich can't be manage by tool and where to store the discriminator.

By default it's in table name except of course context wich follow singleDbMode value.

DO NOT USE THIS FUNCTION !

Parameters:
string $toolId claro_label
Returns:
array of array
Since:
1.8
Deprecated:
since Claroline 1.9, see claro_sql_get_tbl for details

Definition at line 780 of file sql.lib.php.

Generated on Tue Jun 8 12:28:37 2010 for Claroline API by  doxygen 1.6.3