@@ -26,7 +26,7 @@ const int Null = SQLITE_NULL;
26
26
27
27
28
28
// Encapsulation of a Column in a row of the result pointed by the prepared Statement.
29
- Column::Column (Statement::Ptr & aStmtPtr, int aIndex) noexcept :
29
+ Column::Column (Statement::TStatementPtr & aStmtPtr, int aIndex) noexcept :
30
30
mStmtPtr (aStmtPtr),
31
31
mIndex (aIndex)
32
32
{
@@ -35,21 +35,21 @@ Column::Column(Statement::Ptr& aStmtPtr, int aIndex) noexcept :
35
35
// Return the named assigned to this result column (potentially aliased)
36
36
const char * Column::getName () const noexcept
37
37
{
38
- return sqlite3_column_name (mStmtPtr , mIndex );
38
+ return sqlite3_column_name (mStmtPtr . get () , mIndex );
39
39
}
40
40
41
41
#ifdef SQLITE_ENABLE_COLUMN_METADATA
42
42
// Return the name of the table column that is the origin of this result column
43
43
const char * Column::getOriginName () const noexcept
44
44
{
45
- return sqlite3_column_origin_name (mStmtPtr , mIndex );
45
+ return sqlite3_column_origin_name (mStmtPtr . get () , mIndex );
46
46
}
47
47
#endif
48
48
49
49
// Return the integer value of the column specified by its index starting at 0
50
50
int Column::getInt () const noexcept
51
51
{
52
- return sqlite3_column_int (mStmtPtr , mIndex );
52
+ return sqlite3_column_int (mStmtPtr . get () , mIndex );
53
53
}
54
54
55
55
// Return the unsigned integer value of the column specified by its index starting at 0
@@ -61,50 +61,50 @@ unsigned Column::getUInt() const noexcept
61
61
// Return the 64bits integer value of the column specified by its index starting at 0
62
62
long long Column::getInt64 () const noexcept
63
63
{
64
- return sqlite3_column_int64 (mStmtPtr , mIndex );
64
+ return sqlite3_column_int64 (mStmtPtr . get () , mIndex );
65
65
}
66
66
67
67
// Return the double value of the column specified by its index starting at 0
68
68
double Column::getDouble () const noexcept
69
69
{
70
- return sqlite3_column_double (mStmtPtr , mIndex );
70
+ return sqlite3_column_double (mStmtPtr . get () , mIndex );
71
71
}
72
72
73
73
// Return a pointer to the text value (NULL terminated string) of the column specified by its index starting at 0
74
74
const char * Column::getText (const char * apDefaultValue /* = "" */ ) const noexcept
75
75
{
76
- const char * pText = reinterpret_cast <const char *>(sqlite3_column_text (mStmtPtr , mIndex ));
76
+ const char * pText = reinterpret_cast <const char *>(sqlite3_column_text (mStmtPtr . get () , mIndex ));
77
77
return (pText?pText:apDefaultValue);
78
78
}
79
79
80
80
// Return a pointer to the blob value (*not* NULL terminated) of the column specified by its index starting at 0
81
81
const void * Column::getBlob () const noexcept
82
82
{
83
- return sqlite3_column_blob (mStmtPtr , mIndex );
83
+ return sqlite3_column_blob (mStmtPtr . get () , mIndex );
84
84
}
85
85
86
86
// Return a std::string to a TEXT or BLOB column
87
87
std::string Column::getString () const
88
88
{
89
89
// Note: using sqlite3_column_blob and not sqlite3_column_text
90
90
// - no need for sqlite3_column_text to add a \0 on the end, as we're getting the bytes length directly
91
- const char *data = static_cast <const char *>(sqlite3_column_blob (mStmtPtr , mIndex ));
91
+ const char *data = static_cast <const char *>(sqlite3_column_blob (mStmtPtr . get () , mIndex ));
92
92
93
93
// SQLite docs: "The safest policy is to invoke… sqlite3_column_blob() followed by sqlite3_column_bytes()"
94
94
// Note: std::string is ok to pass nullptr as first arg, if length is 0
95
- return std::string (data, sqlite3_column_bytes (mStmtPtr , mIndex ));
95
+ return std::string (data, sqlite3_column_bytes (mStmtPtr . get () , mIndex ));
96
96
}
97
97
98
98
// Return the type of the value of the column
99
99
int Column::getType () const noexcept
100
100
{
101
- return sqlite3_column_type (mStmtPtr , mIndex );
101
+ return sqlite3_column_type (mStmtPtr . get () , mIndex );
102
102
}
103
103
104
104
// Return the number of bytes used by the text value of the column
105
105
int Column::getBytes () const noexcept
106
106
{
107
- return sqlite3_column_bytes (mStmtPtr , mIndex );
107
+ return sqlite3_column_bytes (mStmtPtr . get () , mIndex );
108
108
}
109
109
110
110
// Standard std::ostream inserter
0 commit comments