AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Namespaces | Classes | Functions
alexaClientSDK::storage::sqliteStorage Namespace Reference

Namespaces

 test
 

Classes

class  SQLiteDatabase
 
class  SQLiteMiscStorage
 
class  SQLiteStatement
 

Functions

sqlite3 * createSQLiteDatabase (const std::string &filePath)
 
sqlite3 * openSQLiteDatabase (const std::string &filePath)
 
bool closeSQLiteDatabase (sqlite3 *dbHandle)
 
bool performQuery (sqlite3 *dbHandle, const std::string &sqlString)
 
bool getNumberTableRows (SQLiteDatabase *db, const std::string &tableName, int *numberRows)
 
bool getTableMaxIntValue (SQLiteDatabase *db, const std::string &tableName, const std::string &columnName, int *maxId)
 
bool tableExists (sqlite3 *dbHandle, const std::string &tableName)
 
bool clearTable (sqlite3 *dbHandle, const std::string &tableName)
 
bool dropTable (sqlite3 *dbHandle, const std::string &tableName)
 

Function Documentation

◆ clearTable()

bool alexaClientSDK::storage::sqliteStorage::clearTable ( sqlite3 *  dbHandle,
const std::string &  tableName 
)

Deletes all records from a table.

Parameters
dbHandleA SQLite handle to an open database.
tableNameThe name of the table from which all rows should be deleted.
Returns
Whether the table was cleared successfully.

◆ closeSQLiteDatabase()

bool alexaClientSDK::storage::sqliteStorage::closeSQLiteDatabase ( sqlite3 *  dbHandle)

Closes a SQLite database.

Parameters
Thehandle to sqlite database.
Returns
Whether the operation was successful.

◆ createSQLiteDatabase()

sqlite3* alexaClientSDK::storage::sqliteStorage::createSQLiteDatabase ( const std::string &  filePath)

Creates a SQLite database at the given filePath. If a file at the given path already exists, this function will fail.

Parameters
filePathThe location where the database should be created.
Returns
A pointer to the created sqlite database. If it could not be created, nullptr is returned.

◆ dropTable()

bool alexaClientSDK::storage::sqliteStorage::dropTable ( sqlite3 *  dbHandle,
const std::string &  tableName 
)

Drops a table from the database. Important note - per SQL mechanics, this single command will erase all records that may be stored in the table being dropped. This action cannot be undone.

Parameters
dbHandleA SQLite handle to an open database.
tableNameThe name of the table to be dropped.
Returns
Whether the table was dropped successfully.

◆ getNumberTableRows()

bool alexaClientSDK::storage::sqliteStorage::getNumberTableRows ( SQLiteDatabase db,
const std::string &  tableName,
int *  numberRows 
)

Acquires the number of rows in a table within an open database.

Parameters
dbA SQLite database object.
tableNameThe name of the table to be queried.
[out]numberRowsWhere the number of rows will be stored on a successful lookup.
Returns
Whether the lookup was successful or not.

◆ getTableMaxIntValue()

bool alexaClientSDK::storage::sqliteStorage::getTableMaxIntValue ( SQLiteDatabase db,
const std::string &  tableName,
const std::string &  columnName,
int *  maxId 
)

Queries a specified column in a SQLite table, and identifies the highest value across all rows. This function requires that the table and column exists, and that the column is of integer type.

Parameters
dbA SQLite database object.
tableNameThe name of the table to be queried.
columnNameThe name of the column in the table to be queried.
[out]maxIdWhere the maximum id will be stored on a successful lookup.
Returns
Whether the lookup was successful or not.

◆ openSQLiteDatabase()

sqlite3* alexaClientSDK::storage::sqliteStorage::openSQLiteDatabase ( const std::string &  filePath)

Opens a SQLite database that will be stored at the given (already existing) filePath. If the database file does not already exist at the given filePath, this function will fail.

Parameters
filePathThe location of the database file to be opened.
Returns
A pointer to the opened sqlite database. If it could not be opened, nullptr is returned.

◆ performQuery()

bool alexaClientSDK::storage::sqliteStorage::performQuery ( sqlite3 *  dbHandle,
const std::string &  sqlString 
)

Performs a SQL query, and does not inspect any result. This is an appropriate function to call for simple queries, which do not require bound parameters, such as when creating tables in a database.

Parameters
dbHandleA SQLite handle to an open database.
sqlStringThe SQL string which contains the full query to be performed.
Returns
Whether the query was successfully performed.

◆ tableExists()

bool alexaClientSDK::storage::sqliteStorage::tableExists ( sqlite3 *  dbHandle,
const std::string &  tableName 
)

Queries if a table exists within a given open database.

Parameters
dbHandleA SQLite handle to an open database.
tableNameThe name of the table to be tested for.
Returns
Whether the table exists.

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0