예제 #1
0
 public function testWhereNotNull()
 {
     $q = $this->VoodOrm->debugSqlQuery();
     $q->select("id,name")->whereNotNull("name")->find();
     $sql = "SELECT id,name FROM {$this->table} WHERE (name IS NOT NULL)";
     $this->assertValidQueryBuilder($sql, $q, 0);
 }
예제 #2
0
<?php

include __DIR__ . "/include.php";
use Voodoo\Core;
$DB = new Core\VoodOrm(getPdo());
$users = $DB->user();
// or $DB->table("user");
$userId = 1;
try {
    $user = $users->findOne($userId);
    if ($user) {
        $user->name = "Changed Name";
        // or
        $user->set("name", "Another name");
        // or
        $user->set(array("name" => "Another name changed"));
        $user->update();
        //or $user->save();
    }
} catch (Exception $e) {
    echo "ERROR: " . $e->getMessage();
}