SqlOpenDatabase: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
SqlOpenDatabase(''filename'', ''version'', ''fullname'', ''maxSize'')
SqlOpenDatabase(''dbName'')


== Description ==
== Description ==


SqlOpenDataBase is used to create and open SQLite databases.  
SqlOpenDataBase is used to create and open SQLite databases. It works with both the SQLite WASM library and the Cordova SQLite plugin.


''filename'' is the actual name of the file. If ''filename'' does not exist, it is created.
''dbName'' is the name of the database. If ''dbName'' does not exist, it is created. The database is created in localStorage by default. If another name is supplied, it is created as that name - but will not persist if the app is restarted.
 
''version'' (optional) is the version number. Used on file creation. Set to "1.0" if no value supplied.
 
''fullname'' (optional)  is a long description of the file. (optional). Used on file creation. Set to ''filename'' if no value supplied.
 
''maxsize'' (optional)  is the maximum number of records (optional). Used on file creation. Set to 1,000,000 if no value supplied.


For more information on SQLite, see [[Using SQLite]].
For more information on SQLite, see [[Using SQLite]].
Line 19: Line 13:
<pre>
<pre>
Rem SqlOpenDatabase sample
Rem SqlOpenDatabase sample
DB = SqlOpenDatabase("customers.db","1.0","My Customer Database")
DB = SqlOpenDatabase("customers.db")
Print "Database version is " & DB.version</pre>
If DB.version <> "" Then
  Print "Database version is " & DB.version
Else
  print "Database not found."
End If
</pre>


== Output ==
== Output ==

Latest revision as of 14:05, 28 August 2024

SqlOpenDatabase(dbName)

Description

SqlOpenDataBase is used to create and open SQLite databases. It works with both the SQLite WASM library and the Cordova SQLite plugin.

dbName is the name of the database. If dbName does not exist, it is created. The database is created in localStorage by default. If another name is supplied, it is created as that name - but will not persist if the app is restarted.

For more information on SQLite, see Using SQLite.

Example

Rem SqlOpenDatabase sample
DB = SqlOpenDatabase("customers.db")
If DB.version <> "" Then
  Print "Database version is " & DB.version
Else
  print "Database not found."
End If

Output

Database version is 1.0

Related Items

Sql

SQLite Reference

Using SQLite