mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-04 09:46:02 -04:00
Implemented getDeclaredType with documentation.
This commit is contained in:
parent
01cf6f2d2a
commit
98aff92081
@ -643,6 +643,22 @@ public:
|
||||
*/
|
||||
int getColumnIndex(const char* apName) const;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Return the declared type of the specified result column for a SELECT statement.
|
||||
*
|
||||
* This is the type given at creation of the column and not the actual data type.
|
||||
* SQLite stores data types dynamically for each value and not per column.
|
||||
*
|
||||
* @param[in] aIndex Index of the column in the range [0, getColumnCount()).
|
||||
*
|
||||
* Throw an exception if the specified index is out of the [0, getColumnCount()) range
|
||||
* or if the current statement is not a SELECT statement.
|
||||
*/
|
||||
const char * getDeclaredType(const int aIndex) const;
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Return the UTF-8 SQL Query.
|
||||
|
@ -296,6 +296,20 @@ int Statement::getColumnIndex(const char* apName) const
|
||||
return (*iIndex).second;
|
||||
}
|
||||
|
||||
const char * Statement::getDeclaredType(const int aIndex) const
|
||||
{
|
||||
checkIndex(aIndex);
|
||||
const char * result = sqlite3_column_decltype(mStmtPtr, aIndex);
|
||||
if (!result)
|
||||
{
|
||||
throw SQLite::Exception("Could not determine declared column type.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
int Statement::getBindParameterCount() const noexcept
|
||||
{
|
||||
return sqlite3_bind_parameter_count(mStmtPtr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user