BYU Home pageBRIGHAM YOUNG UNIVERSITY
  Office of Digital Humanities
Back     BYU LiveCode Lessons Gateway

Database library commands and functions

The LiveCode terms in the Database library fall into several categories. Look up the terms in the LiveCode dictionary for a detailed explanation of how they work.

Terms in parentheses are the “old-style” revdb functions. They still work as synonyms of the main entry. Note that some of the old-style functions correspond to newer-style commands, which means they are not interchangeable without changing the syntax of the LiveCode statements in which they are used.

Connecting and disconnecting:

revOpenDatabase function (revdb_connect function): Connect to a database.

revOpenDatabases function (revdb_connections function): Return a list of the open database connections.

revCloseDatabase command (revdb_disconnect function): End a session with a database.

revSetDatabaseDriverPath command: Where are the database drivers?

Getting information and controlling the database:

revExecuteSQL command (revdb_execute function): Execute SQL statements. This command is the one to use when executing any non-select statement—INSERT and UPDATE, for example.

revCommitDatabase command (revdb_commit function): Save changes made to a database.

revRollBackDatabase command (revdb_rollback function): Throw away changes made.

revDatabaseType function (revdb_dbtype function): Is this database MySQL, Oracle, etc?

revDatabaseConnectResult function (revdb_connectionerr function): What was the last connection error?

revDatabaseCursors function (revdb_cursors function): What are this database’s open record sets?

Selecting records to work with:

revQueryDatabase function (revdb_query function): Select records to create a record set.

revQueryDatabaseBLOB function (revdb_queryblob function): Select records containing binary data.

Getting information and controlling a record set:

revNumberOfRecords function (revdb_recordcount function): How many records in this record set?

revDatabaseColumnCount function (revdb_columncount function): How many fields in each record?

revDatabaseColumnLengths function (revdb_columnlengths function): What’s the maximum field size?

revDatabaseColumnNames function (revdb_columnnames function): What are the fields named?

revDatabaseColumnTypes function (revdb_columntypes function): What are the field data types?

revDatabaseID function (revdb_cursorconnection function): Which database is this record set in?

revQueryResult function (revdb_cursorerr function): What was the last query error?

revCloseCursor command: Dispose of a record set.

Moving between records in a record set:

revCurrentRecord function (revdb_currentrecord function): Which record are we on?

revCurrentRecordIsFirst function (revdb_isbof function): Is this record the first record in the record set?

revCurrentRecordIsLast function (revdb_iseof function): Is this record the last record in the record set?

revMoveToFirstRecord command (revdb_movefirst function): Move to the first record in the current record set.

revMoveToLastRecord command (revdb_movelast function): Move to the last record in the current record set.

revMoveToNextRecord command (revdb_movenext function): Move forward one record.

revMoveToPreviousRecord command (revdb_moveprev function): Move back one record.

Getting data:

revDataFromQuery function (revdb_querylist function): Get data without making a record set.

revDatabaseColumnNamed function: Get data from a field in the current record set using the field's name.

revDatabaseColumnNumbered function (revdb_columnbynumber function): Get data from a field in the current record set using the field's column number.

revDatabaseColumnIsNull function (revdb_columnisnull function): Is a field set to null (no value)?

Note: The syntax used by the Database library is the same on all platforms, and (as far as possible) for all databases. Since some databases have more features than others, however, some commands and functions in the Database library may not be supported by all databases.

This information was adapted from the LiveCode Documentation.


Back     BYU LiveCode Lessons Gateway
Maintained by Devin Asay.
Copyright © 2005 Brigham Young University.
This page last updated on March 08, 2012 10:27:00.