Exemple #1
0
function add_bind_var($bound_query, $type, $method, $key, $value)
{
    $bv = new \query\BindVariable();
    $bv->setType($type);
    $bv->{$method}($value);
    $entry = new \query\BoundQuery\BindVariablesEntry();
    $entry->setKey($key);
    $entry->setValue($bv);
    $bound_query->addBindVariables($entry);
}
Exemple #2
0
 public static function BoundQuery($query, $vars)
 {
     $bound_query = new \query\BoundQuery();
     $bound_query->setSql($query);
     if ($vars) {
         foreach ($vars as $key => $value) {
             $entry = new \query\BoundQuery\BindVariablesEntry();
             $entry->setKey($key);
             $entry->setValue(self::BindVariable($value));
             $bound_query->addBindVariables($entry);
         }
     }
     return $bound_query;
 }
Exemple #3
0
function add_list_bind_var($bound_query, $type, $key, $values)
{
    $bv = new \query\BindVariable();
    $bv->setType(\query\Type::TUPLE);
    foreach ($values as $value) {
        $val = new \query\Value();
        $val->setType($type);
        $val->setValue($value);
        $bv->addValues($val);
    }
    $entry = new \query\BoundQuery\BindVariablesEntry();
    $entry->setKey($key);
    $entry->setValue($bv);
    $bound_query->addBindVariables($entry);
}