<?php
/*
* This file contains some tests to check the sqlBuilder's functionality.
* The statements maybe a bit stupid.
*
* $Id: test_insert.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/Insert.php';
error_reporting(E_ALL);
$dbc = DB::connect('mysql://root:hide@address.com/tgcNewsSystem');
$sql = &new tgcSqlBuilder_Insert($dbc);
$sql->addTable('users');
$insert = array (
'col_Username' => 'superman',
'col_Email' => 'hide@address.com',
'id' => 1
);
//$sql->addInsert($insert);
$sql->addRawInsert('username', 'GETNAME()');
$insert = array (
'col_Username' => "'superman'",
'col_Email' => 'GETMAIL()',
'id' => '1'
);
$sql->addRawInsert($insert);
echo "<pre>";
//print_r($sql->removeInsert());
echo "</pre>";
echo "<pre>";
print_r($sql->generateQuery());
echo "</pre>";
?>