j4mie / idiorm

A lightweight nearly-zero-configuration object-relational mapper and fluent query builder for PHP5.
http://j4mie.github.com/idiormandparis/
2.01k stars 369 forks source link

alter table #178

Closed nmkr closed 10 years ago

nmkr commented 10 years ago

Hello,

I cannot Alter a table with the raw_query syntax.. like

ORM::for_table('test')->raw_query("ALTER TABLE testAUTO_INCREMENT = 100")->find_(one|many)();

any hints how i can execute non data querys?

regards

treffynnon commented 10 years ago

Please post actual query as this has a number of errors in it.

nmkr commented 10 years ago

the query is okay, but i receive an error and that breaks the application.

i can catch the exception i guess, but is there a proper method to solve this?

Type: PDOException Code: HY000 Message: SQLSTATE[HY000]: General error File: /home/websites/xx/vendor/j4mie/idiorm/idiorm.php Line: 1593

0 /home/websites/xx/vendor/j4mie/idiorm/idiorm.php(1593): PDOStatement->fetch(2)

1 /home/websites/xx/vendor/j4mie/idiorm/idiorm.php(613): ORM->_run()

2 /home/websites/xx/vendor/j4mie/idiorm/idiorm.php(602): ORM->_find_many()

treffynnon commented 10 years ago

This is not valid:

ALTER TABLE testAUTO_INCREMENT = 100
treffynnon commented 10 years ago

Anyway you probably want to use ORM::raw_execute() rather than $table->raw_query()

nmkr commented 10 years ago

thats it.. thanks!!