Re: update-view-from-class

Kevin Rosenberg <kevin-HJRc7zDS/[email protected]> Thu, 24 Nov 2005 15:41:02 -0700
Newsgroups gmane.lisp.clsql.devel
Message-ID <[email protected]>
Mészáros Levente wrote:
> [...]
> Unfortunately the function list-attribute-types (which queries the 
> database columns) and the function database-generate-column-
> definition (which looks at slot definition) speaks different language.
> 
> Is there an ongoing effort to unify the two? Am I missing something, 
> another useful function here?

I don't think you are missing
anything. database-generate-column-definition does look at the slot
definitions to compute the SQL create table statement and has been
present since the old USQL code. list-attributes-types was written by
mysql for CLSQL to query the database to provide the CommonSQL
specified function.

You're going to run into some issues with introspection across the
databases. SQL92, at least, doesn't provide for querying of table
columns. Different SQL engines provide different mechanisms and
results for querying about columns. In fact, the CommonSQL spec
states that 
  "datatype demotes [sic] a vendor-specific type. Examples in a MS Access
  database are :integer, :longchar  and :datetime."

Oracle seems to have the best stored metadata. However, MySQL 5 has a
new INFORMATION_SCHEMA database that has more metadata than their
"SHOW COLUMNS FROM TABLE ..." query.
 
Kevin