@@ -121,6 +121,8 @@ class Statement
121121 // instead of being copied.
122122 // => if you know what you are doing, use bindNoCopy() instead of bind()
123123
124+ int getIndex (const char * const apName);
125+
124126 /* *
125127 * @brief Bind an int value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
126128 */
@@ -206,11 +208,17 @@ class Statement
206208 /* *
207209 * @brief Bind an int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
208210 */
209- void bind (const char * apName, const int aValue);
211+ void bind (const char * apName, const int aValue)
212+ {
213+ bind (getIndex (apName), aValue);
214+ }
210215 /* *
211216 * @brief Bind a 32bits unsigned int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
212217 */
213- void bind (const char * apName, const unsigned aValue);
218+ void bind (const char * apName, const unsigned aValue)
219+ {
220+ bind (getIndex (apName), aValue);
221+ }
214222
215223#if (LONG_MAX == INT_MAX) // 4 bytes "long" type means the data model is ILP32 or LLP64 (Win64 Visual C++ and MinGW)
216224 /* *
@@ -232,57 +240,84 @@ class Statement
232240 /* *
233241 * @brief Bind a 64bits int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
234242 */
235- void bind (const char * apName, const long long aValue);
243+ void bind (const char * apName, const long long aValue)
244+ {
245+ bind (getIndex (apName), aValue);
246+ }
236247 /* *
237248 * @brief Bind a double (64bits float) value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
238249 */
239- void bind (const char * apName, const double aValue);
250+ void bind (const char * apName, const double aValue)
251+ {
252+ bind (getIndex (apName), aValue);
253+ }
240254 /* *
241255 * @brief Bind a string value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
242256 *
243257 * @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
244258 */
245- void bind (const char * apName, const std::string& aValue);
259+ void bind (const char * apName, const std::string& aValue)
260+ {
261+ bind (getIndex (apName), aValue);
262+ }
246263 /* *
247264 * @brief Bind a text value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
248265 *
249266 * @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
250267 */
251- void bind (const char * apName, const char * apValue);
268+ void bind (const char * apName, const char * apValue)
269+ {
270+ bind (getIndex (apName), apValue);
271+ }
252272 /* *
253273 * @brief Bind a binary blob value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
254274 *
255275 * @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
256276 */
257- void bind (const char * apName, const void * apValue, const int aSize);
277+ void bind (const char * apName, const void * apValue, const int aSize)
278+ {
279+ bind (getIndex (apName), apValue, aSize);
280+ }
258281 /* *
259282 * @brief Bind a string value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
260283 *
261284 * The string can contain null characters as it is binded using its size.
262285 *
263286 * @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
264287 */
265- void bindNoCopy (const char * apName, const std::string& aValue);
288+ void bindNoCopy (const char * apName, const std::string& aValue)
289+ {
290+ bindNoCopy (getIndex (apName), aValue);
291+ }
266292 /* *
267293 * @brief Bind a text value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
268294 *
269295 * Main usage is with null-terminated literal text (aka in code static strings)
270296 *
271297 * @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
272298 */
273- void bindNoCopy (const char * apName, const char * apValue);
299+ void bindNoCopy (const char * apName, const char * apValue)
300+ {
301+ bindNoCopy (getIndex (apName), apValue);
302+ }
274303 /* *
275304 * @brief Bind a binary blob value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
276305 *
277306 * @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
278307 */
279- void bindNoCopy (const char * apName, const void * apValue, const int aSize);
308+ void bindNoCopy (const char * apName, const void * apValue, const int aSize)
309+ {
310+ bindNoCopy (getIndex (apName), apValue, aSize);
311+ }
280312 /* *
281313 * @brief Bind a NULL value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
282314 *
283315 * @see clearBindings() to set all bound parameters to NULL.
284316 */
285- void bind (const char * apName); // bind NULL value
317+ void bind (const char * apName) // bind NULL value
318+ {
319+ bind (getIndex (apName));
320+ }
286321
287322
288323 /* *
0 commit comments