diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:28 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:28 -0800 |
commit | bd9733926076885e3417b74de76e4c9c7bc56254 (patch) | |
tree | 2c99dced547d48407ad44cb0e45e31bb4d02ce43 /rdms.scm | |
parent | fa3f23105ddcf07c5900de47f19af43d1db1b597 (diff) | |
download | slib-upstream/2c7.tar.gz slib-upstream/2c7.zip |
Import Upstream version 2c7upstream/2c7
Diffstat (limited to 'rdms.scm')
-rw-r--r-- | rdms.scm | 42 |
1 files changed, 23 insertions, 19 deletions
@@ -79,6 +79,7 @@ (not (negative? x)))) integer #f) + (number #f number? number #f) (expression #f #f expression #f) (boolean #f boolean? boolean #f) (symbol #f symbol? symbol #f) @@ -252,6 +253,7 @@ (primary-limit 1) (column-name-alist '()) (column-foreign-list '()) + (column-foreign-check-list '()) (column-domain-list '()) (column-type-list '()) (export-alist '()) @@ -283,24 +285,26 @@ (set! column-domain-list (cons column-domain column-domain-list)) (set! column-foreign-list - (cons - (let ((foreign-name - (row-ref dom:row domains:foreign-pos))) - (cond - ((or (not foreign-name) - (eq? foreign-name table-name)) #f) - (else - (let* ((tab (open-table foreign-name #f)) - (p? (and tab (tab 'get 1)))) - (cond - ((not tab) - (rdms:error "foreign key table missing for:" - foreign-name)) - ((not (= (tab 'primary-limit) 1)) - (rdms:error "foreign key table wrong type:" - foreign-name)) - (else p?)))))) - column-foreign-list)))) + (cons (let ((foreign-name + (row-ref dom:row domains:foreign-pos))) + (and (not (eq? foreign-name table-name)) + foreign-name)) + column-foreign-list)) + (set! column-foreign-check-list + (cons + (let ((foreign-name (car column-foreign-list))) + (and foreign-name + (let* ((tab (open-table foreign-name #f)) + (p? (and tab (tab 'get 1)))) + (cond + ((not tab) + (rdms:error "foreign key table missing for:" + foreign-name)) + ((not (= (tab 'primary-limit) 1)) + (rdms:error "foreign key table wrong type:" + foreign-name)) + (else p?))))) + column-foreign-check-list)))) (else (rdms:error "missing domain for column:" ci column-name))) (cond @@ -409,7 +413,7 @@ (rdms:error "foreign key missing:" table-name column-name value)))) cirs dirs row column-name-alist column-domain-list - column-foreign-list) + column-foreign-check-list) (cond ((and uir (not (uir row))) (rdms:error "violated user integrity rule:" row))))) |