Index: t3lib/class.t3lib_sqlparser.php =================================================================== --- t3lib/class.t3lib_sqlparser.php (revision 6276) +++ t3lib/class.t3lib_sqlparser.php (working copy) @@ -126,7 +126,7 @@ * @return array Result array with all the parts in - or error message string * @see compileSQL(), debug_testSQL() */ - function parseSQL($parseString) { + public function parseSQL($parseString) { // Prepare variables: $parseString = $this->trimSQL($parseString); $this->parse_error = ''; @@ -189,7 +189,7 @@ * @return mixed Returns array with components of SELECT query on success, otherwise an error message string. * @see compileSELECT() */ - function parseSELECT($parseString) { + private function parseSELECT($parseString) { // Removing SELECT: $parseString = $this->trimSQL($parseString); @@ -258,7 +258,7 @@ * @return mixed Returns array with components of UPDATE query on success, otherwise an error message string. * @see compileUPDATE() */ - function parseUPDATE($parseString) { + private function parseUPDATE($parseString) { // Removing UPDATE $parseString = $this->trimSQL($parseString); @@ -312,7 +312,7 @@ * @return mixed Returns array with components of INSERT query on success, otherwise an error message string. * @see compileINSERT() */ - function parseINSERT($parseString) { + private function parseINSERT($parseString) { // Removing INSERT $parseString = $this->trimSQL($parseString); @@ -372,7 +372,7 @@ * @return mixed Returns array with components of DELETE query on success, otherwise an error message string. * @see compileDELETE() */ - function parseDELETE($parseString) { + private function parseDELETE($parseString) { // Removing DELETE $parseString = $this->trimSQL($parseString); @@ -410,7 +410,7 @@ * @return mixed Returns array with components of EXPLAIN query on success, otherwise an error message string. * @see parseSELECT() */ - function parseEXPLAIN($parseString) { + private function parseEXPLAIN($parseString) { // Removing EXPLAIN $parseString = $this->trimSQL($parseString); @@ -432,7 +432,7 @@ * @return mixed Returns array with components of CREATE TABLE query on success, otherwise an error message string. * @see compileCREATETABLE() */ - function parseCREATETABLE($parseString) { + private function parseCREATETABLE($parseString) { // Removing CREATE TABLE $parseString = $this->trimSQL($parseString); @@ -511,7 +511,7 @@ * @return mixed Returns array with components of ALTER TABLE query on success, otherwise an error message string. * @see compileALTERTABLE() */ - function parseALTERTABLE($parseString) { + private function parseALTERTABLE($parseString) { // Removing ALTER TABLE $parseString = $this->trimSQL($parseString); @@ -580,7 +580,7 @@ * @param string SQL string starting with DROP TABLE * @return mixed Returns array with components of DROP TABLE query on success, otherwise an error message string. */ - function parseDROPTABLE($parseString) { + private function parseDROPTABLE($parseString) { // Removing DROP TABLE $parseString = $this->trimSQL($parseString); @@ -613,7 +613,7 @@ * @param string SQL string starting with CREATE DATABASE * @return mixed Returns array with components of CREATE DATABASE query on success, otherwise an error message string. */ - function parseCREATEDATABASE($parseString) { + private function parseCREATEDATABASE($parseString) { // Removing CREATE DATABASE $parseString = $this->trimSQL($parseString); @@ -667,7 +667,7 @@ * @return array If successful parsing, returns an array, otherwise an error string. * @see compileFieldList() */ - function parseFieldList(&$parseString, $stopRegex='') { + public function parseFieldList(&$parseString, $stopRegex = '') { $stack = array(); // Contains the parsed content @@ -788,7 +788,7 @@ * @return array If successful parsing, returns an array, otherwise an error string. * @see compileFromTables() */ - function parseFromTables(&$parseString, $stopRegex='') { + public function parseFromTables(&$parseString, $stopRegex = '') { // Prepare variables: $parseString = $this->trimSQL($parseString); @@ -886,7 +886,7 @@ * @param string Regular expressing to STOP parsing, eg. '^(GROUP BY|ORDER BY|LIMIT)([[:space:]]*)' * @return mixed If successful parsing, returns an array, otherwise an error string. */ - function parseWhereClause(&$parseString, $stopRegex='') { + public function parseWhereClause(&$parseString, $stopRegex = '') { // Prepare variables: $parseString = $this->trimSQL($parseString); @@ -1005,7 +1005,7 @@ * @param string Regular expressing to STOP parsing, eg. '^(GROUP BY|ORDER BY|LIMIT)([[:space:]]*)' * @return mixed If successful parsing, returns an array, otherwise an error string. */ - function parseFieldDef(&$parseString, $stopRegex='') { + public function parseFieldDef(&$parseString, $stopRegex = '') { // Prepare variables: $parseString = $this->trimSQL($parseString); $this->lastStopKeyWord = ''; @@ -1068,7 +1068,7 @@ * @param boolean If set the full match of the regex is stripped of the beginning of the string! * @return string The value of the first parenthesis level of the REGEX. */ - function nextPart(&$parseString,$regex,$trimAll=FALSE) { + private function nextPart(&$parseString, $regex, $trimAll = FALSE) { $reg = array(); if (preg_match('/'.$regex.'/i',$parseString.' ', $reg)) { // Adding space char because [[:space:]]+ is often a requirement in regex's $parseString = ltrim(substr($parseString,strlen($reg[$trimAll?0:1]))); @@ -1083,7 +1083,7 @@ * @param string The comparator used before. If "NOT IN" or "IN" then the value is expected to be a list of values. Otherwise just an integer (un-quoted) or string (quoted) * @return mixed The value (string/integer). Otherwise an array with error message in first key (0) */ - function getValue(&$parseString,$comparator='') { + private function getValue(&$parseString, $comparator = '') { $value = ''; if (t3lib_div::inList('NOTIN,IN,_LIST',strtoupper(str_replace(array(' ',"\n","\r","\t"),'',$comparator)))) { // List of values: @@ -1141,7 +1141,7 @@ * @param string The quote used; input either " or ' * @return string The value, passed through stripslashes() ! */ - function getValueInQuotes(&$parseString,$quote) { + private function getValueInQuotes(&$parseString, $quote) { $parts = explode($quote,substr($parseString,1)); $buffer = ''; @@ -1166,7 +1166,7 @@ * @param string Input string * @return string Output string */ - function parseStripslashes($str) { + private function parseStripslashes($str) { $search = array('\\\\', '\\\'', '\\"', '\0', '\n', '\r', '\Z'); $replace = array('\\', '\'', '"', "\x00", "\x0a", "\x0d", "\x1a"); @@ -1180,7 +1180,7 @@ * @param string Input string * @return string Output string */ - function compileAddslashes($str) { + protected function compileAddslashes($str) { return $str; $search = array('\\', '\'', '"', "\x00", "\x0a", "\x0d", "\x1a"); $replace = array('\\\\', '\\\'', '\\"', '\0', '\n', '\r', '\Z'); @@ -1195,7 +1195,7 @@ * @param string Remaining query to parse. * @return string Error message. */ - function parseError($msg,$restQuery) { + private function parseError($msg, $restQuery) { $this->parse_error = 'SQL engine parse ERROR: '.$msg.': near "'.substr($restQuery,0,50).'"'; return $this->parse_error; } @@ -1209,7 +1209,7 @@ * @param string Input string * @return string Output string */ - function trimSQL($str) { + private function trimSQL($str) { return trim(rtrim($str, "; \r\n\t")).' '; } @@ -1237,7 +1237,7 @@ * @return string SQL query * @see parseSQL() */ - function compileSQL($components) { + public function compileSQL($components) { switch($components['type']) { case 'SELECT': $query = $this->compileSELECT($components); @@ -1275,7 +1275,7 @@ * @return string SQL SELECT query * @see parseSELECT() */ - function compileSELECT($components) { + private function compileSELECT($components) { // Initialize: $where = $this->compileWhereClause($components['WHERE']); @@ -1306,7 +1306,7 @@ * @return string SQL UPDATE query * @see parseUPDATE() */ - function compileUPDATE($components) { + private function compileUPDATE($components) { // Where clause: $where = $this->compileWhereClause($components['WHERE']); @@ -1334,7 +1334,7 @@ * @return string SQL INSERT query * @see parseINSERT() */ - function compileINSERT($components) { + protected function compileINSERT($components) { if ($components['VALUES_ONLY']) { // Initialize: @@ -1374,7 +1374,7 @@ * @return string SQL DELETE query * @see parseDELETE() */ - function compileDELETE($components) { + private function compileDELETE($components) { // Where clause: $where = $this->compileWhereClause($components['WHERE']); @@ -1394,7 +1394,7 @@ * @return string SQL CREATE TABLE query * @see parseCREATETABLE() */ - function compileCREATETABLE($components) { + protected function compileCREATETABLE($components) { // Create fields and keys: $fieldsKeys = array(); @@ -1427,7 +1427,7 @@ * @return string SQL ALTER TABLE query * @see parseALTERTABLE() */ - function compileALTERTABLE($components) { + protected function compileALTERTABLE($components) { // Make query: $query = 'ALTER TABLE '.$components['TABLE'].' '.$components['action'].' '.($components['FIELD']?$components['FIELD']:$components['KEY']); @@ -1480,7 +1480,7 @@ * @return string Select field string * @see parseFieldList() */ - function compileFieldList($selectFields) { + public function compileFieldList($selectFields) { // Prepare buffer variable: $outputParts = array(); @@ -1522,7 +1522,7 @@ * @return string Table name string * @see parseFromTables() */ - function compileFromTables($tablesArray) { + public function compileFromTables($tablesArray) { // Prepare buffer variable: $outputParts = array(); @@ -1568,7 +1568,7 @@ * @return string WHERE clause as string. * @see explodeWhereClause() */ - function compileWhereClause($clauseArray) { + public function compileWhereClause($clauseArray) { // Prepare buffer variable: $output=''; @@ -1622,7 +1622,7 @@ * @param array Field definition parts * @return string Field definition string */ - function compileFieldCfg($fieldCfg) { + protected function compileFieldCfg($fieldCfg) { // Set type: $cfg = $fieldCfg['fieldType']; @@ -1671,7 +1671,7 @@ * @param string SQL string to verify parsability of * @return mixed Returns array with string 1 and 2 if error, otherwise false */ - function debug_parseSQLpart($part,$str) { + public function debug_parseSQLpart($part, $str) { $retVal = false; switch($part) { @@ -1696,7 +1696,7 @@ * @param boolean If true, the strings are compared insensitive to case * @return mixed Returns array with string 1 and 2 if error, otherwise false */ - function debug_parseSQLpartCompare($str,$newStr,$caseInsensitive=FALSE) { + public function debug_parseSQLpartCompare($str, $newStr, $caseInsensitive = FALSE) { if ($caseInsensitive) { $str1 = strtoupper($str); $str2 = strtoupper($newStr); @@ -1729,7 +1729,7 @@ * @param string SQL query * @return string Query if all is well, otherwise exit. */ - function debug_testSQL($SQLquery) { + public function debug_testSQL($SQLquery) { // Getting result array: $parseResult = $this->parseSQL($SQLquery); Index: t3lib/class.t3lib_sqlengine.php =================================================================== --- t3lib/class.t3lib_sqlengine.php (revision 6276) +++ t3lib/class.t3lib_sqlengine.php (working copy) @@ -122,7 +122,7 @@ * @param object Parent object * @return void */ - function init($config, $pObj) { + public function init($config, $pObj) { } /** @@ -130,7 +130,7 @@ * * @return void */ - function resetStatusVars() { + public function resetStatusVars() { $this->errorStatus = ''; $this->lastInsertedId = 0; $this->lastAffectedRows = 0; @@ -146,7 +146,7 @@ * @param array $fInfo Field configuration data * @return mixed The processed input value */ - function processAccordingToConfig(&$value,$fInfo) { + private function processAccordingToConfig(&$value, $fInfo) { $options = $this->parseFieldDef($fInfo['Type']); switch(strtolower($options['fieldType'])) { @@ -201,7 +201,7 @@ * @param array Field values as key=>value pairs. * @return boolean TRUE on success and FALSE on failure (error is set internally) */ - function exec_INSERTquery($table,$fields_values) { + public function exec_INSERTquery($table, $fields_values) { // Initialize $this->resetStatusVars(); @@ -269,7 +269,7 @@ * @param array Field values as key=>value pairs. * @return boolean TRUE on success and FALSE on failure (error is set internally) */ - function exec_UPDATEquery($table,$where,$fields_values) { + public function exec_UPDATEquery($table, $where, $fields_values) { // Initialize: $this->resetStatusVars(); @@ -328,7 +328,7 @@ * @param string WHERE clause * @return boolean TRUE on success and FALSE on failure (error is set internally) */ - function exec_DELETEquery($table,$where) { + public function exec_DELETEquery($table, $where) { // Initialize: $this->resetStatusVars(); @@ -379,7 +379,7 @@ * @param string Optional LIMIT value ([begin,]max), if none, supply blank string. * @return object Returns result object, but if errors, returns false */ - function exec_SELECTquery($select_fields,$from_table,$where_clause,$groupBy,$orderBy,$limit) { + public function exec_SELECTquery($select_fields, $from_table, $where_clause, $groupBy, $orderBy, $limit) { // Initialize: $this->resetStatusVars(); @@ -422,7 +422,7 @@ * @param string Query to execute * @return object Result object or false if error */ - function sql_query($query) { + public function sql_query($query) { $res = t3lib_div::makeInstance('t3lib_sqlengine_resultobj'); $res->result = array(); return $res; @@ -433,7 +433,7 @@ * * @return string Error message, if any */ - function sql_error() { + public function sql_error() { return $this->errorStatus; } @@ -442,7 +442,7 @@ * * @return integer Last unique id created. */ - function sql_insert_id() { + public function sql_insert_id() { return $this->lastInsertedId; } @@ -451,7 +451,7 @@ * * @return integer Last amount of affected rows. */ - function sql_affected_rows() { + public function sql_affected_rows() { return $this->lastAffectedRows; } @@ -461,7 +461,7 @@ * @param string Input String * @return string String, with quotes escaped */ - function quoteStr($str) { + public function quoteStr($str) { return addslashes($str); } @@ -487,7 +487,7 @@ * @return array Tables in an array (tablename is in both key and value) * @todo Should return table details in value! see t3lib_db::admin_get_tables() */ - function admin_get_tables() { + public function admin_get_tables() { $whichTables = array(); return $whichTables; } @@ -498,7 +498,7 @@ * @param string Table name * @return array Field information in an associative array with fieldname => field row */ - function admin_get_fields($tableName) { + public function admin_get_fields($tableName) { $output = array(); return $output; } @@ -509,7 +509,7 @@ * @param string Table name * @return array Key information in a numeric array */ - function admin_get_keys($tableName) { + public function admin_get_keys($tableName) { $output = array(); return $output; } @@ -520,7 +520,7 @@ * @param string Query to execute * @return pointer Result pointer */ - function admin_query($query) { + public function admin_query($query) { return $this->sql_query($query); } @@ -545,7 +545,7 @@ * @return void * @todo Table locking tools? */ - function readDataSource($table) { + public function readDataSource($table) { $this->data[$table] = array(); } @@ -557,7 +557,7 @@ * @return void * @todo Table locking tools? */ - function saveDataSource($table) { + public function saveDataSource($table) { debug($this->data[$table]); } @@ -587,7 +587,7 @@ * @param array Where clause parsed into array * @return array Array of keys pointing to result rows in $this->data[$table] */ - function selectFromData($table,$where) { + public function selectFromData($table, $where) { $output = array(); if (is_array($this->data[$table])) { @@ -625,7 +625,7 @@ * @return void Data array passed by reference * @see selectFromData() */ - function select_evalSingle($table,$config,&$itemKeys) { + public function select_evalSingle($table,$config,&$itemKeys) { $neg = preg_match('/^AND[[:space:]]+NOT$/',trim($config['operator'])); if (is_array($config['sub'])) { @@ -744,7 +744,7 @@ * @param string Fieldlist (commaseparated) * @return array Result array with "rows" */ - function getResultSet($keys, $table, $fieldList) { + public function getResultSet($keys, $table, $fieldList) { $fields = t3lib_div::trimExplode(',',$fieldList); $output = array(); @@ -787,7 +787,7 @@ * @param array Result set array (array of rows) * @return string HTML table */ - function debug_printResultSet($array) { + public function debug_printResultSet($array) { if (count($array)) { $tRows=array(); @@ -840,7 +840,7 @@ * * @return integer */ - function sql_num_rows() { + public function sql_num_rows() { return count($this->result); } @@ -849,7 +849,7 @@ * * @return array Associative array */ - function sql_fetch_assoc() { + public function sql_fetch_assoc() { $row = current($this->result); next($this->result); return $row; @@ -860,7 +860,7 @@ * * @return array Numerical array */ - function sql_fetch_row() { + public function sql_fetch_row() { $resultRow = $this->sql_fetch_assoc(); if (is_array($resultRow)) { @@ -878,7 +878,7 @@ * @param integer Position pointer. * @return boolean Returns true on success */ - function sql_data_seek($pointer) { + public function sql_data_seek($pointer) { reset($this->result); for ($a=0;$a<$pointer;$a++) { next($this->result); @@ -891,7 +891,7 @@ * * @return string Blank string, not supported (it seems) */ - function sql_field_type() { + public function sql_field_type() { return ''; } }