diff --git a/doc/clog-manual.html b/doc/clog-manual.html index c6921bc..92e594e 100644 --- a/doc/clog-manual.html +++ b/doc/clog-manual.html @@ -45,21 +45,22 @@
+
CLOG-Data - CLOG Data Binding
+Load and Write to objects and CLOG-Elements
[function] DATA-LOAD-PLIST OBJ PLIST &KEY (UPCASE-KEY T)
[function] DATA-LOAD-PLIST OBJ PLIST &KEY (ROW-ID-NAME NIL) (UPCASE-KEY T)
Load a PLIST in to OBJ where key of plist is the name of slot on
-OBJ and the value is the data to load. If slot is a clog-element
+OBJ and the value is the data to load. If slot contains a CLOG-ELEMENT
TEXT-VALUE is set, if not the slot is set to the value. If key is not
the name of a slot it is ignored. The key is coverted to a string and
upper cased before attempting to match it to a slot if :UPCASE-KEY t
-(default).
:ROW-ID-NAME is set returns that fields value.
+[function] DATA-WRITE-LIST OBJ SLOT-NAME-LIST &KEY (UPCASE-KEY T)
Returns a list, one value for each slot name in SLOT-NAME-LIST. If
+a slot contains a CLOG-ELEMENT then TEXT-VALUE is used to retrieve the
+value. Slot names may be symbols, keywords or text (and will be
+upcased before looking up symbol if :UPCASE-KEY t). All slot-names
+must be bound.
[function] DATA-WRITE-PLIST OBJ SLOT-NAME-LIST &KEY (UPCASE-KEY T) (KEYS-AS-KEYWORDS T)
Returns a plist, one member for each slot name in SLOT-NAME-LIST,
+the key is the slot name. If a slot contains a CLOG-ELEMENT then
+TEXT-VALUE is used to retrieve the value otherwise it is the
+slot-value. Slot names may be symbols, keywords, or text (and will be
+upcased before looking up symbol if :UPCASE-KEY t). If a slot-name is
+a cons, the first will be used as the key in the plist and the second
+will be the actual slot-name. All slot-names must be bound. If
+slot-name does not exist it is left out of returned plist. If
+:KEYS-AS-KEYWORDS t (default) then the keys will be symbols in the
+keyword package.
SQL Writing Helpers
[function] SQL-FIELD-LIST FIELD-LIST &KEY QUOTE-ALL FOR-INSERT
+ +Given list of fields returns a string for use in a SQL select and
+insert field lists. Use a cons (realname asname) to rename fields for
+selects, if :FOR-INSERT t then the realname is used. Symbols are
+stringified first. If :QUOTE-ALL t then all fields are in quotes.
[function] SQL-VALUE-LIST VALUE-LIST
+ +Given list of values returns a string for use in a SQL insert value
+list. If a value is a string it is quoted with single quotes
+(and single quotes qutoed by doubling) unless is the single
+character '?'.
[function] SQL-UPDATE-LIST PLIST
+ +Given plist of field names and values returns a string for use in a
+SQL update. if the 'key' is a cons the first 'key' used. If a value
+is a string it is quoted with single quotes (and single quotes qutoed
+by doubling) unless is the single character '?'.
[function] SQL-SELECT TABLE FIELD-LIST &KEY WHERE ORDER-BY LIMIT
+ +Build basic sql select statement
[function] SQL-INSERT TABLE FIELD-LIST VALUE-LIST
+ +Build basic sql insert statement
[function] SQL-INSERT* TABLE PLIST
+ +Build basic sql insert statement using a plist
[function] SQL-UPDATE TABLE PLIST WHERE
+ +Build basic sql update statement
+ +
CLOG-Database - CLOG Database Connection
+ + + +[class] CLOG-DATABASE CLOG-ELEMENT
+ +Connection to database.
[generic-function] CREATE-DATABASE CLOG-OBJ &KEY HIDDEN CLASS HTML-ID AUTO-PLACE
+ +Create a new CLOG-Database element, for use in +CLOG-Builder. If not using builder use to connect: + (dbi:connect (database-connection clog-obj) ...)
[generic-function] DATABASE-CONNECTION CLOG-OBJ
+ +Accessor to the database handle
[class] CLOG-ONE-ROW CLOG-ELEMENT
+ +Manipulate one row of a table.
[generic-function] CREATE-ONE-ROW CLOG-OBJ &KEY CLOG-DATABASE HIDDEN CLASS HTML-ID AUTO-PLACE
+ +Create a new CLOG-One-Row element. A CLOG Database +must be a parent to CLOG-One-Row.
[generic-function] QUERY-ROW CLOG-OBJ PANEL SQL
+ +Ignore query related prperties and instead execute
+SQL. row-id-name is required for updates. All PANEL items or custom
+rows on panel will be set using DATA-LOAD-PLIST.
[generic-function] GET-ROW CLOG-OBJ PANEL
+ +Get first row from a database table based on
+CLOG-OBJECT's table-name using where-clause and table-columns.
+row-id-name is required. All PANEL items or custom rows on panel will
+be set using DATA-LOAD-PLIST.
[generic-function] NEXT-ROW CLOG-OBJ PANEL
+ +Get next row from a database table based on query
+made for get-row. All PANEL items or custom rows on panel will be set
+using DATA-LOAD-PLIST.
[generic-function] INSERT-ROW CLOG-OBJ PANEL
+ +Insert new row in to database table based on
+CLOG-OBJECT's table-name and table-columns. DATA-WRITE-PLIST is
+used to extract data from PANEL items and custom rows.
[generic-function] UPDATE-ROW CLOG-OBJ PANEL
+ +Update row in database table based on
+CLOG-OBJECT's table-name using current rowid and table-columns.
+row-id-name is required. All PANEL items or custom rows
+on panel will be retrieved from PANEL using DATA-WRITE-PLIST.
[generic-function] CLEAR-ROW CLOG-OBJ PANEL
+ +Clear current rowid and all fields in PANEL
+using DATA-WRITE-PLIST based on table-columns.
[generic-function] DELETE-ROW CLOG-OBJ
+ +Delete a row from a database table based on +current rowid
+
-
CLOG-Panel - CLOG Panels
@@ -4044,7 +4347,7 @@ if:HTML-ID "myid" then the HTML-ID for cent
-
CLOG-Style-Block - CLOG Style Blocks
@@ -4087,7 +4390,7 @@ selector. For example:-
CLOG-Form-Data
@@ -4812,7 +5115,7 @@ optionally fill in with contents of data-list.-
CLOG-Canvas - Class for CLOG canvas objects
@@ -5204,7 +5507,7 @@ https://developer.mozilla.org/en-US/docs/Web/CSS/font-
CLOG-Multimedia - Base Class for CLOG multimedia objects
@@ -5650,7 +5953,7 @@ is nil unbind the event.-
ON-FILE-NAME called with filename or nil if fai
-
CANCEL-TEXT is only displayed if m
-
CLOG-Body - CLOG Body Objects
@@ -6818,7 +7121,7 @@ withHTML.
-
CLOG-Window - CLOG Window Objects
@@ -7223,7 +7526,7 @@ on-storage event is fired for changes to :local storage keys.-
CLOG-Document - CLOG Document Objects
@@ -7395,7 +7698,7 @@ IfON-FULL-SCREEN-CHANGE-HANDLER is nil unbind the event.
-
Clog-Location - CLOG Location Objects
@@ -7525,7 +7828,7 @@ IfON-FULL-SCREEN-CHANGE-HANDLER is nil unbind the event.
-
CLOG-Navigator - CLOG Navigator Objects
@@ -7581,7 +7884,7 @@ IfON-FULL-SCREEN-CHANGE-HANDLER is nil unbind the event.
-
CLOG-jQuery - Base class for CLOG jQuery Objects
@@ -7648,7 +7951,7 @@ result orDEFAULT-ANSWER on time out.
-
Tutorial and demo helpers
@@ -7766,7 +8069,7 @@ clog-user:body to last window openned to /repl.-
* Introduction to Internals *
diff --git a/source/clog-dbi.lisp b/source/clog-dbi.lisp index efe7b94..3fe2f3c 100644 --- a/source/clog-dbi.lisp +++ b/source/clog-dbi.lisp @@ -89,6 +89,10 @@ CLOG-Builder. If not using builder use to connect: :accessor queryid :initform nil :documentation "Current query (private)") + (last-fetch + :accessor last-fetch + :initform nil + :documentation "Last fetch plist") (columns :accessor table-columns :initform nil @@ -149,8 +153,9 @@ be set using DATA-LOAD-PLIST.")) made for get-row. All PANEL items or custom rows on panel will be set using DATA-LOAD-PLIST.")) (defmethod next-row ((obj clog-obj) panel) + (setf (last-fetch obj) (dbi:fetch (queryid obj))) (setf (rowid obj) (data-load-plist panel - (dbi:fetch (queryid obj)) + (last-fetch obj) :row-id-name (row-id-name obj)))) (defgeneric insert-row (clog-obj panel) diff --git a/source/clog.lisp b/source/clog.lisp index 8756448..197ffcf 100644 --- a/source/clog.lisp +++ b/source/clog.lisp @@ -554,6 +554,7 @@ embedded in a native template application.)" (row-id-name generic-function) (rowid generic-function) (table-columns generic-function) + (last-fetch generic-function) (query-row generic-function) (get-row generic-function) (next-row generic-function)