SqlExport: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
No edit summary
Brendon (talk | contribs)
No edit summary
Line 1: Line 1:
SQLEXPORT(''db''[, ''filename''[, ''function'']])
SQLExport(''db''[, ''filename''[, ''function'']])


'''Description'''
== Description ==


The SQLExport function converts an SQLite database to a JSON object. This object can then be sent to another server using AJAX.
The SQLExport function converts an SQLite database to a JSON object. This object can then be sent to another server using AJAX.
Line 11: Line 11:
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.


'''Example'''
== Example ==


<pre>
<pre>
Line 25: Line 25:
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
Line 31: Line 31:
</pre>
</pre>


'''Related Items'''
== Related Items ==


[[sqlimport|SQLIMPORT]]
[[sqlimport|SQLIMPORT]]
[[Category:Language Reference]]

Revision as of 03:27, 17 August 2012

SQLExport(db[, filename[, function]])

Description

The SQLExport function converts 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.

Example

Function btnSQLExport_onclick()
  NSB.ShowProgress("Exporting database...")
  DBjson=SQLExport(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)

Related Items

SQLIMPORT