Skip to content

Commit b98eabb

Browse files
committed
Moved some functions from sources into headers.
1 parent 55d3959 commit b98eabb

File tree

2 files changed

+44
-78
lines changed

2 files changed

+44
-78
lines changed

include/SQLiteCpp/Statement.h

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,17 @@ class Statement
203203
/**
204204
* @brief Bind an int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
205205
*/
206-
void bind(const char* apName, const int aValue);
206+
void bind(const char* apName, const int aValue)
207+
{
208+
bind(getIndex(apName), aValue);
209+
}
207210
/**
208211
* @brief Bind a 32bits unsigned int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
209212
*/
210-
void bind(const char* apName, const unsigned aValue);
213+
void bind(const char* apName, const unsigned aValue)
214+
{
215+
bind(getIndex(apName), aValue);
216+
}
211217

212218
#if (LONG_MAX == INT_MAX) // 4 bytes "long" type means the data model is ILP32 or LLP64 (Win64 Visual C++ and MinGW)
213219
/**
@@ -229,57 +235,84 @@ class Statement
229235
/**
230236
* @brief Bind a 64bits int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
231237
*/
232-
void bind(const char* apName, const long long aValue);
238+
void bind(const char* apName, const long long aValue)
239+
{
240+
bind(getIndex(apName), aValue);
241+
}
233242
/**
234243
* @brief Bind a double (64bits float) value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
235244
*/
236-
void bind(const char* apName, const double aValue);
245+
void bind(const char* apName, const double aValue)
246+
{
247+
bind(getIndex(apName), aValue);
248+
}
237249
/**
238250
* @brief Bind a string value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
239251
*
240252
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
241253
*/
242-
void bind(const char* apName, const std::string& aValue);
254+
void bind(const char* apName, const std::string& aValue)
255+
{
256+
bind(getIndex(apName), aValue);
257+
}
243258
/**
244259
* @brief Bind a text value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
245260
*
246261
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
247262
*/
248-
void bind(const char* apName, const char* apValue);
263+
void bind(const char* apName, const char* apValue)
264+
{
265+
bind(getIndex(apName), apValue);
266+
}
249267
/**
250268
* @brief Bind a binary blob value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
251269
*
252270
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
253271
*/
254-
void bind(const char* apName, const void* apValue, const int aSize);
272+
void bind(const char* apName, const void* apValue, const int aSize)
273+
{
274+
bind(getIndex(apName), apValue, aSize);
275+
}
255276
/**
256277
* @brief Bind a string value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
257278
*
258279
* The string can contain null characters as it is binded using its size.
259280
*
260281
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
261282
*/
262-
void bindNoCopy(const char* apName, const std::string& aValue);
283+
void bindNoCopy(const char* apName, const std::string& aValue)
284+
{
285+
bindNoCopy(getIndex(apName), aValue);
286+
}
263287
/**
264288
* @brief Bind a text value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
265289
*
266290
* Main usage is with null-terminated literal text (aka in code static strings)
267291
*
268292
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
269293
*/
270-
void bindNoCopy(const char* apName, const char* apValue);
294+
void bindNoCopy(const char* apName, const char* apValue)
295+
{
296+
bindNoCopy(getIndex(apName), apValue);
297+
}
271298
/**
272299
* @brief Bind a binary blob value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
273300
*
274301
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
275302
*/
276-
void bindNoCopy(const char* apName, const void* apValue, const int aSize);
303+
void bindNoCopy(const char* apName, const void* apValue, const int aSize)
304+
{
305+
bindNoCopy(getIndex(apName), apValue, aSize);
306+
}
277307
/**
278308
* @brief Bind a NULL value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
279309
*
280310
* @see clearBindings() to set all bound parameters to NULL.
281311
*/
282-
void bind(const char* apName); // bind NULL value
312+
void bind(const char* apName) // bind NULL value
313+
{
314+
bind(getIndex(apName));
315+
}
283316

284317

285318
/**

src/Statement.cpp

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -168,73 +168,6 @@ void Statement::bind(const int aIndex)
168168
}
169169

170170

171-
// Bind an int value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
172-
void Statement::bind(const char* apName, const int aValue)
173-
{
174-
bind(getIndex(apName), aValue);
175-
}
176-
177-
// Bind a 32bits unsigned int value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
178-
void Statement::bind(const char* apName, const unsigned aValue)
179-
{
180-
bind(getIndex(apName), aValue);
181-
}
182-
183-
// Bind a 64bits int value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
184-
void Statement::bind(const char* apName, const long long aValue)
185-
{
186-
bind(getIndex(apName), aValue);
187-
}
188-
189-
// Bind a double (64bits float) value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
190-
void Statement::bind(const char* apName, const double aValue)
191-
{
192-
bind(getIndex(apName), aValue);
193-
}
194-
195-
// Bind a string value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
196-
void Statement::bind(const char* apName, const std::string& aValue)
197-
{
198-
bind(getIndex(apName), aValue);
199-
}
200-
201-
// Bind a text value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
202-
void Statement::bind(const char* apName, const char* apValue)
203-
{
204-
bind(getIndex(apName), apValue);
205-
}
206-
207-
// Bind a binary blob value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
208-
void Statement::bind(const char* apName, const void* apValue, const int aSize)
209-
{
210-
bind(getIndex(apName), apValue, aSize);
211-
}
212-
213-
// Bind a string value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
214-
void Statement::bindNoCopy(const char* apName, const std::string& aValue)
215-
{
216-
bindNoCopy(getIndex(apName), aValue);
217-
}
218-
219-
// Bind a text value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
220-
void Statement::bindNoCopy(const char* apName, const char* apValue)
221-
{
222-
bindNoCopy(getIndex(apName), apValue);
223-
}
224-
225-
// Bind a binary blob value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
226-
void Statement::bindNoCopy(const char* apName, const void* apValue, const int aSize)
227-
{
228-
bindNoCopy(getIndex(apName), apValue, aSize);
229-
}
230-
231-
// Bind a NULL value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
232-
void Statement::bind(const char* apName)
233-
{
234-
bind(getIndex(apName));
235-
}
236-
237-
238171
// Execute a step of the query to fetch one row of results
239172
bool Statement::executeStep()
240173
{

0 commit comments

Comments
 (0)