On Tue, 2007-04-24 at 08:43 -0300, Toby Thain wrote: > On 24-Apr-07, at 8:09 AM, Balazs Scheidler wrote: > > > Hi, > > > > Is there a way to query the record structure of a table through > > libdbi? > > I'm creating tables automatically from my program and I would like to > > validate whether a given table matches my internal table > > representation, > > e.g. whether it has the appropriate fields. > > > > I've found a way to query the list of databases and the list of tables > > in a database, but no way to query the list of fields found in a > > table. > > Is there something I missed? Is this feasible at all? (I know that > > it is > > possible to get the list of fields from MySQL and PostgreSQL, but I > > don't know anything about the others) > > > > I might be interested in adding something like this, but I only know > > MySQL and PgSQL, so I'd need some help for the rest of the drivers. > > Ingres can do it (I contributed the libdbi-driver). Details are in > the documentation. > > The effort to implement this across all drivers may not be worth it, > however, since it's a fairly obscure need which probably can't work > across all drivers anyway... IMHO.
In the meanwhile I've found something that should be fairly portable and does not require changes in libdbi: SELECT * FROM table WHERE 0=1; This will result in an empty set, but the table header is available, thus the type of the fields can be queried. I guess this should work with all the drivers. -- Bazsi ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Libdbi-drivers-devel mailing list Libdbi-drivers-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libdbi-drivers-devel