Changeset 2195 for trunk/workflow/inc/engine/src/common
- Timestamp:
- 03/08/10 16:30:34 (15 years ago)
- Location:
- trunk/workflow/inc/engine/src/common
- Files:
-
- 2 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/workflow/inc/engine/src/common/Base.php
r795 r2195 1 1 <?php 2 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'common'.SEP.'Observable.php');3 2 /** 4 3 * This class is derived by all the API classes so they get the 5 * database connection , database methods and the Observable interface6 * 4 * database connection and the database methods. 5 * 7 6 * @package Galaxia 8 * @license http://www.gnu.org/copyleft/gpl.html GPL 7 * @license http://www.gnu.org/copyleft/gpl.html GPL 9 8 */ 10 class Base extends Observable{9 class Base { 11 10 /** 12 11 * @var object $db Database abstraction object used to access the database … … 17 16 * @var int $num_queries Debugging var 18 17 * @access private 19 */ 18 */ 20 19 var $num_queries = 0; 21 20 /** 22 21 * @var int $num_queries_total Debugging var 23 22 * @access private 24 */ 23 */ 25 24 var $num_queries_total = 0; 26 25 /** 27 26 * @var array $error Error messages 28 27 * @access public 29 */ 28 */ 30 29 var $error= Array(); 31 30 /** … … 39 38 */ 40 39 var $child_name = 'Base'; 41 40 42 41 /** 43 42 * Constructor receiving a database abstraction object … … 72 71 * Always call this function after failed operations on a workflow object to obtain messages 73 72 * 74 * @param bool $as_array if true the result will be send as an array of errors or an empty array. Else, if you do not give any parameter 73 * @param bool $as_array if true the result will be send as an array of errors or an empty array. Else, if you do not give any parameter 75 74 * or give a false parameter you will obtain a single string which can be empty or will contain error messages with <br /> html tags 76 75 * @param bool $debug is false by default, if true you wil obtain more messages 77 76 * @param string $prefix string appended to the debug message 78 77 * @return mixed Error and debug messages or an array of theses messages and empty the error messages 79 * @access public 78 * @access public 80 79 */ 81 function get_error($as_array=false, $debug=false, $prefix='') 80 function get_error($as_array=false, $debug=false, $prefix='') 82 81 { 83 82 //collect errors from used objects … … 96 95 /** 97 96 * Gets warnings recorded by this object 98 * 99 * @param bool $as_array if true the result will be send as an array of warnings or an empty array. Else, if you do not give any parameter 97 * 98 * @param bool $as_array if true the result will be send as an array of warnings or an empty array. Else, if you do not give any parameter 100 99 * or give a false parameter you will obtain a single string which can be empty or will contain warning messages with <br /> html tags 101 100 * @return mixed Warning messages or an array of theses messages and empty the warning messages 102 * @access public 101 * @access public 103 102 */ 104 function get_warning($as_array=false) 103 function get_warning($as_array=false) 105 104 { 106 105 if ($as_array) … … 118 117 * Collect errors from all linked objects which could have been used by this object 119 118 * Each child class should instantiate this function with her linked objetcs, calling get_error(true) 120 * 119 * 121 120 * @param bool $debug is false by default, if true debug messages can be added to 'normal' messages 122 121 * @param string $prefix is a string appended to the debug message 123 122 * @abstract 124 123 * @access public 125 * @return void 124 * @return void 126 125 */ 127 126 function collect_errors($debug=false, $prefix = '') … … 134 133 } 135 134 } 136 135 137 136 /** 138 137 * Performs a query on the AdoDB database object 139 * 138 * 140 139 * @param string $query sql query, parameters should be replaced with ? 141 140 * @param array $values array containing the parameters (going in the ?), use it to avoid security problems. If … … 196 195 197 196 /** 198 * @see Base::query 197 * @see Base::query 199 198 * @param string $query sql query, parameters should be replaced with ? 200 199 * @param array $values array containing the parameters (going in the ?), use it to avoid security problems … … 224 223 if (!$result && $reporterrors ) 225 224 $this->sql_error($query, $clean_values, $result); 226 if (!!$result) 225 if (!!$result) 227 226 { 228 227 $res = $result->fetchRow(); … … 241 240 /** 242 241 * Throws error warnings 243 * 242 * 244 243 * @param string $query 245 244 * @param array $values 246 245 * @param mixed $result 247 246 * @access public 248 * @return void 247 * @return void 249 248 */ 250 249 function sql_error($query, $values, $result) { … … 252 251 // DO NOT DIE, if transactions are there, they will do things in a better way 253 252 } 254 253 255 254 /** 256 255 * Clean the data before it is recorded on the database 257 * 256 * 258 257 * @param $value is a data we want to be stored in the database. 259 * If it is an array we'll make a serialize and then an base64_encode 258 * If it is an array we'll make a serialize and then an base64_encode 260 259 * (you'll have to make an unserialize(base64_decode()) 261 260 * If it is not an array we make an htmlspecialchars() on it … … 292 291 /** 293 292 * Supports DB abstraction 294 * 293 * 295 294 * @param string &$query 296 * @return void 295 * @return void 297 296 * @access public 298 297 */ … … 302 301 case "oci8": 303 302 $query = preg_replace("/`/", "\"", $query); 304 // convert bind variables - adodb does not do that 303 // convert bind variables - adodb does not do that 305 304 $qe = explode("?", $query); 306 305 $query = ''; … … 318 317 /** 319 318 * Supports DB abstraction 320 * 319 * 321 320 * @param string $sort_mode 322 * @return string 321 * @return string 323 322 * @access public 324 323 */ … … 330 329 /** 331 330 * Supports DB abstraction 332 * 333 * @return mixed 331 * 332 * @return mixed 334 333 * @access public 335 334 */
Note: See TracChangeset
for help on using the changeset viewer.