Greg Slepak avatar Greg Slepak committed 6f33c92

added query-cell-with-db

Comments (0)

Files changed (2)

   * added documentation for MAX_POST_LENGTH in request.lsp
   * fix to Jeff's JSON.lsp plugin (switched to " instead of ' for strings)
   * DF:activate-plugin can now be used to load all lisp files in a directory
-  * added db/dragonfly_utils, includes fn-query-with-db, assoc-row-with-db and assoc-rows-with-db
+  * added db/dragonfly_utils, includes fn-query-with-db, assoc-row-with-db, assoc-rows-with-db and query-cell-with-db
   * fixed handling of floats in Sqlite3 on some architectures (more improvements needed though, see TODO)
   * added 'extract' and '<-' functions to core utils
 

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

 	)
 )
 (global 'assoc-rows-with-db)
+
+(define (query-cell-with-db db query params , sql result)
+	(when (setf sql (db:prepare-sql query))
+		(when (or (not params) (sql:bind-params params))
+			(setf result (sql:next-row))
+			(when (list? result)
+				(setf result (first result)))
+		)
+		(deallocate sql)
+		result
+	)
+)
+(global 'query-cell-with-db)
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.