AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <SQLiteStatement.h>
Public Member Functions | |
SQLiteStatement (sqlite3 *dbHandle, const std::string &sqlString) | |
~SQLiteStatement () | |
bool | isValid () |
bool | step () |
bool | reset () |
bool | bindIntParameter (int index, int value) |
bool | bindInt64Parameter (int index, int64_t value) |
bool | bindStringParameter (int index, const std::string &value) |
int | getStepResult () const |
int | getColumnCount () const |
std::string | getColumnName (int index) const |
std::string | getColumnText (int index) const |
int | getColumnInt (int index) const |
int64_t | getColumnInt64 (int index) const |
void | finalize () |
A utility class to simplify interaction with a SQLite statement. In particular, the resource management operations which are common to many functions are captured in this class's constructor and destructor, as well as making the underlying C-style interface more C++ friendly.
The main operations of this class generally map to SQLite operations, so please refer to the online documentation for SQLite for further guidance. This is a good place to begin:
alexaClientSDK::storage::sqliteStorage::SQLiteStatement::SQLiteStatement | ( | sqlite3 * | dbHandle, |
const std::string & | sqlString | ||
) |
Constructor.
dbHandle | A SQLite database handle. |
sqlString | The SQL which this statement object will perform. |
alexaClientSDK::storage::sqliteStorage::SQLiteStatement::~SQLiteStatement | ( | ) |
Destructor.
bool alexaClientSDK::storage::sqliteStorage::SQLiteStatement::bindInt64Parameter | ( | int | index, |
int64_t | value | ||
) |
Binds a 64-bit integer to an index within a query. NOTE: The left-most index for SQLite bind operations begins at 1, not 0.
index | The SQL index (the left-most begins at 1, not 0) the value should be bound to. |
value | The value to be bound. |
bool alexaClientSDK::storage::sqliteStorage::SQLiteStatement::bindIntParameter | ( | int | index, |
int | value | ||
) |
Binds an integer to an index within a query. NOTE: The left-most index for SQLite bind operations begins at 1, not 0.
index | The SQL index (the left-most begins at 1, not 0) the value should be bound to. |
value | The value to be bound. |
bool alexaClientSDK::storage::sqliteStorage::SQLiteStatement::bindStringParameter | ( | int | index, |
const std::string & | value | ||
) |
Binds a string to an index within a query. NOTE: The left-most index for SQLite bind operations begins at 1, not 0.
index | The SQL index (the left-most begins at 1, not 0) the value should be bound to. |
value | The value to be bound. |
void alexaClientSDK::storage::sqliteStorage::SQLiteStatement::finalize | ( | ) |
Releases the SQLite resources.
int alexaClientSDK::storage::sqliteStorage::SQLiteStatement::getColumnCount | ( | ) | const |
Returns the number of columns in the current row being evaluated.
int alexaClientSDK::storage::sqliteStorage::SQLiteStatement::getColumnInt | ( | int | index | ) | const |
Returns the integer value of a particular column in the current row being evaluated. NOTE: The left-most index for SQLite lookup operations begins at 0.
If the function is called with an out-of-bounds index, the result is undefined. If the function is called with a valid index, but a different type than specified in the table schema, then SQLite will perform an implicit conversion as described by its online documentation here:
https://sqlite.org/c3ref/column_blob.html
If sufficient care is taken while using this class, then both errors above can be avoided.
index | The index of the column being queried (left-most column is 0). |
int64_t alexaClientSDK::storage::sqliteStorage::SQLiteStatement::getColumnInt64 | ( | int | index | ) | const |
Returns the 64-bit integer value of a particular column in the current row being evaluated. NOTE: The left-most index for SQLite lookup operations begins at 0.
If the function is called with an out-of-bounds index, the result is undefined. If the function is called with a valid index, but a different type than specified in the table schema, then SQLite will perform an implicit conversion as described by its online documentation here:
https://sqlite.org/c3ref/column_blob.html
If sufficient care is taken while using this class, then both errors above can be avoided.
index | The index of the column being queried (left-most column is 0). |
std::string alexaClientSDK::storage::sqliteStorage::SQLiteStatement::getColumnName | ( | int | index | ) | const |
Returns the name of a particular column in the current row being evaluated.
index | The index of the column being queried. |
std::string alexaClientSDK::storage::sqliteStorage::SQLiteStatement::getColumnText | ( | int | index | ) | const |
Returns the text value of a particular column in the current row being evaluated. NOTE: The left-most index for SQLite lookup operations begins at 0.
If the function is called with an out-of-bounds index, the result is undefined. If the function is called with a valid index, but a different type than specified in the table schema, then SQLite will perform an implicit conversion as described by its online documentation here:
https://sqlite.org/c3ref/column_blob.html
If sufficient care is taken while using this class, then both errors above can be avoided.
index | The index of the column being queried (left-most column is 0). |
int alexaClientSDK::storage::sqliteStorage::SQLiteStatement::getStepResult | ( | ) | const |
Returns the SQLite result for the last step operation performed.
bool alexaClientSDK::storage::sqliteStorage::SQLiteStatement::isValid | ( | ) |
Returns whether the statement has initialized itself correctly.
bool alexaClientSDK::storage::sqliteStorage::SQLiteStatement::reset | ( | ) |
Resets a statement object to be re-executed with different bound parameters.
bool alexaClientSDK::storage::sqliteStorage::SQLiteStatement::step | ( | ) |
Performs an iteration of the SQL query, which evaluates to either a single row of the results, or completes the query.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0