X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=doc%2Fref-ooddl.xml;h=e3ad2f38627990a2564e2410365c5a821c561ed3;hb=cc01ad71ca596c27ddb22af2d3453fab079f0c43;hp=28fe5796dd737c777c18efaee8adbc8532d94dec;hpb=4413405fd38eaba7ba6d6d8b844fef118e326c9a;p=clsql.git
diff --git a/doc/ref-ooddl.xml b/doc/ref-ooddl.xml
index 28fe579..e3ad2f3 100644
--- a/doc/ref-ooddl.xml
+++ b/doc/ref-ooddl.xml
@@ -16,8 +16,8 @@
SQL columns being mapped to slots of the CLOS object.
- The mapping between SQL tables and CLOS objects is defined
- with the macro def-view-class. SQL
tables are created with create-view-from-class
@@ -25,8 +25,10 @@
linkend="drop-view-from-class">drop-view-from-class.
- The above functions refer to the Lisp view of the SQL
- table. This Lisp view should not be confused with SQL VIEW statement.
+ The above functions refer to the Lisp
+ view of the SQL table. This Lisp view
+ should not be confused with SQL VIEW
+ statement.
@@ -86,21 +88,27 @@
Description
If a slot of a class defined by
- DEF-VIEW-CLASS is of the type
- STRING or VARCHAR and does
- not have a length specified, then the value of this variable
- is used as SQL length.
+ def-view-class is of the type
+ string or
+ varchar and does not have a length
+ specified, then the value of this variable is used as SQL
+ length.
Examples
- (let ((*default-string-length* 80))
- (def-view-class s80 ()
- ((a :type string)
- (b :type (string 80))
- (c :type varchar))))
- (create-view-from-class 's80)
+(let ((*default-string-length* 80))
+ (def-view-class s80 ()
+ ((a :type string)
+ (b :type (string 80))
+ (c :type varchar))))
+=> #<Standard-Db-Class S80 {480A431D}>
+
+(create-view-from-class 's80)
+=>
+(table-exists-p [s80])
+=> T
The above code causes a SQL table to be created with the SQL command
@@ -109,8 +117,10 @@
Affected By
- Some SQL backends do not support VARCHAR
- lengths greater than 255 .
+
+ Some SQL backends do not support
+ varchar lengths greater than 255.
+ See Also
@@ -125,13 +135,13 @@
CREATE-VIEW-FROM-CLASS
- Create a SQL table from a view class.
+ Create a SQL table from a View Class.FunctionSyntax
- (create-view-from-class view-class-name &key (database *default-database*) (transactions t)) =>
+ create-view-from-classview-class-name &key databasetransactions => Arguments and Values
@@ -140,8 +150,9 @@
view-class-name
- The name of a view class that has been defined with
- def-view-class.
+ The name of a View
+ Class that has been defined with def-view-class.
@@ -149,7 +160,10 @@
database
- The database in which to create the SQL table.
+ The database in
+ which to create the SQL table. This will default to the
+ value of *default-database*.
@@ -157,7 +171,8 @@
transactions
- When &nil; specifies that a table type which does not support transactions should be used.
+ When &nil; specifies that a table type which does not
+ support transactions should be used.
@@ -166,18 +181,21 @@
Description
- Creates a table as defined by the View Class
- view-class-name in database.
+ Creates a table as defined by the View Class
+ view-class-name in
+ database.
Examples
- * (def-view-class 'foo () ((a :type (string 80))))
- #<CLSQL-SYS::STANDARD-DB-CLASS FOO>
- * (create-view-from-class 'foo)
- * (list-tables)
- ("FOO")
+(def-view-class foo () ((a :type (string 80))))
+=> #<Standard-Db-Class FOO {4807F7CD}>
+(create-view-from-class 'foo)
+=>
+(list-tables)
+=> ("FOO")
@@ -236,7 +254,7 @@
Syntax
- (def-view-class name superclasses slots &rest class-options) => class
+ def-view-classnamesuperclassesslots &rest class-options => classArguments and Values
@@ -250,7 +268,7 @@
- name
+ superclasses
The superclasses for the defined class.
@@ -265,6 +283,14 @@
+
+ class options
+
+
+ The class options.
+
+
+ class
@@ -281,29 +307,30 @@
:db-kind - specifies the kind of
- database mapping which is performed for this slot and defaults
- to :base which indicates that the
- slot maps to an ordinary column of the database table. A
- :db-kind value of
- :key indicates that this slot is
- a special kind of :base slot
- which maps onto a column which is one of the unique keys
- for the database table, the value
- :join indicates this slot
- represents a join onto another View Class which contains
- View Class objects, and the value
- :virtual indicates a standard
- CLOS slot which does not map onto columns of the
- database table.
+ database mapping which is performed for this slot and
+ defaults to :base which indicates
+ that the slot maps to an ordinary column of the database
+ table. A :db-kind value of
+ :key indicates that this slot is a
+ special kind of :base slot which
+ maps onto a column which is one of the unique keys for the
+ database table, the value :join
+ indicates this slot represents a join onto another
+ View Class
+ which contains View Class objects, and the value
+ :virtual indicates a standard CLOS
+ slot which does not map onto columns of the database
+ table.
- :db-info - if a slot is specified with
- :db-kind:join, the
- slot option :db-info contains a property list
- which specifies the nature of the join. The valid members of the list
- are:
+ :db-info - if a slot is specified
+ with :db-kind
+ :join, the slot option
+ :db-info contains a property list
+ which specifies the nature of the join. The valid members
+ of the list are:
@@ -356,13 +383,17 @@
- :set
- set - This controls what is stored in the join slot.
- The default value is &t;. When set is &t; and
- target-slot is undefined, the join slot will contain
- a list of instances of the join class. Whereas, if target-slot is defined,
- then the join slot will contain a list of pairs of (target-value join-instance).
- When set is &nil;, the join slot will contain a single instances.
+ :setset -
+ This controls what is stored in the join slot. The
+ default value is &t;. When set is
+ &t; and target-slot is undefined,
+ the join slot will contain a list of instances of the
+ join class. Whereas, if
+ target-slot is defined, then the
+ join slot will contain a list of pairs of
+ (target-value join-instance).
+ When set is &nil;, the join slot
+ will contain a single instances.
@@ -380,25 +411,32 @@
option. The valid values are:
- string - a variable length character field up to
- *default-string-length* characters.
+ string - a variable length
+ character field up to *default-string-length*
+ characters.
- (string n) - a fixed length character field
- n characters long.
+ (string n) - a fixed length
+ character field n characters
+ long.
- varchar - a variable length character field up to
- *default-string-length* characters.
+ varchar - a variable length
+ character field up to *default-string-length*
+ characters.
- (varchar n) - a variable length character field up to
- n characters in length.
+ (varchar n) - a variable length
+ character field up to n
+ characters in length.
- char - a single character field
+ char - a single character field
- integer - signed integer at least 32-bits wide
+ integer - signed integer
+ at least 32-bits wide(integer n)float(float n)
@@ -406,6 +444,10 @@
number(number n)(number n p)
+
+ tinyint - An integer column 8-bits
+ wide. [not supported by all database backends]
+ smallint - An integer column 16-bits
wide. [not supported by all database backends]
@@ -422,18 +464,25 @@
BIGINT
- wall-time - a slot which
- stores a date and time in a SQL timestamp
- column. &clsql; provides a number of time
- manipulation functions to support objects of type
- wall-time.
+ wall-time - a slot which stores
+ a date and time in a SQL timestamp column. &clsql;
+ provides a number of time manipulation functions to
+ support objects of type wall-time.
- duration - stores a duration structure.
- &clsql; provides routines for wall-time and duration
- processing.
+ date - a slot which stores the
+ date (without any time of day resolution) in a
+ column. &clsql; provides a number of time
+ manipulation functions that operate on date values.
- boolean - stores a &t; or &nil; value.
+
+ duration - stores a
+ duration structure. &clsql; provides
+ routines for wall-time and
+ duration processing.
+
+ boolean - stores a &t; or
+ &nil; value.generalized-boolean - similar
to a boolean in that either a
@@ -449,11 +498,14 @@
symbol - stores a symbol
- list - stores a list by writing it to a string. The items
- in the list must be able to be readable written.
+ list - stores a list by writing
+ it to a string. The items in the list must be able to
+ be readable written.
- vector - stores a vector similarly to list
- array - stores a array similarly to list
+ vector - stores a vector
+ similarly to list
+ array - stores a array
+ similarly to list
@@ -471,16 +523,21 @@
- :void-value - specifies
- the value to store in the Lisp instance if the SQL value is NULL and defaults
- to NIL.
+ :void-value - specifies the value
+ to store in the Lisp instance if the SQL value is NULL and
+ defaults to NIL.
- :db-constraints - is a string
- representing an SQL table constraint expression or a
- list of such strings.
+ :db-constraints - is a keyword
+ symbol representing an SQL column constraint expression or
+ a list of such symbols. The following column constraints
+ are supported: :not-null,
+ :primary-key, :unique,
+ :unsigned (&mysql; specific),
+ :zerofill (&mysql; specific) and
+ :auto-increment (&mysql; specific).
@@ -491,6 +548,31 @@
slot value.
+
+
+ :db-reader - If a string, then when
+ reading values from the database, the string will be used
+ for a format string, with the only value being the value
+ from the database. The resulting string will be used as
+ the slot value. If a function then it will take one
+ argument, the value from the database, and return the
+ value that should be put into the slot. If a symbol, then
+ the symbol-function of the symbol will be used.
+
+
+
+
+ :db-writer - If a string, then when
+ reading values from the slot for the database, the string
+ will be used for a format string, with the only value
+ being the value of the slot. The resulting string will be
+ used as the column value in the database. If a function
+ then it will take one argument, the value of the slot, and
+ return the value that should be put into the database. If
+ a symbol, then the symbol-function of the symbol will be
+ used.
+
+
@@ -499,9 +581,10 @@
- :base-table - specifies the name of the
- SQL database table. The default value is the class name. Like slot names,
- hypens in the class name are converted to underscore characters.
+ :base-table - specifies the name
+ of the SQL database table. The default value is the
+ class name. Like slot names, hypens in the class name
+ are converted to underscore characters.
@@ -510,7 +593,8 @@
Description
- Creates a View Class called name whose
+ Creates a View
+ Class called name whose
slots slots can map onto the attributes
of a table in a database. If
superclasses is &nil; then the
@@ -518,8 +602,8 @@
standard-db-object, otherwise
superclasses is a list of superclasses
for class which must include
- standard-db-object or a descendent of this
- class.
+ standard-db-object or a descendent of
+ this class.
@@ -730,7 +814,7 @@
Syntax
- (drop-view-from-class view-class-name &key (database *default-database*)) =>
+ drop-view-from-classview-class-name &key database => Arguments and Values
@@ -739,7 +823,18 @@
view-class-name
- The name of the view class.
+ The name of the View
+ Class.
+
+
+
+
+ database
+
+
+ database
+ object. This will default to the value of
+ *default-database*.
@@ -747,20 +842,22 @@
Description
- Removes a table defined by the View Class
- VIEW-CLASS-NAME from
- DATABASE which defaults to
- *DEFAULT-DATABASE*.
+ Removes a table defined by the View Class
+ view-class-name from
+ database which defaults to
+ *default-database*.
Examples
- * (list-tables)
- ("FOO" "BAR")
- * (drop-view-from-class 'foo)
- * (list-tables)
- ("BAR")
+(list-tables)
+=> ("FOO" "BAR")
+(drop-view-from-class 'foo)
+=>
+(list-tables)
+=> ("BAR")
@@ -795,7 +892,7 @@
Notes
-
+ None.
@@ -809,7 +906,7 @@
Syntax
- (list-classes &key (test #'identity) (root-class (find-class 'standard-db-object)) (database *default-database*)) => classes
+ list-classes &key testroot-classdatabase => classesArguments and Values
@@ -827,8 +924,9 @@
root-class
- specifies the root class to the search. By default, standard-db-object is used
- which is the root for all view classes.
+ specifies the root class to the search. By default,
+ standard-db-object is used which
+ is the root for all view classes.
@@ -836,7 +934,10 @@
database
- The database to search for view classes.
+ The database to
+ search for view classes. This will default to the value
+ of *default-database*.
@@ -862,14 +963,14 @@
Examples
- * (list-classes)
- (#<clsql-sys::standard-db-class big> #<clsql-sys::standard-db-class employee-address>
- #<clsql-sys::standard-db-class address> #<clsql-sys::standard-db-class company>
- #<clsql-sys::standard-db-class employee>)
+(list-classes)
+=> (#<clsql-sys::standard-db-class big> #<clsql-sys::standard-db-class employee-address>
+ #<clsql-sys::standard-db-class address> #<clsql-sys::standard-db-class company>
+ #<clsql-sys::standard-db-class employee>)
- * (list-classes :test #'(lambda (c) (> (length (symbol-name (class-name c))) 3)))
- (#<clsql-sys::standard-db-class employee-address> #<clsql-sys::standard-db-class address>
- #<clsql-sys::standard-db-class company> #<clsql-sys::standard-db-class employee>)
+(list-classes :test #'(lambda (c) (> (length (symbol-name (class-name c))) 3)))
+=> (#<clsql-sys::standard-db-class employee-address> #<clsql-sys::standard-db-class address>
+ #<clsql-sys::standard-db-class company> #<clsql-sys::standard-db-class employee>)
@@ -882,7 +983,8 @@
Affected by
- Which view classes have been defined in the Lisp session.
+ Which view classes have been defined in the Lisp
+ session.
@@ -900,6 +1002,12 @@
+
+ Notes
+
+ None.
+
+