30
30
* @package MythWeb
31
31
* @subpackage Database
32
32
*
33
- / **/
33
+ **/
34
34
35
35
/**
36
36
* Abstract superclass for all database connection types. This also defines the
37
37
* Database::connect() function that handles creating instances of the
38
38
* appropriate database handle for the requested database engine.
39
- / **/
39
+ **/
40
40
class Database {
41
41
42
42
/** @var resource Resource handle for this database connection */
@@ -73,7 +73,7 @@ class Database {
73
73
74
74
/**
75
75
* Legacy constructor to catch things that the abstract classification won't
76
- / **/
76
+ **/
77
77
function __construct () {
78
78
trigger_error ('The Database class should never be created as an object. Use Database::connect() instead. ' , E_USER_ERROR );
79
79
}
@@ -98,7 +98,7 @@ function __construct() {
98
98
* engines that support them
99
99
*
100
100
* @return object Database subclass based on requested $engine
101
- / **/
101
+ **/
102
102
static function &connect ($ db_name , $ login , $ password , $ server ='localhost ' , $ port =NULL , $ engine ='mysql_detect ' , $ options =array ()) {
103
103
// For consistency, engine names are all lower case.
104
104
$ engine = strtolower ($ engine );
@@ -137,7 +137,7 @@ static function &connect($db_name, $login, $password, $server='localhost', $port
137
137
* @param mixed $args Scalar or nested array to be "flattened" into a single array.
138
138
*
139
139
* @return array Single array comprised of all scalars present in $args.
140
- / **/
140
+ **/
141
141
static function smart_args ($ args ) {
142
142
$ new_args = array ();
143
143
// Not an array
@@ -160,7 +160,7 @@ static function smart_args($args) {
160
160
* Calls $this->escape() on an array of strings.
161
161
*
162
162
* @return string
163
- / **/
163
+ **/
164
164
function escape_array ($ array ) {
165
165
$ new = array ();
166
166
foreach ($ array as $ string ) {
@@ -173,7 +173,7 @@ function escape_array($array) {
173
173
174
174
/**
175
175
* Execute any destruct handler functions.
176
- / **/
176
+ **/
177
177
function __destruct () {
178
178
// Globals already destroyed?
179
179
if ($ this ->global_name && empty ($ GLOBALS [$ this ->global_name ]))
@@ -195,7 +195,7 @@ function __destruct() {
195
195
* might need to use it.
196
196
*
197
197
* @param string $name The global name this instance is registered as.
198
- / **/
198
+ **/
199
199
function register_global_name ($ name ) {
200
200
if ($ GLOBALS [$ name ] === $ this ) {
201
201
$ this ->global_name = $ name ;
@@ -210,7 +210,7 @@ function register_global_name($name) {
210
210
* session_write_close) gets executed before in time.
211
211
*
212
212
* @link http://us2.php.net/session_set_save_handler
213
- / **/
213
+ **/
214
214
function register_destruct_handler ($ func , $ params =null ) {
215
215
$ this ->destruct_handlers [] = array ('f ' => $ func ,
216
216
'p ' => $ params );
@@ -222,7 +222,7 @@ function register_destruct_handler($func, $params=null) {
222
222
* @param string $error The string to set the error message to. Set to
223
223
* false if you want to wipe out the existing errors.
224
224
* @param bool $backtrace Include a backtrace along with the error message.
225
- / **/
225
+ **/
226
226
function error ($ error ='' , $ backtrace =true ) {
227
227
if ($ error === false ) {
228
228
$ this ->err = null ;
@@ -251,7 +251,7 @@ function error($error='', $backtrace=true) {
251
251
* @param mixed ... Additional arguments
252
252
*
253
253
* @return mixed Statement handle for the current type of database connection
254
- / **/
254
+ **/
255
255
function &query ($ query ) {
256
256
// Hack to get query_row and query_assoc working correctly
257
257
$ args = array_slice (func_get_args (), 1 );
@@ -275,7 +275,7 @@ function &query($query) {
275
275
* @param mixed ... Additional arguments
276
276
*
277
277
* @return array
278
- / **/
278
+ **/
279
279
function query_row ($ query ) {
280
280
// Query and return
281
281
$ args = array_slice (func_get_args (), 1 );
@@ -296,7 +296,7 @@ function query_row($query) {
296
296
* @param mixed ... Additional arguments
297
297
*
298
298
* @return assoc
299
- / **/
299
+ **/
300
300
function query_assoc ($ query ) {
301
301
// Query and return
302
302
$ args = array_slice (func_get_args (), 1 );
@@ -317,7 +317,7 @@ function query_assoc($query) {
317
317
* @param mixed ... Additional arguments
318
318
*
319
319
* @return mixed
320
- / **/
320
+ **/
321
321
function query_col ($ query ) {
322
322
// Query and return
323
323
$ args = array_slice (func_get_args (), 1 );
@@ -338,7 +338,7 @@ function query_col($query) {
338
338
* @param mixed ... Additional arguments
339
339
*
340
340
* @return array
341
- / **/
341
+ **/
342
342
function query_list ($ query ) {
343
343
// Query and return
344
344
$ args = array_slice (func_get_args (), 1 );
@@ -363,7 +363,7 @@ function query_list($query) {
363
363
* @param mixed ... Additional arguments
364
364
*
365
365
* @return array
366
- / **/
366
+ **/
367
367
function query_list_array ($ query ) {
368
368
// Query and return
369
369
$ args = array_slice (func_get_args (), 1 );
@@ -388,7 +388,7 @@ function query_list_array($query) {
388
388
* @param mixed ... Additional arguments
389
389
*
390
390
* @return array
391
- / **/
391
+ **/
392
392
function query_list_assoc ($ query ) {
393
393
// Query and return
394
394
$ args = array_slice (func_get_args (), 1 );
@@ -415,7 +415,7 @@ function query_list_assoc($query) {
415
415
* @param mixed ... Additional arguments
416
416
*
417
417
* @return array
418
- / **/
418
+ **/
419
419
function query_keyed_list_array ($ key , $ query ) {
420
420
// Query and return
421
421
$ args = array_slice (func_get_args (), 2 );
@@ -442,7 +442,7 @@ function query_keyed_list_array($key, $query) {
442
442
* @param mixed ... Additional arguments
443
443
*
444
444
* @return array
445
- / **/
445
+ **/
446
446
function query_keyed_list_assoc ($ key , $ query ) {
447
447
// Query and return
448
448
$ args = array_slice (func_get_args (), 2 );
@@ -466,7 +466,7 @@ function query_keyed_list_assoc($key, $query) {
466
466
* @param mixed ... Additional arguments
467
467
*
468
468
* @return int The number of rows affected by the requested query.
469
- / **/
469
+ **/
470
470
function query_num_rows ($ query ) {
471
471
// Query and return
472
472
$ args = array_slice (func_get_args (), 1 );
@@ -487,7 +487,7 @@ function query_num_rows($query) {
487
487
* @param mixed ... Additional arguments
488
488
*
489
489
* @return int The insert_id generated by the requested query.
490
- / **/
490
+ **/
491
491
function query_insert_id ($ query ) {
492
492
// Query and return
493
493
$ args = array_slice (func_get_args (), 1 );
@@ -503,29 +503,29 @@ function query_insert_id($query) {
503
503
/**
504
504
* Wrapper for the last query statement's insert_id method.
505
505
* @return int
506
- / **/
506
+ **/
507
507
function insert_id () {
508
508
return $ this ->last_sh ->insert_id ();
509
509
}
510
510
511
511
/**
512
512
* Wrapper for the last query statement's affected_rows method.
513
513
* @return int
514
- / **/
514
+ **/
515
515
function affected_rows () {
516
516
return $ this ->last_sh ->affected_rows ();
517
517
}
518
518
519
519
/**
520
520
* This function and the next one control if the mysql_query throws a fatal error or not
521
- / **/
521
+ **/
522
522
function enable_fatal_errors () {
523
523
$ this ->fatal_errors = true ;
524
524
}
525
525
526
526
/**
527
527
* This function disables the fatal error trigger code
528
- / **/
528
+ **/
529
529
function disable_fatal_errors () {
530
530
$ this ->fatal_errors = false ;
531
531
}
0 commit comments