Greg Slepak avatar Greg Slepak committed ac3ebd4

replaced null->nil with generic cast-if

Comments (0)

Files changed (2)

example-site/dragonfly-framework/plugins-inactive/db/database_utils.lsp

 
 (context MAIN)
 
-(define (null->nil x)
-	(if-not (null? x) x)
+(define (cast-if test to from)
+	(if (test from) to from)
 )
+(global 'cast-if)
 
 ; define-smacro defined in utils.lsp (part of Dragonfly's core functions)
 (define-smacro (for-query-with-db db query)

example-site/views/dragonfly_sqlite3.html

 					</tr>
 				<% )) %>
 			</table>
-			<% (setf obj (find-dbobj db "people" '("name" "age") 1)) %>
+			<% (setf *obj* (find-dbobj db "people" '("name" "age") 1)) %>
 			<p>
-				I've found a person called <%=(obj:name)%> in the table '<%=obj:table%>' at location <%=obj:finder%>, this person is <%=(obj:age)%> years old.
+				I've found a person called <%=(*obj*:name)%> in the table '<%=*obj*:table%>' at location <%=*obj*:finder%>, this person is <%=(*obj*:age)%> years old.
 			</p>
 			<p>
-				Let's set their age to 10.<%(obj:age 10) (dbobj-save obj)%>
+				Let's set their age to 10.<%(*obj*:age 10) (dbobj-save *obj*)%>
 			</p>
 			<p>
-				They are now <%=(obj:age)%> years old.
+				They are now <%=(*obj*:age)%> years old.
 			</p>
 			<p>
 				Further, I can create a new person. See:
-				<% (release obj) (setf obj (create-dbobj db "people" '("Sue" 57))) %>
+				<% (release *obj*) (setf *obj* (create-dbobj db "people" '("Sue" 57))) %>
 			</p>
 			<p>
 			<table>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.