X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;ds=sidebyside;f=examples%2Fclsql-tutorial.lisp;h=7560f9a68d6f470987d4ab91acd66e50214f3ea9;hb=02ec8bd400759fddb0deedcc21616b693274756b;hp=cf27468c167f71a98f3b29e838337f39d395594d;hpb=9f1b97ba188b6c065146fc2cb7e818e5c62b7175;p=clsql.git diff --git a/examples/clsql-tutorial.lisp b/examples/clsql-tutorial.lisp index cf27468..7560f9a 100644 --- a/examples/clsql-tutorial.lisp +++ b/examples/clsql-tutorial.lisp @@ -4,8 +4,8 @@ ;; You must set these variables to appropriate values. (defvar *tutorial-database-type* nil - "Possible values are :postgresql,:postgresql-socket :mysql or :sqlite") -(defvar *tutorial-database-name* "" + "Possible values are :postgresql,:postgresql-socket :mysql, :oracle, :odbc or :sqlite") +(defvar *tutorial-database-name* "clsqltut" "The name of the database we will work in.") (defvar *tutorial-database-user* "" "The name of the database user we will work as.") @@ -18,7 +18,6 @@ ((emplid :db-kind :key :db-constraints :not-null - :nulls-ok nil :type integer :initarg :emplid) (first-name @@ -32,7 +31,6 @@ (email :accessor employee-email :type (string 100) - :nulls-ok t :initarg :email) (companyid :type integer) @@ -45,7 +43,6 @@ :set nil)) (managerid :type integer - :nulls-ok t :initarg :managerid) (manager :accessor employee-manager @@ -86,11 +83,21 @@ ;; Connect to the database (see the CLSQL documentation for vendor ;; specific connection specs). -(clsql:connect `(,*tutorial-database-server* - ,*tutorial-database-name* - ,*tutorial-database-user* - ,*tutorial-database-password*) - :database-type *tutorial-database-type*) +(case *tutorial-database-type* + ((:mysql :postgresql) + (clsql:connect `(,*tutorial-database-server* + ,*tutorial-database-name* + ,*tutorial-database-user* + ,*tutorial-database-password*) + :database-type *tutorial-database-type*)) + ((:odbc :oracle) + (clsql:connect `(,*tutorial-database-name* + ,*tutorial-database-user* + ,*tutorial-database-password*) + :database-type *tutorial-database-type*)) + (:sqlite + (clsql:connect `(,*tutorial-database-name*) + :database-type *tutorial-database-type*))) ;; Record the sql going out, helps us learn what is going ;; on behind the scenes