File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -643,6 +643,22 @@ class Statement
643643 */
644644 int getColumnIndex (const char * apName) const ;
645645
646+
647+ /* *
648+ * @brief Return the declared type of the specified result column for a SELECT statement.
649+ *
650+ * This is the type given at creation of the column and not the actual data type.
651+ * SQLite stores data types dynamically for each value and not per column.
652+ *
653+ * @param[in] aIndex Index of the column in the range [0, getColumnCount()).
654+ *
655+ * Throw an exception if the specified index is out of the [0, getColumnCount()) range
656+ * or if the current statement is not a SELECT statement.
657+ */
658+ const char * getDeclaredType (const int aIndex) const ;
659+
660+
661+
646662 // //////////////////////////////////////////////////////////////////////////
647663
648664 // / Return the UTF-8 SQL Query.
Original file line number Diff line number Diff line change @@ -296,6 +296,20 @@ int Statement::getColumnIndex(const char* apName) const
296296 return (*iIndex).second ;
297297}
298298
299+ const char * Statement::getDeclaredType (const int aIndex) const
300+ {
301+ checkIndex (aIndex);
302+ const char * result = sqlite3_column_decltype (mStmtPtr , aIndex);
303+ if (!result)
304+ {
305+ throw SQLite::Exception (" Could not determine declared column type." );
306+ }
307+ else
308+ {
309+ return result;
310+ }
311+ }
312+
299313int Statement::getBindParameterCount () const noexcept
300314{
301315 return sqlite3_bind_parameter_count (mStmtPtr );
You can’t perform that action at this time.
0 commit comments