Module LuaSQLiteApplication

The class that's used to interface with SQLite database.

https://www.sqlite.org/about.html This class also holds the reference to the QtLuaHistory object. The database file and the history object must have the same title, if they are belong to each other.

Info:

  • Copyright: Debaru Kft. 2023
  • Release:
  • License: GNU
  • Author: Debaru Kft

Functions

LuaSQLiteApplication () Creates an LuaSQLiteApplication object.
Open () Opens the file specified in "fileName".
Prepare (statementId, sqlStatement) With prepare you can compile an sql statement.
Bind_int (statementId, index, value) Bind an integer value to the specified parameter index in the statement.
Bind_int64 (statementId, index, value) Bind an integer value to the specified parameter index in the statement.
Bind_text (statementId, index, value) Bind a text value to the specified parameter index in the statement.
Reset (statementId) This function is called to reset a prepared statement to it's initial value.
Clear_bindings (statementId) Use this routine to reset all host parameters to NULL.
Step (statementId) After a prepared statement has been prepared, this function must be called one or more times to evaluate the statement.
Column_int (statementId, columnIndex) With this function information can be returned from a single column.
Column_int64 (statementId, columnIndex) With this function information can be returned from a single column.
Column_text (statementId, columnIndex) With this function information can be returned from a single column.
Finalize (statementId) The finalize() function is called to delete a prepared statement.
Close () The close() routines are destructors for the sqlite object.
saveTimestamp () Saves the actual timestamp into two variables.
getTimeSec () After using saveTimestamp() this function can return the seconds.
getTimeUsec () After using saveTimestamp() this function can return the useconds.
clearHistory () Make empty the QtLuaHistory's list, so no records will be shown.
insertRowHistory (name, value, timestampSec, timestampUsec, unit, eventType) Add a row to QtLuaHistory object.

Fields

fileName Name of the database file on the filesystem.
title Title is the string id associated with the SQLite instance.
refresh This variable is used for trigger a refresh in the model.


Functions

LuaSQLiteApplication ()
Creates an LuaSQLiteApplication object.
Open ()
Opens the file specified in "fileName". With create and read, write permissions. If the database is opened (and/or created) successfully, then SQLITE_OK is returned. Otherwise an error code is returned. https://www.sqlite.org/c3ref/open.html

Returns:

    int
Prepare (statementId, sqlStatement)
With prepare you can compile an sql statement. On success, the prepare() family of routines return SQLITE_OK. Otherwise an error code is returned. https://www.sqlite.org/c3ref/prepare.html Every statement has to be associated with a unique id. Later with this id can the user reference the statement. (Use id for example with bind.)

Parameters:

Returns:

    int
Bind_int (statementId, index, value)
Bind an integer value to the specified parameter index in the statement. The bind_* routines return SQLITE_OK on success or an error code if anything goes wrong. https://www.sqlite.org/c3ref/bind_blob.html

Parameters:

Returns:

    int
Bind_int64 (statementId, index, value)
Bind an integer value to the specified parameter index in the statement. The bind_* routines return SQLITE_OK on success or an error code if anything goes wrong. https://www.sqlite.org/c3ref/bind_blob.html

Parameters:

Returns:

    int
Bind_text (statementId, index, value)
Bind a text value to the specified parameter index in the statement. The bind_* routines return SQLITE_OK on success or an error code if anything goes wrong. https://www.sqlite.org/c3ref/bind_blob.html

Parameters:

Returns:

    int
Reset (statementId)
This function is called to reset a prepared statement to it's initial value. The bound values will NOT reset. To reset, use clear_bindings(). For return value visit this link: https://www.sqlite.org/c3ref/reset.html

Parameters:

  • statementId int

Returns:

    int
Clear_bindings (statementId)
Use this routine to reset all host parameters to NULL. https://www.sqlite.org/c3ref/clear_bindings.html

Parameters:

  • statementId int

Returns:

    int
Step (statementId)
After a prepared statement has been prepared, this function must be called one or more times to evaluate the statement. SQLITE_DONE means that the statement has finished executing successfully. For more info visit: https://www.sqlite.org/c3ref/step.html

Parameters:

  • statementId int

Returns:

    int
Column_int (statementId, columnIndex)
With this function information can be returned from a single column. The second argument is the index of the column for which information should be returned. The leftmost column of the result set has the index 0. For more info visit: https://www.sqlite.org/c3ref/column_blob.html

Parameters:

  • statementId int
  • columnIndex int

Returns:

    int
Column_int64 (statementId, columnIndex)
With this function information can be returned from a single column. The second argument is the index of the column for which information should be returned. The leftmost column of the result set has the index 0. For more info visit: https://www.sqlite.org/c3ref/column_blob.html

Parameters:

  • statementId int
  • columnIndex int

Returns:

    int
Column_text (statementId, columnIndex)
With this function information can be returned from a single column. The second argument is the index of the column for which information should be returned. The leftmost column of the result set has the index 0. For more info visit: https://www.sqlite.org/c3ref/column_blob.html

Parameters:

  • statementId int
  • columnIndex int

Returns:

    string
Finalize (statementId)
The finalize() function is called to delete a prepared statement. If the most recent evaluation of the statement encountered no errors or if the statement is never been evaluated, then finalize() returns SQLITE_OK. If the most recent evaluation of statement S failed, then finalize(S) returns the appropriate error code or extended error code. For more info visit: https://www.sqlite.org/c3ref/finalize.html

Parameters:

  • statementId int

Returns:

    int
Close ()
The close() routines are destructors for the sqlite object. Calls to close() return SQLITE_OK if the sqlite object is successfully destroyed and all associated resources are deallocated. For more info visit: https://www.sqlite.org/c3ref/close.html

Returns:

    int
saveTimestamp ()
Saves the actual timestamp into two variables. Seconds and uSeconds. Use: getTimeSec() and getTimeUsec() functions.
getTimeSec ()
After using saveTimestamp() this function can return the seconds.

Returns:

    long
getTimeUsec ()
After using saveTimestamp() this function can return the useconds.

Returns:

    long
clearHistory ()
Make empty the QtLuaHistory's list, so no records will be shown.
insertRowHistory (name, value, timestampSec, timestampUsec, unit, eventType)
Add a row to QtLuaHistory object.

Parameters:

Fields

fileName
Name of the database file on the filesystem.
  • type string (default: "sqlite/history.db")
title
Title is the string id associated with the SQLite instance. This should match with the "name" field of the QtLuaHistory object.
  • type string (default: "History_events")
refresh
This variable is used for trigger a refresh in the model. When refresh is asked from the QtLuaHistory object, this variable will be set. Later the lua code will set it to false.
  • type bool (default: FALSE))
generated by LDoc 1.4.6 Last updated 2023-09-25 09:31:08