This shows you the differences between two versions of the page.
en:dbopen [2016/08/12 21:26] admin |
en:dbopen [2020/02/28 10:46] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== DBOpen (Statement) ===== | ||
- | |||
- | ==== Format ==== | ||
- | **dbopen** [[stringexpressions|file_name]]\\ | ||
- | **dbopen** ( [[stringexpressions|file_name]] )\\ | ||
- | **dbopen** [[integerexpressions|database_number]] , [[stringexpressions|file_name]]\\ | ||
- | **dbopen** ( [[integerexpressions|database_number]] , [[stringexpressions|file_name]] ) | ||
- | |||
- | ==== Description ==== | ||
- | Open an SQLite database file. If the file does not exist then create it. Up to eight database connections can be made at a time in a program. | ||
- | |||
- | ==== Example ==== | ||
- | < | ||
- | #database foo - create a database, populate a table, open a recordset and read data from table. | ||
- | |||
- | # create a new database file or open it | ||
- | dbopen " | ||
- | |||
- | # delete old foo table - trap error if new database | ||
- | onerror errortrap | ||
- | dbexecute "drop table foo;" | ||
- | offerror | ||
- | # create and populate | ||
- | dbexecute " | ||
- | dbexecute " | ||
- | dbexecute " | ||
- | dbexecute " | ||
- | |||
- | # open a recordset and loop through the rows of data | ||
- | dbopenset " | ||
- | while dbrow() | ||
- | print dbint(0) + dbstring(1) + dbfloat(2) | ||
- | end while | ||
- | dbcloseset | ||
- | |||
- | # wrap everything up | ||
- | dbclose | ||
- | end | ||
- | |||
- | errortrap: | ||
- | # accept error - display nothing - return to next statement | ||
- | return | ||
- | </ | ||
- | will display | ||
- | < | ||
- | 1one3.14 | ||
- | 3three9.43 | ||
- | 2two6.28 | ||
- | </ | ||
- | |||
- | ==== See Also ==== | ||
- | {{page> | ||
- | |||
- | ==== External Links ==== | ||
- | More information about databases in general and SQLite specifically can be found at [[http:// | ||
- | |||
- | ==== History ==== | ||
- | |0.9.6y|New to Version| | ||
- | |0.9.9.19|Added ability to have 8 database connections| | ||