Fix build on Linux, including cpplint warnings.

This commit is contained in:
Douglas Heriot 2016-06-26 01:58:01 +10:00 committed by Sébastien Rombauts
parent a84c04aada
commit 9a07f3918d
4 changed files with 12 additions and 11 deletions

View File

@ -106,7 +106,7 @@ public:
*
*/
std::string getString() const noexcept; // nothrow
/**
* @brief Return the type of the value of the column
*
@ -198,7 +198,7 @@ public:
{
return getBlob();
}
#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
// (error: conversion from SQLite::Column to non-scalar type std::string {aka std::basic_string<char>})
@ -217,7 +217,7 @@ public:
return getString();
}
#endif
// 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
inline operator long() const

View File

@ -13,6 +13,7 @@
#include <sqlite3.h>
#include <string>
#include <map>
#include <stdint.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
*/
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)
*
* @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);
/**
* @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
*/
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)
*
* @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);
/**
* @brief Bind a NULL value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
*/

View File

@ -11,6 +11,7 @@
#include <SQLiteCpp/Column.h>
#include <iostream>
#include <string>
namespace SQLite
@ -81,8 +82,7 @@ std::string Column::getString() const noexcept // nothrow
// 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
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()"
// Note: std::string is ok to pass nullptr as first arg, if length is 0
return std::string(data, sqlite3_column_bytes(mStmtPtr, mIndex));

View File

@ -53,7 +53,7 @@ mColumnNames(std::move(other.mColumnNames)),
mbOk(other.mbOk),
mbDone(other.mbDone)
{
//other.mStmtPtr = nullptr; // doesn't support reassigning
// other.mStmtPtr = nullptr; // doesn't support reassigning
other.mColumnCount = 0;
other.mbOk = 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);
check(ret);
}
// 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)
{