Location: PHPKode > scripts > tgcSqlBuilder > test_update.php
<?php
/*
 * This file contains some tests to check the sqlBuilder's functionality.
 * The statements maybe a bit stupid.
 *
 * $Id: test_update.php,v 1.1.1.1 2004/02/14 01:43:16 luckec Exp $
 */

 
// if you do not have PEAR installed on your webserver then use this two lines to include the 
// needed PEAR files, that you downloaded with tgcSqlBuilder
// make sure to set the includefolder correctly
// $pearIncludeFolder  =   './include/pear';
// ini_set('include_path', ini_get('include_path') . ':' . $pearIncludeFolder);

 
require_once 'PEAR.php';
require_once 'DB.php';
require_once 'include/tgcSqlBuilder.php';
require_once 'include/tgcSqlBuilder/Update.php';

error_reporting(E_ALL);

$dbc    =       DB::connect('mysql://root:hide@address.com/tgcNewsSystem');
$sql    =       &new tgcSqlBuilder_Update($dbc);

$sql->addTable('users');

$sql->addUpdate('username', 'john');
$update   =       array   (
                              'col_Username'  =>  'superman',
                              'col_Email'     =>  'hide@address.com',
                              'id'            =>  1
                          );
//$sql->addUpdate($update);

$sql->addRawUpdate('username', 'GETNAME()');
$insert   =       array   (
                              'col_Username'  =>  "'superman'",
                              'col_Email'     =>  'GETMAIL()',
                              'id'            =>  '1'
                          );
$sql->addRawUpdate($insert);
//$sql->removeRawUpdate();

$sql->addWhere('users', 'username', 'doug');
$sql->addWhere('users', 'id', 1);
$sql->addWhere('users', 'id', 2);
$sql->removeWhere('users', 'id');

$sql->setLimit(4);


echo "<pre>";
//print_r($sql->removeInsert());
echo "</pre>";


echo "<pre>";
print_r($sql->generateQuery());
echo "</pre>";
    
?>
Return current item: tgcSqlBuilder