r9549:
[clsql.git] / examples / clsql-tutorial.lisp
index cf27468c167f71a98f3b29e838337f39d395594d..7560f9a68d6f470987d4ab91acd66e50214f3ea9 100644 (file)
@@ -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
 
 ;; 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