Class Database |
Encapsulates an ODBC accessible database.
Details |
Constructor |
DSN | Data store name (odbc)
|
DB_TABLE |
Table to access at that DSN
Methods: |
Abort a block transaction.
newdb | if present, database to associate with this object |
current database, which will be newdb if non-null |
Access the underlying database.
Name of database to start accessingnewTable | if present, table to associate with this object |
current table, which will be newTable if non-null |
Change the name of the table to access.
Name of table to start accessing nothing useful |
if cannot close the database |
Close the database.
Delete entries from the database table based on some filter. e.g. db.delete("name = 'fred'") would remove all data base entries whose name field is fred. Note that calling delete with no argument deletes all entries in the table!
database driver metadata record |
Get record of database odbc driver metadata
Terminate a block transaction. Correctly handles nested blocks by only terminating when leaving outermost block.
rows that have been selected from the database |
Fetch selected rows from the database. Note that, unlike the native 'fetch(db)' procedure, this method is a generator.
result of doing the insert |
Insert the contents of the parameter (a table or record) into the currently active database table.
table of fields (key is field name, database limits |
Get record of database limits
user | Valid database user id
|
password |
a database access |
if unable to open database |
Open a database with automatic access to a specific table
Password for that user. database metadata record |
Get record of database metadata.
select(cols:"*", filter, order)
cols | Columns to display (default is <b>"*"</b>)
|
filter | SQL where clause (w/o the 'WHERE')
that identifies rows to display
|
order | SQL order clause (w/o the 'ORDER BY')
|
result of performing query |
Select rows from the currently active database table.
result of executing sqlstatement |
Execute an arbitrary SQL command/query on the database
Arbitrary SQL statementStart a block transaction if not in one already. Counts nested blocks to ensure correct handling of block ends.
rec | table of fields (key is field name,
entry is new field value) to update
<i>(Can also be a record)</i>
|
whereClause | SQL where clause (w/o the 'WHERE')
that identifies rows to modify
|
result of updating rows |
Update rows in the currently active database table.
Fields: |