Location: PHPKode > scripts > tgcSqlBuilder > test_delete.php
<?php
/*
 * This file contains some tests to check the sqlBuilder's functionality.
 * The statements maybe a bit stupid.
 *
 * $Id: test_delete.php,v 1.1.1.1 2004/02/14 01:43:18 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/Delete.php';

error_reporting(E_ALL);

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

$sql->addTable('users');

$sql->addWhere('users', 'username', 'john', SQLBUILDER_COMP_NOT_EQUAL, SQLBUILDER_LOGICAL_AND);
$sql->addWhere('users', 'username', 'c', SQLBUILDER_COMP_STARTSWITH, SQLBUILDER_LOGICAL_OR);
$sql->addRawWhere('GET_WAGE() > 2000');
 
$sql->addOrderBy('users', 'username', SQLBUILDER_ORDER_DESC);
$sql->addOrderBy('users', 'userId', SQLBUILDER_ORDER_ASC);

$sql->setLimit(3, 4);
$sql->unsetLimit();
/*
echo "<pre> <hr> where(b4 reset)";
print_r($sql->_where);
echo "<hr> <pre>";
*/

//$sql->removeWhere('users', 'username');

/*
echo "<pre> <hr> where(after reset)";
print_r($sql->_where);
echo "<hr> <pre>";
*/

echo $sql->generateQuery();
    
?>
Return current item: tgcSqlBuilder