Public Member Functions | |
exec_INSERTquery ($table, $fields_values) | |
Creates and executes an INSERT SQL-statement for $table from the array with field/value pairs $fields_values. | |
exec_UPDATEquery ($table, $where, $fields_values) | |
Creates and executes an UPDATE SQL-statement for $table where $where-clause (typ. | |
exec_DELETEquery ($table, $where) | |
Creates and executes a DELETE SQL-statement for $table where $where-clause Usage count/core: 40. | |
exec_SELECTquery ($select_fields, $from_table, $where_clause, $groupBy='', $orderBy='', $limit='') | |
Creates and executes a SELECT SQL-statement Using this function specifically allow us to handle the LIMIT feature independently of DB. | |
exec_SELECT_mm_query ($select, $local_table, $mm_table, $foreign_table, $whereClause='', $groupBy='', $orderBy='', $limit='') | |
Creates and executes a SELECT query, selecting fields ($select) from two/three tables joined Use $mm_table together with $local_table or $foreign_table to select over two tables. | |
exec_SELECT_queryArray ($queryParts) | |
Executes a select based on input query parts array. | |
exec_SELECTgetRows ($select_fields, $from_table, $where_clause, $groupBy='', $orderBy='', $limit='', $uidIndexField='') | |
Creates and executes a SELECT SQL-statement AND traverse result set and returns array with records in. | |
INSERTquery ($table, $fields_values) | |
Creates an INSERT SQL-statement for $table from the array with field/value pairs $fields_values. | |
UPDATEquery ($table, $where, $fields_values) | |
Creates an UPDATE SQL-statement for $table where $where-clause (typ. | |
DELETEquery ($table, $where) | |
Creates a DELETE SQL-statement for $table where $where-clause Usage count/core: 3. | |
SELECTquery ($select_fields, $from_table, $where_clause, $groupBy='', $orderBy='', $limit='') | |
Creates a SELECT SQL-statement Usage count/core: 11. | |
listQuery ($field, $value, $table) | |
Returns a WHERE clause that can find a value ($value) in a list field ($field) For instance a record in the database might contain a list of numbers, "34,234,5" (with no spaces between). | |
searchQuery ($searchWords, $fields, $table) | |
Returns a WHERE clause which will make an AND search for the words in the $searchWords array in any of the fields in array $fields. | |
quoteStr ($str, $table) | |
Substitution for PHP function "addslashes()" Use this function instead of the PHP addslashes() function when you build queries - this will prepare your code for DBAL. | |
cleanIntArray ($arr) | |
Will convert all values in the one-dimentional array to integers. | |
cleanIntList ($list) | |
Will force all entries in the input comma list to integers Useful when you want to make sure a commalist of supposed integers really contain only integers; You want to know that when you don't trust content that could go into an SQL statement. | |
stripOrderBy ($str) | |
Removes the prefix "ORDER BY" from the input string. | |
stripGroupBy ($str) | |
Removes the prefix "GROUP BY" from the input string. | |
splitGroupOrderLimit ($str) | |
Takes the last part of a query, eg. | |
sql ($db, $query) | |
Executes query mysql() wrapper function DEPRECIATED - use exec_* functions from this class instead! Usage count/core: 9. | |
sql_query ($query) | |
Executes query mysql_query() wrapper function Usage count/core: 1. | |
sql_error () | |
Returns the error status on the last sql() execution mysql_error() wrapper function Usage count/core: 32. | |
sql_num_rows ($res) | |
Returns the number of selected rows. | |
sql_fetch_assoc ($res) | |
Returns an associative array that corresponds to the fetched row, or FALSE if there are no more rows. | |
sql_fetch_row ($res) | |
Returns an array that corresponds to the fetched row, or FALSE if there are no more rows. | |
sql_free_result ($res) | |
Free result memory mysql_free_result() wrapper function Usage count/core: 3. | |
sql_insert_id () | |
Get the ID generated from the previous INSERT operation mysql_insert_id() wrapper function Usage count/core: 13. | |
sql_affected_rows () | |
Returns the number of rows affected by the last INSERT, UPDATE or DELETE query mysql_affected_rows() wrapper function Usage count/core: 1. | |
sql_data_seek ($res, $seek) | |
Move internal result pointer mysql_data_seek() wrapper function Usage count/core: 3. | |
sql_field_type ($res, $pointer) | |
Get the type of the specified field in a result mysql_field_type() wrapper function Usage count/core: 2. | |
sql_pconnect ($TYPO3_db_host, $TYPO3_db_username, $TYPO3_db_password) | |
Open a (persistent) connection to a MySQL server mysql_pconnect() wrapper function Usage count/core: 12. | |
sql_select_db ($TYPO3_db) | |
Select a MySQL database mysql_select_db() wrapper function Usage count/core: 8. | |
admin_get_dbs () | |
Listing databases from current MySQL connection. | |
admin_get_tables () | |
Returns the list of tables from the default database, TYPO3_db (quering the DBMS) In a DBAL this method should 1) look up all tables from the DBMS of the _DEFAULT handler and then 2) add all tables *configured* to be managed by other handlers Usage count/core: 2. | |
admin_get_fields ($tableName) | |
Returns information about each field in the $table (quering the DBMS) In a DBAL this should look up the right handler for the table and return compatible information This function is important not only for the Install Tool but probably for DBALs as well since they might need to look up table specific information in order to construct correct queries. | |
admin_get_keys ($tableName) | |
Returns information about each index key in the $table (quering the DBMS) In a DBAL this should look up the right handler for the table and return compatible information. | |
admin_query ($query) | |
mysql() wrapper function, used by the Install Tool and EM for all queries regarding management of the database! Usage count/core: 10 | |
debug ($func) | |
Debug function: Outputs error if any. | |
Public Attributes | |
$debugOutput = FALSE | |
$debug_lastBuiltQuery = '' | |
$link |
|
Listing databases from current MySQL connection. NOTICE: It WILL try to select those databases and thus break selection of current database. This doesn't really make sense to transfer to a DBAL layer - this detection is also PRE-DBAL in many ways since it is only used as a service function in the 1-2-3 process of the Install Tool. In any case a lookup should be done in the _DEFAULT handler DBMS then. Use in Install Tool only! Usage count/core: 1
Definition at line 854 of file class.t3lib_db.php. References sql_select_db(). 00854 { 00855 $dbArr = array(); 00856 $db_list = mysql_list_dbs($this->link); 00857 while ($row = mysql_fetch_object($db_list)) { 00858 if ($this->sql_select_db($row->Database)) { 00859 $dbArr[] = $row->Database; 00860 } 00861 } 00862 return $dbArr; 00863 }
|
|
Returns information about each field in the $table (quering the DBMS) In a DBAL this should look up the right handler for the table and return compatible information This function is important not only for the Install Tool but probably for DBALs as well since they might need to look up table specific information in order to construct correct queries. In such cases this information should probably be cached for quick delivery
Definition at line 891 of file class.t3lib_db.php. 00891 { 00892 $output = array(); 00893 00894 $columns_res = mysql_query('SHOW columns FROM '.$tableName, $this->link); 00895 while($fieldRow = mysql_fetch_assoc($columns_res)) { 00896 $output[$fieldRow["Field"]] = $fieldRow; 00897 } 00898 00899 return $output; 00900 }
|
|
Returns information about each index key in the $table (quering the DBMS) In a DBAL this should look up the right handler for the table and return compatible information.
Definition at line 909 of file class.t3lib_db.php. 00909 { 00910 $output = array(); 00911 00912 $keyRes = mysql_query('SHOW keys FROM '.$tableName, $this->link); 00913 while($keyRow = mysql_fetch_assoc($keyRes)) { 00914 $output[] = $keyRow; 00915 } 00916 00917 return $output; 00918 }
|
|
Returns the list of tables from the default database, TYPO3_db (quering the DBMS) In a DBAL this method should 1) look up all tables from the DBMS of the _DEFAULT handler and then 2) add all tables *configured* to be managed by other handlers Usage count/core: 2.
Definition at line 872 of file class.t3lib_db.php. References TYPO3_db. 00872 { 00873 $whichTables = array(); 00874 $tables_result = mysql_list_tables(TYPO3_db, $this->link); 00875 if (!mysql_error()) { 00876 while ($theTable = mysql_fetch_assoc($tables_result)) { 00877 $whichTables[current($theTable)] = current($theTable); 00878 } 00879 } 00880 return $whichTables; 00881 }
|
|
mysql() wrapper function, used by the Install Tool and EM for all queries regarding management of the database! Usage count/core: 10
Definition at line 927 of file class.t3lib_db.php. References admin_query(), and debug(). Referenced by admin_query(). 00927 { 00928 $res = mysql_query($query, $this->link); 00929 if ($this->debugOutput) $this->debug('admin_query'); 00930 return $res; 00931 }
|
|
Will convert all values in the one-dimentional array to integers. Useful when you want to make sure an array contains only integers before imploding them in a select-list. Usage count/core: 7
Definition at line 550 of file class.t3lib_db.php. 00550 {
00551 foreach($arr as $k => $v) {
00552 $arr[$k] = intval($arr[$k]);
00553 }
00554 return $arr;
00555 }
|
|
Will force all entries in the input comma list to integers Useful when you want to make sure a commalist of supposed integers really contain only integers; You want to know that when you don't trust content that could go into an SQL statement. Usage count/core: 6
Definition at line 566 of file class.t3lib_db.php. 00566 { 00567 return implode(',',t3lib_div::intExplode(',',$list)); 00568 }
|
|
Debug function: Outputs error if any.
Definition at line 954 of file class.t3lib_db.php. References error(), and sql_error(). Referenced by admin_query(), exec_DELETEquery(), exec_INSERTquery(), exec_SELECTgetRows(), exec_SELECTquery(), exec_UPDATEquery(), sql(), and sql_query(). 00954 { 00955 00956 $error = $this->sql_error(); 00957 if ($error) { 00958 echo t3lib_div::view_array(array( 00959 'caller' => 't3lib_DB::'.$func, 00960 'ERROR' => $error, 00961 'lastBuiltQuery' => $this->debug_lastBuiltQuery, 00962 'debug_backtrace' => function_exists('debug_backtrace') ? next(debug_backtrace()) : 'N/A' 00963 )); 00964 } 00965 }
|
|
Creates a DELETE SQL-statement for $table where $where-clause Usage count/core: 3.
Definition at line 407 of file class.t3lib_db.php. 00407 { 00408 if (is_string($where)) { 00409 00410 // Table and fieldnames should be "SQL-injection-safe" when supplied to this function 00411 $query = 'DELETE FROM '.$table. 00412 (strlen($where)>0 ? ' 00413 WHERE 00414 '.$where : ''); 00415 00416 if ($this->debugOutput) $this->debug_lastBuiltQuery = $query; 00417 return $query; 00418 } else { 00419 die('<strong>TYPO3 Fatal Error:</strong> "Where" clause argument for DELETE query was not a string in $this->DELETEquery() !'); 00420 } 00421 }
|
|
Creates and executes a DELETE SQL-statement for $table where $where-clause Usage count/core: 40.
Definition at line 197 of file class.t3lib_db.php. References debug(), exec_DELETEquery(), and table(). Referenced by exec_DELETEquery(). 00197 { 00198 $res = mysql_query($this->DELETEquery($table,$where), $this->link); 00199 if ($this->debugOutput) $this->debug('exec_DELETEquery'); 00200 return $res; 00201 }
|
|
Creates and executes an INSERT SQL-statement for $table from the array with field/value pairs $fields_values. Using this function specifically allows us to handle BLOB and CLOB fields depending on DB Usage count/core: 47
Definition at line 167 of file class.t3lib_db.php. References debug(), exec_INSERTquery(), and table(). Referenced by exec_INSERTquery(). 00167 { 00168 $res = mysql_query($this->INSERTquery($table,$fields_values), $this->link); 00169 if ($this->debugOutput) $this->debug('exec_INSERTquery'); 00170 return $res; 00171 }
|
|
Creates and executes a SELECT query, selecting fields ($select) from two/three tables joined Use $mm_table together with $local_table or $foreign_table to select over two tables. Or use all three tables to select the full MM-relation. The JOIN is done with [$local_table].uid <--> [$mm_table].uid_local / [$mm_table].uid_foreign <--> [$foreign_table].uid The function is very useful for selecting MM-relations between tables adhering to the MM-format used by TCE (TYPO3 Core Engine). See the section on $TCA in Inside TYPO3 for more details. Usage: 12 (spec. ext. sys_action, sys_messages, sys_todos)
Definition at line 241 of file class.t3lib_db.php. 00241 { 00242 $mmWhere = $local_table ? $local_table.'.uid='.$mm_table.'.uid_local' : ''; 00243 $mmWhere.= ($local_table AND $foreign_table) ? ' AND ' : ''; 00244 $mmWhere.= $foreign_table ? $foreign_table.'.uid='.$mm_table.'.uid_foreign' : ''; 00245 return $GLOBALS['TYPO3_DB']->exec_SELECTquery( 00246 $select, 00247 ($local_table ? $local_table.',' : '').$mm_table.($foreign_table ? ','.$foreign_table : ''), 00248 $mmWhere.' '.$whereClause, // whereClauseMightContainGroupOrderBy 00249 $groupBy, 00250 $orderBy, 00251 $limit 00252 ); 00253 }
|
|
Executes a select based on input query parts array. Usage: 9
Definition at line 264 of file class.t3lib_db.php. References exec_SELECTquery(). 00264 { 00265 return $this->exec_SELECTquery( 00266 $queryParts['SELECT'], 00267 $queryParts['FROM'], 00268 $queryParts['WHERE'], 00269 $queryParts['GROUPBY'], 00270 $queryParts['ORDERBY'], 00271 $queryParts['LIMIT'] 00272 ); 00273 }
|
|
Creates and executes a SELECT SQL-statement AND traverse result set and returns array with records in.
Definition at line 287 of file class.t3lib_db.php. References debug(), exec_SELECTquery(), sql_error(), and sql_fetch_assoc(). 00287 { 00288 $res = mysql_query($this->SELECTquery($select_fields,$from_table,$where_clause,$groupBy,$orderBy,$limit), $this->link); 00289 if ($this->debugOutput) $this->debug('exec_SELECTquery'); 00290 00291 unset($output); 00292 if (!$this->sql_error()) { 00293 $output = array(); 00294 00295 if ($uidIndexField) { 00296 while($tempRow = $this->sql_fetch_assoc($res)) { 00297 $output[$tempRow[$uidIndexField]] = $tempRow; 00298 } 00299 } else { 00300 while($output[] = $this->sql_fetch_assoc($res)); 00301 array_pop($output); 00302 } 00303 } 00304 return $output; 00305 }
|
|
Creates and executes a SELECT SQL-statement Using this function specifically allow us to handle the LIMIT feature independently of DB. Usage count/core: 340
Definition at line 216 of file class.t3lib_db.php. References debug(), and exec_SELECTquery(). Referenced by exec_SELECT_queryArray(), exec_SELECTgetRows(), and exec_SELECTquery(). 00216 { 00217 $res = mysql_query($this->SELECTquery($select_fields,$from_table,$where_clause,$groupBy,$orderBy,$limit), $this->link); 00218 if ($this->debugOutput) $this->debug('exec_SELECTquery'); 00219 return $res; 00220 }
|
|
Creates and executes an UPDATE SQL-statement for $table where $where-clause (typ. 'uid=...') from the array with field/value pairs $fields_values. Using this function specifically allow us to handle BLOB and CLOB fields depending on DB Usage count/core: 50
Definition at line 183 of file class.t3lib_db.php. References debug(), exec_UPDATEquery(), and table(). Referenced by exec_UPDATEquery(). 00183 { 00184 $res = mysql_query($this->UPDATEquery($table,$where,$fields_values), $this->link); 00185 if ($this->debugOutput) $this->debug('exec_UPDATEquery'); 00186 return $res; 00187 }
|
|
Creates an INSERT SQL-statement for $table from the array with field/value pairs $fields_values. Usage count/core: 4
Definition at line 332 of file class.t3lib_db.php. References quoteStr(), and table(). 00332 { 00333 00334 // Table and fieldnames should be "SQL-injection-safe" when supplied to this function (contrary to values in the arrays which may be insecure). 00335 if (is_array($fields_values) && count($fields_values)) { 00336 00337 // Add slashes old-school: 00338 foreach($fields_values as $k => $v) { 00339 $fields_values[$k] = $this->quoteStr($fields_values[$k], $table); 00340 } 00341 00342 // Build query: 00343 $query = 'INSERT INTO '.$table.' 00344 ( 00345 '.implode(', 00346 ',array_keys($fields_values)).' 00347 ) VALUES ( 00348 "'.implode('", 00349 "',$fields_values).'" 00350 )'; 00351 00352 // Return query: 00353 if ($this->debugOutput) $this->debug_lastBuiltQuery = $query; 00354 return $query; 00355 } 00356 }
|
|
Returns a WHERE clause that can find a value ($value) in a list field ($field) For instance a record in the database might contain a list of numbers, "34,234,5" (with no spaces between). This query would be able to select that record based on the value "34", "234" or "5" regardless of their positioni in the list (left, middle or right). Is nice to look up list-relations to records or files in TYPO3 database tables.
Definition at line 477 of file class.t3lib_db.php. References quoteStr(), and table(). 00477 { 00478 $command = $this->quoteStr($value, $table); 00479 $where = '('.$field.' LIKE "%,'.$command.',%" OR '.$field.' LIKE "'.$command.',%" OR '.$field.' LIKE "%,'.$command.'" OR '.$field.'="'.$command.'")'; 00480 return $where; 00481 }
|
|
Substitution for PHP function "addslashes()" Use this function instead of the PHP addslashes() function when you build queries - this will prepare your code for DBAL. Usage count/core: 105
Definition at line 537 of file class.t3lib_db.php. Referenced by INSERTquery(), and listQuery(). 00537 {
00538 return addslashes($str);
00539 }
|
|
Returns a WHERE clause which will make an AND search for the words in the $searchWords array in any of the fields in array $fields.
Definition at line 491 of file class.t3lib_db.php. 00491 { 00492 $queryParts = array(); 00493 00494 foreach($searchWords as $sw) { 00495 $like=' LIKE "%'.$this->quoteStr($sw, $table).'%"'; 00496 $queryParts[] = $table.'.'.implode($like.' OR '.$table.'.',$fields).$like; 00497 } 00498 $query = '('.implode(') AND (',$queryParts).')'; 00499 return $query ; 00500 }
|
|
Creates a SELECT SQL-statement Usage count/core: 11.
Definition at line 436 of file class.t3lib_db.php. 00436 { 00437 00438 // Table and fieldnames should be "SQL-injection-safe" when supplied to this function 00439 // Build basic query: 00440 $query = 'SELECT '.$select_fields.' 00441 FROM '.$from_table. 00442 (strlen($where_clause)>0 ? ' 00443 WHERE 00444 '.$where_clause : ''); 00445 00446 // Group by: 00447 if (strlen($groupBy)>0) { 00448 $query.= ' 00449 GROUP BY '.$groupBy; 00450 } 00451 // Order by: 00452 if (strlen($orderBy)>0) { 00453 $query.= ' 00454 ORDER BY '.$orderBy; 00455 } 00456 // Group by: 00457 if (strlen($limit)>0) { 00458 $query.= ' 00459 LIMIT '.$limit; 00460 } 00461 00462 // Return query: 00463 if ($this->debugOutput) $this->debug_lastBuiltQuery = $query; 00464 return $query; 00465 }
|
|
Takes the last part of a query, eg. "... uid=123 GROUP BY title ORDER BY title LIMIT 5,2" and splits each part into a table (WHERE, GROUPBY, ORDERBY, LIMIT) Work-around function for use where you know some userdefined end to an SQL clause is supplied and you need to separate these factors. Usage count/core: 13
Definition at line 606 of file class.t3lib_db.php. 00606 { 00607 $str = ' '.$str; // Prepending a space to make sure "[[:space:]]+" will find a space there for the first element. 00608 // Init output array: 00609 $wgolParts = array( 00610 'WHERE' => '', 00611 'GROUPBY' => '', 00612 'ORDERBY' => '', 00613 'LIMIT' => '' 00614 ); 00615 00616 // Find LIMIT: 00617 if (eregi('^(.*)[[:space:]]+LIMIT[[:space:]]+([[:alnum:][:space:],._]+)$',$str,$reg)) { 00618 $wgolParts['LIMIT'] = trim($reg[2]); 00619 $str = $reg[1]; 00620 } 00621 00622 // Find ORDER BY: 00623 if (eregi('^(.*)[[:space:]]+ORDER[[:space:]]+BY[[:space:]]+([[:alnum:][:space:],._]+)$',$str,$reg)) { 00624 $wgolParts['ORDERBY'] = trim($reg[2]); 00625 $str = $reg[1]; 00626 } 00627 00628 // Find GROUP BY: 00629 if (eregi('^(.*)[[:space:]]+GROUP[[:space:]]+BY[[:space:]]+([[:alnum:][:space:],._]+)$',$str,$reg)) { 00630 $wgolParts['GROUPBY'] = trim($reg[2]); 00631 $str = $reg[1]; 00632 } 00633 00634 // Rest is assumed to be "WHERE" clause: 00635 $wgolParts['WHERE'] = $str; 00636 00637 return $wgolParts; 00638 }
|
|
Executes query mysql() wrapper function DEPRECIATED - use exec_* functions from this class instead! Usage count/core: 9.
Definition at line 671 of file class.t3lib_db.php. References debug(), and sql(). Referenced by sql(). 00671 { 00672 $res = mysql_query($query, $this->link); 00673 if ($this->debugOutput) $this->debug('sql'); 00674 return $res; 00675 }
|
|
Returns the number of rows affected by the last INSERT, UPDATE or DELETE query mysql_affected_rows() wrapper function Usage count/core: 1.
Definition at line 769 of file class.t3lib_db.php. 00769 {
00770 return mysql_affected_rows($this->link);
00771 }
|
|
Move internal result pointer mysql_data_seek() wrapper function Usage count/core: 3.
Definition at line 782 of file class.t3lib_db.php. 00782 {
00783 return mysql_data_seek($res,$seek);
00784 }
|
|
Returns the error status on the last sql() execution mysql_error() wrapper function Usage count/core: 32.
Definition at line 698 of file class.t3lib_db.php. Referenced by debug(), and exec_SELECTgetRows(). 00698 {
00699 return mysql_error($this->link);
00700 }
|
|
Returns an associative array that corresponds to the fetched row, or FALSE if there are no more rows. mysql_fetch_assoc() wrapper function Usage count/core: 307
Definition at line 722 of file class.t3lib_db.php. Referenced by exec_SELECTgetRows(). 00722 {
00723 return mysql_fetch_assoc($res);
00724 }
|
|
Returns an array that corresponds to the fetched row, or FALSE if there are no more rows. The array contains the values in numerical indices. mysql_fetch_row() wrapper function Usage count/core: 56
Definition at line 735 of file class.t3lib_db.php. 00735 {
00736 return mysql_fetch_row($res);
00737 }
|
|
Get the type of the specified field in a result mysql_field_type() wrapper function Usage count/core: 2.
Definition at line 795 of file class.t3lib_db.php. 00795 {
00796 return mysql_field_type($res,$pointer);
00797 }
|
|
Free result memory mysql_free_result() wrapper function Usage count/core: 3.
Definition at line 747 of file class.t3lib_db.php. 00747 {
00748 return mysql_free_result($res);
00749 }
|
|
Get the ID generated from the previous INSERT operation mysql_insert_id() wrapper function Usage count/core: 13.
Definition at line 758 of file class.t3lib_db.php. 00758 {
00759 return mysql_insert_id($this->link);
00760 }
|
|
Returns the number of selected rows. mysql_num_rows() wrapper function Usage count/core: 85
Definition at line 710 of file class.t3lib_db.php. 00710 {
00711 return mysql_num_rows($res);
00712 }
|
|
Open a (persistent) connection to a MySQL server mysql_pconnect() wrapper function Usage count/core: 12.
Definition at line 809 of file class.t3lib_db.php. References TYPO3_db_host, TYPO3_db_password, and TYPO3_db_username. 00809 { 00810 if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['no_pconnect']) { 00811 $this->link = mysql_connect($TYPO3_db_host, $TYPO3_db_username, $TYPO3_db_password); 00812 } else { 00813 $this->link = mysql_pconnect($TYPO3_db_host, $TYPO3_db_username, $TYPO3_db_password); 00814 } 00815 return $this->link; 00816 }
|
|
Executes query mysql_query() wrapper function Usage count/core: 1.
Definition at line 685 of file class.t3lib_db.php. References debug(), and sql_query(). Referenced by sql_query(). 00685 { 00686 $res = mysql_query($query, $this->link); 00687 if ($this->debugOutput) $this->debug('sql_query'); 00688 return $res; 00689 }
|
|
Select a MySQL database mysql_select_db() wrapper function Usage count/core: 8.
Definition at line 826 of file class.t3lib_db.php. References TYPO3_db. Referenced by admin_get_dbs(). 00826 {
00827 return mysql_select_db($TYPO3_db, $this->link);
00828 }
|
|
Removes the prefix "GROUP BY" from the input string. This function is used when you call the SELECTquery() function and want to pass the GROUP BY parameter by can't guarantee that "GROUP BY" is not prefixed. Generally; This function provides a work-around to the situation where you cannot pass only the fields by which to order the result. Usage count/core: 1
Definition at line 594 of file class.t3lib_db.php. 00594 { 00595 return eregi_replace('^GROUP[[:space:]]+BY[[:space:]]+','',trim($str)); 00596 }
|
|
Removes the prefix "ORDER BY" from the input string. This function is used when you call the exec_SELECTquery() function and want to pass the ORDER BY parameter by can't guarantee that "ORDER BY" is not prefixed. Generally; This function provides a work-around to the situation where you cannot pass only the fields by which to order the result. Usage count/core: 11
Definition at line 580 of file class.t3lib_db.php. 00580 { 00581 return eregi_replace('^ORDER[[:space:]]+BY[[:space:]]+','',trim($str)); 00582 }
|
|
Creates an UPDATE SQL-statement for $table where $where-clause (typ. 'uid=...') from the array with field/value pairs $fields_values. Usage count/core: 6
Definition at line 368 of file class.t3lib_db.php. 00368 { 00369 00370 // Table and fieldnames should be "SQL-injection-safe" when supplied to this function (contrary to values in the arrays which may be insecure). 00371 if (is_string($where)) { 00372 if (is_array($fields_values) && count($fields_values)) { 00373 00374 // Add slashes old-school: 00375 $nArr = array(); 00376 foreach($fields_values as $k => $v) { 00377 $nArr[] = $k.'="'.$this->quoteStr($v, $table).'"'; 00378 } 00379 00380 // Build query: 00381 $query = 'UPDATE '.$table.' 00382 SET 00383 '.implode(', 00384 ',$nArr). 00385 (strlen($where)>0 ? ' 00386 WHERE 00387 '.$where : ''); 00388 00389 // Return query: 00390 if ($this->debugOutput) $this->debug_lastBuiltQuery = $query; 00391 return $query; 00392 } 00393 } else { 00394 die('<strong>TYPO3 Fatal Error:</strong> "Where" clause argument for UPDATE query was not a string in $this->UPDATEquery() !'); 00395 } 00396 }
|
|
Definition at line 137 of file class.t3lib_db.php. |
|
Definition at line 136 of file class.t3lib_db.php. |
|
Definition at line 140 of file class.t3lib_db.php. |