HELP: new-result-set
{ $values
- { "query" "a query" } { "handle" alien } { "class" class }
- { "result-set" result-set } }
+ { "query" "a query" } { "handle" alien } { "class" class }
+ { "result-set" result-set } }
{ $description "Creates a new " { $link result-set } " object of type " { $snippet "class" } "." } ;
HELP: new-statement
HELP: bind-statement
{ $values
- { "obj" object } { "statement" statement } }
+ { "obj" object } { "statement" statement } }
{ $description "Sets the statement's " { $slot "bind-params" } " and calls " { $link bind-statement* } " to do the database-specific bind. Sets " { $slot "bound?" } " to true if binding succeeds." } ;
HELP: bind-statement*
{ $values
- { "statement" statement } }
+ { "statement" statement } }
{ $description "Does a low-level bind of the SQL statement's tuple parameters if the database requires. Some databases should treat this as a no-op and bind instead when the actual statement is run." } ;
HELP: <simple-statement>
HELP: low-level-bind
{ $values
- { "statement" statement } }
+ { "statement" statement } }
{ $description "For use with prepared statements, methods on this word should bind the datatype in the SQL spec to its identifier in the SQL string. To name bound variables, SQLite uses identifiers in the form of " { $snippet ":name" } ", while PostgreSQL uses increasing numbers beginning with a dollar sign, e.g. " { $snippet "$1" } "." } ;
HELP: query-results
HELP: in-transaction?
{ $values
- { "?" boolean } }
+ { "?" boolean } }
{ $description "Returns true if there is currently a transaction in progress in this scope." } ;
HELP: query-each
{ $values
- { "result-set" result-set } { "quot" quotation } }
+ { "result-set" result-set } { "quot" quotation } }
{ $description "Applies the quotation to each row of the " { $link result-set } " in order." } ;
HELP: query-map
{ $values
- { "result-set" result-set } { "quot" quotation }
- { "seq" sequence } }
+ { "result-set" result-set } { "quot" quotation }
+ { "seq" sequence } }
{ $description "Applies the quotation to each row of the " { $link result-set } " in order." } ;
HELP: rollback-transaction
HELP: sql-command
{ $values
- { "sql" string } }
+ { "sql" string } }
{ $description "Executes an SQL string using the database in the " { $link db-connection } " symbol." } ;
HELP: sql-query
{ $values
- { "sql" string }
- { "rows" "an array of arrays of strings" } }
+ { "sql" string }
+ { "rows" "an array of arrays of strings" } }
{ $description "Runs an SQL query of raw text in the database in the " { $link db-connection } " symbol. Each row is returned as an array of strings; no type-conversions are done on the resulting data." } ;
{ sql-command sql-query } related-words
HELP: sql-row
{ $values
- { "result-set" result-set }
- { "seq" sequence } }
+ { "result-set" result-set }
+ { "seq" sequence } }
{ $description "Returns the current row in a " { $link result-set } " as an array of strings." } ;
HELP: sql-row-typed
{ $values
- { "result-set" result-set }
- { "seq" sequence } }
+ { "result-set" result-set }
+ { "seq" sequence } }
{ $description "Returns the current row in a " { $link result-set } " as an array of typed Factor objects." } ;
{ sql-row sql-row-typed } related-words
HELP: with-db
{ $values
- { "db" "a database configuration object" } { "quot" quotation } }
+ { "db" "a database configuration object" } { "quot" quotation } }
{ $description "Calls the quotation with a database bound to the " { $link db-connection } " symbol. See " { $link "db-custom-database-combinators" } " for help setting up database access." } ;
HELP: with-transaction
{ $values
- { "quot" quotation } }
+ { "quot" quotation } }
{ $description "Calls the quotation inside a database transaction and commits the result to the database after the quotation finishes. If the quotation throws an error, the transaction is aborted." } ;
ARTICLE: "db" "Database library"
You have seen some examples of this:
{ $list
- { "The help is navigable online, but you can also invoke it with " { $link help } " and print help items with " { $link print-content } " ; " }
- { "The " { $snippet "F2" } " shortcut or the words " { $link refresh } " and " { $link refresh-all } " can be used to refresh vocabularies from disk while continuing working in the listener; " }
- { "The " { $link edit } " word gives you editor integration, but you can also click on file names in the help pages for vocabularies to open them. " }
+ { "The help is navigable online, but you can also invoke it with " { $link help } " and print help items with " { $link print-content } " ; " }
+ { "The " { $snippet "F2" } " shortcut or the words " { $link refresh } " and " { $link refresh-all } " can be used to refresh vocabularies from disk while continuing working in the listener;" }
+ { "The " { $link edit } " word gives you editor integration, but you can also click on file names in the help pages for vocabularies to open them." }
}
The refresh is an efficient mechanism. Whenever a word is redefined, words that depend on it are recompiled against the new