mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-04 17:56:13 -04:00
Fix build on Linux, including cpplint warnings.
This commit is contained in:
parent
a84c04aada
commit
9a07f3918d
@ -106,7 +106,7 @@ public:
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
std::string getString() const noexcept; // nothrow
|
std::string getString() const noexcept; // nothrow
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return the type of the value of the column
|
* @brief Return the type of the value of the column
|
||||||
*
|
*
|
||||||
@ -198,7 +198,7 @@ public:
|
|||||||
{
|
{
|
||||||
return getBlob();
|
return getBlob();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(defined(_MSC_VER) && _MSC_VER < 1900)
|
#if !(defined(_MSC_VER) && _MSC_VER < 1900)
|
||||||
// NOTE : the following is required by GCC and Clang to cast a Column result in a std::string
|
// NOTE : the following is required by GCC and Clang to cast a Column result in a std::string
|
||||||
// (error: conversion from ‘SQLite::Column’ to non-scalar type ‘std::string {aka std::basic_string<char>}’)
|
// (error: conversion from ‘SQLite::Column’ to non-scalar type ‘std::string {aka std::basic_string<char>}’)
|
||||||
@ -217,7 +217,7 @@ public:
|
|||||||
return getString();
|
return getString();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// NOTE : the following is required by GCC and Clang to cast a Column result in a long/int64_t
|
// NOTE : the following is required by GCC and Clang to cast a Column result in a long/int64_t
|
||||||
/// @brief Inline cast operator to long as 64bits integer
|
/// @brief Inline cast operator to long as 64bits integer
|
||||||
inline operator long() const
|
inline operator long() const
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <SQLiteCpp/Exception.h>
|
#include <SQLiteCpp/Exception.h>
|
||||||
|
|
||||||
@ -135,14 +136,14 @@ public:
|
|||||||
* @note This uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
|
* @note This uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
|
||||||
*/
|
*/
|
||||||
void bind(const int aIndex, const std::string& aValue);
|
void bind(const int aIndex, const std::string& aValue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
* @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
*
|
*
|
||||||
* @note This uses the SQLITE_STATIC flag, NOT making a copy of the data. It must exist while executing the statement.
|
* @note This uses the SQLITE_STATIC flag, NOT making a copy of the data. It must exist while executing the statement.
|
||||||
*/
|
*/
|
||||||
void bindNoCopy(const int aIndex, const std::string& aValue);
|
void bindNoCopy(const int aIndex, const std::string& aValue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Bind a text value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
* @brief Bind a text value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
*
|
*
|
||||||
@ -155,14 +156,14 @@ public:
|
|||||||
* @note This uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
|
* @note This uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
|
||||||
*/
|
*/
|
||||||
void bind(const int aIndex, const void* apValue, const int aSize);
|
void bind(const int aIndex, const void* apValue, const int aSize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Bind a binary blob value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
* @brief Bind a binary blob value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
*
|
*
|
||||||
* @note This uses the SQLITE_STATIC flag, NOT making a copy of the data. It must exist while executing the statement.
|
* @note This uses the SQLITE_STATIC flag, NOT making a copy of the data. It must exist while executing the statement.
|
||||||
*/
|
*/
|
||||||
void bindNoCopy(const int aIndex, const void* apValue, const int aSize);
|
void bindNoCopy(const int aIndex, const void* apValue, const int aSize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Bind a NULL value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
* @brief Bind a NULL value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
*/
|
*/
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <SQLiteCpp/Column.h>
|
#include <SQLiteCpp/Column.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
namespace SQLite
|
namespace SQLite
|
||||||
@ -81,8 +82,7 @@ std::string Column::getString() const noexcept // nothrow
|
|||||||
// Note: using sqlite3_column_blob and not sqlite3_column_text
|
// Note: using sqlite3_column_blob and not sqlite3_column_text
|
||||||
// - no need for sqlite3_column_text to add a \0 on the end, as we're getting the bytes length directly
|
// - no need for sqlite3_column_text to add a \0 on the end, as we're getting the bytes length directly
|
||||||
const char *data = static_cast<const char *>(sqlite3_column_blob(mStmtPtr, mIndex));
|
const char *data = static_cast<const char *>(sqlite3_column_blob(mStmtPtr, mIndex));
|
||||||
|
|
||||||
// Note: C++ order of argument evaluation is unspecified, so not calling _blob and _bytes both directly in std::string constructor
|
|
||||||
// SQLite docs: "The safest policy is to invoke… sqlite3_column_blob() followed by sqlite3_column_bytes()"
|
// SQLite docs: "The safest policy is to invoke… sqlite3_column_blob() followed by sqlite3_column_bytes()"
|
||||||
// Note: std::string is ok to pass nullptr as first arg, if length is 0
|
// Note: std::string is ok to pass nullptr as first arg, if length is 0
|
||||||
return std::string(data, sqlite3_column_bytes(mStmtPtr, mIndex));
|
return std::string(data, sqlite3_column_bytes(mStmtPtr, mIndex));
|
||||||
|
@ -53,7 +53,7 @@ mColumnNames(std::move(other.mColumnNames)),
|
|||||||
mbOk(other.mbOk),
|
mbOk(other.mbOk),
|
||||||
mbDone(other.mbDone)
|
mbDone(other.mbDone)
|
||||||
{
|
{
|
||||||
//other.mStmtPtr = nullptr; // doesn't support reassigning
|
// other.mStmtPtr = nullptr; // doesn't support reassigning
|
||||||
other.mColumnCount = 0;
|
other.mColumnCount = 0;
|
||||||
other.mbOk = false;
|
other.mbOk = false;
|
||||||
other.mbDone = false;
|
other.mbDone = false;
|
||||||
@ -117,7 +117,7 @@ void Statement::bind(const int aIndex, const std::string& aValue)
|
|||||||
static_cast<int>(aValue.size()), SQLITE_TRANSIENT);
|
static_cast<int>(aValue.size()), SQLITE_TRANSIENT);
|
||||||
check(ret);
|
check(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
// Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
void Statement::bindNoCopy(const int aIndex, const std::string& aValue)
|
void Statement::bindNoCopy(const int aIndex, const std::string& aValue)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user