X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=doc%2Fref_clsql.xml;h=c24b2ced5462fb4ac7780fcd83e973e22638a296;hb=f716bb1161cf9e89a96945c4a444244f9d303691;hp=157df8cf95dd101fe6ff77a1c5d4e9f0e9883c70;hpb=a35619ce17c910796b4f6f58c5916f8f513073e1;p=clsql.git diff --git a/doc/ref_clsql.xml b/doc/ref_clsql.xml index 157df8c..c24b2ce 100644 --- a/doc/ref_clsql.xml +++ b/doc/ref_clsql.xml @@ -1,18 +1,18 @@ - + + %myents; ]> <symbol>CLSQL</symbol> - This part gives a reference to all the symbols exported - from the package CLSQL-SYS, which are also - re-exported from the package CLSQL. These - symbols constitute the normal user-interface of - &clsql;. + This part gives a reference to the symbols exported from the + package CLSQL-SYS, which are also re-exported + from the package CLSQL. These symbols constitute + the normal user-interface of &clsql;. Currently, the symbols of + the &commonsql;-API are not documented here. @@ -555,12 +555,12 @@ Examples - + (setf *default-database-type* :mysql) => :mysql (initialize-database-type) => t - + Affected By @@ -606,14 +606,14 @@ Examples - + (setf *default-database-type* :mysql) => :mysql (initialize-database-type) => t *initialized-database-types* => (:MYSQL) - + Affected By @@ -685,7 +685,7 @@ Examples - + *initialized-database-types* => NIL (setf *default-database-type* :mysql) @@ -701,7 +701,7 @@ => T *initialized-database-types* => (:MYSQL) - + Side Effects @@ -833,7 +833,7 @@ Examples - + (connected-databases) => NIL (connect '(nil "template1" "dent" nil) :database-type :postgresql) @@ -851,7 +851,7 @@ => T (connected-databases) => NIL - + Side Effects @@ -926,7 +926,7 @@ Examples - + (connected-databases) => NIL (connect '("dent" "newesim" "dent" "dent") :database-type :mysql) @@ -951,7 +951,7 @@ => NIL (connected-databases) => NIL - + Affected By @@ -1105,7 +1105,7 @@ Examples - + (database-name-from-spec '("dent" "newesim" "dent" "dent") :mysql) => "dent/newesim/dent" (connect '("dent" "newesim" "dent" "dent") :database-type :mysql) @@ -1122,7 +1122,7 @@ (database-name-from-spec '("www.pmsf.de" "template1" "dent" nil) :postgresql) => "www.pmsf.de/template1/dent" - + Side Effects @@ -1220,7 +1220,7 @@ Examples - + (database-name-from-spec '("dent" "newesim" "dent" "dent") :mysql) => "dent/newesim/dent" (connect '("dent" "newesim" "dent" "dent") :database-type :mysql) @@ -1246,7 +1246,7 @@ => NIL (find-database **) => #<CLSQL-POSTGRESQL:POSTGRESQL-DATABASE {48392D2D}> - + Side Effects @@ -1413,7 +1413,7 @@ Examples - + (database-name-from-spec '("dent" "newesim" "dent" "dent") :mysql) => "dent/newesim/dent" (connect '("dent" "newesim" "dent" "dent") :database-type :mysql) @@ -1442,7 +1442,7 @@ >> (SETQ RESULT OLD-DB))) >> 0] 0 => #<CLSQL-MYSQL:MYSQL-DATABASE {480451F5}> - + Side Effects @@ -1540,10 +1540,10 @@ The default is &nil;. Examples - + (disconnect :database (find-database "dent/newesim/dent")) => T - + Side Effects @@ -1610,10 +1610,10 @@ The default is &nil;. Examples - + (disconnect-pool) => T - + Side Effects @@ -1650,6 +1650,237 @@ The default is &nil;. + + + CREATE-DATABASE + create a database + Function + + + Syntax + create-database connection-spec &key database-type => success + + + Arguments and Values + + + connection-spec + + A connection specification + + + + database-type + + A database type specifier, i.e. a keyword. + This defaults to the value of + *default-database-type* + + + + success + + A boolean flag. If &t;, a new database was + successfully created. + + + + + + + Description + This function creates a database in the database system + specified by database-type. + + + + Examples + +(create-database '("localhost" "new" "dent" "dent") :database-type :mysql) +=> T + +(create-database '("localhost" "new" "dent" "badpasswd") :database-type :mysql) +=> +Error: While trying to access database localhost/new/dent + using database-type MYSQL: + Error database-create failed: mysqladmin: connect to server at 'localhost' failed +error: 'Access denied for user: 'root@localhost' (Using password: YES)' + has occurred. + [condition type: CLSQL-ACCESS-ERROR] + + + + Side Effects + A database will be created on the filesystem of the host. + + + Exceptional Situations + An exception will be thrown if the database system does + not allow new databases to be created or if database creation + fails. + + + Notes + This function may invoke the operating systems + functions. Thus, some database systems may require the + administration functions to be available in the current + PATH. At this time, the + :mysql backend requires + mysqladmin and the + :postgresql backend requires + createdb. + + + + + + DESTROY-DATABASE + destroys a database + Function + + + Syntax + destroy-database connection-spec &key database-type => success + + + Arguments and Values + + + connection-spec + + A connection specification + + + + database-type + + A database type specifier, i.e. a keyword. + This defaults to the value of + *default-database-type* + + + + success + + A boolean flag. If &t;, the database was + successfully destroyed. + + + + + + + Description + This function destroy a database in the database system + specified by database-type. + + + + Examples + +(destroy-database '("localhost" "new" "dent" "dent") :database-type :postgresql) +=> T + +(destroy-database '("localhost" "new" "dent" "dent") :database-type :postgresql) +=> +Error: While trying to access database localhost/test2/root + using database-type POSTGRESQL: + Error database-destory failed: dropdb: database removal failed: ERROR: database "test2" does not exist + has occurred. + [condition type: CLSQL-ACCESS-ERROR] + + + + Side Effects + A database will be removed from the filesystem of the host. + + + Exceptional Situations + An exception will be thrown if the database system does not + allow databases to be removed, the database does not exist, or + if database removal fails. + + + Notes + This function may invoke the operating systems + functions. Thus, some database systems may require the + administration functions to be available in the current + PATH. At this time, the + :mysql backend requires + mysqladmin and the + :postgresql backend requires + dropdb. + + + + + + PROBE-DATABASE + tests for existence of a database + Function + + + Syntax + probe-database connection-spec &key database-type => success + + + Arguments and Values + + + connection-spec + + A connection specification + + + + database-type + + A database type specifier, i.e. a keyword. + This defaults to the value of + *default-database-type* + + + + success + + A boolean flag. If &t;, the database exists + in the database system. + + + + + + + Description + This function tests for the existence of a database in + the database system specified by + database-type. + + + + Examples + +(probe-database '("localhost" "new" "dent" "dent") :database-type :postgresql) +=> T + + + + Side Effects + None + + + Exceptional Situations + An exception maybe thrown if the database system does + not receive administrator-level authentication since function + may need to read the administrative database of the database + system. + + + Notes + None. + + + DATABASE-NAME-FROM-SPEC @@ -1701,7 +1932,7 @@ The default is &nil;. Examples - + (database-name-from-spec '("dent" "newesim" "dent" "dent") :mysql) => "dent/newesim/dent" (connect '("dent" "newesim" "dent" "dent") :database-type :mysql) @@ -1727,7 +1958,7 @@ The default is &nil;. => NIL (find-database **) => #<CLSQL-POSTGRESQL:POSTGRESQL-DATABASE {48392D2D}> - + Side Effects @@ -1803,7 +2034,7 @@ The default is &nil;. Examples - + (execute-command "create table eventlog (time char(30),event char(70))") => T @@ -1829,7 +2060,7 @@ The default is &nil;. (execute-command "drop table eventlog") => T - + Side Effects @@ -1868,7 +2099,7 @@ The default is &nil;. Syntax - query query-expression &key database types => result + query query-expression &key database result-types field-names => result Arguments and Values @@ -1892,11 +2123,11 @@ The default is &nil;. - types + result-types A field type - specififier. The default is &nil;. + specifier. The default is &nil;. The purpose of this argument is cause &clsql; to @@ -1933,6 +2164,15 @@ The default is &nil;. + + field-names + + A boolean with a default value of &t;. When &t;, this + function results a second value of a list of field + names. When &nil;, this function only returns one value + - the list of rows. + + result @@ -1956,7 +2196,7 @@ The default is &nil;. Examples - + (execute-command "create table simple (name char(50), salary numeric(10,2))") => T (execute-command "insert into simple values ('Mai, Pierre',10000)") @@ -1979,7 +2219,7 @@ The default is &nil;. ;; MySQL-specific: (query "show tables") => (("demo") ("log") ("newlog") ("simple") ("spacetrial")) - + Side Effects @@ -2019,7 +2259,7 @@ The default is &nil;. Syntax - map-query output-type-spec function query-expression &key database types => result + map-query output-type-spec function query-expression &key database result-types => result Arguments and Values @@ -2060,10 +2300,10 @@ The default is &nil;. - types + result-types - A field type specififier. + A field type specifier. The default is &nil;. See query for the semantics of this argument. @@ -2116,7 +2356,7 @@ The default is &nil;. Examples - + (map-query 'list #'(lambda (salary name) (declare (ignorable name)) (read-from-string salary)) @@ -2140,7 +2380,7 @@ The default is &nil;. list)) => NIL => (("Hacker, Random J." . 8000.5) ("Mai, Pierre" . 10000.0)) - + Side Effects @@ -2190,7 +2430,7 @@ The default is &nil;. Syntax - do-query ((&rest args) query-expression &key database types) &body body => nil + do-query ((&rest args) query-expression &key database result-types) &body body => nil Arguments and Values @@ -2221,10 +2461,10 @@ The default is &nil;. - types + result-types - A field type specififier. + A field type specifier. The default is &nil;. See query for the semantics of this argument. @@ -2264,7 +2504,7 @@ The default is &nil;. Examples - + (do-query ((salary name) "select salary,name from simple") (format t "~30A gets $~2,5$~%" name (read-from-string salary))) >> Mai, Pierre gets $10000.00 @@ -2274,7 +2514,7 @@ The default is &nil;. (do-query ((salary name) "select salary,name from simple") (return (cons salary name))) => ("10000.00" . "Mai, Pierre") - + Side Effects @@ -2378,7 +2618,7 @@ The default is &nil;. Examples - + (defvar *my-db* (connect '("dent" "newesim" "dent" "dent")) "My database" => *MY-DB* @@ -2411,7 +2651,7 @@ The default is &nil;. >> CLOS Benchmark entry => 32000 => #<EQUAL hash table, 3 entries {48350A1D}> => #<EQUAL hash table, 5 entries {48350FCD}> - + Side Effects