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

Difference between raw_query and raw_execute #352

Closed wowremywang closed 5 years ago

wowremywang commented 5 years ago

Hi, I want to know the difference between raw_query and raw_execute. Does anyone know?

treffynnon commented 5 years ago

raw_query allows you to make use of parameter binding and associate the records with a database table so that you can later call the save() method on an item/record. Please see the documentation: https://idiorm.readthedocs.io/en/latest/querying.html#raw-queries

raw_execute takes a raw SQL string and executes it - it does not bind the results to a particular table so you cannot call the save() method on an item/record. Please see the documentation: https://idiorm.readthedocs.io/en/latest/querying.html#raw-sql-execution-using-pdo