From d55148a9bdb8510eda79557e2b4ae7107f163b71 Mon Sep 17 00:00:00 2001 From: David Botton Date: Tue, 1 Mar 2022 15:58:21 -0500 Subject: [PATCH] No longer require child relationship for database control --- test/db-table.clog | 2 +- test/lookup.clog | 2 +- test/many-to-one.clog | 2 +- test/rolodex.clog | 2 +- test/test.db | Bin 16384 -> 16384 bytes tools/clog-builder-settings.lisp | 64 ++++++++++++++++++++----------- 6 files changed, 46 insertions(+), 26 deletions(-) diff --git a/test/db-table.clog b/test/db-table.clog index 9b5ddaa..7636cd3 100644 --- a/test/db-table.clog +++ b/test/db-table.clog @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/test/lookup.clog b/test/lookup.clog index 46537c7..718af54 100644 --- a/test/lookup.clog +++ b/test/lookup.clog @@ -1 +1 @@ -
span \ No newline at end of file +
span \ No newline at end of file diff --git a/test/many-to-one.clog b/test/many-to-one.clog index 9412d8d..74e5b90 100644 --- a/test/many-to-one.clog +++ b/test/many-to-one.clog @@ -1 +1 @@ -
n/an/a \ No newline at end of file +
n/an/a \ No newline at end of file diff --git a/test/rolodex.clog b/test/rolodex.clog index 68089d5..51ffabd 100644 --- a/test/rolodex.clog +++ b/test/rolodex.clog @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/test/test.db b/test/test.db index 6e01b2c3f870428d62b0ffe184c96476e4d99dda..165244e8280f27cb4b7c293f92fc882c3c14e006 100644 GIT binary patch delta 155 zcmZo@U~Fh$oFL68G*QNxQD|er5`G?L{^<<-xB0j8PvxB0hk7Bpz(XXd}nFtJd1@^*P&9v1!{ Y2L2=bPxx2x_iPq4sNvt-qhBHb0G-4Xf&c&j diff --git a/tools/clog-builder-settings.lisp b/tools/clog-builder-settings.lisp index d21fc04..28c47b4 100644 --- a/tools/clog-builder-settings.lisp +++ b/tools/clog-builder-settings.lisp @@ -1365,6 +1365,7 @@ :create-type :base :setup ,(lambda (control content control-record) (declare (ignore content) (ignore control-record)) + (setf (attribute control "data-clog-one-row-db") "") (setf (attribute control "data-clog-one-row-table") "") (setf (attribute control "data-clog-one-row-where") "") (setf (attribute control "data-clog-one-row-order") "") @@ -1375,10 +1376,14 @@ :on-setup ,(lambda (control control-record) (declare (ignore control-record)) (let ((parent (attribute (parent-element control) "data-clog-name")) + (cdb (attribute control "data-clog-one-row-db")) (master (attribute control "data-clog-one-row-master"))) + (if (or (equal cdb "") + (equal cdb "undefined")) + (setf cdb parent)) (when (equal master "") (setf master nil)) - (format nil "(setf (clog-database target) ~A) ~ + (format nil "(setf (clog-database target) (clog-database (~A panel))) ~ ~A ~ (setf (table-name target) \"~A\") ~ (setf (where-clause target) \"~A\") ~ @@ -1386,12 +1391,10 @@ (setf (limit target) \"~A\") ~ (setf (row-id-name target) \"~A\") ~ (setf (table-columns target) '(~A))" - (if master - (format nil "(clog-database (~A panel))" parent) - (format nil "(~A panel)" parent)) + cdb (if master (format nil "(set-master-one-row target (~A panel) \"~A\")" - parent master) + cdb master) "") (attribute control "data-clog-one-row-table") (attribute control "data-clog-one-row-where") @@ -1402,7 +1405,9 @@ :events ((:name "on-fetch" :parameters "target") ,@*events-element*) - :properties ((:name "table name" + :properties ((:name "database control" + :attr "data-clog-one-row-db") + (:name "table name" :attr "data-clog-one-row-table") (:name "table row id name" :attr "data-clog-one-row-id-name") @@ -1424,6 +1429,7 @@ :create-type :base :setup ,(lambda (control content control-record) (declare (ignore content) (ignore control-record)) + (setf (attribute control "data-clog-one-row-db") "") (setf (attribute control "data-clog-one-row-table") "") (setf (attribute control "data-clog-one-row-where") "") (setf (attribute control "data-clog-one-row-order") "") @@ -1434,10 +1440,14 @@ :on-setup ,(lambda (control control-record) (declare (ignore control-record)) (let ((parent (attribute (parent-element control) "data-clog-name")) + (cdb (attribute control "data-clog-one-row-db")) (master (attribute control "data-clog-one-row-master"))) + (if (or (equal cdb "") + (equal cdb "undefined")) + (setf cdb parent)) (when (equal master "") (setf master nil)) - (format nil "(setf (clog-database target) ~A) ~ + (format nil "(setf (clog-database target) (clog-database (~A panel))) ~ ~A ~ (setf (table-name target) \"~A\") ~ (setf (where-clause target) \"~A\") ~ @@ -1445,12 +1455,10 @@ (setf (limit target) \"~A\") ~ (setf (row-id-name target) \"~A\") ~ (setf (table-columns target) '(~A))" - (if master - (format nil "(clog-database (~A panel))" parent) - (format nil "(~A panel)" parent)) + cdb (if master (format nil "(set-master-one-row target (~A panel) \"~A\")" - parent master) + cdb master) "") (attribute control "data-clog-one-row-table") (attribute control "data-clog-one-row-where") @@ -1469,7 +1477,9 @@ (:name "on-column" :parameters "target column table-column") ,@*events-element*) - :properties ((:name "table name" + :properties ((:name "database control" + :attr "data-clog-one-row-db") + (:name "table name" :attr "data-clog-one-row-table") (:name "table row id name" :attr "data-clog-one-row-id-name") @@ -1491,6 +1501,7 @@ :create-type :base :setup ,(lambda (control content control-record) (declare (ignore content) (ignore control-record)) + (setf (attribute control "data-clog-one-row-db") "") (setf (attribute control "data-clog-one-row-table") "") (setf (attribute control "data-clog-lookup-value") "") (setf (attribute control "data-clog-lookup-option") "") @@ -1503,10 +1514,14 @@ :on-setup ,(lambda (control control-record) (declare (ignore control-record)) (let ((parent (attribute (parent-element control) "data-clog-name")) + (cdb (attribute control "data-clog-one-row-db")) (master (attribute control "data-clog-one-row-master"))) + (if (or (equal cdb "") + (equal cdb "undefined")) + (setf cdb parent)) (when (equal master "") (setf master nil)) - (format nil "(setf (clog-database target) ~A) ~ + (format nil "(setf (clog-database target) (clog-database (~A panel))) ~ ~A ~ (setf (table-name target) \"~A\") ~ (setf (value-field target) :|~A|) ~ @@ -1516,12 +1531,10 @@ (setf (limit target) \"~A\") ~ (setf (row-id-name target) \"~A\") ~ (setf (table-columns target) '(~A))" - (if master - (format nil "(clog-database (~A panel))" parent) - (format nil "(~A panel)" parent)) + cdb (if master (format nil "(set-master-one-row target (~A panel) \"~A\")" - parent master) + cdb master) "") (attribute control "data-clog-one-row-table") (attribute control "data-clog-lookup-value") @@ -1542,6 +1555,8 @@ (setf (attribute control "multiple") t) (remove-attribute control "multiple")) (property control "multiple"))) + (:name "database control" + :attr "data-clog-one-row-db") (:name "table name" :attr "data-clog-one-row-table") (:name "table row id name" @@ -1569,6 +1584,7 @@ :setup ,(lambda (control content control-record) (declare (ignore content) (ignore control-record)) (setf (size control) "4") + (setf (attribute control "data-clog-one-row-db") "") (setf (attribute control "data-clog-one-row-table") "") (setf (attribute control "data-clog-lookup-value") "") (setf (attribute control "data-clog-lookup-option") "") @@ -1581,10 +1597,14 @@ :on-setup ,(lambda (control control-record) (declare (ignore control-record)) (let ((parent (attribute (parent-element control) "data-clog-name")) + (cdb (attribute control "data-clog-one-row-db")) (master (attribute control "data-clog-one-row-master"))) + (if (or (equal cdb "") + (equal cdb "undefined")) + (setf cdb parent)) (when (equal master "") (setf master nil)) - (format nil "(setf (clog-database target) ~A) ~ + (format nil "(setf (clog-database target) (clog-database (~A panel))) ~ ~A ~ (setf (table-name target) \"~A\") ~ (setf (value-field target) :|~A|) ~ @@ -1594,12 +1614,10 @@ (setf (limit target) \"~A\") ~ (setf (row-id-name target) \"~A\") ~ (setf (table-columns target) '(~A))" - (if master - (format nil "(clog-database (~A panel))" parent) - (format nil "(~A panel)" parent)) + cdb (if master (format nil "(set-master-one-row target (~A panel) \"~A\")" - parent master) + cdb master) "") (attribute control "data-clog-one-row-table") (attribute control "data-clog-lookup-value") @@ -1620,6 +1638,8 @@ (setf (attribute control "multiple") t) (remove-attribute control "multiple")) (property control "multiple"))) + (:name "database control" + :attr "data-clog-one-row-db") (:name "table name" :attr "data-clog-one-row-table") (:name "table row id name"