Skip to content

Commit a054212

Browse files
committed
Moved some functions from sources into headers.
1 parent 0bc1d06 commit a054212

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
@@ -223,11 +223,17 @@ class Statement
223223
/**
224224
* @brief Bind an int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
225225
*/
226-
void bind(const char* apName, const int aValue);
226+
void bind(const char* apName, const int aValue)
227+
{
228+
bind(getIndex(apName), aValue);
229+
}
227230
/**
228231
* @brief Bind a 32bits unsigned int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
229232
*/
230-
void bind(const char* apName, const unsigned aValue);
233+
void bind(const char* apName, const unsigned aValue)
234+
{
235+
bind(getIndex(apName), aValue);
236+
}
231237

232238
#if (LONG_MAX == INT_MAX) // 4 bytes "long" type means the data model is ILP32 or LLP64 (Win64 Visual C++ and MinGW)
233239
/**
@@ -249,57 +255,84 @@ class Statement
249255
/**
250256
* @brief Bind a 64bits int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
251257
*/
252-
void bind(const char* apName, const long long aValue);
258+
void bind(const char* apName, const long long aValue)
259+
{
260+
bind(getIndex(apName), aValue);
261+
}
253262
/**
254263
* @brief Bind a double (64bits float) value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
255264
*/
256-
void bind(const char* apName, const double aValue);
265+
void bind(const char* apName, const double aValue)
266+
{
267+
bind(getIndex(apName), aValue);
268+
}
257269
/**
258270
* @brief Bind a string value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
259271
*
260272
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
261273
*/
262-
void bind(const char* apName, const std::string& aValue);
274+
void bind(const char* apName, const std::string& aValue)
275+
{
276+
bind(getIndex(apName), aValue);
277+
}
263278
/**
264279
* @brief Bind a text value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
265280
*
266281
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
267282
*/
268-
void bind(const char* apName, const char* apValue);
283+
void bind(const char* apName, const char* apValue)
284+
{
285+
bind(getIndex(apName), apValue);
286+
}
269287
/**
270288
* @brief Bind a binary blob value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
271289
*
272290
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
273291
*/
274-
void bind(const char* apName, const void* apValue, const int aSize);
292+
void bind(const char* apName, const void* apValue, const int aSize)
293+
{
294+
bind(getIndex(apName), apValue, aSize);
295+
}
275296
/**
276297
* @brief Bind a string value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
277298
*
278299
* The string can contain null characters as it is binded using its size.
279300
*
280301
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
281302
*/
282-
void bindNoCopy(const char* apName, const std::string& aValue);
303+
void bindNoCopy(const char* apName, const std::string& aValue)
304+
{
305+
bindNoCopy(getIndex(apName), aValue);
306+
}
283307
/**
284308
* @brief Bind a text value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
285309
*
286310
* Main usage is with null-terminated literal text (aka in code static strings)
287311
*
288312
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
289313
*/
290-
void bindNoCopy(const char* apName, const char* apValue);
314+
void bindNoCopy(const char* apName, const char* apValue)
315+
{
316+
bindNoCopy(getIndex(apName), apValue);
317+
}
291318
/**
292319
* @brief Bind a binary blob value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
293320
*
294321
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
295322
*/
296-
void bindNoCopy(const char* apName, const void* apValue, const int aSize);
323+
void bindNoCopy(const char* apName, const void* apValue, const int aSize)
324+
{
325+
bindNoCopy(getIndex(apName), apValue, aSize);
326+
}
297327
/**
298328
* @brief Bind a NULL value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
299329
*
300330
* @see clearBindings() to set all bound parameters to NULL.
301331
*/
302-
void bind(const char* apName); // bind NULL value
332+
void bind(const char* apName) // bind NULL value
333+
{
334+
bind(getIndex(apName));
335+
}
303336

304337

305338
/**

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)