(in-package #:clsql-tests)
-#.(clsql:locally-enable-sql-reader-syntax)
+(clsql-sys:file-enable-sql-reader-syntax)
+
(setq *rt-oodml*
'(
;; test retrieval of node, derived nodes etc
(deftest :oodml/select/12
(with-dataset *ds-nodes*
- (length (clsql:select 'node :where [node-id] :flatp t :caching nil)))
+ (length (clsql:select 'node :where [not [null [node-id]]] :flatp t :caching nil)))
11)
(deftest :oodml/select/13
(deftest :oodml/select/14
(with-dataset *ds-nodes*
- (length (clsql:select 'setting :where [setting-id] :flatp t :caching nil)))
+ (length (clsql:select 'setting :where [not [null [setting-id]]] :flatp t :caching nil)))
4)
(deftest :oodml/select/15
(deftest :oodml/select/16
(with-dataset *ds-nodes*
- (length (clsql:select 'user :where [user-id] :flatp t :caching nil)))
+ (length (clsql:select 'user :where [not [null [user-id]]] :flatp t :caching nil)))
2)
(deftest :oodml/select/17
(deftest :oodml/select/18
(with-dataset *ds-nodes*
- (length (clsql:select 'theme :where [theme-id] :flatp t :caching nil)))
+ (length (clsql:select 'theme :where [not [null [theme-id]]] :flatp t :caching nil)))
2)
(deftest :oodml/select/19
(deftest :oodml/select/22
(with-dataset *ds-nodes*
- (let ((a (car (clsql:select 'subloc :where [subloc-id] :flatp t :caching nil))))
+ (let ((a (car (clsql:select 'subloc :where [not [null [subloc-id]]] :flatp t :caching nil))))
(values
(slot-value a 'node-id)
(slot-value a 'subloc-id)
(let ((sl (car (clsql:select 'subloc
:where [= 10 [slot-value 'subloc 'subloc-id]]
:flatp t :caching nil))))
+ (unless sl
+ (error "Couldn't find expected sublocation"))
(format nil "~a ~a ~a"
(slot-value sl 'subloc-id)
(slot-value sl 'title)
(let ((sl (car (clsql:select 'subloc
:where [= 10 [slot-value 'subloc 'subloc-id]]
:flatp t :caching nil))))
+ (unless sl
+ (error "In psfl: found no sublocation with id = 10"))
(format nil "~a ~a ~a"
(slot-value sl 'subloc-id)
(slot-value sl 'title)
(let ((sl (car (clsql:select 'subloc
:where [= 10 [slot-value 'subloc 'subloc-id]]
:flatp t :caching nil))))
+ (unless sl
+ (error "Select for modification: Found no sublocation with id = 10"))
(setf (slot-value sl 'title) "Altered subloc title")
(setf (slot-value sl 'loc) "Altered loc")
(clsql:update-record-from-slot sl 'title)
(let ((sl (car (clsql:select 'subloc
:where [= 10 [slot-value 'subloc 'subloc-id]]
:flatp t :caching nil))))
+ (unless sl
+ (error "Select for next modification: Found no sublocation with id = 10"))
(setf (slot-value sl 'title) "subloc-1")
(setf (slot-value sl 'loc) "a subloc")
- (clsql:update-record-from-slot sl '(title loc))
+ (clsql:update-record-from-slots sl '(title loc))
(print-fresh-subloc)))))
"10 subloc-1 a subloc"
"10 Altered subloc title Altered loc"
t)
))
-
-
-#.(clsql:restore-sql-reader-syntax-state)