X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=doc%2Fcsql.xml;h=f4944410282822326b347c3652938d440c5f78ab;hb=b50166ae0ba2bc09a9094c0e675ec92010b7293e;hp=814b7f4188f848a02a262120e02fc18e19e99296;hpb=2949884623a44f1866a383fb74a88aada9fced93;p=clsql.git diff --git a/doc/csql.xml b/doc/csql.xml index 814b7f4..f494441 100644 --- a/doc/csql.xml +++ b/doc/csql.xml @@ -83,7 +83,7 @@ + url="http://philip.greenspun.com/sql/data-modeling.html"> Philip Greenspun's "SQL For Web Nerds" - Data Modeling @@ -250,7 +250,7 @@ mapped into a database). They would be defined as follows: - :column- - A string which will be used as the + :db-type - A string which will be used as the type specifier for this slots column definition in the database. @@ -292,6 +292,17 @@ mapped into a database). They would be defined as follows: :base-table option specifies what the table name for the view class will be when it is mapped into the database. + + + Another class option is :normalizedp, which signals + &clsql; to use a normalized schema for the mapping from slots to + &sql; columns. By default &clsql; includes all the slots of a parent + class that map to &sql; columns into the child class. This option + tells &clsql; to normalize the schema, so that a join is done on the + primary keys of the concerned tables to get a complete column set + for the classes. For more information, see + def-view-class. + @@ -300,7 +311,7 @@ mapped into a database). They would be defined as follows: In an &sql; only application, the EMPLOYEE and COMPANY tables can be queried to determine things -like, "Who is Vladamir's manager?", "What company does Josef work +like, "Who is Vladimir's manager?", "What company does Josef work for?", and "What employees work for Widgets Inc.". This is done by joining tables with an &sql; query. @@ -316,12 +327,12 @@ SELECT first_name, last_name FROM employee, company -Who is Vladamir's manager? +Who is Vladimir's manager? SELECT managerid FROM employee - WHERE employee.first_name = "Vladamir" + WHERE employee.first_name = "Vladimir" AND employee.last_name = "Lenin" @@ -454,6 +465,24 @@ There are other :join-info options available in &clsql;, but we will save those till we get to the many-to-many relation examples. + + Object Oriented Class Relations + + + &clsql; provides an Object Oriented Data Definition Language, which + provides a mapping from &sql; tables to CLOS objects. By default class + inheritance is handled by including all the columns from parent + classes into the child class. This means your database schema becomes + very much denormalized. The class option :normalizedp + can be used to disable the default behaviour and have &clsql; + normalize the database schemas of inherited classes. + + + + See def-view-class + for more information. + + @@ -489,7 +518,7 @@ any other CLOS object: (defvar employee1 (make-instance 'employee :emplid 1 - :first-name "Vladamir" + :first-name "Vladimir" :last-name "Lenin" :email "lenin@soviet.org" :companyid 1))