예제 #1
0
파일: example.php 프로젝트: rancoud/RQuery
var_dump("Insert Into test last id: " . $id);
$idB = $rQuery->insert("INSERT INTO test (`name`) VALUES (:name)", array('name' => 'B'));
var_dump("Insert Into test last id: " . $idB);
$id = $rQuery->insert("INSERT INTO test (`name`) VALUES (:name)", array('name' => 'C'));
var_dump("Insert Into test last id: " . $id);
$id = $rQuery->insert("INSERT INTO test (`name`) VALUES (:name)", array('name' => 'chickenskill'));
var_dump("Insert Into test last id: " . $id);
$rowsAffected = $rQuery->update("UPDATE test SET name = :name WHERE id = :id", array('id' => $idB, 'name' => 'google'));
var_dump("Row affected: " . $rowsAffected);
$rowsAffected = $rQuery->delete("DELETE FROM test WHERE name = :name1 OR name = :name2", array('name1' => 'A', 'name2' => 'C'));
var_dump("Row affected: " . $rowsAffected);
$cursor = $rQuery->select("SELECT * FROM test");
while ($row = $rQuery->read($cursor)) {
    var_dump($row);
}
$pdo = $rQuery->getDriver();
var_dump($pdo);
$count = $rQuery->count("SELECT COUNT(*) FROM test");
var_dump($count);
$rows = $rQuery->selectAll("SELECT * FROM test");
var_dump($rows);
$row = $rQuery->selectRow("SELECT * FROM test WHERE id = :id", array('id' => $idB));
var_dump($row);
$row = $rQuery->selectCol("SELECT id FROM test");
var_dump($row);
$row = $rQuery->selectCol("SELECT id FROM test WHERE id = :id", array('id' => 99999));
var_dump($row);
$var = $rQuery->selectVar("SELECT name FROM test WHERE id = :id", array('id' => $idB));
var_dump($var);
$var = $rQuery->selectVar("SELECT name FROM test WHERE id = :id", array('id' => 99999));
var_dump($var);