Moved some functions from sources into headers.

This commit is contained in:
KOLANICH 2019-12-25 17:30:46 +03:00
parent 55d39591ac
commit b98eabbe9f
2 changed files with 44 additions and 78 deletions

View File

@ -203,11 +203,17 @@ public:
/** /**
* @brief Bind an int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1) * @brief Bind an int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
*/ */
void bind(const char* apName, const int aValue); void bind(const char* apName, const int aValue)
{
bind(getIndex(apName), aValue);
}
/** /**
* @brief Bind a 32bits unsigned int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1) * @brief Bind a 32bits unsigned int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
*/ */
void bind(const char* apName, const unsigned aValue); void bind(const char* apName, const unsigned aValue)
{
bind(getIndex(apName), aValue);
}
#if (LONG_MAX == INT_MAX) // 4 bytes "long" type means the data model is ILP32 or LLP64 (Win64 Visual C++ and MinGW) #if (LONG_MAX == INT_MAX) // 4 bytes "long" type means the data model is ILP32 or LLP64 (Win64 Visual C++ and MinGW)
/** /**
@ -229,29 +235,44 @@ public:
/** /**
* @brief Bind a 64bits int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1) * @brief Bind a 64bits int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
*/ */
void bind(const char* apName, const long long aValue); void bind(const char* apName, const long long aValue)
{
bind(getIndex(apName), aValue);
}
/** /**
* @brief Bind a double (64bits float) value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1) * @brief Bind a double (64bits float) value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
*/ */
void bind(const char* apName, const double aValue); void bind(const char* apName, const double aValue)
{
bind(getIndex(apName), aValue);
}
/** /**
* @brief Bind a string value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1) * @brief Bind a string value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
* *
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use * @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
*/ */
void bind(const char* apName, const std::string& aValue); void bind(const char* apName, const std::string& aValue)
{
bind(getIndex(apName), aValue);
}
/** /**
* @brief Bind a text value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1) * @brief Bind a text value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
* *
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use * @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
*/ */
void bind(const char* apName, const char* apValue); void bind(const char* apName, const char* apValue)
{
bind(getIndex(apName), apValue);
}
/** /**
* @brief Bind a binary blob value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1) * @brief Bind a binary blob value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
* *
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use * @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
*/ */
void bind(const char* apName, const void* apValue, const int aSize); void bind(const char* apName, const void* apValue, const int aSize)
{
bind(getIndex(apName), apValue, aSize);
}
/** /**
* @brief Bind a string value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1) * @brief Bind a string value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
* *
@ -259,7 +280,10 @@ public:
* *
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement. * @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
*/ */
void bindNoCopy(const char* apName, const std::string& aValue); void bindNoCopy(const char* apName, const std::string& aValue)
{
bindNoCopy(getIndex(apName), aValue);
}
/** /**
* @brief Bind a text value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1) * @brief Bind a text value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
* *
@ -267,19 +291,28 @@ public:
* *
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement. * @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
*/ */
void bindNoCopy(const char* apName, const char* apValue); void bindNoCopy(const char* apName, const char* apValue)
{
bindNoCopy(getIndex(apName), apValue);
}
/** /**
* @brief Bind a binary blob value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1) * @brief Bind a binary blob value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
* *
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement. * @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
*/ */
void bindNoCopy(const char* apName, const void* apValue, const int aSize); void bindNoCopy(const char* apName, const void* apValue, const int aSize)
{
bindNoCopy(getIndex(apName), apValue, aSize);
}
/** /**
* @brief Bind a NULL value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1) * @brief Bind a NULL value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
* *
* @see clearBindings() to set all bound parameters to NULL. * @see clearBindings() to set all bound parameters to NULL.
*/ */
void bind(const char* apName); // bind NULL value void bind(const char* apName) // bind NULL value
{
bind(getIndex(apName));
}
/** /**

View File

@ -168,73 +168,6 @@ void Statement::bind(const int aIndex)
} }
// Bind an int value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
void Statement::bind(const char* apName, const int aValue)
{
bind(getIndex(apName), aValue);
}
// Bind a 32bits unsigned int value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
void Statement::bind(const char* apName, const unsigned aValue)
{
bind(getIndex(apName), aValue);
}
// Bind a 64bits int value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
void Statement::bind(const char* apName, const long long aValue)
{
bind(getIndex(apName), aValue);
}
// Bind a double (64bits float) value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
void Statement::bind(const char* apName, const double aValue)
{
bind(getIndex(apName), aValue);
}
// Bind a string value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
void Statement::bind(const char* apName, const std::string& aValue)
{
bind(getIndex(apName), aValue);
}
// Bind a text value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
void Statement::bind(const char* apName, const char* apValue)
{
bind(getIndex(apName), apValue);
}
// Bind a binary blob value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
void Statement::bind(const char* apName, const void* apValue, const int aSize)
{
bind(getIndex(apName), apValue, aSize);
}
// Bind a string value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
void Statement::bindNoCopy(const char* apName, const std::string& aValue)
{
bindNoCopy(getIndex(apName), aValue);
}
// Bind a text value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
void Statement::bindNoCopy(const char* apName, const char* apValue)
{
bindNoCopy(getIndex(apName), apValue);
}
// Bind a binary blob value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
void Statement::bindNoCopy(const char* apName, const void* apValue, const int aSize)
{
bindNoCopy(getIndex(apName), apValue, aSize);
}
// Bind a NULL value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
void Statement::bind(const char* apName)
{
bind(getIndex(apName));
}
// Execute a step of the query to fetch one row of results // Execute a step of the query to fetch one row of results
bool Statement::executeStep() bool Statement::executeStep()
{ {