diff --git a/.cproject b/.cproject
index 128c991..1357d3b 100644
--- a/.cproject
+++ b/.cproject
@@ -22,7 +22,7 @@
-
+
@@ -50,6 +50,13 @@
+
+
+
+
+
+
+
@@ -465,13 +472,6 @@
-
-
-
-
-
-
-
@@ -516,6 +516,13 @@
+
+
+
+
+
+
+
@@ -931,13 +938,6 @@
-
-
-
-
-
-
-
diff --git a/.gitignore b/.gitignore
index 34e183d..2aa9e4d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,5 @@ Release
*.suo
*.user
*~
+doc
core
diff --git a/Makefile b/Makefile
index bbe6bef..c5cf81a 100644
--- a/Makefile
+++ b/Makefile
@@ -4,8 +4,8 @@
# C++ compiler
CXX = g++
-# flags for C++
-CXXFLAGS ?= -Wall
+# flags for C++
+CXXFLAGS ?= -Wall -Wextra -pedantic -Wformat-security -Winit-self -Wswitch-default -Wswitch-enum -Wfloat-equal -Wundef -Wshadow -Wcast-qual -Wconversion -Wlogical-op -Winline -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn
# [Debug,Release]
BUILD ?= Debug
@@ -13,13 +13,13 @@ BUILD ?= Debug
### Conditionally set variables: ###
ifeq ($(BUILD),Debug)
-BUILD_FLAGS = -g -rdynamic -fno-inline -O0 -DDEBUG -D_DEBUG
+BUILD_FLAGS = -g3 -rdynamic -fstack-protector-all -fno-inline -O0 -DDEBUG -D_DEBUG
endif
ifeq ($(BUILD),Release)
BUILD_FLAGS = -O2
endif
ifeq ($(BUILD),Debug)
-LINK_FLAGS = -g -rdynamic
+LINK_FLAGS = -g3 -rdynamic
endif
ifeq ($(BUILD),Release)
LINK_FLAGS =
@@ -32,8 +32,10 @@ CPPDEPS = -MT $@ -MF`echo $@ | sed -e 's,\.o$$,.d,'` -MD -MP
SQLITE_CXXFLAGS = $(BUILD_FLAGS) $(CXXFLAGS)
SQLITE_EXAMPLE1_OBJECTS = \
$(BUILD)/main.o \
+ $(BUILD)/Column.o \
$(BUILD)/Database.o \
$(BUILD)/Statement.o \
+ $(BUILD)/Transaction.o \
### Targets: ###
@@ -55,12 +57,18 @@ $(BUILD)/example1: $(SQLITE_EXAMPLE1_OBJECTS)
$(BUILD)/main.o: src/example1/main.cpp
$(CXX) -c -o $@ $(SQLITE_CXXFLAGS) $(CPPDEPS) $<
+$(BUILD)/Column.o: src/SQLiteC++/Column.cpp
+ $(CXX) -c -o $@ $(SQLITE_CXXFLAGS) $(CPPDEPS) $<
+
$(BUILD)/Database.o: src/SQLiteC++/Database.cpp
$(CXX) -c -o $@ $(SQLITE_CXXFLAGS) $(CPPDEPS) $<
$(BUILD)/Statement.o: src/SQLiteC++/Statement.cpp
$(CXX) -c -o $@ $(SQLITE_CXXFLAGS) $(CPPDEPS) $<
+$(BUILD)/Transaction.o: src/SQLiteC++/Transaction.cpp
+ $(CXX) -c -o $@ $(SQLITE_CXXFLAGS) $(CPPDEPS) $<
+
.PHONY: all clean
@@ -68,3 +76,4 @@ $(BUILD)/Statement.o: src/SQLiteC++/Statement.cpp
# Dependencies tracking:
-include $(BUILD)/*.d
+
diff --git a/src/SQLiteC++/Column.cpp b/src/SQLiteC++/Column.cpp
index 281fa1a..acf72b6 100644
--- a/src/SQLiteC++/Column.cpp
+++ b/src/SQLiteC++/Column.cpp
@@ -76,4 +76,4 @@ std::ostream& operator<<(std::ostream &stream, const Column& column)
return stream;
}
-}; // namespace SQLite
+} // namespace SQLite
diff --git a/src/SQLiteC++/Column.h b/src/SQLiteC++/Column.h
index e1432f1..e4aa8b3 100644
--- a/src/SQLiteC++/Column.h
+++ b/src/SQLiteC++/Column.h
@@ -43,17 +43,17 @@ public:
const char* getText (void) const throw();
/// Inline cast operator to int
- inline operator const int() const
+ inline operator int() const
{
return getInt();
}
/// Inline cast operator to 64bits integer
- inline operator const sqlite3_int64() const
+ inline operator sqlite3_int64() const
{
return getInt64();
}
/// Inline cast operator to double
- inline operator const double() const
+ inline operator double() const
{
return getDouble();
}
@@ -71,6 +71,7 @@ public:
private:
// Column is copyable, but copy should not be used elsewhere than in return form getColumn
Column(void);
+ // TODO Column(const Column&);
Column& operator=(const Column&);
private:
@@ -83,4 +84,4 @@ private:
/// Standard std::ostream inserter
std::ostream& operator<<(std::ostream &stream, const Column& column);
-}; // namespace SQLite
+} // namespace SQLite
diff --git a/src/SQLiteC++/Database.cpp b/src/SQLiteC++/Database.cpp
index f4402cc..bdcd4a9 100644
--- a/src/SQLiteC++/Database.cpp
+++ b/src/SQLiteC++/Database.cpp
@@ -19,6 +19,7 @@ Database::Database(const char* apFilename, const int aFlags /*= SQLITE_OPEN_READ
mpSQLite(NULL),
mFilename(apFilename)
{
+ // TODO SRombauts : add a :memory: mode, and a backup to/from :memory:
int ret = sqlite3_open_v2(apFilename, &mpSQLite, aFlags, NULL);
if (SQLITE_OK != ret)
{
diff --git a/src/SQLiteC++/Database.h b/src/SQLiteC++/Database.h
index 930951b..27b8e79 100644
--- a/src/SQLiteC++/Database.h
+++ b/src/SQLiteC++/Database.h
@@ -136,4 +136,4 @@ private:
};
-}; // namespace SQLite
+} // namespace SQLite
diff --git a/src/SQLiteC++/Exception.h b/src/SQLiteC++/Exception.h
index 91462fe..9751b66 100644
--- a/src/SQLiteC++/Exception.h
+++ b/src/SQLiteC++/Exception.h
@@ -12,7 +12,7 @@
#include
#ifdef _WIN32
-#pragma warning(disable:4290) // Disable warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
+#pragma warning(disable:4290) // Disable warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
namespace SQLite
@@ -31,4 +31,4 @@ public:
};
-}; // namespace SQLite
+} // namespace SQLite
diff --git a/src/SQLiteC++/Statement.h b/src/SQLiteC++/Statement.h
index 32eb9f0..780bd46 100644
--- a/src/SQLiteC++/Statement.h
+++ b/src/SQLiteC++/Statement.h
@@ -184,4 +184,4 @@ private:
bool mbDone; //!< True when the last executeStep() had no more row to fetch
};
-}; // namespace SQLite
+} // namespace SQLite
diff --git a/src/SQLiteC++/Transaction.cpp b/src/SQLiteC++/Transaction.cpp
index b996992..e31cb7d 100644
--- a/src/SQLiteC++/Transaction.cpp
+++ b/src/SQLiteC++/Transaction.cpp
@@ -46,4 +46,4 @@ void Transaction::commit(void) // throw(SQLite::Exception)
}
-}; // namespace SQLite
+} // namespace SQLite
diff --git a/src/SQLiteC++/Transaction.h b/src/SQLiteC++/Transaction.h
index 1e75e94..d740ebe 100644
--- a/src/SQLiteC++/Transaction.h
+++ b/src/SQLiteC++/Transaction.h
@@ -61,4 +61,4 @@ private:
};
-}; // namespace SQLite
+} // namespace SQLite
diff --git a/src/example1/main.cpp b/src/example1/main.cpp
index ce773bf..888bafb 100644
--- a/src/example1/main.cpp
+++ b/src/example1/main.cpp
@@ -85,10 +85,10 @@ int main (void)
// Demonstrate how to get some typed column value
int id = query.getColumn(0); // = query.getColumn(0).getInt()
//const char* pvalue = query.getColumn(1); // = query.getColumn(1).getText()
- std::string value = query.getColumn(1); // = query.getColumn(1).getText()
+ std::string value2 = query.getColumn(1); // = query.getColumn(1).getText()
int size = query.getColumn(2); // = query.getColumn(2).getInt()
- std::cout << "row : (" << id << ", " << value.c_str() << ", " << size << ")\n";
+ std::cout << "row : (" << id << ", " << value2.c_str() << ", " << size << ")\n";
}
// Reset the query to use it again
@@ -204,8 +204,8 @@ int main (void)
int nb = db.exec("INSERT INTO test VALUES (NULL, \"second\")");
std::cout << "INSERT INTO test VALUES (NULL, \"second\")\", returned " << nb << std::endl;
- nb = db.exec("INSERT INTO test \"error\"");
- std::cout << "INSERT INTO test \"error\"\", returned " << nb << std::endl;
+ nb = db.exec("INSERT INTO test ObviousError");
+ std::cout << "INSERT INTO test \"error\", returned " << nb << std::endl;
// Commit transaction
transaction.commit();
diff --git a/src/sqlite3/README.txt b/src/sqlite3/README.txt
new file mode 100644
index 0000000..a516dcc
--- /dev/null
+++ b/src/sqlite3/README.txt
@@ -0,0 +1 @@
+sqlite3.c and sqlite3.h are not used by the default Linux Makefile (which thus requires the Linux libsqlite3-dev package) but is used by the Visual Studio solution.