From 0ea392937fd9e0a135e16cc7a645e4068f456f5d Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 25 Dec 2011 18:48:46 +0200 Subject: Improve the Zip library --- system/libraries/Zip.php | 70 +++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 52f1bc3d0..3c66c6b3a 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -1,13 +1,13 @@ -now); - - $time['file_mtime'] = ($date['hours'] << 11) + ($date['minutes'] << 5) + $date['seconds'] / 2; - $time['file_mdate'] = (($date['year'] - 1980) << 9) + ($date['mon'] << 5) + $date['mday']; + + $time = array( + 'file_mtime' => ($date['hours'] << 11) + ($date['minutes'] << 5) + $date['seconds'] / 2, + 'file_mdate' => (($date['year'] - 1980) << 9) + ($date['mon'] << 5) + $date['mday'] + ); return $time; } @@ -117,7 +119,7 @@ class CI_Zip { * @param string the directory name * @return void */ - function _add_dir($dir, $file_mtime, $file_mdate) + private function _add_dir($dir, $file_mtime, $file_mdate) { $dir = str_replace("\\", "/", $dir); @@ -170,21 +172,19 @@ class CI_Zip { * @param string * @return void */ - function add_data($filepath, $data = NULL) + public function add_data($filepath, $data = NULL) { if (is_array($filepath)) { foreach ($filepath as $path => $data) { $file_data = $this->_get_mod_time($path); - $this->_add_data($path, $data, $file_data['file_mtime'], $file_data['file_mdate']); } } else { $file_data = $this->_get_mod_time($filepath); - $this->_add_data($filepath, $data, $file_data['file_mtime'], $file_data['file_mdate']); } } @@ -199,7 +199,7 @@ class CI_Zip { * @param string the data to be encoded * @return void */ - function _add_data($filepath, $data, $file_mtime, $file_mdate) + private function _add_data($filepath, $data, $file_mtime, $file_mdate) { $filepath = str_replace("\\", "/", $filepath); @@ -251,7 +251,7 @@ class CI_Zip { * @access public * @return bool */ - function read_file($path, $preserve_filepath = FALSE) + public function read_file($path, $preserve_filepath = FALSE) { if ( ! file_exists($path)) { @@ -286,7 +286,7 @@ class CI_Zip { * @param string path to source * @return bool */ - function read_dir($path, $preserve_filepath = TRUE, $root_path = NULL) + public function read_dir($path, $preserve_filepath = TRUE, $root_path = NULL) { if ( ! $fp = @opendir($path)) { @@ -301,7 +301,7 @@ class CI_Zip { while (FALSE !== ($file = readdir($fp))) { - if (substr($file, 0, 1) == '.') + if ($file[0] === '.') { continue; } @@ -337,7 +337,7 @@ class CI_Zip { * @access public * @return binary string */ - function get_zip() + public function get_zip() { // Is there any data to return? if ($this->entries == 0) @@ -345,15 +345,13 @@ class CI_Zip { return FALSE; } - $zip_data = $this->zipdata; - $zip_data .= $this->directory."\x50\x4b\x05\x06\x00\x00\x00\x00"; - $zip_data .= pack('v', $this->entries); // total # of entries "on this disk" - $zip_data .= pack('v', $this->entries); // total # of entries overall - $zip_data .= pack('V', strlen($this->directory)); // size of central dir - $zip_data .= pack('V', strlen($this->zipdata)); // offset to start of central dir - $zip_data .= "\x00\x00"; // .zip file comment length - - return $zip_data; + return $this->zipdata + . $this->directory."\x50\x4b\x05\x06\x00\x00\x00\x00" + . pack('v', $this->entries) // total # of entries "on this disk" + . pack('v', $this->entries) // total # of entries overall + . pack('V', strlen($this->directory)) // size of central dir + . pack('V', strlen($this->zipdata)) // offset to start of central dir + . "\x00\x00"; // .zip file comment length } // -------------------------------------------------------------------- @@ -367,7 +365,7 @@ class CI_Zip { * @param string the file name * @return bool */ - function archive($filepath) + public function archive($filepath) { if ( ! ($fp = @fopen($filepath, FOPEN_WRITE_CREATE_DESTRUCTIVE))) { @@ -392,7 +390,7 @@ class CI_Zip { * @param string the data to be encoded * @return bool */ - function download($filename = 'backup.zip') + public function download($filename = 'backup.zip') { if ( ! preg_match("|.+?\.zip$|", $filename)) { @@ -420,7 +418,7 @@ class CI_Zip { * @access public * @return void */ - function clear_data() + public function clear_data() { $this->zipdata = ''; $this->directory = ''; @@ -432,4 +430,4 @@ class CI_Zip { } /* End of file Zip.php */ -/* Location: ./system/libraries/Zip.php */ \ No newline at end of file +/* Location: ./system/libraries/Zip.php */ -- cgit v1.2.3-24-g4f1b From b9535c80cc389952912f456f2c68665398b71494 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Dec 2011 16:21:17 +0200 Subject: Update with suggestions from gaker & dixy --- system/libraries/Zip.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 3c66c6b3a..7a97914c0 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -97,7 +97,7 @@ class CI_Zip { * @param string path to file * @return array filemtime/filemdate */ - private function _get_mod_time($dir) + protected function _get_mod_time($dir) { // filemtime() may return false, but raises an error for non-existing files $date = (file_exists($dir)) ? filemtime($dir): getdate($this->now); @@ -115,11 +115,11 @@ class CI_Zip { /** * Add Directory * - * @access private + * @access protected * @param string the directory name * @return void */ - private function _add_dir($dir, $file_mtime, $file_mdate) + protected function _add_dir($dir, $file_mtime, $file_mdate) { $dir = str_replace("\\", "/", $dir); @@ -194,12 +194,12 @@ class CI_Zip { /** * Add Data to Zip * - * @access private + * @access protected * @param string the file name/path * @param string the data to be encoded * @return void */ - private function _add_data($filepath, $data, $file_mtime, $file_mdate) + protected function _add_data($filepath, $data, $file_mtime, $file_mdate) { $filepath = str_replace("\\", "/", $filepath); @@ -288,6 +288,8 @@ class CI_Zip { */ public function read_dir($path, $preserve_filepath = TRUE, $root_path = NULL) { + $path = rtrim($path, '/\\').DIRECTORY_SEPARATOR; + if ( ! $fp = @opendir($path)) { return FALSE; @@ -425,6 +427,7 @@ class CI_Zip { $this->entries = 0; $this->file_num = 0; $this->offset = 0; + return $this; } } -- cgit v1.2.3-24-g4f1b From b1f3f57c65083904fe899753043419a25b073898 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 27 Dec 2011 02:38:39 +0200 Subject: Remove access lines from method descriptions --- system/libraries/Zip.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 7a97914c0..d60b99462 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -68,7 +68,6 @@ class CI_Zip { * * Lets you add a virtual directory into which you can place files. * - * @access public * @param mixed the directory name. Can be string or array * @return void */ @@ -115,7 +114,6 @@ class CI_Zip { /** * Add Directory * - * @access protected * @param string the directory name * @return void */ @@ -167,7 +165,6 @@ class CI_Zip { * in the filename it will be placed within a directory. Make * sure you use add_dir() first to create the folder. * - * @access public * @param mixed * @param string * @return void @@ -194,7 +191,6 @@ class CI_Zip { /** * Add Data to Zip * - * @access protected * @param string the file name/path * @param string the data to be encoded * @return void @@ -248,7 +244,6 @@ class CI_Zip { /** * Read the contents of a file and add it to the zip * - * @access public * @return bool */ public function read_file($path, $preserve_filepath = FALSE) @@ -282,7 +277,6 @@ class CI_Zip { * sub-folders) and creates a zip based on it. Whatever directory structure * is in the original file path will be recreated in the zip file. * - * @access public * @param string path to source * @return bool */ @@ -336,7 +330,6 @@ class CI_Zip { /** * Get the Zip file * - * @access public * @return binary string */ public function get_zip() @@ -363,7 +356,6 @@ class CI_Zip { * * Lets you write a file * - * @access public * @param string the file name * @return bool */ @@ -387,7 +379,6 @@ class CI_Zip { /** * Download * - * @access public * @param string the file name * @param string the data to be encoded * @return bool @@ -417,7 +408,6 @@ class CI_Zip { * Lets you clear current zip data. Useful if you need to create * multiple zips with different data. * - * @access public * @return void */ public function clear_data() -- cgit v1.2.3-24-g4f1b From cfbd15b6d052c1cb93fb5fa08e35fa7d3c6c7751 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 8 Jan 2012 06:41:41 +0200 Subject: Some more misc. stuff --- system/libraries/Zip.php | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index d60b99462..2ed79f0e3 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -51,13 +51,9 @@ class CI_Zip { public $offset = 0; public $now; - /** - * Constructor - */ public function __construct() { - log_message('debug', "Zip Compression Class Initialized"); - + log_message('debug', 'Zip Compression Class Initialized'); $this->now = time(); } @@ -75,13 +71,12 @@ class CI_Zip { { foreach ((array)$directory as $dir) { - if ( ! preg_match("|.+/$|", $dir)) + if ( ! preg_match('|.+/$|', $dir)) { $dir .= '/'; } $dir_time = $this->_get_mod_time($dir); - $this->_add_dir($dir, $dir_time['file_mtime'], $dir_time['file_mdate']); } } @@ -101,12 +96,10 @@ class CI_Zip { // filemtime() may return false, but raises an error for non-existing files $date = (file_exists($dir)) ? filemtime($dir): getdate($this->now); - $time = array( + return array( 'file_mtime' => ($date['hours'] << 11) + ($date['minutes'] << 5) + $date['seconds'] / 2, 'file_mdate' => (($date['year'] - 1980) << 9) + ($date['mon'] << 5) + $date['mday'] ); - - return $time; } // -------------------------------------------------------------------- @@ -197,13 +190,11 @@ class CI_Zip { */ protected function _add_data($filepath, $data, $file_mtime, $file_mdate) { - $filepath = str_replace("\\", "/", $filepath); + $filepath = str_replace('\\', '/', $filepath); $uncompressed_size = strlen($data); $crc32 = crc32($data); - - $gzdata = gzcompress($data); - $gzdata = substr($gzdata, 2, -4); + $gzdata = substr(gzcompress($data), 2, -4); $compressed_size = strlen($gzdata); $this->zipdata .= @@ -255,16 +246,16 @@ class CI_Zip { if (FALSE !== ($data = file_get_contents($path))) { - $name = str_replace("\\", "/", $path); - + $name = str_replace('\\', '/', $path); if ($preserve_filepath === FALSE) { - $name = preg_replace("|.*/(.+)|", "\\1", $name); + $name = preg_replace('|.*/(.+)|', '\\1', $name); } $this->add_data($name, $data); return TRUE; } + return FALSE; } @@ -282,7 +273,7 @@ class CI_Zip { */ public function read_dir($path, $preserve_filepath = TRUE, $root_path = NULL) { - $path = rtrim($path, '/\\').DIRECTORY_SEPARATOR; + $path = rtrim($path, '/\\').'/'; if ( ! $fp = @opendir($path)) { @@ -304,14 +295,13 @@ class CI_Zip { if (@is_dir($path.$file)) { - $this->read_dir($path.$file."/", $preserve_filepath, $root_path); + $this->read_dir($path.$file.'/', $preserve_filepath, $root_path); } else { if (FALSE !== ($data = file_get_contents($path.$file))) { - $name = str_replace("\\", "/", $path); - + $name = str_replace('\\', '/', $path); if ($preserve_filepath === FALSE) { $name = str_replace($root_path, '', $name); @@ -335,7 +325,7 @@ class CI_Zip { public function get_zip() { // Is there any data to return? - if ($this->entries == 0) + if ($this->entries === 0) { return FALSE; } @@ -392,9 +382,7 @@ class CI_Zip { $CI =& get_instance(); $CI->load->helper('download'); - $get_zip = $this->get_zip(); - $zip_content =& $get_zip; force_download($filename, $zip_content); -- cgit v1.2.3-24-g4f1b From e34f1a75ca78825bcf96c4344e01de412f6113bf Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 10 Jan 2012 22:41:52 +0200 Subject: Some quotes --- system/libraries/Zip.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 2ed79f0e3..dbcdb2d97 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -112,7 +112,7 @@ class CI_Zip { */ protected function _add_dir($dir, $file_mtime, $file_mdate) { - $dir = str_replace("\\", "/", $dir); + $dir = str_replace('\\', '/', $dir); $this->zipdata .= "\x50\x4b\x03\x04\x0a\x00\x00\x00\x00\x00" @@ -375,7 +375,7 @@ class CI_Zip { */ public function download($filename = 'backup.zip') { - if ( ! preg_match("|.+?\.zip$|", $filename)) + if ( ! preg_match('|.+?\.zip$|', $filename)) { $filename .= '.zip'; } -- cgit v1.2.3-24-g4f1b From 16d806605993305efe9c264b3ae8383ec92ae5ae Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 20 Jan 2012 13:26:49 +0200 Subject: Some more cleaning --- system/libraries/Zip.php | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index dbcdb2d97..85a0b5ce9 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -9,7 +9,7 @@ * Licensed under the Open Software License version 3.0 * * This source file is subject to the Open Software License (OSL 3.0) that is - * bundled with this package in the files license.txt / license.rst. It is + * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: * http://opensource.org/licenses/OSL-3.0 * If you did not receive a copy of the license and are unable to obtain it @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * Zip Compression Class * @@ -265,7 +263,7 @@ class CI_Zip { * Read a directory and add it to the zip. * * This function recursively reads a folder and everything it contains (including - * sub-folders) and creates a zip based on it. Whatever directory structure + * sub-folders) and creates a zip based on it. Whatever directory structure * is in the original file path will be recreated in the zip file. * * @param string path to source @@ -297,18 +295,14 @@ class CI_Zip { { $this->read_dir($path.$file.'/', $preserve_filepath, $root_path); } - else + elseif (FALSE !== ($data = file_get_contents($path.$file))) { - if (FALSE !== ($data = file_get_contents($path.$file))) + $name = str_replace('\\', '/', $path); + if ($preserve_filepath === FALSE) { - $name = str_replace('\\', '/', $path); - if ($preserve_filepath === FALSE) - { - $name = str_replace($root_path, '', $name); - } - - $this->add_data($name.$file, $data); + $name = str_replace($root_path, '', $name); } + $this->add_data($name.$file, $data); } } @@ -320,7 +314,7 @@ class CI_Zip { /** * Get the Zip file * - * @return binary string + * @return string (binary encoded) */ public function get_zip() { @@ -393,10 +387,10 @@ class CI_Zip { /** * Initialize Data * - * Lets you clear current zip data. Useful if you need to create + * Lets you clear current zip data. Useful if you need to create * multiple zips with different data. * - * @return void + * @return object */ public function clear_data() { -- cgit v1.2.3-24-g4f1b From 1841e6b472820deb2dfe4d43c675211eeabbd057 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 24 Jan 2012 15:30:01 +0200 Subject: Revert a space in the license agreement :) --- system/libraries/Zip.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 85a0b5ce9..e7c55de1b 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -9,7 +9,7 @@ * Licensed under the Open Software License version 3.0 * * This source file is subject to the Open Software License (OSL 3.0) that is - * bundled with this package in the files license.txt / license.rst. It is + * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: * http://opensource.org/licenses/OSL-3.0 * If you did not receive a copy of the license and are unable to obtain it -- cgit v1.2.3-24-g4f1b From 093fe17231b7e7ce371d0e19c44e7a5c5fb5a858 Mon Sep 17 00:00:00 2001 From: Iban Eguia Date: Fri, 27 Jan 2012 19:41:11 +0100 Subject: Added some more doctypes. Fixes #952. --- application/config/doctypes.php | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/application/config/doctypes.php b/application/config/doctypes.php index 984da5965..76e9534b2 100644 --- a/application/config/doctypes.php +++ b/application/config/doctypes.php @@ -5,9 +5,9 @@ * An open source application development framework for PHP 5.1.6 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Academic Free License version 3.0 - * + * * This source file is subject to the Academic Free License (AFL 3.0) that is * bundled with this package in the files license_afl.txt / license_afl.rst. * It is also available through the world wide web at this URL: @@ -26,15 +26,25 @@ */ $_doctypes = array( - 'xhtml11' => '', - 'xhtml1-strict' => '', - 'xhtml1-trans' => '', - 'xhtml1-frame' => '', - 'xhtml-basic11' => '', - 'html5' => '', - 'html4-strict' => '', - 'html4-trans' => '', - 'html4-frame' => '' + 'xhtml11' => '', + 'xhtml1-strict' => '', + 'xhtml1-trans' => '', + 'xhtml1-frame' => '', + 'xhtml-basic11' => '', + 'html5' => '', + 'html4-strict' => '', + 'html4-trans' => '', + 'html4-frame' => '', + 'mathml1' => '', + 'mathml2' => '', + 'svg11' => '', + 'svg10' => '', + 'svg11-basic' => '', + 'svg11-tiny' => '', + 'xhtml-math-svg-xh' => '', + 'xhtml-math-svg-sh' => '', + 'xhtml-rdfa-1' => '', + 'xhtml-rdfa-2' => '' ); /* End of file doctypes.php */ -- cgit v1.2.3-24-g4f1b From 0baf232d1d0f29585f1487b87905e1c1a08d5f23 Mon Sep 17 00:00:00 2001 From: Iban Eguia Date: Fri, 27 Jan 2012 20:21:43 +0100 Subject: Added doccumentation for the new doctypes. --- application/config/doctypes.php | 2 +- user_guide_src/source/helpers/html_helper.rst | 62 ++++++++++++++++++--------- 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/application/config/doctypes.php b/application/config/doctypes.php index 76e9534b2..9cf4808a5 100644 --- a/application/config/doctypes.php +++ b/application/config/doctypes.php @@ -37,8 +37,8 @@ $_doctypes = array( 'html4-frame' => '', 'mathml1' => '', 'mathml2' => '', - 'svg11' => '', 'svg10' => '', + 'svg11' => '', 'svg11-basic' => '', 'svg11-tiny' => '', 'xhtml-math-svg-xh' => '', diff --git a/user_guide_src/source/helpers/html_helper.rst b/user_guide_src/source/helpers/html_helper.rst index 2e217898e..17c28cd2a 100644 --- a/user_guide_src/source/helpers/html_helper.rst +++ b/user_guide_src/source/helpers/html_helper.rst @@ -325,24 +325,44 @@ Strict is used by default, but many doctypes are available. The following is a list of doctype choices. These are configurable, and pulled from application/config/doctypes.php -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| Doctype | Option | Result | -+========================+==========================+===========================================================================================================================+ -| XHTML 1.1 | doctype('xhtml11') | | -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| XHTML 1.0 Strict | doctype('xhtml1-strict') | | -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| XHTML 1.0 Transitional | doctype('xhtml1-trans') | | -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| XHTML 1.0 Frameset | doctype('xhtml1-frame') | | -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| XHTML Basic 1.1 | doctype('xhtml-basic11') | | -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| HTML 5 | doctype('html5') | | -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| HTML 4 Strict | doctype('html4-strict') | | -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| HTML 4 Transitional | doctype('html4-trans') | | -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| HTML 4 Frameset | doctype('html4-frame') | | -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| Doctype | Option | Result | ++===============================+==============================+==================================================================================================================================================+ +| XHTML 1.1 | doctype('xhtml11') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| XHTML 1.0 Strict | doctype('xhtml1-strict') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| XHTML 1.0 Transitional | doctype('xhtml1-trans') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| XHTML 1.0 Frameset | doctype('xhtml1-frame') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| XHTML Basic 1.1 | doctype('xhtml-basic11') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| HTML 5 | doctype('html5') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| HTML 4 Strict | doctype('html4-strict') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| HTML 4 Transitional | doctype('html4-trans') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| HTML 4 Frameset | doctype('html4-frame') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| MathML 1.01 | doctype('mathml1') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| MathML 2.0 | doctype('mathml2') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| SVG 1.0 | doctype('svg10') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| SVG 1.1 Full | doctype('svg11') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| SVG 1.1 Basic | doctype('svg11-basic') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| SVG 1.1 Tiny | doctype('svg11-tiny') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| XHTML+MathML+SVG (XHTML host) | doctype('xhtml-math-svg-xh') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| XHTML+MathML+SVG (SVG host) | doctype('xhtml-math-svg-sh') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| XHTML+RDFa 1.0 | doctype('xhtml-rdfa-1') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| XHTML+RDFa 1.1 | doctype('xhtml-rdfa-2') | | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 4304b96d830232badf3604ad7dfd411e7fc8050f Mon Sep 17 00:00:00 2001 From: Iban Eguia Date: Fri, 27 Jan 2012 20:23:54 +0100 Subject: Added information to changelog. --- user_guide_src/source/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 48011f208..ec3570393 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -33,6 +33,7 @@ Release Date: Not Released - Removed previously deprecated SHA1 Library. - Removed previously deprecated use of ``$autoload['core']`` in application/config/autoload.php. Only entries in ``$autoload['libraries']`` are auto-loaded now. + - Added some more doctypes. - Helpers -- cgit v1.2.3-24-g4f1b From 6c308b7482375baa4982cce26219cecd20bafdc0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 2 Feb 2012 22:03:53 +0200 Subject: Fix some comment blocks --- system/libraries/Zip.php | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index e7c55de1b..174d18a67 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -67,7 +67,7 @@ class CI_Zip { */ public function add_dir($directory) { - foreach ((array)$directory as $dir) + foreach ( (array) $directory as $dir) { if ( ! preg_match('|.+/$|', $dir)) { @@ -82,17 +82,17 @@ class CI_Zip { // -------------------------------------------------------------------- /** - * Get file/directory modification time + * Get file/directory modification time * - * If this is a newly created file/dir, we will set the time to 'now' + * If this is a newly created file/dir, we will set the time to 'now' * - * @param string path to file - * @return array filemtime/filemdate + * @param string path to file + * @return array filemtime/filemdate */ protected function _get_mod_time($dir) { // filemtime() may return false, but raises an error for non-existing files - $date = (file_exists($dir)) ? filemtime($dir): getdate($this->now); + $date = file_exists($dir) ? filemtime($dir) : getdate($this->now); return array( 'file_mtime' => ($date['hours'] << 11) + ($date['minutes'] << 5) + $date['seconds'] / 2, @@ -106,6 +106,8 @@ class CI_Zip { * Add Directory * * @param string the directory name + * @param int + * @param int * @return void */ protected function _add_dir($dir, $file_mtime, $file_mdate) @@ -184,6 +186,8 @@ class CI_Zip { * * @param string the file name/path * @param string the data to be encoded + * @param int + * @param int * @return void */ protected function _add_data($filepath, $data, $file_mtime, $file_mdate) @@ -233,6 +237,8 @@ class CI_Zip { /** * Read the contents of a file and add it to the zip * + * @param string + * @param bool * @return bool */ public function read_file($path, $preserve_filepath = FALSE) @@ -267,12 +273,13 @@ class CI_Zip { * is in the original file path will be recreated in the zip file. * * @param string path to source + * @param bool + * @param bool * @return bool */ public function read_dir($path, $preserve_filepath = TRUE, $root_path = NULL) { $path = rtrim($path, '/\\').'/'; - if ( ! $fp = @opendir($path)) { return FALSE; @@ -306,6 +313,8 @@ class CI_Zip { } } + closedir($fp); + return TRUE; } @@ -314,7 +323,7 @@ class CI_Zip { /** * Get the Zip file * - * @return string (binary encoded) + * @return string (binary encoded) */ public function get_zip() { @@ -325,12 +334,12 @@ class CI_Zip { } return $this->zipdata - . $this->directory."\x50\x4b\x05\x06\x00\x00\x00\x00" - . pack('v', $this->entries) // total # of entries "on this disk" - . pack('v', $this->entries) // total # of entries overall - . pack('V', strlen($this->directory)) // size of central dir - . pack('V', strlen($this->zipdata)) // offset to start of central dir - . "\x00\x00"; // .zip file comment length + .$this->directory."\x50\x4b\x05\x06\x00\x00\x00\x00" + .pack('v', $this->entries) // total # of entries "on this disk" + .pack('v', $this->entries) // total # of entries overall + .pack('V', strlen($this->directory)) // size of central dir + .pack('V', strlen($this->zipdata)) // offset to start of central dir + ."\x00\x00"; // .zip file comment length } // -------------------------------------------------------------------- @@ -364,7 +373,6 @@ class CI_Zip { * Download * * @param string the file name - * @param string the data to be encoded * @return bool */ public function download($filename = 'backup.zip') -- cgit v1.2.3-24-g4f1b From 0b5a4867af78838f3c7e2726e469f904e15976f1 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 29 Feb 2012 23:44:00 +0200 Subject: Minor clean-up --- system/libraries/Zip.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 174d18a67..f2f5f2e5d 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -155,7 +155,7 @@ class CI_Zip { * Add Data to Zip * * Lets you add files to the archive. If the path is included - * in the filename it will be placed within a directory. Make + * in the filename it will be placed within a directory. Make * sure you use add_dir() first to create the folder. * * @param mixed @@ -314,7 +314,6 @@ class CI_Zip { } closedir($fp); - return TRUE; } @@ -373,7 +372,7 @@ class CI_Zip { * Download * * @param string the file name - * @return bool + * @return void */ public function download($filename = 'backup.zip') { -- cgit v1.2.3-24-g4f1b From 7eeda537a1fa8dc3a60bbdb88a7e473cc909f590 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 16:01:55 -0400 Subject: Made database parent classes and methods abstract --- system/database/DB_active_rec.php | 2 +- system/database/DB_driver.php | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 35164a79c..89369f190 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -38,7 +38,7 @@ * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/database/ */ -class CI_DB_active_record extends CI_DB_driver { +abstract class CI_DB_active_record extends CI_DB_driver { protected $return_delete_sql = FALSE; protected $reset_delete_data = FALSE; diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index bcff43392..79b7285bd 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -38,7 +38,7 @@ * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/database/ */ -class CI_DB_driver { +abstract class CI_DB_driver { public $dsn; public $username; @@ -1357,9 +1357,7 @@ class CI_DB_driver { * * @return void */ - protected function _reset_select() - { - } + abstract protected function _reset_select(); } -- cgit v1.2.3-24-g4f1b From 833d504a91f7c85fa2985bcff5016a052972bd7a Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 16:12:03 -0400 Subject: Made the rest of the db classes abstract \n except for the DB_cache class, because I'm not sure if it is directly called --- system/database/DB_forge.php | 2 +- system/database/DB_result.php | 2 +- system/database/DB_utility.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index fe2a67728..192b78fa6 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -34,7 +34,7 @@ * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/database/ */ -class CI_DB_forge { +abstract class CI_DB_forge { public $fields = array(); public $keys = array(); diff --git a/system/database/DB_result.php b/system/database/DB_result.php index c3cdd24ff..d0205e0fd 100644 --- a/system/database/DB_result.php +++ b/system/database/DB_result.php @@ -36,7 +36,7 @@ * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/database/ */ -class CI_DB_result { +abstract class CI_DB_result { public $conn_id = NULL; public $result_id = NULL; diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index c94f93e5e..a7db803e8 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -32,7 +32,7 @@ * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/database/ */ -class CI_DB_utility extends CI_DB_forge { +abstract class CI_DB_utility extends CI_DB_forge { public $db; public $data_cache = array(); -- cgit v1.2.3-24-g4f1b From d2ff0bc1336e106e4b45abe7ee176bf6b9496b6e Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 16:52:10 -0400 Subject: Removed pointless _prep_sql methods --- system/database/DB_driver.php | 2 +- system/database/drivers/cubrid/cubrid_driver.php | 18 ------------------ .../database/drivers/interbase/interbase_driver.php | 16 ---------------- system/database/drivers/mssql/mssql_driver.php | 17 ----------------- system/database/drivers/oci8/oci8_driver.php | 20 ++------------------ system/database/drivers/odbc/odbc_driver.php | 17 ----------------- system/database/drivers/postgre/postgre_driver.php | 17 ----------------- system/database/drivers/sqlite/sqlite_driver.php | 19 ------------------- system/database/drivers/sqlsrv/sqlsrv_driver.php | 17 ----------------- 9 files changed, 3 insertions(+), 140 deletions(-) diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 79b7285bd..42b1b35aa 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -1362,4 +1362,4 @@ abstract class CI_DB_driver { } /* End of file DB_driver.php */ -/* Location: ./system/database/DB_driver.php */ +/* Location: ./system/database/DB_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php index 244707395..32bd8a8b2 100644 --- a/system/database/drivers/cubrid/cubrid_driver.php +++ b/system/database/drivers/cubrid/cubrid_driver.php @@ -178,29 +178,11 @@ class CI_DB_cubrid_driver extends CI_DB { */ function _execute($sql) { - $sql = $this->_prep_query($sql); return @cubrid_query($sql, $this->conn_id); } // -------------------------------------------------------------------- - /** - * Prep the query - * - * If needed, each database adapter can prep the query string - * - * @access private called by execute() - * @param string an SQL query - * @return string - */ - function _prep_query($sql) - { - // No need to prepare - return $sql; - } - - // -------------------------------------------------------------------- - /** * Begin Transaction * diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php index a9a647202..4af5b57ed 100644 --- a/system/database/drivers/interbase/interbase_driver.php +++ b/system/database/drivers/interbase/interbase_driver.php @@ -148,27 +148,11 @@ class CI_DB_interbase_driver extends CI_DB { */ protected function _execute($sql) { - $sql = $this->_prep_query($sql); return @ibase_query($this->conn_id, $sql); } // -------------------------------------------------------------------- - /** - * Prep the query - * - * If needed, each database adapter can prep the query string - * - * @param string an SQL query - * @return string - */ - protected function _prep_query($sql) - { - return $sql; - } - - // -------------------------------------------------------------------- - /** * Begin Transaction * diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index b6b64cc44..a93ac57fe 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -146,28 +146,11 @@ class CI_DB_mssql_driver extends CI_DB { */ function _execute($sql) { - $sql = $this->_prep_query($sql); return @mssql_query($sql, $this->conn_id); } // -------------------------------------------------------------------- - /** - * Prep the query - * - * If needed, each database adapter can prep the query string - * - * @access private called by execute() - * @param string an SQL query - * @return string - */ - function _prep_query($sql) - { - return $sql; - } - - // -------------------------------------------------------------------- - /** * Begin Transaction * diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 070d58a34..8d7040618 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -180,26 +180,10 @@ class CI_DB_oci8_driver extends CI_DB { { if ( ! is_resource($this->stmt_id)) { - $this->stmt_id = oci_parse($this->conn_id, $this->_prep_query($sql)); + $this->stmt_id = oci_parse($this->conn_id, $sql); } } - - // -------------------------------------------------------------------- - - /** - * Prep the query - * - * If needed, each database adapter can prep the query string - * - * @access private called by execute() - * @param string an SQL query - * @return string - */ - private function _prep_query($sql) - { - return $sql; - } - + // -------------------------------------------------------------------- /** diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index acc2838e3..58da07818 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -132,28 +132,11 @@ class CI_DB_odbc_driver extends CI_DB { */ function _execute($sql) { - $sql = $this->_prep_query($sql); return @odbc_exec($this->conn_id, $sql); } // -------------------------------------------------------------------- - /** - * Prep the query - * - * If needed, each database adapter can prep the query string - * - * @access private called by execute() - * @param string an SQL query - * @return string - */ - function _prep_query($sql) - { - return $sql; - } - - // -------------------------------------------------------------------- - /** * Begin Transaction * diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 5d22af2e6..fad9539ff 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -197,28 +197,11 @@ class CI_DB_postgre_driver extends CI_DB { */ function _execute($sql) { - $sql = $this->_prep_query($sql); return @pg_query($this->conn_id, $sql); } // -------------------------------------------------------------------- - /** - * Prep the query - * - * If needed, each database adapter can prep the query string - * - * @access private called by execute() - * @param string an SQL query - * @return string - */ - function _prep_query($sql) - { - return $sql; - } - - // -------------------------------------------------------------------- - /** * Begin Transaction * diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 55d9bfdb8..1870e73b7 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -27,8 +27,6 @@ // ------------------------------------------------------------------------ - - /** * SQLite Database Adapter Class * @@ -163,28 +161,11 @@ class CI_DB_sqlite_driver extends CI_DB { */ function _execute($sql) { - $sql = $this->_prep_query($sql); return @sqlite_query($this->conn_id, $sql); } // -------------------------------------------------------------------- - /** - * Prep the query - * - * If needed, each database adapter can prep the query string - * - * @access private called by execute() - * @param string an SQL query - * @return string - */ - function _prep_query($sql) - { - return $sql; - } - - // -------------------------------------------------------------------- - /** * Begin Transaction * diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index 5e920cbe8..ea9f9483b 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -152,7 +152,6 @@ class CI_DB_sqlsrv_driver extends CI_DB { */ function _execute($sql) { - $sql = $this->_prep_query($sql); return sqlsrv_query($this->conn_id, $sql, null, array( 'Scrollable' => SQLSRV_CURSOR_STATIC, 'SendStreamParamsAtExec' => true @@ -161,22 +160,6 @@ class CI_DB_sqlsrv_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Prep the query - * - * If needed, each database adapter can prep the query string - * - * @access private called by execute() - * @param string an SQL query - * @return string - */ - function _prep_query($sql) - { - return $sql; - } - - // -------------------------------------------------------------------- - /** * Begin Transaction * -- cgit v1.2.3-24-g4f1b From 70b21018b4941414c0041900f26c637763e19cfe Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 17:33:05 -0400 Subject: Added access modifiers to CUBRID driver --- system/database/drivers/cubrid/cubrid_driver.php | 87 +++++++++--------------- 1 file changed, 31 insertions(+), 56 deletions(-) diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php index 32bd8a8b2..cc9f23d9e 100644 --- a/system/database/drivers/cubrid/cubrid_driver.php +++ b/system/database/drivers/cubrid/cubrid_driver.php @@ -66,10 +66,9 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Non-persistent database connection * - * @access private called by the base class * @return resource */ - function db_connect() + protected function db_connect() { // If no port is defined by the user, use the default value if ($this->port == '') @@ -106,13 +105,12 @@ class CI_DB_cubrid_driver extends CI_DB { * file by setting the CCI_PCONNECT parameter to ON. In that case, all * connections established between the client application and the * server will become persistent. This is calling the same - * @cubrid_connect function will establish persisten connection + * @cubrid_connect public function will establish persisten connection * considering that the CCI_PCONNECT is ON. * - * @access private called by the base class * @return resource */ - function db_pconnect() + protected function db_pconnect() { return $this->db_connect(); } @@ -125,10 +123,9 @@ class CI_DB_cubrid_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * - * @access public * @return void */ - function reconnect() + public function reconnect() { if (cubrid_ping($this->conn_id) === FALSE) { @@ -141,10 +138,9 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Select the database * - * @access private called by the base class * @return resource */ - function db_select() + public function db_select() { // In CUBRID there is no need to select a database as the database // is chosen at the connection time. @@ -172,11 +168,10 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Execute the query * - * @access private called by the base class * @param string an SQL query * @return resource */ - function _execute($sql) + protected function _execute($sql) { return @cubrid_query($sql, $this->conn_id); } @@ -186,10 +181,9 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Begin Transaction * - * @access public * @return bool */ - function trans_begin($test_mode = FALSE) + public function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -220,10 +214,9 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Commit Transaction * - * @access public * @return bool */ - function trans_commit() + public function trans_commit() { if ( ! $this->trans_enabled) { @@ -251,10 +244,9 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Rollback Transaction * - * @access public * @return bool */ - function trans_rollback() + public function trans_rollback() { if ( ! $this->trans_enabled) { @@ -282,12 +274,11 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Escape String * - * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - function escape_str($str, $like = FALSE) + public function escape_str($str, $like = FALSE) { if (is_array($str)) { @@ -324,7 +315,7 @@ class CI_DB_cubrid_driver extends CI_DB { * * @return int */ - public function affected_rows() + public public function affected_rows() { return @cubrid_affected_rows(); } @@ -334,10 +325,9 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Insert ID * - * @access public * @return integer */ - function insert_id() + public function insert_id() { return @cubrid_insert_id($this->conn_id); } @@ -350,11 +340,10 @@ class CI_DB_cubrid_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified table * - * @access public * @param string * @return string */ - function count_all($table = '') + public function count_all($table = '') { if ($table == '') { @@ -379,11 +368,10 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access private * @param boolean * @return string */ - function _list_tables($prefix_limit = FALSE) + protected function _list_tables($prefix_limit = FALSE) { $sql = "SHOW TABLES"; @@ -402,11 +390,10 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @access public * @param string the table name * @return string */ - function _list_columns($table = '') + public function _list_columns($table = '') { return 'SHOW COLUMNS FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE); } @@ -418,11 +405,10 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * - * @access public * @param string the table name * @return object */ - function _field_data($table) + public function _field_data($table) { return "SELECT * FROM ".$table." LIMIT 1"; } @@ -437,7 +423,7 @@ class CI_DB_cubrid_driver extends CI_DB { * * @return array */ - public function error() + public public function error() { return array('code' => cubrid_errno($this->conn_id), 'message' => cubrid_error($this->conn_id)); } @@ -445,13 +431,12 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Escape the SQL Identifiers * - * This function escapes column and table names + * This public function escapes column and table names * - * @access private * @param string * @return string */ - function _escape_identifiers($item) + protected function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -487,14 +472,13 @@ class CI_DB_cubrid_driver extends CI_DB { /** * From Tables * - * This function implicitly groups FROM tables so there is no confusion + * This public function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @access public * @param type * @return type */ - function _from_tables($tables) + public function _from_tables($tables) { if ( ! is_array($tables)) { @@ -511,13 +495,12 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - function _insert($table, $keys, $values) + public function _insert($table, $keys, $values) { return "INSERT INTO ".$table." (\"".implode('", "', $keys)."\") VALUES (".implode(', ', $values).")"; } @@ -530,13 +513,12 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific replace string from the supplied data * - * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - function _replace($table, $keys, $values) + public function _replace($table, $keys, $values) { return "REPLACE INTO ".$table." (\"".implode('", "', $keys)."\") VALUES (".implode(', ', $values).")"; } @@ -548,13 +530,12 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - function _insert_batch($table, $keys, $values) + public function _insert_batch($table, $keys, $values) { return "INSERT INTO ".$table." (\"".implode('", "', $keys)."\") VALUES ".implode(', ', $values); } @@ -567,7 +548,6 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * - * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -575,7 +555,7 @@ class CI_DB_cubrid_driver extends CI_DB { * @param array the limit clause * @return string */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + public function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -603,13 +583,12 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific batch update string from the supplied data * - * @access public * @param string the table name * @param array the update data * @param array the where clause * @return string */ - function _update_batch($table, $values, $index, $where = NULL) + public function _update_batch($table, $values, $index, $where = NULL) { $ids = array(); $where = ($where != '' AND count($where) >=1) ? implode(" ", $where).' AND ' : ''; @@ -656,13 +635,12 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific truncate string from the supplied data * If the database does not support the truncate() command - * This function maps to "DELETE FROM table" + * This public function maps to "DELETE FROM table" * - * @access public * @param string the table name * @return string */ - function _truncate($table) + public function _truncate($table) { return "TRUNCATE ".$table; } @@ -674,13 +652,12 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * - * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) + public function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -708,13 +685,12 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * - * @access public * @param string the sql query string * @param integer the number of rows to limit the query to * @param integer the offset value * @return string */ - function _limit($sql, $limit, $offset) + public function _limit($sql, $limit, $offset) { if ($offset == 0) { @@ -733,11 +709,10 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Close DB Connection * - * @access public * @param resource * @return void */ - function _close($conn_id) + public function _close($conn_id) { @cubrid_close($conn_id); } -- cgit v1.2.3-24-g4f1b From f83f0d5448aadcf76fbdac363d0fe7ea811ca9bf Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 17:38:30 -0400 Subject: Added access modifiers to the rest of the Cubrid classes --- system/database/drivers/cubrid/cubrid_forge.php | 21 +++++++-------------- system/database/drivers/cubrid/cubrid_result.php | 23 ++++++++--------------- system/database/drivers/cubrid/cubrid_utility.php | 8 ++++---- 3 files changed, 19 insertions(+), 33 deletions(-) diff --git a/system/database/drivers/cubrid/cubrid_forge.php b/system/database/drivers/cubrid/cubrid_forge.php index 7d606ea36..6bfc7c28f 100644 --- a/system/database/drivers/cubrid/cubrid_forge.php +++ b/system/database/drivers/cubrid/cubrid_forge.php @@ -39,11 +39,10 @@ class CI_DB_cubrid_forge extends CI_DB_forge { /** * Create database * - * @access private * @param string the database name * @return bool */ - function _create_database($name) + protected function _create_database($name) { // CUBRID does not allow to create a database in SQL. The GUI tools // have to be used for this purpose. @@ -55,11 +54,10 @@ class CI_DB_cubrid_forge extends CI_DB_forge { /** * Drop database * - * @access private * @param string the database name * @return bool */ - function _drop_database($name) + protected function _drop_database($name) { // CUBRID does not allow to drop a database in SQL. The GUI tools // have to be used for this purpose. @@ -71,11 +69,10 @@ class CI_DB_cubrid_forge extends CI_DB_forge { /** * Process Fields * - * @access private * @param mixed the fields * @return string */ - function _process_fields($fields) + protected function _process_fields($fields) { $current_field_count = 0; $sql = ''; @@ -172,7 +169,6 @@ class CI_DB_cubrid_forge extends CI_DB_forge { /** * Create Table * - * @access private * @param string the table name * @param mixed the fields * @param mixed primary key(s) @@ -180,7 +176,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -232,10 +228,9 @@ class CI_DB_cubrid_forge extends CI_DB_forge { /** * Drop Table * - * @access private * @return string */ - function _drop_table($table) + protected function _drop_table($table) { return "DROP TABLE IF EXISTS ".$this->db->_escape_identifiers($table); } @@ -248,14 +243,13 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * - * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param array fields * @param string the field after which we should add the new field * @return object */ - function _alter_table($alter_type, $table, $fields, $after_field = '') + protected function _alter_table($alter_type, $table, $fields, $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '; @@ -282,12 +276,11 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * - * @access private * @param string the old table name * @param string the new table name * @return string */ - function _rename_table($table_name, $new_table_name) + protected function _rename_table($table_name, $new_table_name) { return 'RENAME TABLE '.$this->db->protect_identifiers($table_name).' AS '.$this->db->protect_identifiers($new_table_name); } diff --git a/system/database/drivers/cubrid/cubrid_result.php b/system/database/drivers/cubrid/cubrid_result.php index a7eeb8a39..c7a7632aa 100644 --- a/system/database/drivers/cubrid/cubrid_result.php +++ b/system/database/drivers/cubrid/cubrid_result.php @@ -41,10 +41,9 @@ class CI_DB_cubrid_result extends CI_DB_result { /** * Number of rows in the result set * - * @access public * @return integer */ - function num_rows() + public function num_rows() { return @cubrid_num_rows($this->result_id); } @@ -54,10 +53,9 @@ class CI_DB_cubrid_result extends CI_DB_result { /** * Number of fields in the result set * - * @access public * @return integer */ - function num_fields() + public function num_fields() { return @cubrid_num_fields($this->result_id); } @@ -69,10 +67,9 @@ class CI_DB_cubrid_result extends CI_DB_result { * * Generates an array of column names * - * @access public * @return array */ - function list_fields() + public function list_fields() { return cubrid_column_names($this->result_id); } @@ -84,10 +81,9 @@ class CI_DB_cubrid_result extends CI_DB_result { * * Generates an array of objects containing field meta-data * - * @access public * @return array */ - function field_data() + public function field_data() { $retval = array(); @@ -149,7 +145,7 @@ class CI_DB_cubrid_result extends CI_DB_result { * * @return null */ - function free_result() + public function free_result() { if(is_resource($this->result_id) || get_resource_type($this->result_id) == "Unknown" && @@ -169,10 +165,9 @@ class CI_DB_cubrid_result extends CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero * - * @access private * @return array */ - function _data_seek($n = 0) + protected function _data_seek($n = 0) { return cubrid_data_seek($this->result_id, $n); } @@ -184,10 +179,9 @@ class CI_DB_cubrid_result extends CI_DB_result { * * Returns the result set as an array * - * @access private * @return array */ - function _fetch_assoc() + protected function _fetch_assoc() { return cubrid_fetch_assoc($this->result_id); } @@ -199,10 +193,9 @@ class CI_DB_cubrid_result extends CI_DB_result { * * Returns the result set as an object * - * @access private * @return object */ - function _fetch_object() + protected function _fetch_object() { return cubrid_fetch_object($this->result_id); } diff --git a/system/database/drivers/cubrid/cubrid_utility.php b/system/database/drivers/cubrid/cubrid_utility.php index a13c0a5e4..de28e6335 100644 --- a/system/database/drivers/cubrid/cubrid_utility.php +++ b/system/database/drivers/cubrid/cubrid_utility.php @@ -42,7 +42,7 @@ class CI_DB_cubrid_utility extends CI_DB_utility { * @access private * @return array */ - function _list_databases() + protected function _list_databases() { // CUBRID does not allow to see the list of all databases on the // server. It is the way its architecture is designed. Every @@ -71,7 +71,7 @@ class CI_DB_cubrid_utility extends CI_DB_utility { * @return object * @link http://www.cubrid.org/manual/840/en/Optimize%20Database */ - function _optimize_table($table) + protected function _optimize_table($table) { // No SQL based support in CUBRID as of version 8.4.0. Database or // table optimization can be performed using CUBRID Manager @@ -91,7 +91,7 @@ class CI_DB_cubrid_utility extends CI_DB_utility { * @return object * @link http://www.cubrid.org/manual/840/en/Checking%20Database%20Consistency */ - function _repair_table($table) + protected function _repair_table($table) { // Not supported in CUBRID as of version 8.4.0. Database or // table consistency can be checked using CUBRID Manager @@ -107,7 +107,7 @@ class CI_DB_cubrid_utility extends CI_DB_utility { * @param array Preferences * @return mixed */ - function _backup($params = array()) + protected function _backup($params = array()) { // No SQL based support in CUBRID as of version 8.4.0. Database or // table backup can be performed using CUBRID Manager -- cgit v1.2.3-24-g4f1b From ba1ebbefa9c5d225fa28c76dac276e6120263a25 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 17:48:46 -0400 Subject: Added access modifiers for MSSQL driver --- system/database/drivers/mssql/mssql_driver.php | 81 +++++++++---------------- system/database/drivers/mssql/mssql_forge.php | 20 +++--- system/database/drivers/mssql/mssql_result.php | 24 +++----- system/database/drivers/mssql/mssql_utility.php | 12 ++-- 4 files changed, 47 insertions(+), 90 deletions(-) diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index a93ac57fe..9448f052c 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -62,10 +62,9 @@ class CI_DB_mssql_driver extends CI_DB { /** * Non-persistent database connection * - * @access private called by the base class * @return resource */ - function db_connect() + protected function db_connect() { if ($this->port != '') { @@ -80,10 +79,9 @@ class CI_DB_mssql_driver extends CI_DB { /** * Persistent database connection * - * @access private called by the base class * @return resource */ - function db_pconnect() + protected function db_pconnect() { if ($this->port != '') { @@ -101,10 +99,9 @@ class CI_DB_mssql_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * - * @access public * @return void */ - function reconnect() + public function reconnect() { // not implemented in MSSQL } @@ -140,11 +137,10 @@ class CI_DB_mssql_driver extends CI_DB { /** * Execute the query * - * @access private called by the base class * @param string an SQL query * @return resource */ - function _execute($sql) + protected function _execute($sql) { return @mssql_query($sql, $this->conn_id); } @@ -154,10 +150,9 @@ class CI_DB_mssql_driver extends CI_DB { /** * Begin Transaction * - * @access public * @return bool */ - function trans_begin($test_mode = FALSE) + public function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -184,10 +179,9 @@ class CI_DB_mssql_driver extends CI_DB { /** * Commit Transaction * - * @access public * @return bool */ - function trans_commit() + public function trans_commit() { if ( ! $this->trans_enabled) { @@ -209,10 +203,9 @@ class CI_DB_mssql_driver extends CI_DB { /** * Rollback Transaction * - * @access public * @return bool */ - function trans_rollback() + public function trans_rollback() { if ( ! $this->trans_enabled) { @@ -234,12 +227,11 @@ class CI_DB_mssql_driver extends CI_DB { /** * Escape String * - * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - function escape_str($str, $like = FALSE) + public function escape_str($str, $like = FALSE) { if (is_array($str)) { @@ -272,10 +264,9 @@ class CI_DB_mssql_driver extends CI_DB { /** * Affected Rows * - * @access public * @return integer */ - function affected_rows() + public function affected_rows() { return @mssql_rows_affected($this->conn_id); } @@ -287,10 +278,9 @@ class CI_DB_mssql_driver extends CI_DB { * * Returns the last id created in the Identity column. * - * @access public * @return integer */ - function insert_id() + public function insert_id() { $ver = self::_parse_major_version($this->version()); $sql = ($ver >= 8 ? "SELECT SCOPE_IDENTITY() AS last_id" : "SELECT @@IDENTITY AS last_id"); @@ -307,11 +297,10 @@ class CI_DB_mssql_driver extends CI_DB { * Grabs the major version number from the * database server version string passed in. * - * @access private * @param string $version * @return int16 major version number */ - function _parse_major_version($version) + protected function _parse_major_version($version) { preg_match('/([0-9]+)\.([0-9]+)\.([0-9]+)/', $version, $ver_info); return $ver_info[1]; // return the major version b/c that's all we're interested in. @@ -324,7 +313,7 @@ class CI_DB_mssql_driver extends CI_DB { * * @return string */ - protected function _version() + protected public function _version() { return 'SELECT @@VERSION AS ver'; } @@ -337,11 +326,10 @@ class CI_DB_mssql_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * - * @access public * @param string * @return string */ - function count_all($table = '') + public function count_all($table = '') { if ($table == '') { @@ -366,11 +354,10 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access private * @param boolean * @return string */ - function _list_tables($prefix_limit = FALSE) + protected function _list_tables($prefix_limit = FALSE) { $sql = "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name"; @@ -391,11 +378,10 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @access private * @param string the table name * @return string */ - function _list_columns($table = '') + protected function _list_columns($table = '') { return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$table."'"; } @@ -407,11 +393,10 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * - * @access public * @param string the table name * @return object */ - function _field_data($table) + public function _field_data($table) { return "SELECT TOP 1 * FROM ".$table; } @@ -438,13 +423,12 @@ class CI_DB_mssql_driver extends CI_DB { /** * Escape the SQL Identifiers * - * This function escapes column and table names + * This public function escapes column and table names * - * @access private * @param string * @return string */ - function _escape_identifiers($item) + protected function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -480,14 +464,13 @@ class CI_DB_mssql_driver extends CI_DB { /** * From Tables * - * This function implicitly groups FROM tables so there is no confusion + * This public function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @access public * @param type * @return type */ - function _from_tables($tables) + public function _from_tables($tables) { if ( ! is_array($tables)) { @@ -504,13 +487,12 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - function _insert($table, $keys, $values) + public function _insert($table, $keys, $values) { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } @@ -522,7 +504,6 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * - * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -530,7 +511,7 @@ class CI_DB_mssql_driver extends CI_DB { * @param array the limit clause * @return string */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + public function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -558,13 +539,12 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific truncate string from the supplied data * If the database does not support the truncate() command - * This function maps to "DELETE FROM table" + * This public function maps to "DELETE FROM table" * - * @access public * @param string the table name * @return string */ - function _truncate($table) + public function _truncate($table) { return "TRUNCATE ".$table; } @@ -576,13 +556,12 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * - * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) + public function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -610,13 +589,12 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * - * @access public * @param string the sql query string * @param integer the number of rows to limit the query to * @param integer the offset value * @return string */ - function _limit($sql, $limit, $offset) + public function _limit($sql, $limit, $offset) { $i = $limit + $offset; @@ -628,18 +606,15 @@ class CI_DB_mssql_driver extends CI_DB { /** * Close DB Connection * - * @access public * @param resource * @return void */ - function _close($conn_id) + public function _close($conn_id) { @mssql_close($conn_id); } } - - /* End of file mssql_driver.php */ -/* Location: ./system/database/drivers/mssql/mssql_driver.php */ +/* Location: ./system/database/drivers/mssql/mssql_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php index 4a8089bb1..500dd9845 100644 --- a/system/database/drivers/mssql/mssql_forge.php +++ b/system/database/drivers/mssql/mssql_forge.php @@ -39,11 +39,10 @@ class CI_DB_mssql_forge extends CI_DB_forge { /** * Create database * - * @access private * @param string the database name * @return bool */ - function _create_database($name) + protected function _create_database($name) { return "CREATE DATABASE ".$name; } @@ -53,11 +52,10 @@ class CI_DB_mssql_forge extends CI_DB_forge { /** * Drop database * - * @access private * @param string the database name * @return bool */ - function _drop_database($name) + protected function _drop_database($name) { return "DROP DATABASE ".$name; } @@ -67,10 +65,9 @@ class CI_DB_mssql_forge extends CI_DB_forge { /** * Drop Table * - * @access private * @return bool */ - function _drop_table($table) + protected function _drop_table($table) { return "DROP TABLE ".$this->db->_escape_identifiers($table); } @@ -80,7 +77,6 @@ class CI_DB_mssql_forge extends CI_DB_forge { /** * Create Table * - * @access private * @param string the table name * @param array the fields * @param mixed primary key(s) @@ -88,7 +84,7 @@ class CI_DB_mssql_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -190,7 +186,6 @@ class CI_DB_mssql_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * - * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name @@ -200,7 +195,7 @@ class CI_DB_mssql_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -242,12 +237,11 @@ class CI_DB_mssql_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * - * @access private * @param string the old table name * @param string the new table name * @return string */ - function _rename_table($table_name, $new_table_name) + protected function _rename_table($table_name, $new_table_name) { // I think this syntax will work, but can find little documentation on renaming tables in MSSQL return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); @@ -256,4 +250,4 @@ class CI_DB_mssql_forge extends CI_DB_forge { } /* End of file mssql_forge.php */ -/* Location: ./system/database/drivers/mssql/mssql_forge.php */ +/* Location: ./system/database/drivers/mssql/mssql_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php index b205ce2d1..ff899406c 100644 --- a/system/database/drivers/mssql/mssql_result.php +++ b/system/database/drivers/mssql/mssql_result.php @@ -41,10 +41,9 @@ class CI_DB_mssql_result extends CI_DB_result { /** * Number of rows in the result set * - * @access public * @return integer */ - function num_rows() + public function num_rows() { return @mssql_num_rows($this->result_id); } @@ -54,10 +53,9 @@ class CI_DB_mssql_result extends CI_DB_result { /** * Number of fields in the result set * - * @access public * @return integer */ - function num_fields() + public function num_fields() { return @mssql_num_fields($this->result_id); } @@ -69,10 +67,9 @@ class CI_DB_mssql_result extends CI_DB_result { * * Generates an array of column names * - * @access public * @return array */ - function list_fields() + public function list_fields() { $field_names = array(); while ($field = mssql_fetch_field($this->result_id)) @@ -90,10 +87,9 @@ class CI_DB_mssql_result extends CI_DB_result { * * Generates an array of objects containing field meta-data * - * @access public * @return array */ - function field_data() + public function field_data() { $retval = array(); while ($field = mssql_fetch_field($this->result_id)) @@ -118,7 +114,7 @@ class CI_DB_mssql_result extends CI_DB_result { * * @return null */ - function free_result() + public function free_result() { if (is_resource($this->result_id)) { @@ -136,10 +132,9 @@ class CI_DB_mssql_result extends CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero * - * @access private * @return array */ - function _data_seek($n = 0) + protected function _data_seek($n = 0) { return mssql_data_seek($this->result_id, $n); } @@ -151,10 +146,9 @@ class CI_DB_mssql_result extends CI_DB_result { * * Returns the result set as an array * - * @access private * @return array */ - function _fetch_assoc() + protected function _fetch_assoc() { return mssql_fetch_assoc($this->result_id); } @@ -166,16 +160,14 @@ class CI_DB_mssql_result extends CI_DB_result { * * Returns the result set as an object * - * @access private * @return object */ - function _fetch_object() + protected function _fetch_object() { return mssql_fetch_object($this->result_id); } } - /* End of file mssql_result.php */ /* Location: ./system/database/drivers/mssql/mssql_result.php */ \ No newline at end of file diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php index 28f34b999..e64874132 100644 --- a/system/database/drivers/mssql/mssql_utility.php +++ b/system/database/drivers/mssql/mssql_utility.php @@ -39,10 +39,9 @@ class CI_DB_mssql_utility extends CI_DB_utility { /** * List databases * - * @access private * @return bool */ - function _list_databases() + protected function _list_databases() { return "EXEC sp_helpdb"; // Can also be: EXEC sp_databases } @@ -54,11 +53,10 @@ class CI_DB_mssql_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be optimized * - * @access private * @param string the table name * @return object */ - function _optimize_table($table) + protected function _optimize_table($table) { return FALSE; // Is this supported in MS SQL? } @@ -70,11 +68,10 @@ class CI_DB_mssql_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be repaired * - * @access private * @param string the table name * @return object */ - function _repair_table($table) + protected function _repair_table($table) { return FALSE; // Is this supported in MS SQL? } @@ -84,11 +81,10 @@ class CI_DB_mssql_utility extends CI_DB_utility { /** * MSSQL Export * - * @access private * @param array Preferences * @return mixed */ - function _backup($params = array()) + protected function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); -- cgit v1.2.3-24-g4f1b From 9f86f5cddea54e7fedf4be89d1d1cc90d1564488 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 17:53:37 -0400 Subject: Oci8 access modifiers --- system/database/drivers/oci8/oci8_driver.php | 26 ++++++++++++-------------- system/database/drivers/oci8/oci8_forge.php | 17 ++++++----------- system/database/drivers/oci8/oci8_result.php | 3 +-- system/database/drivers/oci8/oci8_utility.php | 12 ++++-------- 4 files changed, 23 insertions(+), 35 deletions(-) diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 8d7040618..e7b744bd3 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -53,33 +53,33 @@ class CI_DB_oci8_driver extends CI_DB { - var $dbdriver = 'oci8'; + public $dbdriver = 'oci8'; // The character used for excaping - var $_escape_char = '"'; + public $_escape_char = '"'; // clause and character used for LIKE escape sequences - var $_like_escape_str = " escape '%s' "; - var $_like_escape_chr = '!'; + public $_like_escape_str = " escape '%s' "; + public $_like_escape_chr = '!'; /** * The syntax to count rows is slightly different across different * database engines, so this string appears in each driver and is * used for the count_all() and count_all_results() functions. */ - var $_count_string = "SELECT COUNT(1) AS "; - var $_random_keyword = ' ASC'; // not currently supported + public $_count_string = "SELECT COUNT(1) AS "; + public $_random_keyword = ' ASC'; // not currently supported // Set "auto commit" by default - var $_commit = OCI_COMMIT_ON_SUCCESS; + public $_commit = OCI_COMMIT_ON_SUCCESS; // need to track statement id and cursor id - var $stmt_id; - var $curs_id; + public $stmt_id; + public $curs_id; // if we use a limit, we will add a field that will // throw off num_fields later - var $limit_used; + public $limit_used; /** * Non-persistent database connection @@ -214,7 +214,7 @@ class CI_DB_oci8_driver extends CI_DB { * KEY OPTIONAL NOTES * name no the name of the parameter should be in : format * value no the value of the parameter. If this is an OUT or IN OUT parameter, - * this should be a reference to a variable + * this should be a reference to a publiciable * type yes the type of the parameter * length yes the max size of the parameter */ @@ -781,7 +781,5 @@ class CI_DB_oci8_driver extends CI_DB { } - - /* End of file oci8_driver.php */ -/* Location: ./system/database/drivers/oci8/oci8_driver.php */ +/* Location: ./system/database/drivers/oci8/oci8_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php index 7fcc8094d..f9a90ff0a 100644 --- a/system/database/drivers/oci8/oci8_forge.php +++ b/system/database/drivers/oci8/oci8_forge.php @@ -39,11 +39,10 @@ class CI_DB_oci8_forge extends CI_DB_forge { /** * Create database * - * @access public * @param string the database name * @return bool */ - function _create_database($name) + public function _create_database($name) { return FALSE; } @@ -53,11 +52,10 @@ class CI_DB_oci8_forge extends CI_DB_forge { /** * Drop database * - * @access private * @param string the database name * @return bool */ - function _drop_database($name) + protected function _drop_database($name) { return FALSE; } @@ -144,10 +142,9 @@ class CI_DB_oci8_forge extends CI_DB_forge { /** * Drop Table * - * @access private * @return bool */ - function _drop_table($table) + protected function _drop_table($table) { return FALSE; } @@ -160,7 +157,6 @@ class CI_DB_oci8_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * - * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name @@ -170,7 +166,7 @@ class CI_DB_oci8_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -212,12 +208,11 @@ class CI_DB_oci8_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * - * @access private * @param string the old table name * @param string the new table name * @return string */ - function _rename_table($table_name, $new_table_name) + protected function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } @@ -225,4 +220,4 @@ class CI_DB_oci8_forge extends CI_DB_forge { } /* End of file oci8_forge.php */ -/* Location: ./system/database/drivers/oci8/oci8_forge.php */ +/* Location: ./system/database/drivers/oci8/oci8_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index 6f1b8b4c1..a14e32eec 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -235,6 +235,5 @@ class CI_DB_oci8_result extends CI_DB_result { } - /* End of file oci8_result.php */ -/* Location: ./system/database/drivers/oci8/oci8_result.php */ +/* Location: ./system/database/drivers/oci8/oci8_result.php */ \ No newline at end of file diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php index 62dfb2f3c..f4863c0db 100644 --- a/system/database/drivers/oci8/oci8_utility.php +++ b/system/database/drivers/oci8/oci8_utility.php @@ -39,10 +39,9 @@ class CI_DB_oci8_utility extends CI_DB_utility { /** * List databases * - * @access private * @return bool */ - function _list_databases() + protected function _list_databases() { return FALSE; } @@ -54,11 +53,10 @@ class CI_DB_oci8_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be optimized * - * @access private * @param string the table name * @return object */ - function _optimize_table($table) + protected function _optimize_table($table) { return FALSE; // Is this supported in Oracle? } @@ -70,11 +68,10 @@ class CI_DB_oci8_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be repaired * - * @access private * @param string the table name * @return object */ - function _repair_table($table) + protected function _repair_table($table) { return FALSE; // Is this supported in Oracle? } @@ -84,11 +81,10 @@ class CI_DB_oci8_utility extends CI_DB_utility { /** * Oracle Export * - * @access private * @param array Preferences * @return mixed */ - function _backup($params = array()) + protected function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); -- cgit v1.2.3-24-g4f1b From 142ca8e565b722b758b5ef88c888891d04da8700 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 18:00:35 -0400 Subject: ODBC access modifiers --- system/database/drivers/odbc/odbc_driver.php | 96 +++++++++++---------------- system/database/drivers/odbc/odbc_forge.php | 20 ++---- system/database/drivers/odbc/odbc_result.php | 19 ++---- system/database/drivers/odbc/odbc_utility.php | 12 ++-- 4 files changed, 55 insertions(+), 92 deletions(-) diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index 58da07818..78acd2ce9 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -48,32 +48,35 @@ class CI_DB_odbc_driver extends CI_DB { var $_escape_char = ''; // clause and character used for LIKE escape sequences - var $_like_escape_str = " {escape '%s'} "; - var $_like_escape_chr = '!'; + protected $_like_escape_str = " {escape '%s'} "; + protected $_like_escape_chr = '!'; /** * The syntax to count rows is slightly different across different * database engines, so this string appears in each driver and is - * used for the count_all() and count_all_results() functions. + * used for the count_all() and count_all_results() public functions. */ - var $_count_string = "SELECT COUNT(*) AS "; - var $_random_keyword; + protected $_count_string = "SELECT COUNT(*) AS "; + protected $_random_keyword; - - function __construct($params) + /** + * Constructor, to define random keyword + */ + public function __construct($params) { parent::__construct($params); $this->_random_keyword = ' RND('.time().')'; // database specific random keyword } + + // -------------------------------------------------------------------------- /** * Non-persistent database connection * - * @access private called by the base class * @return resource */ - function db_connect() + protected function db_connect() { return @odbc_connect($this->hostname, $this->username, $this->password); } @@ -83,10 +86,9 @@ class CI_DB_odbc_driver extends CI_DB { /** * Persistent database connection * - * @access private called by the base class * @return resource */ - function db_pconnect() + protected function db_pconnect() { return @odbc_pconnect($this->hostname, $this->username, $this->password); } @@ -99,10 +101,9 @@ class CI_DB_odbc_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * - * @access public * @return void */ - function reconnect() + public function reconnect() { // not implemented in odbc } @@ -112,10 +113,9 @@ class CI_DB_odbc_driver extends CI_DB { /** * Select the database * - * @access private called by the base class * @return resource */ - function db_select() + protected function db_select() { // Not needed for ODBC return TRUE; @@ -126,11 +126,10 @@ class CI_DB_odbc_driver extends CI_DB { /** * Execute the query * - * @access private called by the base class * @param string an SQL query * @return resource */ - function _execute($sql) + protected function _execute($sql) { return @odbc_exec($this->conn_id, $sql); } @@ -140,10 +139,9 @@ class CI_DB_odbc_driver extends CI_DB { /** * Begin Transaction * - * @access public * @return bool */ - function trans_begin($test_mode = FALSE) + public function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -169,10 +167,9 @@ class CI_DB_odbc_driver extends CI_DB { /** * Commit Transaction * - * @access public * @return bool */ - function trans_commit() + public function trans_commit() { if ( ! $this->trans_enabled) { @@ -195,10 +192,9 @@ class CI_DB_odbc_driver extends CI_DB { /** * Rollback Transaction * - * @access public * @return bool */ - function trans_rollback() + public function trans_rollback() { if ( ! $this->trans_enabled) { @@ -221,12 +217,11 @@ class CI_DB_odbc_driver extends CI_DB { /** * Escape String * - * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - function escape_str($str, $like = FALSE) + public function escape_str($str, $like = FALSE) { if (is_array($str)) { @@ -257,10 +252,9 @@ class CI_DB_odbc_driver extends CI_DB { /** * Affected Rows * - * @access public * @return integer */ - function affected_rows() + public function affected_rows() { return @odbc_num_rows($this->conn_id); } @@ -285,11 +279,10 @@ class CI_DB_odbc_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * - * @access public * @param string * @return string */ - function count_all($table = '') + public function count_all($table = '') { if ($table == '') { @@ -315,11 +308,10 @@ class CI_DB_odbc_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access private * @param boolean * @return string */ - function _list_tables($prefix_limit = FALSE) + protected function _list_tables($prefix_limit = FALSE) { $sql = "SHOW TABLES FROM `".$this->database."`"; @@ -339,11 +331,10 @@ class CI_DB_odbc_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @access public * @param string the table name * @return string */ - function _list_columns($table = '') + public function _list_columns($table = '') { return "SHOW COLUMNS FROM ".$table; } @@ -355,11 +346,10 @@ class CI_DB_odbc_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * - * @access public * @param string the table name * @return object */ - function _field_data($table) + public function _field_data($table) { return "SELECT TOP 1 FROM ".$table; } @@ -384,13 +374,12 @@ class CI_DB_odbc_driver extends CI_DB { /** * Escape the SQL Identifiers * - * This function escapes column and table names + * This public function escapes column and table names * - * @access private * @param string * @return string */ - function _escape_identifiers($item) + protected function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -426,14 +415,13 @@ class CI_DB_odbc_driver extends CI_DB { /** * From Tables * - * This function implicitly groups FROM tables so there is no confusion + * This public function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @access public * @param type * @return type */ - function _from_tables($tables) + public function _from_tables($tables) { if ( ! is_array($tables)) { @@ -450,13 +438,12 @@ class CI_DB_odbc_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - function _insert($table, $keys, $values) + public function _insert($table, $keys, $values) { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } @@ -468,7 +455,6 @@ class CI_DB_odbc_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * - * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -476,7 +462,7 @@ class CI_DB_odbc_driver extends CI_DB { * @param array the limit clause * @return string */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + public function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -504,13 +490,12 @@ class CI_DB_odbc_driver extends CI_DB { * * Generates a platform-specific truncate string from the supplied data * If the database does not support the truncate() command - * This function maps to "DELETE FROM table" + * This public function maps to "DELETE FROM table" * - * @access public * @param string the table name * @return string */ - function _truncate($table) + public function _truncate($table) { return $this->_delete($table); } @@ -522,13 +507,12 @@ class CI_DB_odbc_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * - * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) + public function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -556,13 +540,12 @@ class CI_DB_odbc_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * - * @access public * @param string the sql query string * @param integer the number of rows to limit the query to * @param integer the offset value * @return string */ - function _limit($sql, $limit, $offset) + public function _limit($sql, $limit, $offset) { // Does ODBC doesn't use the LIMIT clause? return $sql; @@ -573,19 +556,14 @@ class CI_DB_odbc_driver extends CI_DB { /** * Close DB Connection * - * @access public * @param resource * @return void */ - function _close($conn_id) + public function _close($conn_id) { @odbc_close($conn_id); } - - } - - /* End of file odbc_driver.php */ -/* Location: ./system/database/drivers/odbc/odbc_driver.php */ +/* Location: ./system/database/drivers/odbc/odbc_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php index acc2cadee..121c09606 100644 --- a/system/database/drivers/odbc/odbc_forge.php +++ b/system/database/drivers/odbc/odbc_forge.php @@ -39,11 +39,10 @@ class CI_DB_odbc_forge extends CI_DB_forge { /** * Create database * - * @access private * @param string the database name * @return bool */ - function _create_database() + protected function _create_database() { // ODBC has no "create database" command since it's // designed to connect to an existing database @@ -59,11 +58,10 @@ class CI_DB_odbc_forge extends CI_DB_forge { /** * Drop database * - * @access private * @param string the database name * @return bool */ - function _drop_database($name) + protected function _drop_database($name) { // ODBC has no "drop database" command since it's // designed to connect to an existing database @@ -79,7 +77,6 @@ class CI_DB_odbc_forge extends CI_DB_forge { /** * Create Table * - * @access private * @param string the table name * @param array the fields * @param mixed primary key(s) @@ -87,7 +84,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -186,10 +183,9 @@ class CI_DB_odbc_forge extends CI_DB_forge { /** * Drop Table * - * @access private * @return bool */ - function _drop_table($table) + protected function _drop_table($table) { // Not a supported ODBC feature if ($this->db->db_debug) @@ -207,7 +203,6 @@ class CI_DB_odbc_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * - * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name @@ -217,7 +212,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -260,12 +255,11 @@ class CI_DB_odbc_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * - * @access private * @param string the old table name * @param string the new table name * @return string */ - function _rename_table($table_name, $new_table_name) + protected function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } @@ -273,4 +267,4 @@ class CI_DB_odbc_forge extends CI_DB_forge { } /* End of file odbc_forge.php */ -/* Location: ./system/database/drivers/odbc/odbc_forge.php */ +/* Location: ./system/database/drivers/odbc/odbc_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php index d19fa247e..0b74871e0 100644 --- a/system/database/drivers/odbc/odbc_result.php +++ b/system/database/drivers/odbc/odbc_result.php @@ -130,7 +130,7 @@ class CI_DB_odbc_result extends CI_DB_result { * * @return null */ - function free_result() + public function free_result() { if (is_resource($this->result_id)) { @@ -148,10 +148,9 @@ class CI_DB_odbc_result extends CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero * - * @access private * @return array */ - function _data_seek($n = 0) + protected function _data_seek($n = 0) { return FALSE; } @@ -163,10 +162,9 @@ class CI_DB_odbc_result extends CI_DB_result { * * Returns the result set as an array * - * @access private * @return array */ - function _fetch_assoc() + protected function _fetch_assoc() { if (function_exists('odbc_fetch_object')) { @@ -185,10 +183,9 @@ class CI_DB_odbc_result extends CI_DB_result { * * Returns the result set as an object * - * @access private * @return object */ - function _fetch_object() + protected function _fetch_object() { if (function_exists('odbc_fetch_object')) { @@ -207,10 +204,9 @@ class CI_DB_odbc_result extends CI_DB_result { * subsititutes the odbc_fetch_object function when * not available (odbc_fetch_object requires unixODBC) * - * @access private * @return object */ - function _odbc_fetch_object(& $odbc_result) { + protected function _odbc_fetch_object(& $odbc_result) { $rs = array(); $rs_obj = FALSE; if (odbc_fetch_into($odbc_result, $rs)) { @@ -229,10 +225,9 @@ class CI_DB_odbc_result extends CI_DB_result { * subsititutes the odbc_fetch_array function when * not available (odbc_fetch_array requires unixODBC) * - * @access private * @return array */ - function _odbc_fetch_array(& $odbc_result) { + protected function _odbc_fetch_array(& $odbc_result) { $rs = array(); $rs_assoc = FALSE; if (odbc_fetch_into($odbc_result, $rs)) { @@ -318,4 +313,4 @@ class CI_DB_odbc_result extends CI_DB_result { } /* End of file odbc_result.php */ -/* Location: ./system/database/drivers/odbc/odbc_result.php */ +/* Location: ./system/database/drivers/odbc/odbc_result.php */ \ No newline at end of file diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php index c146c1785..d663da1ad 100644 --- a/system/database/drivers/odbc/odbc_utility.php +++ b/system/database/drivers/odbc/odbc_utility.php @@ -39,10 +39,9 @@ class CI_DB_odbc_utility extends CI_DB_utility { /** * List databases * - * @access private * @return bool */ - function _list_databases() + protected function _list_databases() { // Not sure if ODBC lets you list all databases... if ($this->db->db_debug) @@ -59,11 +58,10 @@ class CI_DB_odbc_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be optimized * - * @access private * @param string the table name * @return object */ - function _optimize_table($table) + protected function _optimize_table($table) { // Not a supported ODBC feature if ($this->db->db_debug) @@ -80,11 +78,10 @@ class CI_DB_odbc_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be repaired * - * @access private * @param string the table name * @return object */ - function _repair_table($table) + protected function _repair_table($table) { // Not a supported ODBC feature if ($this->db->db_debug) @@ -99,11 +96,10 @@ class CI_DB_odbc_utility extends CI_DB_utility { /** * ODBC Export * - * @access private * @param array Preferences * @return mixed */ - function _backup($params = array()) + protected function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); -- cgit v1.2.3-24-g4f1b From 8c332e7f907e6af498f18fa1bf28e0a0c6e11448 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 18:09:13 -0400 Subject: PDO driver access modifiers --- system/database/drivers/pdo/pdo_driver.php | 124 +++++++++++----------------- system/database/drivers/pdo/pdo_result.php | 25 ++---- system/database/drivers/pdo/pdo_utility.php | 12 +-- 3 files changed, 63 insertions(+), 98 deletions(-) diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 658a3d5a0..727f097f8 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -42,28 +42,31 @@ */ class CI_DB_pdo_driver extends CI_DB { - var $dbdriver = 'pdo'; + public $dbdriver = 'pdo'; // the character used to excape - not necessary for PDO - var $_escape_char = ''; + protected $_escape_char = ''; // clause and character used for LIKE escape sequences - var $_like_escape_str; - var $_like_escape_chr; + protected $_like_escape_str; + protected $_like_escape_chr; /** * The syntax to count rows is slightly different across different * database engines, so this string appears in each driver and is - * used for the count_all() and count_all_results() functions. + * used for the count_all() and count_all_results() public functions. */ - var $_count_string = "SELECT COUNT(*) AS "; - var $_random_keyword; + protected $_count_string = "SELECT COUNT(*) AS "; + protected $_random_keyword; // need to track the pdo driver and options - var $pdodriver; - var $options = array(); + protected $pdodriver; + protected $options = array(); - function __construct($params) + /** + * Pre-connection setup + */ + public function __construct($params) { parent::__construct($params); @@ -104,11 +107,10 @@ class CI_DB_pdo_driver extends CI_DB { /** * Connection String * - * @access private * @param array * @return void */ - function _connect_string($params) + protected function _connect_string($params) { if (strpos($this->hostname, ':')) { @@ -190,10 +192,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Non-persistent database connection * - * @access private called by the base class * @return resource */ - function db_connect() + protected function db_connect() { $this->options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_SILENT; @@ -205,10 +206,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Persistent database connection * - * @access private called by the base class * @return resource */ - function db_pconnect() + protected function db_pconnect() { $this->options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_SILENT; $this->options[PDO::ATTR_PERSISTENT] = TRUE; @@ -221,10 +221,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * PDO connection * - * @access private called by the PDO driver class * @return resource */ - function pdo_connect() + protected function pdo_connect() { // Refer : http://php.net/manual/en/ref.pdo-mysql.connection.php if ($this->pdodriver == 'mysql' && is_php('5.3.6')) @@ -258,10 +257,9 @@ class CI_DB_pdo_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * - * @access public * @return void */ - function reconnect() + public function reconnect() { if ($this->db->db_debug) { @@ -276,10 +274,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Select the database * - * @access private called by the base class * @return resource */ - function db_select() + protected function db_select() { // Not needed for PDO return TRUE; @@ -304,11 +301,10 @@ class CI_DB_pdo_driver extends CI_DB { /** * Execute the query * - * @access private called by the base class * @param string an SQL query * @return object */ - function _execute($sql) + protected function _execute($sql) { $sql = $this->_prep_query($sql); @@ -333,11 +329,10 @@ class CI_DB_pdo_driver extends CI_DB { * * If needed, each database adapter can prep the query string * - * @access private called by execute() * @param string an SQL query * @return string */ - function _prep_query($sql) + protected function _prep_query($sql) { if ($this->pdodriver === 'pgsql') { @@ -347,7 +342,7 @@ class CI_DB_pdo_driver extends CI_DB { elseif ($this->pdodriver === 'sqlite') { // Change the backtick(s) for SQLite - $sql = str_replace('`', '', $sql); + $sql = str_replace('`', '"', $sql); } return $sql; @@ -358,10 +353,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Begin Transaction * - * @access public * @return bool */ - function trans_begin($test_mode = FALSE) + public function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -387,10 +381,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Commit Transaction * - * @access public * @return bool */ - function trans_commit() + public function trans_commit() { if ( ! $this->trans_enabled) { @@ -413,10 +406,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Rollback Transaction * - * @access public * @return bool */ - function trans_rollback() + public function trans_rollback() { if ( ! $this->trans_enabled) { @@ -439,12 +431,11 @@ class CI_DB_pdo_driver extends CI_DB { /** * Escape String * - * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - function escape_str($str, $like = FALSE) + public function escape_str($str, $like = FALSE) { if (is_array($str)) { @@ -483,10 +474,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Affected Rows * - * @access public * @return integer */ - function affected_rows() + public function affected_rows() { return $this->affect_rows; } @@ -518,11 +508,10 @@ class CI_DB_pdo_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * - * @access public * @param string * @return string */ - function count_all($table = '') + public function count_all($table = '') { if ($table == '') { @@ -550,20 +539,19 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access private * @param boolean * @return string */ - function _list_tables($prefix_limit = FALSE) + protected function _list_tables($prefix_limit = FALSE) { if ($this->pdodriver == 'pgsql') { - // Analog function to show all tables in postgre + // Analog public function to show all tables in postgre $sql = "SELECT * FROM information_schema.tables WHERE table_schema = 'public'"; } elseif ($this->pdodriver == 'sqlite') { - // Analog function to show all tables in sqlite + // Analog public function to show all tables in sqlite $sql = "SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'"; } else @@ -586,11 +574,10 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @access public * @param string the table name * @return string */ - function _list_columns($table = '') + public function _list_columns($table = '') { return 'SHOW COLUMNS FROM '.$this->_from_tables($table); } @@ -602,25 +589,24 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * - * @access public * @param string the table name * @return object */ - function _field_data($table) + public function _field_data($table) { if ($this->pdodriver == 'mysql' or $this->pdodriver == 'pgsql') { - // Analog function for mysql and postgre + // Analog public function for mysql and postgre return 'SELECT * FROM '.$this->_from_tables($table).' LIMIT 1'; } elseif ($this->pdodriver == 'oci') { - // Analog function for oci + // Analog public function for oci return 'SELECT * FROM '.$this->_from_tables($table).' WHERE ROWNUM <= 1'; } elseif ($this->pdodriver == 'sqlite') { - // Analog function for sqlite + // Analog public function for sqlite return 'PRAGMA table_info('.$this->_from_tables($table).')'; } @@ -661,13 +647,12 @@ class CI_DB_pdo_driver extends CI_DB { /** * Escape the SQL Identifiers * - * This function escapes column and table names + * This public function escapes column and table names * - * @access private * @param string * @return string */ - function _escape_identifiers($item) + protected function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -704,14 +689,13 @@ class CI_DB_pdo_driver extends CI_DB { /** * From Tables * - * This function implicitly groups FROM tables so there is no confusion + * This public function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @access public * @param type * @return type */ - function _from_tables($tables) + public function _from_tables($tables) { if ( ! is_array($tables)) { @@ -728,13 +712,12 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - function _insert($table, $keys, $values) + public function _insert($table, $keys, $values) { return 'INSERT INTO '.$this->_from_tables($table).' ('.implode(', ', $keys).') VALUES ('.implode(', ', $values).')'; } @@ -746,13 +729,12 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - function _insert_batch($table, $keys, $values) + public function _insert_batch($table, $keys, $values) { return 'INSERT INTO '.$this->_from_tables($table).' ('.implode(', ', $keys).') VALUES '.implode(', ', $values); } @@ -764,7 +746,6 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * - * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -772,7 +753,7 @@ class CI_DB_pdo_driver extends CI_DB { * @param array the limit clause * @return string */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + public function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -796,13 +777,12 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific batch update string from the supplied data * - * @access public * @param string the table name * @param array the update data * @param array the where clause * @return string */ - function _update_batch($table, $values, $index, $where = NULL) + public function _update_batch($table, $values, $index, $where = NULL) { $ids = array(); $where = ($where != '' && count($where) >=1) ? implode(" ", $where).' AND ' : ''; @@ -849,13 +829,12 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific truncate string from the supplied data * If the database does not support the truncate() command - * This function maps to "DELETE FROM table" + * This public function maps to "DELETE FROM table" * - * @access public * @param string the table name * @return string */ - function _truncate($table) + public function _truncate($table) { return $this->_delete($table); } @@ -867,13 +846,12 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * - * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) + public function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -902,13 +880,12 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * - * @access public * @param string the sql query string * @param integer the number of rows to limit the query to * @param integer the offset value * @return string */ - function _limit($sql, $limit, $offset) + public function _limit($sql, $limit, $offset) { if ($this->pdodriver == 'cubrid' OR $this->pdodriver == 'sqlite') { @@ -930,11 +907,10 @@ class CI_DB_pdo_driver extends CI_DB { /** * Close DB Connection * - * @access public * @param resource * @return void */ - function _close($conn_id) + public function _close($conn_id) { $this->conn_id = null; } @@ -942,4 +918,4 @@ class CI_DB_pdo_driver extends CI_DB { } /* End of file pdo_driver.php */ -/* Location: ./system/database/drivers/pdo/pdo_driver.php */ +/* Location: ./system/database/drivers/pdo/pdo_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/pdo/pdo_result.php b/system/database/drivers/pdo/pdo_result.php index 384b753da..330a2e677 100644 --- a/system/database/drivers/pdo/pdo_result.php +++ b/system/database/drivers/pdo/pdo_result.php @@ -51,10 +51,9 @@ class CI_DB_pdo_result extends CI_DB_result { /** * Number of rows in the result set * - * @access public * @return integer */ - function num_rows() + public function num_rows() { if (empty($this->result_id) OR ! is_object($this->result_id)) { @@ -74,10 +73,9 @@ class CI_DB_pdo_result extends CI_DB_result { /** * Fetch the result handler * - * @access public * @return mixed */ - function result_assoc() + public function result_assoc() { // If the result already fetched before, use that one if (count($this->result_array) > 0 OR $this->is_fetched) @@ -116,10 +114,9 @@ class CI_DB_pdo_result extends CI_DB_result { /** * Number of fields in the result set * - * @access public * @return integer */ - function num_fields() + public function num_fields() { return $this->result_id->columnCount(); } @@ -131,10 +128,9 @@ class CI_DB_pdo_result extends CI_DB_result { * * Generates an array of column names * - * @access public * @return array */ - function list_fields() + public function list_fields() { if ($this->db->db_debug) { @@ -151,10 +147,9 @@ class CI_DB_pdo_result extends CI_DB_result { * * Generates an array of objects containing field meta-data * - * @access public * @return array */ - function field_data() + public function field_data() { $data = array(); @@ -224,7 +219,7 @@ class CI_DB_pdo_result extends CI_DB_result { * * @return null */ - function free_result() + public function free_result() { if (is_object($this->result_id)) { @@ -241,10 +236,9 @@ class CI_DB_pdo_result extends CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero * - * @access private * @return array */ - function _data_seek($n = 0) + protected function _data_seek($n = 0) { return FALSE; } @@ -256,10 +250,9 @@ class CI_DB_pdo_result extends CI_DB_result { * * Returns the result set as an array * - * @access private * @return array */ - function _fetch_assoc() + protected function _fetch_assoc() { return $this->result_id->fetch(PDO::FETCH_ASSOC); } @@ -274,7 +267,7 @@ class CI_DB_pdo_result extends CI_DB_result { * @access private * @return object */ - function _fetch_object() + protected function _fetch_object() { return $this->result_id->fetchObject(); } diff --git a/system/database/drivers/pdo/pdo_utility.php b/system/database/drivers/pdo/pdo_utility.php index c278c5172..2c12d7438 100644 --- a/system/database/drivers/pdo/pdo_utility.php +++ b/system/database/drivers/pdo/pdo_utility.php @@ -39,10 +39,9 @@ class CI_DB_pdo_utility extends CI_DB_utility { /** * List databases * - * @access private * @return bool */ - function _list_databases() + protected function _list_databases() { // Not sure if PDO lets you list all databases... if ($this->db->db_debug) @@ -59,11 +58,10 @@ class CI_DB_pdo_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be optimized * - * @access private * @param string the table name * @return object */ - function _optimize_table($table) + protected function _optimize_table($table) { // Not a supported PDO feature if ($this->db->db_debug) @@ -80,11 +78,10 @@ class CI_DB_pdo_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be repaired * - * @access private * @param string the table name * @return object */ - function _repair_table($table) + protected function _repair_table($table) { // Not a supported PDO feature if ($this->db->db_debug) @@ -99,11 +96,10 @@ class CI_DB_pdo_utility extends CI_DB_utility { /** * PDO Export * - * @access private * @param array Preferences * @return mixed */ - function _backup($params = array()) + protected function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); -- cgit v1.2.3-24-g4f1b From 7a3f89716a5ea3fc00e69342f8c9c7de77ca99ce Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 18:18:27 -0400 Subject: Postgre visibility declarations --- system/database/drivers/postgre/postgre_driver.php | 83 ++++++++-------------- system/database/drivers/postgre/postgre_forge.php | 24 +++---- system/database/drivers/postgre/postgre_result.php | 25 +++---- .../database/drivers/postgre/postgre_utility.php | 4 +- 4 files changed, 50 insertions(+), 86 deletions(-) diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index fad9539ff..6ef83726a 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -42,29 +42,28 @@ */ class CI_DB_postgre_driver extends CI_DB { - var $dbdriver = 'postgre'; + public $dbdriver = 'postgre'; - var $_escape_char = '"'; + protected $_escape_char = '"'; // clause and character used for LIKE escape sequences - var $_like_escape_str = " ESCAPE '%s' "; - var $_like_escape_chr = '!'; + protected $_like_escape_str = " ESCAPE '%s' "; + protected $_like_escape_chr = '!'; /** * The syntax to count rows is slightly different across different * database engines, so this string appears in each driver and is * used for the count_all() and count_all_results() functions. */ - var $_count_string = "SELECT COUNT(*) AS "; - var $_random_keyword = ' RANDOM()'; // database specific random keyword + protected $_count_string = "SELECT COUNT(*) AS "; + protected $_random_keyword = ' RANDOM()'; // database specific random keyword /** * Connection String * - * @access private * @return string */ - function _connect_string() + protected function _connect_string() { $components = array( 'hostname' => 'host', @@ -90,10 +89,9 @@ class CI_DB_postgre_driver extends CI_DB { /** * Non-persistent database connection * - * @access private called by the base class * @return resource */ - function db_connect() + protected function db_connect() { return @pg_connect($this->_connect_string()); } @@ -103,10 +101,9 @@ class CI_DB_postgre_driver extends CI_DB { /** * Persistent database connection * - * @access private called by the base class * @return resource */ - function db_pconnect() + protected function db_pconnect() { return @pg_pconnect($this->_connect_string()); } @@ -119,10 +116,9 @@ class CI_DB_postgre_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * - * @access public * @return void */ - function reconnect() + public function reconnect() { if (pg_ping($this->conn_id) === FALSE) { @@ -135,10 +131,9 @@ class CI_DB_postgre_driver extends CI_DB { /** * Select the database * - * @access private called by the base class * @return resource */ - function db_select() + protected function db_select() { // Not needed for Postgre so we'll return TRUE return TRUE; @@ -191,11 +186,10 @@ class CI_DB_postgre_driver extends CI_DB { /** * Execute the query * - * @access private called by the base class * @param string an SQL query * @return resource */ - function _execute($sql) + protected function _execute($sql) { return @pg_query($this->conn_id, $sql); } @@ -264,12 +258,11 @@ class CI_DB_postgre_driver extends CI_DB { /** * Escape String * - * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - function escape_str($str, $like = FALSE) + public function escape_str($str, $like = FALSE) { if (is_array($str)) { @@ -299,10 +292,9 @@ class CI_DB_postgre_driver extends CI_DB { /** * Affected Rows * - * @access public * @return integer */ - function affected_rows() + public function affected_rows() { return @pg_affected_rows($this->result_id); } @@ -312,10 +304,9 @@ class CI_DB_postgre_driver extends CI_DB { /** * Insert ID * - * @access public * @return integer */ - function insert_id() + public function insert_id() { $v = $this->version(); @@ -355,11 +346,10 @@ class CI_DB_postgre_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * - * @access public * @param string * @return string */ - function count_all($table = '') + public function count_all($table = '') { if ($table == '') { @@ -384,11 +374,10 @@ class CI_DB_postgre_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access private * @param boolean * @return string */ - function _list_tables($prefix_limit = FALSE) + protected function _list_tables($prefix_limit = FALSE) { $sql = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'"; @@ -407,11 +396,10 @@ class CI_DB_postgre_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @access public * @param string the table name * @return string */ - function _list_columns($table = '') + public function _list_columns($table = '') { return "SELECT column_name FROM information_schema.columns WHERE table_name ='".$table."'"; } @@ -423,11 +411,10 @@ class CI_DB_postgre_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * - * @access public * @param string the table name * @return object */ - function _field_data($table) + public function _field_data($table) { return "SELECT * FROM ".$table." LIMIT 1"; } @@ -454,11 +441,10 @@ class CI_DB_postgre_driver extends CI_DB { * * This function escapes column and table names * - * @access private * @param string * @return string */ - function _escape_identifiers($item) + protected function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -497,11 +483,10 @@ class CI_DB_postgre_driver extends CI_DB { * This function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @access public * @param type * @return type */ - function _from_tables($tables) + public function _from_tables($tables) { if ( ! is_array($tables)) { @@ -518,13 +503,12 @@ class CI_DB_postgre_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - function _insert($table, $keys, $values) + public function _insert($table, $keys, $values) { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } @@ -536,13 +520,12 @@ class CI_DB_postgre_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - function _insert_batch($table, $keys, $values) + public function _insert_batch($table, $keys, $values) { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values); } @@ -554,7 +537,6 @@ class CI_DB_postgre_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * - * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -562,7 +544,7 @@ class CI_DB_postgre_driver extends CI_DB { * @param array the limit clause * @return string */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + public function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -585,11 +567,10 @@ class CI_DB_postgre_driver extends CI_DB { * If the database does not support the truncate() command * This function maps to "DELETE FROM table" * - * @access public * @param string the table name * @return string */ - function _truncate($table) + public function _truncate($table) { return "TRUNCATE ".$table; } @@ -601,13 +582,12 @@ class CI_DB_postgre_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * - * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) + public function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -632,13 +612,12 @@ class CI_DB_postgre_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * - * @access public * @param string the sql query string * @param integer the number of rows to limit the query to * @param integer the offset value * @return string */ - function _limit($sql, $limit, $offset) + public function _limit($sql, $limit, $offset) { $sql .= "LIMIT ".$limit; @@ -655,18 +634,14 @@ class CI_DB_postgre_driver extends CI_DB { /** * Close DB Connection * - * @access public * @param resource * @return void */ - function _close($conn_id) + public function _close($conn_id) { @pg_close($conn_id); } - - } - /* End of file postgre_driver.php */ -/* Location: ./system/database/drivers/postgre/postgre_driver.php */ +/* Location: ./system/database/drivers/postgre/postgre_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php index 577100544..2aa6ee82a 100644 --- a/system/database/drivers/postgre/postgre_forge.php +++ b/system/database/drivers/postgre/postgre_forge.php @@ -39,11 +39,10 @@ class CI_DB_postgre_forge extends CI_DB_forge { /** * Create database * - * @access private * @param string the database name * @return bool */ - function _create_database($name) + protected function _create_database($name) { return "CREATE DATABASE ".$name; } @@ -53,11 +52,10 @@ class CI_DB_postgre_forge extends CI_DB_forge { /** * Drop database * - * @access private * @param string the database name * @return bool */ - function _drop_database($name) + protected function _drop_database($name) { return "DROP DATABASE ".$name; } @@ -70,7 +68,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param mixed the fields * @return string */ - function _process_fields($fields, $primary_keys=array()) + protected function _process_fields($fields, $primary_keys=array()) { $sql = ''; $current_field_count = 0; @@ -177,7 +175,6 @@ class CI_DB_postgre_forge extends CI_DB_forge { /** * Create Table * - * @access private * @param string the table name * @param array the fields * @param mixed primary key(s) @@ -185,7 +182,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -241,8 +238,11 @@ class CI_DB_postgre_forge extends CI_DB_forge { /** * Drop Table + * + * @param string the table name + * @return string */ - function _drop_table($table) + protected function _drop_table($table) { return "DROP TABLE IF EXISTS ".$this->db->_escape_identifiers($table)." CASCADE"; } @@ -255,7 +255,6 @@ class CI_DB_postgre_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * - * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name @@ -265,7 +264,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - function _alter_table($alter_type, $table, $fields, $after_field = '') + protected function _alter_table($alter_type, $table, $fields, $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '; @@ -292,16 +291,15 @@ class CI_DB_postgre_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * - * @access private * @param string the old table name * @param string the new table name * @return string */ - function _rename_table($table_name, $new_table_name) + protected function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } } /* End of file postgre_forge.php */ -/* Location: ./system/database/drivers/postgre/postgre_forge.php */ +/* Location: ./system/database/drivers/postgre/postgre_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php index 12d7547c5..b27afaedb 100644 --- a/system/database/drivers/postgre/postgre_result.php +++ b/system/database/drivers/postgre/postgre_result.php @@ -41,10 +41,9 @@ class CI_DB_postgre_result extends CI_DB_result { /** * Number of rows in the result set * - * @access public * @return integer */ - function num_rows() + public function num_rows() { return @pg_num_rows($this->result_id); } @@ -54,10 +53,9 @@ class CI_DB_postgre_result extends CI_DB_result { /** * Number of fields in the result set * - * @access public * @return integer */ - function num_fields() + public function num_fields() { return @pg_num_fields($this->result_id); } @@ -69,10 +67,9 @@ class CI_DB_postgre_result extends CI_DB_result { * * Generates an array of column names * - * @access public * @return array */ - function list_fields() + public function list_fields() { $field_names = array(); for ($i = 0; $i < $this->num_fields(); $i++) @@ -90,10 +87,9 @@ class CI_DB_postgre_result extends CI_DB_result { * * Generates an array of objects containing field meta-data * - * @access public * @return array */ - function field_data() + public function field_data() { $retval = array(); for ($i = 0; $i < $this->num_fields(); $i++) @@ -118,7 +114,7 @@ class CI_DB_postgre_result extends CI_DB_result { * * @return null */ - function free_result() + public function free_result() { if (is_resource($this->result_id)) { @@ -136,10 +132,9 @@ class CI_DB_postgre_result extends CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero * - * @access private * @return array */ - function _data_seek($n = 0) + protected function _data_seek($n = 0) { return pg_result_seek($this->result_id, $n); } @@ -151,10 +146,9 @@ class CI_DB_postgre_result extends CI_DB_result { * * Returns the result set as an array * - * @access private * @return array */ - function _fetch_assoc() + protected function _fetch_assoc() { return pg_fetch_assoc($this->result_id); } @@ -166,16 +160,13 @@ class CI_DB_postgre_result extends CI_DB_result { * * Returns the result set as an object * - * @access private * @return object */ - function _fetch_object() + protected function _fetch_object() { return pg_fetch_object($this->result_id); } - } - /* End of file postgre_result.php */ /* Location: ./system/database/drivers/postgre/postgre_result.php */ \ No newline at end of file diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php index e31a6db8f..cf29201ff 100644 --- a/system/database/drivers/postgre/postgre_utility.php +++ b/system/database/drivers/postgre/postgre_utility.php @@ -78,7 +78,7 @@ class CI_DB_postgre_utility extends CI_DB_utility { * @param array Preferences * @return mixed */ - function _backup($params = array()) + public function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); @@ -86,4 +86,4 @@ class CI_DB_postgre_utility extends CI_DB_utility { } /* End of file postgre_utility.php */ -/* Location: ./system/database/drivers/postgre/postgre_utility.php */ +/* Location: ./system/database/drivers/postgre/postgre_utility.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 1ed5995be34f499aec8cd7b6d4d525a33017fd94 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 18:25:43 -0400 Subject: SQlite visibility declarations --- system/database/drivers/sqlite/sqlite_driver.php | 94 ++++++++--------------- system/database/drivers/sqlite/sqlite_forge.php | 19 ++--- system/database/drivers/sqlite/sqlite_result.php | 25 ++---- system/database/drivers/sqlite/sqlite_utility.php | 2 +- 4 files changed, 50 insertions(+), 90 deletions(-) diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 1870e73b7..6535d2753 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -42,30 +42,29 @@ */ class CI_DB_sqlite_driver extends CI_DB { - var $dbdriver = 'sqlite'; + public $dbdriver = 'sqlite'; // The character used to escape with - not needed for SQLite - var $_escape_char = ''; + protected $_escape_char = ''; // clause and character used for LIKE escape sequences - var $_like_escape_str = " ESCAPE '%s' "; - var $_like_escape_chr = '!'; + protected $_like_escape_str = " ESCAPE '%s' "; + protected $_like_escape_chr = '!'; /** * The syntax to count rows is slightly different across different * database engines, so this string appears in each driver and is - * used for the count_all() and count_all_results() functions. + * used for the count_all() and count_all_results() public functions. */ - var $_count_string = "SELECT COUNT(*) AS "; - var $_random_keyword = ' Random()'; // database specific random keyword + protected $_count_string = "SELECT COUNT(*) AS "; + protected $_random_keyword = ' Random()'; // database specific random keyword /** * Non-persistent database connection * - * @access private called by the base class * @return resource */ - function db_connect() + protected function db_connect() { if ( ! $conn_id = @sqlite_open($this->database, FILE_WRITE_MODE, $error)) { @@ -87,10 +86,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Persistent database connection * - * @access private called by the base class * @return resource */ - function db_pconnect() + protected function db_pconnect() { if ( ! $conn_id = @sqlite_popen($this->database, FILE_WRITE_MODE, $error)) { @@ -115,10 +113,9 @@ class CI_DB_sqlite_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * - * @access public * @return void */ - function reconnect() + public function reconnect() { // not implemented in SQLite } @@ -128,10 +125,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Select the database * - * @access private called by the base class * @return resource */ - function db_select() + protected function db_select() { return TRUE; } @@ -155,11 +151,10 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Execute the query * - * @access private called by the base class * @param string an SQL query * @return resource */ - function _execute($sql) + protected function _execute($sql) { return @sqlite_query($this->conn_id, $sql); } @@ -169,10 +164,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Begin Transaction * - * @access public * @return bool */ - function trans_begin($test_mode = FALSE) + public function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -199,10 +193,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Commit Transaction * - * @access public * @return bool */ - function trans_commit() + public function trans_commit() { if ( ! $this->trans_enabled) { @@ -224,10 +217,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Rollback Transaction * - * @access public * @return bool */ - function trans_rollback() + public function trans_rollback() { if ( ! $this->trans_enabled) { @@ -249,12 +241,11 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Escape String * - * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - function escape_str($str, $like = FALSE) + public function escape_str($str, $like = FALSE) { if (is_array($str)) { @@ -284,10 +275,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Affected Rows * - * @access public * @return integer */ - function affected_rows() + public function affected_rows() { return sqlite_changes($this->conn_id); } @@ -297,10 +287,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Insert ID * - * @access public * @return integer */ - function insert_id() + public function insert_id() { return @sqlite_last_insert_rowid($this->conn_id); } @@ -313,11 +302,10 @@ class CI_DB_sqlite_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * - * @access public * @param string * @return string */ - function count_all($table = '') + public function count_all($table = '') { if ($table == '') { @@ -342,11 +330,10 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access private * @param boolean * @return string */ - function _list_tables($prefix_limit = FALSE) + protected function _list_tables($prefix_limit = FALSE) { $sql = "SELECT name from sqlite_master WHERE type='table'"; @@ -364,11 +351,10 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @access public * @param string the table name * @return string */ - function _list_columns($table = '') + public function _list_columns($table = '') { // Not supported return FALSE; @@ -381,11 +367,10 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * - * @access public * @param string the table name * @return object */ - function _field_data($table) + public function _field_data($table) { return "SELECT * FROM ".$table." LIMIT 1"; } @@ -412,13 +397,12 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Escape the SQL Identifiers * - * This function escapes column and table names + * This public function escapes column and table names * - * @access private * @param string * @return string */ - function _escape_identifiers($item) + protected function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -454,14 +438,13 @@ class CI_DB_sqlite_driver extends CI_DB { /** * From Tables * - * This function implicitly groups FROM tables so there is no confusion + * This public function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @access public * @param type * @return type */ - function _from_tables($tables) + public function _from_tables($tables) { if ( ! is_array($tables)) { @@ -478,13 +461,12 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - function _insert($table, $keys, $values) + public function _insert($table, $keys, $values) { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } @@ -496,7 +478,6 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * - * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -504,7 +485,7 @@ class CI_DB_sqlite_driver extends CI_DB { * @param array the limit clause * @return string */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + public function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -532,13 +513,12 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific truncate string from the supplied data * If the database does not support the truncate() command - * This function maps to "DELETE FROM table" + * This public function maps to "DELETE FROM table" * - * @access public * @param string the table name * @return string */ - function _truncate($table) + public function _truncate($table) { return $this->_delete($table); } @@ -550,13 +530,12 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * - * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) + public function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -584,13 +563,12 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * - * @access public * @param string the sql query string * @param integer the number of rows to limit the query to * @param integer the offset value * @return string */ - function _limit($sql, $limit, $offset) + public function _limit($sql, $limit, $offset) { if ($offset == 0) { @@ -609,18 +587,14 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Close DB Connection * - * @access public * @param resource * @return void */ - function _close($conn_id) + public function _close($conn_id) { @sqlite_close($conn_id); } - - } - /* End of file sqlite_driver.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */ +/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php index 7fc531463..595d41968 100644 --- a/system/database/drivers/sqlite/sqlite_forge.php +++ b/system/database/drivers/sqlite/sqlite_forge.php @@ -43,7 +43,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * @param string the database name * @return bool */ - function _create_database() + public function _create_database() { // In SQLite, a database is created when you connect to the database. // We'll return TRUE so that an error isn't generated @@ -55,11 +55,10 @@ class CI_DB_sqlite_forge extends CI_DB_forge { /** * Drop database * - * @access private * @param string the database name * @return bool */ - function _drop_database($name) + protected function _drop_database($name) { if ( ! @file_exists($this->db->database) OR ! @unlink($this->db->database)) { @@ -76,7 +75,6 @@ class CI_DB_sqlite_forge extends CI_DB_forge { /** * Create Table * - * @access private * @param string the table name * @param array the fields * @param mixed primary key(s) @@ -84,7 +82,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -186,10 +184,9 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * * Unsupported feature in SQLite * - * @access private * @return bool */ - function _drop_table($table) + protected function _drop_table($table) { if ($this->db->db_debug) { @@ -206,7 +203,6 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * - * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name @@ -216,7 +212,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -261,12 +257,11 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * - * @access private * @param string the old table name * @param string the new table name * @return string */ - function _rename_table($table_name, $new_table_name) + protected function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } @@ -274,4 +269,4 @@ class CI_DB_sqlite_forge extends CI_DB_forge { } /* End of file sqlite_forge.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_forge.php */ +/* Location: ./system/database/drivers/sqlite/sqlite_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php index ac2235cbc..beb4db6cd 100644 --- a/system/database/drivers/sqlite/sqlite_result.php +++ b/system/database/drivers/sqlite/sqlite_result.php @@ -41,10 +41,9 @@ class CI_DB_sqlite_result extends CI_DB_result { /** * Number of rows in the result set * - * @access public * @return integer */ - function num_rows() + public function num_rows() { return @sqlite_num_rows($this->result_id); } @@ -54,10 +53,9 @@ class CI_DB_sqlite_result extends CI_DB_result { /** * Number of fields in the result set * - * @access public * @return integer */ - function num_fields() + public function num_fields() { return @sqlite_num_fields($this->result_id); } @@ -69,10 +67,9 @@ class CI_DB_sqlite_result extends CI_DB_result { * * Generates an array of column names * - * @access public * @return array */ - function list_fields() + public function list_fields() { $field_names = array(); for ($i = 0; $i < $this->num_fields(); $i++) @@ -90,10 +87,9 @@ class CI_DB_sqlite_result extends CI_DB_result { * * Generates an array of objects containing field meta-data * - * @access public * @return array */ - function field_data() + public function field_data() { $retval = array(); for ($i = 0; $i < $this->num_fields(); $i++) @@ -118,7 +114,7 @@ class CI_DB_sqlite_result extends CI_DB_result { * * @return null */ - function free_result() + public function free_result() { // Not implemented in SQLite } @@ -132,10 +128,9 @@ class CI_DB_sqlite_result extends CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero * - * @access private * @return array */ - function _data_seek($n = 0) + protected function _data_seek($n = 0) { return sqlite_seek($this->result_id, $n); } @@ -147,10 +142,9 @@ class CI_DB_sqlite_result extends CI_DB_result { * * Returns the result set as an array * - * @access private * @return array */ - function _fetch_assoc() + protected function _fetch_assoc() { return sqlite_fetch_array($this->result_id); } @@ -162,10 +156,9 @@ class CI_DB_sqlite_result extends CI_DB_result { * * Returns the result set as an object * - * @access private * @return object */ - function _fetch_object() + protected function _fetch_object() { if (function_exists('sqlite_fetch_object')) { @@ -183,9 +176,7 @@ class CI_DB_sqlite_result extends CI_DB_result { } } } - } - /* End of file sqlite_result.php */ /* Location: ./system/database/drivers/sqlite/sqlite_result.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php index 9f9ddca44..c07004c54 100644 --- a/system/database/drivers/sqlite/sqlite_utility.php +++ b/system/database/drivers/sqlite/sqlite_utility.php @@ -94,4 +94,4 @@ class CI_DB_sqlite_utility extends CI_DB_utility { } /* End of file sqlite_utility.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_utility.php */ +/* Location: ./system/database/drivers/sqlite/sqlite_utility.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From b4172695910bf8c0c07933e9baf536d22c9e097a Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 18:34:11 -0400 Subject: Sqlsrv driver visibility declarations --- system/database/drivers/sqlsrv/sqlsrv_driver.php | 109 +++++++++------------- system/database/drivers/sqlsrv/sqlsrv_forge.php | 20 ++-- system/database/drivers/sqlsrv/sqlsrv_result.php | 24 ++--- system/database/drivers/sqlsrv/sqlsrv_utility.php | 12 +-- 4 files changed, 61 insertions(+), 104 deletions(-) diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index ea9f9483b..95ab61b9f 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -42,30 +42,29 @@ */ class CI_DB_sqlsrv_driver extends CI_DB { - var $dbdriver = 'sqlsrv'; + public $dbdriver = 'sqlsrv'; // The character used for escaping - var $_escape_char = ''; + protected $_escape_char = ''; // clause and character used for LIKE escape sequences - var $_like_escape_str = " ESCAPE '%s' "; - var $_like_escape_chr = '!'; + protected $_like_escape_str = " ESCAPE '%s' "; + protected $_like_escape_chr = '!'; /** * The syntax to count rows is slightly different across different * database engines, so this string appears in each driver and is - * used for the count_all() and count_all_results() functions. + * used for the count_all() and count_all_results() public functions. */ - var $_count_string = "SELECT COUNT(*) AS "; - var $_random_keyword = ' ASC'; // not currently supported + protected $_count_string = "SELECT COUNT(*) AS "; + protected $_random_keyword = ' ASC'; // not currently supported /** * Non-persistent database connection * - * @access private called by the base class * @return resource */ - function db_connect($pooling = false) + protected function db_connect($pooling = false) { // Check for a UTF-8 charset being passed as CI's default 'utf8'. $character_set = (0 === strcasecmp('utf8', $this->char_set)) ? 'UTF-8' : $this->char_set; @@ -93,10 +92,9 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Persistent database connection * - * @access private called by the base class * @return resource */ - function db_pconnect() + protected function db_pconnect() { return $this->db_connect(TRUE); } @@ -109,10 +107,9 @@ class CI_DB_sqlsrv_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * - * @access public * @return void */ - function reconnect() + public function reconnect() { // not implemented in MSSQL } @@ -146,11 +143,10 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Execute the query * - * @access private called by the base class * @param string an SQL query * @return resource */ - function _execute($sql) + protected function _execute($sql) { return sqlsrv_query($this->conn_id, $sql, null, array( 'Scrollable' => SQLSRV_CURSOR_STATIC, @@ -163,10 +159,9 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Begin Transaction * - * @access public * @return bool */ - function trans_begin($test_mode = FALSE) + public function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -192,10 +187,9 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Commit Transaction * - * @access public * @return bool */ - function trans_commit() + public function trans_commit() { if ( ! $this->trans_enabled) { @@ -216,10 +210,9 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Rollback Transaction * - * @access public * @return bool */ - function trans_rollback() + public function trans_rollback() { if ( ! $this->trans_enabled) { @@ -240,12 +233,11 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Escape String * - * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - function escape_str($str, $like = FALSE) + public function escape_str($str, $like = FALSE) { // Escape single quotes return str_replace("'", "''", $str); @@ -256,10 +248,9 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Affected Rows * - * @access public * @return integer */ - function affected_rows() + public function affected_rows() { return @sqlrv_rows_affected($this->conn_id); } @@ -271,10 +262,9 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Returns the last id created in the Identity column. * - * @access public * @return integer */ - function insert_id() + public function insert_id() { return $this->query('select @@IDENTITY as insert_id')->row('insert_id'); } @@ -287,11 +277,10 @@ class CI_DB_sqlsrv_driver extends CI_DB { * Grabs the major version number from the * database server version string passed in. * - * @access private * @param string $version * @return int16 major version number */ - function _parse_major_version($version) + protected function _parse_major_version($version) { preg_match('/([0-9]+)\.([0-9]+)\.([0-9]+)/', $version, $ver_info); return $ver_info[1]; // return the major version b/c that's all we're interested in. @@ -327,11 +316,10 @@ class CI_DB_sqlsrv_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * - * @access public * @param string * @return string */ - function count_all($table = '') + public function count_all($table = '') { if ($table == '') return '0'; @@ -353,11 +341,10 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access private * @param boolean * @return string */ - function _list_tables($prefix_limit = FALSE) + protected function _list_tables($prefix_limit = FALSE) { return "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name"; } @@ -369,11 +356,10 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @access private * @param string the table name * @return string */ - function _list_columns($table = '') + protected function _list_columns($table = '') { return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$this->_escape_table($table)."'"; } @@ -385,11 +371,10 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * - * @access public * @param string the table name * @return object */ - function _field_data($table) + public function _field_data($table) { return "SELECT TOP 1 * FROM " . $this->_escape_table($table); } @@ -437,46 +422,44 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Escape Table Name * - * This function adds backticks if the table name has a period + * This public function adds backticks if the table name has a period * in it. Some DBs will get cranky unless periods are escaped * - * @access private * @param string the table name * @return string */ - function _escape_table($table) + protected function _escape_table($table) { return $table; - } - + } + + // -------------------------------------------------------------------------- /** * Escape the SQL Identifiers * - * This function escapes column and table names + * This public function escapes column and table names * - * @access private * @param string * @return string */ - function _escape_identifiers($item) + protected function _escape_identifiers($item) { return $item; } - // -------------------------------------------------------------------- + // -------------------------------------------------------------------------- /** * From Tables * - * This function implicitly groups FROM tables so there is no confusion + * This public function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @access public - * @param type - * @return type + * @param string the table name + * @return string */ - function _from_tables($tables) + public function _from_tables($tables) { if ( ! is_array($tables)) { @@ -493,13 +476,12 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - function _insert($table, $keys, $values) + public function _insert($table, $keys, $values) { return "INSERT INTO ".$this->_escape_table($table)." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } @@ -511,7 +493,6 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * - * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -519,7 +500,7 @@ class CI_DB_sqlsrv_driver extends CI_DB { * @param array the limit clause * @return string */ - function _update($table, $values, $where) + public function _update($table, $values, $where) { foreach($values as $key => $val) { @@ -536,13 +517,12 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific truncate string from the supplied data * If the database does not support the truncate() command - * This function maps to "DELETE FROM table" + * This public function maps to "DELETE FROM table" * - * @access public * @param string the table name * @return string */ - function _truncate($table) + public function _truncate($table) { return "TRUNCATE ".$table; } @@ -554,13 +534,12 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * - * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - function _delete($table, $where) + public function _delete($table, $where) { return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where); } @@ -572,13 +551,12 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * - * @access public * @param string the sql query string * @param integer the number of rows to limit the query to * @param integer the offset value * @return string */ - function _limit($sql, $limit, $offset) + public function _limit($sql, $limit, $offset) { $i = $limit + $offset; @@ -590,18 +568,15 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Close DB Connection * - * @access public * @param resource * @return void */ - function _close($conn_id) + public function _close($conn_id) { @sqlsrv_close($conn_id); } } - - /* End of file mssql_driver.php */ -/* Location: ./system/database/drivers/mssql/mssql_driver.php */ +/* Location: ./system/database/drivers/mssql/mssql_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php index cd061dd23..645274232 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_forge.php +++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php @@ -39,11 +39,10 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { /** * Create database * - * @access private * @param string the database name * @return bool */ - function _create_database($name) + protected function _create_database($name) { return "CREATE DATABASE ".$name; } @@ -53,11 +52,10 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { /** * Drop database * - * @access private * @param string the database name * @return bool */ - function _drop_database($name) + protected function _drop_database($name) { return "DROP DATABASE ".$name; } @@ -67,10 +65,9 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { /** * Drop Table * - * @access private * @return bool */ - function _drop_table($table) + protected function _drop_table($table) { return "DROP TABLE ".$this->db->_escape_identifiers($table); } @@ -80,7 +77,6 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { /** * Create Table * - * @access private * @param string the table name * @param array the fields * @param mixed primary key(s) @@ -88,7 +84,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -190,7 +186,6 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * - * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name @@ -200,7 +195,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -242,12 +237,11 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * - * @access private * @param string the old table name * @param string the new table name * @return string */ - function _rename_table($table_name, $new_table_name) + protected function _rename_table($table_name, $new_table_name) { // I think this syntax will work, but can find little documentation on renaming tables in MSSQL return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); @@ -256,4 +250,4 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { } /* End of file sqlsrv_forge.php */ -/* Location: ./system/database/drivers/sqlsrv/sqlsrv_forge.php */ +/* Location: ./system/database/drivers/sqlsrv/sqlsrv_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlsrv/sqlsrv_result.php b/system/database/drivers/sqlsrv/sqlsrv_result.php index 52d338a30..095e3440a 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_result.php +++ b/system/database/drivers/sqlsrv/sqlsrv_result.php @@ -41,10 +41,9 @@ class CI_DB_sqlsrv_result extends CI_DB_result { /** * Number of rows in the result set * - * @access public * @return integer */ - function num_rows() + public function num_rows() { return @sqlsrv_num_rows($this->result_id); } @@ -54,10 +53,9 @@ class CI_DB_sqlsrv_result extends CI_DB_result { /** * Number of fields in the result set * - * @access public * @return integer */ - function num_fields() + pubilc function num_fields() { return @sqlsrv_num_fields($this->result_id); } @@ -69,10 +67,9 @@ class CI_DB_sqlsrv_result extends CI_DB_result { * * Generates an array of column names * - * @access public * @return array */ - function list_fields() + public function list_fields() { $field_names = array(); foreach(sqlsrv_field_metadata($this->result_id) as $offset => $field) @@ -90,10 +87,9 @@ class CI_DB_sqlsrv_result extends CI_DB_result { * * Generates an array of objects containing field meta-data * - * @access public * @return array */ - function field_data() + public function field_data() { $retval = array(); foreach(sqlsrv_field_metadata($this->result_id) as $offset => $field) @@ -118,7 +114,7 @@ class CI_DB_sqlsrv_result extends CI_DB_result { * * @return null */ - function free_result() + public function free_result() { if (is_resource($this->result_id)) { @@ -136,10 +132,9 @@ class CI_DB_sqlsrv_result extends CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero * - * @access private * @return array */ - function _data_seek($n = 0) + protected function _data_seek($n = 0) { // Not implemented } @@ -151,10 +146,9 @@ class CI_DB_sqlsrv_result extends CI_DB_result { * * Returns the result set as an array * - * @access private * @return array */ - function _fetch_assoc() + protected function _fetch_assoc() { return sqlsrv_fetch_array($this->result_id, SQLSRV_FETCH_ASSOC); } @@ -166,16 +160,14 @@ class CI_DB_sqlsrv_result extends CI_DB_result { * * Returns the result set as an object * - * @access private * @return object */ - function _fetch_object() + protected function _fetch_object() { return sqlsrv_fetch_object($this->result_id); } } - /* End of file mssql_result.php */ /* Location: ./system/database/drivers/mssql/mssql_result.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlsrv/sqlsrv_utility.php b/system/database/drivers/sqlsrv/sqlsrv_utility.php index 44e6fafeb..9e9dde32e 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_utility.php +++ b/system/database/drivers/sqlsrv/sqlsrv_utility.php @@ -39,10 +39,9 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility { /** * List databases * - * @access private * @return bool */ - function _list_databases() + protected function _list_databases() { return "EXEC sp_helpdb"; // Can also be: EXEC sp_databases } @@ -54,11 +53,10 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be optimized * - * @access private * @param string the table name * @return object */ - function _optimize_table($table) + protected function _optimize_table($table) { return FALSE; // Is this supported in MS SQL? } @@ -70,11 +68,10 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be repaired * - * @access private * @param string the table name * @return object */ - function _repair_table($table) + protected function _repair_table($table) { return FALSE; // Is this supported in MS SQL? } @@ -84,11 +81,10 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility { /** * MSSQL Export * - * @access private * @param array Preferences * @return mixed */ - function _backup($params = array()) + protected function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); -- cgit v1.2.3-24-g4f1b From 9cc5c60052d1942a5f49016a8f36cf90b27b7c78 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 18:36:37 -0400 Subject: Minor mysql/mysqli formatting fixes --- system/database/drivers/mysql/mysql_driver.php | 2 +- system/database/drivers/mysql/mysql_forge.php | 2 +- system/database/drivers/mysql/mysql_result.php | 2 +- system/database/drivers/mysql/mysql_utility.php | 2 +- system/database/drivers/mysqli/mysqli_driver.php | 2 +- system/database/drivers/mysqli/mysqli_forge.php | 2 +- system/database/drivers/mysqli/mysqli_result.php | 2 +- system/database/drivers/mysqli/mysqli_utility.php | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index ba646d226..bef4111c3 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -701,4 +701,4 @@ class CI_DB_mysql_driver extends CI_DB { } /* End of file mysql_driver.php */ -/* Location: ./system/database/drivers/mysql/mysql_driver.php */ +/* Location: ./system/database/drivers/mysql/mysql_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php index 004a5a103..8e5143818 100644 --- a/system/database/drivers/mysql/mysql_forge.php +++ b/system/database/drivers/mysql/mysql_forge.php @@ -237,4 +237,4 @@ class CI_DB_mysql_forge extends CI_DB_forge { } /* End of file mysql_forge.php */ -/* Location: ./system/database/drivers/mysql/mysql_forge.php */ +/* Location: ./system/database/drivers/mysql/mysql_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php index cec28dc2d..f76076f4c 100644 --- a/system/database/drivers/mysql/mysql_result.php +++ b/system/database/drivers/mysql/mysql_result.php @@ -166,4 +166,4 @@ class CI_DB_mysql_result extends CI_DB_result { } /* End of file mysql_result.php */ -/* Location: ./system/database/drivers/mysql/mysql_result.php */ +/* Location: ./system/database/drivers/mysql/mysql_result.php */ \ No newline at end of file diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php index d716b004a..2d89cb9cb 100644 --- a/system/database/drivers/mysql/mysql_utility.php +++ b/system/database/drivers/mysql/mysql_utility.php @@ -204,4 +204,4 @@ class CI_DB_mysql_utility extends CI_DB_utility { } /* End of file mysql_utility.php */ -/* Location: ./system/database/drivers/mysql/mysql_utility.php */ +/* Location: ./system/database/drivers/mysql/mysql_utility.php */ \ No newline at end of file diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index f38b94c13..4c5d52127 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -697,4 +697,4 @@ class CI_DB_mysqli_driver extends CI_DB { } /* End of file mysqli_driver.php */ -/* Location: ./system/database/drivers/mysqli/mysqli_driver.php */ +/* Location: ./system/database/drivers/mysqli/mysqli_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php index 9cb1a0c70..c1be117f3 100644 --- a/system/database/drivers/mysqli/mysqli_forge.php +++ b/system/database/drivers/mysqli/mysqli_forge.php @@ -237,4 +237,4 @@ class CI_DB_mysqli_forge extends CI_DB_forge { } /* End of file mysqli_forge.php */ -/* Location: ./system/database/drivers/mysqli/mysqli_forge.php */ +/* Location: ./system/database/drivers/mysqli/mysqli_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php index f135f4d46..83d88aae3 100644 --- a/system/database/drivers/mysqli/mysqli_result.php +++ b/system/database/drivers/mysqli/mysqli_result.php @@ -167,4 +167,4 @@ class CI_DB_mysqli_result extends CI_DB_result { } /* End of file mysqli_result.php */ -/* Location: ./system/database/drivers/mysqli/mysqli_result.php */ +/* Location: ./system/database/drivers/mysqli/mysqli_result.php */ \ No newline at end of file diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php index 650ddfd18..4d7002e78 100644 --- a/system/database/drivers/mysqli/mysqli_utility.php +++ b/system/database/drivers/mysqli/mysqli_utility.php @@ -90,4 +90,4 @@ class CI_DB_mysqli_utility extends CI_DB_utility { } /* End of file mysqli_utility.php */ -/* Location: ./system/database/drivers/mysqli/mysqli_utility.php */ +/* Location: ./system/database/drivers/mysqli/mysqli_utility.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 78a2de4e049f478ec1efd92d639aaf11be933335 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 18:57:56 -0400 Subject: Fixed visibility declarations on dbforge and utility classes --- system/database/drivers/cubrid/cubrid_forge.php | 14 +++++++------- system/database/drivers/cubrid/cubrid_utility.php | 8 ++++---- system/database/drivers/oci8/oci8_forge.php | 8 ++++---- system/database/drivers/oci8/oci8_utility.php | 8 ++++---- system/database/drivers/odbc/odbc_forge.php | 12 ++++++------ system/database/drivers/odbc/odbc_utility.php | 8 ++++---- system/database/drivers/pdo/pdo_forge.php | 20 +++++++------------- system/database/drivers/pdo/pdo_utility.php | 8 ++++---- system/database/drivers/postgre/postgre_forge.php | 14 +++++++------- system/database/drivers/sqlite/sqlite_forge.php | 10 +++++----- system/database/drivers/sqlsrv/sqlsrv_forge.php | 12 ++++++------ system/database/drivers/sqlsrv/sqlsrv_utility.php | 8 ++++---- 12 files changed, 62 insertions(+), 68 deletions(-) diff --git a/system/database/drivers/cubrid/cubrid_forge.php b/system/database/drivers/cubrid/cubrid_forge.php index 6bfc7c28f..c3251bd3f 100644 --- a/system/database/drivers/cubrid/cubrid_forge.php +++ b/system/database/drivers/cubrid/cubrid_forge.php @@ -42,7 +42,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * @param string the database name * @return bool */ - protected function _create_database($name) + public function _create_database($name) { // CUBRID does not allow to create a database in SQL. The GUI tools // have to be used for this purpose. @@ -57,7 +57,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * @param string the database name * @return bool */ - protected function _drop_database($name) + public function _drop_database($name) { // CUBRID does not allow to drop a database in SQL. The GUI tools // have to be used for this purpose. @@ -72,7 +72,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * @param mixed the fields * @return string */ - protected function _process_fields($fields) + public function _process_fields($fields) { $current_field_count = 0; $sql = ''; @@ -176,7 +176,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -230,7 +230,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * * @return string */ - protected function _drop_table($table) + public function _drop_table($table) { return "DROP TABLE IF EXISTS ".$this->db->_escape_identifiers($table); } @@ -249,7 +249,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - protected function _alter_table($alter_type, $table, $fields, $after_field = '') + public function _alter_table($alter_type, $table, $fields, $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '; @@ -280,7 +280,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * @param string the new table name * @return string */ - protected function _rename_table($table_name, $new_table_name) + public function _rename_table($table_name, $new_table_name) { return 'RENAME TABLE '.$this->db->protect_identifiers($table_name).' AS '.$this->db->protect_identifiers($new_table_name); } diff --git a/system/database/drivers/cubrid/cubrid_utility.php b/system/database/drivers/cubrid/cubrid_utility.php index de28e6335..bc54e7a1b 100644 --- a/system/database/drivers/cubrid/cubrid_utility.php +++ b/system/database/drivers/cubrid/cubrid_utility.php @@ -42,7 +42,7 @@ class CI_DB_cubrid_utility extends CI_DB_utility { * @access private * @return array */ - protected function _list_databases() + public function _list_databases() { // CUBRID does not allow to see the list of all databases on the // server. It is the way its architecture is designed. Every @@ -71,7 +71,7 @@ class CI_DB_cubrid_utility extends CI_DB_utility { * @return object * @link http://www.cubrid.org/manual/840/en/Optimize%20Database */ - protected function _optimize_table($table) + public function _optimize_table($table) { // No SQL based support in CUBRID as of version 8.4.0. Database or // table optimization can be performed using CUBRID Manager @@ -91,7 +91,7 @@ class CI_DB_cubrid_utility extends CI_DB_utility { * @return object * @link http://www.cubrid.org/manual/840/en/Checking%20Database%20Consistency */ - protected function _repair_table($table) + public function _repair_table($table) { // Not supported in CUBRID as of version 8.4.0. Database or // table consistency can be checked using CUBRID Manager @@ -107,7 +107,7 @@ class CI_DB_cubrid_utility extends CI_DB_utility { * @param array Preferences * @return mixed */ - protected function _backup($params = array()) + public function _backup($params = array()) { // No SQL based support in CUBRID as of version 8.4.0. Database or // table backup can be performed using CUBRID Manager diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php index f9a90ff0a..c59cfa709 100644 --- a/system/database/drivers/oci8/oci8_forge.php +++ b/system/database/drivers/oci8/oci8_forge.php @@ -55,7 +55,7 @@ class CI_DB_oci8_forge extends CI_DB_forge { * @param string the database name * @return bool */ - protected function _drop_database($name) + public function _drop_database($name) { return FALSE; } @@ -144,7 +144,7 @@ class CI_DB_oci8_forge extends CI_DB_forge { * * @return bool */ - protected function _drop_table($table) + public function _drop_table($table) { return FALSE; } @@ -166,7 +166,7 @@ class CI_DB_oci8_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + public function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -212,7 +212,7 @@ class CI_DB_oci8_forge extends CI_DB_forge { * @param string the new table name * @return string */ - protected function _rename_table($table_name, $new_table_name) + public function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php index f4863c0db..bfbf87140 100644 --- a/system/database/drivers/oci8/oci8_utility.php +++ b/system/database/drivers/oci8/oci8_utility.php @@ -41,7 +41,7 @@ class CI_DB_oci8_utility extends CI_DB_utility { * * @return bool */ - protected function _list_databases() + public function _list_databases() { return FALSE; } @@ -56,7 +56,7 @@ class CI_DB_oci8_utility extends CI_DB_utility { * @param string the table name * @return object */ - protected function _optimize_table($table) + public function _optimize_table($table) { return FALSE; // Is this supported in Oracle? } @@ -71,7 +71,7 @@ class CI_DB_oci8_utility extends CI_DB_utility { * @param string the table name * @return object */ - protected function _repair_table($table) + public function _repair_table($table) { return FALSE; // Is this supported in Oracle? } @@ -84,7 +84,7 @@ class CI_DB_oci8_utility extends CI_DB_utility { * @param array Preferences * @return mixed */ - protected function _backup($params = array()) + public function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php index 121c09606..c5b062e5c 100644 --- a/system/database/drivers/odbc/odbc_forge.php +++ b/system/database/drivers/odbc/odbc_forge.php @@ -42,7 +42,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { * @param string the database name * @return bool */ - protected function _create_database() + public function _create_database() { // ODBC has no "create database" command since it's // designed to connect to an existing database @@ -61,7 +61,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { * @param string the database name * @return bool */ - protected function _drop_database($name) + public function _drop_database($name) { // ODBC has no "drop database" command since it's // designed to connect to an existing database @@ -84,7 +84,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -185,7 +185,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { * * @return bool */ - protected function _drop_table($table) + public function _drop_table($table) { // Not a supported ODBC feature if ($this->db->db_debug) @@ -212,7 +212,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + public function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -259,7 +259,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { * @param string the new table name * @return string */ - protected function _rename_table($table_name, $new_table_name) + public function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php index d663da1ad..a07d3b64e 100644 --- a/system/database/drivers/odbc/odbc_utility.php +++ b/system/database/drivers/odbc/odbc_utility.php @@ -41,7 +41,7 @@ class CI_DB_odbc_utility extends CI_DB_utility { * * @return bool */ - protected function _list_databases() + public function _list_databases() { // Not sure if ODBC lets you list all databases... if ($this->db->db_debug) @@ -61,7 +61,7 @@ class CI_DB_odbc_utility extends CI_DB_utility { * @param string the table name * @return object */ - protected function _optimize_table($table) + public function _optimize_table($table) { // Not a supported ODBC feature if ($this->db->db_debug) @@ -81,7 +81,7 @@ class CI_DB_odbc_utility extends CI_DB_utility { * @param string the table name * @return object */ - protected function _repair_table($table) + public function _repair_table($table) { // Not a supported ODBC feature if ($this->db->db_debug) @@ -99,7 +99,7 @@ class CI_DB_odbc_utility extends CI_DB_utility { * @param array Preferences * @return mixed */ - protected function _backup($params = array()) + public function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); diff --git a/system/database/drivers/pdo/pdo_forge.php b/system/database/drivers/pdo/pdo_forge.php index 87b638570..7fca962b3 100644 --- a/system/database/drivers/pdo/pdo_forge.php +++ b/system/database/drivers/pdo/pdo_forge.php @@ -39,11 +39,10 @@ class CI_DB_pdo_forge extends CI_DB_forge { /** * Create database * - * @access private * @param string the database name * @return bool */ - function _create_database() + public function _create_database() { // PDO has no "create database" command since it's // designed to connect to an existing database @@ -59,11 +58,10 @@ class CI_DB_pdo_forge extends CI_DB_forge { /** * Drop database * - * @access private * @param string the database name * @return bool */ - function _drop_database($name) + public function _drop_database($name) { // PDO has no "drop database" command since it's // designed to connect to an existing database @@ -79,7 +77,6 @@ class CI_DB_pdo_forge extends CI_DB_forge { /** * Create Table * - * @access private * @param string the table name * @param array the fields * @param mixed primary key(s) @@ -87,7 +84,7 @@ class CI_DB_pdo_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -191,10 +188,9 @@ class CI_DB_pdo_forge extends CI_DB_forge { /** * Drop Table * - * @access private * @return bool */ - function _drop_table($table) + public function _drop_table($table) { // Not a supported PDO feature if ($this->db->db_debug) @@ -212,7 +208,6 @@ class CI_DB_pdo_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * - * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name @@ -222,7 +217,7 @@ class CI_DB_pdo_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + public function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE `'.$this->db->protect_identifiers($table).'` '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -265,12 +260,11 @@ class CI_DB_pdo_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * - * @access private * @param string the old table name * @param string the new table name * @return string */ - function _rename_table($table_name, $new_table_name) + public function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } @@ -278,4 +272,4 @@ class CI_DB_pdo_forge extends CI_DB_forge { } /* End of file pdo_forge.php */ -/* Location: ./system/database/drivers/pdo/pdo_forge.php */ +/* Location: ./system/database/drivers/pdo/pdo_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/pdo/pdo_utility.php b/system/database/drivers/pdo/pdo_utility.php index 2c12d7438..02373b720 100644 --- a/system/database/drivers/pdo/pdo_utility.php +++ b/system/database/drivers/pdo/pdo_utility.php @@ -41,7 +41,7 @@ class CI_DB_pdo_utility extends CI_DB_utility { * * @return bool */ - protected function _list_databases() + public function _list_databases() { // Not sure if PDO lets you list all databases... if ($this->db->db_debug) @@ -61,7 +61,7 @@ class CI_DB_pdo_utility extends CI_DB_utility { * @param string the table name * @return object */ - protected function _optimize_table($table) + public function _optimize_table($table) { // Not a supported PDO feature if ($this->db->db_debug) @@ -81,7 +81,7 @@ class CI_DB_pdo_utility extends CI_DB_utility { * @param string the table name * @return object */ - protected function _repair_table($table) + public function _repair_table($table) { // Not a supported PDO feature if ($this->db->db_debug) @@ -99,7 +99,7 @@ class CI_DB_pdo_utility extends CI_DB_utility { * @param array Preferences * @return mixed */ - protected function _backup($params = array()) + public function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php index 2aa6ee82a..04622586d 100644 --- a/system/database/drivers/postgre/postgre_forge.php +++ b/system/database/drivers/postgre/postgre_forge.php @@ -42,7 +42,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param string the database name * @return bool */ - protected function _create_database($name) + public function _create_database($name) { return "CREATE DATABASE ".$name; } @@ -55,7 +55,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param string the database name * @return bool */ - protected function _drop_database($name) + public function _drop_database($name) { return "DROP DATABASE ".$name; } @@ -68,7 +68,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param mixed the fields * @return string */ - protected function _process_fields($fields, $primary_keys=array()) + public function _process_fields($fields, $primary_keys=array()) { $sql = ''; $current_field_count = 0; @@ -182,7 +182,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -242,7 +242,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param string the table name * @return string */ - protected function _drop_table($table) + public function _drop_table($table) { return "DROP TABLE IF EXISTS ".$this->db->_escape_identifiers($table)." CASCADE"; } @@ -264,7 +264,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - protected function _alter_table($alter_type, $table, $fields, $after_field = '') + public function _alter_table($alter_type, $table, $fields, $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '; @@ -295,7 +295,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param string the new table name * @return string */ - protected function _rename_table($table_name, $new_table_name) + public function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php index 595d41968..4b22989ea 100644 --- a/system/database/drivers/sqlite/sqlite_forge.php +++ b/system/database/drivers/sqlite/sqlite_forge.php @@ -58,7 +58,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * @param string the database name * @return bool */ - protected function _drop_database($name) + public function _drop_database($name) { if ( ! @file_exists($this->db->database) OR ! @unlink($this->db->database)) { @@ -82,7 +82,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -186,7 +186,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * * @return bool */ - protected function _drop_table($table) + public function _drop_table($table) { if ($this->db->db_debug) { @@ -212,7 +212,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + public function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -261,7 +261,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * @param string the new table name * @return string */ - protected function _rename_table($table_name, $new_table_name) + public function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php index 645274232..b7b45a4e6 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_forge.php +++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php @@ -42,7 +42,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * @param string the database name * @return bool */ - protected function _create_database($name) + public function _create_database($name) { return "CREATE DATABASE ".$name; } @@ -55,7 +55,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * @param string the database name * @return bool */ - protected function _drop_database($name) + public function _drop_database($name) { return "DROP DATABASE ".$name; } @@ -67,7 +67,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * * @return bool */ - protected function _drop_table($table) + public function _drop_table($table) { return "DROP TABLE ".$this->db->_escape_identifiers($table); } @@ -84,7 +84,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -195,7 +195,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + public function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -241,7 +241,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * @param string the new table name * @return string */ - protected function _rename_table($table_name, $new_table_name) + public function _rename_table($table_name, $new_table_name) { // I think this syntax will work, but can find little documentation on renaming tables in MSSQL return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); diff --git a/system/database/drivers/sqlsrv/sqlsrv_utility.php b/system/database/drivers/sqlsrv/sqlsrv_utility.php index 9e9dde32e..4d40f0675 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_utility.php +++ b/system/database/drivers/sqlsrv/sqlsrv_utility.php @@ -41,7 +41,7 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility { * * @return bool */ - protected function _list_databases() + public function _list_databases() { return "EXEC sp_helpdb"; // Can also be: EXEC sp_databases } @@ -56,7 +56,7 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility { * @param string the table name * @return object */ - protected function _optimize_table($table) + public function _optimize_table($table) { return FALSE; // Is this supported in MS SQL? } @@ -71,7 +71,7 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility { * @param string the table name * @return object */ - protected function _repair_table($table) + public function _repair_table($table) { return FALSE; // Is this supported in MS SQL? } @@ -84,7 +84,7 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility { * @param array Preferences * @return mixed */ - protected function _backup($params = array()) + public function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); -- cgit v1.2.3-24-g4f1b From 5137ebcafe525752bfc79abc0628e45f55eb196e Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 19:05:25 -0400 Subject: Revert "Fixed visibility declarations on dbforge and utility classes" This reverts commit 78a2de4e049f478ec1efd92d639aaf11be933335. --- system/database/drivers/cubrid/cubrid_forge.php | 14 +++++++------- system/database/drivers/cubrid/cubrid_utility.php | 8 ++++---- system/database/drivers/oci8/oci8_forge.php | 8 ++++---- system/database/drivers/oci8/oci8_utility.php | 8 ++++---- system/database/drivers/odbc/odbc_forge.php | 12 ++++++------ system/database/drivers/odbc/odbc_utility.php | 8 ++++---- system/database/drivers/pdo/pdo_forge.php | 20 +++++++++++++------- system/database/drivers/pdo/pdo_utility.php | 8 ++++---- system/database/drivers/postgre/postgre_forge.php | 14 +++++++------- system/database/drivers/sqlite/sqlite_forge.php | 10 +++++----- system/database/drivers/sqlsrv/sqlsrv_forge.php | 12 ++++++------ system/database/drivers/sqlsrv/sqlsrv_utility.php | 8 ++++---- 12 files changed, 68 insertions(+), 62 deletions(-) diff --git a/system/database/drivers/cubrid/cubrid_forge.php b/system/database/drivers/cubrid/cubrid_forge.php index c3251bd3f..6bfc7c28f 100644 --- a/system/database/drivers/cubrid/cubrid_forge.php +++ b/system/database/drivers/cubrid/cubrid_forge.php @@ -42,7 +42,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * @param string the database name * @return bool */ - public function _create_database($name) + protected function _create_database($name) { // CUBRID does not allow to create a database in SQL. The GUI tools // have to be used for this purpose. @@ -57,7 +57,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * @param string the database name * @return bool */ - public function _drop_database($name) + protected function _drop_database($name) { // CUBRID does not allow to drop a database in SQL. The GUI tools // have to be used for this purpose. @@ -72,7 +72,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * @param mixed the fields * @return string */ - public function _process_fields($fields) + protected function _process_fields($fields) { $current_field_count = 0; $sql = ''; @@ -176,7 +176,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -230,7 +230,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * * @return string */ - public function _drop_table($table) + protected function _drop_table($table) { return "DROP TABLE IF EXISTS ".$this->db->_escape_identifiers($table); } @@ -249,7 +249,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - public function _alter_table($alter_type, $table, $fields, $after_field = '') + protected function _alter_table($alter_type, $table, $fields, $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '; @@ -280,7 +280,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * @param string the new table name * @return string */ - public function _rename_table($table_name, $new_table_name) + protected function _rename_table($table_name, $new_table_name) { return 'RENAME TABLE '.$this->db->protect_identifiers($table_name).' AS '.$this->db->protect_identifiers($new_table_name); } diff --git a/system/database/drivers/cubrid/cubrid_utility.php b/system/database/drivers/cubrid/cubrid_utility.php index bc54e7a1b..de28e6335 100644 --- a/system/database/drivers/cubrid/cubrid_utility.php +++ b/system/database/drivers/cubrid/cubrid_utility.php @@ -42,7 +42,7 @@ class CI_DB_cubrid_utility extends CI_DB_utility { * @access private * @return array */ - public function _list_databases() + protected function _list_databases() { // CUBRID does not allow to see the list of all databases on the // server. It is the way its architecture is designed. Every @@ -71,7 +71,7 @@ class CI_DB_cubrid_utility extends CI_DB_utility { * @return object * @link http://www.cubrid.org/manual/840/en/Optimize%20Database */ - public function _optimize_table($table) + protected function _optimize_table($table) { // No SQL based support in CUBRID as of version 8.4.0. Database or // table optimization can be performed using CUBRID Manager @@ -91,7 +91,7 @@ class CI_DB_cubrid_utility extends CI_DB_utility { * @return object * @link http://www.cubrid.org/manual/840/en/Checking%20Database%20Consistency */ - public function _repair_table($table) + protected function _repair_table($table) { // Not supported in CUBRID as of version 8.4.0. Database or // table consistency can be checked using CUBRID Manager @@ -107,7 +107,7 @@ class CI_DB_cubrid_utility extends CI_DB_utility { * @param array Preferences * @return mixed */ - public function _backup($params = array()) + protected function _backup($params = array()) { // No SQL based support in CUBRID as of version 8.4.0. Database or // table backup can be performed using CUBRID Manager diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php index c59cfa709..f9a90ff0a 100644 --- a/system/database/drivers/oci8/oci8_forge.php +++ b/system/database/drivers/oci8/oci8_forge.php @@ -55,7 +55,7 @@ class CI_DB_oci8_forge extends CI_DB_forge { * @param string the database name * @return bool */ - public function _drop_database($name) + protected function _drop_database($name) { return FALSE; } @@ -144,7 +144,7 @@ class CI_DB_oci8_forge extends CI_DB_forge { * * @return bool */ - public function _drop_table($table) + protected function _drop_table($table) { return FALSE; } @@ -166,7 +166,7 @@ class CI_DB_oci8_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - public function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -212,7 +212,7 @@ class CI_DB_oci8_forge extends CI_DB_forge { * @param string the new table name * @return string */ - public function _rename_table($table_name, $new_table_name) + protected function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php index bfbf87140..f4863c0db 100644 --- a/system/database/drivers/oci8/oci8_utility.php +++ b/system/database/drivers/oci8/oci8_utility.php @@ -41,7 +41,7 @@ class CI_DB_oci8_utility extends CI_DB_utility { * * @return bool */ - public function _list_databases() + protected function _list_databases() { return FALSE; } @@ -56,7 +56,7 @@ class CI_DB_oci8_utility extends CI_DB_utility { * @param string the table name * @return object */ - public function _optimize_table($table) + protected function _optimize_table($table) { return FALSE; // Is this supported in Oracle? } @@ -71,7 +71,7 @@ class CI_DB_oci8_utility extends CI_DB_utility { * @param string the table name * @return object */ - public function _repair_table($table) + protected function _repair_table($table) { return FALSE; // Is this supported in Oracle? } @@ -84,7 +84,7 @@ class CI_DB_oci8_utility extends CI_DB_utility { * @param array Preferences * @return mixed */ - public function _backup($params = array()) + protected function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php index c5b062e5c..121c09606 100644 --- a/system/database/drivers/odbc/odbc_forge.php +++ b/system/database/drivers/odbc/odbc_forge.php @@ -42,7 +42,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { * @param string the database name * @return bool */ - public function _create_database() + protected function _create_database() { // ODBC has no "create database" command since it's // designed to connect to an existing database @@ -61,7 +61,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { * @param string the database name * @return bool */ - public function _drop_database($name) + protected function _drop_database($name) { // ODBC has no "drop database" command since it's // designed to connect to an existing database @@ -84,7 +84,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -185,7 +185,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { * * @return bool */ - public function _drop_table($table) + protected function _drop_table($table) { // Not a supported ODBC feature if ($this->db->db_debug) @@ -212,7 +212,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - public function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -259,7 +259,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { * @param string the new table name * @return string */ - public function _rename_table($table_name, $new_table_name) + protected function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php index a07d3b64e..d663da1ad 100644 --- a/system/database/drivers/odbc/odbc_utility.php +++ b/system/database/drivers/odbc/odbc_utility.php @@ -41,7 +41,7 @@ class CI_DB_odbc_utility extends CI_DB_utility { * * @return bool */ - public function _list_databases() + protected function _list_databases() { // Not sure if ODBC lets you list all databases... if ($this->db->db_debug) @@ -61,7 +61,7 @@ class CI_DB_odbc_utility extends CI_DB_utility { * @param string the table name * @return object */ - public function _optimize_table($table) + protected function _optimize_table($table) { // Not a supported ODBC feature if ($this->db->db_debug) @@ -81,7 +81,7 @@ class CI_DB_odbc_utility extends CI_DB_utility { * @param string the table name * @return object */ - public function _repair_table($table) + protected function _repair_table($table) { // Not a supported ODBC feature if ($this->db->db_debug) @@ -99,7 +99,7 @@ class CI_DB_odbc_utility extends CI_DB_utility { * @param array Preferences * @return mixed */ - public function _backup($params = array()) + protected function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); diff --git a/system/database/drivers/pdo/pdo_forge.php b/system/database/drivers/pdo/pdo_forge.php index 7fca962b3..87b638570 100644 --- a/system/database/drivers/pdo/pdo_forge.php +++ b/system/database/drivers/pdo/pdo_forge.php @@ -39,10 +39,11 @@ class CI_DB_pdo_forge extends CI_DB_forge { /** * Create database * + * @access private * @param string the database name * @return bool */ - public function _create_database() + function _create_database() { // PDO has no "create database" command since it's // designed to connect to an existing database @@ -58,10 +59,11 @@ class CI_DB_pdo_forge extends CI_DB_forge { /** * Drop database * + * @access private * @param string the database name * @return bool */ - public function _drop_database($name) + function _drop_database($name) { // PDO has no "drop database" command since it's // designed to connect to an existing database @@ -77,6 +79,7 @@ class CI_DB_pdo_forge extends CI_DB_forge { /** * Create Table * + * @access private * @param string the table name * @param array the fields * @param mixed primary key(s) @@ -84,7 +87,7 @@ class CI_DB_pdo_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -188,9 +191,10 @@ class CI_DB_pdo_forge extends CI_DB_forge { /** * Drop Table * + * @access private * @return bool */ - public function _drop_table($table) + function _drop_table($table) { // Not a supported PDO feature if ($this->db->db_debug) @@ -208,6 +212,7 @@ class CI_DB_pdo_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * + * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name @@ -217,7 +222,7 @@ class CI_DB_pdo_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - public function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE `'.$this->db->protect_identifiers($table).'` '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -260,11 +265,12 @@ class CI_DB_pdo_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * + * @access private * @param string the old table name * @param string the new table name * @return string */ - public function _rename_table($table_name, $new_table_name) + function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } @@ -272,4 +278,4 @@ class CI_DB_pdo_forge extends CI_DB_forge { } /* End of file pdo_forge.php */ -/* Location: ./system/database/drivers/pdo/pdo_forge.php */ \ No newline at end of file +/* Location: ./system/database/drivers/pdo/pdo_forge.php */ diff --git a/system/database/drivers/pdo/pdo_utility.php b/system/database/drivers/pdo/pdo_utility.php index 02373b720..2c12d7438 100644 --- a/system/database/drivers/pdo/pdo_utility.php +++ b/system/database/drivers/pdo/pdo_utility.php @@ -41,7 +41,7 @@ class CI_DB_pdo_utility extends CI_DB_utility { * * @return bool */ - public function _list_databases() + protected function _list_databases() { // Not sure if PDO lets you list all databases... if ($this->db->db_debug) @@ -61,7 +61,7 @@ class CI_DB_pdo_utility extends CI_DB_utility { * @param string the table name * @return object */ - public function _optimize_table($table) + protected function _optimize_table($table) { // Not a supported PDO feature if ($this->db->db_debug) @@ -81,7 +81,7 @@ class CI_DB_pdo_utility extends CI_DB_utility { * @param string the table name * @return object */ - public function _repair_table($table) + protected function _repair_table($table) { // Not a supported PDO feature if ($this->db->db_debug) @@ -99,7 +99,7 @@ class CI_DB_pdo_utility extends CI_DB_utility { * @param array Preferences * @return mixed */ - public function _backup($params = array()) + protected function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php index 04622586d..2aa6ee82a 100644 --- a/system/database/drivers/postgre/postgre_forge.php +++ b/system/database/drivers/postgre/postgre_forge.php @@ -42,7 +42,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param string the database name * @return bool */ - public function _create_database($name) + protected function _create_database($name) { return "CREATE DATABASE ".$name; } @@ -55,7 +55,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param string the database name * @return bool */ - public function _drop_database($name) + protected function _drop_database($name) { return "DROP DATABASE ".$name; } @@ -68,7 +68,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param mixed the fields * @return string */ - public function _process_fields($fields, $primary_keys=array()) + protected function _process_fields($fields, $primary_keys=array()) { $sql = ''; $current_field_count = 0; @@ -182,7 +182,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -242,7 +242,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param string the table name * @return string */ - public function _drop_table($table) + protected function _drop_table($table) { return "DROP TABLE IF EXISTS ".$this->db->_escape_identifiers($table)." CASCADE"; } @@ -264,7 +264,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - public function _alter_table($alter_type, $table, $fields, $after_field = '') + protected function _alter_table($alter_type, $table, $fields, $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '; @@ -295,7 +295,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param string the new table name * @return string */ - public function _rename_table($table_name, $new_table_name) + protected function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php index 4b22989ea..595d41968 100644 --- a/system/database/drivers/sqlite/sqlite_forge.php +++ b/system/database/drivers/sqlite/sqlite_forge.php @@ -58,7 +58,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * @param string the database name * @return bool */ - public function _drop_database($name) + protected function _drop_database($name) { if ( ! @file_exists($this->db->database) OR ! @unlink($this->db->database)) { @@ -82,7 +82,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -186,7 +186,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * * @return bool */ - public function _drop_table($table) + protected function _drop_table($table) { if ($this->db->db_debug) { @@ -212,7 +212,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - public function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -261,7 +261,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * @param string the new table name * @return string */ - public function _rename_table($table_name, $new_table_name) + protected function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php index b7b45a4e6..645274232 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_forge.php +++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php @@ -42,7 +42,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * @param string the database name * @return bool */ - public function _create_database($name) + protected function _create_database($name) { return "CREATE DATABASE ".$name; } @@ -55,7 +55,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * @param string the database name * @return bool */ - public function _drop_database($name) + protected function _drop_database($name) { return "DROP DATABASE ".$name; } @@ -67,7 +67,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * * @return bool */ - public function _drop_table($table) + protected function _drop_table($table) { return "DROP TABLE ".$this->db->_escape_identifiers($table); } @@ -84,7 +84,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -195,7 +195,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - public function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -241,7 +241,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * @param string the new table name * @return string */ - public function _rename_table($table_name, $new_table_name) + protected function _rename_table($table_name, $new_table_name) { // I think this syntax will work, but can find little documentation on renaming tables in MSSQL return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); diff --git a/system/database/drivers/sqlsrv/sqlsrv_utility.php b/system/database/drivers/sqlsrv/sqlsrv_utility.php index 4d40f0675..9e9dde32e 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_utility.php +++ b/system/database/drivers/sqlsrv/sqlsrv_utility.php @@ -41,7 +41,7 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility { * * @return bool */ - public function _list_databases() + protected function _list_databases() { return "EXEC sp_helpdb"; // Can also be: EXEC sp_databases } @@ -56,7 +56,7 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility { * @param string the table name * @return object */ - public function _optimize_table($table) + protected function _optimize_table($table) { return FALSE; // Is this supported in MS SQL? } @@ -71,7 +71,7 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility { * @param string the table name * @return object */ - public function _repair_table($table) + protected function _repair_table($table) { return FALSE; // Is this supported in MS SQL? } @@ -84,7 +84,7 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility { * @param array Preferences * @return mixed */ - public function _backup($params = array()) + protected function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); -- cgit v1.2.3-24-g4f1b From 0e20da17ff71bbe4a7082940b38f6161d7b6e7f8 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 19:05:46 -0400 Subject: Revert "Sqlsrv driver visibility declarations" This reverts commit b4172695910bf8c0c07933e9baf536d22c9e097a. --- system/database/drivers/sqlsrv/sqlsrv_driver.php | 109 +++++++++++++--------- system/database/drivers/sqlsrv/sqlsrv_forge.php | 20 ++-- system/database/drivers/sqlsrv/sqlsrv_result.php | 24 +++-- system/database/drivers/sqlsrv/sqlsrv_utility.php | 12 ++- 4 files changed, 104 insertions(+), 61 deletions(-) diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index 95ab61b9f..ea9f9483b 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -42,29 +42,30 @@ */ class CI_DB_sqlsrv_driver extends CI_DB { - public $dbdriver = 'sqlsrv'; + var $dbdriver = 'sqlsrv'; // The character used for escaping - protected $_escape_char = ''; + var $_escape_char = ''; // clause and character used for LIKE escape sequences - protected $_like_escape_str = " ESCAPE '%s' "; - protected $_like_escape_chr = '!'; + var $_like_escape_str = " ESCAPE '%s' "; + var $_like_escape_chr = '!'; /** * The syntax to count rows is slightly different across different * database engines, so this string appears in each driver and is - * used for the count_all() and count_all_results() public functions. + * used for the count_all() and count_all_results() functions. */ - protected $_count_string = "SELECT COUNT(*) AS "; - protected $_random_keyword = ' ASC'; // not currently supported + var $_count_string = "SELECT COUNT(*) AS "; + var $_random_keyword = ' ASC'; // not currently supported /** * Non-persistent database connection * + * @access private called by the base class * @return resource */ - protected function db_connect($pooling = false) + function db_connect($pooling = false) { // Check for a UTF-8 charset being passed as CI's default 'utf8'. $character_set = (0 === strcasecmp('utf8', $this->char_set)) ? 'UTF-8' : $this->char_set; @@ -92,9 +93,10 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Persistent database connection * + * @access private called by the base class * @return resource */ - protected function db_pconnect() + function db_pconnect() { return $this->db_connect(TRUE); } @@ -107,9 +109,10 @@ class CI_DB_sqlsrv_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * + * @access public * @return void */ - public function reconnect() + function reconnect() { // not implemented in MSSQL } @@ -143,10 +146,11 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Execute the query * + * @access private called by the base class * @param string an SQL query * @return resource */ - protected function _execute($sql) + function _execute($sql) { return sqlsrv_query($this->conn_id, $sql, null, array( 'Scrollable' => SQLSRV_CURSOR_STATIC, @@ -159,9 +163,10 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Begin Transaction * + * @access public * @return bool */ - public function trans_begin($test_mode = FALSE) + function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -187,9 +192,10 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Commit Transaction * + * @access public * @return bool */ - public function trans_commit() + function trans_commit() { if ( ! $this->trans_enabled) { @@ -210,9 +216,10 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Rollback Transaction * + * @access public * @return bool */ - public function trans_rollback() + function trans_rollback() { if ( ! $this->trans_enabled) { @@ -233,11 +240,12 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Escape String * + * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - public function escape_str($str, $like = FALSE) + function escape_str($str, $like = FALSE) { // Escape single quotes return str_replace("'", "''", $str); @@ -248,9 +256,10 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Affected Rows * + * @access public * @return integer */ - public function affected_rows() + function affected_rows() { return @sqlrv_rows_affected($this->conn_id); } @@ -262,9 +271,10 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Returns the last id created in the Identity column. * + * @access public * @return integer */ - public function insert_id() + function insert_id() { return $this->query('select @@IDENTITY as insert_id')->row('insert_id'); } @@ -277,10 +287,11 @@ class CI_DB_sqlsrv_driver extends CI_DB { * Grabs the major version number from the * database server version string passed in. * + * @access private * @param string $version * @return int16 major version number */ - protected function _parse_major_version($version) + function _parse_major_version($version) { preg_match('/([0-9]+)\.([0-9]+)\.([0-9]+)/', $version, $ver_info); return $ver_info[1]; // return the major version b/c that's all we're interested in. @@ -316,10 +327,11 @@ class CI_DB_sqlsrv_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * + * @access public * @param string * @return string */ - public function count_all($table = '') + function count_all($table = '') { if ($table == '') return '0'; @@ -341,10 +353,11 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * + * @access private * @param boolean * @return string */ - protected function _list_tables($prefix_limit = FALSE) + function _list_tables($prefix_limit = FALSE) { return "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name"; } @@ -356,10 +369,11 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * + * @access private * @param string the table name * @return string */ - protected function _list_columns($table = '') + function _list_columns($table = '') { return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$this->_escape_table($table)."'"; } @@ -371,10 +385,11 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * + * @access public * @param string the table name * @return object */ - public function _field_data($table) + function _field_data($table) { return "SELECT TOP 1 * FROM " . $this->_escape_table($table); } @@ -422,44 +437,46 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Escape Table Name * - * This public function adds backticks if the table name has a period + * This function adds backticks if the table name has a period * in it. Some DBs will get cranky unless periods are escaped * + * @access private * @param string the table name * @return string */ - protected function _escape_table($table) + function _escape_table($table) { return $table; - } - - // -------------------------------------------------------------------------- + } + /** * Escape the SQL Identifiers * - * This public function escapes column and table names + * This function escapes column and table names * + * @access private * @param string * @return string */ - protected function _escape_identifiers($item) + function _escape_identifiers($item) { return $item; } - // -------------------------------------------------------------------------- + // -------------------------------------------------------------------- /** * From Tables * - * This public function implicitly groups FROM tables so there is no confusion + * This function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @param string the table name - * @return string + * @access public + * @param type + * @return type */ - public function _from_tables($tables) + function _from_tables($tables) { if ( ! is_array($tables)) { @@ -476,12 +493,13 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * + * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - public function _insert($table, $keys, $values) + function _insert($table, $keys, $values) { return "INSERT INTO ".$this->_escape_table($table)." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } @@ -493,6 +511,7 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * + * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -500,7 +519,7 @@ class CI_DB_sqlsrv_driver extends CI_DB { * @param array the limit clause * @return string */ - public function _update($table, $values, $where) + function _update($table, $values, $where) { foreach($values as $key => $val) { @@ -517,12 +536,13 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific truncate string from the supplied data * If the database does not support the truncate() command - * This public function maps to "DELETE FROM table" + * This function maps to "DELETE FROM table" * + * @access public * @param string the table name * @return string */ - public function _truncate($table) + function _truncate($table) { return "TRUNCATE ".$table; } @@ -534,12 +554,13 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * + * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - public function _delete($table, $where) + function _delete($table, $where) { return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where); } @@ -551,12 +572,13 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * + * @access public * @param string the sql query string * @param integer the number of rows to limit the query to * @param integer the offset value * @return string */ - public function _limit($sql, $limit, $offset) + function _limit($sql, $limit, $offset) { $i = $limit + $offset; @@ -568,15 +590,18 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Close DB Connection * + * @access public * @param resource * @return void */ - public function _close($conn_id) + function _close($conn_id) { @sqlsrv_close($conn_id); } } + + /* End of file mssql_driver.php */ -/* Location: ./system/database/drivers/mssql/mssql_driver.php */ \ No newline at end of file +/* Location: ./system/database/drivers/mssql/mssql_driver.php */ diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php index 645274232..cd061dd23 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_forge.php +++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php @@ -39,10 +39,11 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { /** * Create database * + * @access private * @param string the database name * @return bool */ - protected function _create_database($name) + function _create_database($name) { return "CREATE DATABASE ".$name; } @@ -52,10 +53,11 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { /** * Drop database * + * @access private * @param string the database name * @return bool */ - protected function _drop_database($name) + function _drop_database($name) { return "DROP DATABASE ".$name; } @@ -65,9 +67,10 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { /** * Drop Table * + * @access private * @return bool */ - protected function _drop_table($table) + function _drop_table($table) { return "DROP TABLE ".$this->db->_escape_identifiers($table); } @@ -77,6 +80,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { /** * Create Table * + * @access private * @param string the table name * @param array the fields * @param mixed primary key(s) @@ -84,7 +88,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -186,6 +190,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * + * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name @@ -195,7 +200,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -237,11 +242,12 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * + * @access private * @param string the old table name * @param string the new table name * @return string */ - protected function _rename_table($table_name, $new_table_name) + function _rename_table($table_name, $new_table_name) { // I think this syntax will work, but can find little documentation on renaming tables in MSSQL return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); @@ -250,4 +256,4 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { } /* End of file sqlsrv_forge.php */ -/* Location: ./system/database/drivers/sqlsrv/sqlsrv_forge.php */ \ No newline at end of file +/* Location: ./system/database/drivers/sqlsrv/sqlsrv_forge.php */ diff --git a/system/database/drivers/sqlsrv/sqlsrv_result.php b/system/database/drivers/sqlsrv/sqlsrv_result.php index 095e3440a..52d338a30 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_result.php +++ b/system/database/drivers/sqlsrv/sqlsrv_result.php @@ -41,9 +41,10 @@ class CI_DB_sqlsrv_result extends CI_DB_result { /** * Number of rows in the result set * + * @access public * @return integer */ - public function num_rows() + function num_rows() { return @sqlsrv_num_rows($this->result_id); } @@ -53,9 +54,10 @@ class CI_DB_sqlsrv_result extends CI_DB_result { /** * Number of fields in the result set * + * @access public * @return integer */ - pubilc function num_fields() + function num_fields() { return @sqlsrv_num_fields($this->result_id); } @@ -67,9 +69,10 @@ class CI_DB_sqlsrv_result extends CI_DB_result { * * Generates an array of column names * + * @access public * @return array */ - public function list_fields() + function list_fields() { $field_names = array(); foreach(sqlsrv_field_metadata($this->result_id) as $offset => $field) @@ -87,9 +90,10 @@ class CI_DB_sqlsrv_result extends CI_DB_result { * * Generates an array of objects containing field meta-data * + * @access public * @return array */ - public function field_data() + function field_data() { $retval = array(); foreach(sqlsrv_field_metadata($this->result_id) as $offset => $field) @@ -114,7 +118,7 @@ class CI_DB_sqlsrv_result extends CI_DB_result { * * @return null */ - public function free_result() + function free_result() { if (is_resource($this->result_id)) { @@ -132,9 +136,10 @@ class CI_DB_sqlsrv_result extends CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero * + * @access private * @return array */ - protected function _data_seek($n = 0) + function _data_seek($n = 0) { // Not implemented } @@ -146,9 +151,10 @@ class CI_DB_sqlsrv_result extends CI_DB_result { * * Returns the result set as an array * + * @access private * @return array */ - protected function _fetch_assoc() + function _fetch_assoc() { return sqlsrv_fetch_array($this->result_id, SQLSRV_FETCH_ASSOC); } @@ -160,14 +166,16 @@ class CI_DB_sqlsrv_result extends CI_DB_result { * * Returns the result set as an object * + * @access private * @return object */ - protected function _fetch_object() + function _fetch_object() { return sqlsrv_fetch_object($this->result_id); } } + /* End of file mssql_result.php */ /* Location: ./system/database/drivers/mssql/mssql_result.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlsrv/sqlsrv_utility.php b/system/database/drivers/sqlsrv/sqlsrv_utility.php index 9e9dde32e..44e6fafeb 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_utility.php +++ b/system/database/drivers/sqlsrv/sqlsrv_utility.php @@ -39,9 +39,10 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility { /** * List databases * + * @access private * @return bool */ - protected function _list_databases() + function _list_databases() { return "EXEC sp_helpdb"; // Can also be: EXEC sp_databases } @@ -53,10 +54,11 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be optimized * + * @access private * @param string the table name * @return object */ - protected function _optimize_table($table) + function _optimize_table($table) { return FALSE; // Is this supported in MS SQL? } @@ -68,10 +70,11 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be repaired * + * @access private * @param string the table name * @return object */ - protected function _repair_table($table) + function _repair_table($table) { return FALSE; // Is this supported in MS SQL? } @@ -81,10 +84,11 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility { /** * MSSQL Export * + * @access private * @param array Preferences * @return mixed */ - protected function _backup($params = array()) + function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); -- cgit v1.2.3-24-g4f1b From 691a8e747dc3b9a277488b133a5a02914ff210eb Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 19:06:00 -0400 Subject: Revert "SQlite visibility declarations" This reverts commit 1ed5995be34f499aec8cd7b6d4d525a33017fd94. --- system/database/drivers/sqlite/sqlite_driver.php | 94 +++++++++++++++-------- system/database/drivers/sqlite/sqlite_forge.php | 19 +++-- system/database/drivers/sqlite/sqlite_result.php | 25 ++++-- system/database/drivers/sqlite/sqlite_utility.php | 2 +- 4 files changed, 90 insertions(+), 50 deletions(-) diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 6535d2753..1870e73b7 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -42,29 +42,30 @@ */ class CI_DB_sqlite_driver extends CI_DB { - public $dbdriver = 'sqlite'; + var $dbdriver = 'sqlite'; // The character used to escape with - not needed for SQLite - protected $_escape_char = ''; + var $_escape_char = ''; // clause and character used for LIKE escape sequences - protected $_like_escape_str = " ESCAPE '%s' "; - protected $_like_escape_chr = '!'; + var $_like_escape_str = " ESCAPE '%s' "; + var $_like_escape_chr = '!'; /** * The syntax to count rows is slightly different across different * database engines, so this string appears in each driver and is - * used for the count_all() and count_all_results() public functions. + * used for the count_all() and count_all_results() functions. */ - protected $_count_string = "SELECT COUNT(*) AS "; - protected $_random_keyword = ' Random()'; // database specific random keyword + var $_count_string = "SELECT COUNT(*) AS "; + var $_random_keyword = ' Random()'; // database specific random keyword /** * Non-persistent database connection * + * @access private called by the base class * @return resource */ - protected function db_connect() + function db_connect() { if ( ! $conn_id = @sqlite_open($this->database, FILE_WRITE_MODE, $error)) { @@ -86,9 +87,10 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Persistent database connection * + * @access private called by the base class * @return resource */ - protected function db_pconnect() + function db_pconnect() { if ( ! $conn_id = @sqlite_popen($this->database, FILE_WRITE_MODE, $error)) { @@ -113,9 +115,10 @@ class CI_DB_sqlite_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * + * @access public * @return void */ - public function reconnect() + function reconnect() { // not implemented in SQLite } @@ -125,9 +128,10 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Select the database * + * @access private called by the base class * @return resource */ - protected function db_select() + function db_select() { return TRUE; } @@ -151,10 +155,11 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Execute the query * + * @access private called by the base class * @param string an SQL query * @return resource */ - protected function _execute($sql) + function _execute($sql) { return @sqlite_query($this->conn_id, $sql); } @@ -164,9 +169,10 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Begin Transaction * + * @access public * @return bool */ - public function trans_begin($test_mode = FALSE) + function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -193,9 +199,10 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Commit Transaction * + * @access public * @return bool */ - public function trans_commit() + function trans_commit() { if ( ! $this->trans_enabled) { @@ -217,9 +224,10 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Rollback Transaction * + * @access public * @return bool */ - public function trans_rollback() + function trans_rollback() { if ( ! $this->trans_enabled) { @@ -241,11 +249,12 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Escape String * + * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - public function escape_str($str, $like = FALSE) + function escape_str($str, $like = FALSE) { if (is_array($str)) { @@ -275,9 +284,10 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Affected Rows * + * @access public * @return integer */ - public function affected_rows() + function affected_rows() { return sqlite_changes($this->conn_id); } @@ -287,9 +297,10 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Insert ID * + * @access public * @return integer */ - public function insert_id() + function insert_id() { return @sqlite_last_insert_rowid($this->conn_id); } @@ -302,10 +313,11 @@ class CI_DB_sqlite_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * + * @access public * @param string * @return string */ - public function count_all($table = '') + function count_all($table = '') { if ($table == '') { @@ -330,10 +342,11 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * + * @access private * @param boolean * @return string */ - protected function _list_tables($prefix_limit = FALSE) + function _list_tables($prefix_limit = FALSE) { $sql = "SELECT name from sqlite_master WHERE type='table'"; @@ -351,10 +364,11 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * + * @access public * @param string the table name * @return string */ - public function _list_columns($table = '') + function _list_columns($table = '') { // Not supported return FALSE; @@ -367,10 +381,11 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * + * @access public * @param string the table name * @return object */ - public function _field_data($table) + function _field_data($table) { return "SELECT * FROM ".$table." LIMIT 1"; } @@ -397,12 +412,13 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Escape the SQL Identifiers * - * This public function escapes column and table names + * This function escapes column and table names * + * @access private * @param string * @return string */ - protected function _escape_identifiers($item) + function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -438,13 +454,14 @@ class CI_DB_sqlite_driver extends CI_DB { /** * From Tables * - * This public function implicitly groups FROM tables so there is no confusion + * This function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * + * @access public * @param type * @return type */ - public function _from_tables($tables) + function _from_tables($tables) { if ( ! is_array($tables)) { @@ -461,12 +478,13 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * + * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - public function _insert($table, $keys, $values) + function _insert($table, $keys, $values) { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } @@ -478,6 +496,7 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * + * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -485,7 +504,7 @@ class CI_DB_sqlite_driver extends CI_DB { * @param array the limit clause * @return string */ - public function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -513,12 +532,13 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific truncate string from the supplied data * If the database does not support the truncate() command - * This public function maps to "DELETE FROM table" + * This function maps to "DELETE FROM table" * + * @access public * @param string the table name * @return string */ - public function _truncate($table) + function _truncate($table) { return $this->_delete($table); } @@ -530,12 +550,13 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * + * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - public function _delete($table, $where = array(), $like = array(), $limit = FALSE) + function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -563,12 +584,13 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * + * @access public * @param string the sql query string * @param integer the number of rows to limit the query to * @param integer the offset value * @return string */ - public function _limit($sql, $limit, $offset) + function _limit($sql, $limit, $offset) { if ($offset == 0) { @@ -587,14 +609,18 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Close DB Connection * + * @access public * @param resource * @return void */ - public function _close($conn_id) + function _close($conn_id) { @sqlite_close($conn_id); } + + } + /* End of file sqlite_driver.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */ \ No newline at end of file +/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */ diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php index 595d41968..7fc531463 100644 --- a/system/database/drivers/sqlite/sqlite_forge.php +++ b/system/database/drivers/sqlite/sqlite_forge.php @@ -43,7 +43,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * @param string the database name * @return bool */ - public function _create_database() + function _create_database() { // In SQLite, a database is created when you connect to the database. // We'll return TRUE so that an error isn't generated @@ -55,10 +55,11 @@ class CI_DB_sqlite_forge extends CI_DB_forge { /** * Drop database * + * @access private * @param string the database name * @return bool */ - protected function _drop_database($name) + function _drop_database($name) { if ( ! @file_exists($this->db->database) OR ! @unlink($this->db->database)) { @@ -75,6 +76,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { /** * Create Table * + * @access private * @param string the table name * @param array the fields * @param mixed primary key(s) @@ -82,7 +84,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -184,9 +186,10 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * * Unsupported feature in SQLite * + * @access private * @return bool */ - protected function _drop_table($table) + function _drop_table($table) { if ($this->db->db_debug) { @@ -203,6 +206,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * + * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name @@ -212,7 +216,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -257,11 +261,12 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * + * @access private * @param string the old table name * @param string the new table name * @return string */ - protected function _rename_table($table_name, $new_table_name) + function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } @@ -269,4 +274,4 @@ class CI_DB_sqlite_forge extends CI_DB_forge { } /* End of file sqlite_forge.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_forge.php */ \ No newline at end of file +/* Location: ./system/database/drivers/sqlite/sqlite_forge.php */ diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php index beb4db6cd..ac2235cbc 100644 --- a/system/database/drivers/sqlite/sqlite_result.php +++ b/system/database/drivers/sqlite/sqlite_result.php @@ -41,9 +41,10 @@ class CI_DB_sqlite_result extends CI_DB_result { /** * Number of rows in the result set * + * @access public * @return integer */ - public function num_rows() + function num_rows() { return @sqlite_num_rows($this->result_id); } @@ -53,9 +54,10 @@ class CI_DB_sqlite_result extends CI_DB_result { /** * Number of fields in the result set * + * @access public * @return integer */ - public function num_fields() + function num_fields() { return @sqlite_num_fields($this->result_id); } @@ -67,9 +69,10 @@ class CI_DB_sqlite_result extends CI_DB_result { * * Generates an array of column names * + * @access public * @return array */ - public function list_fields() + function list_fields() { $field_names = array(); for ($i = 0; $i < $this->num_fields(); $i++) @@ -87,9 +90,10 @@ class CI_DB_sqlite_result extends CI_DB_result { * * Generates an array of objects containing field meta-data * + * @access public * @return array */ - public function field_data() + function field_data() { $retval = array(); for ($i = 0; $i < $this->num_fields(); $i++) @@ -114,7 +118,7 @@ class CI_DB_sqlite_result extends CI_DB_result { * * @return null */ - public function free_result() + function free_result() { // Not implemented in SQLite } @@ -128,9 +132,10 @@ class CI_DB_sqlite_result extends CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero * + * @access private * @return array */ - protected function _data_seek($n = 0) + function _data_seek($n = 0) { return sqlite_seek($this->result_id, $n); } @@ -142,9 +147,10 @@ class CI_DB_sqlite_result extends CI_DB_result { * * Returns the result set as an array * + * @access private * @return array */ - protected function _fetch_assoc() + function _fetch_assoc() { return sqlite_fetch_array($this->result_id); } @@ -156,9 +162,10 @@ class CI_DB_sqlite_result extends CI_DB_result { * * Returns the result set as an object * + * @access private * @return object */ - protected function _fetch_object() + function _fetch_object() { if (function_exists('sqlite_fetch_object')) { @@ -176,7 +183,9 @@ class CI_DB_sqlite_result extends CI_DB_result { } } } + } + /* End of file sqlite_result.php */ /* Location: ./system/database/drivers/sqlite/sqlite_result.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php index c07004c54..9f9ddca44 100644 --- a/system/database/drivers/sqlite/sqlite_utility.php +++ b/system/database/drivers/sqlite/sqlite_utility.php @@ -94,4 +94,4 @@ class CI_DB_sqlite_utility extends CI_DB_utility { } /* End of file sqlite_utility.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_utility.php */ \ No newline at end of file +/* Location: ./system/database/drivers/sqlite/sqlite_utility.php */ -- cgit v1.2.3-24-g4f1b From 99c02ef1dfbdfb444e3effb58906c4369f17b20e Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 19:06:16 -0400 Subject: Revert "Postgre visibility declarations" This reverts commit 7a3f89716a5ea3fc00e69342f8c9c7de77ca99ce. --- system/database/drivers/postgre/postgre_driver.php | 83 ++++++++++++++-------- system/database/drivers/postgre/postgre_forge.php | 24 ++++--- system/database/drivers/postgre/postgre_result.php | 25 ++++--- .../database/drivers/postgre/postgre_utility.php | 4 +- 4 files changed, 86 insertions(+), 50 deletions(-) diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 6ef83726a..fad9539ff 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -42,28 +42,29 @@ */ class CI_DB_postgre_driver extends CI_DB { - public $dbdriver = 'postgre'; + var $dbdriver = 'postgre'; - protected $_escape_char = '"'; + var $_escape_char = '"'; // clause and character used for LIKE escape sequences - protected $_like_escape_str = " ESCAPE '%s' "; - protected $_like_escape_chr = '!'; + var $_like_escape_str = " ESCAPE '%s' "; + var $_like_escape_chr = '!'; /** * The syntax to count rows is slightly different across different * database engines, so this string appears in each driver and is * used for the count_all() and count_all_results() functions. */ - protected $_count_string = "SELECT COUNT(*) AS "; - protected $_random_keyword = ' RANDOM()'; // database specific random keyword + var $_count_string = "SELECT COUNT(*) AS "; + var $_random_keyword = ' RANDOM()'; // database specific random keyword /** * Connection String * + * @access private * @return string */ - protected function _connect_string() + function _connect_string() { $components = array( 'hostname' => 'host', @@ -89,9 +90,10 @@ class CI_DB_postgre_driver extends CI_DB { /** * Non-persistent database connection * + * @access private called by the base class * @return resource */ - protected function db_connect() + function db_connect() { return @pg_connect($this->_connect_string()); } @@ -101,9 +103,10 @@ class CI_DB_postgre_driver extends CI_DB { /** * Persistent database connection * + * @access private called by the base class * @return resource */ - protected function db_pconnect() + function db_pconnect() { return @pg_pconnect($this->_connect_string()); } @@ -116,9 +119,10 @@ class CI_DB_postgre_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * + * @access public * @return void */ - public function reconnect() + function reconnect() { if (pg_ping($this->conn_id) === FALSE) { @@ -131,9 +135,10 @@ class CI_DB_postgre_driver extends CI_DB { /** * Select the database * + * @access private called by the base class * @return resource */ - protected function db_select() + function db_select() { // Not needed for Postgre so we'll return TRUE return TRUE; @@ -186,10 +191,11 @@ class CI_DB_postgre_driver extends CI_DB { /** * Execute the query * + * @access private called by the base class * @param string an SQL query * @return resource */ - protected function _execute($sql) + function _execute($sql) { return @pg_query($this->conn_id, $sql); } @@ -258,11 +264,12 @@ class CI_DB_postgre_driver extends CI_DB { /** * Escape String * + * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - public function escape_str($str, $like = FALSE) + function escape_str($str, $like = FALSE) { if (is_array($str)) { @@ -292,9 +299,10 @@ class CI_DB_postgre_driver extends CI_DB { /** * Affected Rows * + * @access public * @return integer */ - public function affected_rows() + function affected_rows() { return @pg_affected_rows($this->result_id); } @@ -304,9 +312,10 @@ class CI_DB_postgre_driver extends CI_DB { /** * Insert ID * + * @access public * @return integer */ - public function insert_id() + function insert_id() { $v = $this->version(); @@ -346,10 +355,11 @@ class CI_DB_postgre_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * + * @access public * @param string * @return string */ - public function count_all($table = '') + function count_all($table = '') { if ($table == '') { @@ -374,10 +384,11 @@ class CI_DB_postgre_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * + * @access private * @param boolean * @return string */ - protected function _list_tables($prefix_limit = FALSE) + function _list_tables($prefix_limit = FALSE) { $sql = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'"; @@ -396,10 +407,11 @@ class CI_DB_postgre_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * + * @access public * @param string the table name * @return string */ - public function _list_columns($table = '') + function _list_columns($table = '') { return "SELECT column_name FROM information_schema.columns WHERE table_name ='".$table."'"; } @@ -411,10 +423,11 @@ class CI_DB_postgre_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * + * @access public * @param string the table name * @return object */ - public function _field_data($table) + function _field_data($table) { return "SELECT * FROM ".$table." LIMIT 1"; } @@ -441,10 +454,11 @@ class CI_DB_postgre_driver extends CI_DB { * * This function escapes column and table names * + * @access private * @param string * @return string */ - protected function _escape_identifiers($item) + function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -483,10 +497,11 @@ class CI_DB_postgre_driver extends CI_DB { * This function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * + * @access public * @param type * @return type */ - public function _from_tables($tables) + function _from_tables($tables) { if ( ! is_array($tables)) { @@ -503,12 +518,13 @@ class CI_DB_postgre_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * + * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - public function _insert($table, $keys, $values) + function _insert($table, $keys, $values) { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } @@ -520,12 +536,13 @@ class CI_DB_postgre_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * + * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - public function _insert_batch($table, $keys, $values) + function _insert_batch($table, $keys, $values) { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values); } @@ -537,6 +554,7 @@ class CI_DB_postgre_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * + * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -544,7 +562,7 @@ class CI_DB_postgre_driver extends CI_DB { * @param array the limit clause * @return string */ - public function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -567,10 +585,11 @@ class CI_DB_postgre_driver extends CI_DB { * If the database does not support the truncate() command * This function maps to "DELETE FROM table" * + * @access public * @param string the table name * @return string */ - public function _truncate($table) + function _truncate($table) { return "TRUNCATE ".$table; } @@ -582,12 +601,13 @@ class CI_DB_postgre_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * + * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - public function _delete($table, $where = array(), $like = array(), $limit = FALSE) + function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -612,12 +632,13 @@ class CI_DB_postgre_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * + * @access public * @param string the sql query string * @param integer the number of rows to limit the query to * @param integer the offset value * @return string */ - public function _limit($sql, $limit, $offset) + function _limit($sql, $limit, $offset) { $sql .= "LIMIT ".$limit; @@ -634,14 +655,18 @@ class CI_DB_postgre_driver extends CI_DB { /** * Close DB Connection * + * @access public * @param resource * @return void */ - public function _close($conn_id) + function _close($conn_id) { @pg_close($conn_id); } + + } + /* End of file postgre_driver.php */ -/* Location: ./system/database/drivers/postgre/postgre_driver.php */ \ No newline at end of file +/* Location: ./system/database/drivers/postgre/postgre_driver.php */ diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php index 2aa6ee82a..577100544 100644 --- a/system/database/drivers/postgre/postgre_forge.php +++ b/system/database/drivers/postgre/postgre_forge.php @@ -39,10 +39,11 @@ class CI_DB_postgre_forge extends CI_DB_forge { /** * Create database * + * @access private * @param string the database name * @return bool */ - protected function _create_database($name) + function _create_database($name) { return "CREATE DATABASE ".$name; } @@ -52,10 +53,11 @@ class CI_DB_postgre_forge extends CI_DB_forge { /** * Drop database * + * @access private * @param string the database name * @return bool */ - protected function _drop_database($name) + function _drop_database($name) { return "DROP DATABASE ".$name; } @@ -68,7 +70,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param mixed the fields * @return string */ - protected function _process_fields($fields, $primary_keys=array()) + function _process_fields($fields, $primary_keys=array()) { $sql = ''; $current_field_count = 0; @@ -175,6 +177,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { /** * Create Table * + * @access private * @param string the table name * @param array the fields * @param mixed primary key(s) @@ -182,7 +185,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -238,11 +241,8 @@ class CI_DB_postgre_forge extends CI_DB_forge { /** * Drop Table - * - * @param string the table name - * @return string */ - protected function _drop_table($table) + function _drop_table($table) { return "DROP TABLE IF EXISTS ".$this->db->_escape_identifiers($table)." CASCADE"; } @@ -255,6 +255,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * + * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name @@ -264,7 +265,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - protected function _alter_table($alter_type, $table, $fields, $after_field = '') + function _alter_table($alter_type, $table, $fields, $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '; @@ -291,15 +292,16 @@ class CI_DB_postgre_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * + * @access private * @param string the old table name * @param string the new table name * @return string */ - protected function _rename_table($table_name, $new_table_name) + function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } } /* End of file postgre_forge.php */ -/* Location: ./system/database/drivers/postgre/postgre_forge.php */ \ No newline at end of file +/* Location: ./system/database/drivers/postgre/postgre_forge.php */ diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php index b27afaedb..12d7547c5 100644 --- a/system/database/drivers/postgre/postgre_result.php +++ b/system/database/drivers/postgre/postgre_result.php @@ -41,9 +41,10 @@ class CI_DB_postgre_result extends CI_DB_result { /** * Number of rows in the result set * + * @access public * @return integer */ - public function num_rows() + function num_rows() { return @pg_num_rows($this->result_id); } @@ -53,9 +54,10 @@ class CI_DB_postgre_result extends CI_DB_result { /** * Number of fields in the result set * + * @access public * @return integer */ - public function num_fields() + function num_fields() { return @pg_num_fields($this->result_id); } @@ -67,9 +69,10 @@ class CI_DB_postgre_result extends CI_DB_result { * * Generates an array of column names * + * @access public * @return array */ - public function list_fields() + function list_fields() { $field_names = array(); for ($i = 0; $i < $this->num_fields(); $i++) @@ -87,9 +90,10 @@ class CI_DB_postgre_result extends CI_DB_result { * * Generates an array of objects containing field meta-data * + * @access public * @return array */ - public function field_data() + function field_data() { $retval = array(); for ($i = 0; $i < $this->num_fields(); $i++) @@ -114,7 +118,7 @@ class CI_DB_postgre_result extends CI_DB_result { * * @return null */ - public function free_result() + function free_result() { if (is_resource($this->result_id)) { @@ -132,9 +136,10 @@ class CI_DB_postgre_result extends CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero * + * @access private * @return array */ - protected function _data_seek($n = 0) + function _data_seek($n = 0) { return pg_result_seek($this->result_id, $n); } @@ -146,9 +151,10 @@ class CI_DB_postgre_result extends CI_DB_result { * * Returns the result set as an array * + * @access private * @return array */ - protected function _fetch_assoc() + function _fetch_assoc() { return pg_fetch_assoc($this->result_id); } @@ -160,13 +166,16 @@ class CI_DB_postgre_result extends CI_DB_result { * * Returns the result set as an object * + * @access private * @return object */ - protected function _fetch_object() + function _fetch_object() { return pg_fetch_object($this->result_id); } + } + /* End of file postgre_result.php */ /* Location: ./system/database/drivers/postgre/postgre_result.php */ \ No newline at end of file diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php index cf29201ff..e31a6db8f 100644 --- a/system/database/drivers/postgre/postgre_utility.php +++ b/system/database/drivers/postgre/postgre_utility.php @@ -78,7 +78,7 @@ class CI_DB_postgre_utility extends CI_DB_utility { * @param array Preferences * @return mixed */ - public function _backup($params = array()) + function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); @@ -86,4 +86,4 @@ class CI_DB_postgre_utility extends CI_DB_utility { } /* End of file postgre_utility.php */ -/* Location: ./system/database/drivers/postgre/postgre_utility.php */ \ No newline at end of file +/* Location: ./system/database/drivers/postgre/postgre_utility.php */ -- cgit v1.2.3-24-g4f1b From 667c9feadee8ef5ea8c1859e7c79c2d116469051 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 19:06:34 -0400 Subject: Revert "PDO driver access modifiers" This reverts commit 8c332e7f907e6af498f18fa1bf28e0a0c6e11448. --- system/database/drivers/pdo/pdo_driver.php | 124 +++++++++++++++++----------- system/database/drivers/pdo/pdo_result.php | 25 ++++-- system/database/drivers/pdo/pdo_utility.php | 12 ++- 3 files changed, 98 insertions(+), 63 deletions(-) diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 727f097f8..658a3d5a0 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -42,31 +42,28 @@ */ class CI_DB_pdo_driver extends CI_DB { - public $dbdriver = 'pdo'; + var $dbdriver = 'pdo'; // the character used to excape - not necessary for PDO - protected $_escape_char = ''; + var $_escape_char = ''; // clause and character used for LIKE escape sequences - protected $_like_escape_str; - protected $_like_escape_chr; + var $_like_escape_str; + var $_like_escape_chr; /** * The syntax to count rows is slightly different across different * database engines, so this string appears in each driver and is - * used for the count_all() and count_all_results() public functions. + * used for the count_all() and count_all_results() functions. */ - protected $_count_string = "SELECT COUNT(*) AS "; - protected $_random_keyword; + var $_count_string = "SELECT COUNT(*) AS "; + var $_random_keyword; // need to track the pdo driver and options - protected $pdodriver; - protected $options = array(); + var $pdodriver; + var $options = array(); - /** - * Pre-connection setup - */ - public function __construct($params) + function __construct($params) { parent::__construct($params); @@ -107,10 +104,11 @@ class CI_DB_pdo_driver extends CI_DB { /** * Connection String * + * @access private * @param array * @return void */ - protected function _connect_string($params) + function _connect_string($params) { if (strpos($this->hostname, ':')) { @@ -192,9 +190,10 @@ class CI_DB_pdo_driver extends CI_DB { /** * Non-persistent database connection * + * @access private called by the base class * @return resource */ - protected function db_connect() + function db_connect() { $this->options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_SILENT; @@ -206,9 +205,10 @@ class CI_DB_pdo_driver extends CI_DB { /** * Persistent database connection * + * @access private called by the base class * @return resource */ - protected function db_pconnect() + function db_pconnect() { $this->options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_SILENT; $this->options[PDO::ATTR_PERSISTENT] = TRUE; @@ -221,9 +221,10 @@ class CI_DB_pdo_driver extends CI_DB { /** * PDO connection * + * @access private called by the PDO driver class * @return resource */ - protected function pdo_connect() + function pdo_connect() { // Refer : http://php.net/manual/en/ref.pdo-mysql.connection.php if ($this->pdodriver == 'mysql' && is_php('5.3.6')) @@ -257,9 +258,10 @@ class CI_DB_pdo_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * + * @access public * @return void */ - public function reconnect() + function reconnect() { if ($this->db->db_debug) { @@ -274,9 +276,10 @@ class CI_DB_pdo_driver extends CI_DB { /** * Select the database * + * @access private called by the base class * @return resource */ - protected function db_select() + function db_select() { // Not needed for PDO return TRUE; @@ -301,10 +304,11 @@ class CI_DB_pdo_driver extends CI_DB { /** * Execute the query * + * @access private called by the base class * @param string an SQL query * @return object */ - protected function _execute($sql) + function _execute($sql) { $sql = $this->_prep_query($sql); @@ -329,10 +333,11 @@ class CI_DB_pdo_driver extends CI_DB { * * If needed, each database adapter can prep the query string * + * @access private called by execute() * @param string an SQL query * @return string */ - protected function _prep_query($sql) + function _prep_query($sql) { if ($this->pdodriver === 'pgsql') { @@ -342,7 +347,7 @@ class CI_DB_pdo_driver extends CI_DB { elseif ($this->pdodriver === 'sqlite') { // Change the backtick(s) for SQLite - $sql = str_replace('`', '"', $sql); + $sql = str_replace('`', '', $sql); } return $sql; @@ -353,9 +358,10 @@ class CI_DB_pdo_driver extends CI_DB { /** * Begin Transaction * + * @access public * @return bool */ - public function trans_begin($test_mode = FALSE) + function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -381,9 +387,10 @@ class CI_DB_pdo_driver extends CI_DB { /** * Commit Transaction * + * @access public * @return bool */ - public function trans_commit() + function trans_commit() { if ( ! $this->trans_enabled) { @@ -406,9 +413,10 @@ class CI_DB_pdo_driver extends CI_DB { /** * Rollback Transaction * + * @access public * @return bool */ - public function trans_rollback() + function trans_rollback() { if ( ! $this->trans_enabled) { @@ -431,11 +439,12 @@ class CI_DB_pdo_driver extends CI_DB { /** * Escape String * + * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - public function escape_str($str, $like = FALSE) + function escape_str($str, $like = FALSE) { if (is_array($str)) { @@ -474,9 +483,10 @@ class CI_DB_pdo_driver extends CI_DB { /** * Affected Rows * + * @access public * @return integer */ - public function affected_rows() + function affected_rows() { return $this->affect_rows; } @@ -508,10 +518,11 @@ class CI_DB_pdo_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * + * @access public * @param string * @return string */ - public function count_all($table = '') + function count_all($table = '') { if ($table == '') { @@ -539,19 +550,20 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * + * @access private * @param boolean * @return string */ - protected function _list_tables($prefix_limit = FALSE) + function _list_tables($prefix_limit = FALSE) { if ($this->pdodriver == 'pgsql') { - // Analog public function to show all tables in postgre + // Analog function to show all tables in postgre $sql = "SELECT * FROM information_schema.tables WHERE table_schema = 'public'"; } elseif ($this->pdodriver == 'sqlite') { - // Analog public function to show all tables in sqlite + // Analog function to show all tables in sqlite $sql = "SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'"; } else @@ -574,10 +586,11 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * + * @access public * @param string the table name * @return string */ - public function _list_columns($table = '') + function _list_columns($table = '') { return 'SHOW COLUMNS FROM '.$this->_from_tables($table); } @@ -589,24 +602,25 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * + * @access public * @param string the table name * @return object */ - public function _field_data($table) + function _field_data($table) { if ($this->pdodriver == 'mysql' or $this->pdodriver == 'pgsql') { - // Analog public function for mysql and postgre + // Analog function for mysql and postgre return 'SELECT * FROM '.$this->_from_tables($table).' LIMIT 1'; } elseif ($this->pdodriver == 'oci') { - // Analog public function for oci + // Analog function for oci return 'SELECT * FROM '.$this->_from_tables($table).' WHERE ROWNUM <= 1'; } elseif ($this->pdodriver == 'sqlite') { - // Analog public function for sqlite + // Analog function for sqlite return 'PRAGMA table_info('.$this->_from_tables($table).')'; } @@ -647,12 +661,13 @@ class CI_DB_pdo_driver extends CI_DB { /** * Escape the SQL Identifiers * - * This public function escapes column and table names + * This function escapes column and table names * + * @access private * @param string * @return string */ - protected function _escape_identifiers($item) + function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -689,13 +704,14 @@ class CI_DB_pdo_driver extends CI_DB { /** * From Tables * - * This public function implicitly groups FROM tables so there is no confusion + * This function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * + * @access public * @param type * @return type */ - public function _from_tables($tables) + function _from_tables($tables) { if ( ! is_array($tables)) { @@ -712,12 +728,13 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * + * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - public function _insert($table, $keys, $values) + function _insert($table, $keys, $values) { return 'INSERT INTO '.$this->_from_tables($table).' ('.implode(', ', $keys).') VALUES ('.implode(', ', $values).')'; } @@ -729,12 +746,13 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * + * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - public function _insert_batch($table, $keys, $values) + function _insert_batch($table, $keys, $values) { return 'INSERT INTO '.$this->_from_tables($table).' ('.implode(', ', $keys).') VALUES '.implode(', ', $values); } @@ -746,6 +764,7 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * + * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -753,7 +772,7 @@ class CI_DB_pdo_driver extends CI_DB { * @param array the limit clause * @return string */ - public function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -777,12 +796,13 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific batch update string from the supplied data * + * @access public * @param string the table name * @param array the update data * @param array the where clause * @return string */ - public function _update_batch($table, $values, $index, $where = NULL) + function _update_batch($table, $values, $index, $where = NULL) { $ids = array(); $where = ($where != '' && count($where) >=1) ? implode(" ", $where).' AND ' : ''; @@ -829,12 +849,13 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific truncate string from the supplied data * If the database does not support the truncate() command - * This public function maps to "DELETE FROM table" + * This function maps to "DELETE FROM table" * + * @access public * @param string the table name * @return string */ - public function _truncate($table) + function _truncate($table) { return $this->_delete($table); } @@ -846,12 +867,13 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * + * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - public function _delete($table, $where = array(), $like = array(), $limit = FALSE) + function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -880,12 +902,13 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * + * @access public * @param string the sql query string * @param integer the number of rows to limit the query to * @param integer the offset value * @return string */ - public function _limit($sql, $limit, $offset) + function _limit($sql, $limit, $offset) { if ($this->pdodriver == 'cubrid' OR $this->pdodriver == 'sqlite') { @@ -907,10 +930,11 @@ class CI_DB_pdo_driver extends CI_DB { /** * Close DB Connection * + * @access public * @param resource * @return void */ - public function _close($conn_id) + function _close($conn_id) { $this->conn_id = null; } @@ -918,4 +942,4 @@ class CI_DB_pdo_driver extends CI_DB { } /* End of file pdo_driver.php */ -/* Location: ./system/database/drivers/pdo/pdo_driver.php */ \ No newline at end of file +/* Location: ./system/database/drivers/pdo/pdo_driver.php */ diff --git a/system/database/drivers/pdo/pdo_result.php b/system/database/drivers/pdo/pdo_result.php index 330a2e677..384b753da 100644 --- a/system/database/drivers/pdo/pdo_result.php +++ b/system/database/drivers/pdo/pdo_result.php @@ -51,9 +51,10 @@ class CI_DB_pdo_result extends CI_DB_result { /** * Number of rows in the result set * + * @access public * @return integer */ - public function num_rows() + function num_rows() { if (empty($this->result_id) OR ! is_object($this->result_id)) { @@ -73,9 +74,10 @@ class CI_DB_pdo_result extends CI_DB_result { /** * Fetch the result handler * + * @access public * @return mixed */ - public function result_assoc() + function result_assoc() { // If the result already fetched before, use that one if (count($this->result_array) > 0 OR $this->is_fetched) @@ -114,9 +116,10 @@ class CI_DB_pdo_result extends CI_DB_result { /** * Number of fields in the result set * + * @access public * @return integer */ - public function num_fields() + function num_fields() { return $this->result_id->columnCount(); } @@ -128,9 +131,10 @@ class CI_DB_pdo_result extends CI_DB_result { * * Generates an array of column names * + * @access public * @return array */ - public function list_fields() + function list_fields() { if ($this->db->db_debug) { @@ -147,9 +151,10 @@ class CI_DB_pdo_result extends CI_DB_result { * * Generates an array of objects containing field meta-data * + * @access public * @return array */ - public function field_data() + function field_data() { $data = array(); @@ -219,7 +224,7 @@ class CI_DB_pdo_result extends CI_DB_result { * * @return null */ - public function free_result() + function free_result() { if (is_object($this->result_id)) { @@ -236,9 +241,10 @@ class CI_DB_pdo_result extends CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero * + * @access private * @return array */ - protected function _data_seek($n = 0) + function _data_seek($n = 0) { return FALSE; } @@ -250,9 +256,10 @@ class CI_DB_pdo_result extends CI_DB_result { * * Returns the result set as an array * + * @access private * @return array */ - protected function _fetch_assoc() + function _fetch_assoc() { return $this->result_id->fetch(PDO::FETCH_ASSOC); } @@ -267,7 +274,7 @@ class CI_DB_pdo_result extends CI_DB_result { * @access private * @return object */ - protected function _fetch_object() + function _fetch_object() { return $this->result_id->fetchObject(); } diff --git a/system/database/drivers/pdo/pdo_utility.php b/system/database/drivers/pdo/pdo_utility.php index 2c12d7438..c278c5172 100644 --- a/system/database/drivers/pdo/pdo_utility.php +++ b/system/database/drivers/pdo/pdo_utility.php @@ -39,9 +39,10 @@ class CI_DB_pdo_utility extends CI_DB_utility { /** * List databases * + * @access private * @return bool */ - protected function _list_databases() + function _list_databases() { // Not sure if PDO lets you list all databases... if ($this->db->db_debug) @@ -58,10 +59,11 @@ class CI_DB_pdo_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be optimized * + * @access private * @param string the table name * @return object */ - protected function _optimize_table($table) + function _optimize_table($table) { // Not a supported PDO feature if ($this->db->db_debug) @@ -78,10 +80,11 @@ class CI_DB_pdo_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be repaired * + * @access private * @param string the table name * @return object */ - protected function _repair_table($table) + function _repair_table($table) { // Not a supported PDO feature if ($this->db->db_debug) @@ -96,10 +99,11 @@ class CI_DB_pdo_utility extends CI_DB_utility { /** * PDO Export * + * @access private * @param array Preferences * @return mixed */ - protected function _backup($params = array()) + function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); -- cgit v1.2.3-24-g4f1b From 9e560a4c4828901a562f5459157ba0f76612c34f Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 19:06:46 -0400 Subject: Revert "ODBC access modifiers" This reverts commit 142ca8e565b722b758b5ef88c888891d04da8700. --- system/database/drivers/odbc/odbc_driver.php | 96 ++++++++++++++++----------- system/database/drivers/odbc/odbc_forge.php | 20 ++++-- system/database/drivers/odbc/odbc_result.php | 19 ++++-- system/database/drivers/odbc/odbc_utility.php | 12 ++-- 4 files changed, 92 insertions(+), 55 deletions(-) diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index 78acd2ce9..58da07818 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -48,35 +48,32 @@ class CI_DB_odbc_driver extends CI_DB { var $_escape_char = ''; // clause and character used for LIKE escape sequences - protected $_like_escape_str = " {escape '%s'} "; - protected $_like_escape_chr = '!'; + var $_like_escape_str = " {escape '%s'} "; + var $_like_escape_chr = '!'; /** * The syntax to count rows is slightly different across different * database engines, so this string appears in each driver and is - * used for the count_all() and count_all_results() public functions. + * used for the count_all() and count_all_results() functions. */ - protected $_count_string = "SELECT COUNT(*) AS "; - protected $_random_keyword; + var $_count_string = "SELECT COUNT(*) AS "; + var $_random_keyword; - /** - * Constructor, to define random keyword - */ - public function __construct($params) + + function __construct($params) { parent::__construct($params); $this->_random_keyword = ' RND('.time().')'; // database specific random keyword } - - // -------------------------------------------------------------------------- /** * Non-persistent database connection * + * @access private called by the base class * @return resource */ - protected function db_connect() + function db_connect() { return @odbc_connect($this->hostname, $this->username, $this->password); } @@ -86,9 +83,10 @@ class CI_DB_odbc_driver extends CI_DB { /** * Persistent database connection * + * @access private called by the base class * @return resource */ - protected function db_pconnect() + function db_pconnect() { return @odbc_pconnect($this->hostname, $this->username, $this->password); } @@ -101,9 +99,10 @@ class CI_DB_odbc_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * + * @access public * @return void */ - public function reconnect() + function reconnect() { // not implemented in odbc } @@ -113,9 +112,10 @@ class CI_DB_odbc_driver extends CI_DB { /** * Select the database * + * @access private called by the base class * @return resource */ - protected function db_select() + function db_select() { // Not needed for ODBC return TRUE; @@ -126,10 +126,11 @@ class CI_DB_odbc_driver extends CI_DB { /** * Execute the query * + * @access private called by the base class * @param string an SQL query * @return resource */ - protected function _execute($sql) + function _execute($sql) { return @odbc_exec($this->conn_id, $sql); } @@ -139,9 +140,10 @@ class CI_DB_odbc_driver extends CI_DB { /** * Begin Transaction * + * @access public * @return bool */ - public function trans_begin($test_mode = FALSE) + function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -167,9 +169,10 @@ class CI_DB_odbc_driver extends CI_DB { /** * Commit Transaction * + * @access public * @return bool */ - public function trans_commit() + function trans_commit() { if ( ! $this->trans_enabled) { @@ -192,9 +195,10 @@ class CI_DB_odbc_driver extends CI_DB { /** * Rollback Transaction * + * @access public * @return bool */ - public function trans_rollback() + function trans_rollback() { if ( ! $this->trans_enabled) { @@ -217,11 +221,12 @@ class CI_DB_odbc_driver extends CI_DB { /** * Escape String * + * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - public function escape_str($str, $like = FALSE) + function escape_str($str, $like = FALSE) { if (is_array($str)) { @@ -252,9 +257,10 @@ class CI_DB_odbc_driver extends CI_DB { /** * Affected Rows * + * @access public * @return integer */ - public function affected_rows() + function affected_rows() { return @odbc_num_rows($this->conn_id); } @@ -279,10 +285,11 @@ class CI_DB_odbc_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * + * @access public * @param string * @return string */ - public function count_all($table = '') + function count_all($table = '') { if ($table == '') { @@ -308,10 +315,11 @@ class CI_DB_odbc_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * + * @access private * @param boolean * @return string */ - protected function _list_tables($prefix_limit = FALSE) + function _list_tables($prefix_limit = FALSE) { $sql = "SHOW TABLES FROM `".$this->database."`"; @@ -331,10 +339,11 @@ class CI_DB_odbc_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * + * @access public * @param string the table name * @return string */ - public function _list_columns($table = '') + function _list_columns($table = '') { return "SHOW COLUMNS FROM ".$table; } @@ -346,10 +355,11 @@ class CI_DB_odbc_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * + * @access public * @param string the table name * @return object */ - public function _field_data($table) + function _field_data($table) { return "SELECT TOP 1 FROM ".$table; } @@ -374,12 +384,13 @@ class CI_DB_odbc_driver extends CI_DB { /** * Escape the SQL Identifiers * - * This public function escapes column and table names + * This function escapes column and table names * + * @access private * @param string * @return string */ - protected function _escape_identifiers($item) + function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -415,13 +426,14 @@ class CI_DB_odbc_driver extends CI_DB { /** * From Tables * - * This public function implicitly groups FROM tables so there is no confusion + * This function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * + * @access public * @param type * @return type */ - public function _from_tables($tables) + function _from_tables($tables) { if ( ! is_array($tables)) { @@ -438,12 +450,13 @@ class CI_DB_odbc_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * + * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - public function _insert($table, $keys, $values) + function _insert($table, $keys, $values) { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } @@ -455,6 +468,7 @@ class CI_DB_odbc_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * + * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -462,7 +476,7 @@ class CI_DB_odbc_driver extends CI_DB { * @param array the limit clause * @return string */ - public function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -490,12 +504,13 @@ class CI_DB_odbc_driver extends CI_DB { * * Generates a platform-specific truncate string from the supplied data * If the database does not support the truncate() command - * This public function maps to "DELETE FROM table" + * This function maps to "DELETE FROM table" * + * @access public * @param string the table name * @return string */ - public function _truncate($table) + function _truncate($table) { return $this->_delete($table); } @@ -507,12 +522,13 @@ class CI_DB_odbc_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * + * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - public function _delete($table, $where = array(), $like = array(), $limit = FALSE) + function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -540,12 +556,13 @@ class CI_DB_odbc_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * + * @access public * @param string the sql query string * @param integer the number of rows to limit the query to * @param integer the offset value * @return string */ - public function _limit($sql, $limit, $offset) + function _limit($sql, $limit, $offset) { // Does ODBC doesn't use the LIMIT clause? return $sql; @@ -556,14 +573,19 @@ class CI_DB_odbc_driver extends CI_DB { /** * Close DB Connection * + * @access public * @param resource * @return void */ - public function _close($conn_id) + function _close($conn_id) { @odbc_close($conn_id); } + + } + + /* End of file odbc_driver.php */ -/* Location: ./system/database/drivers/odbc/odbc_driver.php */ \ No newline at end of file +/* Location: ./system/database/drivers/odbc/odbc_driver.php */ diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php index 121c09606..acc2cadee 100644 --- a/system/database/drivers/odbc/odbc_forge.php +++ b/system/database/drivers/odbc/odbc_forge.php @@ -39,10 +39,11 @@ class CI_DB_odbc_forge extends CI_DB_forge { /** * Create database * + * @access private * @param string the database name * @return bool */ - protected function _create_database() + function _create_database() { // ODBC has no "create database" command since it's // designed to connect to an existing database @@ -58,10 +59,11 @@ class CI_DB_odbc_forge extends CI_DB_forge { /** * Drop database * + * @access private * @param string the database name * @return bool */ - protected function _drop_database($name) + function _drop_database($name) { // ODBC has no "drop database" command since it's // designed to connect to an existing database @@ -77,6 +79,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { /** * Create Table * + * @access private * @param string the table name * @param array the fields * @param mixed primary key(s) @@ -84,7 +87,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -183,9 +186,10 @@ class CI_DB_odbc_forge extends CI_DB_forge { /** * Drop Table * + * @access private * @return bool */ - protected function _drop_table($table) + function _drop_table($table) { // Not a supported ODBC feature if ($this->db->db_debug) @@ -203,6 +207,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * + * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name @@ -212,7 +217,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -255,11 +260,12 @@ class CI_DB_odbc_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * + * @access private * @param string the old table name * @param string the new table name * @return string */ - protected function _rename_table($table_name, $new_table_name) + function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } @@ -267,4 +273,4 @@ class CI_DB_odbc_forge extends CI_DB_forge { } /* End of file odbc_forge.php */ -/* Location: ./system/database/drivers/odbc/odbc_forge.php */ \ No newline at end of file +/* Location: ./system/database/drivers/odbc/odbc_forge.php */ diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php index 0b74871e0..d19fa247e 100644 --- a/system/database/drivers/odbc/odbc_result.php +++ b/system/database/drivers/odbc/odbc_result.php @@ -130,7 +130,7 @@ class CI_DB_odbc_result extends CI_DB_result { * * @return null */ - public function free_result() + function free_result() { if (is_resource($this->result_id)) { @@ -148,9 +148,10 @@ class CI_DB_odbc_result extends CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero * + * @access private * @return array */ - protected function _data_seek($n = 0) + function _data_seek($n = 0) { return FALSE; } @@ -162,9 +163,10 @@ class CI_DB_odbc_result extends CI_DB_result { * * Returns the result set as an array * + * @access private * @return array */ - protected function _fetch_assoc() + function _fetch_assoc() { if (function_exists('odbc_fetch_object')) { @@ -183,9 +185,10 @@ class CI_DB_odbc_result extends CI_DB_result { * * Returns the result set as an object * + * @access private * @return object */ - protected function _fetch_object() + function _fetch_object() { if (function_exists('odbc_fetch_object')) { @@ -204,9 +207,10 @@ class CI_DB_odbc_result extends CI_DB_result { * subsititutes the odbc_fetch_object function when * not available (odbc_fetch_object requires unixODBC) * + * @access private * @return object */ - protected function _odbc_fetch_object(& $odbc_result) { + function _odbc_fetch_object(& $odbc_result) { $rs = array(); $rs_obj = FALSE; if (odbc_fetch_into($odbc_result, $rs)) { @@ -225,9 +229,10 @@ class CI_DB_odbc_result extends CI_DB_result { * subsititutes the odbc_fetch_array function when * not available (odbc_fetch_array requires unixODBC) * + * @access private * @return array */ - protected function _odbc_fetch_array(& $odbc_result) { + function _odbc_fetch_array(& $odbc_result) { $rs = array(); $rs_assoc = FALSE; if (odbc_fetch_into($odbc_result, $rs)) { @@ -313,4 +318,4 @@ class CI_DB_odbc_result extends CI_DB_result { } /* End of file odbc_result.php */ -/* Location: ./system/database/drivers/odbc/odbc_result.php */ \ No newline at end of file +/* Location: ./system/database/drivers/odbc/odbc_result.php */ diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php index d663da1ad..c146c1785 100644 --- a/system/database/drivers/odbc/odbc_utility.php +++ b/system/database/drivers/odbc/odbc_utility.php @@ -39,9 +39,10 @@ class CI_DB_odbc_utility extends CI_DB_utility { /** * List databases * + * @access private * @return bool */ - protected function _list_databases() + function _list_databases() { // Not sure if ODBC lets you list all databases... if ($this->db->db_debug) @@ -58,10 +59,11 @@ class CI_DB_odbc_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be optimized * + * @access private * @param string the table name * @return object */ - protected function _optimize_table($table) + function _optimize_table($table) { // Not a supported ODBC feature if ($this->db->db_debug) @@ -78,10 +80,11 @@ class CI_DB_odbc_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be repaired * + * @access private * @param string the table name * @return object */ - protected function _repair_table($table) + function _repair_table($table) { // Not a supported ODBC feature if ($this->db->db_debug) @@ -96,10 +99,11 @@ class CI_DB_odbc_utility extends CI_DB_utility { /** * ODBC Export * + * @access private * @param array Preferences * @return mixed */ - protected function _backup($params = array()) + function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); -- cgit v1.2.3-24-g4f1b From 48e1d2e78efea9f41e5ae65b600d35bb87b2e40f Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 19:07:07 -0400 Subject: Revert "Oci8 access modifiers" This reverts commit 9f86f5cddea54e7fedf4be89d1d1cc90d1564488. --- system/database/drivers/oci8/oci8_driver.php | 26 ++++++++++++++------------ system/database/drivers/oci8/oci8_forge.php | 17 +++++++++++------ system/database/drivers/oci8/oci8_result.php | 3 ++- system/database/drivers/oci8/oci8_utility.php | 12 ++++++++---- 4 files changed, 35 insertions(+), 23 deletions(-) diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index e7b744bd3..8d7040618 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -53,33 +53,33 @@ class CI_DB_oci8_driver extends CI_DB { - public $dbdriver = 'oci8'; + var $dbdriver = 'oci8'; // The character used for excaping - public $_escape_char = '"'; + var $_escape_char = '"'; // clause and character used for LIKE escape sequences - public $_like_escape_str = " escape '%s' "; - public $_like_escape_chr = '!'; + var $_like_escape_str = " escape '%s' "; + var $_like_escape_chr = '!'; /** * The syntax to count rows is slightly different across different * database engines, so this string appears in each driver and is * used for the count_all() and count_all_results() functions. */ - public $_count_string = "SELECT COUNT(1) AS "; - public $_random_keyword = ' ASC'; // not currently supported + var $_count_string = "SELECT COUNT(1) AS "; + var $_random_keyword = ' ASC'; // not currently supported // Set "auto commit" by default - public $_commit = OCI_COMMIT_ON_SUCCESS; + var $_commit = OCI_COMMIT_ON_SUCCESS; // need to track statement id and cursor id - public $stmt_id; - public $curs_id; + var $stmt_id; + var $curs_id; // if we use a limit, we will add a field that will // throw off num_fields later - public $limit_used; + var $limit_used; /** * Non-persistent database connection @@ -214,7 +214,7 @@ class CI_DB_oci8_driver extends CI_DB { * KEY OPTIONAL NOTES * name no the name of the parameter should be in : format * value no the value of the parameter. If this is an OUT or IN OUT parameter, - * this should be a reference to a publiciable + * this should be a reference to a variable * type yes the type of the parameter * length yes the max size of the parameter */ @@ -781,5 +781,7 @@ class CI_DB_oci8_driver extends CI_DB { } + + /* End of file oci8_driver.php */ -/* Location: ./system/database/drivers/oci8/oci8_driver.php */ \ No newline at end of file +/* Location: ./system/database/drivers/oci8/oci8_driver.php */ diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php index f9a90ff0a..7fcc8094d 100644 --- a/system/database/drivers/oci8/oci8_forge.php +++ b/system/database/drivers/oci8/oci8_forge.php @@ -39,10 +39,11 @@ class CI_DB_oci8_forge extends CI_DB_forge { /** * Create database * + * @access public * @param string the database name * @return bool */ - public function _create_database($name) + function _create_database($name) { return FALSE; } @@ -52,10 +53,11 @@ class CI_DB_oci8_forge extends CI_DB_forge { /** * Drop database * + * @access private * @param string the database name * @return bool */ - protected function _drop_database($name) + function _drop_database($name) { return FALSE; } @@ -142,9 +144,10 @@ class CI_DB_oci8_forge extends CI_DB_forge { /** * Drop Table * + * @access private * @return bool */ - protected function _drop_table($table) + function _drop_table($table) { return FALSE; } @@ -157,6 +160,7 @@ class CI_DB_oci8_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * + * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name @@ -166,7 +170,7 @@ class CI_DB_oci8_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -208,11 +212,12 @@ class CI_DB_oci8_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * + * @access private * @param string the old table name * @param string the new table name * @return string */ - protected function _rename_table($table_name, $new_table_name) + function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } @@ -220,4 +225,4 @@ class CI_DB_oci8_forge extends CI_DB_forge { } /* End of file oci8_forge.php */ -/* Location: ./system/database/drivers/oci8/oci8_forge.php */ \ No newline at end of file +/* Location: ./system/database/drivers/oci8/oci8_forge.php */ diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index a14e32eec..6f1b8b4c1 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -235,5 +235,6 @@ class CI_DB_oci8_result extends CI_DB_result { } + /* End of file oci8_result.php */ -/* Location: ./system/database/drivers/oci8/oci8_result.php */ \ No newline at end of file +/* Location: ./system/database/drivers/oci8/oci8_result.php */ diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php index f4863c0db..62dfb2f3c 100644 --- a/system/database/drivers/oci8/oci8_utility.php +++ b/system/database/drivers/oci8/oci8_utility.php @@ -39,9 +39,10 @@ class CI_DB_oci8_utility extends CI_DB_utility { /** * List databases * + * @access private * @return bool */ - protected function _list_databases() + function _list_databases() { return FALSE; } @@ -53,10 +54,11 @@ class CI_DB_oci8_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be optimized * + * @access private * @param string the table name * @return object */ - protected function _optimize_table($table) + function _optimize_table($table) { return FALSE; // Is this supported in Oracle? } @@ -68,10 +70,11 @@ class CI_DB_oci8_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be repaired * + * @access private * @param string the table name * @return object */ - protected function _repair_table($table) + function _repair_table($table) { return FALSE; // Is this supported in Oracle? } @@ -81,10 +84,11 @@ class CI_DB_oci8_utility extends CI_DB_utility { /** * Oracle Export * + * @access private * @param array Preferences * @return mixed */ - protected function _backup($params = array()) + function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); -- cgit v1.2.3-24-g4f1b From 8c1b2dc39d104774b3a7be87dc41f2b702bb883c Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 19:07:18 -0400 Subject: Revert "Added access modifiers for MSSQL driver" This reverts commit ba1ebbefa9c5d225fa28c76dac276e6120263a25. --- system/database/drivers/mssql/mssql_driver.php | 81 ++++++++++++++++--------- system/database/drivers/mssql/mssql_forge.php | 20 +++--- system/database/drivers/mssql/mssql_result.php | 24 +++++--- system/database/drivers/mssql/mssql_utility.php | 12 ++-- 4 files changed, 90 insertions(+), 47 deletions(-) diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index 9448f052c..a93ac57fe 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -62,9 +62,10 @@ class CI_DB_mssql_driver extends CI_DB { /** * Non-persistent database connection * + * @access private called by the base class * @return resource */ - protected function db_connect() + function db_connect() { if ($this->port != '') { @@ -79,9 +80,10 @@ class CI_DB_mssql_driver extends CI_DB { /** * Persistent database connection * + * @access private called by the base class * @return resource */ - protected function db_pconnect() + function db_pconnect() { if ($this->port != '') { @@ -99,9 +101,10 @@ class CI_DB_mssql_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * + * @access public * @return void */ - public function reconnect() + function reconnect() { // not implemented in MSSQL } @@ -137,10 +140,11 @@ class CI_DB_mssql_driver extends CI_DB { /** * Execute the query * + * @access private called by the base class * @param string an SQL query * @return resource */ - protected function _execute($sql) + function _execute($sql) { return @mssql_query($sql, $this->conn_id); } @@ -150,9 +154,10 @@ class CI_DB_mssql_driver extends CI_DB { /** * Begin Transaction * + * @access public * @return bool */ - public function trans_begin($test_mode = FALSE) + function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -179,9 +184,10 @@ class CI_DB_mssql_driver extends CI_DB { /** * Commit Transaction * + * @access public * @return bool */ - public function trans_commit() + function trans_commit() { if ( ! $this->trans_enabled) { @@ -203,9 +209,10 @@ class CI_DB_mssql_driver extends CI_DB { /** * Rollback Transaction * + * @access public * @return bool */ - public function trans_rollback() + function trans_rollback() { if ( ! $this->trans_enabled) { @@ -227,11 +234,12 @@ class CI_DB_mssql_driver extends CI_DB { /** * Escape String * + * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - public function escape_str($str, $like = FALSE) + function escape_str($str, $like = FALSE) { if (is_array($str)) { @@ -264,9 +272,10 @@ class CI_DB_mssql_driver extends CI_DB { /** * Affected Rows * + * @access public * @return integer */ - public function affected_rows() + function affected_rows() { return @mssql_rows_affected($this->conn_id); } @@ -278,9 +287,10 @@ class CI_DB_mssql_driver extends CI_DB { * * Returns the last id created in the Identity column. * + * @access public * @return integer */ - public function insert_id() + function insert_id() { $ver = self::_parse_major_version($this->version()); $sql = ($ver >= 8 ? "SELECT SCOPE_IDENTITY() AS last_id" : "SELECT @@IDENTITY AS last_id"); @@ -297,10 +307,11 @@ class CI_DB_mssql_driver extends CI_DB { * Grabs the major version number from the * database server version string passed in. * + * @access private * @param string $version * @return int16 major version number */ - protected function _parse_major_version($version) + function _parse_major_version($version) { preg_match('/([0-9]+)\.([0-9]+)\.([0-9]+)/', $version, $ver_info); return $ver_info[1]; // return the major version b/c that's all we're interested in. @@ -313,7 +324,7 @@ class CI_DB_mssql_driver extends CI_DB { * * @return string */ - protected public function _version() + protected function _version() { return 'SELECT @@VERSION AS ver'; } @@ -326,10 +337,11 @@ class CI_DB_mssql_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * + * @access public * @param string * @return string */ - public function count_all($table = '') + function count_all($table = '') { if ($table == '') { @@ -354,10 +366,11 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * + * @access private * @param boolean * @return string */ - protected function _list_tables($prefix_limit = FALSE) + function _list_tables($prefix_limit = FALSE) { $sql = "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name"; @@ -378,10 +391,11 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * + * @access private * @param string the table name * @return string */ - protected function _list_columns($table = '') + function _list_columns($table = '') { return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$table."'"; } @@ -393,10 +407,11 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * + * @access public * @param string the table name * @return object */ - public function _field_data($table) + function _field_data($table) { return "SELECT TOP 1 * FROM ".$table; } @@ -423,12 +438,13 @@ class CI_DB_mssql_driver extends CI_DB { /** * Escape the SQL Identifiers * - * This public function escapes column and table names + * This function escapes column and table names * + * @access private * @param string * @return string */ - protected function _escape_identifiers($item) + function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -464,13 +480,14 @@ class CI_DB_mssql_driver extends CI_DB { /** * From Tables * - * This public function implicitly groups FROM tables so there is no confusion + * This function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * + * @access public * @param type * @return type */ - public function _from_tables($tables) + function _from_tables($tables) { if ( ! is_array($tables)) { @@ -487,12 +504,13 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * + * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - public function _insert($table, $keys, $values) + function _insert($table, $keys, $values) { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } @@ -504,6 +522,7 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * + * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -511,7 +530,7 @@ class CI_DB_mssql_driver extends CI_DB { * @param array the limit clause * @return string */ - public function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -539,12 +558,13 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific truncate string from the supplied data * If the database does not support the truncate() command - * This public function maps to "DELETE FROM table" + * This function maps to "DELETE FROM table" * + * @access public * @param string the table name * @return string */ - public function _truncate($table) + function _truncate($table) { return "TRUNCATE ".$table; } @@ -556,12 +576,13 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * + * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - public function _delete($table, $where = array(), $like = array(), $limit = FALSE) + function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -589,12 +610,13 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * + * @access public * @param string the sql query string * @param integer the number of rows to limit the query to * @param integer the offset value * @return string */ - public function _limit($sql, $limit, $offset) + function _limit($sql, $limit, $offset) { $i = $limit + $offset; @@ -606,15 +628,18 @@ class CI_DB_mssql_driver extends CI_DB { /** * Close DB Connection * + * @access public * @param resource * @return void */ - public function _close($conn_id) + function _close($conn_id) { @mssql_close($conn_id); } } + + /* End of file mssql_driver.php */ -/* Location: ./system/database/drivers/mssql/mssql_driver.php */ \ No newline at end of file +/* Location: ./system/database/drivers/mssql/mssql_driver.php */ diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php index 500dd9845..4a8089bb1 100644 --- a/system/database/drivers/mssql/mssql_forge.php +++ b/system/database/drivers/mssql/mssql_forge.php @@ -39,10 +39,11 @@ class CI_DB_mssql_forge extends CI_DB_forge { /** * Create database * + * @access private * @param string the database name * @return bool */ - protected function _create_database($name) + function _create_database($name) { return "CREATE DATABASE ".$name; } @@ -52,10 +53,11 @@ class CI_DB_mssql_forge extends CI_DB_forge { /** * Drop database * + * @access private * @param string the database name * @return bool */ - protected function _drop_database($name) + function _drop_database($name) { return "DROP DATABASE ".$name; } @@ -65,9 +67,10 @@ class CI_DB_mssql_forge extends CI_DB_forge { /** * Drop Table * + * @access private * @return bool */ - protected function _drop_table($table) + function _drop_table($table) { return "DROP TABLE ".$this->db->_escape_identifiers($table); } @@ -77,6 +80,7 @@ class CI_DB_mssql_forge extends CI_DB_forge { /** * Create Table * + * @access private * @param string the table name * @param array the fields * @param mixed primary key(s) @@ -84,7 +88,7 @@ class CI_DB_mssql_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -186,6 +190,7 @@ class CI_DB_mssql_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * + * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name @@ -195,7 +200,7 @@ class CI_DB_mssql_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - protected function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -237,11 +242,12 @@ class CI_DB_mssql_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * + * @access private * @param string the old table name * @param string the new table name * @return string */ - protected function _rename_table($table_name, $new_table_name) + function _rename_table($table_name, $new_table_name) { // I think this syntax will work, but can find little documentation on renaming tables in MSSQL return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); @@ -250,4 +256,4 @@ class CI_DB_mssql_forge extends CI_DB_forge { } /* End of file mssql_forge.php */ -/* Location: ./system/database/drivers/mssql/mssql_forge.php */ \ No newline at end of file +/* Location: ./system/database/drivers/mssql/mssql_forge.php */ diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php index ff899406c..b205ce2d1 100644 --- a/system/database/drivers/mssql/mssql_result.php +++ b/system/database/drivers/mssql/mssql_result.php @@ -41,9 +41,10 @@ class CI_DB_mssql_result extends CI_DB_result { /** * Number of rows in the result set * + * @access public * @return integer */ - public function num_rows() + function num_rows() { return @mssql_num_rows($this->result_id); } @@ -53,9 +54,10 @@ class CI_DB_mssql_result extends CI_DB_result { /** * Number of fields in the result set * + * @access public * @return integer */ - public function num_fields() + function num_fields() { return @mssql_num_fields($this->result_id); } @@ -67,9 +69,10 @@ class CI_DB_mssql_result extends CI_DB_result { * * Generates an array of column names * + * @access public * @return array */ - public function list_fields() + function list_fields() { $field_names = array(); while ($field = mssql_fetch_field($this->result_id)) @@ -87,9 +90,10 @@ class CI_DB_mssql_result extends CI_DB_result { * * Generates an array of objects containing field meta-data * + * @access public * @return array */ - public function field_data() + function field_data() { $retval = array(); while ($field = mssql_fetch_field($this->result_id)) @@ -114,7 +118,7 @@ class CI_DB_mssql_result extends CI_DB_result { * * @return null */ - public function free_result() + function free_result() { if (is_resource($this->result_id)) { @@ -132,9 +136,10 @@ class CI_DB_mssql_result extends CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero * + * @access private * @return array */ - protected function _data_seek($n = 0) + function _data_seek($n = 0) { return mssql_data_seek($this->result_id, $n); } @@ -146,9 +151,10 @@ class CI_DB_mssql_result extends CI_DB_result { * * Returns the result set as an array * + * @access private * @return array */ - protected function _fetch_assoc() + function _fetch_assoc() { return mssql_fetch_assoc($this->result_id); } @@ -160,14 +166,16 @@ class CI_DB_mssql_result extends CI_DB_result { * * Returns the result set as an object * + * @access private * @return object */ - protected function _fetch_object() + function _fetch_object() { return mssql_fetch_object($this->result_id); } } + /* End of file mssql_result.php */ /* Location: ./system/database/drivers/mssql/mssql_result.php */ \ No newline at end of file diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php index e64874132..28f34b999 100644 --- a/system/database/drivers/mssql/mssql_utility.php +++ b/system/database/drivers/mssql/mssql_utility.php @@ -39,9 +39,10 @@ class CI_DB_mssql_utility extends CI_DB_utility { /** * List databases * + * @access private * @return bool */ - protected function _list_databases() + function _list_databases() { return "EXEC sp_helpdb"; // Can also be: EXEC sp_databases } @@ -53,10 +54,11 @@ class CI_DB_mssql_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be optimized * + * @access private * @param string the table name * @return object */ - protected function _optimize_table($table) + function _optimize_table($table) { return FALSE; // Is this supported in MS SQL? } @@ -68,10 +70,11 @@ class CI_DB_mssql_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be repaired * + * @access private * @param string the table name * @return object */ - protected function _repair_table($table) + function _repair_table($table) { return FALSE; // Is this supported in MS SQL? } @@ -81,10 +84,11 @@ class CI_DB_mssql_utility extends CI_DB_utility { /** * MSSQL Export * + * @access private * @param array Preferences * @return mixed */ - protected function _backup($params = array()) + function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); -- cgit v1.2.3-24-g4f1b From 0c2747151f0cd32b6188ecd8c1dcdcdb6fe44792 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 19:08:29 -0400 Subject: Revert "Added access modifiers to the rest of the Cubrid classes" This reverts commit f83f0d5448aadcf76fbdac363d0fe7ea811ca9bf. --- system/database/drivers/cubrid/cubrid_forge.php | 21 ++++++++++++++------- system/database/drivers/cubrid/cubrid_result.php | 23 +++++++++++++++-------- system/database/drivers/cubrid/cubrid_utility.php | 8 ++++---- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/system/database/drivers/cubrid/cubrid_forge.php b/system/database/drivers/cubrid/cubrid_forge.php index 6bfc7c28f..7d606ea36 100644 --- a/system/database/drivers/cubrid/cubrid_forge.php +++ b/system/database/drivers/cubrid/cubrid_forge.php @@ -39,10 +39,11 @@ class CI_DB_cubrid_forge extends CI_DB_forge { /** * Create database * + * @access private * @param string the database name * @return bool */ - protected function _create_database($name) + function _create_database($name) { // CUBRID does not allow to create a database in SQL. The GUI tools // have to be used for this purpose. @@ -54,10 +55,11 @@ class CI_DB_cubrid_forge extends CI_DB_forge { /** * Drop database * + * @access private * @param string the database name * @return bool */ - protected function _drop_database($name) + function _drop_database($name) { // CUBRID does not allow to drop a database in SQL. The GUI tools // have to be used for this purpose. @@ -69,10 +71,11 @@ class CI_DB_cubrid_forge extends CI_DB_forge { /** * Process Fields * + * @access private * @param mixed the fields * @return string */ - protected function _process_fields($fields) + function _process_fields($fields) { $current_field_count = 0; $sql = ''; @@ -169,6 +172,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { /** * Create Table * + * @access private * @param string the table name * @param mixed the fields * @param mixed primary key(s) @@ -176,7 +180,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * @param boolean should 'IF NOT EXISTS' be added to the SQL * @return bool */ - protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -228,9 +232,10 @@ class CI_DB_cubrid_forge extends CI_DB_forge { /** * Drop Table * + * @access private * @return string */ - protected function _drop_table($table) + function _drop_table($table) { return "DROP TABLE IF EXISTS ".$this->db->_escape_identifiers($table); } @@ -243,13 +248,14 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * + * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param array fields * @param string the field after which we should add the new field * @return object */ - protected function _alter_table($alter_type, $table, $fields, $after_field = '') + function _alter_table($alter_type, $table, $fields, $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '; @@ -276,11 +282,12 @@ class CI_DB_cubrid_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * + * @access private * @param string the old table name * @param string the new table name * @return string */ - protected function _rename_table($table_name, $new_table_name) + function _rename_table($table_name, $new_table_name) { return 'RENAME TABLE '.$this->db->protect_identifiers($table_name).' AS '.$this->db->protect_identifiers($new_table_name); } diff --git a/system/database/drivers/cubrid/cubrid_result.php b/system/database/drivers/cubrid/cubrid_result.php index c7a7632aa..a7eeb8a39 100644 --- a/system/database/drivers/cubrid/cubrid_result.php +++ b/system/database/drivers/cubrid/cubrid_result.php @@ -41,9 +41,10 @@ class CI_DB_cubrid_result extends CI_DB_result { /** * Number of rows in the result set * + * @access public * @return integer */ - public function num_rows() + function num_rows() { return @cubrid_num_rows($this->result_id); } @@ -53,9 +54,10 @@ class CI_DB_cubrid_result extends CI_DB_result { /** * Number of fields in the result set * + * @access public * @return integer */ - public function num_fields() + function num_fields() { return @cubrid_num_fields($this->result_id); } @@ -67,9 +69,10 @@ class CI_DB_cubrid_result extends CI_DB_result { * * Generates an array of column names * + * @access public * @return array */ - public function list_fields() + function list_fields() { return cubrid_column_names($this->result_id); } @@ -81,9 +84,10 @@ class CI_DB_cubrid_result extends CI_DB_result { * * Generates an array of objects containing field meta-data * + * @access public * @return array */ - public function field_data() + function field_data() { $retval = array(); @@ -145,7 +149,7 @@ class CI_DB_cubrid_result extends CI_DB_result { * * @return null */ - public function free_result() + function free_result() { if(is_resource($this->result_id) || get_resource_type($this->result_id) == "Unknown" && @@ -165,9 +169,10 @@ class CI_DB_cubrid_result extends CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero * + * @access private * @return array */ - protected function _data_seek($n = 0) + function _data_seek($n = 0) { return cubrid_data_seek($this->result_id, $n); } @@ -179,9 +184,10 @@ class CI_DB_cubrid_result extends CI_DB_result { * * Returns the result set as an array * + * @access private * @return array */ - protected function _fetch_assoc() + function _fetch_assoc() { return cubrid_fetch_assoc($this->result_id); } @@ -193,9 +199,10 @@ class CI_DB_cubrid_result extends CI_DB_result { * * Returns the result set as an object * + * @access private * @return object */ - protected function _fetch_object() + function _fetch_object() { return cubrid_fetch_object($this->result_id); } diff --git a/system/database/drivers/cubrid/cubrid_utility.php b/system/database/drivers/cubrid/cubrid_utility.php index de28e6335..a13c0a5e4 100644 --- a/system/database/drivers/cubrid/cubrid_utility.php +++ b/system/database/drivers/cubrid/cubrid_utility.php @@ -42,7 +42,7 @@ class CI_DB_cubrid_utility extends CI_DB_utility { * @access private * @return array */ - protected function _list_databases() + function _list_databases() { // CUBRID does not allow to see the list of all databases on the // server. It is the way its architecture is designed. Every @@ -71,7 +71,7 @@ class CI_DB_cubrid_utility extends CI_DB_utility { * @return object * @link http://www.cubrid.org/manual/840/en/Optimize%20Database */ - protected function _optimize_table($table) + function _optimize_table($table) { // No SQL based support in CUBRID as of version 8.4.0. Database or // table optimization can be performed using CUBRID Manager @@ -91,7 +91,7 @@ class CI_DB_cubrid_utility extends CI_DB_utility { * @return object * @link http://www.cubrid.org/manual/840/en/Checking%20Database%20Consistency */ - protected function _repair_table($table) + function _repair_table($table) { // Not supported in CUBRID as of version 8.4.0. Database or // table consistency can be checked using CUBRID Manager @@ -107,7 +107,7 @@ class CI_DB_cubrid_utility extends CI_DB_utility { * @param array Preferences * @return mixed */ - protected function _backup($params = array()) + function _backup($params = array()) { // No SQL based support in CUBRID as of version 8.4.0. Database or // table backup can be performed using CUBRID Manager -- cgit v1.2.3-24-g4f1b From 175e289d092578952f134f7cad549bcc5e3efa17 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 19 Mar 2012 19:08:39 -0400 Subject: Revert "Added access modifiers to CUBRID driver" This reverts commit 70b21018b4941414c0041900f26c637763e19cfe. --- system/database/drivers/cubrid/cubrid_driver.php | 87 +++++++++++++++--------- 1 file changed, 56 insertions(+), 31 deletions(-) diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php index cc9f23d9e..32bd8a8b2 100644 --- a/system/database/drivers/cubrid/cubrid_driver.php +++ b/system/database/drivers/cubrid/cubrid_driver.php @@ -66,9 +66,10 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Non-persistent database connection * + * @access private called by the base class * @return resource */ - protected function db_connect() + function db_connect() { // If no port is defined by the user, use the default value if ($this->port == '') @@ -105,12 +106,13 @@ class CI_DB_cubrid_driver extends CI_DB { * file by setting the CCI_PCONNECT parameter to ON. In that case, all * connections established between the client application and the * server will become persistent. This is calling the same - * @cubrid_connect public function will establish persisten connection + * @cubrid_connect function will establish persisten connection * considering that the CCI_PCONNECT is ON. * + * @access private called by the base class * @return resource */ - protected function db_pconnect() + function db_pconnect() { return $this->db_connect(); } @@ -123,9 +125,10 @@ class CI_DB_cubrid_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * + * @access public * @return void */ - public function reconnect() + function reconnect() { if (cubrid_ping($this->conn_id) === FALSE) { @@ -138,9 +141,10 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Select the database * + * @access private called by the base class * @return resource */ - public function db_select() + function db_select() { // In CUBRID there is no need to select a database as the database // is chosen at the connection time. @@ -168,10 +172,11 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Execute the query * + * @access private called by the base class * @param string an SQL query * @return resource */ - protected function _execute($sql) + function _execute($sql) { return @cubrid_query($sql, $this->conn_id); } @@ -181,9 +186,10 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Begin Transaction * + * @access public * @return bool */ - public function trans_begin($test_mode = FALSE) + function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -214,9 +220,10 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Commit Transaction * + * @access public * @return bool */ - public function trans_commit() + function trans_commit() { if ( ! $this->trans_enabled) { @@ -244,9 +251,10 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Rollback Transaction * + * @access public * @return bool */ - public function trans_rollback() + function trans_rollback() { if ( ! $this->trans_enabled) { @@ -274,11 +282,12 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Escape String * + * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - public function escape_str($str, $like = FALSE) + function escape_str($str, $like = FALSE) { if (is_array($str)) { @@ -315,7 +324,7 @@ class CI_DB_cubrid_driver extends CI_DB { * * @return int */ - public public function affected_rows() + public function affected_rows() { return @cubrid_affected_rows(); } @@ -325,9 +334,10 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Insert ID * + * @access public * @return integer */ - public function insert_id() + function insert_id() { return @cubrid_insert_id($this->conn_id); } @@ -340,10 +350,11 @@ class CI_DB_cubrid_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified table * + * @access public * @param string * @return string */ - public function count_all($table = '') + function count_all($table = '') { if ($table == '') { @@ -368,10 +379,11 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * + * @access private * @param boolean * @return string */ - protected function _list_tables($prefix_limit = FALSE) + function _list_tables($prefix_limit = FALSE) { $sql = "SHOW TABLES"; @@ -390,10 +402,11 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * + * @access public * @param string the table name * @return string */ - public function _list_columns($table = '') + function _list_columns($table = '') { return 'SHOW COLUMNS FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE); } @@ -405,10 +418,11 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * + * @access public * @param string the table name * @return object */ - public function _field_data($table) + function _field_data($table) { return "SELECT * FROM ".$table." LIMIT 1"; } @@ -423,7 +437,7 @@ class CI_DB_cubrid_driver extends CI_DB { * * @return array */ - public public function error() + public function error() { return array('code' => cubrid_errno($this->conn_id), 'message' => cubrid_error($this->conn_id)); } @@ -431,12 +445,13 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Escape the SQL Identifiers * - * This public function escapes column and table names + * This function escapes column and table names * + * @access private * @param string * @return string */ - protected function _escape_identifiers($item) + function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -472,13 +487,14 @@ class CI_DB_cubrid_driver extends CI_DB { /** * From Tables * - * This public function implicitly groups FROM tables so there is no confusion + * This function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * + * @access public * @param type * @return type */ - public function _from_tables($tables) + function _from_tables($tables) { if ( ! is_array($tables)) { @@ -495,12 +511,13 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * + * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - public function _insert($table, $keys, $values) + function _insert($table, $keys, $values) { return "INSERT INTO ".$table." (\"".implode('", "', $keys)."\") VALUES (".implode(', ', $values).")"; } @@ -513,12 +530,13 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific replace string from the supplied data * + * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - public function _replace($table, $keys, $values) + function _replace($table, $keys, $values) { return "REPLACE INTO ".$table." (\"".implode('", "', $keys)."\") VALUES (".implode(', ', $values).")"; } @@ -530,12 +548,13 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * + * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - public function _insert_batch($table, $keys, $values) + function _insert_batch($table, $keys, $values) { return "INSERT INTO ".$table." (\"".implode('", "', $keys)."\") VALUES ".implode(', ', $values); } @@ -548,6 +567,7 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * + * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -555,7 +575,7 @@ class CI_DB_cubrid_driver extends CI_DB { * @param array the limit clause * @return string */ - public function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -583,12 +603,13 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific batch update string from the supplied data * + * @access public * @param string the table name * @param array the update data * @param array the where clause * @return string */ - public function _update_batch($table, $values, $index, $where = NULL) + function _update_batch($table, $values, $index, $where = NULL) { $ids = array(); $where = ($where != '' AND count($where) >=1) ? implode(" ", $where).' AND ' : ''; @@ -635,12 +656,13 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific truncate string from the supplied data * If the database does not support the truncate() command - * This public function maps to "DELETE FROM table" + * This function maps to "DELETE FROM table" * + * @access public * @param string the table name * @return string */ - public function _truncate($table) + function _truncate($table) { return "TRUNCATE ".$table; } @@ -652,12 +674,13 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * + * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - public function _delete($table, $where = array(), $like = array(), $limit = FALSE) + function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -685,12 +708,13 @@ class CI_DB_cubrid_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * + * @access public * @param string the sql query string * @param integer the number of rows to limit the query to * @param integer the offset value * @return string */ - public function _limit($sql, $limit, $offset) + function _limit($sql, $limit, $offset) { if ($offset == 0) { @@ -709,10 +733,11 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Close DB Connection * + * @access public * @param resource * @return void */ - public function _close($conn_id) + function _close($conn_id) { @cubrid_close($conn_id); } -- cgit v1.2.3-24-g4f1b From 0336dc228c84695ec75fc8dccedac354d1556de9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 15:34:28 +0200 Subject: Remove EOF newline --- system/libraries/Zip.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index aa838eeca..c9810fab9 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -412,4 +412,4 @@ class CI_Zip { } /* End of file Zip.php */ -/* Location: ./system/libraries/Zip.php */ +/* Location: ./system/libraries/Zip.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 215890b015d219f0d31e8ad678b0b655e6923f3b Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Tue, 20 Mar 2012 09:38:16 -0400 Subject: Remove extraneous newlines --- system/database/DB_active_rec.php | 22 +++++++++++----------- system/database/DB_cache.php | 2 +- system/database/DB_forge.php | 2 +- system/database/DB_result.php | 2 +- system/database/DB_utility.php | 2 +- system/database/drivers/cubrid/cubrid_driver.php | 2 +- .../drivers/interbase/interbase_driver.php | 2 +- system/database/drivers/mssql/mssql_driver.php | 4 +--- system/database/drivers/mssql/mssql_forge.php | 2 +- system/database/drivers/mssql/mssql_result.php | 1 - system/database/drivers/mysql/mysql_forge.php | 2 +- system/database/drivers/mysqli/mysqli_forge.php | 2 +- system/database/drivers/oci8/oci8_driver.php | 4 +--- system/database/drivers/oci8/oci8_forge.php | 2 +- system/database/drivers/oci8/oci8_result.php | 3 +-- system/database/drivers/odbc/odbc_driver.php | 2 +- system/database/drivers/odbc/odbc_forge.php | 2 +- system/database/drivers/odbc/odbc_result.php | 2 +- system/database/drivers/odbc/odbc_utility.php | 2 +- system/database/drivers/pdo/pdo_driver.php | 2 +- system/database/drivers/pdo/pdo_forge.php | 2 +- system/database/drivers/postgre/postgre_forge.php | 2 +- system/database/drivers/postgre/postgre_result.php | 2 +- .../database/drivers/postgre/postgre_utility.php | 2 +- system/database/drivers/sqlite/sqlite_driver.php | 2 +- system/database/drivers/sqlite/sqlite_forge.php | 2 +- system/database/drivers/sqlite/sqlite_utility.php | 2 +- system/database/drivers/sqlsrv/sqlsrv_driver.php | 4 +--- system/database/drivers/sqlsrv/sqlsrv_forge.php | 2 +- system/database/drivers/sqlsrv/sqlsrv_result.php | 1 - 30 files changed, 38 insertions(+), 47 deletions(-) diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 89369f190..fe591dda1 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -2197,19 +2197,19 @@ abstract class CI_DB_active_record extends CI_DB_driver { protected function _reset_write() { $this->_reset_run(array( - 'ar_set' => array(), - 'ar_from' => array(), - 'ar_where' => array(), - 'ar_like' => array(), - 'ar_orderby' => array(), - 'ar_keys' => array(), - 'ar_limit' => FALSE, - 'ar_order' => FALSE - ) - ); + 'ar_set' => array(), + 'ar_from' => array(), + 'ar_where' => array(), + 'ar_like' => array(), + 'ar_orderby' => array(), + 'ar_keys' => array(), + 'ar_limit' => FALSE, + 'ar_order' => FALSE + ) + ); } } /* End of file DB_active_rec.php */ -/* Location: ./system/database/DB_active_rec.php */ +/* Location: ./system/database/DB_active_rec.php */ \ No newline at end of file diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index fb0cfa89a..58e6968c0 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -183,4 +183,4 @@ class CI_DB_Cache { } /* End of file DB_cache.php */ -/* Location: ./system/database/DB_cache.php */ +/* Location: ./system/database/DB_cache.php */ \ No newline at end of file diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index 192b78fa6..34c502a99 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -346,4 +346,4 @@ abstract class CI_DB_forge { } /* End of file DB_forge.php */ -/* Location: ./system/database/DB_forge.php */ +/* Location: ./system/database/DB_forge.php */ \ No newline at end of file diff --git a/system/database/DB_result.php b/system/database/DB_result.php index d0205e0fd..37c50e577 100644 --- a/system/database/DB_result.php +++ b/system/database/DB_result.php @@ -392,4 +392,4 @@ abstract class CI_DB_result { } /* End of file DB_result.php */ -/* Location: ./system/database/DB_result.php */ +/* Location: ./system/database/DB_result.php */ \ No newline at end of file diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index a7db803e8..642a004bd 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -384,4 +384,4 @@ abstract class CI_DB_utility extends CI_DB_forge { } /* End of file DB_utility.php */ -/* Location: ./system/database/DB_utility.php */ +/* Location: ./system/database/DB_utility.php */ \ No newline at end of file diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php index f6b08daa0..f39c2ad76 100644 --- a/system/database/drivers/cubrid/cubrid_driver.php +++ b/system/database/drivers/cubrid/cubrid_driver.php @@ -715,4 +715,4 @@ class CI_DB_cubrid_driver extends CI_DB { } /* End of file cubrid_driver.php */ -/* Location: ./system/database/drivers/cubrid/cubrid_driver.php */ +/* Location: ./system/database/drivers/cubrid/cubrid_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php index 4af5b57ed..9fa03adc7 100644 --- a/system/database/drivers/interbase/interbase_driver.php +++ b/system/database/drivers/interbase/interbase_driver.php @@ -607,4 +607,4 @@ SQL; } /* End of file interbase_driver.php */ -/* Location: ./system/database/drivers/interbase/interbase_driver.php */ +/* Location: ./system/database/drivers/interbase/interbase_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index a93ac57fe..ccbc3c456 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -639,7 +639,5 @@ class CI_DB_mssql_driver extends CI_DB { } - - /* End of file mssql_driver.php */ -/* Location: ./system/database/drivers/mssql/mssql_driver.php */ +/* Location: ./system/database/drivers/mssql/mssql_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php index 4a8089bb1..ee8b8f544 100644 --- a/system/database/drivers/mssql/mssql_forge.php +++ b/system/database/drivers/mssql/mssql_forge.php @@ -256,4 +256,4 @@ class CI_DB_mssql_forge extends CI_DB_forge { } /* End of file mssql_forge.php */ -/* Location: ./system/database/drivers/mssql/mssql_forge.php */ +/* Location: ./system/database/drivers/mssql/mssql_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php index b205ce2d1..c77c5a752 100644 --- a/system/database/drivers/mssql/mssql_result.php +++ b/system/database/drivers/mssql/mssql_result.php @@ -176,6 +176,5 @@ class CI_DB_mssql_result extends CI_DB_result { } - /* End of file mssql_result.php */ /* Location: ./system/database/drivers/mssql/mssql_result.php */ \ No newline at end of file diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php index d317ac3e0..11172b41b 100644 --- a/system/database/drivers/mysql/mysql_forge.php +++ b/system/database/drivers/mysql/mysql_forge.php @@ -237,4 +237,4 @@ class CI_DB_mysql_forge extends CI_DB_forge { } /* End of file mysql_forge.php */ -/* Location: ./system/database/drivers/mysql/mysql_forge.php */ +/* Location: ./system/database/drivers/mysql/mysql_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php index 9ec4bf7aa..8cf0ae1fd 100644 --- a/system/database/drivers/mysqli/mysqli_forge.php +++ b/system/database/drivers/mysqli/mysqli_forge.php @@ -237,4 +237,4 @@ class CI_DB_mysqli_forge extends CI_DB_forge { } /* End of file mysqli_forge.php */ -/* Location: ./system/database/drivers/mysqli/mysqli_forge.php */ +/* Location: ./system/database/drivers/mysqli/mysqli_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 8d7040618..e3846bc1a 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -781,7 +781,5 @@ class CI_DB_oci8_driver extends CI_DB { } - - /* End of file oci8_driver.php */ -/* Location: ./system/database/drivers/oci8/oci8_driver.php */ +/* Location: ./system/database/drivers/oci8/oci8_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php index 7fcc8094d..0a251998b 100644 --- a/system/database/drivers/oci8/oci8_forge.php +++ b/system/database/drivers/oci8/oci8_forge.php @@ -225,4 +225,4 @@ class CI_DB_oci8_forge extends CI_DB_forge { } /* End of file oci8_forge.php */ -/* Location: ./system/database/drivers/oci8/oci8_forge.php */ +/* Location: ./system/database/drivers/oci8/oci8_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index 6f1b8b4c1..a14e32eec 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -235,6 +235,5 @@ class CI_DB_oci8_result extends CI_DB_result { } - /* End of file oci8_result.php */ -/* Location: ./system/database/drivers/oci8/oci8_result.php */ +/* Location: ./system/database/drivers/oci8/oci8_result.php */ \ No newline at end of file diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index 87abedec9..6704264c6 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -561,4 +561,4 @@ class CI_DB_odbc_driver extends CI_DB { } /* End of file odbc_driver.php */ -/* Location: ./system/database/drivers/odbc/odbc_driver.php */ +/* Location: ./system/database/drivers/odbc/odbc_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php index 26a524a64..486a8dd7f 100644 --- a/system/database/drivers/odbc/odbc_forge.php +++ b/system/database/drivers/odbc/odbc_forge.php @@ -265,4 +265,4 @@ class CI_DB_odbc_forge extends CI_DB_forge { } /* End of file odbc_forge.php */ -/* Location: ./system/database/drivers/odbc/odbc_forge.php */ +/* Location: ./system/database/drivers/odbc/odbc_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php index f6aee356f..30cc979ce 100644 --- a/system/database/drivers/odbc/odbc_result.php +++ b/system/database/drivers/odbc/odbc_result.php @@ -319,4 +319,4 @@ class CI_DB_odbc_result extends CI_DB_result { } /* End of file odbc_result.php */ -/* Location: ./system/database/drivers/odbc/odbc_result.php */ +/* Location: ./system/database/drivers/odbc/odbc_result.php */ \ No newline at end of file diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php index 5244f084f..65445e96c 100644 --- a/system/database/drivers/odbc/odbc_utility.php +++ b/system/database/drivers/odbc/odbc_utility.php @@ -106,4 +106,4 @@ class CI_DB_odbc_utility extends CI_DB_utility { } /* End of file odbc_utility.php */ -/* Location: ./system/database/drivers/odbc/odbc_utility.php */ +/* Location: ./system/database/drivers/odbc/odbc_utility.php */ \ No newline at end of file diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 658a3d5a0..9b44e7c64 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -942,4 +942,4 @@ class CI_DB_pdo_driver extends CI_DB { } /* End of file pdo_driver.php */ -/* Location: ./system/database/drivers/pdo/pdo_driver.php */ +/* Location: ./system/database/drivers/pdo/pdo_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/pdo/pdo_forge.php b/system/database/drivers/pdo/pdo_forge.php index 87b638570..2e5c81de3 100644 --- a/system/database/drivers/pdo/pdo_forge.php +++ b/system/database/drivers/pdo/pdo_forge.php @@ -278,4 +278,4 @@ class CI_DB_pdo_forge extends CI_DB_forge { } /* End of file pdo_forge.php */ -/* Location: ./system/database/drivers/pdo/pdo_forge.php */ +/* Location: ./system/database/drivers/pdo/pdo_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php index 2a8fdd676..a72449820 100644 --- a/system/database/drivers/postgre/postgre_forge.php +++ b/system/database/drivers/postgre/postgre_forge.php @@ -299,4 +299,4 @@ class CI_DB_postgre_forge extends CI_DB_forge { } /* End of file postgre_forge.php */ -/* Location: ./system/database/drivers/postgre/postgre_forge.php */ +/* Location: ./system/database/drivers/postgre/postgre_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php index b3eafb8f7..8b22564b3 100644 --- a/system/database/drivers/postgre/postgre_result.php +++ b/system/database/drivers/postgre/postgre_result.php @@ -168,4 +168,4 @@ class CI_DB_postgre_result extends CI_DB_result { } /* End of file postgre_result.php */ -/* Location: ./system/database/drivers/postgre/postgre_result.php */ +/* Location: ./system/database/drivers/postgre/postgre_result.php */ \ No newline at end of file diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php index e31a6db8f..c6b71b4d9 100644 --- a/system/database/drivers/postgre/postgre_utility.php +++ b/system/database/drivers/postgre/postgre_utility.php @@ -86,4 +86,4 @@ class CI_DB_postgre_utility extends CI_DB_utility { } /* End of file postgre_utility.php */ -/* Location: ./system/database/drivers/postgre/postgre_utility.php */ +/* Location: ./system/database/drivers/postgre/postgre_utility.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 1870e73b7..de72b5454 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -623,4 +623,4 @@ class CI_DB_sqlite_driver extends CI_DB { /* End of file sqlite_driver.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */ +/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php index 7fc531463..26d0d94bf 100644 --- a/system/database/drivers/sqlite/sqlite_forge.php +++ b/system/database/drivers/sqlite/sqlite_forge.php @@ -274,4 +274,4 @@ class CI_DB_sqlite_forge extends CI_DB_forge { } /* End of file sqlite_forge.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_forge.php */ +/* Location: ./system/database/drivers/sqlite/sqlite_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php index 9f9ddca44..c07004c54 100644 --- a/system/database/drivers/sqlite/sqlite_utility.php +++ b/system/database/drivers/sqlite/sqlite_utility.php @@ -94,4 +94,4 @@ class CI_DB_sqlite_utility extends CI_DB_utility { } /* End of file sqlite_utility.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_utility.php */ +/* Location: ./system/database/drivers/sqlite/sqlite_utility.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index ea9f9483b..0239e8f56 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -601,7 +601,5 @@ class CI_DB_sqlsrv_driver extends CI_DB { } - - /* End of file mssql_driver.php */ -/* Location: ./system/database/drivers/mssql/mssql_driver.php */ +/* Location: ./system/database/drivers/mssql/mssql_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php index cd061dd23..0a276e172 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_forge.php +++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php @@ -256,4 +256,4 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { } /* End of file sqlsrv_forge.php */ -/* Location: ./system/database/drivers/sqlsrv/sqlsrv_forge.php */ +/* Location: ./system/database/drivers/sqlsrv/sqlsrv_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlsrv/sqlsrv_result.php b/system/database/drivers/sqlsrv/sqlsrv_result.php index 52d338a30..d980f98ff 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_result.php +++ b/system/database/drivers/sqlsrv/sqlsrv_result.php @@ -176,6 +176,5 @@ class CI_DB_sqlsrv_result extends CI_DB_result { } - /* End of file mssql_result.php */ /* Location: ./system/database/drivers/mssql/mssql_result.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 6dd4aff404c675d8da6ddfbd905bf4dbc13dece7 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 15:54:23 +0200 Subject: Revert CI_DB_result to a regular class It's directly instantiated for cached database results --- system/database/DB_result.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/database/DB_result.php b/system/database/DB_result.php index 37c50e577..04f964fb1 100644 --- a/system/database/DB_result.php +++ b/system/database/DB_result.php @@ -36,7 +36,7 @@ * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/database/ */ -abstract class CI_DB_result { +class CI_DB_result { public $conn_id = NULL; public $result_id = NULL; -- cgit v1.2.3-24-g4f1b From 1f619a889efbe71e66553de7918965f062c3c828 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 16:03:04 +0200 Subject: Visibility declarations and cleanup for CI_DB_mssql_driver --- system/database/drivers/mssql/mssql_driver.php | 136 ++++++++++--------------- 1 file changed, 56 insertions(+), 80 deletions(-) diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index ccbc3c456..1c1b84582 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -1,13 +1,13 @@ -port != '') { @@ -80,10 +77,9 @@ class CI_DB_mssql_driver extends CI_DB { /** * Persistent database connection * - * @access private called by the base class * @return resource */ - function db_pconnect() + public function db_pconnect() { if ($this->port != '') { @@ -101,10 +97,9 @@ class CI_DB_mssql_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * - * @access public * @return void */ - function reconnect() + public function reconnect() { // not implemented in MSSQL } @@ -140,11 +135,10 @@ class CI_DB_mssql_driver extends CI_DB { /** * Execute the query * - * @access private called by the base class * @param string an SQL query * @return resource */ - function _execute($sql) + protected function _execute($sql) { return @mssql_query($sql, $this->conn_id); } @@ -154,10 +148,9 @@ class CI_DB_mssql_driver extends CI_DB { /** * Begin Transaction * - * @access public * @return bool */ - function trans_begin($test_mode = FALSE) + public function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -184,10 +177,9 @@ class CI_DB_mssql_driver extends CI_DB { /** * Commit Transaction * - * @access public * @return bool */ - function trans_commit() + public function trans_commit() { if ( ! $this->trans_enabled) { @@ -209,10 +201,9 @@ class CI_DB_mssql_driver extends CI_DB { /** * Rollback Transaction * - * @access public * @return bool */ - function trans_rollback() + public function trans_rollback() { if ( ! $this->trans_enabled) { @@ -234,12 +225,11 @@ class CI_DB_mssql_driver extends CI_DB { /** * Escape String * - * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - function escape_str($str, $like = FALSE) + public function escape_str($str, $like = FALSE) { if (is_array($str)) { @@ -272,10 +262,9 @@ class CI_DB_mssql_driver extends CI_DB { /** * Affected Rows * - * @access public - * @return integer + * @return int */ - function affected_rows() + public function affected_rows() { return @mssql_rows_affected($this->conn_id); } @@ -283,14 +272,13 @@ class CI_DB_mssql_driver extends CI_DB { // -------------------------------------------------------------------- /** - * Insert ID - * - * Returns the last id created in the Identity column. - * - * @access public - * @return integer - */ - function insert_id() + * Insert ID + * + * Returns the last id created in the Identity column. + * + * @return string + */ + public function insert_id() { $ver = self::_parse_major_version($this->version()); $sql = ($ver >= 8 ? "SELECT SCOPE_IDENTITY() AS last_id" : "SELECT @@IDENTITY AS last_id"); @@ -302,16 +290,15 @@ class CI_DB_mssql_driver extends CI_DB { // -------------------------------------------------------------------- /** - * Parse major version - * - * Grabs the major version number from the - * database server version string passed in. - * - * @access private - * @param string $version - * @return int16 major version number - */ - function _parse_major_version($version) + * Parse major version + * + * Grabs the major version number from the + * database server version string passed in. + * + * @param string $version + * @return int major version number + */ + protected function _parse_major_version($version) { preg_match('/([0-9]+)\.([0-9]+)\.([0-9]+)/', $version, $ver_info); return $ver_info[1]; // return the major version b/c that's all we're interested in. @@ -320,10 +307,10 @@ class CI_DB_mssql_driver extends CI_DB { // -------------------------------------------------------------------- /** - * Version number query string - * - * @return string - */ + * Version number query string + * + * @return string + */ protected function _version() { return 'SELECT @@VERSION AS ver'; @@ -337,11 +324,10 @@ class CI_DB_mssql_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * - * @access public * @param string * @return string */ - function count_all($table = '') + public function count_all($table = '') { if ($table == '') { @@ -366,11 +352,10 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access private - * @param boolean + * @param bool * @return string */ - function _list_tables($prefix_limit = FALSE) + protected function _list_tables($prefix_limit = FALSE) { $sql = "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name"; @@ -391,11 +376,10 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @access private * @param string the table name * @return string */ - function _list_columns($table = '') + protected function _list_columns($table = '') { return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$table."'"; } @@ -407,11 +391,10 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * - * @access public * @param string the table name - * @return object + * @return string */ - function _field_data($table) + protected function _field_data($table) { return "SELECT TOP 1 * FROM ".$table; } @@ -440,11 +423,10 @@ class CI_DB_mssql_driver extends CI_DB { * * This function escapes column and table names * - * @access private * @param string * @return string */ - function _escape_identifiers($item) + public function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -483,11 +465,10 @@ class CI_DB_mssql_driver extends CI_DB { * This function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @access public - * @param type - * @return type + * @param array + * @return string */ - function _from_tables($tables) + protected function _from_tables($tables) { if ( ! is_array($tables)) { @@ -504,13 +485,12 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - function _insert($table, $keys, $values) + protected function _insert($table, $keys, $values) { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } @@ -522,7 +502,6 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * - * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -530,7 +509,7 @@ class CI_DB_mssql_driver extends CI_DB { * @param array the limit clause * @return string */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + protected function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -560,11 +539,10 @@ class CI_DB_mssql_driver extends CI_DB { * If the database does not support the truncate() command * This function maps to "DELETE FROM table" * - * @access public * @param string the table name * @return string */ - function _truncate($table) + protected function _truncate($table) { return "TRUNCATE ".$table; } @@ -610,13 +588,12 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * - * @access public * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value + * @param int the number of rows to limit the query to + * @param int the offset value * @return string */ - function _limit($sql, $limit, $offset) + protected function _limit($sql, $limit, $offset) { $i = $limit + $offset; @@ -628,11 +605,10 @@ class CI_DB_mssql_driver extends CI_DB { /** * Close DB Connection * - * @access public * @param resource * @return void */ - function _close($conn_id) + protected function _close($conn_id) { @mssql_close($conn_id); } -- cgit v1.2.3-24-g4f1b From 11559020f790fe7be8018aa42663e9d5976f012a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 16:04:48 +0200 Subject: Visibility declarations and cleanup for CI_DB_mssql_result --- system/database/drivers/mssql/mssql_result.php | 37 ++++++++++---------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php index c77c5a752..2723f4614 100644 --- a/system/database/drivers/mssql/mssql_result.php +++ b/system/database/drivers/mssql/mssql_result.php @@ -1,13 +1,13 @@ -result_id); } @@ -54,10 +51,9 @@ class CI_DB_mssql_result extends CI_DB_result { /** * Number of fields in the result set * - * @access public - * @return integer + * @return int */ - function num_fields() + public function num_fields() { return @mssql_num_fields($this->result_id); } @@ -69,10 +65,9 @@ class CI_DB_mssql_result extends CI_DB_result { * * Generates an array of column names * - * @access public * @return array */ - function list_fields() + public function list_fields() { $field_names = array(); while ($field = mssql_fetch_field($this->result_id)) @@ -90,10 +85,9 @@ class CI_DB_mssql_result extends CI_DB_result { * * Generates an array of objects containing field meta-data * - * @access public * @return array */ - function field_data() + public function field_data() { $retval = array(); while ($field = mssql_fetch_field($this->result_id)) @@ -116,9 +110,9 @@ class CI_DB_mssql_result extends CI_DB_result { /** * Free the result * - * @return null + * @return void */ - function free_result() + public function free_result() { if (is_resource($this->result_id)) { @@ -136,10 +130,9 @@ class CI_DB_mssql_result extends CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero * - * @access private * @return array */ - function _data_seek($n = 0) + protected function _data_seek($n = 0) { return mssql_data_seek($this->result_id, $n); } @@ -151,10 +144,9 @@ class CI_DB_mssql_result extends CI_DB_result { * * Returns the result set as an array * - * @access private * @return array */ - function _fetch_assoc() + protected function _fetch_assoc() { return mssql_fetch_assoc($this->result_id); } @@ -166,10 +158,9 @@ class CI_DB_mssql_result extends CI_DB_result { * * Returns the result set as an object * - * @access private * @return object */ - function _fetch_object() + protected function _fetch_object() { return mssql_fetch_object($this->result_id); } -- cgit v1.2.3-24-g4f1b From c066481ed558e764ab489449141d2489551b562f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 16:07:59 +0200 Subject: Visibility declarations and cleanup for MSSQL forge and utility classes --- system/database/drivers/mssql/mssql_forge.php | 43 +++++++++++-------------- system/database/drivers/mssql/mssql_utility.php | 26 ++++++--------- 2 files changed, 28 insertions(+), 41 deletions(-) diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php index ee8b8f544..2e3e314ed 100644 --- a/system/database/drivers/mssql/mssql_forge.php +++ b/system/database/drivers/mssql/mssql_forge.php @@ -1,13 +1,13 @@ -db->_escape_identifiers($table); } @@ -80,15 +76,14 @@ class CI_DB_mssql_forge extends CI_DB_forge { /** * Create Table * - * @access private * @param string the table name * @param array the fields * @param mixed primary key(s) * @param mixed key(s) - * @param boolean should 'IF NOT EXISTS' be added to the SQL - * @return bool + * @param bool should 'IF NOT EXISTS' be added to the SQL + * @return string */ - function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -100,7 +95,7 @@ class CI_DB_mssql_forge extends CI_DB_forge { $sql .= $this->db->_escape_identifiers($table)." ("; $current_field_count = 0; - foreach ($fields as $field=>$attributes) + foreach ($fields as $field => $attributes) { // Numeric field names aren't allowed in databases, so if the key is // numeric, we know it was assigned by PHP and the developer manually @@ -190,17 +185,16 @@ class CI_DB_mssql_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * - * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name * @param string the column definition * @param string the default value - * @param boolean should 'NOT NULL' be added + * @param bool should 'NOT NULL' be added * @param string the field after which we should add the new field - * @return object + * @return string */ - function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + public function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -242,12 +236,11 @@ class CI_DB_mssql_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * - * @access private * @param string the old table name * @param string the new table name * @return string */ - function _rename_table($table_name, $new_table_name) + public function _rename_table($table_name, $new_table_name) { // I think this syntax will work, but can find little documentation on renaming tables in MSSQL return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php index 28f34b999..5c144330d 100644 --- a/system/database/drivers/mssql/mssql_utility.php +++ b/system/database/drivers/mssql/mssql_utility.php @@ -1,13 +1,13 @@ -db->display_error('db_unsuported_feature'); -- cgit v1.2.3-24-g4f1b From e62973498626a163427f2d2346f21d6d0506a288 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 16:25:07 +0200 Subject: Visibility declarations and cleanup for CI_DB_sqlsrv_driver --- system/database/drivers/sqlsrv/sqlsrv_driver.php | 206 ++++++++++------------- 1 file changed, 85 insertions(+), 121 deletions(-) diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index 0239e8f56..2b9f82201 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -1,13 +1,13 @@ -char_set)) ? 'UTF-8' : $this->char_set; @@ -78,10 +75,11 @@ class CI_DB_sqlsrv_driver extends CI_DB { 'CharacterSet' => $character_set, 'ReturnDatesAsStrings' => 1 ); - - // If the username and password are both empty, assume this is a + + // If the username and password are both empty, assume this is a // 'Windows Authentication Mode' connection. - if(empty($connection['UID']) && empty($connection['PWD'])) { + if (empty($connection['UID']) && empty($connection['PWD'])) + { unset($connection['UID'], $connection['PWD']); } @@ -93,10 +91,9 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Persistent database connection * - * @access private called by the base class * @return resource */ - function db_pconnect() + public function db_pconnect() { return $this->db_connect(TRUE); } @@ -109,10 +106,9 @@ class CI_DB_sqlsrv_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * - * @access public * @return void */ - function reconnect() + public function reconnect() { // not implemented in MSSQL } @@ -146,16 +142,16 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Execute the query * - * @access private called by the base class * @param string an SQL query * @return resource */ - function _execute($sql) + protected function _execute($sql) { - return sqlsrv_query($this->conn_id, $sql, null, array( - 'Scrollable' => SQLSRV_CURSOR_STATIC, - 'SendStreamParamsAtExec' => true - )); + return sqlsrv_query($this->conn_id, + $sql, + NULL, + array('Scrollable'=> SQLSRV_CURSOR_STATIC, 'SendStreamParamsAtExec' => TRUE) + ); } // -------------------------------------------------------------------- @@ -163,10 +159,9 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Begin Transaction * - * @access public * @return bool */ - function trans_begin($test_mode = FALSE) + public function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -192,10 +187,9 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Commit Transaction * - * @access public * @return bool */ - function trans_commit() + public function trans_commit() { if ( ! $this->trans_enabled) { @@ -216,10 +210,9 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Rollback Transaction * - * @access public * @return bool */ - function trans_rollback() + public function trans_rollback() { if ( ! $this->trans_enabled) { @@ -240,12 +233,11 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Escape String * - * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - function escape_str($str, $like = FALSE) + public function escape_str($str, $like = FALSE) { // Escape single quotes return str_replace("'", "''", $str); @@ -256,10 +248,9 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Affected Rows * - * @access public - * @return integer + * @return int */ - function affected_rows() + public function affected_rows() { return @sqlrv_rows_affected($this->conn_id); } @@ -267,31 +258,31 @@ class CI_DB_sqlsrv_driver extends CI_DB { // -------------------------------------------------------------------- /** - * Insert ID - * - * Returns the last id created in the Identity column. - * - * @access public - * @return integer - */ - function insert_id() + * Insert ID + * + * Returns the last id created in the Identity column. + * + * @return string + */ + public function insert_id() { - return $this->query('select @@IDENTITY as insert_id')->row('insert_id'); + $query = $this->query('SELECT @@IDENTITY AS insert_id'); + $query = $query->row(); + return $query->insert_id; } // -------------------------------------------------------------------- /** - * Parse major version - * - * Grabs the major version number from the - * database server version string passed in. - * - * @access private - * @param string $version - * @return int16 major version number - */ - function _parse_major_version($version) + * Parse major version + * + * Grabs the major version number from the + * database server version string passed in. + * + * @param string $version + * @return int major version number + */ + protected function _parse_major_version($version) { preg_match('/([0-9]+)\.([0-9]+)\.([0-9]+)/', $version, $ver_info); return $ver_info[1]; // return the major version b/c that's all we're interested in. @@ -327,23 +318,25 @@ class CI_DB_sqlsrv_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * - * @access public * @param string - * @return string + * @return int */ - function count_all($table = '') + public function count_all($table = '') { if ($table == '') - return '0'; - + { + return 0; + } + $query = $this->query("SELECT COUNT(*) AS numrows FROM " . $this->dbprefix . $table); - if ($query->num_rows() == 0) - return '0'; + { + return 0; + } $row = $query->row(); $this->_reset_select(); - return $row->numrows; + return (int) $row->numrows; } // -------------------------------------------------------------------- @@ -353,11 +346,10 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access private - * @param boolean + * @param bool * @return string */ - function _list_tables($prefix_limit = FALSE) + protected function _list_tables($prefix_limit = FALSE) { return "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name"; } @@ -369,13 +361,12 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @access private * @param string the table name * @return string */ - function _list_columns($table = '') + protected function _list_columns($table = '') { - return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$this->_escape_table($table)."'"; + return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$table."'"; } // -------------------------------------------------------------------- @@ -385,13 +376,12 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * - * @access public * @param string the table name - * @return object + * @return string */ - function _field_data($table) + protected function _field_data($table) { - return "SELECT TOP 1 * FROM " . $this->_escape_table($table); + return 'SELECT TOP 1 * FROM '.$table; } // -------------------------------------------------------------------- @@ -434,32 +424,15 @@ class CI_DB_sqlsrv_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Escape Table Name - * - * This function adds backticks if the table name has a period - * in it. Some DBs will get cranky unless periods are escaped - * - * @access private - * @param string the table name - * @return string - */ - function _escape_table($table) - { - return $table; - } - - /** * Escape the SQL Identifiers * * This function escapes column and table names * - * @access private * @param string * @return string */ - function _escape_identifiers($item) + public function _escape_identifiers($item) { return $item; } @@ -472,11 +445,10 @@ class CI_DB_sqlsrv_driver extends CI_DB { * This function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @access public - * @param type - * @return type + * @param array + * @return string */ - function _from_tables($tables) + protected function _from_tables($tables) { if ( ! is_array($tables)) { @@ -493,15 +465,14 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - function _insert($table, $keys, $values) - { - return "INSERT INTO ".$this->_escape_table($table)." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; + protected function _insert($table, $keys, $values) + { + return 'INSERT INTO '.$table.' ('.implode(', ', $keys).') VALUES ('.implode(', ', $values).')'; } // -------------------------------------------------------------------- @@ -511,7 +482,6 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * - * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -519,16 +489,16 @@ class CI_DB_sqlsrv_driver extends CI_DB { * @param array the limit clause * @return string */ - function _update($table, $values, $where) + protected function _update($table, $values, $where) { foreach($values as $key => $val) { $valstr[] = $key." = ".$val; } - - return "UPDATE ".$this->_escape_table($table)." SET ".implode(', ', $valstr)." WHERE ".implode(" ", $where); + + return 'UPDATE '.$table.' SET '.implode(', ', $valstr).' WHERE '.implode(' ', $where); } - + // -------------------------------------------------------------------- /** @@ -538,11 +508,10 @@ class CI_DB_sqlsrv_driver extends CI_DB { * If the database does not support the truncate() command * This function maps to "DELETE FROM table" * - * @access public * @param string the table name * @return string */ - function _truncate($table) + protected function _truncate($table) { return "TRUNCATE ".$table; } @@ -554,15 +523,14 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * - * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - function _delete($table, $where) + protected function _delete($table, $where) { - return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where); + return 'DELETE FROM '.$table.' WHERE '.implode(' ', $where); } // -------------------------------------------------------------------- @@ -572,17 +540,14 @@ class CI_DB_sqlsrv_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * - * @access public * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value + * @param int the number of rows to limit the query to + * @param int the offset value * @return string */ - function _limit($sql, $limit, $offset) + protected function _limit($sql, $limit, $offset) { - $i = $limit + $offset; - - return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.$i.' ', $sql); + return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.($limit + $offset).' ', $sql); } // -------------------------------------------------------------------- @@ -590,16 +555,15 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Close DB Connection * - * @access public * @param resource * @return void */ - function _close($conn_id) + protected function _close($conn_id) { @sqlsrv_close($conn_id); } } -/* End of file mssql_driver.php */ -/* Location: ./system/database/drivers/mssql/mssql_driver.php */ \ No newline at end of file +/* End of file sqlsrv_driver.php */ +/* Location: ./system/database/drivers/sqlsrv/sqlsrv_driver.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 9659bd5bca64832598be7f8c9528c401ca139ea8 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 16:27:47 +0200 Subject: Visibility declarations and cleanup for CI_DB_sqlsrv_result --- system/database/drivers/sqlsrv/sqlsrv_result.php | 55 ++++++++++-------------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/system/database/drivers/sqlsrv/sqlsrv_result.php b/system/database/drivers/sqlsrv/sqlsrv_result.php index d980f98ff..10d790e4b 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_result.php +++ b/system/database/drivers/sqlsrv/sqlsrv_result.php @@ -1,13 +1,13 @@ -result_id); } @@ -54,10 +51,9 @@ class CI_DB_sqlsrv_result extends CI_DB_result { /** * Number of fields in the result set * - * @access public - * @return integer + * @return int */ - function num_fields() + public function num_fields() { return @sqlsrv_num_fields($this->result_id); } @@ -69,17 +65,16 @@ class CI_DB_sqlsrv_result extends CI_DB_result { * * Generates an array of column names * - * @access public * @return array */ - function list_fields() + public function list_fields() { $field_names = array(); - foreach(sqlsrv_field_metadata($this->result_id) as $offset => $field) + foreach (sqlsrv_field_metadata($this->result_id) as $offset => $field) { $field_names[] = $field['Name']; } - + return $field_names; } @@ -90,13 +85,12 @@ class CI_DB_sqlsrv_result extends CI_DB_result { * * Generates an array of objects containing field meta-data * - * @access public * @return array */ - function field_data() + public function field_data() { $retval = array(); - foreach(sqlsrv_field_metadata($this->result_id) as $offset => $field) + foreach (sqlsrv_field_metadata($this->result_id) as $offset => $field) { $F = new stdClass(); $F->name = $field['Name']; @@ -104,10 +98,10 @@ class CI_DB_sqlsrv_result extends CI_DB_result { $F->max_length = $field['Size']; $F->primary_key = 0; $F->default = ''; - + $retval[] = $F; } - + return $retval; } @@ -116,9 +110,9 @@ class CI_DB_sqlsrv_result extends CI_DB_result { /** * Free the result * - * @return null + * @return void */ - function free_result() + public function free_result() { if (is_resource($this->result_id)) { @@ -132,14 +126,13 @@ class CI_DB_sqlsrv_result extends CI_DB_result { /** * Data Seek * - * Moves the internal pointer to the desired offset. We call + * Moves the internal pointer to the desired offset. We call * this internally before fetching results to make sure the * result set starts at zero * - * @access private - * @return array + * @return void */ - function _data_seek($n = 0) + protected function _data_seek($n = 0) { // Not implemented } @@ -151,10 +144,9 @@ class CI_DB_sqlsrv_result extends CI_DB_result { * * Returns the result set as an array * - * @access private * @return array */ - function _fetch_assoc() + protected function _fetch_assoc() { return sqlsrv_fetch_array($this->result_id, SQLSRV_FETCH_ASSOC); } @@ -166,15 +158,14 @@ class CI_DB_sqlsrv_result extends CI_DB_result { * * Returns the result set as an object * - * @access private * @return object */ - function _fetch_object() + protected function _fetch_object() { return sqlsrv_fetch_object($this->result_id); } } -/* End of file mssql_result.php */ -/* Location: ./system/database/drivers/mssql/mssql_result.php */ \ No newline at end of file +/* End of file sqlsrv_result.php */ +/* Location: ./system/database/drivers/sqlsrv/sqlsrv_result.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 4d1167149a9bad94bdc6a6947525d4c610f0e3aa Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 16:30:57 +0200 Subject: Visibility declarations and cleanup for SQLSRV forge and utility classes --- system/database/drivers/sqlsrv/sqlsrv_forge.php | 36 +++++++++-------------- system/database/drivers/sqlsrv/sqlsrv_utility.php | 30 ++++++++----------- 2 files changed, 26 insertions(+), 40 deletions(-) diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php index 0a276e172..0dc7b5242 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_forge.php +++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php @@ -1,13 +1,13 @@ -db->_escape_identifiers($table); } @@ -80,15 +75,14 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { /** * Create Table * - * @access private * @param string the table name * @param array the fields * @param mixed primary key(s) * @param mixed key(s) - * @param boolean should 'IF NOT EXISTS' be added to the SQL + * @param bool should 'IF NOT EXISTS' be added to the SQL * @return bool */ - function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -100,7 +94,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { $sql .= $this->db->_escape_identifiers($table)." ("; $current_field_count = 0; - foreach ($fields as $field=>$attributes) + foreach ($fields as $field => $attributes) { // Numeric field names aren't allowed in databases, so if the key is // numeric, we know it was assigned by PHP and the developer manually @@ -190,17 +184,16 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * - * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name * @param string the column definition * @param string the default value - * @param boolean should 'NOT NULL' be added + * @param bool should 'NOT NULL' be added * @param string the field after which we should add the new field - * @return object + * @return string */ - function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + public function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -242,12 +235,11 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * - * @access private * @param string the old table name * @param string the new table name * @return string */ - function _rename_table($table_name, $new_table_name) + public function _rename_table($table_name, $new_table_name) { // I think this syntax will work, but can find little documentation on renaming tables in MSSQL return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); diff --git a/system/database/drivers/sqlsrv/sqlsrv_utility.php b/system/database/drivers/sqlsrv/sqlsrv_utility.php index 44e6fafeb..5830c62de 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_utility.php +++ b/system/database/drivers/sqlsrv/sqlsrv_utility.php @@ -1,13 +1,13 @@ -db->display_error('db_unsuported_feature'); @@ -96,5 +90,5 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility { } -/* End of file mssql_utility.php */ -/* Location: ./system/database/drivers/mssql/mssql_utility.php */ \ No newline at end of file +/* End of file sqlsrv_utility.php */ +/* Location: ./system/database/drivers/sqlsrv/sqlsrv_utility.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 979b5280f98a962dd83a5b8923edd4eef224ce74 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 16:45:39 +0200 Subject: Visibility declarations and cleanup for CI_DB_sqlite_driver --- system/database/drivers/sqlite/sqlite_driver.php | 109 +++++++++-------------- 1 file changed, 41 insertions(+), 68 deletions(-) diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index de72b5454..bb86c2296 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -1,13 +1,13 @@ -database, FILE_WRITE_MODE, $error)) { @@ -87,10 +84,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Persistent database connection * - * @access private called by the base class * @return resource */ - function db_pconnect() + public function db_pconnect() { if ( ! $conn_id = @sqlite_popen($this->database, FILE_WRITE_MODE, $error)) { @@ -115,10 +111,9 @@ class CI_DB_sqlite_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * - * @access public * @return void */ - function reconnect() + public function reconnect() { // not implemented in SQLite } @@ -128,10 +123,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Select the database * - * @access private called by the base class * @return resource */ - function db_select() + public function db_select() { return TRUE; } @@ -155,11 +149,10 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Execute the query * - * @access private called by the base class * @param string an SQL query * @return resource */ - function _execute($sql) + protected function _execute($sql) { return @sqlite_query($this->conn_id, $sql); } @@ -169,10 +162,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Begin Transaction * - * @access public * @return bool */ - function trans_begin($test_mode = FALSE) + public function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -199,10 +191,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Commit Transaction * - * @access public * @return bool */ - function trans_commit() + public function trans_commit() { if ( ! $this->trans_enabled) { @@ -224,10 +215,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Rollback Transaction * - * @access public * @return bool */ - function trans_rollback() + public function trans_rollback() { if ( ! $this->trans_enabled) { @@ -249,12 +239,11 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Escape String * - * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - function escape_str($str, $like = FALSE) + public function escape_str($str, $like = FALSE) { if (is_array($str)) { @@ -284,10 +273,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Affected Rows * - * @access public - * @return integer + * @return int */ - function affected_rows() + public function affected_rows() { return sqlite_changes($this->conn_id); } @@ -297,10 +285,9 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Insert ID * - * @access public - * @return integer + * @return int */ - function insert_id() + public function insert_id() { return @sqlite_last_insert_rowid($this->conn_id); } @@ -313,11 +300,10 @@ class CI_DB_sqlite_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * - * @access public * @param string * @return string */ - function count_all($table = '') + public function count_all($table = '') { if ($table == '') { @@ -342,11 +328,10 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access private - * @param boolean + * @param bool * @return string */ - function _list_tables($prefix_limit = FALSE) + protected function _list_tables($prefix_limit = FALSE) { $sql = "SELECT name from sqlite_master WHERE type='table'"; @@ -364,11 +349,10 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @access public * @param string the table name - * @return string + * @return bool */ - function _list_columns($table = '') + protected function _list_columns($table = '') { // Not supported return FALSE; @@ -381,11 +365,10 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * - * @access public * @param string the table name - * @return object + * @return string */ - function _field_data($table) + protected function _field_data($table) { return "SELECT * FROM ".$table." LIMIT 1"; } @@ -414,11 +397,10 @@ class CI_DB_sqlite_driver extends CI_DB { * * This function escapes column and table names * - * @access private * @param string * @return string */ - function _escape_identifiers($item) + public function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -457,11 +439,10 @@ class CI_DB_sqlite_driver extends CI_DB { * This function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @access public - * @param type - * @return type + * @param array + * @return string */ - function _from_tables($tables) + protected function _from_tables($tables) { if ( ! is_array($tables)) { @@ -478,13 +459,12 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - function _insert($table, $keys, $values) + protected function _insert($table, $keys, $values) { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } @@ -496,7 +476,6 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * - * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -504,7 +483,7 @@ class CI_DB_sqlite_driver extends CI_DB { * @param array the limit clause * @return string */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + protected function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -534,11 +513,10 @@ class CI_DB_sqlite_driver extends CI_DB { * If the database does not support the truncate() command * This function maps to "DELETE FROM table" * - * @access public * @param string the table name * @return string */ - function _truncate($table) + protected function _truncate($table) { return $this->_delete($table); } @@ -550,13 +528,12 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * - * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) + protected function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -584,13 +561,12 @@ class CI_DB_sqlite_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * - * @access public * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value + * @param int the number of rows to limit the query to + * @param int the offset value * @return string */ - function _limit($sql, $limit, $offset) + protected function _limit($sql, $limit, $offset) { if ($offset == 0) { @@ -609,18 +585,15 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Close DB Connection * - * @access public * @param resource * @return void */ - function _close($conn_id) + protected function _close($conn_id) { @sqlite_close($conn_id); } - } - /* End of file sqlite_driver.php */ /* Location: ./system/database/drivers/sqlite/sqlite_driver.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From f4ebb0e3e81b64e0287ce1627960850adb013f6f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 16:52:56 +0200 Subject: Visibility declarations and cleanup for CI_DB_sqlite_result --- system/database/drivers/sqlite/sqlite_result.php | 40 +++++++++--------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php index ac2235cbc..b002aeff1 100644 --- a/system/database/drivers/sqlite/sqlite_result.php +++ b/system/database/drivers/sqlite/sqlite_result.php @@ -1,13 +1,13 @@ -result_id); } @@ -54,10 +51,9 @@ class CI_DB_sqlite_result extends CI_DB_result { /** * Number of fields in the result set * - * @access public - * @return integer + * @return int */ - function num_fields() + public function num_fields() { return @sqlite_num_fields($this->result_id); } @@ -69,10 +65,9 @@ class CI_DB_sqlite_result extends CI_DB_result { * * Generates an array of column names * - * @access public * @return array */ - function list_fields() + public function list_fields() { $field_names = array(); for ($i = 0; $i < $this->num_fields(); $i++) @@ -90,10 +85,9 @@ class CI_DB_sqlite_result extends CI_DB_result { * * Generates an array of objects containing field meta-data * - * @access public * @return array */ - function field_data() + public function field_data() { $retval = array(); for ($i = 0; $i < $this->num_fields(); $i++) @@ -116,9 +110,9 @@ class CI_DB_sqlite_result extends CI_DB_result { /** * Free the result * - * @return null + * @return void */ - function free_result() + public function free_result() { // Not implemented in SQLite } @@ -128,14 +122,13 @@ class CI_DB_sqlite_result extends CI_DB_result { /** * Data Seek * - * Moves the internal pointer to the desired offset. We call + * Moves the internal pointer to the desired offset. We call * this internally before fetching results to make sure the * result set starts at zero * - * @access private * @return array */ - function _data_seek($n = 0) + protected function _data_seek($n = 0) { return sqlite_seek($this->result_id, $n); } @@ -147,10 +140,9 @@ class CI_DB_sqlite_result extends CI_DB_result { * * Returns the result set as an array * - * @access private * @return array */ - function _fetch_assoc() + protected function _fetch_assoc() { return sqlite_fetch_array($this->result_id); } @@ -162,10 +154,9 @@ class CI_DB_sqlite_result extends CI_DB_result { * * Returns the result set as an object * - * @access private * @return object */ - function _fetch_object() + protected function _fetch_object() { if (function_exists('sqlite_fetch_object')) { @@ -186,6 +177,5 @@ class CI_DB_sqlite_result extends CI_DB_result { } - /* End of file sqlite_result.php */ /* Location: ./system/database/drivers/sqlite/sqlite_result.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 8480f7c35af9aacaf2ebee43677ff1d31a5cce13 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 16:55:05 +0200 Subject: Visibility declarations and cleanup for CI_DB_sqlite_forge --- system/database/drivers/sqlite/sqlite_forge.php | 35 +++++++++---------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php index 26d0d94bf..068a556ed 100644 --- a/system/database/drivers/sqlite/sqlite_forge.php +++ b/system/database/drivers/sqlite/sqlite_forge.php @@ -1,13 +1,13 @@ -db->database) OR ! @unlink($this->db->database)) { @@ -71,20 +67,20 @@ class CI_DB_sqlite_forge extends CI_DB_forge { } return TRUE; } + // -------------------------------------------------------------------- /** * Create Table * - * @access private * @param string the table name * @param array the fields * @param mixed primary key(s) * @param mixed key(s) - * @param boolean should 'IF NOT EXISTS' be added to the SQL + * @param bool should 'IF NOT EXISTS' be added to the SQL * @return bool */ - function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { $sql = 'CREATE TABLE '; @@ -184,12 +180,9 @@ class CI_DB_sqlite_forge extends CI_DB_forge { /** * Drop Table * - * Unsupported feature in SQLite - * - * @access private * @return bool */ - function _drop_table($table) + public function _drop_table($table) { if ($this->db->db_debug) { @@ -206,17 +199,16 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * - * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name * @param string the column definition * @param string the default value - * @param boolean should 'NOT NULL' be added + * @param bool should 'NOT NULL' be added * @param string the field after which we should add the new field - * @return object + * @return string */ - function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + public function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -261,12 +253,11 @@ class CI_DB_sqlite_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * - * @access private * @param string the old table name * @param string the new table name * @return string */ - function _rename_table($table_name, $new_table_name) + public function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } -- cgit v1.2.3-24-g4f1b From da123732482727d33cafda557ae3047003592546 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 22:27:40 +0200 Subject: Visibility declarations and cleanup for CI_DB_oci8_driver --- system/database/drivers/oci8/oci8_driver.php | 142 +++++++++++---------------- 1 file changed, 56 insertions(+), 86 deletions(-) diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index e3846bc1a..238a08ff8 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -1,13 +1,13 @@ -stmt_id)) { $this->stmt_id = oci_parse($this->conn_id, $sql); } } - + // -------------------------------------------------------------------- /** - * getCursor. Returns a cursor from the datbase + * Get cursor. Returns a cursor from the database * - * @access public - * @return cursor id + * @return cursor id */ public function get_cursor() { @@ -203,11 +193,10 @@ class CI_DB_oci8_driver extends CI_DB { /** * Stored Procedure. Executes a stored procedure * - * @access public - * @param package package stored procedure is in - * @param procedure stored procedure to execute - * @param params array of parameters - * @return array + * @param string package stored procedure is in + * @param string stored procedure to execute + * @param array parameters + * @return object * * params array keys * @@ -256,10 +245,9 @@ class CI_DB_oci8_driver extends CI_DB { /** * Bind parameters * - * @access private - * @return none + * @return void */ - private function _bind_params($params) + protected function _bind_params($params) { if ( ! is_array($params) OR ! is_resource($this->stmt_id)) { @@ -285,7 +273,6 @@ class CI_DB_oci8_driver extends CI_DB { /** * Begin Transaction * - * @access public * @return bool */ public function trans_begin($test_mode = FALSE) @@ -315,7 +302,6 @@ class CI_DB_oci8_driver extends CI_DB { /** * Commit Transaction * - * @access public * @return bool */ public function trans_commit() @@ -341,7 +327,6 @@ class CI_DB_oci8_driver extends CI_DB { /** * Rollback Transaction * - * @access public * @return bool */ public function trans_rollback() @@ -401,8 +386,7 @@ class CI_DB_oci8_driver extends CI_DB { /** * Affected Rows * - * @access public - * @return integer + * @return int */ public function affected_rows() { @@ -414,8 +398,7 @@ class CI_DB_oci8_driver extends CI_DB { /** * Insert ID * - * @access public - * @return integer + * @return int */ public function insert_id() { @@ -431,9 +414,8 @@ class CI_DB_oci8_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * - * @access public - * @param string - * @return string + * @param string + * @return string */ public function count_all($table = '') { @@ -460,8 +442,7 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access protected - * @param boolean + * @param bool * @return string */ protected function _list_tables($prefix_limit = FALSE) @@ -483,9 +464,8 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @access protected - * @param string the table name - * @return string + * @param string the table name + * @return string */ protected function _list_columns($table = '') { @@ -499,9 +479,8 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * - * @access public - * @param string the table name - * @return object + * @param string the table name + * @return string */ protected function _field_data($table) { @@ -546,11 +525,10 @@ class CI_DB_oci8_driver extends CI_DB { * * This function escapes column and table names * - * @access protected * @param string * @return string */ - protected function _escape_identifiers($item) + public function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -589,9 +567,8 @@ class CI_DB_oci8_driver extends CI_DB { * This function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @access protected - * @param type - * @return type + * @param array + * @return string */ protected function _from_tables($tables) { @@ -610,11 +587,10 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public - * @param string the table name - * @param array the insert keys - * @param array the insert values - * @return string + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string */ protected function _insert($table, $keys, $values) { @@ -628,10 +604,10 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @param string the table name - * @param array the insert keys - * @param array the insert values - * @return string + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string */ protected function _insert_batch($table, $keys, $values) { @@ -655,7 +631,6 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * - * @access protected * @param string the table name * @param array the update data * @param array the where clause @@ -692,7 +667,6 @@ class CI_DB_oci8_driver extends CI_DB { * If the database does not support the truncate() command * This function maps to "DELETE FROM table" * - * @access protected * @param string the table name * @return string */ @@ -708,7 +682,6 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * - * @access protected * @param string the table name * @param array the where clause * @param string the limit clause @@ -742,11 +715,10 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * - * @access protected - * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value - * @return string + * @param string the sql query string + * @param int the number of rows to limit the query to + * @param int the offset value + * @return string */ protected function _limit($sql, $limit, $offset) { @@ -769,16 +741,14 @@ class CI_DB_oci8_driver extends CI_DB { /** * Close DB Connection * - * @access protected - * @param resource - * @return void + * @param resource + * @return void */ protected function _close($conn_id) { @oci_close($conn_id); } - } /* End of file oci8_driver.php */ -- cgit v1.2.3-24-g4f1b From 2f56fba915e35bcc7a36fbc047503d777decccd5 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 22:32:20 +0200 Subject: Visibility declarations and cleanup for OCI8 result, forge and utility classes --- system/database/drivers/oci8/oci8_forge.php | 27 ++++++++-------------- system/database/drivers/oci8/oci8_result.php | 33 +++++++++------------------ system/database/drivers/oci8/oci8_utility.php | 25 ++++++++------------ 3 files changed, 31 insertions(+), 54 deletions(-) diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php index 0a251998b..8285a29d2 100644 --- a/system/database/drivers/oci8/oci8_forge.php +++ b/system/database/drivers/oci8/oci8_forge.php @@ -1,13 +1,13 @@ -db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -212,12 +206,11 @@ class CI_DB_oci8_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * - * @access private * @param string the old table name * @param string the new table name * @return string */ - function _rename_table($table_name, $new_table_name) + public function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index a14e32eec..c3f775730 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -1,13 +1,13 @@ -db->display_error('db_unsuported_feature'); } + } /* End of file oci8_utility.php */ -- cgit v1.2.3-24-g4f1b From bd44d5a7e12b8eb7f710021f92b6ffd79073cd43 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 22:59:29 +0200 Subject: Visibility declarations and cleanup for CI_DB_pdo_driver --- system/database/drivers/pdo/pdo_driver.php | 186 ++++++++++++----------------- 1 file changed, 77 insertions(+), 109 deletions(-) diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 9b44e7c64..0295b9d56 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -1,13 +1,13 @@ -_like_escape_str = " ESCAPE '%s' "; $this->_like_escape_chr = '!'; } - - $this->trans_enabled = FALSE; + + $this->trans_enabled = FALSE; $this->_random_keyword = ' RND('.time().')'; // database specific random keyword } /** * Connection String * - * @access private * @param array * @return void */ - function _connect_string($params) + protected function _connect_string($params) { if (strpos($this->hostname, ':')) { @@ -138,7 +135,7 @@ class CI_DB_pdo_driver extends CI_DB { $this->dsn = $this->pdodriver.':'; // Add hostname to the DSN for databases that need it - if ( ! empty($this->hostname) + if ( ! empty($this->hostname) && strpos($this->hostname, ':') === FALSE && in_array($this->pdodriver, array('informix', 'mysql', 'pgsql', 'sybase', 'mssql', 'dblib', 'cubrid'))) { @@ -153,7 +150,7 @@ class CI_DB_pdo_driver extends CI_DB { } // Add the database name to the DSN, if needed - if (stripos($this->dsn, 'dbname') === FALSE + if (stripos($this->dsn, 'dbname') === FALSE && in_array($this->pdodriver, array('4D', 'pgsql', 'mysql', 'firebird', 'sybase', 'mssql', 'dblib', 'cubrid'))) { $this->dsn .= 'dbname='.$this->database.';'; @@ -190,10 +187,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Non-persistent database connection * - * @access private called by the base class - * @return resource + * @return object */ - function db_connect() + public function db_connect() { $this->options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_SILENT; @@ -205,14 +201,13 @@ class CI_DB_pdo_driver extends CI_DB { /** * Persistent database connection * - * @access private called by the base class - * @return resource + * @return object */ - function db_pconnect() + public function db_pconnect() { - $this->options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_SILENT; + $this->options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_SILENT; $this->options[PDO::ATTR_PERSISTENT] = TRUE; - + return $this->pdo_connect(); } @@ -221,23 +216,22 @@ class CI_DB_pdo_driver extends CI_DB { /** * PDO connection * - * @access private called by the PDO driver class - * @return resource + * @return object */ - function pdo_connect() + public function pdo_connect() { // Refer : http://php.net/manual/en/ref.pdo-mysql.connection.php - if ($this->pdodriver == 'mysql' && is_php('5.3.6')) + if ($this->pdodriver === 'mysql' && ! is_php('5.3.6')) { $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES $this->char_set COLLATE '$this->dbcollat'"; } // Connecting... - try + try { $db = new PDO($this->dsn, $this->username, $this->password, $this->options); - } - catch (PDOException $e) + } + catch (PDOException $e) { if ($this->db_debug && empty($this->failover)) { @@ -258,10 +252,9 @@ class CI_DB_pdo_driver extends CI_DB { * Keep / reestablish the db connection if no queries have been * sent for a length of time exceeding the server's idle timeout * - * @access public * @return void */ - function reconnect() + public function reconnect() { if ($this->db->db_debug) { @@ -276,10 +269,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Select the database * - * @access private called by the base class * @return resource */ - function db_select() + public function db_select() { // Not needed for PDO return TRUE; @@ -304,16 +296,15 @@ class CI_DB_pdo_driver extends CI_DB { /** * Execute the query * - * @access private called by the base class * @param string an SQL query - * @return object + * @return mixed */ - function _execute($sql) + protected function _execute($sql) { $sql = $this->_prep_query($sql); $result_id = $this->conn_id->query($sql); - + if (is_object($result_id)) { $this->affect_rows = $result_id->rowCount(); @@ -322,7 +313,7 @@ class CI_DB_pdo_driver extends CI_DB { { $this->affect_rows = 0; } - + return $result_id; } @@ -333,11 +324,10 @@ class CI_DB_pdo_driver extends CI_DB { * * If needed, each database adapter can prep the query string * - * @access private called by execute() * @param string an SQL query * @return string */ - function _prep_query($sql) + protected function _prep_query($sql) { if ($this->pdodriver === 'pgsql') { @@ -358,10 +348,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Begin Transaction * - * @access public * @return bool */ - function trans_begin($test_mode = FALSE) + public function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -387,10 +376,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Commit Transaction * - * @access public * @return bool */ - function trans_commit() + public function trans_commit() { if ( ! $this->trans_enabled) { @@ -404,7 +392,7 @@ class CI_DB_pdo_driver extends CI_DB { } $ret = $this->conn->commit(); - + return $ret; } @@ -413,10 +401,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Rollback Transaction * - * @access public * @return bool */ - function trans_rollback() + public function trans_rollback() { if ( ! $this->trans_enabled) { @@ -439,12 +426,11 @@ class CI_DB_pdo_driver extends CI_DB { /** * Escape String * - * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ - function escape_str($str, $like = FALSE) + public function escape_str($str, $like = FALSE) { if (is_array($str)) { @@ -455,24 +441,22 @@ class CI_DB_pdo_driver extends CI_DB { return $str; } - + //Escape the string $str = $this->conn_id->quote($str); - + //If there are duplicated quotes, trim them away if (strpos($str, "'") === 0) { $str = substr($str, 1, -1); } - + // escape LIKE condition wildcards if ($like === TRUE) { - $str = str_replace( array('%', '_', $this->_like_escape_chr), - array($this->_like_escape_chr.'%', - $this->_like_escape_chr.'_', - $this->_like_escape_chr.$this->_like_escape_chr), - $str); + return str_replace(array($this->_like_escape_chr, '%', '_'), + array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_'), + $str); } return $str; @@ -483,10 +467,9 @@ class CI_DB_pdo_driver extends CI_DB { /** * Affected Rows * - * @access public - * @return integer + * @return int */ - function affected_rows() + public function affected_rows() { return $this->affect_rows; } @@ -518,7 +501,6 @@ class CI_DB_pdo_driver extends CI_DB { * Generates a platform-specific query string that counts all records in * the specified database * - * @access public * @param string * @return string */ @@ -550,11 +532,10 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access private - * @param boolean + * @param bool * @return string */ - function _list_tables($prefix_limit = FALSE) + protected function _list_tables($prefix_limit = FALSE) { if ($this->pdodriver == 'pgsql') { @@ -573,7 +554,7 @@ class CI_DB_pdo_driver extends CI_DB { if ($prefix_limit !== FALSE AND $this->dbprefix != '') { - return FALSE; + return FALSE; } return $sql; @@ -586,11 +567,10 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @access public * @param string the table name * @return string */ - function _list_columns($table = '') + protected function _list_columns($table = '') { return 'SHOW COLUMNS FROM '.$this->_from_tables($table); } @@ -602,11 +582,10 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific query so that the column data can be retrieved * - * @access public * @param string the table name - * @return object + * @return string */ - function _field_data($table) + protected function _field_data($table) { if ($this->pdodriver == 'mysql' or $this->pdodriver == 'pgsql') { @@ -623,7 +602,7 @@ class CI_DB_pdo_driver extends CI_DB { // Analog function for sqlite return 'PRAGMA table_info('.$this->_from_tables($table).')'; } - + return 'SELECT TOP 1 FROM '.$this->_from_tables($table); } @@ -663,11 +642,10 @@ class CI_DB_pdo_driver extends CI_DB { * * This function escapes column and table names * - * @access private * @param string * @return string */ - function _escape_identifiers($item) + public function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -707,11 +685,10 @@ class CI_DB_pdo_driver extends CI_DB { * This function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @access public - * @param type - * @return type + * @param array + * @return string */ - function _from_tables($tables) + protected function _from_tables($tables) { if ( ! is_array($tables)) { @@ -728,17 +705,16 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - function _insert($table, $keys, $values) + protected function _insert($table, $keys, $values) { return 'INSERT INTO '.$this->_from_tables($table).' ('.implode(', ', $keys).') VALUES ('.implode(', ', $values).')'; } - + // -------------------------------------------------------------------- /** @@ -746,13 +722,12 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public - * @param string the table name - * @param array the insert keys - * @param array the insert values - * @return string + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string */ - function _insert_batch($table, $keys, $values) + protected function _insert_batch($table, $keys, $values) { return 'INSERT INTO '.$this->_from_tables($table).' ('.implode(', ', $keys).') VALUES '.implode(', ', $values); } @@ -764,7 +739,6 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * - * @access public * @param string the table name * @param array the update data * @param array the where clause @@ -772,7 +746,7 @@ class CI_DB_pdo_driver extends CI_DB { * @param array the limit clause * @return string */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + protected function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -788,7 +762,7 @@ class CI_DB_pdo_driver extends CI_DB { return $sql; } - + // -------------------------------------------------------------------- /** @@ -796,13 +770,12 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific batch update string from the supplied data * - * @access public * @param string the table name * @param array the update data * @param array the where clause * @return string */ - function _update_batch($table, $values, $index, $where = NULL) + protected function _update_batch($table, $values, $index, $where = NULL) { $ids = array(); $where = ($where != '' && count($where) >=1) ? implode(" ", $where).' AND ' : ''; @@ -841,7 +814,6 @@ class CI_DB_pdo_driver extends CI_DB { return $sql; } - // -------------------------------------------------------------------- /** @@ -851,11 +823,10 @@ class CI_DB_pdo_driver extends CI_DB { * If the database does not support the truncate() command * This function maps to "DELETE FROM table" * - * @access public * @param string the table name * @return string */ - function _truncate($table) + protected function _truncate($table) { return $this->_delete($table); } @@ -867,13 +838,12 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * - * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) + protected function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -902,13 +872,12 @@ class CI_DB_pdo_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * - * @access public * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value + * @param int the number of rows to limit the query to + * @param int the offset value * @return string */ - function _limit($sql, $limit, $offset) + protected function _limit($sql, $limit, $offset) { if ($this->pdodriver == 'cubrid' OR $this->pdodriver == 'sqlite') { @@ -920,7 +889,7 @@ class CI_DB_pdo_driver extends CI_DB { { $sql .= 'LIMIT '.$limit; $sql .= ($offset > 0) ? ' OFFSET '.$offset : ''; - + return $sql; } } @@ -930,11 +899,10 @@ class CI_DB_pdo_driver extends CI_DB { /** * Close DB Connection * - * @access public * @param resource * @return void */ - function _close($conn_id) + protected function _close($conn_id) { $this->conn_id = null; } -- cgit v1.2.3-24-g4f1b From be22c5bcbea252da8133f5e3a2403f2e6bfcf90a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 23:01:53 +0200 Subject: Visibility declarations and cleanup for CI_DB_pdo_result --- system/database/drivers/pdo/pdo_result.php | 60 +++++++++++++----------------- 1 file changed, 25 insertions(+), 35 deletions(-) diff --git a/system/database/drivers/pdo/pdo_result.php b/system/database/drivers/pdo/pdo_result.php index 384b753da..5bbd85d75 100644 --- a/system/database/drivers/pdo/pdo_result.php +++ b/system/database/drivers/pdo/pdo_result.php @@ -1,13 +1,13 @@ -result_id) OR ! is_object($this->result_id)) { @@ -74,10 +71,9 @@ class CI_DB_pdo_result extends CI_DB_result { /** * Fetch the result handler * - * @access public * @return mixed */ - function result_assoc() + public function result_assoc() { // If the result already fetched before, use that one if (count($this->result_array) > 0 OR $this->is_fetched) @@ -94,7 +90,7 @@ class CI_DB_pdo_result extends CI_DB_result { // Define the method and handler $res_method = '_fetch_'.$type; $res_handler = 'result_'.$type; - + $this->$res_handler = array(); $this->_data_seek(0); @@ -116,10 +112,9 @@ class CI_DB_pdo_result extends CI_DB_result { /** * Number of fields in the result set * - * @access public - * @return integer + * @return int */ - function num_fields() + public function num_fields() { return $this->result_id->columnCount(); } @@ -131,16 +126,15 @@ class CI_DB_pdo_result extends CI_DB_result { * * Generates an array of column names * - * @access public - * @return array + * @return bool */ - function list_fields() + public function list_fields() { if ($this->db->db_debug) { return $this->db->display_error('db_unsuported_feature'); } - + return FALSE; } @@ -151,13 +145,12 @@ class CI_DB_pdo_result extends CI_DB_result { * * Generates an array of objects containing field meta-data * - * @access public * @return array */ - function field_data() + public function field_data() { $data = array(); - + try { if (strpos($this->result_id->queryString, 'PRAGMA') !== FALSE) @@ -173,7 +166,7 @@ class CI_DB_pdo_result extends CI_DB_result { $F->max_length = ( ! empty($matches[2])) ? preg_replace('/[^\d]/', '', $matches[2]) : NULL; $F->primary_key = (int) $field['pk']; $F->pdo_type = NULL; - + $data[] = $F; } } @@ -188,7 +181,7 @@ class CI_DB_pdo_result extends CI_DB_result { $F->type = $field['native_type']; $F->default = NULL; $F->pdo_type = $field['pdo_type']; - + if ($field['precision'] < 0) { $F->max_length = NULL; @@ -203,7 +196,7 @@ class CI_DB_pdo_result extends CI_DB_result { $data[] = $F; } } - + return $data; } catch (Exception $e) @@ -222,9 +215,9 @@ class CI_DB_pdo_result extends CI_DB_result { /** * Free the result * - * @return null + * @return void */ - function free_result() + public function free_result() { if (is_object($this->result_id)) { @@ -237,14 +230,13 @@ class CI_DB_pdo_result extends CI_DB_result { /** * Data Seek * - * Moves the internal pointer to the desired offset. We call + * Moves the internal pointer to the desired offset. We call * this internally before fetching results to make sure the * result set starts at zero * - * @access private - * @return array + * @return bool */ - function _data_seek($n = 0) + protected function _data_seek($n = 0) { return FALSE; } @@ -256,10 +248,9 @@ class CI_DB_pdo_result extends CI_DB_result { * * Returns the result set as an array * - * @access private * @return array */ - function _fetch_assoc() + protected function _fetch_assoc() { return $this->result_id->fetch(PDO::FETCH_ASSOC); } @@ -271,11 +262,10 @@ class CI_DB_pdo_result extends CI_DB_result { * * Returns the result set as an object * - * @access private * @return object */ - function _fetch_object() - { + protected function _fetch_object() + { return $this->result_id->fetchObject(); } -- cgit v1.2.3-24-g4f1b From 9fd79f568beb10194f3de66b14a484c2dddcaa95 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 23:04:13 +0200 Subject: Visibility declarations and cleanup for PDO forge and utility classes --- system/database/drivers/pdo/pdo_forge.php | 32 +++++++++++------------------ system/database/drivers/pdo/pdo_utility.php | 24 ++++++++-------------- 2 files changed, 21 insertions(+), 35 deletions(-) diff --git a/system/database/drivers/pdo/pdo_forge.php b/system/database/drivers/pdo/pdo_forge.php index 2e5c81de3..6bff3542f 100644 --- a/system/database/drivers/pdo/pdo_forge.php +++ b/system/database/drivers/pdo/pdo_forge.php @@ -1,13 +1,13 @@ -db->db_debug) @@ -212,17 +206,16 @@ class CI_DB_pdo_forge extends CI_DB_forge { * Generates a platform-specific query so that a table can be altered * Called by add_column(), drop_column(), and column_alter(), * - * @access private * @param string the ALTER type (ADD, DROP, CHANGE) * @param string the column name * @param string the table name * @param string the column definition * @param string the default value - * @param boolean should 'NOT NULL' be added + * @param bool should 'NOT NULL' be added * @param string the field after which we should add the new field - * @return object + * @return string */ - function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + public function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') { $sql = 'ALTER TABLE `'.$this->db->protect_identifiers($table).'` '.$alter_type.' '.$this->db->protect_identifiers($column_name); @@ -265,12 +258,11 @@ class CI_DB_pdo_forge extends CI_DB_forge { * * Generates a platform-specific query so that a table can be renamed * - * @access private * @param string the old table name * @param string the new table name * @return string */ - function _rename_table($table_name, $new_table_name) + public function _rename_table($table_name, $new_table_name) { return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); } diff --git a/system/database/drivers/pdo/pdo_utility.php b/system/database/drivers/pdo/pdo_utility.php index c278c5172..86c798397 100644 --- a/system/database/drivers/pdo/pdo_utility.php +++ b/system/database/drivers/pdo/pdo_utility.php @@ -1,13 +1,13 @@ -db->db_debug) @@ -59,11 +56,10 @@ class CI_DB_pdo_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be optimized * - * @access private * @param string the table name - * @return object + * @return bool */ - function _optimize_table($table) + public function _optimize_table($table) { // Not a supported PDO feature if ($this->db->db_debug) @@ -80,11 +76,10 @@ class CI_DB_pdo_utility extends CI_DB_utility { * * Generates a platform-specific query so that a table can be repaired * - * @access private * @param string the table name - * @return object + * @return bool */ - function _repair_table($table) + public function _repair_table($table) { // Not a supported PDO feature if ($this->db->db_debug) @@ -99,11 +94,10 @@ class CI_DB_pdo_utility extends CI_DB_utility { /** * PDO Export * - * @access private * @param array Preferences * @return mixed */ - function _backup($params = array()) + public function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); -- cgit v1.2.3-24-g4f1b From 131772cbf8f19bc4f470f5abbdbe3f89125659d3 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 23:35:03 +0200 Subject: Some small improvements to CI_DB_interbase_driver --- .../drivers/interbase/interbase_driver.php | 145 +++++++-------------- 1 file changed, 49 insertions(+), 96 deletions(-) diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php index 9fa03adc7..977a84ecb 100644 --- a/system/database/drivers/interbase/interbase_driver.php +++ b/system/database/drivers/interbase/interbase_driver.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * Firebird/Interbase Database Adapter Class * @@ -56,8 +54,8 @@ class CI_DB_interbase_driver extends CI_DB { * database engines, so this string appears in each driver and is * used for the count_all() and count_all_results() functions. */ - protected $_count_string = "SELECT COUNT(*) AS "; - protected $_random_keyword = ' Random()'; // database specific random keyword + protected $_count_string = 'SELECT COUNT(*) AS '; + protected $_random_keyword = ' Random()'; // database specific random keyword // Keeps track of the resource for the current transaction protected $trans; @@ -160,13 +158,8 @@ class CI_DB_interbase_driver extends CI_DB { */ public function trans_begin($test_mode = FALSE) { - if ( ! $this->trans_enabled) - { - return TRUE; - } - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) + if ( ! $this->trans_enabled OR $this->_trans_depth > 0) { return TRUE; } @@ -174,7 +167,7 @@ class CI_DB_interbase_driver extends CI_DB { // Reset the transaction failure flag. // If the $test_mode flag is set to TRUE transactions will be rolled back // even if the queries produce a successful result. - $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; + $this->_trans_failure = ($test_mode === TRUE); $this->trans = @ibase_trans($this->conn_id); @@ -190,13 +183,8 @@ class CI_DB_interbase_driver extends CI_DB { */ public function trans_commit() { - if ( ! $this->trans_enabled) - { - return TRUE; - } - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) + if ( ! $this->trans_enabled OR $this->_trans->depth > 0) { return TRUE; } @@ -213,13 +201,8 @@ class CI_DB_interbase_driver extends CI_DB { */ public function trans_rollback() { - if ( ! $this->trans_enabled) - { - return TRUE; - } - // When transactions are nested we only begin/commit/rollback the outermost ones - if ($this->_trans_depth > 0) + if ( ! $this->trans_enabled OR $this->_trans_depth > 0) { return TRUE; } @@ -251,9 +234,9 @@ class CI_DB_interbase_driver extends CI_DB { // escape LIKE condition wildcards if ($like === TRUE) { - $str = str_replace( array('%', '_', $this->_like_escape_chr), - array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), - $str); + return str_replace(array($this->_like_escape_chr, '%', '_'), + array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_'), + $str); } return $str; @@ -264,7 +247,7 @@ class CI_DB_interbase_driver extends CI_DB { /** * Affected Rows * - * @return integer + * @return int */ public function affected_rows() { @@ -276,9 +259,9 @@ class CI_DB_interbase_driver extends CI_DB { /** * Insert ID * - * @param string $generator_name - * @param integer $inc_by - * @return integer + * @param string $generator_name + * @param int $inc_by + * @return int */ public function insert_id($generator_name, $inc_by=0) { @@ -310,9 +293,9 @@ class CI_DB_interbase_driver extends CI_DB { return 0; } - $row = $query->row(); + $query = $query->row(); $this->_reset_select(); - return (int) $row->numrows; + return (int) $query->numrows; } // -------------------------------------------------------------------- @@ -322,21 +305,18 @@ class CI_DB_interbase_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @param boolean + * @param bool * @return string */ protected function _list_tables($prefix_limit = FALSE) { - $sql = <<dbprefix != '') + if ($prefix_limit !== FALSE && $this->dbprefix != '') { - $sql .= ' AND "RDB$RELATION_NAME" LIKE \''.$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr); + return $sql.' AND "RDB$RELATION_NAME" LIKE \''.$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr); } + return $sql; } @@ -352,10 +332,7 @@ SQL; */ protected function _list_columns($table = '') { - return <<escape_str($table)."'"; } // -------------------------------------------------------------------- @@ -366,14 +343,14 @@ SQL; * Generates a platform-specific query so that the column data can be retrieved * * @param string the table name - * @return object + * @return string */ protected function _field_data($table) { // Need to find a more efficient way to do this // but Interbase/Firebird seems to lack the // limit clause - return "SELECT * FROM {$table}"; + return 'SELECT * FROM '.$table; } // -------------------------------------------------------------------- @@ -407,24 +384,20 @@ SQL; { if (strpos($item, '.'.$id) !== FALSE) { - $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item); + $item = str_replace('.', $this->_escape_char.'.', $item); // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); + return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $this->_escape_char.$item); } } if (strpos($item, '.') !== FALSE) { - $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; - } - else - { - $str = $this->_escape_char.$item.$this->_escape_char; + $item = str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item); } // remove duplicates if the user already included the escape - return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); + return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $this->_escape_char.$item.$this->_escape_char); } // -------------------------------------------------------------------- @@ -435,8 +408,8 @@ SQL; * This public function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @param type - * @return type + * @param array + * @return string */ protected function _from_tables($tables) { @@ -463,7 +436,7 @@ SQL; */ protected function _insert($table, $keys, $values) { - return "INSERT INTO {$table} (".implode(', ', $keys).') VALUES ('.implode(', ', $values).')'; + return 'INSERT INTO '.$table.' ('.implode(', ', $keys).') VALUES ('.implode(', ', $values).')'; } // -------------------------------------------------------------------- @@ -484,20 +457,14 @@ SQL; { foreach ($values as $key => $val) { - $valstr[] = $key." = ".$val; + $valstr[] = $key.' = '.$val; } //$limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; - - $sql = "UPDATE {$table} SET ".implode(', ', $valstr); - - $sql .= ($where != '' AND count($where) >=1) ? ' WHERE '.implode(' ', $where) : ''; - - $sql .= $orderby; - - return $sql; + return 'UPDATE '.$table.' SET '.implode(', ', $valstr) + .(($where != '' && count($where) > 0) ? ' WHERE '.implode(' ', $where) : '') + .(count($orderby) > 0 ? ' ORDER BY '.implode(', ', $orderby) : ''); } @@ -532,23 +499,20 @@ SQL; */ protected function _delete($table, $where = array(), $like = array(), $limit = FALSE) { - $conditions = ''; - if (count($where) > 0 OR count($like) > 0) { - $conditions = "\nWHERE "; - $conditions .= implode("\n", $this->ar_where); - - if (count($where) > 0 && count($like) > 0) - { - $conditions .= ' AND '; - } - $conditions .= implode("\n", $like); + $conditions = "\nWHERE ".implode("\n", $where) + .((count($where) > 0 && count($like) > 0) ? ' AND ' : '') + .implode("\n", $like); + } + else + { + $conditions = ''; } //$limit = ( ! $limit) ? '' : ' LIMIT '.$limit; - return "DELETE FROM {$table}{$conditions}"; + return 'DELETE FROM '.$table.' '.$conditions; } // -------------------------------------------------------------------- @@ -559,36 +523,25 @@ SQL; * Generates a platform-specific LIMIT clause * * @param string the sql query string - * @param integer the number of rows to limit the query to - * @param integer the offset value + * @param int the number of rows to limit the query to + * @param int the offset value * @return string */ protected function _limit($sql, $limit, $offset) { - // Keep the current sql string safe for a moment - $orig_sql = $sql; - // Limit clause depends on if Interbase or Firebird if (stripos($this->version(), 'firebird') !== FALSE) { - $sql = 'FIRST '. (int) $limit; - - if ($offset > 0) - { - $sql .= ' SKIP '. (int) $offset; - } + $select = 'FIRST '. (int) $limit + .($offset > 0 ? ' SKIP '. (int) $offset : ''); } else { - $sql = 'ROWS ' . (int) $limit; - - if ($offset > 0) - { - $sql = 'ROWS '. (int) $offset . ' TO ' . ($limit + $offset); - } + $select = 'ROWS ' + .($offset > 0 ? (int) $offset.' TO '.($limit + $offset) : (int) $limit); } - return preg_replace('`SELECT`i', "SELECT {$sql}", $orig_sql); + return preg_replace('`SELECT`i', 'SELECT '.$select, $sql); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 60c9c9990f635309965929e73d0bfe52d46253ca Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Mar 2012 23:46:09 +0200 Subject: Some small improvements to CI_DB_interbase_result --- .../drivers/interbase/interbase_driver.php | 2 +- .../drivers/interbase/interbase_result.php | 85 +++++++++------------- 2 files changed, 35 insertions(+), 52 deletions(-) diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php index 977a84ecb..326841dc2 100644 --- a/system/database/drivers/interbase/interbase_driver.php +++ b/system/database/drivers/interbase/interbase_driver.php @@ -310,7 +310,7 @@ class CI_DB_interbase_driver extends CI_DB { */ protected function _list_tables($prefix_limit = FALSE) { - $sql = 'SELECT "RDB$RELATION_NAME" FROM "RDB\$RELATIONS" WHERE "RDB$RELATION_NAME" NOT LIKE \'RDB$%\' AND "RDB$RELATION_NAME" NOT LIKE \'MON$%\''; + $sql = 'SELECT "RDB$RELATION_NAME" FROM "RDB$RELATIONS" WHERE "RDB$RELATION_NAME" NOT LIKE \'RDB$%\' AND "RDB$RELATION_NAME" NOT LIKE \'MON$%\''; if ($prefix_limit !== FALSE && $this->dbprefix != '') { diff --git a/system/database/drivers/interbase/interbase_result.php b/system/database/drivers/interbase/interbase_result.php index 5bf0c902d..fd4178dec 100644 --- a/system/database/drivers/interbase/interbase_result.php +++ b/system/database/drivers/interbase/interbase_result.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * Interbase/Firebird Result Class * @@ -43,18 +41,18 @@ class CI_DB_interbase_result extends CI_DB_result { /** * Number of rows in the result set * - * @return integer + * @return int */ public function num_rows() { - if( ! is_null($this->num_rows)) + if (is_int($this->num_rows)) { return $this->num_rows; } - - //Get the results so that you can get an accurate rowcount + + // Get the results so that you can get an accurate rowcount $this->result(); - + return $this->num_rows; } @@ -63,7 +61,7 @@ class CI_DB_interbase_result extends CI_DB_result { /** * Number of fields in the result set * - * @return integer + * @return int */ public function num_fields() { @@ -102,20 +100,17 @@ class CI_DB_interbase_result extends CI_DB_result { */ public function field_data() { - $retval = array(); - for ($i = 0, $num_fields = $this->num_fields(); $i < $num_fields; $i++) + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) { $info = ibase_field_info($this->result_id, $i); - - $F = new stdClass(); - $F->name = $info['name']; - $F->type = $info['type']; - $F->max_length = $info['length']; - $F->primary_key = 0; - $F->default = ''; - - $retval[] = $F; + + $retval[$i] = new stdClass(); + $retval[$i]->name = $info['name']; + $retval[$i]->type = $info['type']; + $retval[$i]->max_length = $info['length']; + $retval[$i]->primary_key = 0; + $retval[$i]->default = ''; } return $retval; @@ -126,7 +121,7 @@ class CI_DB_interbase_result extends CI_DB_result { /** * Free the result * - * @return null + * @return void */ public function free_result() { @@ -138,7 +133,7 @@ class CI_DB_interbase_result extends CI_DB_result { /** * Data Seek * - * Moves the internal pointer to the desired offset. We call + * Moves the internal pointer to the desired offset. We call * this internally before fetching results to make sure the * result set starts at zero * @@ -146,11 +141,8 @@ class CI_DB_interbase_result extends CI_DB_result { */ protected function _data_seek($n = 0) { - //Set the row count to 0 - $this->num_rows = 0; - - //Interbase driver doesn't implement a suitable function - return FALSE; + // Interbase driver doesn't implement a suitable function + return FALSE; } // -------------------------------------------------------------------- @@ -169,7 +161,7 @@ class CI_DB_interbase_result extends CI_DB_result { //Increment row count $this->num_rows++; } - + return $row; } @@ -189,10 +181,10 @@ class CI_DB_interbase_result extends CI_DB_result { //Increment row count $this->num_rows++; } - + return $row; } - + // -------------------------------------------------------------------- /** @@ -202,29 +194,20 @@ class CI_DB_interbase_result extends CI_DB_result { */ public function result_object() { - if (count($this->result_object) > 0) + if (count($this->result_object) === $this->num_rows) { return $this->result_object; } - - // Convert result array to object so that + + // Convert result array to object so that // We don't have to get the result again - if (count($this->result_array) > 0) + if (($c = count($this->result_array)) > 0) { - $i = 0; - - foreach ($this->result_array as $array) + for ($i = 0; $i < $c; $i++) { - $this->result_object[$i] = new StdClass(); - - foreach ($array as $key => $val) - { - $this->result_object[$i]->{$key} = $val; - } - - ++$i; + $this->result_object[$i] = (object) $this->result_array[$i]; } - + return $this->result_object; } @@ -254,20 +237,20 @@ class CI_DB_interbase_result extends CI_DB_result { */ public function result_array() { - if (count($this->result_array) > 0) + if (count($this->result_array) === $this->num_rows) { return $this->result_array; } - + // Since the object and array are really similar, just case // the result object to an array if need be - if (count($this->result_object) > 0) + if (($c = count($this->result_object)) > 0) { - foreach ($this->result_object as $obj) + for ($i = 0; $i < $c; $i++) { - $this->result_array[] = (array) $obj; + $this->result_array[$i] = (array) $this->result_object[$i]; } - + return $this->result_array; } -- cgit v1.2.3-24-g4f1b From b455294bc404e41a65f8c9260837e76ee1cc9bda Mon Sep 17 00:00:00 2001 From: leandronf Date: Wed, 21 Mar 2012 23:54:26 -0300 Subject: (DSN) Delivery status notification feature --- system/libraries/Email.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index f30fe40b6..d870f9782 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -59,6 +59,7 @@ class CI_Email { public $crlf = "\n"; // The RFC 2045 compliant CRLF for quoted-printable is "\r\n". Apparently some servers, // even on the receiving end think they need to muck with CRLFs, so using "\n", while // distasteful, is the only thing that seems to work for all environments. + var $dsn = FALSE"; // Delivery Status Notification public $send_multipart = TRUE; // TRUE/FALSE - Yahoo does not like multipart alternative, so this is an override. Set to FALSE for Yahoo. public $bcc_batch_mode = FALSE; // TRUE/FALSE - Turns on/off Bcc batch feature public $bcc_batch_size = 200; // If bcc_batch_mode = TRUE, sets max number of Bccs in each batch @@ -1567,9 +1568,11 @@ class CI_Email { $resp = 250; break; case 'to' : - - $this->_send_data('RCPT TO:<'.$data.'>'); - + + if($this->dsn) + $this->_send_data('RCPT TO:<'.$data.'> NOTIFY=SUCCESS,DELAY,FAILURE ORCPT=rfc822;'.$data); + else + $this->_send_data('RCPT TO:<'.$data.'>'); $resp = 250; break; case 'data' : -- cgit v1.2.3-24-g4f1b From 7686c1208cf1b0d9e1f4e522fff8a4b4646b7a2d Mon Sep 17 00:00:00 2001 From: leandronf Date: Thu, 22 Mar 2012 08:07:31 -0300 Subject: Update system/libraries/Email.php --- system/libraries/Email.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index d870f9782..8f383c939 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -59,7 +59,7 @@ class CI_Email { public $crlf = "\n"; // The RFC 2045 compliant CRLF for quoted-printable is "\r\n". Apparently some servers, // even on the receiving end think they need to muck with CRLFs, so using "\n", while // distasteful, is the only thing that seems to work for all environments. - var $dsn = FALSE"; // Delivery Status Notification + public $dsn = FALSE; // Delivery Status Notification public $send_multipart = TRUE; // TRUE/FALSE - Yahoo does not like multipart alternative, so this is an override. Set to FALSE for Yahoo. public $bcc_batch_mode = FALSE; // TRUE/FALSE - Turns on/off Bcc batch feature public $bcc_batch_size = 200; // If bcc_batch_mode = TRUE, sets max number of Bccs in each batch @@ -1569,10 +1569,14 @@ class CI_Email { break; case 'to' : - if($this->dsn) + if ($this->dsn) + { $this->_send_data('RCPT TO:<'.$data.'> NOTIFY=SUCCESS,DELAY,FAILURE ORCPT=rfc822;'.$data); + } else + { $this->_send_data('RCPT TO:<'.$data.'>'); + } $resp = 250; break; case 'data' : -- cgit v1.2.3-24-g4f1b From 603cd2cba9365337bf9e6b7fe4055d22780c0883 Mon Sep 17 00:00:00 2001 From: leandronf Date: Thu, 22 Mar 2012 08:10:37 -0300 Subject: Update user_guide_src/source/changelog.rst --- user_guide_src/source/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index ed0b710c3..f353dbb36 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -100,6 +100,7 @@ Release Date: Not Released - Added function reset_validation() to form validation library, which resets internal validation variables in case of multiple validation routines. - Changed the Session library to select only one row when using database sessions. - Added a Wincache driver to the `Caching Library `. + - Added dsn config setting for Email library. - Core -- cgit v1.2.3-24-g4f1b From d18f552c53e3f55d091054a9dfb82faa989be8c4 Mon Sep 17 00:00:00 2001 From: leandronf Date: Thu, 22 Mar 2012 08:11:58 -0300 Subject: Update user_guide_src/source/libraries/email.rst --- user_guide_src/source/libraries/email.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/libraries/email.rst b/user_guide_src/source/libraries/email.rst index 27b704dae..351b50d06 100644 --- a/user_guide_src/source/libraries/email.rst +++ b/user_guide_src/source/libraries/email.rst @@ -104,6 +104,7 @@ Preference Default Value Options Descript **newline** \\n "\\r\\n" or "\\n" or "\\r" Newline character. (Use "\\r\\n" to comply with RFC 822). **bcc_batch_mode** FALSE TRUE or FALSE (boolean) Enable BCC Batch Mode. **bcc_batch_size** 200 None Number of emails in each BCC batch. +**dsn** FALSE TRUE or FALSE (boolean) Enable notify message from server =================== ====================== ============================ ======================================================================= Email Function Reference -- cgit v1.2.3-24-g4f1b From d576af40ede1bcd38df98a3b06a095bb0af0625e Mon Sep 17 00:00:00 2001 From: leandronf Date: Thu, 22 Mar 2012 19:47:41 -0300 Subject: Update user_guide_src/source/changelog.rst --- user_guide_src/source/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index f353dbb36..44ecf43d2 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -100,7 +100,7 @@ Release Date: Not Released - Added function reset_validation() to form validation library, which resets internal validation variables in case of multiple validation routines. - Changed the Session library to select only one row when using database sessions. - Added a Wincache driver to the `Caching Library `. - - Added dsn config setting for Email library. + - Added dsn (delivery status notification) option to the :doc:`Email Library `. - Core -- cgit v1.2.3-24-g4f1b From be07c9292421e1e18afa8126de35bccdc0fdaaa0 Mon Sep 17 00:00:00 2001 From: leandronf Date: Thu, 22 Mar 2012 19:49:23 -0300 Subject: Update user_guide_src/source/libraries/email.rst --- user_guide_src/source/libraries/email.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/email.rst b/user_guide_src/source/libraries/email.rst index 351b50d06..d7e40f5c4 100644 --- a/user_guide_src/source/libraries/email.rst +++ b/user_guide_src/source/libraries/email.rst @@ -104,7 +104,7 @@ Preference Default Value Options Descript **newline** \\n "\\r\\n" or "\\n" or "\\r" Newline character. (Use "\\r\\n" to comply with RFC 822). **bcc_batch_mode** FALSE TRUE or FALSE (boolean) Enable BCC Batch Mode. **bcc_batch_size** 200 None Number of emails in each BCC batch. -**dsn** FALSE TRUE or FALSE (boolean) Enable notify message from server +**dsn** FALSE TRUE or FALSE (boolean) Enable notify message from server =================== ====================== ============================ ======================================================================= Email Function Reference -- cgit v1.2.3-24-g4f1b From 2cae193647045a83014972d2aae908e7ea0ac8f3 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 23 Mar 2012 16:08:41 +0200 Subject: Add dummy method reconnect() method to CI_DB_driver and remove it from drivers that don't support it --- system/database/DB_driver.php | 17 +++++++++++++++++ .../database/drivers/interbase/interbase_driver.php | 15 --------------- system/database/drivers/mssql/mssql_driver.php | 15 --------------- system/database/drivers/oci8/oci8_driver.php | 16 ---------------- system/database/drivers/odbc/odbc_driver.php | 15 --------------- system/database/drivers/pdo/pdo_driver.php | 20 -------------------- system/database/drivers/sqlite/sqlite_driver.php | 15 --------------- system/database/drivers/sqlsrv/sqlsrv_driver.php | 15 --------------- 8 files changed, 17 insertions(+), 111 deletions(-) diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 42b1b35aa..9f1a0b895 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -170,6 +170,23 @@ abstract class CI_DB_driver { // -------------------------------------------------------------------- + /** + * Reconnect + * + * Keep / reestablish the db connection if no queries have been + * sent for a length of time exceeding the server's idle timeout. + * + * This is just a dummy method to allow drivers without such + * functionality to not declare it, while others will override it. + * + * @return void + */ + public function reconnect() + { + } + + // -------------------------------------------------------------------- + /** * Set client character set * diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php index 326841dc2..d8b6ae571 100644 --- a/system/database/drivers/interbase/interbase_driver.php +++ b/system/database/drivers/interbase/interbase_driver.php @@ -84,21 +84,6 @@ class CI_DB_interbase_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @return void - */ - public function reconnect() - { - // not implemented in Interbase/Firebird - } - - // -------------------------------------------------------------------- - /** * Select the database * diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index 1c1b84582..f2933fe43 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -91,21 +91,6 @@ class CI_DB_mssql_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @return void - */ - public function reconnect() - { - // not implemented in MSSQL - } - - // -------------------------------------------------------------------- - /** * Select the database * diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 238a08ff8..c9e791d63 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -102,22 +102,6 @@ class CI_DB_oci8_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @return void - */ - public function reconnect() - { - // not implemented in oracle - return; - } - - // -------------------------------------------------------------------- - /** * Select the database * diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index 6704264c6..901787ff3 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -89,21 +89,6 @@ class CI_DB_odbc_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @return void - */ - public function reconnect() - { - // not implemented in odbc - } - - // -------------------------------------------------------------------- - /** * Select the database * diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 0295b9d56..19338e30f 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -246,26 +246,6 @@ class CI_DB_pdo_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @return void - */ - public function reconnect() - { - if ($this->db->db_debug) - { - return $this->db->display_error('db_unsuported_feature'); - } - - return FALSE; - } - - // -------------------------------------------------------------------- - /** * Select the database * diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index bb86c2296..fa7e4846a 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -105,21 +105,6 @@ class CI_DB_sqlite_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @return void - */ - public function reconnect() - { - // not implemented in SQLite - } - - // -------------------------------------------------------------------- - /** * Select the database * diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index 2b9f82201..9f2f88699 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -100,21 +100,6 @@ class CI_DB_sqlsrv_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * Reconnect - * - * Keep / reestablish the db connection if no queries have been - * sent for a length of time exceeding the server's idle timeout - * - * @return void - */ - public function reconnect() - { - // not implemented in MSSQL - } - - // -------------------------------------------------------------------- - /** * Select the database * -- cgit v1.2.3-24-g4f1b From a963fbfa8445ec6124ca2e676dbf1ae1a5adb549 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Fri, 23 Mar 2012 10:11:07 -0400 Subject: Make travis test on multiple php versions --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 032bf9df5..2584e8ac2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: php -phps: +php: - 5.2 - 5.3 - 5.4 -- cgit v1.2.3-24-g4f1b From 44670568d7ae7a263136643c6a28bb7bb35c5615 Mon Sep 17 00:00:00 2001 From: Reiny Júnior Date: Sun, 25 Mar 2012 16:56:08 -0300 Subject: correcting PHPUnit execution error path, in Setup_test.php load file path --- tests/phpunit.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/phpunit.xml b/tests/phpunit.xml index abb9881b9..dfeecd19f 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -11,7 +11,7 @@ stopOnSkipped="false"> - codeigniter/Setup_test.php + ./codeigniter/Setup_test.php codeigniter/core codeigniter/helpers codeigniter/libraries @@ -19,7 +19,6 @@ codeigniter/libraries codeigniter/helpers --> - -- cgit v1.2.3-24-g4f1b From 94708bd62022f9a0cfb06d2f26e8441b6c4c562c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 12:09:28 +0300 Subject: Alter SQLite's escape_str() for LIKE queries --- system/database/drivers/sqlite/sqlite_driver.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index fa7e4846a..08b074cca 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -245,9 +245,9 @@ class CI_DB_sqlite_driver extends CI_DB { // escape LIKE condition wildcards if ($like === TRUE) { - $str = str_replace( array('%', '_', $this->_like_escape_chr), - array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), - $str); + return str_replace(array($this->_like_escape_chr, '%', '_'), + array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_') + $str); } return $str; -- cgit v1.2.3-24-g4f1b From 830f5af4bac8da4b6f9392334348bc9e33b09240 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 12:11:38 +0300 Subject: Add a missing comma --- system/database/drivers/sqlite/sqlite_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 08b074cca..102c79bb3 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -246,7 +246,7 @@ class CI_DB_sqlite_driver extends CI_DB { if ($like === TRUE) { return str_replace(array($this->_like_escape_chr, '%', '_'), - array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_') + array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_'), $str); } -- cgit v1.2.3-24-g4f1b From a00e50483ab27d8ba3d3a2aa1a5138bfa8c8be70 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 12:23:13 +0300 Subject: Add DSN string and persistent connections support for CUBRID --- system/database/drivers/cubrid/cubrid_driver.php | 85 ++++++++++++++++-------- user_guide_src/source/changelog.rst | 2 + 2 files changed, 58 insertions(+), 29 deletions(-) diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php index f39c2ad76..bed3d8685 100644 --- a/system/database/drivers/cubrid/cubrid_driver.php +++ b/system/database/drivers/cubrid/cubrid_driver.php @@ -57,38 +57,35 @@ class CI_DB_cubrid_driver extends CI_DB { protected $_count_string = 'SELECT COUNT(*) AS '; protected $_random_keyword = ' RAND()'; // database specific random keyword - /** - * Non-persistent database connection - * - * @return resource - */ - public function db_connect() - { - // If no port is defined by the user, use the default value - if ($this->port == '') - { - // Default CUBRID Broker port - $this->port = 33000; - } + // CUBRID-specific properties + public $auto_commit = TRUE; - $conn = cubrid_connect($this->hostname, $this->port, $this->database, $this->username, $this->password); + public function __construct($params) + { + parent::__construct($params); - if ($conn) + if (preg_match('/^CUBRID:[^:]+(:[0-9][1-9]{0,4})?:[^:]+:[^:]*:[^:]*:(\?.+)?$/', $this->dsn, $matches)) { - // Check if a user wants to run queries in dry, i.e. run the - // queries but not commit them. - if (isset($this->auto_commit) && ! $this->auto_commit) + if (stripos($matches[2], 'autocommit=off') !== FALSE) { - cubrid_set_autocommit($conn, CUBRID_AUTOCOMMIT_FALSE); - } - else - { - cubrid_set_autocommit($conn, CUBRID_AUTOCOMMIT_TRUE); - $this->auto_commit = TRUE; + $this->auto_commit = FALSE; } } + else + { + // If no port is defined by the user, use the default value + $this->port == '' OR $this->port = 33000; + } + } - return $conn; + /** + * Non-persistent database connection + * + * @return resource + */ + public function db_connect() + { + return $this->_cubrid_connect(); } // -------------------------------------------------------------------- @@ -100,15 +97,45 @@ class CI_DB_cubrid_driver extends CI_DB { * engine which can be configured in the CUBRID Broker configuration * file by setting the CCI_PCONNECT parameter to ON. In that case, all * connections established between the client application and the - * server will become persistent. This is calling the same - * @cubrid_connect function will establish persisten connection - * considering that the CCI_PCONNECT is ON. + * server will become persistent. * * @return resource */ public function db_pconnect() { - return $this->db_connect(); + return $this->_cubrid_connect(TRUE); + } + + // -------------------------------------------------------------------- + + /** + * CUBRID connection + * + * A CUBRID-specific method to create a connection to the database. + * Except for determining if a persistent connection should be used, + * the rest of the logic is the same for db_connect() and db_pconnect(). + * + * @param bool + * @return resource + */ + protected function _cubrid_connect($persistent = FALSE) + { + if (preg_match('/^CUBRID:[^:]+(:[0-9][1-9]{0,4})?:[^:]+:([^:]*):([^:]*):(\?.+)?$/', $this->dsn, $matches)) + { + $_temp = ($persistent !== TRUE) ? 'cubrid_connect_with_url' : 'cubrid_pconnect_with_url'; + $conn_id = ($matches[2] === '' && $matches[3] === '' && $this->username !== '' && $this->password !== '') + ? $_temp($this->dsn, $this->username, $this->password) + : $_temp($this->dsn); + } + else + { + $_temp = ($persistent !== TRUE) ? 'cubrid_connect' : 'cubrid_pconnect'; + $conn_id = ($this->username !== '') + ? $_temp($this->hostname, $this->port, $this->database, $this->username, $this->password) + : $_temp($this->hostname, $this->port, $this->database); + } + + return $conn_id; } // -------------------------------------------------------------------- diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 44ecf43d2..42d468eed 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -73,6 +73,8 @@ Release Date: Not Released - Removed protect_identifiers() and renamed _protect_identifiers() to it instead - it was just an alias. - MySQL and MySQLi drivers now require at least MySQL version 5.1. - db_set_charset() now only requires one parameter (collation was only needed due to legacy support for MySQL versions prior to 5.1). + - Added DSN string support for CUBRID. + - Added persistent connections support for CUBRID. - Libraries -- cgit v1.2.3-24-g4f1b From 6192bc0cd34e214d5287ba45994d84789def31af Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 12:32:32 +0300 Subject: Improve PostgreSQL DSN string support and add a missing method visibility declaration --- system/database/drivers/postgre/postgre_driver.php | 71 ++++++++++++++++------ .../database/drivers/postgre/postgre_utility.php | 2 +- 2 files changed, 54 insertions(+), 19 deletions(-) diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 3bfccad05..3e2d05ce8 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -57,29 +57,64 @@ class CI_DB_postgre_driver extends CI_DB { protected $_random_keyword = ' RANDOM()'; // database specific random keyword /** - * Connection String + * Constructor * - * @return string + * Creates a DSN string to be used for db_connect() and db_pconnect() + * + * @return void */ - protected function _connect_string() + public function __construct($params) { - $components = array( - 'hostname' => 'host', - 'port' => 'port', - 'database' => 'dbname', - 'username' => 'user', - 'password' => 'password' - ); - - $connect_string = ""; - foreach ($components as $key => $val) + parent::__construct($params); + + if ( ! empty($this->dsn)) + { + return; + } + + $this->dsn === '' OR $this->dsn = ''; + + if (strpos($this->hostname, '/') !== FALSE) + { + // If UNIX sockets are used, we shouldn't set a port + $this->port = ''; + } + + $this->hostname === '' OR $this->dsn = 'host='.$this->hostname; + + if ( ! empty($this->port) && ctype_digit($this->port)) + { + $this->dsn .= 'host='.$this->port.' '; + } + + if ($this->username !== '') { - if (isset($this->$key) && $this->$key != '') + $this->dsn .= 'username='.$this->username.' '; + + /* An empty password is valid! + * + * $db['password'] = NULL must be done in order to ignore it. + */ + $this->password === NULL OR $this->dsn .= "password='".$this->password."' "; + } + + $this->database === '' OR $this->dsn .= 'dbname='.$this->database.' '; + + /* We don't have these options as elements in our standard configuration + * array, but they might be set by parse_url() if the configuration was + * provided via string. Example: + * + * postgre://username:password@localhost:5432/database?connect_timeout=5&sslmode=1 + */ + foreach (array('connect_timeout', 'options', 'sslmode', 'service') as $key) + { + if (isset($this->$key) && is_string($this->key) && $this->key !== '') { - $connect_string .= " $val=".$this->$key; + $this->dsn .= $key."='".$this->key."' "; } } - return trim($connect_string); + + $this->dsn = rtrim($this->dsn); } // -------------------------------------------------------------------- @@ -91,7 +126,7 @@ class CI_DB_postgre_driver extends CI_DB { */ public function db_connect() { - return @pg_connect($this->_connect_string()); + return @pg_connect($this->dsn); } // -------------------------------------------------------------------- @@ -103,7 +138,7 @@ class CI_DB_postgre_driver extends CI_DB { */ public function db_pconnect() { - return @pg_pconnect($this->_connect_string()); + return @pg_pconnect($this->dsn); } // -------------------------------------------------------------------- diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php index c6b71b4d9..cf29201ff 100644 --- a/system/database/drivers/postgre/postgre_utility.php +++ b/system/database/drivers/postgre/postgre_utility.php @@ -78,7 +78,7 @@ class CI_DB_postgre_utility extends CI_DB_utility { * @param array Preferences * @return mixed */ - function _backup($params = array()) + public function _backup($params = array()) { // Currently unsupported return $this->db->display_error('db_unsuported_feature'); -- cgit v1.2.3-24-g4f1b From 9a1fc2013e876347e9c8d336bade7ac589712bf7 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 12:38:34 +0300 Subject: Add ODBC support for the new 'dsn' config value --- system/database/drivers/odbc/odbc_driver.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index 901787ff3..ad773117f 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -57,12 +57,17 @@ class CI_DB_odbc_driver extends CI_DB { protected $_count_string = 'SELECT COUNT(*) AS '; protected $_random_keyword; - public function __construct($params) { parent::__construct($params); $this->_random_keyword = ' RND('.time().')'; // database specific random keyword + + // Legacy support for DSN in the hostname field + if ($this->dsn == '') + { + $this->dsn = $this->hostname; + } } /** @@ -72,7 +77,7 @@ class CI_DB_odbc_driver extends CI_DB { */ public function db_connect() { - return @odbc_connect($this->hostname, $this->username, $this->password); + return @odbc_connect($this->dsn, $this->username, $this->password); } // -------------------------------------------------------------------- @@ -84,7 +89,7 @@ class CI_DB_odbc_driver extends CI_DB { */ public function db_pconnect() { - return @odbc_pconnect($this->hostname, $this->username, $this->password); + return @odbc_pconnect($this->dsn, $this->username, $this->password); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 59ad0af04debb4e10e20fbdfc1827a620a88b7be Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 12:47:45 +0300 Subject: Add DSN string support for Oracle --- system/database/drivers/oci8/oci8_driver.php | 87 +++++++++++++++++++++++++++- user_guide_src/source/changelog.rst | 1 + 2 files changed, 86 insertions(+), 2 deletions(-) diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index c9e791d63..3bc8c114c 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -78,6 +78,85 @@ class CI_DB_oci8_driver extends CI_DB { // throw off num_fields later public $limit_used; + public function __construct($params) + { + parent::__construct($params); + + $valid_dsns = array( + 'tns' => '/^\(DESCRIPTION=(\(.+\)){2,}\)$/', // TNS + // Easy Connect string (Oracle 10g+) + 'ec' => '/^(\/\/)?[a-z0-9.:_-]+(:[1-9][0-9]{0,4})?(\/[a-z0-9$_]+)?(:[^\/])?(\/[a-z0-9$_]+)?$/i', + 'in' => '/^[a-z0-9$_]+$/i' // Instance name (defined in tnsnames.ora) + ); + + /* Space characters don't have any effect when actually + * connecting, but can be a hassle while validating the DSN. + */ + $this->dsn = str_replace(array("\n", "\r", "\t", ' '), '', $this->dsn); + + if ($this->dsn !== '') + { + foreach ($valid_dsns as $regexp) + { + if (preg_match($regexp, $this->dsn)) + { + return; + } + } + } + + // Legacy support for TNS in the hostname configuration field + $this->hostname = str_replace(array("\n", "\r", "\t", ' '), '', $this->hostname); + if (preg_match($valid_dsns['tns'], $this->hostname)) + { + $this->dsn = $this->hostname; + return; + } + elseif ($this->hostname !== '' && strpos($this->hostname, '/') === FALSE && strpos($this->hostname, ':') === FALSE + && (( ! empty($this->port) && ctype_digit($this->port)) OR $this->database !== '')) + { + /* If the hostname field isn't empty, doesn't contain + * ':' and/or '/' and if port and/or database aren't + * empty, then the hostname field is most likely indeed + * just a hostname. Therefore we'll try and build an + * Easy Connect string from these 3 settings, assuming + * that the database field is a service name. + */ + $this->dsn = $this->hostname + .(( ! empty($this->port) && ctype_digit($this->port)) ? ':'.$this->port : '') + .($this->database !== '' ? '/'.ltrim($this->database, '/') : ''); + + if (preg_match($valid_dsns['ec'], $this->dsn)) + { + return; + } + } + + /* At this point, we can only try and validate the hostname and + * database fields separately as DSNs. + */ + if (preg_match($valid_dsns['ec'], $this->hostname) OR preg_match($valid_dsns['in'], $this->hostname)) + { + $this->dsn = $this->hostname; + return; + } + + $this->database = str_replace(array("\n", "\r", "\t", ' '), '', $this->database); + foreach ($valid_dsns as $regexp) + { + if (preg_match($regexp, $this->database)) + { + return; + } + } + + /* Well - OK, an empty string should work as well. + * PHP will try to use environment variables to + * determine which Oracle instance to connect to. + */ + $this->dsn = ''; + } + /** * Non-persistent database connection * @@ -85,7 +164,9 @@ class CI_DB_oci8_driver extends CI_DB { */ public function db_connect() { - return @oci_connect($this->username, $this->password, $this->hostname, $this->char_set); + return ( ! empty($this->char_set)) + ? @oci_connect($this->username, $this->password, $this->dsn, $this->char_set) + : @oci_connect($this->username, $this->password, $this->dsn); } // -------------------------------------------------------------------- @@ -97,7 +178,9 @@ class CI_DB_oci8_driver extends CI_DB { */ public function db_pconnect() { - return @oci_pconnect($this->username, $this->password, $this->hostname, $this->char_set); + return ( ! empty($this->char_set)) + ? @oci_pconnect($this->username, $this->password, $this->dsn, $this->char_set) + : @oci_pconnect($this->username, $this->password, $this->dsn); } // -------------------------------------------------------------------- diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 42d468eed..7ec417d42 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -75,6 +75,7 @@ Release Date: Not Released - db_set_charset() now only requires one parameter (collation was only needed due to legacy support for MySQL versions prior to 5.1). - Added DSN string support for CUBRID. - Added persistent connections support for CUBRID. + - Added DSN string support (Easy Connect and TNS) for Oracle. - Libraries -- cgit v1.2.3-24-g4f1b From 968bbbb40d188c2bfff6712555b380bd9678d995 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 12:59:05 +0300 Subject: Minor adjustments in the changelog --- user_guide_src/source/changelog.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 7ec417d42..7afe8be68 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -58,7 +58,7 @@ Release Date: Not Released - Adding $escape parameter to the order_by function, this enables ordering by custom fields. - MySQLi driver now uses mysqli_get_server_info() for server version checking. - MySQLi driver now supports persistent connections when running on PHP >= 5.3. - - Added dsn if the group connections in the config use PDO or any driver which need DSN. + - Added 'dsn' configuration setting for drivers that support DSN strings (PDO, PostgreSQL, Oracle, ODBC, CUBRID). - Improved PDO database support. - Added Interbase/Firebird database support via the "interbase" driver - Added an optional database name parameter to db_select(). @@ -252,11 +252,9 @@ Release Date: November 14, 2011 override them. - Removed CI_CORE boolean constant from CodeIgniter.php (no longer Reactor and Core versions). - Bug fixes for 2.1.0 ------------------- - - Fixed #378 Robots identified as regular browsers by the User Agent class. - If a config class was loaded first then a library with the same name @@ -1255,7 +1253,7 @@ Bug fixes for 1.6.3 - Added a language key for valid_emails in validation_lang.php. - Amended fixes for bug (#3419) with parsing DSN database connections. -- Moved the _has_operators() function (#4535) into DB_driver from +- Moved the _has_operator() function (#4535) into DB_driver from DB_active_rec. - Fixed a syntax error in upload_lang.php. - Fixed a bug (#4542) with a regular expression in the Image library. -- cgit v1.2.3-24-g4f1b From c2697db0f2721cc9fefb58b85bf55e6bdb91db9b Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 13:05:24 +0300 Subject: Rename a variable and style fixes in system/database/DB.php --- system/database/DB.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/system/database/DB.php b/system/database/DB.php index 116116bf4..96e495515 100755 --- a/system/database/DB.php +++ b/system/database/DB.php @@ -37,11 +37,11 @@ function &DB($params = '', $active_record_override = NULL) { // Load the DB config file if a DSN string wasn't passed - if (is_string($params) AND strpos($params, '://') === FALSE) + if (is_string($params) && strpos($params, '://') === FALSE) { // Is the config file in the environment folder? if (( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/database.php')) - AND ! file_exists($file_path = APPPATH.'config/database.php')) + && ! file_exists($file_path = APPPATH.'config/database.php')) { show_error('The configuration file database.php does not exist.'); } @@ -74,24 +74,24 @@ function &DB($params = '', $active_record_override = NULL) * parameter. DSNs must have this prototype: * $dsn = 'driver://username:password@hostname/database'; */ - if (($dns = @parse_url($params)) === FALSE) + if (($dsn = @parse_url($params)) === FALSE) { show_error('Invalid DB Connection String'); } $params = array( - 'dbdriver' => $dns['scheme'], - 'hostname' => (isset($dns['host'])) ? rawurldecode($dns['host']) : '', - 'port' => (isset($dns['port'])) ? rawurldecode($dns['port']) : '', - 'username' => (isset($dns['user'])) ? rawurldecode($dns['user']) : '', - 'password' => (isset($dns['pass'])) ? rawurldecode($dns['pass']) : '', - 'database' => (isset($dns['path'])) ? rawurldecode(substr($dns['path'], 1)) : '' + 'dbdriver' => $dsn['scheme'], + 'hostname' => isset($dsn['host']) ? rawurldecode($dsn['host']) : '', + 'port' => isset($dsn['port']) ? rawurldecode($dsn['port']) : '', + 'username' => isset($dsn['user']) ? rawurldecode($dsn['user']) : '', + 'password' => isset($dsn['pass']) ? rawurldecode($dsn['pass']) : '', + 'database' => isset($dsn['path']) ? rawurldecode(substr($dsn['path'], 1)) : '' ); // were additional config items set? - if (isset($dns['query'])) + if (isset($dsn['query'])) { - parse_str($dns['query'], $extra); + parse_str($dsn['query'], $extra); foreach ($extra as $key => $val) { // booleans please @@ -158,4 +158,4 @@ function &DB($params = '', $active_record_override = NULL) } /* End of file DB.php */ -/* Location: ./system/database/DB.php */ +/* Location: ./system/database/DB.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From e734b38e0f4cde3ebe17cdb1844faa0129fe8b11 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 13:42:36 +0300 Subject: Clear some spaces and fix some inconsistencies in application/ php files --- application/config/autoload.php | 6 +++--- application/config/config.php | 6 +++--- application/config/constants.php | 10 +++++----- application/config/database.php | 6 +++--- application/config/doctypes.php | 2 +- application/config/foreign_chars.php | 6 +++--- application/config/hooks.php | 7 +++---- application/config/migration.php | 6 +++--- application/config/mimes.php | 5 +++-- application/config/profiler.php | 7 +++---- application/config/routes.php | 7 +++---- application/config/smileys.php | 6 +++--- application/config/user_agents.php | 4 ++-- application/controllers/welcome.php | 10 +++++----- application/errors/error_404.php | 10 ++++------ application/errors/error_db.php | 10 ++++------ application/errors/error_general.php | 10 ++++------ application/errors/error_php.php | 14 +++++++------- application/views/welcome_message.php | 14 ++++++-------- 19 files changed, 68 insertions(+), 78 deletions(-) diff --git a/application/config/autoload.php b/application/config/autoload.php index e8c999334..b3e63cbf6 100644 --- a/application/config/autoload.php +++ b/application/config/autoload.php @@ -1,13 +1,13 @@ - array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'), +$mimes = array( + 'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'), 'cpt' => 'application/mac-compactpro', 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'), 'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'), @@ -165,4 +166,4 @@ $mimes = array('hqx' => array('application/mac-binhex40', 'application/mac-binhe ); /* End of file mimes.php */ -/* Location: ./application/config/mimes.php */ +/* Location: ./application/config/mimes.php */ \ No newline at end of file diff --git a/application/config/profiler.php b/application/config/profiler.php index 53391892d..c161a4d59 100644 --- a/application/config/profiler.php +++ b/application/config/profiler.php @@ -1,13 +1,13 @@ - - - +?> diff --git a/application/errors/error_db.php b/application/errors/error_db.php index 81ff02adb..eb3a75260 100644 --- a/application/errors/error_db.php +++ b/application/errors/error_db.php @@ -1,13 +1,13 @@ - - - +?> diff --git a/application/errors/error_general.php b/application/errors/error_general.php index 8efcfd991..59896e1ea 100644 --- a/application/errors/error_general.php +++ b/application/errors/error_general.php @@ -1,13 +1,13 @@ - - - +?> diff --git a/application/errors/error_php.php b/application/errors/error_php.php index 42e5f5a28..3855720de 100644 --- a/application/errors/error_php.php +++ b/application/errors/error_php.php @@ -1,13 +1,13 @@ -Filename:

Line Number:

- - + +

Backtrace:

- +

File:
@@ -47,7 +47,7 @@ Function:

- +

diff --git a/application/views/welcome_message.php b/application/views/welcome_message.php index 0dd892441..45360da60 100644 --- a/application/views/welcome_message.php +++ b/application/views/welcome_message.php @@ -1,13 +1,13 @@ - - - +?> @@ -75,7 +73,7 @@ #body{ margin: 0 15px 0 15px; } - + p.footer{ text-align: right; font-size: 11px; @@ -84,7 +82,7 @@ padding: 0 10px 0 10px; margin: 20px 0 0 0; } - + #container{ margin: 10px; border: 1px solid #D0D0D0; -- cgit v1.2.3-24-g4f1b From e684bdac2d6282e3b9a5c57e1006d5ed1664f647 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 13:47:29 +0300 Subject: Clear some spaces and fix some inconsistencies in the Zip library and system/helpers/ files --- system/helpers/captcha_helper.php | 4 +--- system/helpers/date_helper.php | 2 +- system/helpers/smiley_helper.php | 13 ++++++------- system/helpers/string_helper.php | 10 +++++----- system/helpers/text_helper.php | 8 ++++---- system/libraries/Zip.php | 8 ++++---- 6 files changed, 21 insertions(+), 24 deletions(-) diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 578796573..5955e054a 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -1,4 +1,4 @@ -now); - + $time['file_mtime'] = ($date['hours'] << 11) + ($date['minutes'] << 5) + $date['seconds'] / 2; $time['file_mdate'] = (($date['year'] - 1980) << 9) + ($date['mon'] << 5) + $date['mday']; -- cgit v1.2.3-24-g4f1b From c6a68e04169802c8aa82e41634ce350eafd1ec1e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 14:30:10 +0300 Subject: Add visibility declarations where they remain missing --- system/core/Exceptions.php | 6 ++---- system/database/drivers/mssql/mssql_driver.php | 3 +-- system/database/drivers/pdo/pdo_driver.php | 2 +- user_guide_src/source/changelog.rst | 1 + 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index d7282b1f3..f36b31598 100755 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * Exceptions Class * @@ -163,7 +161,7 @@ class CI_Exceptions { * @param string the error line number * @return string */ - function show_php_error($severity, $message, $filepath, $line) + public function show_php_error($severity, $message, $filepath, $line) { $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; $filepath = str_replace('\\', '/', $filepath); @@ -189,4 +187,4 @@ class CI_Exceptions { } /* End of file Exceptions.php */ -/* Location: ./system/core/Exceptions.php */ +/* Location: ./system/core/Exceptions.php */ \ No newline at end of file diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index f2933fe43..912808631 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -539,13 +539,12 @@ class CI_DB_mssql_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * - * @access public * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) + protected function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 19338e30f..f336eb0ab 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -484,7 +484,7 @@ class CI_DB_pdo_driver extends CI_DB { * @param string * @return string */ - function count_all($table = '') + public function count_all($table = '') { if ($table == '') { diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 34d6a0b63..47220d61a 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -36,6 +36,7 @@ Release Date: Not Released - Removed previously deprecated use of ``$autoload['core']`` in application/config/autoload.php. Only entries in ``$autoload['libraries']`` are auto-loaded now. - Added some more doctypes. + - Updated all classes to be written in PHP 5 style, with visibility declarations and no ``var`` usage for properties. - Helpers -- cgit v1.2.3-24-g4f1b From a5dd2976044b856a875d50e612a2b39ae05787ea Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 14:43:01 +0300 Subject: Make _initialize() a constructor and rename _call_hook() to call_hook in the Hooks class --- system/core/CodeIgniter.php | 14 +++++++------- system/core/Hooks.php | 32 ++++++++++++-------------------- user_guide_src/source/changelog.rst | 1 + 3 files changed, 20 insertions(+), 27 deletions(-) diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index a79a69590..4885f310c 100755 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -133,7 +133,7 @@ * Is there a "pre_system" hook? * ------------------------------------------------------ */ - $EXT->_call_hook('pre_system'); + $EXT->call_hook('pre_system'); /* * ------------------------------------------------------ @@ -194,7 +194,7 @@ * Is there a valid cache file? If so, we're done... * ------------------------------------------------------ */ - if ($EXT->_call_hook('cache_override') === FALSE + if ($EXT->call_hook('cache_override') === FALSE && $OUT->_display_cache($CFG, $URI) == TRUE) { exit; @@ -297,7 +297,7 @@ * Is there a "pre_controller" hook? * ------------------------------------------------------ */ - $EXT->_call_hook('pre_controller'); + $EXT->call_hook('pre_controller'); /* * ------------------------------------------------------ @@ -314,7 +314,7 @@ * Is there a "post_controller_constructor" hook? * ------------------------------------------------------ */ - $EXT->_call_hook('post_controller_constructor'); + $EXT->call_hook('post_controller_constructor'); /* * ------------------------------------------------------ @@ -369,14 +369,14 @@ * Is there a "post_controller" hook? * ------------------------------------------------------ */ - $EXT->_call_hook('post_controller'); + $EXT->call_hook('post_controller'); /* * ------------------------------------------------------ * Send the final rendered output to the browser * ------------------------------------------------------ */ - if ($EXT->_call_hook('display_override') === FALSE) + if ($EXT->call_hook('display_override') === FALSE) { $OUT->_display(); } @@ -386,7 +386,7 @@ * Is there a "post_system" hook? * ------------------------------------------------------ */ - $EXT->_call_hook('post_system'); + $EXT->call_hook('post_system'); /* * ------------------------------------------------------ diff --git a/system/core/Hooks.php b/system/core/Hooks.php index 493822f36..68e30ef0f 100755 --- a/system/core/Hooks.php +++ b/system/core/Hooks.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Hooks Class * @@ -51,7 +49,7 @@ class CI_Hooks { * * @var array */ - public $hooks = array(); + public $hooks = array(); /** * Determines wether hook is in progress, used to prevent infinte loops * @@ -59,23 +57,17 @@ class CI_Hooks { */ public $in_progress = FALSE; - public function __construct() - { - $this->_initialize(); - log_message('debug', 'Hooks Class Initialized'); - } - - // -------------------------------------------------------------------- - /** * Initialize the Hooks Preferences * * @return void */ - private function _initialize() + public function __construct() { $CFG =& load_class('Config', 'core'); + log_message('debug', 'Hooks Class Initialized'); + // If hooks are not enabled in the config file // there is nothing else to do if ($CFG->item('enable_hooks') == FALSE) @@ -84,7 +76,7 @@ class CI_Hooks { } // Grab the "hooks" definition file. - if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php')) + if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php')) { include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'); } @@ -113,14 +105,14 @@ class CI_Hooks { * @param string the hook name * @return mixed */ - public function _call_hook($which = '') + public function call_hook($which = '') { if ( ! $this->enabled OR ! isset($this->hooks[$which])) { return FALSE; } - if (isset($this->hooks[$which][0]) AND is_array($this->hooks[$which][0])) + if (isset($this->hooks[$which][0]) && is_array($this->hooks[$which][0])) { foreach ($this->hooks[$which] as $val) { @@ -167,7 +159,7 @@ class CI_Hooks { // Set file path // ----------------------------------- - if ( ! isset($data['filepath']) OR ! isset($data['filename'])) + if ( ! isset($data['filepath'], $data['filename'])) { return FALSE; } @@ -187,12 +179,12 @@ class CI_Hooks { $function = FALSE; $params = ''; - if (isset($data['class']) AND $data['class'] != '') + if ( ! empty($data['class'])) { $class = $data['class']; } - if (isset($data['function'])) + if ( ! empty($data['function'])) { $function = $data['function']; } @@ -202,7 +194,7 @@ class CI_Hooks { $params = $data['params']; } - if ($class === FALSE AND $function === FALSE) + if ($class === FALSE && $function === FALSE) { return FALSE; } @@ -244,4 +236,4 @@ class CI_Hooks { } /* End of file Hooks.php */ -/* Location: ./system/core/Hooks.php */ +/* Location: ./system/core/Hooks.php */ \ No newline at end of file diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 47220d61a..37c38f16a 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -117,6 +117,7 @@ Release Date: Not Released - Added method() to CI_Input to retrieve $_SERVER['REQUEST_METHOD']. - Modified valid_ip() to use PHP's filter_var() in the :doc:`Input Library `. - Added support for HTTP-Only cookies with new config option ``cookie_httponly`` (default FALSE). + - Renamed method _call_hook() to call_hook() in the :doc:`Hooks Library `. Bug fixes for 3.0 ------------------ -- cgit v1.2.3-24-g4f1b From c4d979c45297ecc021e385a96dc3bae04a4cdbc4 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 14:53:00 +0300 Subject: Switch private methods to protected and cleanup the Ftp library --- system/libraries/Ftp.php | 109 ++++++++++++++++++----------------------------- 1 file changed, 41 insertions(+), 68 deletions(-) diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php index 4d96c00cc..8aa1650d2 100644 --- a/system/libraries/Ftp.php +++ b/system/libraries/Ftp.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * FTP Class * @@ -42,16 +40,11 @@ class CI_FTP { public $username = ''; public $password = ''; public $port = 21; - public $passive = TRUE; + public $passive = TRUE; public $debug = FALSE; - public $conn_id = FALSE; + public $conn_id = FALSE; - /** - * Constructor - Sets Preferences - * - * The constructor can be passed an array of config values - */ public function __construct($config = array()) { if (count($config) > 0) @@ -59,7 +52,7 @@ class CI_FTP { $this->initialize($config); } - log_message('debug', "FTP Class Initialized"); + log_message('debug', 'FTP Class Initialized'); } // -------------------------------------------------------------------- @@ -67,7 +60,6 @@ class CI_FTP { /** * Initialize preferences * - * @access public * @param array * @return void */ @@ -90,7 +82,6 @@ class CI_FTP { /** * FTP Connect * - * @access public * @param array the connection values * @return bool */ @@ -133,10 +124,9 @@ class CI_FTP { /** * FTP Login * - * @access private * @return bool */ - private function _login() + protected function _login() { return @ftp_login($this->conn_id, $this->username, $this->password); } @@ -146,10 +136,9 @@ class CI_FTP { /** * Validates the connection ID * - * @access private * @return bool */ - private function _is_conn() + protected function _is_conn() { if ( ! is_resource($this->conn_id)) { @@ -164,17 +153,15 @@ class CI_FTP { // -------------------------------------------------------------------- - /** * Change directory * * The second parameter lets us momentarily turn off debugging so that * this function can be used to test for the existence of a folder - * without throwing an error. There's no FTP equivalent to is_dir() + * without throwing an error. There's no FTP equivalent to is_dir() * so we do it by trying to change to a particular directory. * Internally, this parameter is only used by the "mirror" function below. * - * @access public * @param string * @param bool * @return bool @@ -190,7 +177,7 @@ class CI_FTP { if ($result === FALSE) { - if ($this->debug == TRUE AND $supress_debug == FALSE) + if ($this->debug == TRUE && $supress_debug == FALSE) { $this->_error('ftp_unable_to_changedir'); } @@ -205,8 +192,8 @@ class CI_FTP { /** * Create a directory * - * @access public * @param string + * @param int * @return bool */ public function mkdir($path = '', $permissions = NULL) @@ -230,7 +217,7 @@ class CI_FTP { // Set file permissions if needed if ( ! is_null($permissions)) { - $this->chmod($path, (int)$permissions); + $this->chmod($path, (int) $permissions); } return TRUE; @@ -241,10 +228,10 @@ class CI_FTP { /** * Upload a file to the server * - * @access public * @param string * @param string * @param string + * @param int * @return bool */ public function upload($locpath, $rempath, $mode = 'auto', $permissions = NULL) @@ -284,7 +271,7 @@ class CI_FTP { // Set file permissions if needed if ( ! is_null($permissions)) { - $this->chmod($rempath, (int)$permissions); + $this->chmod($rempath, (int) $permissions); } return TRUE; @@ -295,7 +282,6 @@ class CI_FTP { /** * Download a file from a remote server to the local server * - * @access public * @param string * @param string * @param string @@ -337,7 +323,6 @@ class CI_FTP { /** * Rename (or move) a file * - * @access public * @param string * @param string * @param bool @@ -369,7 +354,6 @@ class CI_FTP { /** * Move a file * - * @access public * @param string * @param string * @return bool @@ -384,7 +368,6 @@ class CI_FTP { /** * Rename (or move) a file * - * @access public * @param string * @return bool */ @@ -415,7 +398,6 @@ class CI_FTP { * Delete a folder and recursively delete everything (including sub-folders) * containted within it. * - * @access public * @param string * @return bool */ @@ -427,11 +409,11 @@ class CI_FTP { } // Add a trailing slash to the file path if needed - $filepath = preg_replace("/(.+?)\/*$/", "\\1/", $filepath); + $filepath = preg_replace('/(.+?)\/*$/', '\\1/', $filepath); $list = $this->list_files($filepath); - if ($list !== FALSE AND count($list) > 0) + if ($list !== FALSE && count($list) > 0) { foreach ($list as $item) { @@ -463,7 +445,6 @@ class CI_FTP { /** * Set file permissions * - * @access public * @param string the file path * @param string the permissions * @return bool @@ -494,7 +475,6 @@ class CI_FTP { /** * FTP List files in the specified directory * - * @access public * @return array */ public function list_files($path = '.') @@ -512,11 +492,11 @@ class CI_FTP { /** * Read a directory and recreate it remotely * - * This function recursively reads a folder and everything it contains (including - * sub-folders) and creates a mirror via FTP based on it. Whatever the directory structure - * of the original file path will be recreated on the server. + * This function recursively reads a folder and everything it contains + * (including sub-folders) and creates a mirror via FTP based on it. + * Whatever the directory structure of the original file path will be + * recreated on the server. * - * @access public * @param string path to source with trailing slash * @param string path to destination - include the base folder with trailing slash * @return bool @@ -532,7 +512,7 @@ class CI_FTP { if ($fp = @opendir($locpath)) { // Attempt to open the remote file path and try to create it, if it doesn't exist - if ( ! $this->changedir($rempath, TRUE) AND ( ! $this->mkdir($rempath) OR ! $this->changedir($rempath))) + if ( ! $this->changedir($rempath, TRUE) && ( ! $this->mkdir($rempath) OR ! $this->changedir($rempath))) { return FALSE; } @@ -542,9 +522,9 @@ class CI_FTP { { if (@is_dir($locpath.$file) && $file[0] !== '.') { - $this->mirror($locpath.$file."/", $rempath.$file."/"); + $this->mirror($locpath.$file.'/', $rempath.$file.'/'); } - elseif ($file[0] !== ".") + elseif ($file[0] !== '.') { // Get the file extension so we can se the upload type $ext = $this->_getext($file); @@ -565,11 +545,10 @@ class CI_FTP { /** * Extract the file extension * - * @access private * @param string * @return string */ - private function _getext($filename) + protected function _getext($filename) { if (FALSE === strpos($filename, '.')) { @@ -580,36 +559,34 @@ class CI_FTP { return end($x); } - // -------------------------------------------------------------------- /** * Set the upload type * - * @access private * @param string * @return string */ - private function _settype($ext) + protected function _settype($ext) { $text_types = array( - 'txt', - 'text', - 'php', - 'phps', - 'php4', - 'js', - 'css', - 'htm', - 'html', - 'phtml', - 'shtml', - 'log', - 'xml' - ); - - - return (in_array($ext, $text_types)) ? 'ascii' : 'binary'; + 'txt', + 'text', + 'php', + 'phps', + 'php4', + 'js', + 'css', + 'htm', + 'html', + 'phtml', + 'shtml', + 'log', + 'xml' + ); + + + return in_array($ext, $text_types) ? 'ascii' : 'binary'; } // ------------------------------------------------------------------------ @@ -617,7 +594,6 @@ class CI_FTP { /** * Close the connection * - * @access public * @return bool */ public function close() @@ -635,20 +611,17 @@ class CI_FTP { /** * Display error message * - * @access private * @param string * @return void */ - private function _error($line) + protected function _error($line) { $CI =& get_instance(); $CI->lang->load('ftp'); show_error($CI->lang->line($line)); } - } -// END FTP Class /* End of file Ftp.php */ -/* Location: ./system/libraries/Ftp.php */ +/* Location: ./system/libraries/Ftp.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 6f042ccc261645530e897bb8c390eae0640bacb0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 14:58:33 +0300 Subject: Switch private methods and properties to protected and cleanup the Cart library --- system/libraries/Cart.php | 46 +++++++++++++++------------------------------- 1 file changed, 15 insertions(+), 31 deletions(-) diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index 60a1e52fe..305960f5f 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * Shopping Cart Class * @@ -41,12 +39,11 @@ class CI_Cart { // These are the regular expression rules that we use to validate the product ID and product name public $product_id_rules = '\.a-z0-9_-'; // alpha-numeric, dashes, underscores, or periods public $product_name_rules = '\.\:\-_ a-z0-9'; // alpha-numeric, dashes, underscores, colons or periods - public $product_name_safe = true; // only allow safe product names - - // Private variables. Do not change! - private $CI; - private $_cart_contents = array(); + public $product_name_safe = TRUE; // only allow safe product names + // Protected variables. Do not change! + protected $CI; + protected $_cart_contents = array(); /** * Shopping Class Constructor @@ -72,7 +69,7 @@ class CI_Cart { $this->_cart_contents = array('cart_total' => 0, 'total_items' => 0); } - log_message('debug', "Cart Class Initialized"); + log_message('debug', 'Cart Class Initialized'); } // -------------------------------------------------------------------- @@ -80,7 +77,6 @@ class CI_Cart { /** * Insert items into the cart and save it to the session table * - * @access public * @param array * @return bool */ @@ -110,7 +106,7 @@ class CI_Cart { { foreach ($items as $val) { - if (is_array($val) AND isset($val['id'])) + if (is_array($val) && isset($val['id'])) { if ($this->_insert($val)) { @@ -135,7 +131,6 @@ class CI_Cart { /** * Insert * - * @access private * @param array * @return bool */ @@ -213,7 +208,7 @@ class CI_Cart { // Internally, we need to treat identical submissions, but with different options, as a unique product. // Our solution is to convert the options array to a string and MD5 it along with the product ID. // This becomes the unique "row ID" - if (isset($items['options']) AND count($items['options']) > 0) + if (isset($items['options']) && count($items['options']) > 0) { $rowid = md5($items['id'].implode('', $items['options'])); } @@ -249,7 +244,6 @@ class CI_Cart { * changes to the quantity before checkout. That array must contain the * product ID and quantity for each item. * - * @access public * @param array * @param string * @return bool @@ -308,11 +302,10 @@ class CI_Cart { * changes to the quantity before checkout. That array must contain the * product ID and quantity for each item. * - * @access private * @param array * @return bool */ - private function _update($items = array()) + protected function _update($items = array()) { // Without these array indexes there is nothing we can do if ( ! isset($items['qty']) OR ! isset($items['rowid']) OR ! isset($this->_cart_contents[$items['rowid']])) @@ -348,10 +341,9 @@ class CI_Cart { /** * Save the cart array to the session DB * - * @access private * @return bool */ - private function _save_cart() + protected function _save_cart() { // Lets add up the individual prices and set the cart sub-total $this->_cart_contents['total_items'] = $this->_cart_contents['cart_total'] = 0; @@ -390,8 +382,7 @@ class CI_Cart { /** * Cart Total * - * @access public - * @return integer + * @return int */ public function total() { @@ -405,8 +396,7 @@ class CI_Cart { * * Removes an item from the cart * - * @access public - * @return boolean + * @return bool */ public function remove($rowid) { @@ -423,8 +413,7 @@ class CI_Cart { * * Returns the total item count * - * @access public - * @return integer + * @return int */ public function total_items() { @@ -438,7 +427,6 @@ class CI_Cart { * * Returns the entire cart array * - * @access public * @return array */ public function contents($newest_first = FALSE) @@ -461,7 +449,6 @@ class CI_Cart { * Returns TRUE if the rowid passed to this function correlates to an item * that has options associated with it. * - * @access public * @return bool */ public function has_options($rowid = '') @@ -476,7 +463,7 @@ class CI_Cart { * * Returns the an array of options, for a particular product row ID * - * @access public + * @param int * @return array */ public function product_options($rowid = '') @@ -491,7 +478,7 @@ class CI_Cart { * * Returns the supplied number with commas and a decimal point. * - * @access public + * @param float * @return string */ public function format_number($n = '') @@ -514,7 +501,6 @@ class CI_Cart { * * Empties the cart and kills the session * - * @access public * @return void */ public function destroy() @@ -523,9 +509,7 @@ class CI_Cart { $this->CI->session->unset_userdata('cart_contents'); } - } -// END Cart Class /* End of file Cart.php */ -/* Location: ./system/libraries/Cart.php */ +/* Location: ./system/libraries/Cart.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 74476e1c4371bb7dc8c9727898026687d875284f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 15:03:40 +0300 Subject: Switch private methods and properties to protected and cleanup the Parser library --- system/libraries/Cart.php | 2 +- system/libraries/Parser.php | 47 ++++++++++++++++----------------------------- 2 files changed, 18 insertions(+), 31 deletions(-) diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index 305960f5f..ca7be555e 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -134,7 +134,7 @@ class CI_Cart { * @param array * @return bool */ - private function _insert($items = array()) + protected function _insert($items = array()) { // Was any cart data passed? No? Bah... if ( ! is_array($items) OR count($items) === 0) diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php index 290e17fc0..d1b5b764b 100644 --- a/system/libraries/Parser.php +++ b/system/libraries/Parser.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * Parser Class * @@ -41,15 +39,14 @@ class CI_Parser { public $l_delim = '{'; public $r_delim = '}'; public $object; - private $CI; + protected $CI; /** - * Parse a template + * Parse a template * * Parses pseudo-variables contained in the specified template view, * replacing them with the data in the second param * - * @access public * @param string * @param array * @param bool @@ -66,12 +63,11 @@ class CI_Parser { // -------------------------------------------------------------------- /** - * Parse a String + * Parse a String * * Parses pseudo-variables contained in the specified string, * replacing them with the data in the second param * - * @access public * @param string * @param array * @param bool @@ -85,18 +81,17 @@ class CI_Parser { // -------------------------------------------------------------------- /** - * Parse a template + * Parse a template * * Parses pseudo-variables contained in the specified template, * replacing them with the data in the second param * - * @access private * @param string * @param array * @param bool * @return string */ - private function _parse($template, $data, $return = FALSE) + protected function _parse($template, $data, $return = FALSE) { if ($template == '') { @@ -126,9 +121,8 @@ class CI_Parser { // -------------------------------------------------------------------- /** - * Set the left/right variable delimiters + * Set the left/right variable delimiters * - * @access public * @param string * @param string * @return void @@ -142,15 +136,14 @@ class CI_Parser { // -------------------------------------------------------------------- /** - * Parse a single key/value + * Parse a single key/value * - * @access private * @param string * @param string * @param string * @return string */ - private function _parse_single($key, $val, $string) + protected function _parse_single($key, $val, $string) { return str_replace($this->l_delim.$key.$this->r_delim, (string) $val, $string); } @@ -158,17 +151,16 @@ class CI_Parser { // -------------------------------------------------------------------- /** - * Parse a tag pair + * Parse a tag pair * - * Parses tag pairs: {some_tag} string... {/some_tag} + * Parses tag pairs: {some_tag} string... {/some_tag} * - * @access private * @param string * @param array * @param string * @return string */ - private function _parse_pair($variable, $data, $string) + protected function _parse_pair($variable, $data, $string) { if (FALSE === ($match = $this->_match_pair($string, $variable))) { @@ -200,25 +192,20 @@ class CI_Parser { // -------------------------------------------------------------------- /** - * Matches a variable pair + * Matches a variable pair * - * @access private * @param string * @param string * @return mixed */ - private function _match_pair($string, $variable) + protected function _match_pair($string, $variable) { - if ( ! preg_match("|" . preg_quote($this->l_delim) . $variable . preg_quote($this->r_delim) . "(.+?)". preg_quote($this->l_delim) . '/' . $variable . preg_quote($this->r_delim) . "|s", $string, $match)) - { - return FALSE; - } - - return $match; + return preg_match('|'.preg_quote($this->l_delim).$variable.preg_quote($this->r_delim).'(.+?)'.preg_quote($this->l_delim).'/'.$variable.preg_quote($this->r_delim).'|s', + $string, $match) + ? $match : FALSE; } } -// END Parser Class /* End of file Parser.php */ -/* Location: ./system/libraries/Parser.php */ +/* Location: ./system/libraries/Parser.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 03c644d7224847402058cde0fa3fbb4e810bfdf2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 15:09:34 +0300 Subject: Temporarily remove PHP 5.2 from travis config --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2584e8ac2..29111bcf5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: php php: - - 5.2 - 5.3 - 5.4 -- cgit v1.2.3-24-g4f1b From b24b033a9c285c98802fbd7bf16d486e355e2f97 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 15:34:39 +0300 Subject: Switch private methods and properties to protected and cleanup the Cache library and drivers --- system/libraries/Cache/Cache.php | 109 +++++++++------------ system/libraries/Cache/drivers/Cache_apc.php | 43 ++++---- system/libraries/Cache/drivers/Cache_dummy.php | 37 +++---- system/libraries/Cache/drivers/Cache_file.php | 42 ++++---- system/libraries/Cache/drivers/Cache_memcached.php | 57 +++++------ system/libraries/Cache/drivers/Cache_wincache.php | 7 +- 6 files changed, 125 insertions(+), 170 deletions(-) diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php index 7642a5270..f98241617 100644 --- a/system/libraries/Cache/Cache.php +++ b/system/libraries/Cache/Cache.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Caching Class * @@ -50,11 +48,37 @@ class CI_Cache extends CI_Driver_Library { protected $_adapter = 'dummy'; protected $_backup_driver; + /** + * Constructor + * + * Initialize class properties based on the configuration array. + * + * @param array + * @return void + */ public function __construct($config = array()) { - if ( ! empty($config)) + $default_config = array( + 'adapter', + 'memcached' + ); + + foreach ($default_config as $key) { - $this->_initialize($config); + if (isset($config[$key])) + { + $param = '_'.$key; + + $this->{$param} = $config[$key]; + } + } + + if (isset($config['backup'])) + { + if (in_array('cache_'.$config['backup'], $this->valid_drivers)) + { + $this->_backup_driver = $config['backup']; + } } } @@ -63,11 +87,11 @@ class CI_Cache extends CI_Driver_Library { /** * Get * - * Look for a value in the cache. If it exists, return the data + * Look for a value in the cache. If it exists, return the data * if not, return FALSE * - * @param string - * @return mixed value that is stored/FALSE on failure + * @param string + * @return mixed value that is stored/FALSE on failure */ public function get($id) { @@ -79,11 +103,10 @@ class CI_Cache extends CI_Driver_Library { /** * Cache Save * - * @param string Unique Key - * @param mixed Data to store - * @param int Length of time (in seconds) to cache the data - * - * @return boolean true on success/false on failure + * @param string Unique Key + * @param mixed Data to store + * @param int Length of time (in seconds) to cache the data + * @return bool true on success/false on failure */ public function save($id, $data, $ttl = 60) { @@ -95,8 +118,8 @@ class CI_Cache extends CI_Driver_Library { /** * Delete from Cache * - * @param mixed unique identifier of the item in the cache - * @return boolean true on success/false on failure + * @param mixed unique identifier of the item in the cache + * @return bool true on success/false on failure */ public function delete($id) { @@ -108,7 +131,7 @@ class CI_Cache extends CI_Driver_Library { /** * Clean the cache * - * @return boolean false on failure/true on success + * @return bool false on failure/true on success */ public function clean() { @@ -120,8 +143,8 @@ class CI_Cache extends CI_Driver_Library { /** * Cache Info * - * @param string user/filehits - * @return mixed array on success, false on failure + * @param string user/filehits + * @return mixed array on success, false on failure */ public function cache_info($type = 'user') { @@ -133,8 +156,8 @@ class CI_Cache extends CI_Driver_Library { /** * Get Cache Metadata * - * @param mixed key to get cache metadata on - * @return mixed return value from child method + * @param mixed key to get cache metadata on + * @return mixed return value from child method */ public function get_metadata($id) { @@ -143,47 +166,11 @@ class CI_Cache extends CI_Driver_Library { // ------------------------------------------------------------------------ - /** - * Initialize - * - * Initialize class properties based on the configuration array. - * - * @param array - * @return void - */ - private function _initialize($config) - { - $default_config = array( - 'adapter', - 'memcached' - ); - - foreach ($default_config as $key) - { - if (isset($config[$key])) - { - $param = '_'.$key; - - $this->{$param} = $config[$key]; - } - } - - if (isset($config['backup'])) - { - if (in_array('cache_'.$config['backup'], $this->valid_drivers)) - { - $this->_backup_driver = $config['backup']; - } - } - } - - // ------------------------------------------------------------------------ - /** * Is the requested driver supported in this environment? * - * @param string The driver to test. - * @return array + * @param string The driver to test. + * @return array */ public function is_supported($driver) { @@ -202,8 +189,8 @@ class CI_Cache extends CI_Driver_Library { /** * __get() * - * @param child - * @return object + * @param child + * @return object */ public function __get($child) { @@ -217,9 +204,7 @@ class CI_Cache extends CI_Driver_Library { return $obj; } - // ------------------------------------------------------------------------ } -// End Class /* End of file Cache.php */ -/* Location: ./system/libraries/Cache/Cache.php */ +/* Location: ./system/libraries/Cache/Cache.php */ \ No newline at end of file diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php index c387a30fc..59ab67533 100644 --- a/system/libraries/Cache/drivers/Cache_apc.php +++ b/system/libraries/Cache/drivers/Cache_apc.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter APC Caching Class * @@ -36,23 +34,22 @@ * @author EllisLab Dev Team * @link */ - class CI_Cache_apc extends CI_Driver { /** * Get * - * Look for a value in the cache. If it exists, return the data + * Look for a value in the cache. If it exists, return the data * if not, return FALSE * - * @param string - * @return mixed value that is stored/FALSE on failure + * @param string + * @return mixed value that is stored/FALSE on failure */ public function get($id) { $data = apc_fetch($id); - return (is_array($data)) ? $data[0] : FALSE; + return is_array($data) ? $data[0] : FALSE; } // ------------------------------------------------------------------------ @@ -60,11 +57,11 @@ class CI_Cache_apc extends CI_Driver { /** * Cache Save * - * @param string Unique Key - * @param mixed Data to store - * @param int Length of time (in seconds) to cache the data + * @param string Unique Key + * @param mixed Data to store + * @param int Length of time (in seconds) to cache the data * - * @return boolean true on success/false on failure + * @return bool true on success/false on failure */ public function save($id, $data, $ttl = 60) { @@ -77,8 +74,8 @@ class CI_Cache_apc extends CI_Driver { /** * Delete from Cache * - * @param mixed unique identifier of the item in the cache - * @param boolean true on success/false on failure + * @param mixed unique identifier of the item in the cache + * @param bool true on success/false on failure */ public function delete($id) { @@ -90,7 +87,7 @@ class CI_Cache_apc extends CI_Driver { /** * Clean the cache * - * @return boolean false on failure/true on success + * @return bool false on failure/true on success */ public function clean() { @@ -102,8 +99,8 @@ class CI_Cache_apc extends CI_Driver { /** * Cache Info * - * @param string user/filehits - * @return mixed array on success, false on failure + * @param string user/filehits + * @return mixed array on success, false on failure */ public function cache_info($type = NULL) { @@ -115,8 +112,8 @@ class CI_Cache_apc extends CI_Driver { /** * Get Cache Metadata * - * @param mixed key to get cache metadata on - * @return mixed array on success/false on failure + * @param mixed key to get cache metadata on + * @return mixed array on success/false on failure */ public function get_metadata($id) { @@ -142,10 +139,12 @@ class CI_Cache_apc extends CI_Driver { * is_supported() * * Check to see if APC is available on this system, bail if it isn't. + * + * @return bool */ public function is_supported() { - if ( ! extension_loaded('apc') OR ini_get('apc.enabled') != "1") + if ( ! extension_loaded('apc') OR ! (bool) @ini_get('apc.enabled')) { log_message('error', 'The APC PHP extension must be loaded to use APC Cache.'); return FALSE; @@ -154,11 +153,7 @@ class CI_Cache_apc extends CI_Driver { return TRUE; } - // ------------------------------------------------------------------------ - - } -// End Class /* End of file Cache_apc.php */ -/* Location: ./system/libraries/Cache/drivers/Cache_apc.php */ +/* Location: ./system/libraries/Cache/drivers/Cache_apc.php */ \ No newline at end of file diff --git a/system/libraries/Cache/drivers/Cache_dummy.php b/system/libraries/Cache/drivers/Cache_dummy.php index c9767e401..e8b791c5b 100644 --- a/system/libraries/Cache/drivers/Cache_dummy.php +++ b/system/libraries/Cache/drivers/Cache_dummy.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Dummy Caching Class * @@ -36,7 +34,6 @@ * @author EllisLab Dev Team * @link */ - class CI_Cache_dummy extends CI_Driver { /** @@ -44,8 +41,8 @@ class CI_Cache_dummy extends CI_Driver { * * Since this is the dummy class, it's always going to return FALSE. * - * @param string - * @return Boolean FALSE + * @param string + * @return bool FALSE */ public function get($id) { @@ -57,11 +54,10 @@ class CI_Cache_dummy extends CI_Driver { /** * Cache Save * - * @param string Unique Key - * @param mixed Data to store - * @param int Length of time (in seconds) to cache the data - * - * @return boolean TRUE, Simulating success + * @param string Unique Key + * @param mixed Data to store + * @param int Length of time (in seconds) to cache the data + * @return bool TRUE, Simulating success */ public function save($id, $data, $ttl = 60) { @@ -73,8 +69,8 @@ class CI_Cache_dummy extends CI_Driver { /** * Delete from Cache * - * @param mixed unique identifier of the item in the cache - * @param boolean TRUE, simulating success + * @param mixed unique identifier of the item in the cache + * @param bool TRUE, simulating success */ public function delete($id) { @@ -86,7 +82,7 @@ class CI_Cache_dummy extends CI_Driver { /** * Clean the cache * - * @return boolean TRUE, simulating success + * @return bool TRUE, simulating success */ public function clean() { @@ -98,8 +94,8 @@ class CI_Cache_dummy extends CI_Driver { /** * Cache Info * - * @param string user/filehits - * @return boolean FALSE + * @param string user/filehits + * @return bool FALSE */ public function cache_info($type = NULL) { @@ -111,8 +107,8 @@ class CI_Cache_dummy extends CI_Driver { /** * Get Cache Metadata * - * @param mixed key to get cache metadata on - * @return boolean FALSE + * @param mixed key to get cache metadata on + * @return bool FALSE */ public function get_metadata($id) { @@ -125,17 +121,14 @@ class CI_Cache_dummy extends CI_Driver { * Is this caching driver supported on the system? * Of course this one is. * - * @return TRUE; + * @return bool TRUE */ public function is_supported() { return TRUE; } - // ------------------------------------------------------------------------ - } -// End Class /* End of file Cache_dummy.php */ -/* Location: ./system/libraries/Cache/drivers/Cache_dummy.php */ +/* Location: ./system/libraries/Cache/drivers/Cache_dummy.php */ \ No newline at end of file diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index c0be0def4..dd27aa90e 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Memcached Caching Class * @@ -36,14 +34,10 @@ * @author EllisLab Dev Team * @link */ - class CI_Cache_file extends CI_Driver { protected $_cache_path; - /** - * Constructor - */ public function __construct() { $CI =& get_instance(); @@ -57,8 +51,8 @@ class CI_Cache_file extends CI_Driver { /** * Fetch from cache * - * @param mixed unique key id - * @return mixed data on success/false on failure + * @param mixed unique key id + * @return mixed data on success/false on failure */ public function get($id) { @@ -83,11 +77,11 @@ class CI_Cache_file extends CI_Driver { /** * Save into cache * - * @param string unique key - * @param mixed data to store - * @param int length of time (in seconds) the cache is valid - * - Default is 60 seconds - * @return boolean true on success/false on failure + * @param string unique key + * @param mixed data to store + * @param int length of time (in seconds) the cache is valid + * - Default is 60 seconds + * @return bool true on success/false on failure */ public function save($id, $data, $ttl = 60) { @@ -111,12 +105,12 @@ class CI_Cache_file extends CI_Driver { /** * Delete from Cache * - * @param mixed unique identifier of item in cache - * @return boolean true on success/false on failure + * @param mixed unique identifier of item in cache + * @return bool true on success/false on failure */ public function delete($id) { - return (file_exists($this->_cache_path.$id)) ? unlink($this->_cache_path.$id) : FALSE; + return file_exists($this->_cache_path.$id) ? unlink($this->_cache_path.$id) : FALSE; } // ------------------------------------------------------------------------ @@ -124,7 +118,7 @@ class CI_Cache_file extends CI_Driver { /** * Clean the Cache * - * @return boolean false on failure/true on success + * @return bool false on failure/true on success */ public function clean() { @@ -138,8 +132,8 @@ class CI_Cache_file extends CI_Driver { * * Not supported by file-based caching * - * @param string user/filehits - * @return mixed FALSE + * @param string user/filehits + * @return mixed FALSE */ public function cache_info($type = NULL) { @@ -151,8 +145,8 @@ class CI_Cache_file extends CI_Driver { /** * Get Cache Metadata * - * @param mixed key to get cache metadata on - * @return mixed FALSE on failure, array on success. + * @param mixed key to get cache metadata on + * @return mixed FALSE on failure, array on success. */ public function get_metadata($id) { @@ -188,16 +182,14 @@ class CI_Cache_file extends CI_Driver { * * In the file driver, check to see that the cache directory is indeed writable * - * @return boolean + * @return bool */ public function is_supported() { return is_really_writable($this->_cache_path); } - // ------------------------------------------------------------------------ } -// End Class /* End of file Cache_file.php */ -/* Location: ./system/libraries/Cache/drivers/Cache_file.php */ +/* Location: ./system/libraries/Cache/drivers/Cache_file.php */ \ No newline at end of file diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php index b8f2d7e4c..1028c8fd5 100644 --- a/system/libraries/Cache/drivers/Cache_memcached.php +++ b/system/libraries/Cache/drivers/Cache_memcached.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Memcached Caching Class * @@ -36,12 +34,11 @@ * @author EllisLab Dev Team * @link */ - class CI_Cache_memcached extends CI_Driver { - private $_memcached; // Holds the memcached object + protected $_memcached; // Holds the memcached object - protected $_memcache_conf = array( + protected $_memcache_conf = array( 'default' => array( 'default_host' => '127.0.0.1', 'default_port' => 11211, @@ -49,19 +46,17 @@ class CI_Cache_memcached extends CI_Driver { ) ); - // ------------------------------------------------------------------------ - /** * Fetch from cache * - * @param mixed unique key id - * @return mixed data on success/false on failure + * @param mixed unique key id + * @return mixed data on success/false on failure */ public function get($id) { $data = $this->_memcached->get($id); - return (is_array($data)) ? $data[0] : FALSE; + return is_array($data) ? $data[0] : FALSE; } // ------------------------------------------------------------------------ @@ -69,18 +64,18 @@ class CI_Cache_memcached extends CI_Driver { /** * Save * - * @param string unique identifier - * @param mixed data being cached - * @param int time to live - * @return boolean true on success, false on failure + * @param string unique identifier + * @param mixed data being cached + * @param int time to live + * @return bool true on success, false on failure */ public function save($id, $data, $ttl = 60) { - if (get_class($this->_memcached) == 'Memcached') + if (get_class($this->_memcached) === 'Memcached') { return $this->_memcached->set($id, array($data, time(), $ttl), $ttl); } - else if (get_class($this->_memcached) == 'Memcache') + elseif (get_class($this->_memcached) === 'Memcache') { return $this->_memcached->set($id, array($data, time(), $ttl), 0, $ttl); } @@ -93,8 +88,8 @@ class CI_Cache_memcached extends CI_Driver { /** * Delete from Cache * - * @param mixed key to be deleted. - * @return boolean true on success, false on failure + * @param mixed key to be deleted. + * @return bool true on success, false on failure */ public function delete($id) { @@ -106,7 +101,7 @@ class CI_Cache_memcached extends CI_Driver { /** * Clean the Cache * - * @return boolean false on failure/true on success + * @return bool false on failure/true on success */ public function clean() { @@ -118,10 +113,9 @@ class CI_Cache_memcached extends CI_Driver { /** * Cache Info * - * @param null type not supported in memcached - * @return mixed array on success, false on failure + * @return mixed array on success, false on failure */ - public function cache_info($type = NULL) + public function cache_info() { return $this->_memcached->getStats(); } @@ -131,8 +125,8 @@ class CI_Cache_memcached extends CI_Driver { /** * Get Cache Metadata * - * @param mixed key to get cache metadata on - * @return mixed FALSE on failure, array on success. + * @param mixed key to get cache metadata on + * @return mixed FALSE on failure, array on success. */ public function get_metadata($id) { @@ -156,8 +150,10 @@ class CI_Cache_memcached extends CI_Driver { /** * Setup memcached. + * + * @return bool */ - private function _setup_memcached() + protected function _setup_memcached() { // Try to load memcached server info from the config file. $CI =& get_instance(); @@ -179,14 +175,13 @@ class CI_Cache_memcached extends CI_Driver { { $this->_memcached = new Memcached(); } - else if (class_exists('Memcache')) + elseif (class_exists('Memcache')) { $this->_memcached = new Memcache(); } else { log_message('error', 'Failed to create object for Memcached Cache; extension not loaded?'); - return FALSE; } @@ -237,23 +232,21 @@ class CI_Cache_memcached extends CI_Driver { * * Returns FALSE if memcached is not supported on the system. * If it is, we setup the memcached object & return TRUE + * + * @return bool */ public function is_supported() { if ( ! extension_loaded('memcached') && ! extension_loaded('memcache')) { log_message('error', 'The Memcached Extension must be loaded to use Memcached Cache.'); - return FALSE; } return $this->_setup_memcached(); } - // ------------------------------------------------------------------------ - } -// End Class /* End of file Cache_memcached.php */ -/* Location: ./system/libraries/Cache/drivers/Cache_memcached.php */ +/* Location: ./system/libraries/Cache/drivers/Cache_memcached.php */ \ No newline at end of file diff --git a/system/libraries/Cache/drivers/Cache_wincache.php b/system/libraries/Cache/drivers/Cache_wincache.php index df619d4e6..b32e66a46 100644 --- a/system/libraries/Cache/drivers/Cache_wincache.php +++ b/system/libraries/Cache/drivers/Cache_wincache.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Wincache Caching Class * @@ -39,7 +37,6 @@ * @author Mike Murkovic * @link */ - class CI_Cache_wincache extends CI_Driver { /** @@ -68,7 +65,7 @@ class CI_Cache_wincache extends CI_Driver { * @param string Unique Key * @param mixed Data to store * @param int Length of time (in seconds) to cache the data - * @return bool true on success/false on failure + * @return bool true on success/false on failure */ public function save($id, $data, $ttl = 60) { @@ -162,4 +159,4 @@ class CI_Cache_wincache extends CI_Driver { } /* End of file Cache_wincache.php */ -/* Location: ./system/libraries/Cache/drivers/Cache_wincache.php */ +/* Location: ./system/libraries/Cache/drivers/Cache_wincache.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 6dbabb565e1411a2c62fa86d46b0b2bbb98ab9b0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 15:41:48 +0300 Subject: Switch a private property to protected and cleanup the Calendar library --- system/libraries/Calendar.php | 61 ++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 35 deletions(-) diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php index 6c04de8a2..b6f145d95 100644 --- a/system/libraries/Calendar.php +++ b/system/libraries/Calendar.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Calendar Class * @@ -40,7 +38,7 @@ */ class CI_Calendar { - private $CI; + protected $CI; public $lang; public $local_time; public $template = ''; @@ -54,6 +52,9 @@ class CI_Calendar { * Constructor * * Loads the calendar language file and sets the default time reference + * + * @param array + * @return void */ public function __construct($config = array()) { @@ -71,7 +72,7 @@ class CI_Calendar { $this->initialize($config); } - log_message('debug', "Calendar Class Initialized"); + log_message('debug', 'Calendar Class Initialized'); } // -------------------------------------------------------------------- @@ -81,7 +82,6 @@ class CI_Calendar { * * Accepts an associative array as input, containing display preferences * - * @access public * @param array config preferences * @return void */ @@ -101,9 +101,8 @@ class CI_Calendar { /** * Generate the calendar * - * @access public - * @param integer the year - * @param integer the month + * @param int the year + * @param int the month * @param array the data to be shown in the calendar cells * @return string */ @@ -147,7 +146,7 @@ class CI_Calendar { // Set the starting day number $local_date = mktime(12, 0, 0, $month, 1, $year); $date = getdate($local_date); - $day = $start_day + 1 - $date["wday"]; + $day = $start_day + 1 - $date['wday']; while ($day > 1) { @@ -160,7 +159,7 @@ class CI_Calendar { $cur_month = date('m', $this->local_time); $cur_day = date('j', $this->local_time); - $is_current_month = ($cur_year == $year AND $cur_month == $month) ? TRUE : FALSE; + $is_current_month = ($cur_year == $year && $cur_month == $month); // Generate the template data array $this->parse_template(); @@ -172,7 +171,7 @@ class CI_Calendar { if ($this->show_next_prev == TRUE) { // Add a trailing slash to the URL if needed - $this->next_prev_url = preg_replace("/(.+?)\/*$/", "\\1/", $this->next_prev_url); + $this->next_prev_url = preg_replace('/(.+?)\/*$/', '\\1/', $this->next_prev_url); $adjusted_date = $this->adjust_date($month - 1, $year); $out .= str_replace('{previous_url}', $this->next_prev_url.$adjusted_date['year'].'/'.$adjusted_date['month'], $this->temp['heading_previous_cell'])."\n"; @@ -213,21 +212,21 @@ class CI_Calendar { for ($i = 0; $i < 7; $i++) { - $out .= ($is_current_month === TRUE AND $day == $cur_day) ? $this->temp['cal_cell_start_today'] : $this->temp['cal_cell_start']; + $out .= ($is_current_month === TRUE && $day == $cur_day) ? $this->temp['cal_cell_start_today'] : $this->temp['cal_cell_start']; - if ($day > 0 AND $day <= $total_days) + if ($day > 0 && $day <= $total_days) { if (isset($data[$day])) { // Cells with content - $temp = ($is_current_month === TRUE AND $day == $cur_day) ? + $temp = ($is_current_month === TRUE && $day == $cur_day) ? $this->temp['cal_cell_content_today'] : $this->temp['cal_cell_content']; $out .= str_replace(array('{content}', '{day}'), array($data[$day], $day), $temp); } else { // Cells with no content - $temp = ($is_current_month === TRUE AND $day == $cur_day) ? + $temp = ($is_current_month === TRUE && $day == $cur_day) ? $this->temp['cal_cell_no_content_today'] : $this->temp['cal_cell_no_content']; $out .= str_replace('{day}', $day, $temp); } @@ -238,7 +237,7 @@ class CI_Calendar { $out .= $this->temp['cal_cell_blank']; } - $out .= ($is_current_month === TRUE AND $day == $cur_day) ? $this->temp['cal_cell_end_today'] : $this->temp['cal_cell_end']; + $out .= ($is_current_month === TRUE && $day == $cur_day) ? $this->temp['cal_cell_end_today'] : $this->temp['cal_cell_end']; $day++; } @@ -258,8 +257,7 @@ class CI_Calendar { * Generates a textual month name based on the numeric * month provided. * - * @access public - * @param integer the month + * @param int the month * @return string */ public function get_month_name($month) @@ -289,9 +287,8 @@ class CI_Calendar { * Get Day Names * * Returns an array of day names (Sunday, Monday, etc.) based - * on the type. Options: long, short, abrev + * on the type. Options: long, short, abrev * - * @access public * @param string * @return array */ @@ -333,9 +330,8 @@ class CI_Calendar { * For example, if you submit 13 as the month, the year will * increment and the month will become January. * - * @access public - * @param integer the month - * @param integer the year + * @param int the month + * @param int the year * @return array */ public function adjust_date($month, $year) @@ -370,10 +366,9 @@ class CI_Calendar { /** * Total days in a given month * - * @access public - * @param integer the month - * @param integer the year - * @return integer + * @param int the month + * @param int the year + * @return int */ public function get_total_days($month, $year) { @@ -387,7 +382,7 @@ class CI_Calendar { // Is the year a leap year? if ($month == 2) { - if ($year % 400 == 0 OR ($year % 4 == 0 AND $year % 100 != 0)) + if ($year % 400 == 0 OR ($year % 4 == 0 && $year % 100 != 0)) { return 29; } @@ -403,8 +398,7 @@ class CI_Calendar { * * This is used in the event that the user has not created their own template * - * @access public - * @return array + * @return array */ public function default_template() { @@ -441,7 +435,6 @@ class CI_Calendar { * Harvests the data within the template {pseudo-variables} * used to display the calendar * - * @access public * @return void */ public function parse_template() @@ -457,7 +450,7 @@ class CI_Calendar { foreach (array('table_open', 'table_close', 'heading_row_start', 'heading_previous_cell', 'heading_title_cell', 'heading_next_cell', 'heading_row_end', 'week_row_start', 'week_day_cell', 'week_row_end', 'cal_row_start', 'cal_cell_start', 'cal_cell_content', 'cal_cell_no_content', 'cal_cell_blank', 'cal_cell_end', 'cal_row_end', 'cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today') as $val) { - if (preg_match("/\{".$val."\}(.*?)\{\/".$val."\}/si", $this->template, $match)) + if (preg_match('/\{'.$val.'\}(.*?)\{\/'.$val.'\}/si', $this->template, $match)) { $this->temp[$val] = $match[1]; } @@ -470,7 +463,5 @@ class CI_Calendar { } -// END CI_Calendar class - /* End of file Calendar.php */ -/* Location: ./system/libraries/Calendar.php */ +/* Location: ./system/libraries/Calendar.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From bb30d79ef0a7d2a3949c479783ab2a1390118836 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 15:49:09 +0300 Subject: Remove access description lines and fix comments in system/core/Common.php --- system/core/Common.php | 190 +++++++++++++++++++++++++------------------------ 1 file changed, 96 insertions(+), 94 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index f20acafd4..aeb784bbe 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * Common Functions * @@ -42,15 +40,14 @@ // ------------------------------------------------------------------------ /** -* Determines if the current version of PHP is greater then the supplied value -* -* Since there are a few places where we conditionally test for PHP > 5 -* we'll set a static variable. -* -* @access public -* @param string -* @return bool TRUE if the current version is $version or higher -*/ + * Determines if the current version of PHP is greater then the supplied value + * + * Since there are a few places where we conditionally test for PHP > 5 + * we'll set a static variable. + * + * @param string + * @return bool TRUE if the current version is $version or higher + */ if ( ! function_exists('is_php')) { function is_php($version = '5.0.0') @@ -76,7 +73,7 @@ if ( ! function_exists('is_php')) * the file, based on the read-only attribute. is_writable() is also unreliable * on Unix servers if safe_mode is on. * - * @access public + * @param string * @return void */ if ( ! function_exists('is_really_writable')) @@ -118,18 +115,17 @@ if ( ! function_exists('is_really_writable')) // ------------------------------------------------------------------------ /** -* Class registry -* -* This function acts as a singleton. If the requested class does not -* exist it is instantiated and set to a static variable. If it has -* previously been instantiated the variable is returned. -* -* @access public -* @param string the class name being requested -* @param string the directory where the class should be found -* @param string the class name prefix -* @return object -*/ + * Class registry + * + * This function acts as a singleton. If the requested class does not + * exist it is instantiated and set to a static variable. If it has + * previously been instantiated the variable is returned. + * + * @param string the class name being requested + * @param string the directory where the class should be found + * @param string the class name prefix + * @return object + */ if ( ! function_exists('load_class')) { function &load_class($class, $directory = 'libraries', $prefix = 'CI_') @@ -192,12 +188,12 @@ if ( ! function_exists('load_class')) // -------------------------------------------------------------------- /** -* Keeps track of which libraries have been loaded. This function is -* called by the load_class() function above -* -* @access public -* @return array -*/ + * Keeps track of which libraries have been loaded. This function is + * called by the load_class() function above + * + * @param string + * @return array + */ if ( ! function_exists('is_loaded')) { function &is_loaded($class = '') @@ -216,14 +212,14 @@ if ( ! function_exists('is_loaded')) // ------------------------------------------------------------------------ /** -* Loads the main config.php file -* -* This function lets us grab the config file even if the Config class -* hasn't been instantiated yet -* -* @access private -* @return array -*/ + * Loads the main config.php file + * + * This function lets us grab the config file even if the Config class + * hasn't been instantiated yet + * + * @param array + * @return array + */ if ( ! function_exists('get_config')) { function &get_config($replace = array()) @@ -276,11 +272,11 @@ if ( ! function_exists('get_config')) // ------------------------------------------------------------------------ /** -* Returns the specified config item -* -* @access public -* @return mixed -*/ + * Returns the specified config item + * + * @param string + * @return mixed + */ if ( ! function_exists('config_item')) { function config_item($item) @@ -305,17 +301,19 @@ if ( ! function_exists('config_item')) // ------------------------------------------------------------------------ /** -* Error Handler -* -* This function lets us invoke the exception class and -* display errors using the standard error template located -* in application/errors/errors.php -* This function will send the error page directly to the -* browser and exit. -* -* @access public -* @return void -*/ + * Error Handler + * + * This function lets us invoke the exception class and + * display errors using the standard error template located + * in application/errors/errors.php + * This function will send the error page directly to the + * browser and exit. + * + * @param string + * @param int + * @param string + * @return void + */ if ( ! function_exists('show_error')) { function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered') @@ -329,15 +327,16 @@ if ( ! function_exists('show_error')) // ------------------------------------------------------------------------ /** -* 404 Page Handler -* -* This function is similar to the show_error() function above -* However, instead of the standard error template it displays -* 404 errors. -* -* @access public -* @return void -*/ + * 404 Page Handler + * + * This function is similar to the show_error() function above + * However, instead of the standard error template it displays + * 404 errors. + * + * @param string + * @param bool + * @return void + */ if ( ! function_exists('show_404')) { function show_404($page = '', $log_error = TRUE) @@ -351,14 +350,16 @@ if ( ! function_exists('show_404')) // ------------------------------------------------------------------------ /** -* Error Logging Interface -* -* We use this as a simple mechanism to access the logging -* class and send messages to be logged. -* -* @access public -* @return void -*/ + * Error Logging Interface + * + * We use this as a simple mechanism to access the logging + * class and send messages to be logged. + * + * @param string + * @param string + * @param bool + * @return void + */ if ( ! function_exists('log_message')) { function log_message($level = 'error', $message, $php_error = FALSE) @@ -380,8 +381,7 @@ if ( ! function_exists('log_message')) /** * Set HTTP Status Header * - * @access public - * @param int the status code + * @param int the status code * @param string * @return void */ @@ -467,19 +467,22 @@ if ( ! function_exists('set_status_header')) // -------------------------------------------------------------------- /** -* Exception Handler -* -* This is the custom exception handler that is declaired at the top -* of Codeigniter.php. The main reason we use this is to permit -* PHP errors to be logged in our own log files since the user may -* not have access to server logs. Since this function -* effectively intercepts PHP errors, however, we also need -* to display errors based on the current error_reporting level. -* We do that with the use of a PHP error template. -* -* @access private -* @return void -*/ + * Exception Handler + * + * This is the custom exception handler that is declaired at the top + * of Codeigniter.php. The main reason we use this is to permit + * PHP errors to be logged in our own log files since the user may + * not have access to server logs. Since this function + * effectively intercepts PHP errors, however, we also need + * to display errors based on the current error_reporting level. + * We do that with the use of a PHP error template. + * + * @param int + * @param string + * @param string + * @param int + * @return void + */ if ( ! function_exists('_exception_handler')) { function _exception_handler($severity, $message, $filepath, $line) @@ -521,8 +524,8 @@ if ( ! function_exists('_exception_handler')) * This prevents sandwiching null characters * between ascii characters, like Java\0script. * - * @access public * @param string + * @param bool * @return string */ if ( ! function_exists('remove_invisible_characters')) @@ -554,12 +557,11 @@ if ( ! function_exists('remove_invisible_characters')) // ------------------------------------------------------------------------ /** -* Returns HTML escaped variable -* -* @access public -* @param mixed -* @return mixed -*/ + * Returns HTML escaped variable + * + * @param mixed + * @return mixed + */ if ( ! function_exists('html_escape')) { function html_escape($var) @@ -571,4 +573,4 @@ if ( ! function_exists('html_escape')) } /* End of file Common.php */ -/* Location: ./system/core/Common.php */ +/* Location: ./system/core/Common.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From a8bb4be3b2aa5984c465bbcf1ef51fd3eba92208 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 15:54:23 +0300 Subject: Remove remaining access description lines from database classes and styleguide example --- system/database/DB_active_rec.php | 40 +++++++++--------------- system/database/drivers/mysqli/mysqli_driver.php | 1 - user_guide_src/source/general/styleguide.rst | 1 - 3 files changed, 15 insertions(+), 27 deletions(-) diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index fe591dda1..b324226ab 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * Active Record Class * @@ -422,7 +420,7 @@ abstract class CI_DB_active_record extends CI_DB_driver { foreach ($key as $k => $v) { - $prefix = (count($this->ar_where) === 0 AND count($this->ar_cache_where) === 0) ? '' : $type; + $prefix = (count($this->ar_where) === 0 && count($this->ar_cache_where) === 0) ? '' : $type; if (is_null($v) && ! $this->_has_operator($k)) { @@ -537,7 +535,7 @@ abstract class CI_DB_active_record extends CI_DB_driver { * * @param string The field to search * @param array The values searched on - * @param boolean If the statement would be IN or NOT IN + * @param bool If the statement would be IN or NOT IN * @param string * @return object */ @@ -719,7 +717,7 @@ abstract class CI_DB_active_record extends CI_DB_driver { { $type = $this->_group_get_type($type); $this->ar_where_group_started = TRUE; - $prefix = (count($this->ar_where) === 0 AND count($this->ar_cache_where) === 0) ? '' : $type; + $prefix = (count($this->ar_where) === 0 && count($this->ar_cache_where) === 0) ? '' : $type; $this->ar_where[] = $value = $prefix.$not.str_repeat(' ', ++$this->ar_where_group_count).' ('; if ($this->ar_caching) @@ -984,8 +982,8 @@ abstract class CI_DB_active_record extends CI_DB_driver { /** * Sets the LIMIT value * - * @param integer the limit value - * @param integer the offset value + * @param int the limit value + * @param int the offset value * @return object */ public function limit($value, $offset = NULL) @@ -1005,7 +1003,7 @@ abstract class CI_DB_active_record extends CI_DB_driver { /** * Sets the OFFSET value * - * @param integer the offset value + * @param int the offset value * @return object */ public function offset($offset) @@ -1021,7 +1019,7 @@ abstract class CI_DB_active_record extends CI_DB_driver { * * @param mixed * @param string - * @param boolean + * @param bool * @return object */ public function set($key, $value = '', $escape = TRUE) @@ -1055,9 +1053,8 @@ abstract class CI_DB_active_record extends CI_DB_driver { * * Compiles a SELECT query string and returns the sql. * - * @access public * @param string the table name to select from (optional) - * @param boolean TRUE: resets AR values; FALSE: leave AR vaules alone + * @param bool TRUE: resets AR values; FALSE: leave AR vaules alone * @return string */ public function get_compiled_select($table = '', $reset = TRUE) @@ -1226,7 +1223,7 @@ abstract class CI_DB_active_record extends CI_DB_driver { * * @param mixed * @param string - * @param boolean + * @param bool * @return object */ public function set_insert_batch($key, $value = '', $escape = TRUE) @@ -1283,9 +1280,8 @@ abstract class CI_DB_active_record extends CI_DB_driver { * * Compiles an insert query and returns the sql * - * @access public * @param string the table to insert into - * @param boolean TRUE: reset AR values; FALSE: leave AR values alone + * @param bool TRUE: reset AR values; FALSE: leave AR values alone * @return string */ public function get_compiled_insert($table = '', $reset = TRUE) @@ -1316,7 +1312,6 @@ abstract class CI_DB_active_record extends CI_DB_driver { * * Compiles an insert string and runs the query * - * @access public * @param string the table to insert data into * @param array an associative array of insert values * @return object @@ -1352,7 +1347,6 @@ abstract class CI_DB_active_record extends CI_DB_driver { * validate that the there data is actually being set and that table * has been chosen to be inserted into. * - * @access public * @param string the table to insert data into * @return string */ @@ -1423,9 +1417,8 @@ abstract class CI_DB_active_record extends CI_DB_driver { * * Compiles an update query and returns the sql * - * @access public * @param string the table to update - * @param boolean TRUE: reset AR values; FALSE: leave AR values alone + * @param bool TRUE: reset AR values; FALSE: leave AR values alone * @return string */ public function get_compiled_update($table = '', $reset = TRUE) @@ -1499,7 +1492,6 @@ abstract class CI_DB_active_record extends CI_DB_driver { * validate that data is actually being set and that a table has been * chosen to be update. * - * @access public * @param string the table to update data on * @return bool */ @@ -1584,7 +1576,7 @@ abstract class CI_DB_active_record extends CI_DB_driver { * * @param array * @param string - * @param boolean + * @param bool * @return object */ public function set_update_batch($key, $index = '', $escape = TRUE) @@ -1696,9 +1688,8 @@ abstract class CI_DB_active_record extends CI_DB_driver { * * Compiles a delete query string and returns the sql * - * @access public * @param string the table to delete from - * @param boolean TRUE: reset AR values; FALSE: leave AR values alone + * @param bool TRUE: reset AR values; FALSE: leave AR values alone * @return string */ public function get_compiled_delete($table = '', $reset = TRUE) @@ -1719,7 +1710,7 @@ abstract class CI_DB_active_record extends CI_DB_driver { * @param mixed the table(s) to delete from. String or array * @param mixed the where clause * @param mixed the limit clause - * @param boolean + * @param bool * @return object */ public function delete($table = '', $where = '', $limit = NULL, $reset_data = TRUE) @@ -2062,7 +2053,6 @@ abstract class CI_DB_active_record extends CI_DB_driver { * * Empties the AR cache * - * @access public * @return void */ public function flush_cache() @@ -2114,7 +2104,7 @@ abstract class CI_DB_active_record extends CI_DB_driver { // If we are "protecting identifiers" we need to examine the "from" // portion of the query to determine if there are any aliases - if ($this->_protect_identifiers === TRUE AND count($this->ar_cache_from) > 0) + if ($this->_protect_identifiers === TRUE && count($this->ar_cache_from) > 0) { $this->_track_aliases($this->ar_from); } diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index 4c5d52127..041daf710 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -357,7 +357,6 @@ class CI_DB_mysqli_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access private * @param bool * @return string */ diff --git a/user_guide_src/source/general/styleguide.rst b/user_guide_src/source/general/styleguide.rst index d8bdd0531..c97f23817 100644 --- a/user_guide_src/source/general/styleguide.rst +++ b/user_guide_src/source/general/styleguide.rst @@ -168,7 +168,6 @@ picked up by IDEs:: /** * Encodes string for use in XML * - * @access public * @param string * @return string */ -- cgit v1.2.3-24-g4f1b From 5227837eca102b5aa2c14daa4201ffcb0a79f246 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 16:02:30 +0300 Subject: Remove access description lines and cleanup the Xmlrpcs library --- system/libraries/Xmlrpcs.php | 64 ++++++++++++++------------------------------ 1 file changed, 20 insertions(+), 44 deletions(-) diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php index fc41444bc..6d270c2ea 100644 --- a/system/libraries/Xmlrpcs.php +++ b/system/libraries/Xmlrpcs.php @@ -54,10 +54,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc public $controller_obj; public $object = FALSE; - /** - * Constructor - */ - public function __construct($config=array()) + public function __construct($config = array()) { parent::__construct(); $this->set_system_methods(); @@ -67,7 +64,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc $this->methods = array_merge($this->methods, $config['functions']); } - log_message('debug', "XML-RPC Server Class Initialized"); + log_message('debug', 'XML-RPC Server Class Initialized'); } // -------------------------------------------------------------------- @@ -75,7 +72,6 @@ class CI_Xmlrpcs extends CI_Xmlrpc /** * Initialize Prefs and Serve * - * @access public * @param mixed * @return void */ @@ -107,7 +103,6 @@ class CI_Xmlrpcs extends CI_Xmlrpc /** * Setting of System Methods * - * @access public * @return void */ public function set_system_methods() @@ -137,7 +132,6 @@ class CI_Xmlrpcs extends CI_Xmlrpc /** * Main Server Function * - * @access public * @return void */ public function serve() @@ -145,8 +139,8 @@ class CI_Xmlrpcs extends CI_Xmlrpc $r = $this->parseRequest(); $payload = 'xmlrpc_defencoding.'"?'.'>'."\n".$this->debug_msg.$r->prepare_response(); - header("Content-Type: text/xml"); - header("Content-Length: ".strlen($payload)); + header('Content-Type: text/xml'); + header('Content-Length: '.strlen($payload)); exit($payload); } @@ -155,7 +149,6 @@ class CI_Xmlrpcs extends CI_Xmlrpc /** * Add Method to Class * - * @access public * @param string method name * @param string function * @param string signature @@ -176,7 +169,6 @@ class CI_Xmlrpcs extends CI_Xmlrpc /** * Parse Server Request * - * @access public * @param string data * @return object xmlrpc response */ @@ -198,7 +190,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- $parser = xml_parser_create($this->xmlrpc_defencoding); - $parser_object = new XML_RPC_Message("filler"); + $parser_object = new XML_RPC_Message('filler'); $parser_object->xh[$parser] = array( 'isf' => 0, @@ -215,7 +207,6 @@ class CI_Xmlrpcs extends CI_Xmlrpc xml_set_character_data_handler($parser, 'character_data'); //xml_set_default_handler($parser, 'default_handler'); - //------------------------------------- // PARSE + PROCESS XML DATA //------------------------------------- @@ -245,7 +236,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc { if ($this->debug === TRUE) { - $plist .= "$i - " . print_r(get_object_vars($parser_object->xh[$parser]['params'][$i]), TRUE). ";\n"; + $plist .= $i.' - '.print_r(get_object_vars($parser_object->xh[$parser]['params'][$i]), TRUE).";\n"; } $m->addParam($parser_object->xh[$parser]['params'][$i]); @@ -276,7 +267,6 @@ class CI_Xmlrpcs extends CI_Xmlrpc /** * Executes the Method * - * @access protected * @param object * @return mixed */ @@ -305,7 +295,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc // Check for Method (and Object) //------------------------------------- - $method_parts = explode(".", $this->methods[$methName]['function']); + $method_parts = explode('.', $this->methods[$methName]['function']); $objectCall = (isset($method_parts[1]) && $method_parts[1] != ''); if ($system_call === TRUE) @@ -315,14 +305,11 @@ class CI_Xmlrpcs extends CI_Xmlrpc return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']); } } - else + elseif (($objectCall && ! is_callable(array($method_parts[0], $method_parts[1]))) + OR ( ! $objectCall && ! is_callable($this->methods[$methName]['function'])) + ) { - if (($objectCall AND ! is_callable(array($method_parts[0], $method_parts[1]))) - OR ( ! $objectCall AND ! is_callable($this->methods[$methName]['function'])) - ) - { - return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']); - } + return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']); } //------------------------------------- @@ -351,7 +338,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc return new XML_RPC_Response(0, $this->xmlrpcerr['incorrect_params'], $this->xmlrpcstr['incorrect_params'] . - ": Wanted {$wanted}, got {$pt} at param {$pno})"); + ': Wanted '.$wanted.', got '.$pt.' at param '.$pno.')'); } } } @@ -393,7 +380,6 @@ class CI_Xmlrpcs extends CI_Xmlrpc /** * Server Function: List Methods * - * @access public * @param mixed * @return object */ @@ -409,7 +395,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc foreach ($this->system_methods as $key => $value) { - $output[]= new XML_RPC_Values($key, 'string'); + $output[] = new XML_RPC_Values($key, 'string'); } $v->addArray($output); @@ -421,7 +407,6 @@ class CI_Xmlrpcs extends CI_Xmlrpc /** * Server Function: Return Signature for Method * - * @access public * @param mixed * @return object */ @@ -447,18 +432,14 @@ class CI_Xmlrpcs extends CI_Xmlrpc } $sigs[] = new XML_RPC_Values($cursig, 'array'); } - $r = new XML_RPC_Response(new XML_RPC_Values($sigs, 'array')); - } - else - { - $r = new XML_RPC_Response(new XML_RPC_Values('undef', 'string')); + + return new XML_RPC_Response(new XML_RPC_Values($sigs, 'array')); } + + return new XML_RPC_Response(new XML_RPC_Values('undef', 'string')); } - else - { - $r = new XML_RPC_Response(0,$this->xmlrpcerr['introspect_unknown'], $this->xmlrpcstr['introspect_unknown']); - } - return $r; + + return new XML_RPC_Response(0,$this->xmlrpcerr['introspect_unknown'], $this->xmlrpcstr['introspect_unknown']); } // -------------------------------------------------------------------- @@ -466,7 +447,6 @@ class CI_Xmlrpcs extends CI_Xmlrpc /** * Server Function: Doc String for Method * - * @access public * @param mixed * @return object */ @@ -492,7 +472,6 @@ class CI_Xmlrpcs extends CI_Xmlrpc /** * Server Function: Multi-call * - * @access public * @param mixed * @return object */ @@ -536,7 +515,6 @@ class CI_Xmlrpcs extends CI_Xmlrpc /** * Multi-call Function: Error Handling * - * @access public * @param mixed * @return object */ @@ -556,7 +534,6 @@ class CI_Xmlrpcs extends CI_Xmlrpc /** * Multi-call Function: Processes method * - * @access public * @param mixed * @return object */ @@ -610,7 +587,6 @@ class CI_Xmlrpcs extends CI_Xmlrpc } } -// END XML_RPC_Server class /* End of file Xmlrpcs.php */ -/* Location: ./system/libraries/Xmlrpcs.php */ +/* Location: ./system/libraries/Xmlrpcs.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From d69082b8af130ac74806203140a391fc8ca18b82 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 16:14:26 +0300 Subject: Remove access description lines and cleanup the Typography library --- system/libraries/Typography.php | 53 ++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 33 deletions(-) diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php index 65e30b089..21bbad038 100644 --- a/system/libraries/Typography.php +++ b/system/libraries/Typography.php @@ -25,13 +25,11 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * Typography Class * - * - * @access protected + * @package CodeIgniter + * @subpackage Libraries * @category Helpers * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/libraries/typography.html @@ -67,7 +65,6 @@ class CI_Typography { * - Converts double dashes into em-dashes. * - Converts two spaces into entities * - * @access public * @param string * @param bool whether to reduce more then two consecutive newlines to two * @return string @@ -94,15 +91,12 @@ class CI_Typography { // HTML comment tags don't conform to patterns of normal tags, so pull them out separately, only if needed $html_comments = array(); - if (strpos($str, '", - "'", - "<", - ">", - '"', - '&', - '$', - '=', - ';', - '?', - '/', - "%20", - "%22", - "%3c", // < - "%253c", // < - "%3e", // > - "%0e", // > - "%28", // ( - "%29", // ) - "%2528", // ( - "%26", // & - "%24", // $ - "%3f", // ? - "%3b", // ; - "%3d" // = - ); - - $filename = str_replace($bad, '', $filename); - - return stripslashes($filename); + '', + "'", '"', + '<', '>', + '&', '$', + '=', + ';', + '?', + '/', + '%20', + '%22', + '%3c', // < + '%253c', // < + '%3e', // > + '%0e', // > + '%28', // ( + '%29', // ) + '%2528', // ( + '%26', // & + '%24', // $ + '%3f', // ? + '%3b', // ; + '%3d' // = + ); + + return stripslashes(str_replace($bad, '', $filename)); } // -------------------------------------------------------------------- @@ -847,7 +817,7 @@ class CI_Upload { $current = ini_get('memory_limit') * 1024 * 1024; // There was a bug/behavioural change in PHP 5.2, where numbers over one million get output - // into scientific notation. number_format() ensures this number is an integer + // into scientific notation. number_format() ensures this number is an integer // http://bugs.php.net/bug.php?id=43053 $new_memory = number_format(ceil(filesize($file) + $current), 0, '.', ''); @@ -857,8 +827,8 @@ class CI_Upload { // If the file being uploaded is an image, then we should have no problem with XSS attacks (in theory), but // IE can be fooled into mime-type detecting a malformed image as an html file, thus executing an XSS attack on anyone - // using IE who looks at the image. It does this by inspecting the first 255 bytes of an image. To get around this - // CI will itself look at the first 255 bytes of an image to determine its relative safety. This can save a lot of + // using IE who looks at the image. It does this by inspecting the first 255 bytes of an image. To get around this + // CI will itself look at the first 255 bytes of an image to determine its relative safety. This can save a lot of // processor power and time if it is actually a clean image, as it will be in nearly all instances _except_ an // attempted XSS attack. @@ -932,7 +902,7 @@ class CI_Upload { */ public function display_errors($open = '

', $close = '

') { - return (count($this->error_msg) > 0) ? $open . implode($close . $open, $this->error_msg) . $close : ''; + return (count($this->error_msg) > 0) ? $open.implode($close.$open, $this->error_msg).$close : ''; } // -------------------------------------------------------------------- @@ -940,7 +910,7 @@ class CI_Upload { /** * List of Mime Types * - * This is a list of mime types. We use it to validate + * This is a list of mime types. We use it to validate * the "allowed types" set by the developer * * @param string @@ -952,7 +922,7 @@ class CI_Upload { if (count($this->mimes) == 0) { - if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) + if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) { include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'); } @@ -966,10 +936,9 @@ class CI_Upload { } $this->mimes = $mimes; - unset($mimes); } - return ( ! isset($this->mimes[$mime])) ? FALSE : $this->mimes[$mime]; + return isset($this->mimes[$mime]) ? $this->mimes[$mime] : FALSE; } // -------------------------------------------------------------------- @@ -1006,9 +975,7 @@ class CI_Upload { } } - $filename .= '.'.$ext; - - return $filename; + return $filename.'.'.$ext; } // -------------------------------------------------------------------- @@ -1129,10 +1096,7 @@ class CI_Upload { $this->file_type = $file['type']; } - // -------------------------------------------------------------------- - } -// END Upload Class /* End of file Upload.php */ -/* Location: ./system/libraries/Upload.php */ +/* Location: ./system/libraries/Upload.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 8486e9cbdd28e80b41e517afe786e9b0c917af8a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 20:24:12 +0300 Subject: Renamed (with an underscore prefix) and switched from private to protected properties in the Driver library --- system/libraries/Driver.php | 52 ++++++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index 9a073b336..f409f47d4 100644 --- a/system/libraries/Driver.php +++ b/system/libraries/Driver.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Driver Library Class * @@ -84,8 +82,8 @@ class CI_Driver_Library { // it's a valid driver, but the file simply can't be found if ( ! class_exists($child_class)) { - log_message('error', "Unable to load the requested driver: ".$child_class); - show_error("Unable to load the requested driver: ".$child_class); + log_message('error', 'Unable to load the requested driver: '.$child_class); + show_error('Unable to load the requested driver: '.$child_class); } } @@ -96,15 +94,11 @@ class CI_Driver_Library { } // The requested driver isn't valid! - log_message('error', "Invalid driver requested: ".$child_class); - show_error("Invalid driver requested: ".$child_class); + log_message('error', 'Invalid driver requested: '.$child_class); + show_error('Invalid driver requested: '.$child_class); } - // -------------------------------------------------------------------- - } -// END CI_Driver_Library CLASS - /** * CodeIgniter Driver Class @@ -120,12 +114,12 @@ class CI_Driver_Library { */ class CI_Driver { - protected $parent; + protected $_parent; - private $methods = array(); - private $properties = array(); + protected $_methods = array(); + protected $_properties = array(); - private static $reflections = array(); + protected static $_reflections = array(); /** * Decorate @@ -137,14 +131,14 @@ class CI_Driver { */ public function decorate($parent) { - $this->parent = $parent; + $this->_parent = $parent; // Lock down attributes to what is defined in the class // and speed up references in magic methods $class_name = get_class($parent); - if ( ! isset(self::$reflections[$class_name])) + if ( ! isset(self::$_reflections[$class_name])) { $r = new ReflectionObject($parent); @@ -152,7 +146,7 @@ class CI_Driver { { if ($method->isPublic()) { - $this->methods[] = $method->getName(); + $this->_methods[] = $method->getName(); } } @@ -160,15 +154,15 @@ class CI_Driver { { if ($prop->isPublic()) { - $this->properties[] = $prop->getName(); + $this->_properties[] = $prop->getName(); } } - self::$reflections[$class_name] = array($this->methods, $this->properties); + self::$_reflections[$class_name] = array($this->_methods, $this->_properties); } else { - list($this->methods, $this->properties) = self::$reflections[$class_name]; + list($this->_methods, $this->_properties) = self::$_reflections[$class_name]; } } @@ -179,16 +173,15 @@ class CI_Driver { * * Handles access to the parent driver library's methods * - * @access public * @param string * @param array * @return mixed */ public function __call($method, $args = array()) { - if (in_array($method, $this->methods)) + if (in_array($method, $this->_methods)) { - return call_user_func_array(array($this->parent, $method), $args); + return call_user_func_array(array($this->_parent, $method), $args); } $trace = debug_backtrace(); @@ -208,9 +201,9 @@ class CI_Driver { */ public function __get($var) { - if (in_array($var, $this->properties)) + if (in_array($var, $this->_properties)) { - return $this->parent->$var; + return $this->_parent->$var; } } @@ -227,16 +220,13 @@ class CI_Driver { */ public function __set($var, $val) { - if (in_array($var, $this->properties)) + if (in_array($var, $this->_properties)) { - $this->parent->$var = $val; + $this->_parent->$var = $val; } } - // -------------------------------------------------------------------- - } -// END CI_Driver CLASS /* End of file Driver.php */ -/* Location: ./system/libraries/Driver.php */ +/* Location: ./system/libraries/Driver.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 627e172fd3ada0fc2b648a3fff10af4a0022378f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 20:53:47 +0300 Subject: Remove access description lines and cleanup the download, language, number, path & xml helpers --- system/helpers/download_helper.php | 3 +-- system/helpers/language_helper.php | 7 ++----- system/helpers/number_helper.php | 5 +---- system/helpers/path_helper.php | 3 +-- system/helpers/xml_helper.php | 14 ++++++-------- 5 files changed, 11 insertions(+), 21 deletions(-) diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 96ff29dec..19192a147 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -42,7 +42,6 @@ * * Generates headers that force a download to happen * - * @access public * @param string filename * @param mixed the data to be downloaded * @param bool wether to try and send the actual file MIME type @@ -125,4 +124,4 @@ if ( ! function_exists('force_download')) } /* End of file download_helper.php */ -/* Location: ./system/helpers/download_helper.php */ +/* Location: ./system/helpers/download_helper.php */ \ No newline at end of file diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php index 1d66df59f..b31c97107 100644 --- a/system/helpers/language_helper.php +++ b/system/helpers/language_helper.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Language Helpers * @@ -44,7 +42,6 @@ * * Fetches a language variable and optionally outputs a form label * - * @access public * @param string the language line * @param string the id of the form element * @return string @@ -58,7 +55,7 @@ if ( ! function_exists('lang')) if ($id != '') { - $line = '"; + $line = ''; } return $line; @@ -66,4 +63,4 @@ if ( ! function_exists('lang')) } /* End of file language_helper.php */ -/* Location: ./system/helpers/language_helper.php */ +/* Location: ./system/helpers/language_helper.php */ \ No newline at end of file diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index b6c823d8b..40da6e7bf 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Number Helpers * @@ -42,7 +40,6 @@ /** * Formats a numbers as bytes, based on size, and adds the appropriate suffix * - * @access public * @param mixed // will be cast as int * @return string */ @@ -84,4 +81,4 @@ if ( ! function_exists('byte_format')) } /* End of file number_helper.php */ -/* Location: ./system/helpers/number_helper.php */ +/* Location: ./system/helpers/number_helper.php */ \ No newline at end of file diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index c31f0bdc5..6ee99072c 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -40,7 +40,6 @@ /** * Set Realpath * - * @access public * @param string * @param bool checks to see if the path exists * @return string @@ -71,4 +70,4 @@ if ( ! function_exists('set_realpath')) } /* End of file path_helper.php */ -/* Location: ./system/helpers/path_helper.php */ +/* Location: ./system/helpers/path_helper.php */ \ No newline at end of file diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php index f3ff5764c..67fd34b97 100644 --- a/system/helpers/xml_helper.php +++ b/system/helpers/xml_helper.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter XML Helpers * @@ -42,8 +40,8 @@ /** * Convert Reserved XML characters to Entities * - * @access public * @param string + * @param bool * @return string */ if ( ! function_exists('xml_convert')) @@ -54,11 +52,11 @@ if ( ! function_exists('xml_convert')) // Replace entities to temporary markers so that // ampersands won't get messed up - $str = preg_replace("/&#(\d+);/", "$temp\\1;", $str); + $str = preg_replace('/&#(\d+);/', $temp.'\\1;', $str); if ($protect_all == TRUE) { - $str = preg_replace('/&(\w+);/', "$temp\\1;", $str); + $str = preg_replace('/&(\w+);/', $temp.'\\1;', $str); } $str = str_replace(array('&', '<', '>', '"', "'", '-'), @@ -66,11 +64,11 @@ if ( ! function_exists('xml_convert')) $str); // Decode the temp markers back to entities - $str = preg_replace('/$temp(\d+);/', '&#\\1;', $str); + $str = preg_replace('/'.$temp.'(\d+);/', '&#\\1;', $str); if ($protect_all == TRUE) { - return preg_replace("/$temp(\w+);/", '&\\1;', $str); + return preg_replace('/'.$temp.'(\w+);/', '&\\1;', $str); } return $str; @@ -78,4 +76,4 @@ if ( ! function_exists('xml_convert')) } /* End of file xml_helper.php */ -/* Location: ./system/helpers/xml_helper.php */ +/* Location: ./system/helpers/xml_helper.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 2046b1a14f68495e6324edb26250916037bce9e1 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 21:07:04 +0300 Subject: Remove access description lines and cleanup the html helper --- system/helpers/html_helper.php | 66 ++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 41 deletions(-) diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index b8c4f36f6..0417bd253 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter HTML Helpers * @@ -42,12 +40,10 @@ /** * Heading * - * Generates an HTML heading tag. First param is the data. - * Second param is the size of the heading tag. + * Generates an HTML heading tag. * - * @access public - * @param string - * @param integer + * @param string content + * @param int heading level * @return string */ if ( ! function_exists('heading')) @@ -65,7 +61,6 @@ if ( ! function_exists('heading')) * * Generates an HTML unordered list from an single or multi-dimensional array. * - * @access public * @param array * @param mixed * @return string @@ -85,7 +80,6 @@ if ( ! function_exists('ul')) * * Generates an HTML ordered list from an single or multi-dimensional array. * - * @access public * @param array * @param mixed * @return string @@ -105,11 +99,10 @@ if ( ! function_exists('ol')) * * Generates an HTML ordered list from an single or multi-dimensional array. * - * @access private * @param string * @param mixed * @param mixed - * @param integer + * @param int * @return string */ if ( ! function_exists('_list')) @@ -131,13 +124,13 @@ if ( ! function_exists('_list')) $atts = ''; foreach ($attributes as $key => $val) { - $atts .= ' ' . $key . '="' . $val . '"'; + $atts .= ' '.$key.'="'.$val.'"'; } $attributes = $atts; } - elseif (is_string($attributes) AND strlen($attributes) > 0) + elseif (is_string($attributes) && strlen($attributes) > 0) { - $attributes = ' '. $attributes; + $attributes = ' '.$attributes; } // Write the opening list tag @@ -175,8 +168,7 @@ if ( ! function_exists('_list')) /** * Generates HTML BR tags based on number supplied * - * @access public - * @param integer + * @param int * @return string */ if ( ! function_exists('br')) @@ -194,8 +186,8 @@ if ( ! function_exists('br')) * * Generates an element * - * @access public * @param mixed + * @param bool * @return string */ if ( ! function_exists('img')) @@ -217,7 +209,7 @@ if ( ! function_exists('img')) foreach ($src as $k => $v) { - if ($k === 'src' AND strpos($v, '://') === FALSE) + if ($k === 'src' && strpos($v, '://') === FALSE) { $CI =& get_instance(); @@ -232,7 +224,7 @@ if ( ! function_exists('img')) } else { - $img .= " $k=\"$v\""; + $img .= ' '.$k.'="'.$v.'"'; } } @@ -248,10 +240,9 @@ if ( ! function_exists('img')) * Generates a page document type declaration * * Valid options are xhtml-11, xhtml-strict, xhtml-trans, xhtml-frame, - * html4-strict, html4-trans, and html4-frame. Values are saved in the + * html4-strict, html4-trans, and html4-frame. Values are saved in the * doctypes config file. * - * @access public * @param string type The doctype to be generated * @return string */ @@ -263,7 +254,7 @@ if ( ! function_exists('doctype')) if ( ! is_array($_doctypes)) { - if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php')) + if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php')) { include(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php'); } @@ -278,7 +269,7 @@ if ( ! function_exists('doctype')) } } - return (isset($_doctypes[$type])) ? $_doctypes[$type] : FALSE; + return isset($_doctypes[$type]) ? $_doctypes[$type] : FALSE; } } @@ -289,13 +280,12 @@ if ( ! function_exists('doctype')) * * Generates link to a CSS file * - * @access public * @param mixed stylesheet hrefs or an array * @param string rel * @param string type * @param string title * @param string media - * @param boolean should index_page be added to the css path + * @param bool should index_page be added to the css path * @return string */ if ( ! function_exists('link_tag')) @@ -309,7 +299,7 @@ if ( ! function_exists('link_tag')) { foreach ($href as $k => $v) { - if ($k === 'href' AND strpos($v, '://') === FALSE) + if ($k === 'href' && strpos($v, '://') === FALSE) { if ($index_page === TRUE) { @@ -322,11 +312,9 @@ if ( ! function_exists('link_tag')) } else { - $link .= "$k=\"$v\" "; + $link .= $k.'="'.$v.'" '; } } - - $link .= '/>'; } else { @@ -354,11 +342,9 @@ if ( ! function_exists('link_tag')) { $link .= 'title="'.$title.'" '; } - - $link .= '/>'; } - return $link."\n"; + return $link."/>\n"; } } @@ -367,8 +353,10 @@ if ( ! function_exists('link_tag')) /** * Generates meta tags from an array of key/values * - * @access public * @param array + * @param string + * @param string + * @param string * @return string */ if ( ! function_exists('meta')) @@ -381,13 +369,10 @@ if ( ! function_exists('meta')) { $name = array(array('name' => $name, 'content' => $content, 'type' => $type, 'newline' => $newline)); } - else + elseif (isset($name['name'])) { // Turn single array into multidimensional - if (isset($name['name'])) - { - $name = array($name); - } + $name = array($name); } $str = ''; @@ -410,8 +395,7 @@ if ( ! function_exists('meta')) /** * Generates non-breaking space entities based on number supplied * - * @access public - * @param integer + * @param int * @return string */ if ( ! function_exists('nbs')) @@ -423,4 +407,4 @@ if ( ! function_exists('nbs')) } /* End of file html_helper.php */ -/* Location: ./system/helpers/html_helper.php */ +/* Location: ./system/helpers/html_helper.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 93a83c720e69d1d363896f6b685d2b7ef475ebbc Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 21:24:02 +0300 Subject: Remove access description lines and cleanup the form helper --- system/helpers/form_helper.php | 161 ++++++++++++++--------------------------- 1 file changed, 56 insertions(+), 105 deletions(-) diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 37337d975..ada822860 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -24,8 +24,6 @@ * @since Version 1.0 */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Form Helpers * @@ -43,7 +41,6 @@ * * Creates the opening portion of the form. * - * @access public * @param string the URI segments of the form destination * @param array a key/value pair of attributes * @param array a key/value pair hidden data @@ -71,15 +68,15 @@ if ( ! function_exists('form_open')) $form = '
\n"; - // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites - if ($CI->config->item('csrf_protection') === TRUE AND ! (strpos($action, $CI->config->base_url()) === FALSE OR strpos($form, 'method="get"'))) + // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites + if ($CI->config->item('csrf_protection') === TRUE && ! (strpos($action, $CI->config->base_url()) === FALSE OR strpos($form, 'method="get"'))) { $hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash(); } - if (is_array($hidden) AND count($hidden) > 0) + if (is_array($hidden) && count($hidden) > 0) { - $form .= sprintf("
%s
", form_hidden($hidden)); + $form .= sprintf('
%s
', form_hidden($hidden)); } return $form; @@ -93,7 +90,6 @@ if ( ! function_exists('form_open')) * * Creates the opening portion of the form, but with "multipart/form-data". * - * @access public * @param string the URI segments of the form destination * @param array a key/value pair of attributes * @param array a key/value pair hidden data @@ -121,10 +117,9 @@ if ( ! function_exists('form_open_multipart')) /** * Hidden Input Field * - * Generates hidden fields. You can pass a simple key/value string or an associative - * array with multiple values. + * Generates hidden fields. You can pass a simple key/value string or + * an associative array with multiple values. * - * @access public * @param mixed * @param string * @return string @@ -157,7 +152,7 @@ if ( ! function_exists('form_hidden')) { foreach ($value as $k => $v) { - $k = (is_int($k)) ? '' : $k; + $k = is_int($k) ? '' : $k; form_hidden($name.'['.$k.']', $v, TRUE); } } @@ -171,7 +166,6 @@ if ( ! function_exists('form_hidden')) /** * Text Input Field * - * @access public * @param mixed * @param string * @param string @@ -181,7 +175,7 @@ if ( ! function_exists('form_input')) { function form_input($data = '', $value = '', $extra = '') { - $defaults = array('type' => 'text', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value); + $defaults = array('type' => 'text', 'name' => ( ! is_array($data) ? $data : ''), 'value' => $value); return '\n"; } @@ -194,7 +188,6 @@ if ( ! function_exists('form_input')) * * Identical to the input function but adds the "password" type * - * @access public * @param mixed * @param string * @param string @@ -221,7 +214,6 @@ if ( ! function_exists('form_password')) * * Identical to the input function but adds the "file" type * - * @access public * @param mixed * @param string * @param string @@ -246,7 +238,6 @@ if ( ! function_exists('form_upload')) /** * Textarea field * - * @access public * @param mixed * @param string * @param string @@ -256,7 +247,7 @@ if ( ! function_exists('form_textarea')) { function form_textarea($data = '', $value = '', $extra = '') { - $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'cols' => '40', 'rows' => '10'); + $defaults = array('name' => ( ! is_array($data) ? $data : ''), 'cols' => '40', 'rows' => '10'); if ( ! is_array($data) OR ! isset($data['value'])) { @@ -268,7 +259,7 @@ if ( ! function_exists('form_textarea')) unset($data['value']); // textareas don't use the value attribute } - $name = (is_array($data)) ? $data['name'] : $data; + $name = is_array($data) ? $data['name'] : $data; return '\n"; } } @@ -278,12 +269,11 @@ if ( ! function_exists('form_textarea')) /** * Multi-select menu * - * @access public * @param string * @param array * @param mixed * @param string - * @return type + * @return string */ if ( ! function_exists('form_multiselect')) { @@ -303,7 +293,6 @@ if ( ! function_exists('form_multiselect')) /** * Drop-down Menu * - * @access public * @param string * @param array * @param string @@ -314,28 +303,16 @@ if ( ! function_exists('form_dropdown')) { function form_dropdown($name = '', $options = array(), $selected = array(), $extra = '') { - // If name is really an array then we'll call the function again using the array - if (is_array($name) && isset($name['name'])) - { - - if ( ! isset($name['options'])) - { - $name['options'] = array(); - } - - if ( ! isset($name['selected'])) - { - $name['selected'] = array(); - } - - if ( ! isset($name['extra'])) - { - $name['extra'] = ''; - } - - return form_dropdown($name['name'], $name['options'], $name['selected'], $name['extra']); - } - + // If name is really an array then we'll call the function again using the array + if (is_array($name) && isset($name['name'])) + { + isset($name['options']) OR $name['options'] = array(); + isset($name['selected']) OR $name['selected'] = array(); + isset($name['extra']) OR $name['extra'] = array(); + + return form_dropdown($name['name'], $name['options'], $name['selected'], $name['extra']); + } + if ( ! is_array($selected)) { $selected = array($selected); @@ -363,11 +340,11 @@ if ( ! function_exists('form_dropdown')) foreach ($val as $optgroup_key => $optgroup_val) { - $sel = (in_array($optgroup_key, $selected)) ? ' selected="selected"' : ''; + $sel = in_array($optgroup_key, $selected) ? ' selected="selected"' : ''; $form .= '\n"; } - $form .= ''."\n"; + $form .= "\n"; } else { @@ -375,9 +352,7 @@ if ( ! function_exists('form_dropdown')) } } - $form .= "\n"; - - return $form; + return $form."\n"; } } @@ -386,7 +361,6 @@ if ( ! function_exists('form_dropdown')) /** * Checkbox Field * - * @access public * @param mixed * @param string * @param bool @@ -397,9 +371,9 @@ if ( ! function_exists('form_checkbox')) { function form_checkbox($data = '', $value = '', $checked = FALSE, $extra = '') { - $defaults = array('type' => 'checkbox', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value); + $defaults = array('type' => 'checkbox', 'name' => ( ! is_array($data) ? $data : ''), 'value' => $value); - if (is_array($data) AND array_key_exists('checked', $data)) + if (is_array($data) && array_key_exists('checked', $data)) { $checked = $data['checked']; @@ -431,7 +405,6 @@ if ( ! function_exists('form_checkbox')) /** * Radio Button * - * @access public * @param mixed * @param string * @param bool @@ -457,7 +430,6 @@ if ( ! function_exists('form_radio')) /** * Submit Button * - * @access public * @param mixed * @param string * @param string @@ -467,7 +439,7 @@ if ( ! function_exists('form_submit')) { function form_submit($data = '', $value = '', $extra = '') { - $defaults = array('type' => 'submit', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value); + $defaults = array('type' => 'submit', 'name' => ( ! is_array($data) ? $data : ''), 'value' => $value); return '\n"; } } @@ -477,7 +449,6 @@ if ( ! function_exists('form_submit')) /** * Reset Button * - * @access public * @param mixed * @param string * @param string @@ -487,7 +458,7 @@ if ( ! function_exists('form_reset')) { function form_reset($data = '', $value = '', $extra = '') { - $defaults = array('type' => 'reset', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value); + $defaults = array('type' => 'reset', 'name' => ( ! is_array($data) ? $data : ''), 'value' => $value); return '\n"; } } @@ -497,7 +468,6 @@ if ( ! function_exists('form_reset')) /** * Form Button * - * @access public * @param mixed * @param string * @param string @@ -507,8 +477,8 @@ if ( ! function_exists('form_button')) { function form_button($data = '', $content = '', $extra = '') { - $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'type' => 'button'); - if ( is_array($data) AND isset($data['content'])) + $defaults = array('name' => ( ! is_array($data) ? $data : ''), 'type' => 'button'); + if (is_array($data) && isset($data['content'])) { $content = $data['content']; unset($data['content']); // content is not an attribute @@ -523,7 +493,6 @@ if ( ! function_exists('form_button')) /** * Form Label Tag * - * @access public * @param string The text to appear onscreen * @param string The id the label applies to * @param string Additional attributes @@ -538,10 +507,10 @@ if ( ! function_exists('form_label')) if ($id != '') { - $label .= " for=\"$id\""; + $label .= ' for="'.$id.'"'; } - if (is_array($attributes) AND count($attributes) > 0) + if (is_array($attributes) && count($attributes) > 0) { foreach ($attributes as $key => $val) { @@ -549,7 +518,7 @@ if ( ! function_exists('form_label')) } } - return $label .= ">$label_text"; + return $label.'>'.$label_text.''; } } @@ -560,7 +529,6 @@ if ( ! function_exists('form_label')) * Used to produce
text. To close fieldset * use form_fieldset_close() * - * @access public * @param string The legend text * @param string Additional attributes * @return string @@ -572,7 +540,7 @@ if ( ! function_exists('form_fieldset')) $fieldset = '\n"; if ($legend_text != '') { - $fieldset .= "$legend_text\n"; + return $fieldset.''.$legend_text."\n"; } return $fieldset; @@ -584,7 +552,6 @@ if ( ! function_exists('form_fieldset')) /** * Fieldset Close Tag * - * @access public * @param string * @return string */ @@ -592,7 +559,7 @@ if ( ! function_exists('form_fieldset_close')) { function form_fieldset_close($extra = '') { - return "
".$extra; + return ''.$extra; } } @@ -601,7 +568,6 @@ if ( ! function_exists('form_fieldset_close')) /** * Form Close Tag * - * @access public * @param string * @return string */ @@ -609,7 +575,7 @@ if ( ! function_exists('form_close')) { function form_close($extra = '') { - return "
".$extra; + return ''.$extra; } } @@ -670,10 +636,9 @@ if ( ! function_exists('form_prep')) * Form Value * * Grabs a value from the POST array for the specified field so you can - * re-populate an input field or textarea. If Form Validation + * re-populate an input field or textarea. If Form Validation * is active it retrieves the info from the validation class * - * @access public * @param string * @return mixed */ @@ -703,7 +668,6 @@ if ( ! function_exists('set_value')) * Let's you set the selected value of a