SqlExport: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(5 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
== Description == | == Description == | ||
The SQLExport function | The SQLExport function returns an SQLite database to a JSON object. This object can then be sent to another server using AJAX. | ||
To include your own ''filename'', include it as the second parameter. If nothing is suppled, ‘default’ will be used. | To include your own ''filename'', include it as the second parameter. If nothing is suppled, ‘default’ will be used. | ||
Line 10: | Line 10: | ||
SQLExport is used by the IDE to convert databases listed in the manifest to JavaScript files which are included in the project. | SQLExport is used by the IDE to convert databases listed in the manifest to JavaScript files which are included in the project. | ||
For more information on SQLite, see [[Using SQLite]]. | |||
== Example == | == Example == | ||
Line 16: | Line 18: | ||
Function btnSQLExport_onclick() | Function btnSQLExport_onclick() | ||
NSB.ShowProgress("Exporting database...") | NSB.ShowProgress("Exporting database...") | ||
DBjson=SQLExport(DB,,exportComplete) | DBjson=SQLExport(DB, "customer.db", exportComplete) | ||
End Function | End Function | ||
Line 36: | Line 38: | ||
[[Category:Language Reference]] | [[Category:Language Reference]] | ||
[[Category:Miscellaneous]] |
Latest revision as of 16:26, 27 February 2017
SQLExport(db[, filename[, function]])
Description
The SQLExport function returns an SQLite database to a JSON object. This object can then be sent to another server using AJAX.
To include your own filename, include it as the second parameter. If nothing is suppled, ‘default’ will be used.
Since it can take some time to do the conversion with large databases, the SQLExport returns immediately and continues to run in the background. When it is complete, function is called in your app.
SQLExport is used by the IDE to convert databases listed in the manifest to JavaScript files which are included in the project.
For more information on SQLite, see Using SQLite.
Example
Function btnSQLExport_onclick() NSB.ShowProgress("Exporting database...") DBjson=SQLExport(DB, "customer.db", exportComplete) End Function Function exportComplete() NSB.ShowProgress(False) MsgBox JSON.stringify(DBjson) End Function
Output
(a MsgBox showing the converted data as a string)