|
SelectQuery.class.php:
echo
OSQL::select()->from('employer')->
get('id')->get('name')->get('birth_date')->
where(
Expression::between(
'birth_date',
DBValue::create(1980),
SQLFunction::create('now')
)
)->
toString(
DBFactory::getDefaultInstance()->getDialect()
);
==
SELECT "employer"."id", "employer"."name", "employer"."birth_date"
FROM "employer"
WHERE ("birth_date" BETWEEN '1980' AND now())
UpdateQuery.class.php:
echo
OSQL::update('imaginary_table')->
set('field', 25)->
set(
'counter',
Expression::add(
DBField::create('counter'),
1
)
)->
setBoolean('boolean', true)->
where(
Expression::in(
'id',
OSQL::select()->from('update_queue')->
get('id')
)
)->
toString(
DBFactory::getDefaultInstance()->getDialect()
);
==
UPDATE "imaginary_table"
SET
"field" = '25',
"counter" = ("counter" + '1'),
"boolean" = 'true'
WHERE (
"id" in (SELECT "update_queue"."id" FROM "update_queue")
)
DeleteQuery.class.php:
echo
OSQL::delete()->from('pity_table')->
toString(
DBFactory::getDefaultInstance()->getDialect()
);
==
Fatal error: Uncaught [leave 'pity_table' table alone in peace] in: ...
|