MDL-30972 Documentation : clarified phpdocs for main public APIs in DML layer and touched up on some drivers

This commit is contained in:
Aparup Banerjee
2012-02-09 10:01:42 +08:00
parent baa5cd8240
commit 6df260107c
12 changed files with 495 additions and 417 deletions
+22 -20
View File
@@ -110,10 +110,10 @@ class pgsql_native_moodle_database extends moodle_database {
/**
* Connect to db
* Must be called before other methods.
* @param string $dbhost
* @param string $dbuser
* @param string $dbpass
* @param string $dbname
* @param string $dbhost The database host.
* @param string $dbuser The database username.
* @param string $dbpass The database username's password.
* @param string $dbname The name of the database being connected to.
* @param mixed $prefix string means moodle db prefix, false used for external databases where prefix not used
* @param array $dboptions driver specific options
* @return bool true
@@ -234,7 +234,7 @@ class pgsql_native_moodle_database extends moodle_database {
/**
* Returns database server info array
* @return array
* @return array Array containing 'description' and 'version' info
*/
public function get_server_info() {
static $info;
@@ -254,7 +254,7 @@ class pgsql_native_moodle_database extends moodle_database {
/**
* Returns supported query parameter types
* @return int bitmask
* @return int bitmask of accepted SQL_PARAMS_*
*/
protected function allowed_param_types() {
return SQL_PARAMS_DOLLAR;
@@ -269,7 +269,8 @@ class pgsql_native_moodle_database extends moodle_database {
}
/**
* Return tables in database WITHOUT current prefix
* Return tables in database WITHOUT current prefix.
* @param bool $usecache if true, returns list of cached tables.
* @return array of table names in lowercase and without prefix
*/
public function get_tables($usecache=true) {
@@ -303,7 +304,8 @@ class pgsql_native_moodle_database extends moodle_database {
}
/**
* Return table indexes - everything lowercased
* Return table indexes - everything lowercased.
* @param string $table The table we want to get indexes from.
* @return array of arrays
*/
public function get_indexes($table) {
@@ -563,7 +565,7 @@ class pgsql_native_moodle_database extends moodle_database {
* Do NOT use in code, to be used by database_manager only!
* @param string $sql query
* @return bool true
* @throws dml_exception if error
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
public function change_database_structure($sql) {
$this->reset_caches();
@@ -582,7 +584,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @param string $sql query
* @param array $params query parameters
* @return bool true
* @throws dml_exception if error
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
public function execute($sql, array $params=null) {
list($sql, $params, $type) = $this->fix_sql_params($sql, $params);
@@ -613,7 +615,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @param int $limitfrom return a subset of records, starting at this point (optional, required if $limitnum is set).
* @param int $limitnum return a subset comprising this many records (optional, required if $limitfrom is set).
* @return moodle_recordset instance
* @throws dml_exception if error
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
public function get_recordset_sql($sql, array $params=null, $limitfrom=0, $limitnum=0) {
$limitfrom = (int)$limitfrom;
@@ -655,7 +657,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @param int $limitfrom return a subset of records, starting at this point (optional, required if $limitnum is set).
* @param int $limitnum return a subset comprising this many records (optional, required if $limitfrom is set).
* @return array of objects, or empty array if no records were found
* @throws dml_exception if error
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
public function get_records_sql($sql, array $params=null, $limitfrom=0, $limitnum=0) {
$limitfrom = (int)$limitfrom;
@@ -717,7 +719,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @param string $sql The SQL query
* @param array $params array of sql parameters
* @return array of values
* @throws dml_exception if error
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
public function get_fieldset_sql($sql, array $params=null) {
list($sql, $params, $type) = $this->fix_sql_params($sql, $params);
@@ -740,7 +742,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @param bool $bulk true means repeated inserts expected
* @param bool $customsequence true if 'id' included in $params, disables $returnid
* @return bool|int true or new id
* @throws dml_exception if error
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
public function insert_record_raw($table, $params, $returnid=true, $bulk=false, $customsequence=false) {
if (!is_array($params)) {
@@ -803,7 +805,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @param object $data A data object with values for one or more fields in the record
* @param bool $returnid Should the id of the newly created record entry be returned? If this option is not requested then true/false is returned.
* @return bool|int true or new id
* @throws dml_exception if error
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
public function insert_record($table, $dataobject, $returnid=true, $bulk=false) {
$dataobject = (array)$dataobject;
@@ -857,7 +859,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @param string $table name of database table to be inserted into
* @param object $dataobject A data object with values for one or more fields in the record
* @return bool true
* @throws dml_exception if error
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
public function import_record($table, $dataobject) {
$dataobject = (array)$dataobject;
@@ -904,7 +906,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @param mixed $params data record as object or array
* @param bool true means repeated updates expected
* @return bool true
* @throws dml_exception if error
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
public function update_record_raw($table, $params, $bulk=false) {
$params = (array)$params;
@@ -950,7 +952,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @param object $dataobject An object with contents equal to fieldname=>fieldvalue. Must have an entry for 'id' to map to the table specified.
* @param bool true means repeated updates expected
* @return bool true
* @throws dml_exception if error
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
public function update_record($table, $dataobject, $bulk=false) {
$dataobject = (array)$dataobject;
@@ -1003,7 +1005,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @param string $select A fragment of SQL to be used in a where clause in the SQL call.
* @param array $params array of sql parameters
* @return bool true
* @throws dml_exception if error
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
public function set_field_select($table, $newfield, $newvalue, $select, array $params=null) {
@@ -1056,7 +1058,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @param string $select A fragment of SQL to be used in a where clause in the SQL call (used to define the selection criteria).
* @param array $params array of sql parameters
* @return bool true
* @throws dml_exception if error
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
public function delete_records_select($table, $select, array $params=null) {
if ($select) {