Juha Heinanen wrote:
Alex Balashov writes:
Most database APIs provide a way to expose the table definition as well, i.e. a list of column types and names.
that is what mysql describe and show statements do, but analyzing the output is not convenient (columns, types, attributes, index).
No, what I meant is that the database interaction library itself (e.g. libmysqlclient) provide ways to get this information into native data primitives generically, which lends itself to more generic and simple machine processing.
In the case of PHP, to run with your example, it would be something like this:
http://us.php.net/manual/en/function.mysql-fetch-field.php
This PHP function exposes a native underlying function in libmysqlclient that is sure to be accessible from the C API as well. It does not simply parse the textual output of a DESCRIBE command.
No matter how compelling this direction, it is certainly more difficult than simply using 'version' numbers -- of that there is no question.