Subversion Repositories phpLibraryV2

Rev

Rev 16 | Rev 29 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 16 Rev 17
Line 278... Line 278...
278
            $this->parameters[ 'lastInsertKey' ] = $this->insert_id;
278
            $this->parameters[ 'lastInsertKey' ] = $this->insert_id;
279
            $this->parameters[ 'error' ] = $errors;
279
            $this->parameters[ 'error' ] = $errors;
280
         } // if select .. else
280
         } // if select .. else
281
         return $this->parameters;
281
         return $this->parameters;
282
      }  // function doSQL
282
      }  // function doSQL
-
 
283
      
-
 
284
      public function run () {
-
 
285
         return $this->doSQL( );
-
 
286
      }
283
 
287
 
284
      /*
288
      /*
285
       * function will return one and only one row, NOT as an array of array
289
       * function will return one and only one row, NOT as an array of array
286
       * but as a single row array
290
       * but as a single row array
287
       * if more than one row is returned by query, error is set and function
291
       * if more than one row is returned by query, error is set and function
Line 307... Line 311...
307
      // function returns the first column of the first row of data returned from query
311
      // function returns the first column of the first row of data returned from query
308
      // or null no value returned
312
      // or null no value returned
309
      public function getOneDBValue( $sql = null ) {
313
      public function getOneDBValue( $sql = null ) {
310
         if ( isset( $sql ) )
314
         if ( isset( $sql ) )
311
            $this->parameters[ 'query' ] = $sql;
315
            $this->parameters[ 'query' ] = $sql;
312
         $save = $this->parameters[ 'useAssociativeArray' ];
316
         $save = $this->parameters['returntype'];
313
         $useAssociativeArray = false;
317
         $this->parameters['returntype'] = 'array';
314
         $this->run();
318
         $this->run();
315
         $useAssociativeArray = $save;
319
         $this->parameters['returntype'] = $save;
-
 
320
//         print "<pre>" . print_r($this->parameters,true ) . "</pre>";
316
         return $this->parameters[ 'rowsAffected' ] ? $this->parameters[ 'returnData' ][0][0] : null;
321
         return $this->parameters[ 'rowsAffected' ] ? $this->parameters[ 'returnData' ][0][0] : null;
317
      }
322
      }
318
 
323
 
319
      /*
324
      /*
320
       * function will attempt to make a constant ($value) safe for SQL depending on the type.
325
       * function will attempt to make a constant ($value) safe for SQL depending on the type.
Line 381... Line 386...
381
      }
386
      }
382
 
387
 
383
 
388
 
384
   } // class DBQuery
389
   } // class DBQuery
385
 
390
 
-
 
391
/*
386
   $db = new DBQuery( '127.0.0.1', 'camp', 'camp', 'camp' );
392
 *    $db = new DBQuery( '127.0.0.1', 'camp', 'camp', 'camp' );
387
 
393
 
388
   if ($db->connect_error) {
394
   if ($db->connect_error) {
389
       die('Connect Error (' . $db->connect_errno . ') '  . $db->connect_error);
395
       die('Connect Error (' . $db->connect_errno . ') '  . $db->connect_error);
390
   }
396
   }
391
   $result = $db->doSQL(
397
   $result = $db->doSQL(
Line 404... Line 410...
404
      print_r( $result );
410
      print_r( $result );
405
   }
411
   }
406
//   $return = $db->doSQL( "select device.device_id 'id',device.name 'name', device_type.name 'type' from device join device_type using (device_type_id) where device.removed_date is null and device_type.show_as_system = 'Y'" );
412
//   $return = $db->doSQL( "select device.device_id 'id',device.name 'name', device_type.name 'type' from device join device_type using (device_type_id) where device.removed_date is null and device_type.show_as_system = 'Y'" );
407
//   print_r( $return );
413
//   print_r( $return );
408
//   print_r( $db );
414
//   print_r( $db );
-
 
415
*/
409
?>
416
?>
410
            
417
            
411
                  
418
                  
412
                  
419
                  
413
                  
420