mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-04 09:46:02 -04:00
Makefile was outdated
- Added Column.o and Transaction.o - Added more gcc warnings in Makefile - Fix for those warnings - Added TODO for improvements
This commit is contained in:
parent
37a760945c
commit
ab55e695af
30
.cproject
30
.cproject
@ -22,7 +22,7 @@
|
||||
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.25715897" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
|
||||
<builder buildPath="${workspace_loc:/SQLiteC++/Debug}" id="cdt.managedbuild.target.gnu.builder.exe.debug.1197823563" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.archiver.base.836634439" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1817615032" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
|
||||
<tool command="g++" id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1817615032" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
|
||||
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.750523151" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.exe.debug.option.debugging.level.1248186067" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1310903331" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
@ -50,6 +50,13 @@
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings">
|
||||
<doc-comment-owner id="org.eclipse.cdt.ui.doxygen">
|
||||
<path value=""/>
|
||||
</doc-comment-owner>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
@ -465,13 +472,6 @@
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings">
|
||||
<doc-comment-owner id="org.eclipse.cdt.ui.doxygen">
|
||||
<path value=""/>
|
||||
</doc-comment-owner>
|
||||
</storageModule>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="cdt.managedbuild.config.gnu.exe.release.326780594">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.326780594" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||
@ -516,6 +516,13 @@
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings">
|
||||
<doc-comment-owner id="org.eclipse.cdt.ui.doxygen">
|
||||
<path value=""/>
|
||||
</doc-comment-owner>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
@ -931,13 +938,6 @@
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings">
|
||||
<doc-comment-owner id="org.eclipse.cdt.ui.doxygen">
|
||||
<path value=""/>
|
||||
</doc-comment-owner>
|
||||
</storageModule>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,4 +5,5 @@ Release
|
||||
*.suo
|
||||
*.user
|
||||
*~
|
||||
doc
|
||||
core
|
||||
|
15
Makefile
15
Makefile
@ -5,7 +5,7 @@
|
||||
CXX = g++
|
||||
|
||||
# flags for C++
|
||||
CXXFLAGS ?= -Wall
|
||||
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
|
||||
|
||||
|
||||
|
@ -76,4 +76,4 @@ std::ostream& operator<<(std::ostream &stream, const Column& column)
|
||||
return stream;
|
||||
}
|
||||
|
||||
}; // namespace SQLite
|
||||
} // namespace SQLite
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -136,4 +136,4 @@ private:
|
||||
};
|
||||
|
||||
|
||||
}; // namespace SQLite
|
||||
} // namespace SQLite
|
||||
|
@ -31,4 +31,4 @@ public:
|
||||
};
|
||||
|
||||
|
||||
}; // namespace SQLite
|
||||
} // namespace SQLite
|
||||
|
@ -184,4 +184,4 @@ private:
|
||||
bool mbDone; //!< True when the last executeStep() had no more row to fetch
|
||||
};
|
||||
|
||||
}; // namespace SQLite
|
||||
} // namespace SQLite
|
||||
|
@ -46,4 +46,4 @@ void Transaction::commit(void) // throw(SQLite::Exception)
|
||||
}
|
||||
|
||||
|
||||
}; // namespace SQLite
|
||||
} // namespace SQLite
|
||||
|
@ -61,4 +61,4 @@ private:
|
||||
};
|
||||
|
||||
|
||||
}; // namespace SQLite
|
||||
} // namespace SQLite
|
||||
|
@ -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();
|
||||
|
1
src/sqlite3/README.txt
Normal file
1
src/sqlite3/README.txt
Normal file
@ -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.
|
Loading…
x
Reference in New Issue
Block a user