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

Reteive column names #139

Closed michaelward82 closed 11 years ago

michaelward82 commented 11 years ago

I would like to be able to iterate over $_POST data, assigning data to a table row from any key that matches a DB column name.

At the moment, I cannot find any way to see if a database column exists or not (within the structure of Idiorm or Paris).

Is there any way to retrieve a list of column names for a table or model from Idiorm or Paris?

I'd be willing to help implement a solution if there isn't a way, should there be a wish for a property or function that lists the column names for a table.

treffynnon commented 11 years ago

This can be done with a raw query in MySQL: SHOW COLUMNS FROM table_name

I am not sure about other databases and that would be the danger of implementing anything specific - different vendors provide differing methods for accessing this information.