Added sqlite
This commit is contained in:
538
3rd-party/SRombauts-SQLiteCpp-f69986a/.cproject
vendored
Normal file
538
3rd-party/SRombauts-SQLiteCpp-f69986a/.cproject
vendored
Normal file
@@ -0,0 +1,538 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||||
|
<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.1034724773">
|
||||||
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.1034724773" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||||
|
<externalSettings/>
|
||||||
|
<extensions>
|
||||||
|
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
</extensions>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.1034724773" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug">
|
||||||
|
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1034724773." name="/" resourcePath="">
|
||||||
|
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.898681687" name="Linux GCC" nonInternalBuilderId="cdt.managedbuild.target.gnu.builder.exe.debug" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
|
||||||
|
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.25715897" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
|
||||||
|
<builder buildPath="${ProjDirPath}/build" id="cdt.managedbuild.target.gnu.builder.exe.debug.1103730408" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" 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 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"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.796464367" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
|
||||||
|
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.1202477623" name="Optimization Level" superClass="gnu.c.compiler.exe.debug.option.optimization.level" valueType="enumerated"/>
|
||||||
|
<option id="gnu.c.compiler.exe.debug.option.debugging.level.280470620" name="Debug Level" superClass="gnu.c.compiler.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1655653012" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1058275134" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.1061662206" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
|
||||||
|
<option id="gnu.cpp.link.option.libs.1966761747" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
|
||||||
|
<listOptionValue builtIn="false" value="pthread"/>
|
||||||
|
<listOptionValue builtIn="false" value="dl"/>
|
||||||
|
</option>
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1636986986" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
||||||
|
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||||
|
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||||
|
</inputType>
|
||||||
|
</tool>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.258570404" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1571334436" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</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>
|
||||||
|
</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">
|
||||||
|
<externalSettings/>
|
||||||
|
<extensions>
|
||||||
|
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
</extensions>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.326780594" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
|
||||||
|
<folderInfo id="cdt.managedbuild.config.gnu.exe.release.326780594." name="/" resourcePath="">
|
||||||
|
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1521127462" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
|
||||||
|
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.1294814790" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/>
|
||||||
|
<builder arguments="BUILD=Release" buildPath="${ProjDirPath}" command="make" id="cdt.managedbuild.target.gnu.builder.exe.release.1733496537" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.archiver.base.446006787" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.2105828055" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
|
||||||
|
<option id="gnu.cpp.compiler.exe.release.option.optimization.level.1921346334" name="Optimization Level" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
|
||||||
|
<option id="gnu.cpp.compiler.exe.release.option.debugging.level.1660521780" name="Debug Level" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1064866729" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1329805514" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release">
|
||||||
|
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.2130170048" name="Optimization Level" superClass="gnu.c.compiler.exe.release.option.optimization.level" valueType="enumerated"/>
|
||||||
|
<option id="gnu.c.compiler.exe.release.option.debugging.level.1028604453" name="Debug Level" superClass="gnu.c.compiler.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1173224902" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.1484631410" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1493084285" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release">
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1398815353" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
||||||
|
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||||
|
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||||
|
</inputType>
|
||||||
|
</tool>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.1362356526" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release">
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.831278578" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</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>
|
||||||
|
</cconfiguration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<project id="SQLiteC++.cdt.managedbuild.target.gnu.exe.2007535171" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||||
|
<configuration configurationName="Release">
|
||||||
|
<resource resourceType="PROJECT" workspacePath="/SQLiteCpp"/>
|
||||||
|
</configuration>
|
||||||
|
<configuration configurationName="Debug">
|
||||||
|
<resource resourceType="PROJECT" workspacePath="/SQLiteCpp"/>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="scannerConfiguration">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="makefileGenerator">
|
||||||
|
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.326780594;cdt.managedbuild.config.gnu.exe.release.326780594.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1329805514;cdt.managedbuild.tool.gnu.c.compiler.input.1173224902">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
||||||
|
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="makefileGenerator">
|
||||||
|
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1034724773;cdt.managedbuild.config.gnu.exe.debug.1034724773.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1817615032;cdt.managedbuild.tool.gnu.cpp.compiler.input.1310903331">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
|
||||||
|
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="makefileGenerator">
|
||||||
|
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.326780594;cdt.managedbuild.config.gnu.exe.release.326780594.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.2105828055;cdt.managedbuild.tool.gnu.cpp.compiler.input.1064866729">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
|
||||||
|
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="makefileGenerator">
|
||||||
|
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1034724773;cdt.managedbuild.config.gnu.exe.debug.1034724773.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.796464367;cdt.managedbuild.tool.gnu.c.compiler.input.1655653012">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
||||||
|
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="makefileGenerator">
|
||||||
|
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||||
|
</cproject>
|
29
3rd-party/SRombauts-SQLiteCpp-f69986a/.gitignore
vendored
Normal file
29
3rd-party/SRombauts-SQLiteCpp-f69986a/.gitignore
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
Debug
|
||||||
|
Release
|
||||||
|
build
|
||||||
|
example1
|
||||||
|
*.a
|
||||||
|
|
||||||
|
/SQLiteCpp.sln
|
||||||
|
*.ncb
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*sdf
|
||||||
|
*.vc*
|
||||||
|
*~
|
||||||
|
doc
|
||||||
|
core
|
||||||
|
*ipch
|
||||||
|
.settings/
|
||||||
|
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles
|
||||||
|
*.cmake
|
||||||
|
*.dir
|
||||||
|
Testing
|
||||||
|
Win32
|
||||||
|
|
||||||
|
SQLiteCpp_example1
|
||||||
|
SQLiteCpp_tests
|
||||||
|
|
||||||
|
!FindSQLiteCpp.cmake
|
3
3rd-party/SRombauts-SQLiteCpp-f69986a/.gitmodules
vendored
Normal file
3
3rd-party/SRombauts-SQLiteCpp-f69986a/.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "googletest"]
|
||||||
|
path = googletest
|
||||||
|
url = https://github.com/google/googletest.git
|
85
3rd-party/SRombauts-SQLiteCpp-f69986a/.project
vendored
Normal file
85
3rd-party/SRombauts-SQLiteCpp-f69986a/.project
vendored
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>SQLiteC++</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.python.pydev.PyDevBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||||
|
<triggers>clean,full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
<dictionary>
|
||||||
|
<key>?name?</key>
|
||||||
|
<value></value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.append_environment</key>
|
||||||
|
<value>true</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
|
||||||
|
<value>all</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
||||||
|
<value>-j</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
||||||
|
<value>make</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
||||||
|
<value>clean</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.contents</key>
|
||||||
|
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
||||||
|
<value>false</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
||||||
|
<value>true</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
||||||
|
<value>true</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
|
||||||
|
<value>all</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
||||||
|
<value>true</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
||||||
|
<value>true</value>
|
||||||
|
</dictionary>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||||
|
<triggers>full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||||
|
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||||
|
<nature>org.python.pydev.pythonNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
163
3rd-party/SRombauts-SQLiteCpp-f69986a/.travis.yml
vendored
Normal file
163
3rd-party/SRombauts-SQLiteCpp-f69986a/.travis.yml
vendored
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
# Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
|
||||||
|
# request for Ubuntu 14.04 Trusty VM
|
||||||
|
sudo: true
|
||||||
|
dist: trusty
|
||||||
|
|
||||||
|
cache:
|
||||||
|
apt: true
|
||||||
|
|
||||||
|
# NOTE: no language, so that we can set CXX and CC env vars as required
|
||||||
|
#language: cpp
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
# gcc default
|
||||||
|
- compiler: gcc
|
||||||
|
env:
|
||||||
|
- CC=gcc
|
||||||
|
- CXX=g++
|
||||||
|
# gcc 4.9 std=default
|
||||||
|
- compiler: gcc
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
packages:
|
||||||
|
- g++-4.9
|
||||||
|
env:
|
||||||
|
- CC=gcc-4.9
|
||||||
|
- CXX=g++-4.9
|
||||||
|
# gcc 5 std=c++03
|
||||||
|
- compiler: gcc
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
packages:
|
||||||
|
- g++-5
|
||||||
|
env:
|
||||||
|
- CC=gcc-5
|
||||||
|
- CXX=g++-5
|
||||||
|
- CXXFLAGS="-std=c++03"
|
||||||
|
# gcc 5 std=c++11
|
||||||
|
- compiler: gcc
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
packages:
|
||||||
|
- g++-5
|
||||||
|
env:
|
||||||
|
- CC=gcc-5
|
||||||
|
- CXX=g++-5
|
||||||
|
- CXXFLAGS="-std=c++11"
|
||||||
|
# gcc 5 std=c++14
|
||||||
|
- compiler: gcc
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
packages:
|
||||||
|
- g++-5
|
||||||
|
env:
|
||||||
|
- CC=gcc-5
|
||||||
|
- CXX=g++-5
|
||||||
|
- CXXFLAGS="-std=c++14"
|
||||||
|
# gcc 5 std=c++1z
|
||||||
|
- compiler: gcc
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
packages:
|
||||||
|
- g++-5
|
||||||
|
env:
|
||||||
|
- CC=gcc-5
|
||||||
|
- CXX=g++-5
|
||||||
|
- CXXFLAGS="-std=c++1z"
|
||||||
|
# gcc 6 std=c++14
|
||||||
|
- compiler: gcc
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
packages:
|
||||||
|
- g++-6
|
||||||
|
env:
|
||||||
|
- CXX=g++-6
|
||||||
|
- CXXFLAGS="-std=c++14"
|
||||||
|
# gcc 6 std=c++1z
|
||||||
|
- compiler: gcc
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
packages:
|
||||||
|
- g++-6
|
||||||
|
env:
|
||||||
|
- CC=gcc-6
|
||||||
|
- CXX=g++-6
|
||||||
|
- CXXFLAGS="-std=c++1z"
|
||||||
|
# gcc 6 std=c++14 all warnings, pedantic
|
||||||
|
- compiler: gcc
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
packages:
|
||||||
|
- g++-6
|
||||||
|
env:
|
||||||
|
- CC=gcc-6
|
||||||
|
- CXX=g++-6
|
||||||
|
- CXXFLAGS="-std=c++14 -Wall -Wextra -pedantic"
|
||||||
|
# clang default
|
||||||
|
- compiler: clang
|
||||||
|
env:
|
||||||
|
- CC=clang
|
||||||
|
- CXX=clang++
|
||||||
|
# clang 3.8
|
||||||
|
- compiler: clang
|
||||||
|
os: linux
|
||||||
|
env:
|
||||||
|
- CC=clang
|
||||||
|
- CXX=clang++
|
||||||
|
- LLVM_VERSION=3.8.0
|
||||||
|
- LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz
|
||||||
|
- CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1"
|
||||||
|
- CXXFLAGS=-lc++
|
||||||
|
- PATH=$HOME/clang-$LLVM_VERSION/bin:$PATH
|
||||||
|
- LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH
|
||||||
|
before_install:
|
||||||
|
- wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH
|
||||||
|
- mkdir $HOME/clang-$LLVM_VERSION
|
||||||
|
- tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1
|
||||||
|
# os x
|
||||||
|
- compiler: clang
|
||||||
|
os: osx
|
||||||
|
osx_image: xcode8
|
||||||
|
#install:
|
||||||
|
# - brew install cmake
|
||||||
|
env:
|
||||||
|
- CC=clang
|
||||||
|
- CXX=clang
|
||||||
|
- CXXFLAGS=-lstdc++
|
||||||
|
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- if [[ "$CXX" == "g++" ]]; then pip install --user cpp-coveralls ; fi
|
||||||
|
|
||||||
|
# scripts to run before build
|
||||||
|
before_script:
|
||||||
|
- mkdir build
|
||||||
|
- cd build
|
||||||
|
- cmake -DCMAKE_BUILD_TYPE=Debug -DSQLITECPP_USE_GCOV=ON -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON ..
|
||||||
|
|
||||||
|
# build examples, and run tests (ie make & make test)
|
||||||
|
script:
|
||||||
|
- cmake --build .
|
||||||
|
- ctest --verbose --output-on-failure
|
||||||
|
|
||||||
|
# generate and publish GCov coveralls results
|
||||||
|
after_success:
|
||||||
|
- if [[ "$CXX" == "g++" ]]; then coveralls --root .. -e examples -e googletest -e sqlite3 -e tests -E ".*feature_tests.*" -E ".*CompilerId.*" --gcov-options '\-lp' ; fi
|
96
3rd-party/SRombauts-SQLiteCpp-f69986a/CHANGELOG.txt
vendored
Normal file
96
3rd-party/SRombauts-SQLiteCpp-f69986a/CHANGELOG.txt
vendored
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
Mar 30 2012
|
||||||
|
Start of a new thin C++ SQLite wrapper
|
||||||
|
|
||||||
|
Apr 2 2012
|
||||||
|
The wrapper is functionnal
|
||||||
|
Added documentation and examples
|
||||||
|
Publication on GitHub
|
||||||
|
|
||||||
|
Version 0.1.0 - Apr 4 2012
|
||||||
|
Added a Database::exec() methode to execute simple SQL statement
|
||||||
|
Added a version number like in sqlite3.h, starting with 0.1.0
|
||||||
|
|
||||||
|
Version 0.2.0 - Apr 11 2012
|
||||||
|
Added getLastInsertId() and setBusyTimout()
|
||||||
|
Added bind() by name methods
|
||||||
|
|
||||||
|
Version 0.3.0 - Apr 16 2012
|
||||||
|
Added an easy wrapper Database::execAngGet()
|
||||||
|
|
||||||
|
Version 0.4.0 - Apr 23 2012
|
||||||
|
Added a Database::tableExists() easy to use function
|
||||||
|
|
||||||
|
Dec 10 2012
|
||||||
|
Added a Statement::exec() method to execute a one-step query with no expected result
|
||||||
|
|
||||||
|
Version 0.5.0 - March 9 2013
|
||||||
|
Added assert() on errors on destructors
|
||||||
|
Added getBytes()
|
||||||
|
Added getBlob(), getType() and isInteger/isFloat/isText/isBlob/isNull
|
||||||
|
Added bind() for binary blob data
|
||||||
|
|
||||||
|
Version 0.5.1 - April 7 2013
|
||||||
|
Added Column::getName()
|
||||||
|
|
||||||
|
Version 0.6.0 - November 22 2013
|
||||||
|
Renamed Column::getName() to Column::getOriginName()
|
||||||
|
Added Column::getName()
|
||||||
|
|
||||||
|
Version 0.7.0 - January 9 2014
|
||||||
|
Added Database::createFunction()
|
||||||
|
Added std::string version of existing APIs
|
||||||
|
Improved CMake with more build options and Doxygen auto-detection
|
||||||
|
|
||||||
|
Version 0.8.0 - February 26 2014
|
||||||
|
Database constructor support opening a database with a custom VFS (default to NULL)
|
||||||
|
Changed Column::getText() to return empty string "" by default instead of NULL pointer (to handle std::string conversion)
|
||||||
|
|
||||||
|
Version 1.0.0 - May 3 2015
|
||||||
|
Public headers file moved to include/ dir
|
||||||
|
Added support to biicode in CMakeLists.txt
|
||||||
|
Added Unit Tests
|
||||||
|
Added aBusyTimeoutMs parameter to Database() constructors
|
||||||
|
Added Database::getTotalChanges()
|
||||||
|
Added Database::getErrorCode()
|
||||||
|
Added Statement::clearBindings()
|
||||||
|
Added Statement::getColumn(aName)
|
||||||
|
Added Statement::getErrorCode()
|
||||||
|
Added Statement::getColumnName(aIndex)
|
||||||
|
Added Statement::getColumnOriginName(aIndex)
|
||||||
|
|
||||||
|
Version 1.1.0 - May 18 2015
|
||||||
|
Fixed valgrind error on Database destructor
|
||||||
|
Added Database::loadExtension
|
||||||
|
|
||||||
|
Version 1.2.0 - September 9 2015
|
||||||
|
Fixed build with GCC 5.1.0
|
||||||
|
Fixed MSVC release build warning
|
||||||
|
Fixed CppDepends warnings
|
||||||
|
Updated documentation on installation
|
||||||
|
Added Database::getHandle()
|
||||||
|
|
||||||
|
Version 1.3.0 - November 1 2015
|
||||||
|
Fixed build with Visual Studio 2015
|
||||||
|
Further improvements to README
|
||||||
|
Added Backup class
|
||||||
|
|
||||||
|
Version 1.3.1 - February 10 2016
|
||||||
|
Swith Linux/Mac build to the provided SQLite3 C library
|
||||||
|
Update SQLite3 from 3.8.8.3 to latest 3.10.2 (2016-01-20)
|
||||||
|
Remove warnings
|
||||||
|
Remove biicode support (defunct service, servers will shutdown the 16th of February 2016)
|
||||||
|
|
||||||
|
Version 2.0.0 - July 25 2016
|
||||||
|
Update SQLite3 from 3.10.2 to latest 3.13 (2016-05-18)
|
||||||
|
Move #include <sqlite3.h> from headers to .cpp files only using forward declarations
|
||||||
|
Add Database::VERSION to reach SQLITE_VERSION without including sqlite3.h in application code
|
||||||
|
Add getLibVersion() and getLibVersionNumber() to get runtime version of the library
|
||||||
|
Better exception messages when Statements fail PR #84
|
||||||
|
Variadic templates for bind() (C++14) PR #85
|
||||||
|
Add Statement::bindNoCopy() methods for strings, using SQLITE_STATIC to avoid internal copy by SQLite3 PR #86
|
||||||
|
Add Statement::bind() overload for uint32_t, and Column::getUint() and cast operator to uint32_t PR #86
|
||||||
|
Use the new SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION from SQLite 3.13 for security reason
|
||||||
|
Rename Backup::remainingPageCount()/totalPageCount() to Backup::getRemainingPageCount()/getTotalPageCount()
|
||||||
|
Remove Column::errmsg() method : use Database or Statement equivalents
|
||||||
|
More unit tests, with code coverage status on the GitHub page
|
||||||
|
Do not force MSVC to use static runtime if unit-tests are not build
|
286
3rd-party/SRombauts-SQLiteCpp-f69986a/CMakeLists.txt
vendored
Normal file
286
3rd-party/SRombauts-SQLiteCpp-f69986a/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,286 @@
|
|||||||
|
# Main CMake file for compiling the library itself, examples and tests.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
#
|
||||||
|
# Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
# or copy at http://opensource.org/licenses/MIT)
|
||||||
|
cmake_minimum_required(VERSION 2.8.12) # first version with add_compile_options()
|
||||||
|
project(SQLiteCpp)
|
||||||
|
|
||||||
|
# Define useful variables to handle OS differences:
|
||||||
|
if (WIN32)
|
||||||
|
set(DEV_NULL "NUL")
|
||||||
|
else (WIN32) # UNIX
|
||||||
|
set(DEV_NULL "/dev/null")
|
||||||
|
endif (WIN32)
|
||||||
|
|
||||||
|
# then Compiler/IDE differences:
|
||||||
|
if (MSVC)
|
||||||
|
set(CPPLINT_ARG_OUTPUT "--output=vs7")
|
||||||
|
set(CPPCHECK_ARG_TEMPLATE "--template=vs")
|
||||||
|
# disable Visual Studio warnings for fopen() used in the example
|
||||||
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
|
# Flags for linking with multithread static C++ runtime, required by googletest
|
||||||
|
if (SQLITECPP_BUILD_TESTS)
|
||||||
|
message(STATUS "Linking against multithread static C++ runtime for unit tests with googletest")
|
||||||
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
|
||||||
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
|
||||||
|
endif (SQLITECPP_BUILD_TESTS)
|
||||||
|
else (MSVC)
|
||||||
|
set(CPPLINT_ARG_OUTPUT "--output=eclipse")
|
||||||
|
set(CPPCHECK_ARG_TEMPLATE "--template=gcc")
|
||||||
|
# Useful compile flags and extra warnings
|
||||||
|
add_compile_options(-fstack-protector -Wall -Winit-self -Wswitch-enum -Wshadow -Winline)
|
||||||
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
# GCC flags
|
||||||
|
if (SQLITECPP_USE_GCOV AND CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
message (STATUS "Using GCov instrumentation")
|
||||||
|
else ()
|
||||||
|
message (WARNING "GCov instrumentation works best in Debug mode")
|
||||||
|
endif ()
|
||||||
|
add_compile_options (-coverage) # NOTE would be usefull but not working with current google test and gcc 4.8 -fkeep-inline-functions
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -coverage")
|
||||||
|
endif ()
|
||||||
|
endif (CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
endif (MSVC)
|
||||||
|
# and then common variables
|
||||||
|
set(CPPLINT_ARG_VERBOSE "--verbose=3")
|
||||||
|
set(CPPLINT_ARG_LINELENGTH "--linelength=120")
|
||||||
|
|
||||||
|
# Print CXX compiler information
|
||||||
|
message (STATUS "CMAKE_CXX_COMPILER '${CMAKE_CXX_COMPILER}' '${CMAKE_CXX_COMPILER_ID}' '${CMAKE_CXX_COMPILER_VERSION}'")
|
||||||
|
|
||||||
|
# Print CXX FLAGS
|
||||||
|
message (STATUS "CMAKE_CXX_FLAGS '${CMAKE_CXX_FLAGS}'")
|
||||||
|
if (MSVC)
|
||||||
|
message (STATUS "CMAKE_CXX_FLAGS_DEBUG '${CMAKE_CXX_FLAGS_DEBUG}'")
|
||||||
|
message (STATUS "CMAKE_CXX_FLAGS_RELEASE '${CMAKE_CXX_FLAGS_RELEASE}'")
|
||||||
|
message (STATUS "CMAKE_CXX_FLAGS_RELWITHDEBINFO '${CMAKE_CXX_FLAGS_RELWITHDEBINFO}'")
|
||||||
|
message (STATUS "CMAKE_CXX_FLAGS_MINSIZEREL '${CMAKE_CXX_FLAGS_MINSIZEREL}'")
|
||||||
|
else (NOT MSVC)
|
||||||
|
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||||
|
message (STATUS "CMAKE_CXX_FLAGS_DEBUG '${CMAKE_CXX_FLAGS_DEBUG}'")
|
||||||
|
elseif (CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
|
||||||
|
message (STATUS "CMAKE_CXX_FLAGS_RELWITHDEBINFO '${CMAKE_CXX_FLAGS_RELWITHDEBINFO}'")
|
||||||
|
elseif (CMAKE_BUILD_TYPE STREQUAL MinSizeRel)
|
||||||
|
message (STATUS "CMAKE_CXX_FLAGS_MINSIZEREL '${CMAKE_CXX_FLAGS_MINSIZEREL}'")
|
||||||
|
else ()
|
||||||
|
message (STATUS "CMAKE_CXX_FLAGS_RELEASE '${CMAKE_CXX_FLAGS_RELEASE}'")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Options relative to SQLite and SQLiteC++ functions
|
||||||
|
|
||||||
|
option(SQLITE_ENABLE_COLUMN_METADATA "Enable Column::getColumnOriginName(). Require support from sqlite3 library." ON)
|
||||||
|
if (SQLITE_ENABLE_COLUMN_METADATA)
|
||||||
|
# Enable the use of SQLite column metadata and Column::getColumnOriginName() method,
|
||||||
|
# Require that the sqlite3 library is also compiled with this flag (default under Debian/Ubuntu, but not on Mac OS X).
|
||||||
|
add_definitions(-DSQLITE_ENABLE_COLUMN_METADATA)
|
||||||
|
endif (SQLITE_ENABLE_COLUMN_METADATA)
|
||||||
|
|
||||||
|
option(SQLITE_ENABLE_ASSERT_HANDLER "Enable the user defintion of a assertion_failed() handler." OFF)
|
||||||
|
if (SQLITE_ENABLE_ASSERT_HANDLER)
|
||||||
|
# Enable the user defintion of a assertion_failed() handler (default to false, easier to handler for begginers).
|
||||||
|
add_definitions(-DSQLITECPP_ENABLE_ASSERT_HANDLER)
|
||||||
|
endif (SQLITE_ENABLE_ASSERT_HANDLER)
|
||||||
|
|
||||||
|
|
||||||
|
## Build the C++ Wrapper ##
|
||||||
|
|
||||||
|
# adding a new file require explicittly modifing the CMakeLists.txt
|
||||||
|
# so that CMake knows that it should rebuild the project (it is best practice)
|
||||||
|
|
||||||
|
# list of sources files of the library
|
||||||
|
set(SQLITECPP_SRC
|
||||||
|
${PROJECT_SOURCE_DIR}/src/Backup.cpp
|
||||||
|
${PROJECT_SOURCE_DIR}/src/Column.cpp
|
||||||
|
${PROJECT_SOURCE_DIR}/src/Database.cpp
|
||||||
|
${PROJECT_SOURCE_DIR}/src/Exception.cpp
|
||||||
|
${PROJECT_SOURCE_DIR}/src/Statement.cpp
|
||||||
|
${PROJECT_SOURCE_DIR}/src/Transaction.cpp
|
||||||
|
)
|
||||||
|
source_group(src FILES ${SQLITECPP_SRC})
|
||||||
|
|
||||||
|
# list of header files of the library
|
||||||
|
set(SQLITECPP_INC
|
||||||
|
${PROJECT_SOURCE_DIR}/include/SQLiteCpp/SQLiteCpp.h
|
||||||
|
${PROJECT_SOURCE_DIR}/include/SQLiteCpp/Assertion.h
|
||||||
|
${PROJECT_SOURCE_DIR}/include/SQLiteCpp/Backup.h
|
||||||
|
${PROJECT_SOURCE_DIR}/include/SQLiteCpp/Column.h
|
||||||
|
${PROJECT_SOURCE_DIR}/include/SQLiteCpp/Database.h
|
||||||
|
${PROJECT_SOURCE_DIR}/include/SQLiteCpp/Exception.h
|
||||||
|
${PROJECT_SOURCE_DIR}/include/SQLiteCpp/Statement.h
|
||||||
|
${PROJECT_SOURCE_DIR}/include/SQLiteCpp/Transaction.h
|
||||||
|
${PROJECT_SOURCE_DIR}/include/SQLiteCpp/VariadicBind.h
|
||||||
|
)
|
||||||
|
source_group(inc FILES ${SQLITECPP_INC})
|
||||||
|
|
||||||
|
# list of test files of the library
|
||||||
|
set(SQLITECPP_TESTS
|
||||||
|
tests/Column_test.cpp
|
||||||
|
tests/Database_test.cpp
|
||||||
|
tests/Statement_test.cpp
|
||||||
|
tests/Backup_test.cpp
|
||||||
|
tests/Transaction_test.cpp
|
||||||
|
tests/VariadicBind_test.cpp
|
||||||
|
)
|
||||||
|
source_group(tests FILES ${SQLITECPP_TESTS})
|
||||||
|
|
||||||
|
# list of example files of the library
|
||||||
|
set(SQLITECPP_EXAMPLES
|
||||||
|
examples/example1/main.cpp
|
||||||
|
)
|
||||||
|
source_group(example1 FILES ${SQLITECPP_EXAMPLES})
|
||||||
|
|
||||||
|
# list of doc files of the library
|
||||||
|
set(SQLITECPP_DOC
|
||||||
|
README.md
|
||||||
|
LICENSE.txt
|
||||||
|
CHANGELOG.txt
|
||||||
|
TODO.txt
|
||||||
|
)
|
||||||
|
source_group(doc FILES ${SQLITECPP_DOC})
|
||||||
|
|
||||||
|
# list of script files of the library
|
||||||
|
set(SQLITECPP_SCRIPT
|
||||||
|
.travis.yml
|
||||||
|
appveyor.yml
|
||||||
|
build.bat
|
||||||
|
build.sh
|
||||||
|
cpplint.py
|
||||||
|
Doxyfile
|
||||||
|
FindSQLiteCpp.cmake
|
||||||
|
)
|
||||||
|
source_group(scripts FILES ${SQLITECPP_SCRIPT})
|
||||||
|
|
||||||
|
# All includes are relative to the "include" directory
|
||||||
|
include_directories("${PROJECT_SOURCE_DIR}/include")
|
||||||
|
|
||||||
|
# add sources of the wrapper as a "SQLiteCpp" static library
|
||||||
|
add_library(SQLiteCpp ${SQLITECPP_SRC} ${SQLITECPP_INC} ${SQLITECPP_DOC} ${SQLITECPP_SCRIPT})
|
||||||
|
target_include_directories(SQLiteCpp PUBLIC "${PROJECT_SOURCE_DIR}/include")
|
||||||
|
|
||||||
|
if (UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
||||||
|
set_target_properties(SQLiteCpp PROPERTIES COMPILE_FLAGS "-fPIC")
|
||||||
|
endif (UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
||||||
|
|
||||||
|
|
||||||
|
## Build provided copy of SQLite3 C library ##
|
||||||
|
|
||||||
|
option(SQLITECPP_INTERNAL_SQLITE "Add the internal SQLite3 source to the project." ON)
|
||||||
|
if (SQLITECPP_INTERNAL_SQLITE)
|
||||||
|
# build the SQLite3 C library (for ease of use/compatibility) versus Linux sqlite3-dev package
|
||||||
|
add_subdirectory(sqlite3)
|
||||||
|
include_directories("${PROJECT_SOURCE_DIR}/sqlite3")
|
||||||
|
target_include_directories(sqlite3 PUBLIC "${PROJECT_SOURCE_DIR}/sqlite3")
|
||||||
|
endif (SQLITECPP_INTERNAL_SQLITE)
|
||||||
|
|
||||||
|
|
||||||
|
# Optional additional targets:
|
||||||
|
|
||||||
|
option(SQLITECPP_RUN_CPPLINT "Run cpplint.py tool for Google C++ StyleGuide." ON)
|
||||||
|
if (SQLITECPP_RUN_CPPLINT)
|
||||||
|
find_package(PythonInterp)
|
||||||
|
if (PYTHONINTERP_FOUND)
|
||||||
|
# add a cpplint target to the "all" target
|
||||||
|
add_custom_target(SQLiteCpp_cpplint
|
||||||
|
ALL
|
||||||
|
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/cpplint.py ${CPPLINT_ARG_OUTPUT} ${CPPLINT_ARG_VERBOSE} ${CPPLINT_ARG_LINELENGTH} ${SQLITECPP_SRC} ${SQLITECPP_INC}
|
||||||
|
)
|
||||||
|
endif (PYTHONINTERP_FOUND)
|
||||||
|
else (SQLITECPP_RUN_CPPLINT)
|
||||||
|
message(STATUS "SQLITECPP_RUN_CPPLINT OFF")
|
||||||
|
endif (SQLITECPP_RUN_CPPLINT)
|
||||||
|
|
||||||
|
option(SQLITECPP_RUN_CPPCHECK "Run cppcheck C++ static analysis tool." ON)
|
||||||
|
if (SQLITECPP_RUN_CPPCHECK)
|
||||||
|
find_program(CPPCHECK_EXECUTABLE NAMES cppcheck)
|
||||||
|
if (CPPCHECK_EXECUTABLE)
|
||||||
|
# add a cppcheck target to the "all" target
|
||||||
|
add_custom_target(SQLiteCpp_cppcheck
|
||||||
|
ALL
|
||||||
|
COMMAND ${CPPCHECK_EXECUTABLE} -j 8 cppcheck --enable=style --quiet ${CPPCHECK_ARG_TEMPLATE} ${PROJECT_SOURCE_DIR}/src
|
||||||
|
)
|
||||||
|
execute_process(COMMAND "${CPPCHECK_EXECUTABLE}" --version OUTPUT_VARIABLE CPPCHECK_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
message(STATUS "Found Cppcheck: ${CPPCHECK_EXECUTABLE} ${CPPCHECK_VERSION}")
|
||||||
|
else (CPPCHECK_EXECUTABLE)
|
||||||
|
message(STATUS "Could NOT find cppcheck")
|
||||||
|
endif (CPPCHECK_EXECUTABLE)
|
||||||
|
else (SQLITECPP_RUN_CPPCHECK)
|
||||||
|
message(STATUS "SQLITECPP_RUN_CPPCHECK OFF")
|
||||||
|
endif (SQLITECPP_RUN_CPPCHECK)
|
||||||
|
|
||||||
|
option(SQLITECPP_RUN_DOXYGEN "Run Doxygen C++ documentation tool." OFF)
|
||||||
|
if (SQLITECPP_RUN_DOXYGEN)
|
||||||
|
find_package(Doxygen)
|
||||||
|
if (DOXYGEN_FOUND)
|
||||||
|
# add a Doxygen target to the "all" target
|
||||||
|
add_custom_target(SQLiteCpp_doxygen
|
||||||
|
ALL
|
||||||
|
COMMAND doxygen Doxyfile > ${DEV_NULL}
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
endif (DOXYGEN_FOUND)
|
||||||
|
else (SQLITECPP_RUN_DOXYGEN)
|
||||||
|
message(STATUS "SQLITECPP_RUN_DOXYGEN OFF")
|
||||||
|
endif (SQLITECPP_RUN_DOXYGEN)
|
||||||
|
|
||||||
|
option(SQLITECPP_BUILD_EXAMPLES "Build examples." OFF)
|
||||||
|
if (SQLITECPP_BUILD_EXAMPLES)
|
||||||
|
# add the basic example executable
|
||||||
|
add_executable(SQLiteCpp_example1 ${SQLITECPP_EXAMPLES})
|
||||||
|
target_link_libraries(SQLiteCpp_example1 SQLiteCpp sqlite3)
|
||||||
|
# Link target with pthread and dl for linux
|
||||||
|
if (UNIX)
|
||||||
|
target_link_libraries(SQLiteCpp_example1 pthread)
|
||||||
|
if (NOT APPLE)
|
||||||
|
target_link_libraries(SQLiteCpp_example1 dl)
|
||||||
|
endif ()
|
||||||
|
elseif (MSYS OR MINGW)
|
||||||
|
target_link_libraries(SQLiteCpp_example1 ssp)
|
||||||
|
endif ()
|
||||||
|
else (SQLITECPP_BUILD_EXAMPLES)
|
||||||
|
message(STATUS "SQLITECPP_BUILD_EXAMPLES OFF")
|
||||||
|
endif (SQLITECPP_BUILD_EXAMPLES)
|
||||||
|
|
||||||
|
option(SQLITECPP_BUILD_TESTS "Build and run tests." OFF)
|
||||||
|
if (SQLITECPP_BUILD_TESTS)
|
||||||
|
# deactivate some warnings for compiling the gtest library
|
||||||
|
if (NOT MSVC)
|
||||||
|
add_compile_options(-Wno-variadic-macros -Wno-long-long -Wno-switch-enum -Wno-float-equal -Wno-conversion-null -Wno-switch-default -Wno-pedantic)
|
||||||
|
endif (NOT MSVC)
|
||||||
|
|
||||||
|
# add the subdirectory containing the CMakeLists.txt for the gtest library
|
||||||
|
# TODO: under Linux, uses libgtest-dev if found
|
||||||
|
# TODO: move to the new googletest Github repository
|
||||||
|
if (NOT EXISTS "${PROJECT_SOURCE_DIR}/googletest/CMakeLists.txt")
|
||||||
|
message(FATAL_ERROR "Missing 'googletest' submodule! Either use 'git init submodule' and 'git update submodule' to get googletest according to the README, or deactivate unit tests with -DSQLITECPP_BUILD_TESTS=OFF")
|
||||||
|
endif ()
|
||||||
|
add_subdirectory(googletest)
|
||||||
|
include_directories("${PROJECT_SOURCE_DIR}/googletest/googletest/include")
|
||||||
|
|
||||||
|
# add the unit test executable
|
||||||
|
add_executable(SQLiteCpp_tests ${SQLITECPP_TESTS})
|
||||||
|
target_link_libraries(SQLiteCpp_tests gtest_main SQLiteCpp sqlite3)
|
||||||
|
# Link target with dl for linux
|
||||||
|
if (UNIX AND NOT APPLE)
|
||||||
|
target_link_libraries(SQLiteCpp_tests dl)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# add a "test" target:
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
|
# does the tests pass?
|
||||||
|
add_test(UnitTests SQLiteCpp_tests)
|
||||||
|
|
||||||
|
if (SQLITECPP_BUILD_EXAMPLES)
|
||||||
|
# does the example1 runs successfully?
|
||||||
|
add_test(Example1Run SQLiteCpp_example1)
|
||||||
|
endif (SQLITECPP_BUILD_EXAMPLES)
|
||||||
|
else (SQLITECPP_BUILD_TESTS)
|
||||||
|
message(STATUS "SQLITECPP_BUILD_TESTS OFF")
|
||||||
|
endif (SQLITECPP_BUILD_TESTS)
|
||||||
|
|
2304
3rd-party/SRombauts-SQLiteCpp-f69986a/Doxyfile
vendored
Normal file
2304
3rd-party/SRombauts-SQLiteCpp-f69986a/Doxyfile
vendored
Normal file
File diff suppressed because it is too large
Load Diff
58
3rd-party/SRombauts-SQLiteCpp-f69986a/FindSQLiteCpp.cmake
vendored
Normal file
58
3rd-party/SRombauts-SQLiteCpp-f69986a/FindSQLiteCpp.cmake
vendored
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
# @file CMakeLists.txt
|
||||||
|
# @ingroup SQLiteCpp
|
||||||
|
# @brief SQLiteCpp CMake module.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2010-2014 Kartik Kumar (me@kartikkumar.com)
|
||||||
|
#
|
||||||
|
# Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
# or copy at http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
|
macro(_sqlitecpp_check_version)
|
||||||
|
file(READ "${SQLITECPP_INCLUDE_DIR}/SQLiteCpp.h" _sqlitecpp_header)
|
||||||
|
|
||||||
|
string(REGEX MATCH "define[ \t]+SQLITECPP_VERSION_NUMBER[ \t]+([0-9]+)"
|
||||||
|
_sqlitecpp_version_match "${_sqlitecpp_header}")
|
||||||
|
set(SQLITECPP_VERSION "${CMAKE_MATCH_1}")
|
||||||
|
if(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION})
|
||||||
|
set(SQLITECPP_VERSION_OK FALSE)
|
||||||
|
else(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION})
|
||||||
|
set(SQLITECPP_VERSION_OK TRUE)
|
||||||
|
endif(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION})
|
||||||
|
|
||||||
|
if(NOT SQLITECPP_VERSION_OK)
|
||||||
|
message(STATUS "SQLiteCpp version ${SQLITECPP_VERSION} found in ${SQLITECPP_INCLUDE_DIR}, "
|
||||||
|
"but at least version ${SQLiteCpp_FIND_VERSION} is required!")
|
||||||
|
endif(NOT SQLITECPP_VERSION_OK)
|
||||||
|
|
||||||
|
set(SQLITECPP_LIBRARY "SQLiteCpp")
|
||||||
|
link_directories(${SQLITECPP_LIBRARY_DIR})
|
||||||
|
endmacro(_sqlitecpp_check_version)
|
||||||
|
|
||||||
|
if(SQLITECPP_INCLUDE_DIR)
|
||||||
|
# Check if SQLiteCpp is already present in cache.
|
||||||
|
_sqlitecpp_check_version()
|
||||||
|
set(SQLITECPP_FOUND ${SQLITECPP_VERSION_OK})
|
||||||
|
|
||||||
|
else (SQLITECPP_INCLUDE_DIR)
|
||||||
|
find_path(SQLITECPP_BASE_PATH NAMES SQLiteCpp.h
|
||||||
|
PATHS
|
||||||
|
${PROJECT_SOURCE_DIR}
|
||||||
|
${PROJECT_SOURCE_DIR}/..
|
||||||
|
${PROJECT_SOURCE_DIR}/../..
|
||||||
|
${PROJECT_SOURCE_DIR}/../../..
|
||||||
|
${PROJECT_SOURCE_DIR}/../../../..
|
||||||
|
PATH_SUFFIXES SQLiteCpp/include/SQLiteCpp
|
||||||
|
)
|
||||||
|
set(SQLITECPP_INCLUDE_DIR ${SQLITECPP_BASE_PATH})
|
||||||
|
set(SQLITECPP_LIBRARY_DIR ${SQLITECPP_BASE_PATH}/../../build)
|
||||||
|
|
||||||
|
if(SQLITECPP_INCLUDE_DIR)
|
||||||
|
_sqlitecpp_check_version()
|
||||||
|
endif(SQLITECPP_INCLUDE_DIR)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(SQLITECPP DEFAULT_MSG SQLITECPP_INCLUDE_DIR SQLITECPP_VERSION_OK)
|
||||||
|
|
||||||
|
mark_as_advanced(SQLITECPP_INCLUDE_DIR)
|
||||||
|
|
||||||
|
endif(SQLITECPP_INCLUDE_DIR)
|
20
3rd-party/SRombauts-SQLiteCpp-f69986a/LICENSE.txt
vendored
Normal file
20
3rd-party/SRombauts-SQLiteCpp-f69986a/LICENSE.txt
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||||
|
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
303
3rd-party/SRombauts-SQLiteCpp-f69986a/README.md
vendored
Normal file
303
3rd-party/SRombauts-SQLiteCpp-f69986a/README.md
vendored
Normal file
@@ -0,0 +1,303 @@
|
|||||||
|
SQLiteC++
|
||||||
|
---------
|
||||||
|
|
||||||
|
[](https://github.com/SRombauts/SQLiteCpp/releases)
|
||||||
|
[](https://github.com/SRombauts/SQLiteCpp/blob/master/LICENSE.txt)
|
||||||
|
[](https://travis-ci.org/SRombauts/SQLiteCpp "Travis CI Linux Build Status")
|
||||||
|
[](https://ci.appveyor.com/project/SbastienRombauts/SQLiteCpp "AppVeyor Windows Build status")
|
||||||
|
[](https://coveralls.io/github/SRombauts/SQLiteCpp "Coveralls test coverage")
|
||||||
|
[](https://gitter.im/SRombauts/SQLiteCpp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
|
|
||||||
|
|
||||||
|
SQLiteC++ (SQLiteCpp) is a smart and easy to use C++ SQLite3 wrapper.
|
||||||
|
|
||||||
|
See SQLiteC++ website http://srombauts.github.com/SQLiteCpp on GitHub.
|
||||||
|
|
||||||
|
Keywords: sqlite, sqlite3, C, library, wrapper C++
|
||||||
|
|
||||||
|
## About SQLiteC++:
|
||||||
|
|
||||||
|
SQLiteC++ offers an encapsulation around the native C APIs of SQLite,
|
||||||
|
with a few intuitive and well documented C++ classes.
|
||||||
|
|
||||||
|
### License:
|
||||||
|
|
||||||
|
Copyright (c) 2012-2016 Sébastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
|
||||||
|
Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
or copy at http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
|
#### Note on redistribution of SQLite source files
|
||||||
|
|
||||||
|
As stated by the MIT License, you are welcome to reuse, modify, and redistribute the SQLiteCpp source code
|
||||||
|
the way you want it to, be it a git submodule, a subdirectory, or a selection of some source files.
|
||||||
|
|
||||||
|
I would love a mention in your README, a web link to the SQLite repository, and a mention of the author,
|
||||||
|
but none of those are mandatory.
|
||||||
|
|
||||||
|
### About SQLite underlying library:
|
||||||
|
|
||||||
|
SQLite is a library that implements a serverless transactional SQL database engine.
|
||||||
|
It is the most widely deployed SQL database engine in the world.
|
||||||
|
All of the code and documentation in SQLite has been dedicated to the public domain by the authors.
|
||||||
|
http://www.sqlite.org/about.html
|
||||||
|
|
||||||
|
### The goals of SQLiteC++ are:
|
||||||
|
|
||||||
|
- to offer the best of the existing simple C++ SQLite wrappers
|
||||||
|
- to be elegantly written with good C++ design, STL, exceptions and RAII idiom
|
||||||
|
- to keep dependencies to a minimum (STL and SQLite3)
|
||||||
|
- to be portable
|
||||||
|
- to be light and fast
|
||||||
|
- to be thread-safe only as much as SQLite "Multi-thread" mode (see below)
|
||||||
|
- to have a good unit test coverage
|
||||||
|
- to use API names sticking with those of the SQLite library
|
||||||
|
- to be well documented with Doxygen tags, and with some good examples
|
||||||
|
- to be well maintained
|
||||||
|
- to use a permissive MIT license, similar to BSD or Boost, for proprietary/commercial usage
|
||||||
|
|
||||||
|
It is designed using the Resource Acquisition Is Initialization (RAII) idiom
|
||||||
|
(see http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization),
|
||||||
|
and throwing exceptions in case of SQLite errors (exept in destructors,
|
||||||
|
where assert() are used instead).
|
||||||
|
Each SQLiteC++ object must be constructed with a valid SQLite database connection,
|
||||||
|
and then is always valid until destroyed.
|
||||||
|
|
||||||
|
### Supported platforms:
|
||||||
|
|
||||||
|
Developements and tests are done under the following OSs:
|
||||||
|
- Ubuntu 14.04 (Travis CI)
|
||||||
|
- Windows XP/10
|
||||||
|
- OS X 10.11 (Travis CI)
|
||||||
|
|
||||||
|
And the following IDEs/Compilers
|
||||||
|
- GCC 4.8.4, 4.9.3, 5.3.0 and 6.1.1 (C++03, C++11, C++14, C++1z)
|
||||||
|
- Clang 3.5 and 3.8
|
||||||
|
- Xcode 8
|
||||||
|
- Visual Studio Community 2015
|
||||||
|
- Eclipse CDT under Linux
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
- an STL implementation (even an old one, like the one provided with VC6 should work)
|
||||||
|
- exception support (the class Exception inherits from std::runtime_error)
|
||||||
|
- the SQLite library (3.7.15 minimum from 2012-12-12) either by linking to it dynamicaly or statically (install the libsqlite3-dev package under Debian/Ubuntu/Mint Linux),
|
||||||
|
or by adding its source file in your project code base (source code provided in src/sqlite3 for Windows),
|
||||||
|
with the SQLITE_ENABLE_COLUMN_METADATA macro defined (see http://www.sqlite.org/compile.html#enable_column_metadata).
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
To use this wrapper, you need to add the SQLiteC++ source files from the src/ directory
|
||||||
|
in your project code base, and compile/link against the sqlite library.
|
||||||
|
|
||||||
|
The easiest way to do this is to add the wrapper as a library.
|
||||||
|
The "CMakeLists.txt" file defining the static library is provided in the root directory,
|
||||||
|
so you simply have to add_subdirectory(SQLiteCpp) to you main CMakeLists.txt
|
||||||
|
and link to the "SQLiteCpp" wrapper library.
|
||||||
|
|
||||||
|
Thus this SQLiteCpp repository can be directly used as a Git submoldule.
|
||||||
|
See the [SQLiteCpp_Example](https://github.com/SRombauts/SQLiteCpp_Example) side repository for a standalone "from scratch" example.
|
||||||
|
|
||||||
|
Under Debian/Ubuntu/Mint Linux, you can install the libsqlite3-dev package if you don't want to use the embedded sqlite3 library.
|
||||||
|
|
||||||
|
### Building example and unit-tests:
|
||||||
|
|
||||||
|
Use git to clone the repository. Then init and update submodule "googletest".
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
git clone https://github.com/SRombauts/SQLiteCpp.git
|
||||||
|
cd SQLiteCpp
|
||||||
|
git submodule init
|
||||||
|
git submodule update
|
||||||
|
```
|
||||||
|
|
||||||
|
#### CMake and tests
|
||||||
|
A CMake configuration file is also provided for multiplatform support and testing.
|
||||||
|
|
||||||
|
Typical generic build for MS Visual Studio under Windows (from [build.bat](build.bat)):
|
||||||
|
|
||||||
|
```Batchfile
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
|
||||||
|
cmake .. # cmake .. -G "Visual Studio 10" # for Visual Studio 2010
|
||||||
|
@REM Generate a Visual Studio solution for latest version found
|
||||||
|
cmake -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON ..
|
||||||
|
|
||||||
|
@REM Build default configuration (ie 'Debug')
|
||||||
|
cmake --build .
|
||||||
|
|
||||||
|
@REM Build and run tests
|
||||||
|
ctest --output-on-failure
|
||||||
|
```
|
||||||
|
|
||||||
|
Generating the Linux Makefile, building in Debug and executing the tests (from [build.sh](build.sh)):
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
mkdir Debug
|
||||||
|
cd Debug
|
||||||
|
|
||||||
|
# Generate a Makefile for GCC (or Clang, depanding on CC/CXX envvar)
|
||||||
|
cmake -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON ..
|
||||||
|
|
||||||
|
# Build (ie 'make')
|
||||||
|
cmake --build .
|
||||||
|
|
||||||
|
# Build and run unit-tests (ie 'make test')
|
||||||
|
ctest --output-on-failure
|
||||||
|
```
|
||||||
|
|
||||||
|
#### CMake options
|
||||||
|
|
||||||
|
* For more options on customizing the build, see the [CMakeLists.txt](https://github.com/SRombauts/SQLiteCpp/blob/master/CMakeLists.txt) file.
|
||||||
|
|
||||||
|
#### Troubleshooting
|
||||||
|
|
||||||
|
Under Linux, if you get muliple linker errors like "undefined reference to sqlite3_xxx",
|
||||||
|
it's that you lack the "sqlite3" library: install the libsqlite3-dev package.
|
||||||
|
|
||||||
|
If you get a single linker error "Column.cpp: undefined reference to sqlite3_column_origin_name",
|
||||||
|
it's that your "sqlite3" library was not compiled with
|
||||||
|
the SQLITE_ENABLE_COLUMN_METADATA macro defined (see http://www.sqlite.org/compile.html#enable_column_metadata).
|
||||||
|
You can either recompile it yourself (seek help online) or you can comment out the following line in src/Column.h:
|
||||||
|
|
||||||
|
```C++
|
||||||
|
#define SQLITE_ENABLE_COLUMN_METADATA
|
||||||
|
```
|
||||||
|
|
||||||
|
### Continuous Integration
|
||||||
|
|
||||||
|
This project is continuously tested under Ubuntu Linux with the gcc and clang compilers
|
||||||
|
using the Travis CI community service with the above CMake building and testing procedure.
|
||||||
|
It is also tested in the same way under Windows Server 2012 R2 with Visual Studio 2013 compiler
|
||||||
|
using the AppVeyor countinuous integration service.
|
||||||
|
|
||||||
|
Detailed results can be seen online:
|
||||||
|
- https://travis-ci.org/SRombauts/SQLiteCpp
|
||||||
|
- https://ci.appveyor.com/project/SbastienRombauts/SQLiteCpp
|
||||||
|
|
||||||
|
### Thread-safety
|
||||||
|
|
||||||
|
SQLite supports three modes of thread safety, as describe in "SQLite And Multiple Threads":
|
||||||
|
see http://www.sqlite.org/threadsafe.html
|
||||||
|
|
||||||
|
This SQLiteC++ wrapper does no add any locks (no mutexes) nor any other thread-safety mechanism
|
||||||
|
above the SQLite library itself, by design, for lightness and speed.
|
||||||
|
|
||||||
|
Thus, SQLiteC++ naturally supports the "Multi Thread" mode of SQLite:
|
||||||
|
"In this mode, SQLite can be safely used by multiple threads
|
||||||
|
provided that no single database connection is used simultaneously in two or more threads."
|
||||||
|
|
||||||
|
But SQLiteC++ does not support the fully thread-safe "Serialized" mode of SQLite,
|
||||||
|
because of the way it shares the underlying SQLite precompiled statement
|
||||||
|
in a custom shared pointer (See the inner class "Statement::Ptr").
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
### The first sample demonstrates how to query a database and get results:
|
||||||
|
|
||||||
|
```C++
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Open a database file
|
||||||
|
SQLite::Database db("example.db3");
|
||||||
|
|
||||||
|
// Compile a SQL query, containing one parameter (index 1)
|
||||||
|
SQLite::Statement query(db, "SELECT * FROM test WHERE size > ?");
|
||||||
|
|
||||||
|
// Bind the integer value 6 to the first parameter of the SQL query
|
||||||
|
query.bind(1, 6);
|
||||||
|
|
||||||
|
// Loop to execute the query step by step, to get rows of result
|
||||||
|
while (query.executeStep())
|
||||||
|
{
|
||||||
|
// Demonstrate how to get some typed column value
|
||||||
|
int id = query.getColumn(0);
|
||||||
|
const char* value = query.getColumn(1);
|
||||||
|
int size = query.getColumn(2);
|
||||||
|
|
||||||
|
std::cout << "row: " << id << ", " << value << ", " << size << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
std::cout << "exception: " << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### The second sample shows how to manage a transaction:
|
||||||
|
|
||||||
|
```C++
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SQLite::Database db("transaction.db3", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
|
||||||
|
db.exec("DROP TABLE IF EXISTS test");
|
||||||
|
|
||||||
|
// Begin transaction
|
||||||
|
SQLite::Transaction transaction(db);
|
||||||
|
|
||||||
|
db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT)");
|
||||||
|
|
||||||
|
int nb = db.exec("INSERT INTO test VALUES (NULL, \"test\")");
|
||||||
|
std::cout << "INSERT INTO test VALUES (NULL, \"test\")\", returned " << nb << std::endl;
|
||||||
|
|
||||||
|
// Commit transaction
|
||||||
|
transaction.commit();
|
||||||
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
std::cout << "exception: " << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### How to handle assertion in SQLiteC++:
|
||||||
|
Exceptions shall not be used in destructors, so SQLiteC++ uses SQLITECPP_ASSERT() to check for errors in destructors.
|
||||||
|
If you don't want assert() to be called, you have to enable and define an assert handler as shown below,
|
||||||
|
and by setting the flag SQLITECPP_ENABLE_ASSERT_HANDLER when compiling the lib.
|
||||||
|
|
||||||
|
```C++
|
||||||
|
#ifdef SQLITECPP_ENABLE_ASSERT_HANDLER
|
||||||
|
namespace SQLite
|
||||||
|
{
|
||||||
|
/// definition of the assertion handler enabled when SQLITECPP_ENABLE_ASSERT_HANDLER is defined in the project (CMakeList.txt)
|
||||||
|
void assertion_failed(const char* apFile, const long apLine, const char* apFunc, const char* apExpr, const char* apMsg)
|
||||||
|
{
|
||||||
|
// Print a message to the standard error output stream, and abort the program.
|
||||||
|
std::cerr << apFile << ":" << apLine << ":" << " error: assertion failed (" << apExpr << ") in " << apFunc << "() with message \"" << apMsg << "\"\n";
|
||||||
|
std::abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
```
|
||||||
|
|
||||||
|
## How to contribute
|
||||||
|
### GitHub website
|
||||||
|
The most efficient way to help and contribute to this wrapper project is to
|
||||||
|
use the tools provided by GitHub:
|
||||||
|
- please fill bug reports and feature requests here: https://github.com/SRombauts/SQLiteCpp/issues
|
||||||
|
- fork the repository, make some small changes and submit them with pull-request
|
||||||
|
|
||||||
|
### Contact
|
||||||
|
You can also email me directly, I will try to answer questions and requests whenever I get the time for it.
|
||||||
|
|
||||||
|
### Coding Style Guidelines
|
||||||
|
The source code use the CamelCase naming style variant where:
|
||||||
|
- type names (class, struct, typedef, enums...) begin with a capital letter
|
||||||
|
- files (.cpp/.h) are named like the class they contain
|
||||||
|
- function and variable names begin with a lower case letter
|
||||||
|
- member variables begin with a 'm', function arguments begin with a 'a', booleans with a 'b', pointers with a 'p'
|
||||||
|
- each file, class, method and member variable is documented using Doxygen tags
|
||||||
|
See also http://www.appinf.com/download/CppCodingStyleGuide.pdf for good guidelines
|
||||||
|
|
||||||
|
## See also - Some other simple C++ SQLite wrappers:
|
||||||
|
|
||||||
|
See bellow a short comparison of other wrappers done at the time of writing:
|
||||||
|
- [sqdbcpp](http://code.google.com/p/sqdbcpp/): RAII design, simple, no dependencies, UTF-8/UTF-16, new BSD license
|
||||||
|
- [sqlite3cc](http://ed.am/dev/sqlite3cc): uses boost, modern design, LPGPL
|
||||||
|
- [sqlite3pp](https://github.com/iwongu/sqlite3pp): modern design inspired by boost, MIT License
|
||||||
|
- [SQLite++](http://sqlitepp.berlios.de/): uses boost build system, Boost License 1.0
|
||||||
|
- [CppSQLite](http://www.codeproject.com/Articles/6343/CppSQLite-C-Wrapper-for-SQLite/): famous Code Project but old design, BSD License
|
||||||
|
- [easySQLite](http://code.google.com/p/easysqlite/): manages table as structured objects, complex
|
||||||
|
- [sqlite_modern_cpp](https://github.com/keramer/sqlite_modern_cpp): modern C++11, all in one file, MIT license
|
||||||
|
|
30
3rd-party/SRombauts-SQLiteCpp-f69986a/TODO.txt
vendored
Normal file
30
3rd-party/SRombauts-SQLiteCpp-f69986a/TODO.txt
vendored
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
Switch to C++11 for v2.0.0 with removal of include <sqlite.h> in headers
|
||||||
|
|
||||||
|
Add a Tutorial for SQLite newbies
|
||||||
|
Add a real example in the form of a small interactive console application
|
||||||
|
|
||||||
|
Improve Github Wiki pages with the FAQ: Installation, Examples, Tutorial, How to contribute
|
||||||
|
Publish the Doxygen Documentation in the Github Pages (gh-pages branch)
|
||||||
|
|
||||||
|
Missing features in v2.0.0:
|
||||||
|
- #24: executemany() like in Python https://docs.python.org/2/library/sqlite3.html#sqlite3.Connection.executemany
|
||||||
|
- #34: Better type for getColumn
|
||||||
|
|
||||||
|
Missing documentation in v2.0.0:
|
||||||
|
- explain the noncopyable property for RAII design
|
||||||
|
- comment on returning error code instead of exception that shall not be thrown when expected (!?)
|
||||||
|
|
||||||
|
Missing unit tests in v2.0.0:
|
||||||
|
- Load Extension (not practicable, and easy to verify by code review)
|
||||||
|
|
||||||
|
Advanced missing features:
|
||||||
|
- #39: SAVEPOINT https://www.sqlite.org/lang_savepoint.html
|
||||||
|
|
||||||
|
- Add optional usage of experimental sqlite3_trace() function to enable statistics
|
||||||
|
- Agregate ?
|
||||||
|
|
||||||
|
- support for different transaction mode ? NO: too specific
|
||||||
|
- operator<< binding ? NO: redundant with bind()
|
||||||
|
- ATTACH Database ? NO: can already be done by "ATTACH" Statement
|
||||||
|
|
||||||
|
Post an article to CodeProject: Is there a license issue ?
|
26
3rd-party/SRombauts-SQLiteCpp-f69986a/appveyor.yml
vendored
Normal file
26
3rd-party/SRombauts-SQLiteCpp-f69986a/appveyor.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
|
||||||
|
# build format
|
||||||
|
version: "{build}"
|
||||||
|
|
||||||
|
# scripts that run after cloning repository
|
||||||
|
install:
|
||||||
|
- git submodule update --init googletest
|
||||||
|
|
||||||
|
# configurations to add to build matrix
|
||||||
|
# TODO: VS2010->VS2015 and Win32/Win64 (see https://github.com/google/googletest/blob/master/appveyor.yml)
|
||||||
|
# TODO: MinGW Makefiles and MSYS Makefiles
|
||||||
|
configuration:
|
||||||
|
- Debug
|
||||||
|
# - Release # CMake can only build the default configuration on Visual Studio
|
||||||
|
|
||||||
|
# scripts to run before build
|
||||||
|
before_build:
|
||||||
|
- mkdir build
|
||||||
|
- cd build
|
||||||
|
- cmake -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON -DSQLITECPP_RUN_CPPCHECK=OFF ..
|
||||||
|
|
||||||
|
# build examples, and run tests (ie make & make test)
|
||||||
|
build_script:
|
||||||
|
- cmake --build .
|
||||||
|
- ctest --output-on-failure
|
25
3rd-party/SRombauts-SQLiteCpp-f69986a/build.bat
vendored
Normal file
25
3rd-party/SRombauts-SQLiteCpp-f69986a/build.bat
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
@REM Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
@REM
|
||||||
|
@REM Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
@REM or copy at http://opensource.org/licenses/MIT)
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
|
||||||
|
@REM Generate a Visual Studio solution for latest version found
|
||||||
|
cmake -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON ..
|
||||||
|
if ERRORLEVEL 1 goto onError
|
||||||
|
|
||||||
|
@REM Build default configuration (ie 'Debug')
|
||||||
|
cmake --build .
|
||||||
|
if ERRORLEVEL 1 goto onError
|
||||||
|
|
||||||
|
@REM Build and run tests
|
||||||
|
ctest --output-on-failure
|
||||||
|
if ERRORLEVEL 1 goto onError
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
exit
|
||||||
|
|
||||||
|
:onError
|
||||||
|
@echo An error occured!
|
||||||
|
cd ..
|
20
3rd-party/SRombauts-SQLiteCpp-f69986a/build.sh
vendored
Normal file
20
3rd-party/SRombauts-SQLiteCpp-f69986a/build.sh
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Copyright (c) 2012-2016 Sébastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
#
|
||||||
|
# Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
# or copy at http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
|
# exit on firts error
|
||||||
|
set -e
|
||||||
|
|
||||||
|
mkdir -p build
|
||||||
|
cd build
|
||||||
|
|
||||||
|
# Generate a Makefile for GCC (or Clang, depanding on CC/CXX envvar)
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=Debug -DSQLITECPP_USE_GCOV=OFF -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON ..
|
||||||
|
|
||||||
|
# Build (ie 'make')
|
||||||
|
cmake --build .
|
||||||
|
|
||||||
|
# Build and run unit-tests (ie 'make test')
|
||||||
|
ctest --output-on-failure
|
4797
3rd-party/SRombauts-SQLiteCpp-f69986a/cpplint.py
vendored
Normal file
4797
3rd-party/SRombauts-SQLiteCpp-f69986a/cpplint.py
vendored
Normal file
File diff suppressed because it is too large
Load Diff
46
3rd-party/SRombauts-SQLiteCpp-f69986a/include/SQLiteCpp/Assertion.h
vendored
Normal file
46
3rd-party/SRombauts-SQLiteCpp-f69986a/include/SQLiteCpp/Assertion.h
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* @file Assertion.h
|
||||||
|
* @ingroup SQLiteCpp
|
||||||
|
* @brief Definition of the SQLITECPP_ASSERT() macro.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SQLITECPP_ASSERT SQLITECPP_ASSERT() is used in destructors, where exceptions shall not be thrown
|
||||||
|
*
|
||||||
|
* Define SQLITECPP_ENABLE_ASSERT_HANDLER at the project level
|
||||||
|
* and define a SQLite::assertion_failed() assertion handler
|
||||||
|
* to tell SQLiteC++ to use it instead of assert() when an assertion fail.
|
||||||
|
*/
|
||||||
|
#ifdef SQLITECPP_ENABLE_ASSERT_HANDLER
|
||||||
|
|
||||||
|
// if an assert handler is provided by user code, use it instead of assert()
|
||||||
|
namespace SQLite
|
||||||
|
{
|
||||||
|
// declaration of the assert handler to define in user code
|
||||||
|
void assertion_failed(const char* apFile, const long apLine, const char* apFunc,
|
||||||
|
const char* apExpr, const char* apMsg);
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define __func__ __FUNCTION__
|
||||||
|
#endif
|
||||||
|
// call the assert handler provided by user code
|
||||||
|
#define SQLITECPP_ASSERT(expression, message) \
|
||||||
|
if (!(expression)) SQLite::assertion_failed(__FILE__, __LINE__, __func__, #expression, message)
|
||||||
|
} // namespace SQLite
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
// if no assert handler provided by user code, use standard assert()
|
||||||
|
// (note: in release mode assert() does nothing)
|
||||||
|
#define SQLITECPP_ASSERT(expression, message) assert(expression && message)
|
||||||
|
|
||||||
|
#endif
|
136
3rd-party/SRombauts-SQLiteCpp-f69986a/include/SQLiteCpp/Backup.h
vendored
Normal file
136
3rd-party/SRombauts-SQLiteCpp-f69986a/include/SQLiteCpp/Backup.h
vendored
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
/**
|
||||||
|
* @file Backup.h
|
||||||
|
* @ingroup SQLiteCpp
|
||||||
|
* @brief Backup is used to backup a database file in a safe and online way.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Shibao HONG (shibaohong@outlook.com)
|
||||||
|
* Copyright (c) 2015-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <SQLiteCpp/Database.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
// Forward declaration to avoid inclusion of <sqlite3.h> in a header
|
||||||
|
struct sqlite3_backup;
|
||||||
|
|
||||||
|
namespace SQLite
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief RAII encapsulation of a SQLite Database Backup process.
|
||||||
|
*
|
||||||
|
* A Backup object is used to backup a source database file to a destination database file
|
||||||
|
* in a safe and online way.
|
||||||
|
*
|
||||||
|
* Resource Acquisition Is Initialization (RAII) means that the Backup Resource
|
||||||
|
* is allocated in the constructor and released in the destructor, so that there is
|
||||||
|
* no need to worry about memory management or the validity of the underlying SQLite Backup.
|
||||||
|
*
|
||||||
|
* Thread-safety: a Backup object shall not be shared by multiple threads, because :
|
||||||
|
* 1) in the SQLite "Thread Safe" mode, "SQLite can be safely used by multiple threads
|
||||||
|
* provided that no single database connection is used simultaneously in two or more threads."
|
||||||
|
* 2) the SQLite "Serialized" mode is not supported by SQLiteC++,
|
||||||
|
* because of the way it shares the underling SQLite precompiled statement
|
||||||
|
* in a custom shared pointer (See the inner class "Statement::Ptr").
|
||||||
|
*/
|
||||||
|
class Backup
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Initialize a SQLite Backup object.
|
||||||
|
*
|
||||||
|
* Initialize a SQLite Backup object for the source database and destination database.
|
||||||
|
* The database name is "main" for the main database, "temp" for the temporary database,
|
||||||
|
* or the name specified after the AS keyword in an ATTACH statement for an attached database.
|
||||||
|
*
|
||||||
|
* Exception is thrown in case of error, then the Backup object is NOT constructed.
|
||||||
|
*
|
||||||
|
* @param[in] aDestDatabase Destination database connection
|
||||||
|
* @param[in] apDestDatabaseName Destination database name
|
||||||
|
* @param[in] aSrcDatabase Source database connection
|
||||||
|
* @param[in] apSrcDatabaseName Source database name
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
Backup(Database& aDestDatabase,
|
||||||
|
const char* apDestDatabaseName,
|
||||||
|
Database& aSrcDatabase,
|
||||||
|
const char* apSrcDatabaseName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialize a SQLite Backup object.
|
||||||
|
*
|
||||||
|
* Initialize a SQLite Backup object for source database and destination database.
|
||||||
|
* The database name is "main" for the main database, "temp" for the temporary database,
|
||||||
|
* or the name specified after the AS keyword in an ATTACH statement for an attached database.
|
||||||
|
*
|
||||||
|
* Exception is thrown in case of error, then the Backup object is NOT constructed.
|
||||||
|
*
|
||||||
|
* @param[in] aDestDatabase Destination database connection
|
||||||
|
* @param[in] aDestDatabaseName Destination database name
|
||||||
|
* @param[in] aSrcDatabase Source database connection
|
||||||
|
* @param[in] aSrcDatabaseName Source database name
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
Backup(Database& aDestDatabase,
|
||||||
|
const std::string& aDestDatabaseName,
|
||||||
|
Database& aSrcDatabase,
|
||||||
|
const std::string& aSrcDatabaseName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialize a SQLite Backup object for main databases.
|
||||||
|
*
|
||||||
|
* Initialize a SQLite Backup object for source database and destination database.
|
||||||
|
* Backup the main databases between the source and the destination.
|
||||||
|
*
|
||||||
|
* Exception is thrown in case of error, then the Backup object is NOT constructed.
|
||||||
|
*
|
||||||
|
* @param[in] aDestDatabase Destination database connection
|
||||||
|
* @param[in] aSrcDatabase Source database connection
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
Backup(Database& aDestDatabase,
|
||||||
|
Database& aSrcDatabase);
|
||||||
|
|
||||||
|
/// Release the SQLite Backup resource.
|
||||||
|
virtual ~Backup() noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Execute a step of backup with a given number of source pages to be copied
|
||||||
|
*
|
||||||
|
* Exception is thrown when SQLITE_IOERR_XXX, SQLITE_NOMEM, or SQLITE_READONLY is returned
|
||||||
|
* in sqlite3_backup_step(). These errors are considered fatal, so there is no point
|
||||||
|
* in retrying the call to executeStep().
|
||||||
|
*
|
||||||
|
* @param[in] aNumPage The number of source pages to be copied, with a negative value meaning all remaining source pages
|
||||||
|
*
|
||||||
|
* @return SQLITE_OK/SQLITE_DONE/SQLITE_BUSY/SQLITE_LOCKED
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
int executeStep(const int aNumPage = -1);
|
||||||
|
|
||||||
|
/// Return the number of source pages still to be backed up as of the most recent call to executeStep().
|
||||||
|
int getRemainingPageCount();
|
||||||
|
|
||||||
|
/// Return the total number of pages in the source database as of the most recent call to executeStep().
|
||||||
|
int getTotalPageCount();
|
||||||
|
|
||||||
|
private:
|
||||||
|
/// @{ Backup must be non-copyable
|
||||||
|
Backup(const Backup&);
|
||||||
|
Backup& operator=(const Backup&);
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
private:
|
||||||
|
sqlite3_backup* mpSQLiteBackup; ///< Pointer to SQLite Database Backup Handle
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace SQLite
|
281
3rd-party/SRombauts-SQLiteCpp-f69986a/include/SQLiteCpp/Column.h
vendored
Normal file
281
3rd-party/SRombauts-SQLiteCpp-f69986a/include/SQLiteCpp/Column.h
vendored
Normal file
@@ -0,0 +1,281 @@
|
|||||||
|
/**
|
||||||
|
* @file Column.h
|
||||||
|
* @ingroup SQLiteCpp
|
||||||
|
* @brief Encapsulation of a Column in a row of the result pointed by the prepared SQLite::Statement.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <SQLiteCpp/Statement.h>
|
||||||
|
#include <SQLiteCpp/Exception.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace SQLite
|
||||||
|
{
|
||||||
|
|
||||||
|
extern const int INTEGER; ///< SQLITE_INTEGER
|
||||||
|
extern const int FLOAT; ///< SQLITE_FLOAT
|
||||||
|
extern const int TEXT; ///< SQLITE_TEXT
|
||||||
|
extern const int BLOB; ///< SQLITE_BLOB
|
||||||
|
extern const int Null; ///< SQLITE_NULL
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Encapsulation of a Column in a row of the result pointed by the prepared Statement.
|
||||||
|
*
|
||||||
|
* A Column is a particular field of SQLite data in the current row of result
|
||||||
|
* of the Statement : it points to a single cell.
|
||||||
|
*
|
||||||
|
* Its value can be expressed as a text, and, when applicable, as a numeric
|
||||||
|
* (integer or floating point) or a binary blob.
|
||||||
|
*
|
||||||
|
* Thread-safety: a Column object shall not be shared by multiple threads, because :
|
||||||
|
* 1) in the SQLite "Thread Safe" mode, "SQLite can be safely used by multiple threads
|
||||||
|
* provided that no single database connection is used simultaneously in two or more threads."
|
||||||
|
* 2) the SQLite "Serialized" mode is not supported by SQLiteC++,
|
||||||
|
* because of the way it shares the underling SQLite precompiled statement
|
||||||
|
* in a custom shared pointer (See the inner class "Statement::Ptr").
|
||||||
|
*/
|
||||||
|
class Column
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Encapsulation of a Column in a Row of the result.
|
||||||
|
*
|
||||||
|
* @param[in] aStmtPtr Shared pointer to the prepared SQLite Statement Object.
|
||||||
|
* @param[in] aIndex Index of the column in the row of result, starting at 0
|
||||||
|
*/
|
||||||
|
Column(Statement::Ptr& aStmtPtr, int aIndex) noexcept; // nothrow
|
||||||
|
/// Simple destructor
|
||||||
|
virtual ~Column() noexcept; // nothrow
|
||||||
|
|
||||||
|
// default copy constructor and assignment operator are perfectly suited :
|
||||||
|
// they copy the Statement::Ptr which in turn increments the reference counter.
|
||||||
|
|
||||||
|
/// Make clang happy by explicitly implementing the copy-constructor:
|
||||||
|
Column(const Column & aOther) :
|
||||||
|
mStmtPtr(aOther.mStmtPtr),
|
||||||
|
mIndex(aOther.mIndex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return a pointer to the named assigned to this result column (potentially aliased)
|
||||||
|
*
|
||||||
|
* @see getOriginName() to get original column name (not aliased)
|
||||||
|
*/
|
||||||
|
const char* getName() const noexcept; // nothrow
|
||||||
|
|
||||||
|
#ifdef SQLITE_ENABLE_COLUMN_METADATA
|
||||||
|
/**
|
||||||
|
* @brief Return a pointer to the table column name that is the origin of this result column
|
||||||
|
*
|
||||||
|
* Require definition of the SQLITE_ENABLE_COLUMN_METADATA preprocessor macro :
|
||||||
|
* - when building the SQLite library itself (which is the case for the Debian libsqlite3 binary for instance),
|
||||||
|
* - and also when compiling this wrapper.
|
||||||
|
*/
|
||||||
|
const char* getOriginName() const noexcept; // nothrow
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// Return the integer value of the column.
|
||||||
|
int getInt() const noexcept; // nothrow
|
||||||
|
/// Return the 32bits unsigned integer value of the column (note that SQLite3 does not support unsigned 64bits).
|
||||||
|
unsigned getUInt() const noexcept; // nothrow
|
||||||
|
/// Return the 64bits integer value of the column (note that SQLite3 does not support unsigned 64bits).
|
||||||
|
long long getInt64() const noexcept; // nothrow
|
||||||
|
/// Return the double (64bits float) value of the column
|
||||||
|
double getDouble() const noexcept; // nothrow
|
||||||
|
/**
|
||||||
|
* @brief Return a pointer to the text value (NULL terminated string) of the column.
|
||||||
|
*
|
||||||
|
* @warning The value pointed at is only valid while the statement is valid (ie. not finalized),
|
||||||
|
* thus you must copy it before using it beyond its scope (to a std::string for instance).
|
||||||
|
*/
|
||||||
|
const char* getText(const char* apDefaultValue = "") const noexcept; // nothrow
|
||||||
|
/**
|
||||||
|
* @brief Return a pointer to the binary blob value of the column.
|
||||||
|
*
|
||||||
|
* @warning The value pointed at is only valid while the statement is valid (ie. not finalized),
|
||||||
|
* thus you must copy it before using it beyond its scope (to a std::string for instance).
|
||||||
|
*/
|
||||||
|
const void* getBlob() const noexcept; // nothrow
|
||||||
|
/**
|
||||||
|
* @brief Return a std::string for a TEXT or BLOB column.
|
||||||
|
*
|
||||||
|
* Note this correctly handles strings that contain null bytes.
|
||||||
|
*/
|
||||||
|
std::string getString() const noexcept; // nothrow
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return the type of the value of the column
|
||||||
|
*
|
||||||
|
* Return either SQLite::INTEGER, SQLite::FLOAT, SQLite::TEXT, SQLite::BLOB, or SQLite::Null.
|
||||||
|
*
|
||||||
|
* @warning After a type conversion (by a call to a getXxx on a Column of a Yyy type),
|
||||||
|
* the value returned by sqlite3_column_type() is undefined.
|
||||||
|
*/
|
||||||
|
int getType() const noexcept; // nothrow
|
||||||
|
|
||||||
|
/// Test if the column is an integer type value (meaningful only before any conversion)
|
||||||
|
inline bool isInteger() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return (SQLite::INTEGER == getType());
|
||||||
|
}
|
||||||
|
/// Test if the column is a floating point type value (meaningful only before any conversion)
|
||||||
|
inline bool isFloat() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return (SQLite::FLOAT == getType());
|
||||||
|
}
|
||||||
|
/// Test if the column is a text type value (meaningful only before any conversion)
|
||||||
|
inline bool isText() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return (SQLite::TEXT == getType());
|
||||||
|
}
|
||||||
|
/// Test if the column is a binary blob type value (meaningful only before any conversion)
|
||||||
|
inline bool isBlob() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return (SQLite::BLOB == getType());
|
||||||
|
}
|
||||||
|
/// Test if the column is NULL (meaningful only before any conversion)
|
||||||
|
inline bool isNull() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return (SQLite::Null == getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return the number of bytes used by the text (or blob) value of the column
|
||||||
|
*
|
||||||
|
* Return either :
|
||||||
|
* - size in bytes (not in characters) of the string returned by getText() without the '\0' terminator
|
||||||
|
* - size in bytes of the string representation of the numerical value (integer or double)
|
||||||
|
* - size in bytes of the binary blob returned by getBlob()
|
||||||
|
* - 0 for a NULL value
|
||||||
|
*/
|
||||||
|
int getBytes() const noexcept;
|
||||||
|
|
||||||
|
/// Alias returning the number of bytes used by the text (or blob) value of the column
|
||||||
|
inline int size() const noexcept
|
||||||
|
{
|
||||||
|
return getBytes ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Inline cast operator to int
|
||||||
|
inline operator int() const
|
||||||
|
{
|
||||||
|
return getInt();
|
||||||
|
}
|
||||||
|
/// Inline cast operator to 32bits unsigned integer
|
||||||
|
inline operator unsigned int() const
|
||||||
|
{
|
||||||
|
return getUInt();
|
||||||
|
}
|
||||||
|
#if (LONG_MAX == INT_MAX) // sizeof(long)==4 means the data model of the system is ILP32 (32bits OS or Windows 64bits)
|
||||||
|
/// Inline cast operator to 32bits long
|
||||||
|
inline operator long() const
|
||||||
|
{
|
||||||
|
return getInt();
|
||||||
|
}
|
||||||
|
/// Inline cast operator to 32bits unsigned long
|
||||||
|
inline operator unsigned long() const
|
||||||
|
{
|
||||||
|
return getUInt();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/// Inline cast operator to 64bits long when the data model of the system is ILP64 (Linux 64 bits...)
|
||||||
|
inline operator long() const
|
||||||
|
{
|
||||||
|
return getInt64();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// Inline cast operator to 64bits integer
|
||||||
|
inline operator long long() const
|
||||||
|
{
|
||||||
|
return getInt64();
|
||||||
|
}
|
||||||
|
/// Inline cast operator to double
|
||||||
|
inline operator double() const
|
||||||
|
{
|
||||||
|
return getDouble();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Inline cast operator to char*
|
||||||
|
*
|
||||||
|
* @see getText
|
||||||
|
*/
|
||||||
|
inline operator const char*() const
|
||||||
|
{
|
||||||
|
return getText();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Inline cast operator to void*
|
||||||
|
*
|
||||||
|
* @see getBlob
|
||||||
|
*/
|
||||||
|
inline operator const void*() const
|
||||||
|
{
|
||||||
|
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>}’)
|
||||||
|
// but is not working under Microsoft Visual Studio 2010, 2012 and 2013
|
||||||
|
// (error C2440: 'initializing' : cannot convert from 'SQLite::Column' to 'std::basic_string<_Elem,_Traits,_Ax>'
|
||||||
|
// [...] constructor overload resolution was ambiguous)
|
||||||
|
/**
|
||||||
|
* @brief Inline cast operator to std::string
|
||||||
|
*
|
||||||
|
* Handles BLOB or TEXT, which may contain null bytes within
|
||||||
|
*
|
||||||
|
* @see getString
|
||||||
|
*/
|
||||||
|
inline operator std::string() const
|
||||||
|
{
|
||||||
|
return getString();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private:
|
||||||
|
Statement::Ptr mStmtPtr; ///< Shared Pointer to the prepared SQLite Statement Object
|
||||||
|
int mIndex; ///< Index of the column in the row of result, starting at 0
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Standard std::ostream text inserter
|
||||||
|
*
|
||||||
|
* Insert the text value of the Column object, using getText(), into the provided stream.
|
||||||
|
*
|
||||||
|
* @param[in] aStream Stream to use
|
||||||
|
* @param[in] aColumn Column object to insert into the provided stream
|
||||||
|
*
|
||||||
|
* @return Reference to the stream used
|
||||||
|
*/
|
||||||
|
std::ostream& operator<<(std::ostream& aStream, const Column& aColumn);
|
||||||
|
|
||||||
|
#if __cplusplus >= 201402L || (defined(_MSC_VER) && _MSC_VER >= 1900)
|
||||||
|
// Create an instance of T from the first N columns, see declaration in Statement.h for full details
|
||||||
|
template<typename T, int N>
|
||||||
|
T Statement::getColumns()
|
||||||
|
{
|
||||||
|
checkRow();
|
||||||
|
checkIndex(N - 1);
|
||||||
|
return getColumns<T>(std::make_integer_sequence<int, N>{});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper function called by getColums<typename T, int N>
|
||||||
|
template<typename T, const int... Is>
|
||||||
|
T Statement::getColumns(const std::integer_sequence<int, Is...>)
|
||||||
|
{
|
||||||
|
return T(Column(mStmtPtr, Is)...);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace SQLite
|
440
3rd-party/SRombauts-SQLiteCpp-f69986a/include/SQLiteCpp/Database.h
vendored
Normal file
440
3rd-party/SRombauts-SQLiteCpp-f69986a/include/SQLiteCpp/Database.h
vendored
Normal file
@@ -0,0 +1,440 @@
|
|||||||
|
/**
|
||||||
|
* @file Database.h
|
||||||
|
* @ingroup SQLiteCpp
|
||||||
|
* @brief Management of a SQLite Database Connection.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <SQLiteCpp/Column.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
// Forward declarations to avoid inclusion of <sqlite3.h> in a header
|
||||||
|
struct sqlite3;
|
||||||
|
struct sqlite3_context;
|
||||||
|
struct Mem;
|
||||||
|
typedef struct Mem sqlite3_value;
|
||||||
|
|
||||||
|
|
||||||
|
namespace SQLite
|
||||||
|
{
|
||||||
|
|
||||||
|
// Those public constants enable most usages of SQLiteCpp without including <sqlite3.h> in the client application.
|
||||||
|
|
||||||
|
/// The database is opened in read-only mode. If the database does not already exist, an error is returned.
|
||||||
|
extern const int OPEN_READONLY; // SQLITE_OPEN_READONLY
|
||||||
|
/// The database is opened for reading and writing if possible, or reading only if the file is write protected
|
||||||
|
/// by the operating system. In either case the database must already exist, otherwise an error is returned.
|
||||||
|
extern const int OPEN_READWRITE; // SQLITE_OPEN_READWRITE
|
||||||
|
/// With OPEN_READWRITE: The database is opened for reading and writing, and is created if it does not already exist.
|
||||||
|
extern const int OPEN_CREATE; // SQLITE_OPEN_CREATE
|
||||||
|
|
||||||
|
/// Enable URI filename interpretation, parsed according to RFC 3986 (ex. "file:data.db?mode=ro&cache=private")
|
||||||
|
extern const int OPEN_URI; // SQLITE_OPEN_URI
|
||||||
|
|
||||||
|
extern const int OK; ///< SQLITE_OK (used by inline check() bellow)
|
||||||
|
|
||||||
|
extern const char* VERSION; ///< SQLITE_VERSION string from the sqlite3.h used at compile time
|
||||||
|
extern const int VERSION_NUMBER; ///< SQLITE_VERSION_NUMBER from the sqlite3.h used at compile time
|
||||||
|
|
||||||
|
/// Return SQLite version string using runtime call to the compiled library
|
||||||
|
const char* getLibVersion() noexcept; // nothrow
|
||||||
|
/// Return SQLite version number using runtime call to the compiled library
|
||||||
|
int getLibVersionNumber() noexcept; // nothrow
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief RAII management of a SQLite Database Connection.
|
||||||
|
*
|
||||||
|
* A Database object manage a list of all SQLite Statements associated with the
|
||||||
|
* underlying SQLite 3 database connection.
|
||||||
|
*
|
||||||
|
* Resource Acquisition Is Initialization (RAII) means that the Database Connection
|
||||||
|
* is opened in the constructor and closed in the destructor, so that there is
|
||||||
|
* no need to worry about memory management or the validity of the underlying SQLite Connection.
|
||||||
|
*
|
||||||
|
* Thread-safety: a Database object shall not be shared by multiple threads, because :
|
||||||
|
* 1) in the SQLite "Thread Safe" mode, "SQLite can be safely used by multiple threads
|
||||||
|
* provided that no single database connection is used simultaneously in two or more threads."
|
||||||
|
* 2) the SQLite "Serialized" mode is not supported by SQLiteC++,
|
||||||
|
* because of the way it shares the underling SQLite precompiled statement
|
||||||
|
* in a custom shared pointer (See the inner class "Statement::Ptr").
|
||||||
|
*/
|
||||||
|
class Database
|
||||||
|
{
|
||||||
|
friend class Statement; // Give Statement constructor access to the mpSQLite Connection Handle
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Open the provided database UTF-8 filename.
|
||||||
|
*
|
||||||
|
* Uses sqlite3_open_v2() with readonly default flag, which is the opposite behavior
|
||||||
|
* of the old sqlite3_open() function (READWRITE+CREATE).
|
||||||
|
* This makes sense if you want to use it on a readonly filesystem
|
||||||
|
* or to prevent creation of a void file when a required file is missing.
|
||||||
|
*
|
||||||
|
* Exception is thrown in case of error, then the Database object is NOT constructed.
|
||||||
|
*
|
||||||
|
* @param[in] apFilename UTF-8 path/uri to the database file ("filename" sqlite3 parameter)
|
||||||
|
* @param[in] aFlags SQLite::OPEN_READONLY/SQLite::OPEN_READWRITE/SQLite::OPEN_CREATE...
|
||||||
|
* @param[in] aBusyTimeoutMs Amount of milliseconds to wait before returning SQLITE_BUSY (see setBusyTimeout())
|
||||||
|
* @param[in] apVfs UTF-8 name of custom VFS to use, or nullptr for sqlite3 default
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
Database(const char* apFilename,
|
||||||
|
const int aFlags = SQLite::OPEN_READONLY,
|
||||||
|
const int aBusyTimeoutMs = 0,
|
||||||
|
const char* apVfs = NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Open the provided database UTF-8 filename.
|
||||||
|
*
|
||||||
|
* Uses sqlite3_open_v2() with readonly default flag, which is the opposite behavior
|
||||||
|
* of the old sqlite3_open() function (READWRITE+CREATE).
|
||||||
|
* This makes sense if you want to use it on a readonly filesystem
|
||||||
|
* or to prevent creation of a void file when a required file is missing.
|
||||||
|
*
|
||||||
|
* Exception is thrown in case of error, then the Database object is NOT constructed.
|
||||||
|
*
|
||||||
|
* @param[in] aFilename UTF-8 path/uri to the database file ("filename" sqlite3 parameter)
|
||||||
|
* @param[in] aFlags SQLite::OPEN_READONLY/SQLite::OPEN_READWRITE/SQLite::OPEN_CREATE...
|
||||||
|
* @param[in] aBusyTimeoutMs Amount of milliseconds to wait before returning SQLITE_BUSY (see setBusyTimeout())
|
||||||
|
* @param[in] aVfs UTF-8 name of custom VFS to use, or empty string for sqlite3 default
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
Database(const std::string& aFilename,
|
||||||
|
const int aFlags = SQLite::OPEN_READONLY,
|
||||||
|
const int aBusyTimeoutMs = 0,
|
||||||
|
const std::string& aVfs = "");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Close the SQLite database connection.
|
||||||
|
*
|
||||||
|
* All SQLite statements must have been finalized before,
|
||||||
|
* so all Statement objects must have been unregistered.
|
||||||
|
*
|
||||||
|
* @warning assert in case of error
|
||||||
|
*/
|
||||||
|
virtual ~Database() noexcept; // nothrow
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set a busy handler that sleeps for a specified amount of time when a table is locked.
|
||||||
|
*
|
||||||
|
* This is useful in multithreaded program to handle case where a table is locked for writing by a thread.
|
||||||
|
* Any other thread cannot access the table and will receive a SQLITE_BUSY error:
|
||||||
|
* setting a timeout will wait and retry up to the time specified before returning this SQLITE_BUSY error.
|
||||||
|
* Reading the value of timeout for current connection can be done with SQL query "PRAGMA busy_timeout;".
|
||||||
|
* Default busy timeout is 0ms.
|
||||||
|
*
|
||||||
|
* @param[in] aBusyTimeoutMs Amount of milliseconds to wait before returning SQLITE_BUSY
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
void setBusyTimeout(const int aBusyTimeoutMs) noexcept; // nothrow
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Shortcut to execute one or multiple statements without results.
|
||||||
|
*
|
||||||
|
* This is useful for any kind of statements other than the Data Query Language (DQL) "SELECT" :
|
||||||
|
* - Data Manipulation Language (DML) statements "INSERT", "UPDATE" and "DELETE"
|
||||||
|
* - Data Definition Language (DDL) statements "CREATE", "ALTER" and "DROP"
|
||||||
|
* - Data Control Language (DCL) statements "GRANT", "REVOKE", "COMMIT" and "ROLLBACK"
|
||||||
|
*
|
||||||
|
* @see Statement::exec() to handle precompiled statements (for better performances) without results
|
||||||
|
* @see Statement::executeStep() to handle "SELECT" queries with results
|
||||||
|
*
|
||||||
|
* @param[in] apQueries one or multiple UTF-8 encoded, semicolon-separate SQL statements
|
||||||
|
*
|
||||||
|
* @return number of rows modified by the *last* INSERT, UPDATE or DELETE statement (beware of multiple statements)
|
||||||
|
* @warning undefined for CREATE or DROP table: returns the value of a previous INSERT, UPDATE or DELETE statement.
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
int exec(const char* apQueries);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Shortcut to execute one or multiple statements without results.
|
||||||
|
*
|
||||||
|
* This is useful for any kind of statements other than the Data Query Language (DQL) "SELECT" :
|
||||||
|
* - Data Manipulation Language (DML) statements "INSERT", "UPDATE" and "DELETE"
|
||||||
|
* - Data Definition Language (DDL) statements "CREATE", "ALTER" and "DROP"
|
||||||
|
* - Data Control Language (DCL) statements "GRANT", "REVOKE", "COMMIT" and "ROLLBACK"
|
||||||
|
*
|
||||||
|
* @see Statement::exec() to handle precompiled statements (for better performances) without results
|
||||||
|
* @see Statement::executeStep() to handle "SELECT" queries with results
|
||||||
|
*
|
||||||
|
* @param[in] aQueries one or multiple UTF-8 encoded, semicolon-separate SQL statements
|
||||||
|
*
|
||||||
|
* @return number of rows modified by the *last* INSERT, UPDATE or DELETE statement (beware of multiple statements)
|
||||||
|
* @warning undefined for CREATE or DROP table: returns the value of a previous INSERT, UPDATE or DELETE statement.
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
inline int exec(const std::string& aQueries)
|
||||||
|
{
|
||||||
|
return exec(aQueries.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Shortcut to execute a one step query and fetch the first column of the result.
|
||||||
|
*
|
||||||
|
* This is a shortcut to execute a simple statement with a single result.
|
||||||
|
* This should be used only for non reusable queries (else you should use a Statement with bind()).
|
||||||
|
* This should be used only for queries with expected results (else an exception is fired).
|
||||||
|
*
|
||||||
|
* @warning WARNING: Be very careful with this dangerous method: you have to
|
||||||
|
* make a COPY OF THE result, else it will be destroy before the next line
|
||||||
|
* (when the underlying temporary Statement and Column objects are destroyed)
|
||||||
|
*
|
||||||
|
* @see also Statement class for handling queries with multiple results
|
||||||
|
*
|
||||||
|
* @param[in] apQuery an UTF-8 encoded SQL query
|
||||||
|
*
|
||||||
|
* @return a temporary Column object with the first column of result.
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
Column execAndGet(const char* apQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Shortcut to execute a one step query and fetch the first column of the result.
|
||||||
|
*
|
||||||
|
* This is a shortcut to execute a simple statement with a single result.
|
||||||
|
* This should be used only for non reusable queries (else you should use a Statement with bind()).
|
||||||
|
* This should be used only for queries with expected results (else an exception is fired).
|
||||||
|
*
|
||||||
|
* @warning WARNING: Be very careful with this dangerous method: you have to
|
||||||
|
* make a COPY OF THE result, else it will be destroy before the next line
|
||||||
|
* (when the underlying temporary Statement and Column objects are destroyed)
|
||||||
|
*
|
||||||
|
* @see also Statement class for handling queries with multiple results
|
||||||
|
*
|
||||||
|
* @param[in] aQuery an UTF-8 encoded SQL query
|
||||||
|
*
|
||||||
|
* @return a temporary Column object with the first column of result.
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
inline Column execAndGet(const std::string& aQuery)
|
||||||
|
{
|
||||||
|
return execAndGet(aQuery.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Shortcut to test if a table exists.
|
||||||
|
*
|
||||||
|
* Table names are case sensitive.
|
||||||
|
*
|
||||||
|
* @param[in] apTableName an UTF-8 encoded case sensitive Table name
|
||||||
|
*
|
||||||
|
* @return true if the table exists.
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
bool tableExists(const char* apTableName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Shortcut to test if a table exists.
|
||||||
|
*
|
||||||
|
* Table names are case sensitive.
|
||||||
|
*
|
||||||
|
* @param[in] aTableName an UTF-8 encoded case sensitive Table name
|
||||||
|
*
|
||||||
|
* @return true if the table exists.
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
inline bool tableExists(const std::string& aTableName)
|
||||||
|
{
|
||||||
|
return tableExists(aTableName.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the rowid of the most recent successful INSERT into the database from the current connection.
|
||||||
|
*
|
||||||
|
* Each entry in an SQLite table always has a unique 64-bit signed integer key called the rowid.
|
||||||
|
* If the table has a column of type INTEGER PRIMARY KEY, then it is an alias for the rowid.
|
||||||
|
*
|
||||||
|
* @return Rowid of the most recent successful INSERT into the database, or 0 if there was none.
|
||||||
|
*/
|
||||||
|
long long getLastInsertRowid() const noexcept; // nothrow
|
||||||
|
|
||||||
|
/// Get total number of rows modified by all INSERT, UPDATE or DELETE statement since connection (not DROP table).
|
||||||
|
int getTotalChanges() const noexcept; // nothrow
|
||||||
|
|
||||||
|
/// Return the numeric result code for the most recent failed API call (if any).
|
||||||
|
int getErrorCode() const noexcept; // nothrow
|
||||||
|
/// Return the extended numeric result code for the most recent failed API call (if any).
|
||||||
|
int getExtendedErrorCode() const noexcept; // nothrow
|
||||||
|
/// Return UTF-8 encoded English language explanation of the most recent failed API call (if any).
|
||||||
|
const char* getErrorMsg() const noexcept; // nothrow
|
||||||
|
|
||||||
|
/// Return the filename used to open the database.
|
||||||
|
const std::string& getFilename() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return mFilename;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return raw pointer to SQLite Database Connection Handle.
|
||||||
|
*
|
||||||
|
* This is often needed to mix this wrapper with other libraries or for advance usage not supported by SQLiteCpp.
|
||||||
|
*/
|
||||||
|
inline sqlite3* getHandle() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return mpSQLite;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Create or redefine a SQL function or aggregate in the sqlite database.
|
||||||
|
*
|
||||||
|
* This is the equivalent of the sqlite3_create_function_v2 command.
|
||||||
|
* @see http://www.sqlite.org/c3ref/create_function.html
|
||||||
|
*
|
||||||
|
* @note UTF-8 text encoding assumed.
|
||||||
|
*
|
||||||
|
* @param[in] apFuncName Name of the SQL function to be created or redefined
|
||||||
|
* @param[in] aNbArg Number of arguments in the function
|
||||||
|
* @param[in] abDeterministic Optimize for deterministic functions (most are). A random number generator is not.
|
||||||
|
* @param[in] apApp Arbitrary pointer of user data, accessible with sqlite3_user_data().
|
||||||
|
* @param[in] apFunc Pointer to a C-function to implement a scalar SQL function (apStep & apFinal NULL)
|
||||||
|
* @param[in] apStep Pointer to a C-function to implement an aggregate SQL function (apFunc NULL)
|
||||||
|
* @param[in] apFinal Pointer to a C-function to implement an aggregate SQL function (apFunc NULL)
|
||||||
|
* @param[in] apDestroy If not NULL, then it is the destructor for the application data pointer.
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
void createFunction(const char* apFuncName,
|
||||||
|
int aNbArg,
|
||||||
|
bool abDeterministic,
|
||||||
|
void* apApp,
|
||||||
|
void (*apFunc)(sqlite3_context *, int, sqlite3_value **),
|
||||||
|
void (*apStep)(sqlite3_context *, int, sqlite3_value **),
|
||||||
|
void (*apFinal)(sqlite3_context *), // NOLINT(readability/casting)
|
||||||
|
void (*apDestroy)(void *));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Create or redefine a SQL function or aggregate in the sqlite database.
|
||||||
|
*
|
||||||
|
* This is the equivalent of the sqlite3_create_function_v2 command.
|
||||||
|
* @see http://www.sqlite.org/c3ref/create_function.html
|
||||||
|
*
|
||||||
|
* @note UTF-8 text encoding assumed.
|
||||||
|
*
|
||||||
|
* @param[in] aFuncName Name of the SQL function to be created or redefined
|
||||||
|
* @param[in] aNbArg Number of arguments in the function
|
||||||
|
* @param[in] abDeterministic Optimize for deterministic functions (most are). A random number generator is not.
|
||||||
|
* @param[in] apApp Arbitrary pointer of user data, accessible with sqlite3_user_data().
|
||||||
|
* @param[in] apFunc Pointer to a C-function to implement a scalar SQL function (apStep & apFinal NULL)
|
||||||
|
* @param[in] apStep Pointer to a C-function to implement an aggregate SQL function (apFunc NULL)
|
||||||
|
* @param[in] apFinal Pointer to a C-function to implement an aggregate SQL function (apFunc NULL)
|
||||||
|
* @param[in] apDestroy If not NULL, then it is the destructor for the application data pointer.
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
inline void createFunction(const std::string& aFuncName,
|
||||||
|
int aNbArg,
|
||||||
|
bool abDeterministic,
|
||||||
|
void* apApp,
|
||||||
|
void (*apFunc)(sqlite3_context *, int, sqlite3_value **),
|
||||||
|
void (*apStep)(sqlite3_context *, int, sqlite3_value **),
|
||||||
|
void (*apFinal)(sqlite3_context *), // NOLINT(readability/casting)
|
||||||
|
void (*apDestroy)(void *))
|
||||||
|
{
|
||||||
|
return createFunction(aFuncName.c_str(), aNbArg, abDeterministic,
|
||||||
|
apApp, apFunc, apStep, apFinal, apDestroy);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Load a module into the current sqlite database instance.
|
||||||
|
*
|
||||||
|
* This is the equivalent of the sqlite3_load_extension call, but additionally enables
|
||||||
|
* module loading support prior to loading the requested module.
|
||||||
|
*
|
||||||
|
* @see http://www.sqlite.org/c3ref/load_extension.html
|
||||||
|
*
|
||||||
|
* @note UTF-8 text encoding assumed.
|
||||||
|
*
|
||||||
|
* @param[in] apExtensionName Name of the shared library containing extension
|
||||||
|
* @param[in] apEntryPointName Name of the entry point (NULL to let sqlite work it out)
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
void loadExtension(const char* apExtensionName, const char* apEntryPointName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the key for the current sqlite database instance.
|
||||||
|
*
|
||||||
|
* This is the equivalent of the sqlite3_key call and should thus be called
|
||||||
|
* directly after opening the database.
|
||||||
|
* Open encrypted database -> call db.key("secret") -> database ready
|
||||||
|
*
|
||||||
|
* @param[in] aKey Key to decode/encode the database
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
void key(const std::string& aKey) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reset the key for the current sqlite database instance.
|
||||||
|
*
|
||||||
|
* This is the equivalent of the sqlite3_rekey call and should thus be called
|
||||||
|
* after the database has been opened with a valid key. To decrypt a
|
||||||
|
* database, call this method with an empty string.
|
||||||
|
* Open normal database -> call db.rekey("secret") -> encrypted database, database ready
|
||||||
|
* Open encrypted database -> call db.key("secret") -> call db.rekey("newsecret") -> change key, database ready
|
||||||
|
* Open encrypted database -> call db.key("secret") -> call db.rekey("") -> decrypted database, database ready
|
||||||
|
*
|
||||||
|
* @param[in] aNewKey New key to encode the database
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
void rekey(const std::string& aNewKey) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Test if a file contains an unencrypted database.
|
||||||
|
*
|
||||||
|
* This is a simple test that reads the first bytes of a database file and
|
||||||
|
* compares them to the standard header for unencrypted databases. If the
|
||||||
|
* header does not match the standard string, we assume that we have an
|
||||||
|
* encrypted file.
|
||||||
|
*
|
||||||
|
* @param[in] aFilename path/uri to a file
|
||||||
|
*
|
||||||
|
* @return true if the database has the standard header.
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
static const bool isUnencrypted(const std::string& aFilename);
|
||||||
|
|
||||||
|
private:
|
||||||
|
/// @{ Database must be non-copyable
|
||||||
|
Database(const Database&);
|
||||||
|
Database& operator=(const Database&);
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check if aRet equal SQLITE_OK, else throw a SQLite::Exception with the SQLite error message
|
||||||
|
*/
|
||||||
|
inline void check(const int aRet) const
|
||||||
|
{
|
||||||
|
if (SQLite::OK != aRet)
|
||||||
|
{
|
||||||
|
throw SQLite::Exception(mpSQLite, aRet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
sqlite3* mpSQLite; ///< Pointer to SQLite Database Connection Handle
|
||||||
|
std::string mFilename; ///< UTF-8 filename used to open the database
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace SQLite
|
99
3rd-party/SRombauts-SQLiteCpp-f69986a/include/SQLiteCpp/Exception.h
vendored
Normal file
99
3rd-party/SRombauts-SQLiteCpp-f69986a/include/SQLiteCpp/Exception.h
vendored
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
/**
|
||||||
|
* @file Exception.h
|
||||||
|
* @ingroup SQLiteCpp
|
||||||
|
* @brief Encapsulation of the error message from SQLite3 on a std::runtime_error.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
// Forward declaration to avoid inclusion of <sqlite3.h> in a header
|
||||||
|
struct sqlite3;
|
||||||
|
|
||||||
|
/// Compatibility with non-clang compilers.
|
||||||
|
#ifndef __has_feature
|
||||||
|
#define __has_feature(x) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Detect whether the compiler supports C++11 noexcept exception specifications.
|
||||||
|
#if ( defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || (__GNUC__ > 4)) \
|
||||||
|
&& defined(__GXX_EXPERIMENTAL_CXX0X__))
|
||||||
|
// GCC 4.7 and following have noexcept
|
||||||
|
#elif defined(__clang__) && __has_feature(cxx_noexcept)
|
||||||
|
// Clang 3.0 and above have noexcept
|
||||||
|
#elif defined(_MSC_VER) && _MSC_VER > 1800
|
||||||
|
// Visual Studio 2015 and above have noexcept
|
||||||
|
#else
|
||||||
|
// Visual Studio 2013 does not support noexcept, and "throw()" is deprecated by C++11
|
||||||
|
#define noexcept
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
namespace SQLite
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Encapsulation of the error message from SQLite3, based on std::runtime_error.
|
||||||
|
*/
|
||||||
|
class Exception : public std::runtime_error
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Encapsulation of the error message from SQLite3, based on std::runtime_error.
|
||||||
|
*
|
||||||
|
* @param[in] aErrorMessage The string message describing the SQLite error
|
||||||
|
*/
|
||||||
|
explicit Exception(const std::string& aErrorMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Encapsulation of the error message from SQLite3, based on std::runtime_error.
|
||||||
|
*
|
||||||
|
* @param[in] aErrorMessage The string message describing the SQLite error
|
||||||
|
* @param[in] ret Return value from function call that failed.
|
||||||
|
*/
|
||||||
|
Exception(const std::string& aErrorMessage, int ret);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Encapsulation of the error message from SQLite3, based on std::runtime_error.
|
||||||
|
*
|
||||||
|
* @param[in] apSQLite The SQLite object, to obtain detailed error messages from.
|
||||||
|
*/
|
||||||
|
explicit Exception(sqlite3* apSQLite);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Encapsulation of the error message from SQLite3, based on std::runtime_error.
|
||||||
|
*
|
||||||
|
* @param[in] apSQLite The SQLite object, to obtain detailed error messages from.
|
||||||
|
* @param[in] ret Return value from function call that failed.
|
||||||
|
*/
|
||||||
|
Exception(sqlite3* apSQLite, int ret);
|
||||||
|
|
||||||
|
/// Return the result code (if any, otherwise -1).
|
||||||
|
inline int getErrorCode() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return mErrcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Return the extended numeric result code (if any, otherwise -1).
|
||||||
|
inline int getExtendedErrorCode() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return mExtendedErrcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Return a string, solely based on the error code
|
||||||
|
const char* getErrorStr() const noexcept; // nothrow
|
||||||
|
|
||||||
|
private:
|
||||||
|
const int mErrcode; ///< Error code value
|
||||||
|
const int mExtendedErrcode; ///< Detailed error code if any
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace SQLite
|
42
3rd-party/SRombauts-SQLiteCpp-f69986a/include/SQLiteCpp/SQLiteCpp.h
vendored
Normal file
42
3rd-party/SRombauts-SQLiteCpp-f69986a/include/SQLiteCpp/SQLiteCpp.h
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* @file SQLiteCpp.h
|
||||||
|
* @ingroup SQLiteCpp
|
||||||
|
* @brief SQLiteC++ is a smart and simple C++ SQLite3 wrapper. This file is only "easy include" for other files.
|
||||||
|
*
|
||||||
|
* Include this main header file in your project to gain access to all functionality provided by the wrapper.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @defgroup SQLiteCpp SQLiteC++
|
||||||
|
* @brief SQLiteC++ is a smart and simple C++ SQLite3 wrapper. This file is only "easy include" for other files.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
// Include useful headers of SQLiteC++
|
||||||
|
#include <SQLiteCpp/Assertion.h>
|
||||||
|
#include <SQLiteCpp/Exception.h>
|
||||||
|
#include <SQLiteCpp/Database.h>
|
||||||
|
#include <SQLiteCpp/Statement.h>
|
||||||
|
#include <SQLiteCpp/Column.h>
|
||||||
|
#include <SQLiteCpp/Transaction.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Version numbers for SQLiteC++ are provided in the same way as sqlite3.h
|
||||||
|
*
|
||||||
|
* The [SQLITECPP_VERSION] C preprocessor macro in the SQLiteC++.h header
|
||||||
|
* evaluates to a string literal that is the SQLite version in the
|
||||||
|
* format "X.Y.Z" where X is the major version number
|
||||||
|
* and Y is the minor version number and Z is the release number.
|
||||||
|
*
|
||||||
|
* The [SQLITECPP_VERSION_NUMBER] C preprocessor macro resolves to an integer
|
||||||
|
* with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same
|
||||||
|
* numbers used in [SQLITECPP_VERSION].
|
||||||
|
*/
|
||||||
|
#define SQLITECPP_VERSION "2.00.00" // 2.0.0
|
||||||
|
#define SQLITECPP_VERSION_NUMBER 2000000 // 2.0.0
|
648
3rd-party/SRombauts-SQLiteCpp-f69986a/include/SQLiteCpp/Statement.h
vendored
Normal file
648
3rd-party/SRombauts-SQLiteCpp-f69986a/include/SQLiteCpp/Statement.h
vendored
Normal file
@@ -0,0 +1,648 @@
|
|||||||
|
/**
|
||||||
|
* @file Statement.h
|
||||||
|
* @ingroup SQLiteCpp
|
||||||
|
* @brief A prepared SQLite Statement is a compiled SQL query ready to be executed, pointing to a row of result.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <SQLiteCpp/Exception.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
// Forward declarations to avoid inclusion of <sqlite3.h> in a header
|
||||||
|
struct sqlite3;
|
||||||
|
struct sqlite3_stmt;
|
||||||
|
|
||||||
|
|
||||||
|
namespace SQLite
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// Forward declaration
|
||||||
|
class Database;
|
||||||
|
class Column;
|
||||||
|
|
||||||
|
extern const int OK; ///< SQLITE_OK
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief RAII encapsulation of a prepared SQLite Statement.
|
||||||
|
*
|
||||||
|
* A Statement is a compiled SQL query ready to be executed step by step
|
||||||
|
* to provide results one row at a time.
|
||||||
|
*
|
||||||
|
* Resource Acquisition Is Initialization (RAII) means that the Statement
|
||||||
|
* is compiled in the constructor and finalized in the destructor, so that there is
|
||||||
|
* no need to worry about memory management or the validity of the underlying SQLite Statement.
|
||||||
|
*
|
||||||
|
* Thread-safety: a Statement object shall not be shared by multiple threads, because :
|
||||||
|
* 1) in the SQLite "Thread Safe" mode, "SQLite can be safely used by multiple threads
|
||||||
|
* provided that no single database connection is used simultaneously in two or more threads."
|
||||||
|
* 2) the SQLite "Serialized" mode is not supported by SQLiteC++,
|
||||||
|
* because of the way it shares the underling SQLite precompiled statement
|
||||||
|
* in a custom shared pointer (See the inner class "Statement::Ptr").
|
||||||
|
*/
|
||||||
|
class Statement
|
||||||
|
{
|
||||||
|
friend class Column; // For access to Statement::Ptr inner class
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Compile and register the SQL query for the provided SQLite Database Connection
|
||||||
|
*
|
||||||
|
* @param[in] aDatabase the SQLite Database Connection
|
||||||
|
* @param[in] apQuery an UTF-8 encoded query string
|
||||||
|
*
|
||||||
|
* Exception is thrown in case of error, then the Statement object is NOT constructed.
|
||||||
|
*/
|
||||||
|
Statement(Database& aDatabase, const char* apQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Compile and register the SQL query for the provided SQLite Database Connection
|
||||||
|
*
|
||||||
|
* @param[in] aDatabase the SQLite Database Connection
|
||||||
|
* @param[in] aQuery an UTF-8 encoded query string
|
||||||
|
*
|
||||||
|
* Exception is thrown in case of error, then the Statement object is NOT constructed.
|
||||||
|
*/
|
||||||
|
Statement(Database& aDatabase, const std::string& aQuery);
|
||||||
|
|
||||||
|
/// Finalize and unregister the SQL query from the SQLite Database Connection.
|
||||||
|
virtual ~Statement() noexcept; // nothrow
|
||||||
|
|
||||||
|
/// Reset the statement to make it ready for a new execution.
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clears away all the bindings of a prepared statement.
|
||||||
|
*
|
||||||
|
* Contrary to the intuition of many, reset() does not reset the bindings on a prepared statement.
|
||||||
|
* Use this routine to reset all parameters to NULL.
|
||||||
|
*/
|
||||||
|
void clearBindings(); // throw(SQLite::Exception)
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Bind a value to a parameter of the SQL statement,
|
||||||
|
// in the form "?" (unnamed), "?NNN", ":VVV", "@VVV" or "$VVV".
|
||||||
|
//
|
||||||
|
// Can use the parameter index, starting from "1", to the higher NNN value,
|
||||||
|
// or the complete parameter name "?NNN", ":VVV", "@VVV" or "$VVV"
|
||||||
|
// (prefixed with the corresponding sign "?", ":", "@" or "$")
|
||||||
|
//
|
||||||
|
// Note that for text and blob values, the SQLITE_TRANSIENT flag is used,
|
||||||
|
// which tell the sqlite library to make its own copy of the data before the bind() call returns.
|
||||||
|
// This choice is done to prevent any common misuses, like passing a pointer to a
|
||||||
|
// dynamic allocated and temporary variable (a std::string for instance).
|
||||||
|
// This is under-optimized for static data (a static text define in code)
|
||||||
|
// as well as for dynamic allocated buffer which could be transfer to sqlite
|
||||||
|
// instead of being copied.
|
||||||
|
// => if you know what you are doing, use bindNoCopy() instead of bind()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Bind an int value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*/
|
||||||
|
void bind(const int aIndex, const int aValue);
|
||||||
|
/**
|
||||||
|
* @brief Bind a 32bits unsigned int value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*/
|
||||||
|
void bind(const int aIndex, const unsigned aValue);
|
||||||
|
/**
|
||||||
|
* @brief Bind a 64bits int value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*/
|
||||||
|
void bind(const int aIndex, const long long aValue);
|
||||||
|
/**
|
||||||
|
* @brief Bind a double (64bits float) value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*/
|
||||||
|
void bind(const int aIndex, const double aValue);
|
||||||
|
/**
|
||||||
|
* @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*
|
||||||
|
* @note 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 text value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*
|
||||||
|
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
|
||||||
|
*/
|
||||||
|
void bind(const int aIndex, const char* apValue);
|
||||||
|
/**
|
||||||
|
* @brief Bind a binary blob value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*
|
||||||
|
* @note 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 string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1).
|
||||||
|
*
|
||||||
|
* The string can contain null characters as it is binded using its size.
|
||||||
|
*
|
||||||
|
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged 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)
|
||||||
|
*
|
||||||
|
* Main usage is with null-terminated literal text (aka in code static strings)
|
||||||
|
*
|
||||||
|
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
|
||||||
|
*/
|
||||||
|
void bindNoCopy(const int aIndex, const char* apValue);
|
||||||
|
/**
|
||||||
|
* @brief Bind a binary blob value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*
|
||||||
|
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged 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)
|
||||||
|
*
|
||||||
|
* @see clearBindings() to set all bound parameters to NULL.
|
||||||
|
*/
|
||||||
|
void bind(const int aIndex);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Bind an int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*/
|
||||||
|
void bind(const char* apName, const int aValue);
|
||||||
|
/**
|
||||||
|
* @brief Bind a 32bits unsigned int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*/
|
||||||
|
void bind(const char* apName, const unsigned aValue);
|
||||||
|
/**
|
||||||
|
* @brief Bind a 64bits int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*/
|
||||||
|
void bind(const char* apName, const long long aValue);
|
||||||
|
/**
|
||||||
|
* @brief Bind a double (64bits float) value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*/
|
||||||
|
void bind(const char* apName, const double aValue);
|
||||||
|
/**
|
||||||
|
* @brief Bind a string value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*
|
||||||
|
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
|
||||||
|
*/
|
||||||
|
void bind(const char* apName, const std::string& aValue);
|
||||||
|
/**
|
||||||
|
* @brief Bind a text value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*
|
||||||
|
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
|
||||||
|
*/
|
||||||
|
void bind(const char* apName, const char* apValue);
|
||||||
|
/**
|
||||||
|
* @brief Bind a binary blob value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*
|
||||||
|
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
|
||||||
|
*/
|
||||||
|
void bind(const char* apName, const void* apValue, const int aSize);
|
||||||
|
/**
|
||||||
|
* @brief Bind a string value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*
|
||||||
|
* The string can contain null characters as it is binded using its size.
|
||||||
|
*
|
||||||
|
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
|
||||||
|
*/
|
||||||
|
void bindNoCopy(const char* apName, const std::string& aValue);
|
||||||
|
/**
|
||||||
|
* @brief Bind a text value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*
|
||||||
|
* Main usage is with null-terminated literal text (aka in code static strings)
|
||||||
|
*
|
||||||
|
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
|
||||||
|
*/
|
||||||
|
void bindNoCopy(const char* apName, const char* apValue);
|
||||||
|
/**
|
||||||
|
* @brief Bind a binary blob value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*
|
||||||
|
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
|
||||||
|
*/
|
||||||
|
void bindNoCopy(const char* apName, const void* apValue, const int aSize);
|
||||||
|
/**
|
||||||
|
* @brief Bind a NULL value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*
|
||||||
|
* @see clearBindings() to set all bound parameters to NULL.
|
||||||
|
*/
|
||||||
|
void bind(const char* apName); // bind NULL value
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Bind an int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*/
|
||||||
|
inline void bind(const std::string& aName, const int aValue)
|
||||||
|
{
|
||||||
|
bind(aName.c_str(), aValue);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Bind a 32bits unsigned int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*/
|
||||||
|
inline void bind(const std::string& aName, const unsigned aValue)
|
||||||
|
{
|
||||||
|
bind(aName.c_str(), aValue);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Bind a 64bits int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*/
|
||||||
|
inline void bind(const std::string& aName, const long long aValue)
|
||||||
|
{
|
||||||
|
bind(aName.c_str(), aValue);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Bind a double (64bits float) value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*/
|
||||||
|
inline void bind(const std::string& aName, const double aValue)
|
||||||
|
{
|
||||||
|
bind(aName.c_str(), aValue);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Bind a string value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*
|
||||||
|
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
|
||||||
|
*/
|
||||||
|
inline void bind(const std::string& aName, const std::string& aValue)
|
||||||
|
{
|
||||||
|
bind(aName.c_str(), aValue);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Bind a text value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*
|
||||||
|
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
|
||||||
|
*/
|
||||||
|
inline void bind(const std::string& aName, const char* apValue)
|
||||||
|
{
|
||||||
|
bind(aName.c_str(), apValue);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Bind a binary blob value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*
|
||||||
|
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
|
||||||
|
*/
|
||||||
|
inline void bind(const std::string& aName, const void* apValue, const int aSize)
|
||||||
|
{
|
||||||
|
bind(aName.c_str(), apValue, aSize);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Bind a string value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*
|
||||||
|
* The string can contain null characters as it is binded using its size.
|
||||||
|
*
|
||||||
|
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
|
||||||
|
*/
|
||||||
|
inline void bindNoCopy(const std::string& aName, const std::string& aValue)
|
||||||
|
{
|
||||||
|
bindNoCopy(aName.c_str(), aValue);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Bind a text value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*
|
||||||
|
* Main usage is with null-terminated literal text (aka in code static strings)
|
||||||
|
*
|
||||||
|
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
|
||||||
|
*/
|
||||||
|
inline void bindNoCopy(const std::string& aName, const char* apValue)
|
||||||
|
{
|
||||||
|
bindNoCopy(aName.c_str(), apValue);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Bind a binary blob value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*
|
||||||
|
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
|
||||||
|
*/
|
||||||
|
inline void bindNoCopy(const std::string& aName, const void* apValue, const int aSize)
|
||||||
|
{
|
||||||
|
bindNoCopy(aName.c_str(), apValue, aSize);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Bind a NULL value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
|
||||||
|
*
|
||||||
|
* @see clearBindings() to set all bound parameters to NULL.
|
||||||
|
*/
|
||||||
|
inline void bind(const std::string& aName) // bind NULL value
|
||||||
|
{
|
||||||
|
bind(aName.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Execute a step of the prepared query to fetch one row of results.
|
||||||
|
*
|
||||||
|
* While true is returned, a row of results is available, and can be accessed
|
||||||
|
* thru the getColumn() method
|
||||||
|
*
|
||||||
|
* @see exec() execute a one-step prepared statement with no expected result
|
||||||
|
* @see Database::exec() is a shortcut to execute one or multiple statements without results
|
||||||
|
*
|
||||||
|
* @return - true (SQLITE_ROW) if there is another row ready : you can call getColumn(N) to get it
|
||||||
|
* then you have to call executeStep() again to fetch more rows until the query is finished
|
||||||
|
* - false (SQLITE_DONE) if the query has finished executing : there is no (more) row of result
|
||||||
|
* (case of a query with no result, or after N rows fetched successfully)
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
bool executeStep();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Execute a one-step query with no expected result.
|
||||||
|
*
|
||||||
|
* This method is useful for any kind of statements other than the Data Query Language (DQL) "SELECT" :
|
||||||
|
* - Data Definition Language (DDL) statements "CREATE", "ALTER" and "DROP"
|
||||||
|
* - Data Manipulation Language (DML) statements "INSERT", "UPDATE" and "DELETE"
|
||||||
|
* - Data Control Language (DCL) statements "GRANT", "REVOKE", "COMMIT" and "ROLLBACK"
|
||||||
|
*
|
||||||
|
* It is similar to Database::exec(), but using a precompiled statement, it adds :
|
||||||
|
* - the ability to bind() arguments to it (best way to insert data),
|
||||||
|
* - reusing it allows for better performances (efficient for multiple insertion).
|
||||||
|
*
|
||||||
|
* @see executeStep() execute a step of the prepared query to fetch one row of results
|
||||||
|
* @see Database::exec() is a shortcut to execute one or multiple statements without results
|
||||||
|
*
|
||||||
|
* @return number of row modified by this SQL statement (INSERT, UPDATE or DELETE)
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error, or if row of results are returned !
|
||||||
|
*/
|
||||||
|
int exec();
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return a copy of the column data specified by its index
|
||||||
|
*
|
||||||
|
* Can be used to access the data of the current row of result when applicable,
|
||||||
|
* while the executeStep() method returns true.
|
||||||
|
*
|
||||||
|
* Throw an exception if there is no row to return a Column from:
|
||||||
|
* - if provided index is out of bound
|
||||||
|
* - before any executeStep() call
|
||||||
|
* - after the last executeStep() returned false
|
||||||
|
* - after a reset() call
|
||||||
|
*
|
||||||
|
* Throw an exception if the specified index is out of the [0, getColumnCount()) range.
|
||||||
|
*
|
||||||
|
* @param[in] aIndex Index of the column, starting at 0
|
||||||
|
*
|
||||||
|
* @note This method is not const, reflecting the fact that the returned Column object will
|
||||||
|
* share the ownership of the underlying sqlite3_stmt.
|
||||||
|
*
|
||||||
|
* @warning The resulting Column object must not be memorized "as-is".
|
||||||
|
* Is is only a wrapper around the current result row, so it is only valid
|
||||||
|
* while the row from the Statement remains valid, that is only until next executeStep() call.
|
||||||
|
* Thus, you should instead extract immediately its data (getInt(), getText()...)
|
||||||
|
* and use or copy this data for any later usage.
|
||||||
|
*/
|
||||||
|
Column getColumn(const int aIndex);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return a copy of the column data specified by its column name (less efficient than using an index)
|
||||||
|
*
|
||||||
|
* Can be used to access the data of the current row of result when applicable,
|
||||||
|
* while the executeStep() method returns true.
|
||||||
|
*
|
||||||
|
* Throw an exception if there is no row to return a Column from :
|
||||||
|
* - if provided name is not one of the aliased column names
|
||||||
|
* - before any executeStep() call
|
||||||
|
* - after the last executeStep() returned false
|
||||||
|
* - after a reset() call
|
||||||
|
*
|
||||||
|
* Throw an exception if the specified name is not an on of the aliased name of the columns in the result.
|
||||||
|
*
|
||||||
|
* @param[in] apName Aliased name of the column, that is, the named specified in the query (not the original name)
|
||||||
|
*
|
||||||
|
* @note Uses a map of column names to indexes, build on first call.
|
||||||
|
*
|
||||||
|
* @note This method is not const, reflecting the fact that the returned Column object will
|
||||||
|
* share the ownership of the underlying sqlite3_stmt.
|
||||||
|
*
|
||||||
|
* @warning The resulting Column object must not be memorized "as-is".
|
||||||
|
* Is is only a wrapper around the current result row, so it is only valid
|
||||||
|
* while the row from the Statement remains valid, that is only until next executeStep() call.
|
||||||
|
* Thus, you should instead extract immediately its data (getInt(), getText()...)
|
||||||
|
* and use or copy this data for any later usage.
|
||||||
|
*
|
||||||
|
* Throw an exception if the specified name is not one of the aliased name of the columns in the result.
|
||||||
|
*/
|
||||||
|
Column getColumn(const char* apName);
|
||||||
|
|
||||||
|
#if __cplusplus >= 201402L || (defined(_MSC_VER) && _MSC_VER >= 1900)
|
||||||
|
/**
|
||||||
|
* @brief Return an instance of T constructed from copies of the first N columns
|
||||||
|
*
|
||||||
|
* Can be used to access the data of the current row of result when applicable,
|
||||||
|
* while the executeStep() method returns true.
|
||||||
|
*
|
||||||
|
* Throw an exception if there is no row to return a Column from:
|
||||||
|
* - if provided column count is out of bound
|
||||||
|
* - before any executeStep() call
|
||||||
|
* - after the last executeStep() returned false
|
||||||
|
* - after a reset() call
|
||||||
|
*
|
||||||
|
* Throw an exception if the specified column count is out of the [0, getColumnCount()) range.
|
||||||
|
*
|
||||||
|
* @tparam T Object type to construct
|
||||||
|
* @tparam N Number of columns
|
||||||
|
*
|
||||||
|
* @note Requires std=C++14
|
||||||
|
*/
|
||||||
|
template<typename T, int N>
|
||||||
|
T getColumns();
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* @brief Helper function used by getColumns<typename T, int N> to expand an integer_sequence used to generate
|
||||||
|
* the required Column objects
|
||||||
|
*/
|
||||||
|
template<typename T, const int... Is>
|
||||||
|
T getColumns(const std::integer_sequence<int, Is...>);
|
||||||
|
|
||||||
|
public:
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Test if the column value is NULL
|
||||||
|
*
|
||||||
|
* @param[in] aIndex Index of the column, starting at 0
|
||||||
|
*
|
||||||
|
* @return true if the column value is NULL
|
||||||
|
*
|
||||||
|
* Throw an exception if the specified index is out of the [0, getColumnCount()) range.
|
||||||
|
*/
|
||||||
|
bool isColumnNull(const int aIndex) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Test if the column value is NULL
|
||||||
|
*
|
||||||
|
* @param[in] apName Aliased name of the column, that is, the named specified in the query (not the original name)
|
||||||
|
*
|
||||||
|
* @return true if the column value is NULL
|
||||||
|
*
|
||||||
|
* Throw an exception if the specified name is not one of the aliased name of the columns in the result.
|
||||||
|
*/
|
||||||
|
bool isColumnNull(const char* apName) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return a pointer to the named assigned to the specified result column (potentially aliased)
|
||||||
|
*
|
||||||
|
* @param[in] aIndex Index of the column in the range [0, getColumnCount()).
|
||||||
|
*
|
||||||
|
* @see getColumnOriginName() to get original column name (not aliased)
|
||||||
|
*
|
||||||
|
* Throw an exception if the specified index is out of the [0, getColumnCount()) range.
|
||||||
|
*/
|
||||||
|
const char* getColumnName(const int aIndex) const;
|
||||||
|
|
||||||
|
#ifdef SQLITE_ENABLE_COLUMN_METADATA
|
||||||
|
/**
|
||||||
|
* @brief Return a pointer to the table column name that is the origin of the specified result column
|
||||||
|
*
|
||||||
|
* Require definition of the SQLITE_ENABLE_COLUMN_METADATA preprocessor macro :
|
||||||
|
* - when building the SQLite library itself (which is the case for the Debian libsqlite3 binary for instance),
|
||||||
|
* - and also when compiling this wrapper.
|
||||||
|
*
|
||||||
|
* Throw an exception if the specified index is out of the [0, getColumnCount()) range.
|
||||||
|
*/
|
||||||
|
const char* getColumnOriginName(const int aIndex) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return the index of the specified (potentially aliased) column name
|
||||||
|
*
|
||||||
|
* @param[in] apName Aliased name of the column, that is, the named specified in the query (not the original name)
|
||||||
|
*
|
||||||
|
* @note Uses a map of column names to indexes, build on first call.
|
||||||
|
*
|
||||||
|
* Throw an exception if the specified name is not known.
|
||||||
|
*/
|
||||||
|
int getColumnIndex(const char* apName) const;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/// Return the UTF-8 SQL Query.
|
||||||
|
inline const std::string& getQuery() const
|
||||||
|
{
|
||||||
|
return mQuery;
|
||||||
|
}
|
||||||
|
/// Return the number of columns in the result set returned by the prepared statement
|
||||||
|
inline int getColumnCount() const
|
||||||
|
{
|
||||||
|
return mColumnCount;
|
||||||
|
}
|
||||||
|
/// true when a row has been fetched with executeStep()
|
||||||
|
inline bool isOk() const
|
||||||
|
{
|
||||||
|
return mbOk;
|
||||||
|
}
|
||||||
|
/// true when the last executeStep() had no more row to fetch
|
||||||
|
inline bool isDone() const
|
||||||
|
{
|
||||||
|
return mbDone;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Return the numeric result code for the most recent failed API call (if any).
|
||||||
|
int getErrorCode() const noexcept; // nothrow
|
||||||
|
/// Return the extended numeric result code for the most recent failed API call (if any).
|
||||||
|
int getExtendedErrorCode() const noexcept; // nothrow
|
||||||
|
/// Return UTF-8 encoded English language explanation of the most recent failed API call (if any).
|
||||||
|
const char* getErrorMsg() const noexcept; // nothrow
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* @brief Shared pointer to the sqlite3_stmt SQLite Statement Object.
|
||||||
|
*
|
||||||
|
* Manage the finalization of the sqlite3_stmt with a reference counter.
|
||||||
|
*
|
||||||
|
* This is a internal class, not part of the API (hence full documentation is in the cpp).
|
||||||
|
*/
|
||||||
|
class Ptr
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Prepare the statement and initialize its reference counter
|
||||||
|
Ptr(sqlite3* apSQLite, std::string& aQuery);
|
||||||
|
// Copy constructor increments the ref counter
|
||||||
|
Ptr(const Ptr& aPtr);
|
||||||
|
// Decrement the ref counter and finalize the sqlite3_stmt when it reaches 0
|
||||||
|
~Ptr() noexcept; // nothrow (no virtual destructor needed here)
|
||||||
|
|
||||||
|
/// Inline cast operator returning the pointer to SQLite Database Connection Handle
|
||||||
|
inline operator sqlite3*() const
|
||||||
|
{
|
||||||
|
return mpSQLite;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Inline cast operator returning the pointer to SQLite Statement Object
|
||||||
|
inline operator sqlite3_stmt*() const
|
||||||
|
{
|
||||||
|
return mpStmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/// @{ Unused/forbidden copy/assignment operator
|
||||||
|
Ptr& operator=(const Ptr& aPtr);
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
private:
|
||||||
|
sqlite3* mpSQLite; //!< Pointer to SQLite Database Connection Handle
|
||||||
|
sqlite3_stmt* mpStmt; //!< Pointer to SQLite Statement Object
|
||||||
|
unsigned int* mpRefCount; //!< Pointer to the heap allocated reference counter of the sqlite3_stmt
|
||||||
|
//!< (to share it with Column objects)
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
/// @{ Statement must be non-copyable
|
||||||
|
Statement(const Statement&);
|
||||||
|
Statement& operator=(const Statement&);
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check if a return code equals SQLITE_OK, else throw a SQLite::Exception with the SQLite error message
|
||||||
|
*
|
||||||
|
* @param[in] SQLite return code to test against the SQLITE_OK expected value
|
||||||
|
*/
|
||||||
|
inline void check(const int aRet) const
|
||||||
|
{
|
||||||
|
if (SQLite::OK != aRet)
|
||||||
|
{
|
||||||
|
throw SQLite::Exception(mStmtPtr, aRet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check if there is a row of result returnes by executeStep(), else throw a SQLite::Exception.
|
||||||
|
*/
|
||||||
|
inline void checkRow() const
|
||||||
|
{
|
||||||
|
if (false == mbOk)
|
||||||
|
{
|
||||||
|
throw SQLite::Exception("No row to get a column from. executeStep() was not called, or returned false.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check if there is a Column index is in the range of columns in the result.
|
||||||
|
*/
|
||||||
|
inline void checkIndex(const int aIndex) const
|
||||||
|
{
|
||||||
|
if ((aIndex < 0) || (aIndex >= mColumnCount))
|
||||||
|
{
|
||||||
|
throw SQLite::Exception("Column index out of range.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/// Map of columns index by name (mutable so getColumnIndex can be const)
|
||||||
|
typedef std::map<std::string, int> TColumnNames;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string mQuery; //!< UTF-8 SQL Query
|
||||||
|
Ptr mStmtPtr; //!< Shared Pointer to the prepared SQLite Statement Object
|
||||||
|
int mColumnCount; //!< Number of columns in the result of the prepared statement
|
||||||
|
mutable TColumnNames mColumnNames; //!< Map of columns index by name (mutable so getColumnIndex can be const)
|
||||||
|
bool mbOk; //!< true when a row has been fetched with executeStep()
|
||||||
|
bool mbDone; //!< true when the last executeStep() had no more row to fetch
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace SQLite
|
77
3rd-party/SRombauts-SQLiteCpp-f69986a/include/SQLiteCpp/Transaction.h
vendored
Normal file
77
3rd-party/SRombauts-SQLiteCpp-f69986a/include/SQLiteCpp/Transaction.h
vendored
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
/**
|
||||||
|
* @file Transaction.h
|
||||||
|
* @ingroup SQLiteCpp
|
||||||
|
* @brief A Transaction is way to group multiple SQL statements into an atomic secured operation.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <SQLiteCpp/Exception.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace SQLite
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// Forward declaration
|
||||||
|
class Database;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief RAII encapsulation of a SQLite Transaction.
|
||||||
|
*
|
||||||
|
* A Transaction is a way to group multiple SQL statements into an atomic secured operation;
|
||||||
|
* either it succeeds, with all the changes committed to the database file,
|
||||||
|
* or if it fails, all the changes are rolled back to the initial state.
|
||||||
|
*
|
||||||
|
* Resource Acquisition Is Initialization (RAII) means that the Transaction
|
||||||
|
* begins in the constructor and is rollbacked in the destructor, so that there is
|
||||||
|
* no need to worry about memory management or the validity of the underlying SQLite Connection.
|
||||||
|
*
|
||||||
|
* This method also offers big performances improvements compared to individually executed statements.
|
||||||
|
*
|
||||||
|
* Thread-safety: a Transaction object shall not be shared by multiple threads, because :
|
||||||
|
* 1) in the SQLite "Thread Safe" mode, "SQLite can be safely used by multiple threads
|
||||||
|
* provided that no single database connection is used simultaneously in two or more threads."
|
||||||
|
* 2) the SQLite "Serialized" mode is not supported by SQLiteC++,
|
||||||
|
* because of the way it shares the underling SQLite precompiled statement
|
||||||
|
* in a custom shared pointer (See the inner class "Statement::Ptr").
|
||||||
|
*/
|
||||||
|
class Transaction
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Begins the SQLite transaction
|
||||||
|
*
|
||||||
|
* @param[in] aDatabase the SQLite Database Connection
|
||||||
|
*
|
||||||
|
* Exception is thrown in case of error, then the Transaction is NOT initiated.
|
||||||
|
*/
|
||||||
|
explicit Transaction(Database& aDatabase);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Safely rollback the transaction if it has not been committed.
|
||||||
|
*/
|
||||||
|
virtual ~Transaction() noexcept; // nothrow
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Commit the transaction.
|
||||||
|
*/
|
||||||
|
void commit();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Transaction must be non-copyable
|
||||||
|
Transaction(const Transaction&);
|
||||||
|
Transaction& operator=(const Transaction&);
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Database& mDatabase; ///< Reference to the SQLite Database Connection
|
||||||
|
bool mbCommited; ///< True when commit has been called
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace SQLite
|
76
3rd-party/SRombauts-SQLiteCpp-f69986a/include/SQLiteCpp/VariadicBind.h
vendored
Normal file
76
3rd-party/SRombauts-SQLiteCpp-f69986a/include/SQLiteCpp/VariadicBind.h
vendored
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
/**
|
||||||
|
* @file VariadicBind.h
|
||||||
|
* @ingroup SQLiteCpp
|
||||||
|
* @brief Convenience function for Statement::bind(...)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 Paul Dreik (github@pauldreik.se)
|
||||||
|
* Copyright (c) 2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if (__cplusplus >= 201402L) || ( defined(_MSC_VER) && (_MSC_VER >= 1900) ) // c++14: Visual Studio 2015
|
||||||
|
|
||||||
|
#include <SQLiteCpp/Statement.h>
|
||||||
|
|
||||||
|
/// @cond
|
||||||
|
#include <utility>
|
||||||
|
#include <initializer_list>
|
||||||
|
|
||||||
|
namespace SQLite
|
||||||
|
{
|
||||||
|
|
||||||
|
/// implementation detail for variadic bind.
|
||||||
|
namespace detail {
|
||||||
|
template<class F, class ...Args, std::size_t ... I>
|
||||||
|
inline void invoke_with_index(F&& f, std::integer_sequence<std::size_t, I...>, const Args& ...args)
|
||||||
|
{
|
||||||
|
std::initializer_list<int> { (f(I+1, args), 0)... };
|
||||||
|
}
|
||||||
|
|
||||||
|
/// implementation detail for variadic bind.
|
||||||
|
template<class F, class ...Args>
|
||||||
|
inline void invoke_with_index(F&& f, const Args& ... args)
|
||||||
|
{
|
||||||
|
invoke_with_index(std::forward<F>(f), std::index_sequence_for<Args...>(), args...);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
/// @endcond
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Convenience function for calling Statement::bind(...) once for each argument given.
|
||||||
|
*
|
||||||
|
* This takes care of incrementing the index between each calls to bind.
|
||||||
|
*
|
||||||
|
* This feature requires a c++14 capable compiler.
|
||||||
|
*
|
||||||
|
* \code{.cpp}
|
||||||
|
* SQLite::Statement stm("SELECT * FROM MyTable WHERE colA>? && colB=? && colC<?");
|
||||||
|
* bind(stm,a,b,c);
|
||||||
|
* //...is equivalent to
|
||||||
|
* stm.bind(1,a);
|
||||||
|
* stm.bind(2,b);
|
||||||
|
* stm.bind(3,c);
|
||||||
|
* \endcode
|
||||||
|
* @param s statement
|
||||||
|
* @param args one or more args to bind.
|
||||||
|
*/
|
||||||
|
template<class ...Args>
|
||||||
|
void bind(SQLite::Statement& s, const Args& ... args)
|
||||||
|
{
|
||||||
|
static_assert(sizeof...(args) > 0, "please invoke bind with one or more args");
|
||||||
|
|
||||||
|
auto f=[&s](std::size_t index, const auto& value)
|
||||||
|
{
|
||||||
|
s.bind(index, value);
|
||||||
|
};
|
||||||
|
detail::invoke_with_index(f, args...);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace SQLite
|
||||||
|
|
||||||
|
#endif // c++14
|
||||||
|
|
12
3rd-party/SRombauts-SQLiteCpp-f69986a/sqlite3/CMakeLists.txt
vendored
Normal file
12
3rd-party/SRombauts-SQLiteCpp-f69986a/sqlite3/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# CMake file for compiling the sqlite3 static library under Windows (for ease of use)
|
||||||
|
#
|
||||||
|
# Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
#
|
||||||
|
# Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
# or copy at http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
|
# add sources of the "sqlite3" static library
|
||||||
|
add_library(sqlite3
|
||||||
|
sqlite3.c
|
||||||
|
sqlite3.h
|
||||||
|
)
|
14
3rd-party/SRombauts-SQLiteCpp-f69986a/sqlite3/README.md
vendored
Normal file
14
3rd-party/SRombauts-SQLiteCpp-f69986a/sqlite3/README.md
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
sqlite3
|
||||||
|
-------
|
||||||
|
|
||||||
|
"sqlite3.c" and "sqlite3.h" files from sqlite-amalgamation-3120200.zip (SQLite 3.12.2 2016-04-18)
|
||||||
|
|
||||||
|
Those files are provided for easy setup and compatibility under Windows/Linux/MacOS.
|
||||||
|
They are used by default by the CMake build.
|
||||||
|
|
||||||
|
Use -DSQLITECPP_INTERNAL_SQLITE=OFF to link against the Linux "libsqlite3-dev" package instead.
|
||||||
|
|
||||||
|
### License:
|
||||||
|
|
||||||
|
All of the code and documentation in SQLite has been dedicated to the public domain by the authors.
|
||||||
|
|
196842
3rd-party/SRombauts-SQLiteCpp-f69986a/sqlite3/sqlite3.c
vendored
Normal file
196842
3rd-party/SRombauts-SQLiteCpp-f69986a/sqlite3/sqlite3.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
10188
3rd-party/SRombauts-SQLiteCpp-f69986a/sqlite3/sqlite3.h
vendored
Normal file
10188
3rd-party/SRombauts-SQLiteCpp-f69986a/sqlite3/sqlite3.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
104
3rd-party/SRombauts-SQLiteCpp-f69986a/src/Backup.cpp
vendored
Normal file
104
3rd-party/SRombauts-SQLiteCpp-f69986a/src/Backup.cpp
vendored
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
/**
|
||||||
|
* @file Backup.cpp
|
||||||
|
* @ingroup SQLiteCpp
|
||||||
|
* @brief Backup is used to backup a database file in a safe and online way.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Shibao HONG (shibaohong@outlook.com)
|
||||||
|
* Copyright (c) 2015-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
#include <SQLiteCpp/Backup.h>
|
||||||
|
|
||||||
|
#include <SQLiteCpp/Exception.h>
|
||||||
|
|
||||||
|
#include <sqlite3.h>
|
||||||
|
|
||||||
|
namespace SQLite
|
||||||
|
{
|
||||||
|
|
||||||
|
// Initialize resource for SQLite database backup
|
||||||
|
Backup::Backup(Database& aDestDatabase,
|
||||||
|
const char* apDestDatabaseName,
|
||||||
|
Database& aSrcDatabase,
|
||||||
|
const char* apSrcDatabaseName) :
|
||||||
|
mpSQLiteBackup(NULL)
|
||||||
|
{
|
||||||
|
mpSQLiteBackup = sqlite3_backup_init(aDestDatabase.getHandle(),
|
||||||
|
apDestDatabaseName,
|
||||||
|
aSrcDatabase.getHandle(),
|
||||||
|
apSrcDatabaseName);
|
||||||
|
if (NULL == mpSQLiteBackup)
|
||||||
|
{
|
||||||
|
// If an error occurs, the error code and message are attached to the destination database connection.
|
||||||
|
throw SQLite::Exception(aDestDatabase.getHandle());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize resource for SQLite database backup
|
||||||
|
Backup::Backup(Database& aDestDatabase,
|
||||||
|
const std::string& aDestDatabaseName,
|
||||||
|
Database& aSrcDatabase,
|
||||||
|
const std::string& aSrcDatabaseName) :
|
||||||
|
mpSQLiteBackup(NULL)
|
||||||
|
{
|
||||||
|
mpSQLiteBackup = sqlite3_backup_init(aDestDatabase.getHandle(),
|
||||||
|
aDestDatabaseName.c_str(),
|
||||||
|
aSrcDatabase.getHandle(),
|
||||||
|
aSrcDatabaseName.c_str());
|
||||||
|
if (NULL == mpSQLiteBackup)
|
||||||
|
{
|
||||||
|
// If an error occurs, the error code and message are attached to the destination database connection.
|
||||||
|
throw SQLite::Exception(aDestDatabase.getHandle());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize resource for SQLite database backup
|
||||||
|
Backup::Backup(Database &aDestDatabase, Database &aSrcDatabase) :
|
||||||
|
mpSQLiteBackup(NULL)
|
||||||
|
{
|
||||||
|
mpSQLiteBackup = sqlite3_backup_init(aDestDatabase.getHandle(),
|
||||||
|
"main",
|
||||||
|
aSrcDatabase.getHandle(),
|
||||||
|
"main");
|
||||||
|
if (NULL == mpSQLiteBackup)
|
||||||
|
{
|
||||||
|
// If an error occurs, the error code and message are attached to the destination database connection.
|
||||||
|
throw SQLite::Exception(aDestDatabase.getHandle());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Release resource for SQLite database backup
|
||||||
|
Backup::~Backup() noexcept
|
||||||
|
{
|
||||||
|
if (NULL != mpSQLiteBackup)
|
||||||
|
{
|
||||||
|
sqlite3_backup_finish(mpSQLiteBackup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Execute backup step with a given number of source pages to be copied
|
||||||
|
int Backup::executeStep(const int aNumPage /* = -1 */)
|
||||||
|
{
|
||||||
|
const int res = sqlite3_backup_step(mpSQLiteBackup, aNumPage);
|
||||||
|
if (SQLITE_OK != res && SQLITE_DONE != res && SQLITE_BUSY != res && SQLITE_LOCKED != res)
|
||||||
|
{
|
||||||
|
throw SQLite::Exception(sqlite3_errstr(res), res);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the number of remaining source pages to be copied in this backup process
|
||||||
|
int Backup::getRemainingPageCount()
|
||||||
|
{
|
||||||
|
return sqlite3_backup_remaining(mpSQLiteBackup);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the number of total source pages to be copied in this backup process
|
||||||
|
int Backup::getTotalPageCount()
|
||||||
|
{
|
||||||
|
return sqlite3_backup_pagecount(mpSQLiteBackup);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace SQLite
|
124
3rd-party/SRombauts-SQLiteCpp-f69986a/src/Column.cpp
vendored
Normal file
124
3rd-party/SRombauts-SQLiteCpp-f69986a/src/Column.cpp
vendored
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
/**
|
||||||
|
* @file Column.cpp
|
||||||
|
* @ingroup SQLiteCpp
|
||||||
|
* @brief Encapsulation of a Column in a row of the result pointed by the prepared SQLite::Statement.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
#include <SQLiteCpp/Column.h>
|
||||||
|
|
||||||
|
#include <sqlite3.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
|
namespace SQLite
|
||||||
|
{
|
||||||
|
|
||||||
|
const int INTEGER = SQLITE_INTEGER;
|
||||||
|
const int FLOAT = SQLITE_FLOAT;
|
||||||
|
const int TEXT = SQLITE_TEXT;
|
||||||
|
const int BLOB = SQLITE_BLOB;
|
||||||
|
const int Null = SQLITE_NULL;
|
||||||
|
|
||||||
|
|
||||||
|
// Encapsulation of a Column in a row of the result pointed by the prepared Statement.
|
||||||
|
Column::Column(Statement::Ptr& aStmtPtr, int aIndex) noexcept : // nothrow
|
||||||
|
mStmtPtr(aStmtPtr),
|
||||||
|
mIndex(aIndex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Finalize and unregister the SQL query from the SQLite Database Connection.
|
||||||
|
Column::~Column() noexcept // nothrow
|
||||||
|
{
|
||||||
|
// the finalization will be done by the destructor of the last shared pointer
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the named assigned to this result column (potentially aliased)
|
||||||
|
const char* Column::getName() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_column_name(mStmtPtr, mIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef SQLITE_ENABLE_COLUMN_METADATA
|
||||||
|
// Return the name of the table column that is the origin of this result column
|
||||||
|
const char* Column::getOriginName() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_column_origin_name(mStmtPtr, mIndex);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Return the integer value of the column specified by its index starting at 0
|
||||||
|
int Column::getInt() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_column_int(mStmtPtr, mIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the unsigned integer value of the column specified by its index starting at 0
|
||||||
|
unsigned Column::getUInt() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return static_cast<unsigned>(getInt64());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the 64bits integer value of the column specified by its index starting at 0
|
||||||
|
long long Column::getInt64() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_column_int64(mStmtPtr, mIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the double value of the column specified by its index starting at 0
|
||||||
|
double Column::getDouble() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_column_double(mStmtPtr, mIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return a pointer to the text value (NULL terminated string) of the column specified by its index starting at 0
|
||||||
|
const char* Column::getText(const char* apDefaultValue /* = "" */) const noexcept // nothrow
|
||||||
|
{
|
||||||
|
const char* pText = reinterpret_cast<const char*>(sqlite3_column_text(mStmtPtr, mIndex));
|
||||||
|
return (pText?pText:apDefaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return a pointer to the blob value (*not* NULL terminated) of the column specified by its index starting at 0
|
||||||
|
const void* Column::getBlob() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_column_blob(mStmtPtr, mIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return a std::string to a TEXT or BLOB column
|
||||||
|
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));
|
||||||
|
|
||||||
|
// 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));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the type of the value of the column
|
||||||
|
int Column::getType() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_column_type(mStmtPtr, mIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the number of bytes used by the text value of the column
|
||||||
|
int Column::getBytes() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_column_bytes(mStmtPtr, mIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Standard std::ostream inserter
|
||||||
|
std::ostream& operator<<(std::ostream& aStream, const Column& aColumn)
|
||||||
|
{
|
||||||
|
aStream << aColumn.getText();
|
||||||
|
return aStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace SQLite
|
287
3rd-party/SRombauts-SQLiteCpp-f69986a/src/Database.cpp
vendored
Normal file
287
3rd-party/SRombauts-SQLiteCpp-f69986a/src/Database.cpp
vendored
Normal file
@@ -0,0 +1,287 @@
|
|||||||
|
/**
|
||||||
|
* @file Database.cpp
|
||||||
|
* @ingroup SQLiteCpp
|
||||||
|
* @brief Management of a SQLite Database Connection.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
#include <SQLiteCpp/Database.h>
|
||||||
|
|
||||||
|
#include <SQLiteCpp/Statement.h>
|
||||||
|
#include <SQLiteCpp/Assertion.h>
|
||||||
|
#include <SQLiteCpp/Exception.h>
|
||||||
|
|
||||||
|
#include <sqlite3.h>
|
||||||
|
#include <fstream>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef SQLITE_DETERMINISTIC
|
||||||
|
#define SQLITE_DETERMINISTIC 0x800
|
||||||
|
#endif // SQLITE_DETERMINISTIC
|
||||||
|
|
||||||
|
|
||||||
|
namespace SQLite
|
||||||
|
{
|
||||||
|
|
||||||
|
const int OPEN_READONLY = SQLITE_OPEN_READONLY;
|
||||||
|
const int OPEN_READWRITE = SQLITE_OPEN_READWRITE;
|
||||||
|
const int OPEN_CREATE = SQLITE_OPEN_CREATE;
|
||||||
|
const int OPEN_URI = SQLITE_OPEN_URI;
|
||||||
|
|
||||||
|
const int OK = SQLITE_OK;
|
||||||
|
|
||||||
|
const char* VERSION = SQLITE_VERSION;
|
||||||
|
const int VERSION_NUMBER = SQLITE_VERSION_NUMBER;
|
||||||
|
|
||||||
|
// Return SQLite version string using runtime call to the compiled library
|
||||||
|
const char* getLibVersion() noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_libversion();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return SQLite version number using runtime call to the compiled library
|
||||||
|
int getLibVersionNumber() noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_libversion_number();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Open the provided database UTF-8 filename with SQLite::OPEN_xxx provided flags.
|
||||||
|
Database::Database(const char* apFilename,
|
||||||
|
const int aFlags /* = SQLite::OPEN_READONLY*/,
|
||||||
|
const int aBusyTimeoutMs /* = 0 */,
|
||||||
|
const char* apVfs /* = NULL*/) :
|
||||||
|
mpSQLite(NULL),
|
||||||
|
mFilename(apFilename)
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_open_v2(apFilename, &mpSQLite, aFlags, apVfs);
|
||||||
|
if (SQLITE_OK != ret)
|
||||||
|
{
|
||||||
|
const SQLite::Exception exception(mpSQLite, ret); // must create before closing
|
||||||
|
sqlite3_close(mpSQLite); // close is required even in case of error on opening
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
if (aBusyTimeoutMs > 0)
|
||||||
|
{
|
||||||
|
setBusyTimeout(aBusyTimeoutMs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Open the provided database UTF-8 filename with SQLite::OPEN_xxx provided flags.
|
||||||
|
Database::Database(const std::string& aFilename,
|
||||||
|
const int aFlags /* = SQLite::OPEN_READONLY*/,
|
||||||
|
const int aBusyTimeoutMs /* = 0 */,
|
||||||
|
const std::string& aVfs /* = "" */) :
|
||||||
|
mpSQLite(NULL),
|
||||||
|
mFilename(aFilename)
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_open_v2(aFilename.c_str(), &mpSQLite, aFlags, aVfs.empty() ? NULL : aVfs.c_str());
|
||||||
|
if (SQLITE_OK != ret)
|
||||||
|
{
|
||||||
|
const SQLite::Exception exception(mpSQLite, ret); // must create before closing
|
||||||
|
sqlite3_close(mpSQLite); // close is required even in case of error on opening
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
if (aBusyTimeoutMs > 0)
|
||||||
|
{
|
||||||
|
setBusyTimeout(aBusyTimeoutMs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the SQLite database connection.
|
||||||
|
Database::~Database() noexcept // nothrow
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_close(mpSQLite);
|
||||||
|
|
||||||
|
// Avoid unreferenced variable warning when build in release mode
|
||||||
|
(void) ret;
|
||||||
|
|
||||||
|
// Only case of error is SQLITE_BUSY: "database is locked" (some statements are not finalized)
|
||||||
|
// Never throw an exception in a destructor :
|
||||||
|
SQLITECPP_ASSERT(SQLITE_OK == ret, "database is locked"); // See SQLITECPP_ENABLE_ASSERT_HANDLER
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set a busy handler that sleeps for a specified amount of time when a table is locked.
|
||||||
|
*
|
||||||
|
* This is useful in multithreaded program to handle case where a table is locked for writting by a thread.
|
||||||
|
* Any other thread cannot access the table and will receive a SQLITE_BUSY error:
|
||||||
|
* setting a timeout will wait and retry up to the time specified before returning this SQLITE_BUSY error.
|
||||||
|
* Reading the value of timeout for current connection can be done with SQL query "PRAGMA busy_timeout;".
|
||||||
|
* Default busy timeout is 0ms.
|
||||||
|
*
|
||||||
|
* @param[in] aBusyTimeoutMs Amount of milliseconds to wait before returning SQLITE_BUSY
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
void Database::setBusyTimeout(const int aBusyTimeoutMs) noexcept // nothrow
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_busy_timeout(mpSQLite, aBusyTimeoutMs);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shortcut to execute one or multiple SQL statements without results (UPDATE, INSERT, ALTER, COMMIT, CREATE...).
|
||||||
|
int Database::exec(const char* apQueries)
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_exec(mpSQLite, apQueries, NULL, NULL, NULL);
|
||||||
|
check(ret);
|
||||||
|
|
||||||
|
// Return the number of rows modified by those SQL statements (INSERT, UPDATE or DELETE only)
|
||||||
|
return sqlite3_changes(mpSQLite);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shortcut to execute a one step query and fetch the first column of the result.
|
||||||
|
// WARNING: Be very careful with this dangerous method: you have to
|
||||||
|
// make a COPY OF THE result, else it will be destroy before the next line
|
||||||
|
// (when the underlying temporary Statement and Column objects are destroyed)
|
||||||
|
// this is an issue only for pointer type result (ie. char* and blob)
|
||||||
|
// (use the Column copy-constructor)
|
||||||
|
Column Database::execAndGet(const char* apQuery)
|
||||||
|
{
|
||||||
|
Statement query(*this, apQuery);
|
||||||
|
(void)query.executeStep(); // Can return false if no result, which will throw next line in getColumn()
|
||||||
|
return query.getColumn(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shortcut to test if a table exists.
|
||||||
|
bool Database::tableExists(const char* apTableName)
|
||||||
|
{
|
||||||
|
Statement query(*this, "SELECT count(*) FROM sqlite_master WHERE type='table' AND name=?");
|
||||||
|
query.bind(1, apTableName);
|
||||||
|
(void)query.executeStep(); // Cannot return false, as the above query always return a result
|
||||||
|
return (1 == query.getColumn(0).getInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the rowid of the most recent successful INSERT into the database from the current connection.
|
||||||
|
long long Database::getLastInsertRowid() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_last_insert_rowid(mpSQLite);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get total number of rows modified by all INSERT, UPDATE or DELETE statement since connection.
|
||||||
|
int Database::getTotalChanges() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_total_changes(mpSQLite);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the numeric result code for the most recent failed API call (if any).
|
||||||
|
int Database::getErrorCode() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_errcode(mpSQLite);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the extended numeric result code for the most recent failed API call (if any).
|
||||||
|
int Database::getExtendedErrorCode() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_extended_errcode(mpSQLite);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return UTF-8 encoded English language explanation of the most recent failed API call (if any).
|
||||||
|
const char* Database::getErrorMsg() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_errmsg(mpSQLite);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attach a custom function to your sqlite database. Assumes UTF8 text representation.
|
||||||
|
// Parameter details can be found here: http://www.sqlite.org/c3ref/create_function.html
|
||||||
|
void Database::createFunction(const char* apFuncName,
|
||||||
|
int aNbArg,
|
||||||
|
bool abDeterministic,
|
||||||
|
void* apApp,
|
||||||
|
void (*apFunc)(sqlite3_context *, int, sqlite3_value **),
|
||||||
|
void (*apStep)(sqlite3_context *, int, sqlite3_value **),
|
||||||
|
void (*apFinal)(sqlite3_context *), // NOLINT(readability/casting)
|
||||||
|
void (*apDestroy)(void *))
|
||||||
|
{
|
||||||
|
int TextRep = SQLITE_UTF8;
|
||||||
|
// optimization if deterministic function (e.g. of nondeterministic function random())
|
||||||
|
if (abDeterministic) {
|
||||||
|
TextRep = TextRep|SQLITE_DETERMINISTIC;
|
||||||
|
}
|
||||||
|
const int ret = sqlite3_create_function_v2(mpSQLite, apFuncName, aNbArg, TextRep,
|
||||||
|
apApp, apFunc, apStep, apFinal, apDestroy);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load an extension into the sqlite database. Only affects the current connection.
|
||||||
|
// Parameter details can be found here: http://www.sqlite.org/c3ref/load_extension.html
|
||||||
|
void Database::loadExtension(const char* apExtensionName, const char *apEntryPointName)
|
||||||
|
{
|
||||||
|
#ifdef SQLITE_OMIT_LOAD_EXTENSION
|
||||||
|
throw std::runtime_error("sqlite extensions are disabled");
|
||||||
|
#else
|
||||||
|
#ifdef SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION // Since SQLite 3.13 (2016-05-18):
|
||||||
|
// Security warning:
|
||||||
|
// It is recommended that the SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION method be used to enable only this interface.
|
||||||
|
// The use of the sqlite3_enable_load_extension() interface should be avoided to keep the SQL load_extension()
|
||||||
|
// disabled and prevent SQL injections from giving attackers access to extension loading capabilities.
|
||||||
|
int ret = sqlite3_db_config(mpSQLite, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1, NULL);
|
||||||
|
#else
|
||||||
|
int ret = sqlite3_enable_load_extension(mpSQLite, 1);
|
||||||
|
#endif
|
||||||
|
check(ret);
|
||||||
|
|
||||||
|
ret = sqlite3_load_extension(mpSQLite, apExtensionName, apEntryPointName, 0);
|
||||||
|
check(ret);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the key for the current sqlite database instance.
|
||||||
|
void Database::key(const std::string& aKey) const
|
||||||
|
{
|
||||||
|
int pass_len = aKey.length();
|
||||||
|
#ifdef SQLITE_HAS_CODEC
|
||||||
|
if (pass_len > 0) {
|
||||||
|
const int ret = sqlite3_key(mpSQLite, aKey.c_str(), pass_len);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
#else // SQLITE_HAS_CODEC
|
||||||
|
if (pass_len > 0) {
|
||||||
|
const SQLite::Exception exception("No encryption support, recompile with SQLITE_HAS_CODEC to enable.");
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
#endif // SQLITE_HAS_CODEC
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset the key for the current sqlite database instance.
|
||||||
|
void Database::rekey(const std::string& aNewKey) const
|
||||||
|
{
|
||||||
|
#ifdef SQLITE_HAS_CODEC
|
||||||
|
int pass_len = aNewKey.length();
|
||||||
|
if (pass_len > 0) {
|
||||||
|
const int ret = sqlite3_rekey(mpSQLite, aNewKey.c_str(), pass_len);
|
||||||
|
check(ret);
|
||||||
|
} else {
|
||||||
|
const int ret = sqlite3_rekey(mpSQLite, nullptr, 0);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
#else // SQLITE_HAS_CODEC
|
||||||
|
const SQLite::Exception exception("No encryption support, recompile with SQLITE_HAS_CODEC to enable.");
|
||||||
|
throw exception;
|
||||||
|
#endif // SQLITE_HAS_CODEC
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test if a file contains an unencrypted database.
|
||||||
|
const bool Database::isUnencrypted(const std::string& aFilename)
|
||||||
|
{
|
||||||
|
if (aFilename.length() > 0) {
|
||||||
|
std::ifstream fileBuffer(aFilename.c_str(), std::ios::in | std::ios::binary);
|
||||||
|
char header[16];
|
||||||
|
if (fileBuffer.is_open()) {
|
||||||
|
fileBuffer.seekg(0, std::ios::beg);
|
||||||
|
fileBuffer.getline(header, 16);
|
||||||
|
fileBuffer.close();
|
||||||
|
} else {
|
||||||
|
const SQLite::Exception exception("Error opening file: " + aFilename);
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
return strncmp(header, "SQLite format 3\000", 16) == 0;
|
||||||
|
}
|
||||||
|
const SQLite::Exception exception("Could not open database, the aFilename parameter was empty.");
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace SQLite
|
54
3rd-party/SRombauts-SQLiteCpp-f69986a/src/Exception.cpp
vendored
Normal file
54
3rd-party/SRombauts-SQLiteCpp-f69986a/src/Exception.cpp
vendored
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/**
|
||||||
|
* @file Exception.cpp
|
||||||
|
* @ingroup SQLiteCpp
|
||||||
|
* @brief Encapsulation of the error message from SQLite3 on a std::runtime_error.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
#include <SQLiteCpp/Exception.h>
|
||||||
|
|
||||||
|
#include <sqlite3.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace SQLite
|
||||||
|
{
|
||||||
|
|
||||||
|
Exception::Exception(const std::string& aErrorMessage) :
|
||||||
|
std::runtime_error(aErrorMessage),
|
||||||
|
mErrcode(-1), // 0 would be SQLITE_OK, which doesn't make sense
|
||||||
|
mExtendedErrcode(-1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Exception::Exception(const std::string& aErrorMessage, int ret) :
|
||||||
|
std::runtime_error(aErrorMessage),
|
||||||
|
mErrcode(ret),
|
||||||
|
mExtendedErrcode(-1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Exception::Exception(sqlite3* apSQLite) :
|
||||||
|
std::runtime_error(sqlite3_errmsg(apSQLite)),
|
||||||
|
mErrcode(sqlite3_errcode(apSQLite)),
|
||||||
|
mExtendedErrcode(sqlite3_extended_errcode(apSQLite))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Exception::Exception(sqlite3* apSQLite, int ret) :
|
||||||
|
std::runtime_error(sqlite3_errmsg(apSQLite)),
|
||||||
|
mErrcode(ret),
|
||||||
|
mExtendedErrcode(sqlite3_extended_errcode(apSQLite))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return a string, solely based on the error code
|
||||||
|
const char* Exception::getErrorStr() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_errstr(mErrcode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace SQLite
|
462
3rd-party/SRombauts-SQLiteCpp-f69986a/src/Statement.cpp
vendored
Normal file
462
3rd-party/SRombauts-SQLiteCpp-f69986a/src/Statement.cpp
vendored
Normal file
@@ -0,0 +1,462 @@
|
|||||||
|
/**
|
||||||
|
* @file Statement.cpp
|
||||||
|
* @ingroup SQLiteCpp
|
||||||
|
* @brief A prepared SQLite Statement is a compiled SQL query ready to be executed, pointing to a row of result.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
#include <SQLiteCpp/Statement.h>
|
||||||
|
|
||||||
|
#include <SQLiteCpp/Database.h>
|
||||||
|
#include <SQLiteCpp/Column.h>
|
||||||
|
#include <SQLiteCpp/Assertion.h>
|
||||||
|
#include <SQLiteCpp/Exception.h>
|
||||||
|
|
||||||
|
#include <sqlite3.h>
|
||||||
|
|
||||||
|
namespace SQLite
|
||||||
|
{
|
||||||
|
|
||||||
|
// Compile and register the SQL query for the provided SQLite Database Connection
|
||||||
|
Statement::Statement(Database &aDatabase, const char* apQuery) :
|
||||||
|
mQuery(apQuery),
|
||||||
|
mStmtPtr(aDatabase.mpSQLite, mQuery), // prepare the SQL query, and ref count (needs Database friendship)
|
||||||
|
mColumnCount(0),
|
||||||
|
mbOk(false),
|
||||||
|
mbDone(false)
|
||||||
|
{
|
||||||
|
mColumnCount = sqlite3_column_count(mStmtPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compile and register the SQL query for the provided SQLite Database Connection
|
||||||
|
Statement::Statement(Database &aDatabase, const std::string& aQuery) :
|
||||||
|
mQuery(aQuery),
|
||||||
|
mStmtPtr(aDatabase.mpSQLite, mQuery), // prepare the SQL query, and ref count (needs Database friendship)
|
||||||
|
mColumnCount(0),
|
||||||
|
mbOk(false),
|
||||||
|
mbDone(false)
|
||||||
|
{
|
||||||
|
mColumnCount = sqlite3_column_count(mStmtPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Finalize and unregister the SQL query from the SQLite Database Connection.
|
||||||
|
Statement::~Statement() noexcept // nothrow
|
||||||
|
{
|
||||||
|
// the finalization will be done by the destructor of the last shared pointer
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset the statement to make it ready for a new execution (see also #clearBindings() bellow)
|
||||||
|
void Statement::reset()
|
||||||
|
{
|
||||||
|
mbOk = false;
|
||||||
|
mbDone = false;
|
||||||
|
const int ret = sqlite3_reset(mStmtPtr);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clears away all the bindings of a prepared statement (can be associated with #reset() above).
|
||||||
|
void Statement::clearBindings()
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_clear_bindings(mStmtPtr);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind an int value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bind(const int aIndex, const int aValue)
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_bind_int(mStmtPtr, aIndex, aValue);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind a 32bits unsigned int value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bind(const int aIndex, const unsigned aValue)
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_bind_int64(mStmtPtr, aIndex, aValue);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind a 64bits int value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bind(const int aIndex, const long long aValue)
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_bind_int64(mStmtPtr, aIndex, aValue);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind a double (64bits float) value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bind(const int aIndex, const double aValue)
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_bind_double(mStmtPtr, aIndex, aValue);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bind(const int aIndex, const std::string& aValue)
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_bind_text(mStmtPtr, aIndex, aValue.c_str(),
|
||||||
|
static_cast<int>(aValue.size()), SQLITE_TRANSIENT);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind a text value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bind(const int aIndex, const char* apValue)
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_bind_text(mStmtPtr, aIndex, apValue, -1, SQLITE_TRANSIENT);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind a binary blob value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bind(const int aIndex, const void* apValue, const int aSize)
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_bind_blob(mStmtPtr, aIndex, apValue, aSize, 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)
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_bind_text(mStmtPtr, aIndex, aValue.c_str(),
|
||||||
|
static_cast<int>(aValue.size()), SQLITE_STATIC);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind a text value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bindNoCopy(const int aIndex, const char* apValue)
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_bind_text(mStmtPtr, aIndex, apValue, -1, SQLITE_STATIC);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind a binary blob value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bindNoCopy(const int aIndex, const void* apValue, const int aSize)
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_bind_blob(mStmtPtr, aIndex, apValue, aSize, SQLITE_STATIC);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind a NULL value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bind(const int aIndex)
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_bind_null(mStmtPtr, aIndex);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Bind an int value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bind(const char* apName, const int aValue)
|
||||||
|
{
|
||||||
|
const int index = sqlite3_bind_parameter_index(mStmtPtr, apName);
|
||||||
|
const int ret = sqlite3_bind_int(mStmtPtr, index, aValue);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind a 32bits unsigned int value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bind(const char* apName, const unsigned aValue)
|
||||||
|
{
|
||||||
|
const int index = sqlite3_bind_parameter_index(mStmtPtr, apName);
|
||||||
|
const int ret = sqlite3_bind_int64(mStmtPtr, index, aValue);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind a 64bits int value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bind(const char* apName, const long long aValue)
|
||||||
|
{
|
||||||
|
const int index = sqlite3_bind_parameter_index(mStmtPtr, apName);
|
||||||
|
const int ret = sqlite3_bind_int64(mStmtPtr, index, aValue);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind a double (64bits float) value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bind(const char* apName, const double aValue)
|
||||||
|
{
|
||||||
|
const int index = sqlite3_bind_parameter_index(mStmtPtr, apName);
|
||||||
|
const int ret = sqlite3_bind_double(mStmtPtr, index, aValue);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind a string value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bind(const char* apName, const std::string& aValue)
|
||||||
|
{
|
||||||
|
const int index = sqlite3_bind_parameter_index(mStmtPtr, apName);
|
||||||
|
const int ret = sqlite3_bind_text(mStmtPtr, index, aValue.c_str(),
|
||||||
|
static_cast<int>(aValue.size()), SQLITE_TRANSIENT);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind a text value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bind(const char* apName, const char* apValue)
|
||||||
|
{
|
||||||
|
const int index = sqlite3_bind_parameter_index(mStmtPtr, apName);
|
||||||
|
const int ret = sqlite3_bind_text(mStmtPtr, index, apValue, -1, SQLITE_TRANSIENT);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind a binary blob value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bind(const char* apName, const void* apValue, const int aSize)
|
||||||
|
{
|
||||||
|
const int index = sqlite3_bind_parameter_index(mStmtPtr, apName);
|
||||||
|
const int ret = sqlite3_bind_blob(mStmtPtr, index, apValue, aSize, 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 char* apName, const std::string& aValue)
|
||||||
|
{
|
||||||
|
const int index = sqlite3_bind_parameter_index(mStmtPtr, apName);
|
||||||
|
const int ret = sqlite3_bind_text(mStmtPtr, index, aValue.c_str(),
|
||||||
|
static_cast<int>(aValue.size()), SQLITE_STATIC);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind a text value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bindNoCopy(const char* apName, const char* apValue)
|
||||||
|
{
|
||||||
|
const int index = sqlite3_bind_parameter_index(mStmtPtr, apName);
|
||||||
|
const int ret = sqlite3_bind_text(mStmtPtr, index, apValue, -1, SQLITE_STATIC);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind a binary blob value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bindNoCopy(const char* apName, const void* apValue, const int aSize)
|
||||||
|
{
|
||||||
|
const int index = sqlite3_bind_parameter_index(mStmtPtr, apName);
|
||||||
|
const int ret = sqlite3_bind_blob(mStmtPtr, index, apValue, aSize, SQLITE_STATIC);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind a NULL value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement
|
||||||
|
void Statement::bind(const char* apName)
|
||||||
|
{
|
||||||
|
const int index = sqlite3_bind_parameter_index(mStmtPtr, apName);
|
||||||
|
const int ret = sqlite3_bind_null(mStmtPtr, index);
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Execute a step of the query to fetch one row of results
|
||||||
|
bool Statement::executeStep()
|
||||||
|
{
|
||||||
|
if (false == mbDone)
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_step(mStmtPtr);
|
||||||
|
if (SQLITE_ROW == ret) // one row is ready : call getColumn(N) to access it
|
||||||
|
{
|
||||||
|
mbOk = true;
|
||||||
|
}
|
||||||
|
else if (SQLITE_DONE == ret) // no (more) row ready : the query has finished executing
|
||||||
|
{
|
||||||
|
mbOk = false;
|
||||||
|
mbDone = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mbOk = false;
|
||||||
|
mbDone = false;
|
||||||
|
throw SQLite::Exception(mStmtPtr, ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw SQLite::Exception("Statement needs to be reseted.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return mbOk; // true only if one row is accessible by getColumn(N)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Execute a one-step query with no expected result
|
||||||
|
int Statement::exec()
|
||||||
|
{
|
||||||
|
if (false == mbDone)
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_step(mStmtPtr);
|
||||||
|
if (SQLITE_DONE == ret) // the statement has finished executing successfully
|
||||||
|
{
|
||||||
|
mbOk = false;
|
||||||
|
mbDone = true;
|
||||||
|
}
|
||||||
|
else if (SQLITE_ROW == ret)
|
||||||
|
{
|
||||||
|
mbOk = false;
|
||||||
|
mbDone = false;
|
||||||
|
throw SQLite::Exception("exec() does not expect results. Use executeStep.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mbOk = false;
|
||||||
|
mbDone = false;
|
||||||
|
throw SQLite::Exception(mStmtPtr, ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw SQLite::Exception("Statement need to be reseted.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the number of rows modified by those SQL statements (INSERT, UPDATE or DELETE)
|
||||||
|
return sqlite3_changes(mStmtPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return a copy of the column data specified by its index starting at 0
|
||||||
|
// (use the Column copy-constructor)
|
||||||
|
Column Statement::getColumn(const int aIndex)
|
||||||
|
{
|
||||||
|
checkRow();
|
||||||
|
checkIndex(aIndex);
|
||||||
|
|
||||||
|
// Share the Statement Object handle with the new Column created
|
||||||
|
return Column(mStmtPtr, aIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return a copy of the column data specified by its column name starting at 0
|
||||||
|
// (use the Column copy-constructor)
|
||||||
|
Column Statement::getColumn(const char* apName)
|
||||||
|
{
|
||||||
|
checkRow();
|
||||||
|
const int index = getColumnIndex(apName);
|
||||||
|
|
||||||
|
// Share the Statement Object handle with the new Column created
|
||||||
|
return Column(mStmtPtr, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test if the column is NULL
|
||||||
|
bool Statement::isColumnNull(const int aIndex) const
|
||||||
|
{
|
||||||
|
checkRow();
|
||||||
|
checkIndex(aIndex);
|
||||||
|
return (SQLITE_NULL == sqlite3_column_type(mStmtPtr, aIndex));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Statement::isColumnNull(const char* apName) const
|
||||||
|
{
|
||||||
|
checkRow();
|
||||||
|
const int index = getColumnIndex(apName);
|
||||||
|
return (SQLITE_NULL == sqlite3_column_type(mStmtPtr, index));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the named assigned to the specified result column (potentially aliased)
|
||||||
|
const char* Statement::getColumnName(const int aIndex) const
|
||||||
|
{
|
||||||
|
checkIndex(aIndex);
|
||||||
|
return sqlite3_column_name(mStmtPtr, aIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef SQLITE_ENABLE_COLUMN_METADATA
|
||||||
|
// Return the named assigned to the specified result column (potentially aliased)
|
||||||
|
const char* Statement::getColumnOriginName(const int aIndex) const
|
||||||
|
{
|
||||||
|
checkIndex(aIndex);
|
||||||
|
return sqlite3_column_origin_name(mStmtPtr, aIndex);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Return the index of the specified (potentially aliased) column name
|
||||||
|
int Statement::getColumnIndex(const char* apName) const
|
||||||
|
{
|
||||||
|
// Build the map of column index by name on first call
|
||||||
|
if (mColumnNames.empty())
|
||||||
|
{
|
||||||
|
for (int i = 0; i < mColumnCount; ++i)
|
||||||
|
{
|
||||||
|
const char* pName = sqlite3_column_name(mStmtPtr, i);
|
||||||
|
mColumnNames[pName] = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const TColumnNames::const_iterator iIndex = mColumnNames.find(apName);
|
||||||
|
if (iIndex == mColumnNames.end())
|
||||||
|
{
|
||||||
|
throw SQLite::Exception("Unknown column name.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (*iIndex).second;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the numeric result code for the most recent failed API call (if any).
|
||||||
|
int Statement::getErrorCode() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_errcode(mStmtPtr);
|
||||||
|
}
|
||||||
|
// Return the extended numeric result code for the most recent failed API call (if any).
|
||||||
|
int Statement::getExtendedErrorCode() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_extended_errcode(mStmtPtr);
|
||||||
|
}
|
||||||
|
// Return UTF-8 encoded English language explanation of the most recent failed API call (if any).
|
||||||
|
const char* Statement::getErrorMsg() const noexcept // nothrow
|
||||||
|
{
|
||||||
|
return sqlite3_errmsg(mStmtPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Internal class : shared pointer to the sqlite3_stmt SQLite Statement Object
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Prepare the statement and initialize its reference counter
|
||||||
|
*
|
||||||
|
* @param[in] apSQLite The sqlite3 database connexion
|
||||||
|
* @param[in] aQuery The SQL query string to prepare
|
||||||
|
*/
|
||||||
|
Statement::Ptr::Ptr(sqlite3* apSQLite, std::string& aQuery) :
|
||||||
|
mpSQLite(apSQLite),
|
||||||
|
mpStmt(NULL),
|
||||||
|
mpRefCount(NULL)
|
||||||
|
{
|
||||||
|
const int ret = sqlite3_prepare_v2(apSQLite, aQuery.c_str(), static_cast<int>(aQuery.size()), &mpStmt, NULL);
|
||||||
|
if (SQLITE_OK != ret)
|
||||||
|
{
|
||||||
|
throw SQLite::Exception(apSQLite, ret);
|
||||||
|
}
|
||||||
|
// Initialize the reference counter of the sqlite3_stmt :
|
||||||
|
// used to share the mStmtPtr between Statement and Column objects;
|
||||||
|
// This is needed to enable Column objects to live longer than the Statement objet it refers to.
|
||||||
|
mpRefCount = new unsigned int(1); // NOLINT(readability/casting)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Copy constructor increments the ref counter
|
||||||
|
*
|
||||||
|
* @param[in] aPtr Pointer to copy
|
||||||
|
*/
|
||||||
|
Statement::Ptr::Ptr(const Statement::Ptr& aPtr) :
|
||||||
|
mpSQLite(aPtr.mpSQLite),
|
||||||
|
mpStmt(aPtr.mpStmt),
|
||||||
|
mpRefCount(aPtr.mpRefCount)
|
||||||
|
{
|
||||||
|
assert(NULL != mpRefCount);
|
||||||
|
assert(0 != *mpRefCount);
|
||||||
|
|
||||||
|
// Increment the reference counter of the sqlite3_stmt,
|
||||||
|
// asking not to finalize the sqlite3_stmt during the lifetime of the new objet
|
||||||
|
++(*mpRefCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Decrement the ref counter and finalize the sqlite3_stmt when it reaches 0
|
||||||
|
*/
|
||||||
|
Statement::Ptr::~Ptr() noexcept // nothrow
|
||||||
|
{
|
||||||
|
assert(NULL != mpRefCount);
|
||||||
|
assert(0 != *mpRefCount);
|
||||||
|
|
||||||
|
// Decrement and check the reference counter of the sqlite3_stmt
|
||||||
|
--(*mpRefCount);
|
||||||
|
if (0 == *mpRefCount)
|
||||||
|
{
|
||||||
|
// If count reaches zero, finalize the sqlite3_stmt, as no Statement nor Column objet use it anymore.
|
||||||
|
// No need to check the return code, as it is the same as the last statement evaluation.
|
||||||
|
sqlite3_finalize(mpStmt);
|
||||||
|
|
||||||
|
// and delete the reference counter
|
||||||
|
delete mpRefCount;
|
||||||
|
mpRefCount = NULL;
|
||||||
|
mpStmt = NULL;
|
||||||
|
}
|
||||||
|
// else, the finalization will be done later, by the last object
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace SQLite
|
60
3rd-party/SRombauts-SQLiteCpp-f69986a/src/Transaction.cpp
vendored
Normal file
60
3rd-party/SRombauts-SQLiteCpp-f69986a/src/Transaction.cpp
vendored
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/**
|
||||||
|
* @file Transaction.cpp
|
||||||
|
* @ingroup SQLiteCpp
|
||||||
|
* @brief A Transaction is way to group multiple SQL statements into an atomic secured operation.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2013 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
#include <SQLiteCpp/Transaction.h>
|
||||||
|
|
||||||
|
#include <SQLiteCpp/Database.h>
|
||||||
|
#include <SQLiteCpp/Assertion.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace SQLite
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// Begins the SQLite transaction
|
||||||
|
Transaction::Transaction(Database& aDatabase) :
|
||||||
|
mDatabase(aDatabase),
|
||||||
|
mbCommited(false)
|
||||||
|
{
|
||||||
|
mDatabase.exec("BEGIN");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Safely rollback the transaction if it has not been committed.
|
||||||
|
Transaction::~Transaction() noexcept // nothrow
|
||||||
|
{
|
||||||
|
if (false == mbCommited)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mDatabase.exec("ROLLBACK");
|
||||||
|
}
|
||||||
|
catch (SQLite::Exception&)
|
||||||
|
{
|
||||||
|
// Never throw an exception in a destructor: error if already rollbacked, but no harm is caused by this.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit the transaction.
|
||||||
|
void Transaction::commit()
|
||||||
|
{
|
||||||
|
if (false == mbCommited)
|
||||||
|
{
|
||||||
|
mDatabase.exec("COMMIT");
|
||||||
|
mbCommited = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw SQLite::Exception("Transaction already commited.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace SQLite
|
115
3rd-party/SRombauts-SQLiteCpp-f69986a/tests/Backup_test.cpp
vendored
Normal file
115
3rd-party/SRombauts-SQLiteCpp-f69986a/tests/Backup_test.cpp
vendored
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
/**
|
||||||
|
* @file Backup_test.cpp
|
||||||
|
* @ingroup tests
|
||||||
|
* @brief Test of a SQLite Backup.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Shibao HONG (shibaohong@outlook.com)
|
||||||
|
* Copyright (c) 2015-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <SQLiteCpp/Backup.h>
|
||||||
|
#include <SQLiteCpp/Database.h>
|
||||||
|
#include <SQLiteCpp/Statement.h>
|
||||||
|
#include <SQLiteCpp/Exception.h>
|
||||||
|
|
||||||
|
#include <sqlite3.h> // for SQLITE_ERROR, SQLITE_RANGE and SQLITE_DONE
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
TEST(Backup, initException) {
|
||||||
|
remove("backup_test.db3");
|
||||||
|
SQLite::Database srcDB("backup_test.db3", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
srcDB.exec("CREATE TABLE backup_test (id INTEGER PRIMARY KEY, value TEXT)");
|
||||||
|
ASSERT_EQ(1, srcDB.exec("INSERT INTO backup_test VALUES (1, \"first\")"));
|
||||||
|
ASSERT_EQ(1, srcDB.exec("INSERT INTO backup_test VALUES (2, \"second\")"));
|
||||||
|
EXPECT_THROW(SQLite::Backup backup(srcDB, srcDB), SQLite::Exception);
|
||||||
|
EXPECT_THROW(SQLite::Backup backup(srcDB, "main", srcDB, "main"), SQLite::Exception);
|
||||||
|
const std::string name("main");
|
||||||
|
EXPECT_THROW(SQLite::Backup backup(srcDB, name, srcDB, name), SQLite::Exception);
|
||||||
|
remove("backup_test.db3");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Backup, executeStepOne) {
|
||||||
|
remove("backup_test.db3");
|
||||||
|
remove("backup_test.db3.backup");
|
||||||
|
SQLite::Database srcDB("backup_test.db3", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
srcDB.exec("CREATE TABLE backup_test (id INTEGER PRIMARY KEY, value TEXT)");
|
||||||
|
ASSERT_EQ(1, srcDB.exec("INSERT INTO backup_test VALUES (1, \"first\")"));
|
||||||
|
ASSERT_EQ(1, srcDB.exec("INSERT INTO backup_test VALUES (2, \"second\")"));
|
||||||
|
|
||||||
|
SQLite::Database destDB("backup_test.db3.backup", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
SQLite::Backup backup(destDB, "main", srcDB, "main");
|
||||||
|
int res = backup.executeStep(1); // backup only one page at a time
|
||||||
|
ASSERT_EQ(SQLite::OK, res);
|
||||||
|
const int total = backup.getTotalPageCount();
|
||||||
|
ASSERT_EQ(2, total);
|
||||||
|
int remaining = backup.getRemainingPageCount();
|
||||||
|
ASSERT_EQ(1, remaining);
|
||||||
|
res = backup.executeStep(1); // backup the second and last page
|
||||||
|
ASSERT_EQ(SQLITE_DONE, res);
|
||||||
|
remaining = backup.getRemainingPageCount();
|
||||||
|
ASSERT_EQ(0, remaining);
|
||||||
|
|
||||||
|
SQLite::Statement query(destDB, "SELECT * FROM backup_test ORDER BY id ASC");
|
||||||
|
ASSERT_TRUE(query.executeStep());
|
||||||
|
EXPECT_EQ(1, query.getColumn(0).getInt());
|
||||||
|
EXPECT_STREQ("first", query.getColumn(1));
|
||||||
|
ASSERT_TRUE(query.executeStep());
|
||||||
|
EXPECT_EQ(2, query.getColumn(0).getInt());
|
||||||
|
EXPECT_STREQ("second", query.getColumn(1));
|
||||||
|
remove("backup_test.db3");
|
||||||
|
remove("backup_test.db3.backup");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Backup, executeStepAll) {
|
||||||
|
remove("backup_test.db3");
|
||||||
|
remove("backup_test.db3.backup");
|
||||||
|
SQLite::Database srcDB("backup_test.db3", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
srcDB.exec("CREATE TABLE backup_test (id INTEGER PRIMARY KEY, value TEXT)");
|
||||||
|
ASSERT_EQ(1, srcDB.exec("INSERT INTO backup_test VALUES (1, \"first\")"));
|
||||||
|
ASSERT_EQ(1, srcDB.exec("INSERT INTO backup_test VALUES (2, \"second\")"));
|
||||||
|
|
||||||
|
SQLite::Database destDB("backup_test.db3.backup", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
SQLite::Backup backup(destDB, srcDB);
|
||||||
|
const int res = backup.executeStep(); // uses default argument "-1" => execute all steps at once
|
||||||
|
ASSERT_EQ(res, SQLITE_DONE);
|
||||||
|
const int total = backup.getTotalPageCount();
|
||||||
|
ASSERT_EQ(2, total);
|
||||||
|
const int remaining = backup.getRemainingPageCount();
|
||||||
|
ASSERT_EQ(0, remaining);
|
||||||
|
|
||||||
|
SQLite::Statement query(destDB, "SELECT * FROM backup_test ORDER BY id ASC");
|
||||||
|
ASSERT_TRUE(query.executeStep());
|
||||||
|
EXPECT_EQ(1, query.getColumn(0).getInt());
|
||||||
|
EXPECT_STREQ("first", query.getColumn(1));
|
||||||
|
ASSERT_TRUE(query.executeStep());
|
||||||
|
EXPECT_EQ(2, query.getColumn(0).getInt());
|
||||||
|
EXPECT_STREQ("second", query.getColumn(1));
|
||||||
|
remove("backup_test.db3");
|
||||||
|
remove("backup_test.db3.backup");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Backup, executeStepException) {
|
||||||
|
remove("backup_test.db3");
|
||||||
|
remove("backup_test.db3.backup");
|
||||||
|
SQLite::Database srcDB("backup_test.db3", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
srcDB.exec("CREATE TABLE backup_test (id INTEGER PRIMARY KEY, value TEXT)");
|
||||||
|
ASSERT_EQ(1, srcDB.exec("INSERT INTO backup_test VALUES (1, \"first\")"));
|
||||||
|
ASSERT_EQ(1, srcDB.exec("INSERT INTO backup_test VALUES (2, \"second\")"));
|
||||||
|
{
|
||||||
|
SQLite::Database destDB("backup_test.db3.backup", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
(void)destDB;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
SQLite::Database destDB("backup_test.db3.backup", SQLite::OPEN_READONLY);
|
||||||
|
SQLite::Backup backup(destDB, srcDB);
|
||||||
|
EXPECT_THROW(backup.executeStep(), SQLite::Exception);
|
||||||
|
}
|
||||||
|
remove("backup_test.db3");
|
||||||
|
remove("backup_test.db3.backup");
|
||||||
|
}
|
201
3rd-party/SRombauts-SQLiteCpp-f69986a/tests/Column_test.cpp
vendored
Normal file
201
3rd-party/SRombauts-SQLiteCpp-f69986a/tests/Column_test.cpp
vendored
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
/**
|
||||||
|
* @file Column_test.cpp
|
||||||
|
* @ingroup tests
|
||||||
|
* @brief Test of a SQLiteCpp Column.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <SQLiteCpp/Database.h>
|
||||||
|
#include <SQLiteCpp/Statement.h>
|
||||||
|
#include <SQLiteCpp/Column.h>
|
||||||
|
|
||||||
|
#include <sqlite3.h> // for sqlite3_int64
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
|
TEST(Column, basis) {
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getExtendedErrorCode());
|
||||||
|
|
||||||
|
// Create a new table
|
||||||
|
EXPECT_EQ(0, db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, msg TEXT, int INTEGER, double REAL, binary BLOB, empty TEXT)"));
|
||||||
|
EXPECT_TRUE(db.tableExists("test"));
|
||||||
|
EXPECT_TRUE(db.tableExists(std::string("test")));
|
||||||
|
EXPECT_EQ(0, db.getLastInsertRowid());
|
||||||
|
|
||||||
|
// Create a first row (autoid: 1) with all kind of data and a null value
|
||||||
|
SQLite::Statement insert(db, "INSERT INTO test VALUES (NULL, \"first\", -123, 0.123, ?, NULL)");
|
||||||
|
// Bind the blob value to the first parameter of the SQL query
|
||||||
|
const char buffer[] = {'b', 'l', '\0', 'b'}; // "bl\0b" : 4 char, with a null byte inside
|
||||||
|
const int size = sizeof(buffer); // size = 4
|
||||||
|
const void* blob = &buffer;
|
||||||
|
insert.bind(1, blob, size);
|
||||||
|
// Execute the one-step query to insert the row
|
||||||
|
EXPECT_EQ(1, insert.exec());
|
||||||
|
EXPECT_EQ(1, db.getLastInsertRowid());
|
||||||
|
EXPECT_EQ(1, db.getTotalChanges());
|
||||||
|
|
||||||
|
EXPECT_THROW(insert.exec(), SQLite::Exception); // exec() shall throw as it needs to be reseted
|
||||||
|
|
||||||
|
// Compile a SQL query
|
||||||
|
SQLite::Statement query(db, "SELECT * FROM test");
|
||||||
|
EXPECT_STREQ("SELECT * FROM test", query.getQuery().c_str());
|
||||||
|
EXPECT_EQ(6, query.getColumnCount ());
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
|
||||||
|
// validates every variant of cast operators, and conversions of types
|
||||||
|
{
|
||||||
|
const sqlite3_int64 id1 = query.getColumn(0); // operator int64_t()
|
||||||
|
const int64_t id2 = query.getColumn(0); // operator int64_t()
|
||||||
|
const long long id3 = query.getColumn(0); // operator int64_t()
|
||||||
|
const long id4 = query.getColumn(0); // operator int64_t() or long() depending on compiler/architecture
|
||||||
|
const unsigned int uint1 = query.getColumn(0); // operator uint32_t()
|
||||||
|
const uint32_t uint2 = query.getColumn(0); // operator uint32_t()
|
||||||
|
const char* ptxt = query.getColumn(1); // operator const char*()
|
||||||
|
const std::string msg = query.getColumn(1); // operator std::string() (or const char* with MSVC)
|
||||||
|
const int integer = query.getColumn(2); // operator int()
|
||||||
|
const double real = query.getColumn(3); // operator double()
|
||||||
|
const void* pblob = query.getColumn(4); // operator void*()
|
||||||
|
const std::string sblob = query.getColumn(4); // operator std::string() (or const char* with MSVC)
|
||||||
|
const void* pempty = query.getColumn(5); // operator void*()
|
||||||
|
EXPECT_EQ(1, id1);
|
||||||
|
EXPECT_EQ(1, id2);
|
||||||
|
EXPECT_EQ(1, id3);
|
||||||
|
EXPECT_EQ(1, id4);
|
||||||
|
EXPECT_EQ(1, uint1);
|
||||||
|
EXPECT_EQ(1, uint2);
|
||||||
|
EXPECT_STREQ("first", ptxt);
|
||||||
|
EXPECT_EQ("first", msg);
|
||||||
|
EXPECT_EQ(-123, integer);
|
||||||
|
EXPECT_EQ(0.123, real);
|
||||||
|
EXPECT_EQ(0, memcmp("bl\0b", pblob, size));
|
||||||
|
EXPECT_EQ(size, sblob.size());
|
||||||
|
EXPECT_EQ(0, memcmp("bl\0b", &sblob[0], size));
|
||||||
|
EXPECT_EQ(NULL, pempty);
|
||||||
|
}
|
||||||
|
|
||||||
|
// validates every variant of explicit getters
|
||||||
|
{
|
||||||
|
int64_t id = query.getColumn(0).getInt64();
|
||||||
|
const unsigned int uint1 = query.getColumn(0).getUInt();
|
||||||
|
const uint32_t uint2 = query.getColumn(0).getUInt();
|
||||||
|
const char* ptxt = query.getColumn(1).getText();
|
||||||
|
const std::string msg1 = query.getColumn(1).getText();
|
||||||
|
const std::string msg2 = query.getColumn(1).getString();
|
||||||
|
const int integer = query.getColumn(2).getInt();
|
||||||
|
const double real = query.getColumn(3).getDouble();
|
||||||
|
const void* pblob = query.getColumn(4).getBlob();
|
||||||
|
const std::string sblob = query.getColumn(4).getString();
|
||||||
|
EXPECT_EQ(1, id);
|
||||||
|
EXPECT_EQ(1, uint1);
|
||||||
|
EXPECT_EQ(1, uint2);
|
||||||
|
EXPECT_STREQ("first", ptxt);
|
||||||
|
EXPECT_EQ("first", msg1);
|
||||||
|
EXPECT_EQ("first", msg2);
|
||||||
|
EXPECT_EQ(-123, integer);
|
||||||
|
EXPECT_EQ(0.123, real);
|
||||||
|
EXPECT_EQ(0, memcmp("bl\0b", pblob, 4));
|
||||||
|
EXPECT_EQ(0, memcmp("bl\0b", &sblob[0], 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate getBytes(), getType(), isInteger(), isNull()...
|
||||||
|
EXPECT_EQ(SQLite::INTEGER, query.getColumn(0).getType());
|
||||||
|
EXPECT_EQ(true, query.getColumn(0).isInteger());
|
||||||
|
EXPECT_EQ(false, query.getColumn(0).isFloat());
|
||||||
|
EXPECT_EQ(false, query.getColumn(0).isText());
|
||||||
|
EXPECT_EQ(false, query.getColumn(0).isBlob());
|
||||||
|
EXPECT_EQ(false, query.getColumn(0).isNull());
|
||||||
|
EXPECT_STREQ("1", query.getColumn(0).getText()); // convert to string
|
||||||
|
EXPECT_EQ(1, query.getColumn(0).getBytes()); // size of the string "1" without the null terminator
|
||||||
|
EXPECT_EQ(SQLite::TEXT, query.getColumn(1).getType());
|
||||||
|
EXPECT_EQ(false, query.getColumn(1).isInteger());
|
||||||
|
EXPECT_EQ(false, query.getColumn(1).isFloat());
|
||||||
|
EXPECT_EQ(true, query.getColumn(1).isText());
|
||||||
|
EXPECT_EQ(false, query.getColumn(1).isBlob());
|
||||||
|
EXPECT_EQ(false, query.getColumn(1).isNull());
|
||||||
|
EXPECT_STREQ("first", query.getColumn(1).getText()); // convert to string
|
||||||
|
EXPECT_EQ(5, query.getColumn(1).getBytes()); // size of the string "first"
|
||||||
|
EXPECT_EQ(SQLite::INTEGER, query.getColumn(2).getType());
|
||||||
|
EXPECT_EQ(true, query.getColumn(2).isInteger());
|
||||||
|
EXPECT_EQ(false, query.getColumn(2).isFloat());
|
||||||
|
EXPECT_EQ(false, query.getColumn(2).isText());
|
||||||
|
EXPECT_EQ(false, query.getColumn(2).isBlob());
|
||||||
|
EXPECT_EQ(false, query.getColumn(2).isNull());
|
||||||
|
EXPECT_STREQ("-123", query.getColumn(2).getText()); // convert to string
|
||||||
|
EXPECT_EQ(4, query.getColumn(2).getBytes()); // size of the string "-123"
|
||||||
|
EXPECT_EQ(SQLite::FLOAT, query.getColumn(3).getType());
|
||||||
|
EXPECT_EQ(false, query.getColumn(3).isInteger());
|
||||||
|
EXPECT_EQ(true, query.getColumn(3).isFloat());
|
||||||
|
EXPECT_EQ(false, query.getColumn(3).isText());
|
||||||
|
EXPECT_EQ(false, query.getColumn(3).isBlob());
|
||||||
|
EXPECT_EQ(false, query.getColumn(3).isNull());
|
||||||
|
EXPECT_STREQ("0.123", query.getColumn(3).getText()); // convert to string
|
||||||
|
EXPECT_EQ(5, query.getColumn(3).getBytes()); // size of the string "0.123"
|
||||||
|
EXPECT_EQ(SQLite::BLOB, query.getColumn(4).getType());
|
||||||
|
EXPECT_EQ(false, query.getColumn(4).isInteger());
|
||||||
|
EXPECT_EQ(false, query.getColumn(4).isFloat());
|
||||||
|
EXPECT_EQ(false, query.getColumn(4).isText());
|
||||||
|
EXPECT_EQ(true, query.getColumn(4).isBlob());
|
||||||
|
EXPECT_EQ(false, query.getColumn(4).isNull());
|
||||||
|
EXPECT_STREQ("bl\0b", query.getColumn(4).getText()); // convert to string
|
||||||
|
EXPECT_EQ(4, query.getColumn(4).getBytes()); // size of the blob "bl\0b" with the null char
|
||||||
|
EXPECT_EQ(SQLite::Null, query.getColumn(5).getType());
|
||||||
|
EXPECT_EQ(false, query.getColumn(5).isInteger());
|
||||||
|
EXPECT_EQ(false, query.getColumn(5).isFloat());
|
||||||
|
EXPECT_EQ(false, query.getColumn(5).isText());
|
||||||
|
EXPECT_EQ(false, query.getColumn(5).isBlob());
|
||||||
|
EXPECT_EQ(true, query.getColumn(5).isNull());
|
||||||
|
EXPECT_STREQ("", query.getColumn(5).getText()); // convert to string
|
||||||
|
EXPECT_EQ(0, query.getColumn(5).getBytes()); // size of the string "" without the null terminator
|
||||||
|
|
||||||
|
// Use intermediate Column objects (this is not the recommended way to use the API)
|
||||||
|
{
|
||||||
|
const SQLite::Column id = query.getColumn(0);
|
||||||
|
EXPECT_EQ(1, id.getInt64());
|
||||||
|
const SQLite::Column msg = query.getColumn(1);
|
||||||
|
EXPECT_EQ("first", msg.getString());
|
||||||
|
const SQLite::Column integer = query.getColumn(2);
|
||||||
|
EXPECT_EQ(-123, integer.getInt());
|
||||||
|
const SQLite::Column dbl = query.getColumn(3);
|
||||||
|
EXPECT_EQ(0.123, dbl.getDouble());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Column, getName) {
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
EXPECT_EQ(0, db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, msg TEXT)"));
|
||||||
|
EXPECT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, \"first\")"));
|
||||||
|
|
||||||
|
// Compile a SQL query, using the "id" column name as-is, but aliasing the "msg" column with new name "value"
|
||||||
|
SQLite::Statement query(db, "SELECT id, msg as value FROM test");
|
||||||
|
query.executeStep();
|
||||||
|
|
||||||
|
// Show how to get the aliased names of the result columns.
|
||||||
|
const std::string name0 = query.getColumn(0).getName();
|
||||||
|
const std::string name1 = query.getColumn(1).getName();
|
||||||
|
EXPECT_EQ("id", name0);
|
||||||
|
EXPECT_EQ("value", name1);
|
||||||
|
|
||||||
|
#ifdef SQLITE_ENABLE_COLUMN_METADATA
|
||||||
|
// Show how to get origin names of the table columns from which theses result columns come from.
|
||||||
|
// Requires the SQLITE_ENABLE_COLUMN_METADATA preprocessor macro to be
|
||||||
|
// also defined at compile times of the SQLite library itself.
|
||||||
|
const std::string oname0 = query.getColumn(0).getOriginName();
|
||||||
|
const std::string oname1 = query.getColumn(1).getOriginName();
|
||||||
|
EXPECT_EQ("id", oname0);
|
||||||
|
EXPECT_EQ("msg", oname1);
|
||||||
|
#endif
|
||||||
|
}
|
329
3rd-party/SRombauts-SQLiteCpp-f69986a/tests/Database_test.cpp
vendored
Normal file
329
3rd-party/SRombauts-SQLiteCpp-f69986a/tests/Database_test.cpp
vendored
Normal file
@@ -0,0 +1,329 @@
|
|||||||
|
/**
|
||||||
|
* @file Database_test.cpp
|
||||||
|
* @ingroup tests
|
||||||
|
* @brief Test of a SQLiteCpp Database.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <SQLiteCpp/Database.h>
|
||||||
|
|
||||||
|
#include <sqlite3.h> // for SQLITE_ERROR and SQLITE_VERSION_NUMBER
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
#ifdef SQLITECPP_ENABLE_ASSERT_HANDLER
|
||||||
|
namespace SQLite
|
||||||
|
{
|
||||||
|
/// definition of the assertion handler enabled when SQLITECPP_ENABLE_ASSERT_HANDLER is defined in the project (CMakeList.txt)
|
||||||
|
void assertion_failed(const char* apFile, const long apLine, const char* apFunc, const char* apExpr, const char* apMsg)
|
||||||
|
{
|
||||||
|
// TODO: unit test that this assertion callback get called (already tested manually)
|
||||||
|
std::cout << "assertion_failed(" << apFile << ", " << apLine << ", " << apFunc << ", " << apExpr << ", " << apMsg << ")\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
TEST(SQLiteCpp, version) {
|
||||||
|
EXPECT_STREQ(SQLITE_VERSION, SQLite::VERSION);
|
||||||
|
EXPECT_EQ (SQLITE_VERSION_NUMBER, SQLite::VERSION_NUMBER);
|
||||||
|
EXPECT_STREQ(SQLITE_VERSION, SQLite::getLibVersion());
|
||||||
|
EXPECT_EQ (SQLITE_VERSION_NUMBER, SQLite::getLibVersionNumber());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Database, ctorExecCreateDropExist) {
|
||||||
|
remove("test.db3");
|
||||||
|
{
|
||||||
|
// Try to open a non-existing database
|
||||||
|
std::string filename = "test.db3";
|
||||||
|
EXPECT_THROW(SQLite::Database not_found(filename), SQLite::Exception);
|
||||||
|
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db("test.db3", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
EXPECT_STREQ("test.db3", db.getFilename().c_str());
|
||||||
|
EXPECT_FALSE(db.tableExists("test"));
|
||||||
|
EXPECT_FALSE(db.tableExists(std::string("test")));
|
||||||
|
EXPECT_EQ(0, db.getLastInsertRowid());
|
||||||
|
|
||||||
|
EXPECT_EQ(0, db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT)"));
|
||||||
|
EXPECT_TRUE(db.tableExists("test"));
|
||||||
|
EXPECT_TRUE(db.tableExists(std::string("test")));
|
||||||
|
EXPECT_EQ(0, db.getLastInsertRowid());
|
||||||
|
|
||||||
|
EXPECT_EQ(0, db.exec("DROP TABLE IF EXISTS test"));
|
||||||
|
EXPECT_FALSE(db.tableExists("test"));
|
||||||
|
EXPECT_FALSE(db.tableExists(std::string("test")));
|
||||||
|
EXPECT_EQ(0, db.getLastInsertRowid());
|
||||||
|
} // Close DB test.db3
|
||||||
|
remove("test.db3");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Database, createCloseReopen) {
|
||||||
|
remove("test.db3");
|
||||||
|
{
|
||||||
|
// Try to open the non-existing database
|
||||||
|
EXPECT_THROW(SQLite::Database not_found("test.db3"), SQLite::Exception);
|
||||||
|
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db("test.db3", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
EXPECT_FALSE(db.tableExists("test"));
|
||||||
|
db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT)");
|
||||||
|
EXPECT_TRUE(db.tableExists("test"));
|
||||||
|
} // Close DB test.db3
|
||||||
|
{
|
||||||
|
// Reopen the database file
|
||||||
|
SQLite::Database db("test.db3", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
EXPECT_TRUE(db.tableExists("test"));
|
||||||
|
} // Close DB test.db3
|
||||||
|
remove("test.db3");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Database, inMemory) {
|
||||||
|
{
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE);
|
||||||
|
EXPECT_FALSE(db.tableExists("test"));
|
||||||
|
db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT)");
|
||||||
|
EXPECT_TRUE(db.tableExists("test"));
|
||||||
|
// Create a new database: not shared with the above db
|
||||||
|
SQLite::Database db2(":memory:");
|
||||||
|
EXPECT_FALSE(db2.tableExists("test"));
|
||||||
|
} // Close an destroy DBs
|
||||||
|
{
|
||||||
|
// Create a new database: no more "test" table
|
||||||
|
SQLite::Database db(":memory:");
|
||||||
|
EXPECT_FALSE(db.tableExists("test"));
|
||||||
|
} // Close an destroy DB
|
||||||
|
}
|
||||||
|
|
||||||
|
#if SQLITE_VERSION_NUMBER >= 3007015 // SQLite v3.7.15 is first version with PRAGMA busy_timeout
|
||||||
|
TEST(Database, busyTimeout) {
|
||||||
|
{
|
||||||
|
// Create a new database with default timeout of 0ms
|
||||||
|
SQLite::Database db(":memory:");
|
||||||
|
// Busy timeout default to 0ms: any contention between threads or process leads to SQLITE_BUSY error
|
||||||
|
EXPECT_EQ(0, db.execAndGet("PRAGMA busy_timeout").getInt());
|
||||||
|
|
||||||
|
// Set a non null busy timeout: any contention between threads will leads to as much retry as possible during the time
|
||||||
|
db.setBusyTimeout(5000);
|
||||||
|
EXPECT_EQ(5000, db.execAndGet("PRAGMA busy_timeout").getInt());
|
||||||
|
|
||||||
|
// Reset timeout to 0
|
||||||
|
db.setBusyTimeout(0);
|
||||||
|
EXPECT_EQ(0, db.execAndGet("PRAGMA busy_timeout").getInt());
|
||||||
|
}
|
||||||
|
{
|
||||||
|
// Create a new database with a non null busy timeout
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE, 5000);
|
||||||
|
EXPECT_EQ(5000, db.execAndGet("PRAGMA busy_timeout").getInt());
|
||||||
|
|
||||||
|
// Reset timeout to null
|
||||||
|
db.setBusyTimeout(0);
|
||||||
|
EXPECT_EQ(0, db.execAndGet("PRAGMA busy_timeout").getInt());
|
||||||
|
}
|
||||||
|
{
|
||||||
|
// Create a new database with a non null busy timeout
|
||||||
|
const std::string memory = ":memory:";
|
||||||
|
SQLite::Database db(memory, SQLite::OPEN_READWRITE, 5000);
|
||||||
|
EXPECT_EQ(5000, db.execAndGet("PRAGMA busy_timeout").getInt());
|
||||||
|
|
||||||
|
// Reset timeout to null
|
||||||
|
db.setBusyTimeout(0);
|
||||||
|
EXPECT_EQ(0, db.execAndGet("PRAGMA busy_timeout").getInt());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // SQLITE_VERSION_NUMBER >= 3007015
|
||||||
|
|
||||||
|
TEST(Database, exec) {
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE);
|
||||||
|
|
||||||
|
// Create a new table with an explicit "id" column aliasing the underlying rowid
|
||||||
|
// NOTE: here exec() returns 0 only because it is the first statements since database connexion,
|
||||||
|
// but its return is an undefined value for "CREATE TABLE" statements.
|
||||||
|
db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT)");
|
||||||
|
EXPECT_EQ(0, db.getLastInsertRowid());
|
||||||
|
EXPECT_EQ(0, db.getTotalChanges());
|
||||||
|
|
||||||
|
// first row : insert the "first" text value into new row of id 1
|
||||||
|
EXPECT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, \"first\")"));
|
||||||
|
EXPECT_EQ(1, db.getLastInsertRowid());
|
||||||
|
EXPECT_EQ(1, db.getTotalChanges());
|
||||||
|
|
||||||
|
// second row : insert the "second" text value into new row of id 2
|
||||||
|
EXPECT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, \"second\")"));
|
||||||
|
EXPECT_EQ(2, db.getLastInsertRowid());
|
||||||
|
EXPECT_EQ(2, db.getTotalChanges());
|
||||||
|
|
||||||
|
// third row : insert the "third" text value into new row of id 3
|
||||||
|
const std::string insert("INSERT INTO test VALUES (NULL, \"third\")");
|
||||||
|
EXPECT_EQ(1, db.exec(insert));
|
||||||
|
EXPECT_EQ(3, db.getLastInsertRowid());
|
||||||
|
EXPECT_EQ(3, db.getTotalChanges());
|
||||||
|
|
||||||
|
// update the second row : update text value to "second_updated"
|
||||||
|
EXPECT_EQ(1, db.exec("UPDATE test SET value=\"second-updated\" WHERE id='2'"));
|
||||||
|
EXPECT_EQ(3, db.getLastInsertRowid()); // last inserted row ID is still 3
|
||||||
|
EXPECT_EQ(4, db.getTotalChanges());
|
||||||
|
|
||||||
|
// delete the third row
|
||||||
|
EXPECT_EQ(1, db.exec("DELETE FROM test WHERE id='3'"));
|
||||||
|
EXPECT_EQ(3, db.getLastInsertRowid());
|
||||||
|
EXPECT_EQ(5, db.getTotalChanges());
|
||||||
|
|
||||||
|
// drop the whole table, ie the two remaining columns
|
||||||
|
// NOTE: here exec() returns 1, like the last time, as it is an undefined value for "DROP TABLE" statements
|
||||||
|
db.exec("DROP TABLE IF EXISTS test");
|
||||||
|
EXPECT_FALSE(db.tableExists("test"));
|
||||||
|
EXPECT_EQ(5, db.getTotalChanges());
|
||||||
|
|
||||||
|
// Re-Create the same table
|
||||||
|
// NOTE: here exec() returns 1, like the last time, as it is an undefined value for "CREATE TABLE" statements
|
||||||
|
db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT)");
|
||||||
|
EXPECT_EQ(5, db.getTotalChanges());
|
||||||
|
|
||||||
|
// insert two rows with two *different* statements => returns only 1, ie. for the second INSERT statement
|
||||||
|
EXPECT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, \"first\");INSERT INTO test VALUES (NULL, \"second\");"));
|
||||||
|
EXPECT_EQ(2, db.getLastInsertRowid());
|
||||||
|
EXPECT_EQ(7, db.getTotalChanges());
|
||||||
|
|
||||||
|
#if (SQLITE_VERSION_NUMBER >= 3007011)
|
||||||
|
// insert two rows with only one statement (starting with SQLite 3.7.11) => returns 2
|
||||||
|
EXPECT_EQ(2, db.exec("INSERT INTO test VALUES (NULL, \"third\"), (NULL, \"fourth\");"));
|
||||||
|
EXPECT_EQ(4, db.getLastInsertRowid());
|
||||||
|
EXPECT_EQ(9, db.getTotalChanges());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Database, execAndGet) {
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE);
|
||||||
|
|
||||||
|
// Create a new table with an explicit "id" column aliasing the underlying rowid
|
||||||
|
db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT, weight INTEGER)");
|
||||||
|
|
||||||
|
// insert a few rows
|
||||||
|
EXPECT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, \"first\", 3)"));
|
||||||
|
EXPECT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, \"second\", 5)"));
|
||||||
|
EXPECT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, \"third\", 7)"));
|
||||||
|
|
||||||
|
// Get a single value result with an easy to use shortcut
|
||||||
|
EXPECT_STREQ("second", db.execAndGet("SELECT value FROM test WHERE id=2"));
|
||||||
|
EXPECT_STREQ("third", db.execAndGet("SELECT value FROM test WHERE weight=7"));
|
||||||
|
EXPECT_EQ(3, db.execAndGet("SELECT weight FROM test WHERE value=\"first\"").getInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Database, execException) {
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE);
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getExtendedErrorCode());
|
||||||
|
|
||||||
|
// exception with SQL error: "no such table"
|
||||||
|
EXPECT_THROW(db.exec("INSERT INTO test VALUES (NULL, \"first\", 3)"), SQLite::Exception);
|
||||||
|
EXPECT_EQ(SQLITE_ERROR, db.getErrorCode());
|
||||||
|
EXPECT_EQ(SQLITE_ERROR, db.getExtendedErrorCode());
|
||||||
|
EXPECT_STREQ("no such table: test", db.getErrorMsg());
|
||||||
|
|
||||||
|
// Create a new table
|
||||||
|
db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT, weight INTEGER)");
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getExtendedErrorCode());
|
||||||
|
EXPECT_STREQ("not an error", db.getErrorMsg());
|
||||||
|
|
||||||
|
// exception with SQL error: "table test has 3 columns but 2 values were supplied"
|
||||||
|
EXPECT_THROW(db.exec("INSERT INTO test VALUES (NULL, 3)"), SQLite::Exception);
|
||||||
|
EXPECT_EQ(SQLITE_ERROR, db.getErrorCode());
|
||||||
|
EXPECT_EQ(SQLITE_ERROR, db.getExtendedErrorCode());
|
||||||
|
EXPECT_STREQ("table test has 3 columns but 2 values were supplied", db.getErrorMsg());
|
||||||
|
|
||||||
|
// exception with SQL error: "No row to get a column from"
|
||||||
|
EXPECT_THROW(db.execAndGet("SELECT weight FROM test WHERE value=\"first\""), SQLite::Exception);
|
||||||
|
|
||||||
|
EXPECT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, \"first\", 3)"));
|
||||||
|
// exception with SQL error: "No row to get a column from"
|
||||||
|
EXPECT_THROW(db.execAndGet("SELECT weight FROM test WHERE value=\"second\""), SQLite::Exception);
|
||||||
|
|
||||||
|
// Add a row with more values than columns in the table: "table test has 3 columns but 4 values were supplied"
|
||||||
|
EXPECT_THROW(db.exec("INSERT INTO test VALUES (NULL, \"first\", 123, 0.123)"), SQLite::Exception);
|
||||||
|
EXPECT_EQ(SQLITE_ERROR, db.getErrorCode());
|
||||||
|
EXPECT_EQ(SQLITE_ERROR, db.getExtendedErrorCode());
|
||||||
|
EXPECT_STREQ("table test has 3 columns but 4 values were supplied", db.getErrorMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: test Database::createFunction()
|
||||||
|
// TODO: test Database::loadExtension()
|
||||||
|
|
||||||
|
#ifdef SQLITE_HAS_CODEC
|
||||||
|
TEST(Database, encryptAndDecrypt) {
|
||||||
|
remove("test.db3");
|
||||||
|
{
|
||||||
|
// Try to open the non-existing database
|
||||||
|
EXPECT_THROW(SQLite::Database not_found("test.db3"), SQLite::Exception);
|
||||||
|
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db("test.db3", SQLite::OPEN_READWRITE | SQLite::OPEN_CREATE);
|
||||||
|
EXPECT_FALSE(db.tableExists("test"));
|
||||||
|
db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT)");
|
||||||
|
EXPECT_TRUE(db.tableExists("test"));
|
||||||
|
} // Close DB test.db3
|
||||||
|
{
|
||||||
|
// Reopen the database file and encrypt it
|
||||||
|
EXPECT_TRUE(SQLite::Database::isUnencrypted("test.db3"));
|
||||||
|
SQLite::Database db("test.db3", SQLite::OPEN_READWRITE);
|
||||||
|
// Encrypt the database
|
||||||
|
db.rekey("123secret");
|
||||||
|
} // Close DB test.db3
|
||||||
|
{
|
||||||
|
// Reopen the database file and try to use it
|
||||||
|
EXPECT_FALSE(SQLite::Database::isUnencrypted("test.db3"));
|
||||||
|
SQLite::Database db("test.db3", SQLite::OPEN_READONLY);
|
||||||
|
EXPECT_THROW(db.tableExists("test"), SQLite::Exception);
|
||||||
|
db.key("123secret");
|
||||||
|
EXPECT_TRUE(db.tableExists("test"));
|
||||||
|
} // Close DB test.db3
|
||||||
|
{
|
||||||
|
// Reopen the database file and decrypt it
|
||||||
|
EXPECT_FALSE(SQLite::Database::isUnencrypted("test.db3"));
|
||||||
|
SQLite::Database db("test.db3", SQLite::OPEN_READWRITE);
|
||||||
|
// Decrypt the database
|
||||||
|
db.key("123secret");
|
||||||
|
db.rekey("");
|
||||||
|
} // Close DB test.db3
|
||||||
|
{
|
||||||
|
// Reopen the database file and use it
|
||||||
|
EXPECT_TRUE(SQLite::Database::isUnencrypted("test.db3"));
|
||||||
|
SQLite::Database db("test.db3", SQLite::OPEN_READWRITE);
|
||||||
|
EXPECT_TRUE(db.tableExists("test"));
|
||||||
|
} // Close DB test.db3
|
||||||
|
remove("test.db3");
|
||||||
|
}
|
||||||
|
#else // SQLITE_HAS_CODEC
|
||||||
|
TEST(Database, encryptAndDecrypt) {
|
||||||
|
remove("test.db3");
|
||||||
|
{
|
||||||
|
// Try to open the non-existing database
|
||||||
|
EXPECT_THROW(SQLite::Database not_found("test.db3"), SQLite::Exception);
|
||||||
|
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db("test.db3", SQLite::OPEN_READWRITE | SQLite::OPEN_CREATE);
|
||||||
|
EXPECT_FALSE(db.tableExists("test"));
|
||||||
|
db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT)");
|
||||||
|
EXPECT_TRUE(db.tableExists("test"));
|
||||||
|
} // Close DB test.db3
|
||||||
|
{
|
||||||
|
// Reopen the database file and encrypt it
|
||||||
|
EXPECT_TRUE(SQLite::Database::isUnencrypted("test.db3"));
|
||||||
|
SQLite::Database db("test.db3", SQLite::OPEN_READWRITE);
|
||||||
|
// Encrypt the database
|
||||||
|
EXPECT_THROW(db.key("123secret"), SQLite::Exception);
|
||||||
|
EXPECT_THROW(db.rekey("123secret"), SQLite::Exception);
|
||||||
|
} // Close DB test.db3
|
||||||
|
remove("test.db3");
|
||||||
|
}
|
||||||
|
#endif // SQLITE_HAS_CODEC
|
710
3rd-party/SRombauts-SQLiteCpp-f69986a/tests/Statement_test.cpp
vendored
Normal file
710
3rd-party/SRombauts-SQLiteCpp-f69986a/tests/Statement_test.cpp
vendored
Normal file
@@ -0,0 +1,710 @@
|
|||||||
|
/**
|
||||||
|
* @file Statement_test.cpp
|
||||||
|
* @ingroup tests
|
||||||
|
* @brief Test of a SQLiteCpp Statement.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <SQLiteCpp/Database.h>
|
||||||
|
#include <SQLiteCpp/Statement.h>
|
||||||
|
|
||||||
|
#include <sqlite3.h> // for SQLITE_DONE
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
|
TEST(Statement, invalid) {
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getExtendedErrorCode());
|
||||||
|
|
||||||
|
// Compile a SQL query, but without any table in the database
|
||||||
|
EXPECT_THROW(SQLite::Statement query(db, "SELECT * FROM test"), SQLite::Exception);
|
||||||
|
EXPECT_EQ(SQLITE_ERROR, db.getErrorCode());
|
||||||
|
EXPECT_EQ(SQLITE_ERROR, db.getExtendedErrorCode());
|
||||||
|
|
||||||
|
EXPECT_EQ(0, db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT)"));
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getExtendedErrorCode());
|
||||||
|
|
||||||
|
// Compile a SQL query with no parameter
|
||||||
|
SQLite::Statement query(db, "SELECT * FROM test");
|
||||||
|
EXPECT_STREQ("SELECT * FROM test", query.getQuery().c_str());
|
||||||
|
EXPECT_EQ(2, query.getColumnCount ());
|
||||||
|
EXPECT_FALSE(query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_EQ(SQLite::OK, query.getErrorCode());
|
||||||
|
EXPECT_EQ(SQLite::OK, query.getExtendedErrorCode());
|
||||||
|
EXPECT_THROW(query.isColumnNull(-1), SQLite::Exception);
|
||||||
|
EXPECT_THROW(query.isColumnNull(0), SQLite::Exception);
|
||||||
|
EXPECT_THROW(query.isColumnNull(1), SQLite::Exception);
|
||||||
|
EXPECT_THROW(query.isColumnNull(2), SQLite::Exception);
|
||||||
|
EXPECT_THROW(query.getColumn(-1), SQLite::Exception);
|
||||||
|
EXPECT_THROW(query.getColumn(0), SQLite::Exception);
|
||||||
|
EXPECT_THROW(query.getColumn(1), SQLite::Exception);
|
||||||
|
EXPECT_THROW(query.getColumn(2), SQLite::Exception);
|
||||||
|
|
||||||
|
query.reset();
|
||||||
|
EXPECT_FALSE(query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_FALSE(query.isOk());
|
||||||
|
EXPECT_TRUE( query.isDone());
|
||||||
|
query.reset();
|
||||||
|
EXPECT_FALSE(query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
|
||||||
|
query.reset();
|
||||||
|
EXPECT_THROW(query.bind(-1, 123), SQLite::Exception);
|
||||||
|
EXPECT_THROW(query.bind(0, 123), SQLite::Exception);
|
||||||
|
EXPECT_THROW(query.bind(1, 123), SQLite::Exception);
|
||||||
|
EXPECT_THROW(query.bind(2, 123), SQLite::Exception);
|
||||||
|
EXPECT_THROW(query.bind(0, "abc"), SQLite::Exception);
|
||||||
|
EXPECT_THROW(query.bind(0), SQLite::Exception);
|
||||||
|
EXPECT_EQ(SQLITE_RANGE, db.getErrorCode());
|
||||||
|
EXPECT_EQ(SQLITE_RANGE, db.getExtendedErrorCode());
|
||||||
|
EXPECT_STREQ("bind or column index out of range", db.getErrorMsg());
|
||||||
|
EXPECT_EQ(SQLITE_RANGE, query.getErrorCode());
|
||||||
|
EXPECT_EQ(SQLITE_RANGE, query.getExtendedErrorCode());
|
||||||
|
EXPECT_STREQ("bind or column index out of range", query.getErrorMsg());
|
||||||
|
|
||||||
|
query.exec(); // exec() instead of executeStep() as there is no result
|
||||||
|
EXPECT_THROW(query.isColumnNull(0), SQLite::Exception);
|
||||||
|
EXPECT_THROW(query.getColumn(0), SQLite::Exception);
|
||||||
|
|
||||||
|
EXPECT_THROW(query.exec(), SQLite::Exception); // exec() shall throw as it needs to be reseted
|
||||||
|
|
||||||
|
// Add a first row
|
||||||
|
EXPECT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, \"first\")"));
|
||||||
|
EXPECT_EQ(1, db.getLastInsertRowid());
|
||||||
|
EXPECT_EQ(1, db.getTotalChanges());
|
||||||
|
|
||||||
|
query.reset();
|
||||||
|
EXPECT_FALSE(query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
|
||||||
|
EXPECT_THROW(query.exec(), SQLite::Exception); // exec() shall throw as it does not expect a result
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Statement, executeStep) {
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
|
||||||
|
// Create a new table
|
||||||
|
EXPECT_EQ(0, db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, msg TEXT, int INTEGER, double REAL)"));
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
|
||||||
|
// Create a first row
|
||||||
|
EXPECT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, \"first\", 123, 0.123)"));
|
||||||
|
EXPECT_EQ(1, db.getLastInsertRowid());
|
||||||
|
|
||||||
|
// Compile a SQL query
|
||||||
|
SQLite::Statement query(db, "SELECT * FROM test");
|
||||||
|
EXPECT_STREQ("SELECT * FROM test", query.getQuery().c_str());
|
||||||
|
EXPECT_EQ(4, query.getColumnCount());
|
||||||
|
|
||||||
|
// Get the first row
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
const int64_t id = query.getColumn(0);
|
||||||
|
const std::string msg = query.getColumn(1);
|
||||||
|
const int integer = query.getColumn(2);
|
||||||
|
const long integer2= query.getColumn(2);
|
||||||
|
const double real = query.getColumn(3);
|
||||||
|
EXPECT_EQ(1, id);
|
||||||
|
EXPECT_EQ("first", msg);
|
||||||
|
EXPECT_EQ(123, integer);
|
||||||
|
EXPECT_EQ(123, integer2);
|
||||||
|
EXPECT_EQ(0.123, real);
|
||||||
|
|
||||||
|
// Step one more time to discover there is nothing more
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_FALSE(query.isOk());
|
||||||
|
EXPECT_TRUE (query.isDone()); // "done" is "the end"
|
||||||
|
|
||||||
|
// Step after "the end" throw an exception
|
||||||
|
EXPECT_THROW(query.executeStep(), SQLite::Exception);
|
||||||
|
|
||||||
|
// Try to insert a new row with the same PRIMARY KEY: "UNIQUE constraint failed: test.id"
|
||||||
|
SQLite::Statement insert(db, "INSERT INTO test VALUES (1, \"impossible\", 456, 0.456)");
|
||||||
|
EXPECT_THROW(insert.executeStep(), SQLite::Exception);
|
||||||
|
// in this case, reset() do throw again the same error
|
||||||
|
EXPECT_THROW(insert.reset(), SQLite::Exception);
|
||||||
|
|
||||||
|
// Try again to insert a new row with the same PRIMARY KEY (with an alternative method): "UNIQUE constraint failed: test.id"
|
||||||
|
SQLite::Statement insert2(db, "INSERT INTO test VALUES (1, \"impossible\", 456, 0.456)");
|
||||||
|
EXPECT_THROW(insert2.exec(), SQLite::Exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Statement, bindings) {
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
|
||||||
|
// Create a new table
|
||||||
|
EXPECT_EQ(0, db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, msg TEXT, int INTEGER, double REAL)"));
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
|
||||||
|
// Insertion with bindable parameters
|
||||||
|
SQLite::Statement insert(db, "INSERT INTO test VALUES (NULL, ?, ?, ?)");
|
||||||
|
|
||||||
|
// Compile a SQL query to check the results
|
||||||
|
SQLite::Statement query(db, "SELECT * FROM test");
|
||||||
|
EXPECT_STREQ("SELECT * FROM test", query.getQuery().c_str());
|
||||||
|
EXPECT_EQ(4, query.getColumnCount());
|
||||||
|
|
||||||
|
// First row with text/int/double
|
||||||
|
{
|
||||||
|
const char* text = "first";
|
||||||
|
const int integer = -123;
|
||||||
|
const double dbl = 0.123;
|
||||||
|
insert.bind(1, text);
|
||||||
|
insert.bind(2, integer);
|
||||||
|
insert.bind(3, dbl);
|
||||||
|
EXPECT_EQ(1, insert.exec());
|
||||||
|
EXPECT_EQ(SQLITE_DONE, db.getErrorCode());
|
||||||
|
|
||||||
|
// Check the result
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_EQ (1, query.getColumn(0).getInt64());
|
||||||
|
EXPECT_STREQ("first", query.getColumn(1).getText());
|
||||||
|
EXPECT_EQ (-123, query.getColumn(2).getInt());
|
||||||
|
EXPECT_EQ (0.123, query.getColumn(3).getDouble());
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset() without clearbindings()
|
||||||
|
insert.reset();
|
||||||
|
|
||||||
|
// Second row with the same exact values because clearbindings() was not called
|
||||||
|
{
|
||||||
|
EXPECT_EQ(1, insert.exec());
|
||||||
|
EXPECT_EQ(SQLITE_DONE, db.getErrorCode());
|
||||||
|
|
||||||
|
// Check the result
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_EQ (2, query.getColumn(0).getInt64());
|
||||||
|
EXPECT_STREQ("first", query.getColumn(1).getText());
|
||||||
|
EXPECT_EQ (-123, query.getColumn(2).getInt());
|
||||||
|
EXPECT_EQ (0.123, query.getColumn(3).getDouble());
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset() with clearbindings() and no more bindings
|
||||||
|
insert.reset();
|
||||||
|
insert.clearBindings();
|
||||||
|
|
||||||
|
// Third row with the all null values because clearbindings() was called
|
||||||
|
{
|
||||||
|
EXPECT_EQ(1, insert.exec());
|
||||||
|
EXPECT_EQ(SQLITE_DONE, db.getErrorCode());
|
||||||
|
|
||||||
|
// Check the resultw
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_EQ (3, query.getColumn(0).getInt64());
|
||||||
|
EXPECT_TRUE (query.isColumnNull(1));
|
||||||
|
EXPECT_STREQ("", query.getColumn(1).getText());
|
||||||
|
EXPECT_TRUE (query.isColumnNull(2));
|
||||||
|
EXPECT_EQ (0, query.getColumn(2).getInt());
|
||||||
|
EXPECT_TRUE (query.isColumnNull(3));
|
||||||
|
EXPECT_EQ (0.0, query.getColumn(3).getDouble());
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset() with clearbindings() and new bindings
|
||||||
|
insert.reset();
|
||||||
|
insert.clearBindings();
|
||||||
|
|
||||||
|
// Fourth row with string/int64/float
|
||||||
|
{
|
||||||
|
const std::string fourth("fourth");
|
||||||
|
const long long int64 = 12345678900000LL;
|
||||||
|
const float float32 = 0.234f;
|
||||||
|
insert.bind(1, fourth);
|
||||||
|
insert.bind(2, int64);
|
||||||
|
insert.bind(3, float32);
|
||||||
|
EXPECT_EQ(1, insert.exec());
|
||||||
|
EXPECT_EQ(SQLITE_DONE, db.getErrorCode());
|
||||||
|
|
||||||
|
// Check the result
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_EQ(4, query.getColumn(0).getInt64());
|
||||||
|
EXPECT_EQ(fourth, query.getColumn(1).getText());
|
||||||
|
EXPECT_EQ(12345678900000LL, query.getColumn(2).getInt64());
|
||||||
|
EXPECT_EQ(0.234f, query.getColumn(3).getDouble());
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset() without clearbindings()
|
||||||
|
insert.reset();
|
||||||
|
|
||||||
|
// Fifth row with binary buffer and a null parameter
|
||||||
|
{
|
||||||
|
const char buffer[] = "binary";
|
||||||
|
insert.bind(1, buffer, sizeof(buffer));
|
||||||
|
insert.bind(2);
|
||||||
|
EXPECT_EQ(1, insert.exec());
|
||||||
|
|
||||||
|
// Check the result
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_EQ(5, query.getColumn(0).getInt64());
|
||||||
|
EXPECT_STREQ(buffer, query.getColumn(1).getText());
|
||||||
|
EXPECT_TRUE (query.isColumnNull(2));
|
||||||
|
EXPECT_EQ(0, query.getColumn(2).getInt());
|
||||||
|
EXPECT_EQ(0.234f, query.getColumn(3).getDouble());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// reset() without clearbindings()
|
||||||
|
insert.reset();
|
||||||
|
|
||||||
|
// Sixth row with uint32_t unsigned value
|
||||||
|
{
|
||||||
|
const uint32_t uint32 = 4294967295U;
|
||||||
|
insert.bind(2, uint32);
|
||||||
|
EXPECT_EQ(1, insert.exec());
|
||||||
|
EXPECT_EQ(SQLITE_DONE, db.getErrorCode());
|
||||||
|
|
||||||
|
// Check the result
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE(query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_EQ(6, query.getColumn(0).getInt64());
|
||||||
|
EXPECT_EQ(4294967295U, query.getColumn(2).getUInt());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Statement, bindNoCopy) {
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
|
||||||
|
// Create a new table
|
||||||
|
EXPECT_EQ(0, db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, txt1 TEXT, txt2 TEXT, binary BLOB)"));
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
|
||||||
|
// Insertion with bindable parameters
|
||||||
|
SQLite::Statement insert(db, "INSERT INTO test VALUES (NULL, ?, ?, ?)");
|
||||||
|
|
||||||
|
// Compile a SQL query to check the results
|
||||||
|
SQLite::Statement query(db, "SELECT * FROM test");
|
||||||
|
EXPECT_STREQ("SELECT * FROM test", query.getQuery().c_str());
|
||||||
|
EXPECT_EQ(4, query.getColumnCount());
|
||||||
|
|
||||||
|
// Insert one row with all variants of bindNoCopy()
|
||||||
|
{
|
||||||
|
const char* txt1 = "first";
|
||||||
|
const std::string txt2 = "sec\0nd";
|
||||||
|
const char blob[] = {'b','l','\0','b'};
|
||||||
|
insert.bindNoCopy(1, txt1);
|
||||||
|
insert.bindNoCopy(2, txt2);
|
||||||
|
insert.bindNoCopy(3, blob, sizeof(blob));
|
||||||
|
EXPECT_EQ(1, insert.exec());
|
||||||
|
EXPECT_EQ(SQLITE_DONE, db.getErrorCode());
|
||||||
|
|
||||||
|
// Check the result
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE(query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_EQ(1, query.getColumn(0).getInt64());
|
||||||
|
EXPECT_STREQ(txt1, query.getColumn(1).getText());
|
||||||
|
EXPECT_EQ(0, memcmp(&txt2[0], &query.getColumn(2).getString()[0], txt2.size()));
|
||||||
|
EXPECT_EQ(0, memcmp(blob, &query.getColumn(3).getString()[0], sizeof(blob)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Statement, bindByName) {
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
|
||||||
|
// Create a new table
|
||||||
|
EXPECT_EQ(0, db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, msg TEXT, int INTEGER, double REAL)"));
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
|
||||||
|
// Insertion with bindable parameters
|
||||||
|
SQLite::Statement insert(db, "INSERT INTO test VALUES (NULL, @msg, @int, @double)");
|
||||||
|
|
||||||
|
// First row with text/int/double
|
||||||
|
insert.bind("@msg", "first");
|
||||||
|
insert.bind("@int", 123);
|
||||||
|
insert.bind("@double", 0.123);
|
||||||
|
EXPECT_EQ(1, insert.exec());
|
||||||
|
EXPECT_EQ(SQLITE_DONE, db.getErrorCode());
|
||||||
|
|
||||||
|
// Compile a SQL query to check the result
|
||||||
|
SQLite::Statement query(db, "SELECT * FROM test");
|
||||||
|
EXPECT_STREQ("SELECT * FROM test", query.getQuery().c_str());
|
||||||
|
EXPECT_EQ(4, query.getColumnCount());
|
||||||
|
|
||||||
|
// Check the result
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_EQ (1, query.getColumn(0).getInt64());
|
||||||
|
EXPECT_STREQ("first", query.getColumn(1).getText());
|
||||||
|
EXPECT_EQ (123, query.getColumn(2).getInt());
|
||||||
|
EXPECT_EQ (0.123, query.getColumn(3).getDouble());
|
||||||
|
|
||||||
|
// reset() with clearbindings() and new bindings
|
||||||
|
insert.reset();
|
||||||
|
insert.clearBindings();
|
||||||
|
|
||||||
|
// Second row with string/int64/float
|
||||||
|
{
|
||||||
|
const std::string second("second");
|
||||||
|
const long long int64 = 12345678900000LL;
|
||||||
|
const float float32 = 0.234f;
|
||||||
|
insert.bind("@msg", second);
|
||||||
|
insert.bind("@int", int64);
|
||||||
|
insert.bind("@double", float32);
|
||||||
|
EXPECT_EQ(1, insert.exec());
|
||||||
|
EXPECT_EQ(SQLITE_DONE, db.getErrorCode());
|
||||||
|
|
||||||
|
// Check the result
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_EQ(2, query.getColumn(0).getInt64());
|
||||||
|
EXPECT_EQ(second, query.getColumn(1).getText());
|
||||||
|
EXPECT_EQ(12345678900000LL, query.getColumn(2).getInt64());
|
||||||
|
EXPECT_EQ(0.234f, query.getColumn(3).getDouble());
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset() without clearbindings()
|
||||||
|
insert.reset();
|
||||||
|
|
||||||
|
// Third row with binary buffer and a null parameter
|
||||||
|
{
|
||||||
|
const char buffer[] = "binary";
|
||||||
|
insert.bind("@msg", buffer, sizeof(buffer));
|
||||||
|
insert.bind("@int");
|
||||||
|
EXPECT_EQ(1, insert.exec());
|
||||||
|
|
||||||
|
// Check the result
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_EQ(3, query.getColumn(0).getInt64());
|
||||||
|
EXPECT_STREQ(buffer, query.getColumn(1).getText());
|
||||||
|
EXPECT_TRUE (query.isColumnNull(2));
|
||||||
|
EXPECT_EQ(0, query.getColumn(2).getInt());
|
||||||
|
EXPECT_EQ(0.234f, query.getColumn(3).getDouble());
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset() without clearbindings()
|
||||||
|
insert.reset();
|
||||||
|
|
||||||
|
// Fourth row with uint32_t unsigned value
|
||||||
|
{
|
||||||
|
const uint32_t uint32 = 4294967295U;
|
||||||
|
insert.bind("@int", uint32);
|
||||||
|
EXPECT_EQ(1, insert.exec());
|
||||||
|
EXPECT_EQ(SQLITE_DONE, db.getErrorCode());
|
||||||
|
|
||||||
|
// Check the result
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE(query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_EQ(4, query.getColumn(0).getInt64());
|
||||||
|
EXPECT_EQ(4294967295U, query.getColumn(2).getUInt());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Statement, bindNoCopyByName) {
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
|
||||||
|
// Create a new table
|
||||||
|
EXPECT_EQ(0, db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, txt1 TEXT, txt2 TEXT, binary BLOB)"));
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
|
||||||
|
// Insertion with bindable parameters
|
||||||
|
SQLite::Statement insert(db, "INSERT INTO test VALUES (NULL, @txt1, @txt2, @blob)");
|
||||||
|
|
||||||
|
// Compile a SQL query to check the results
|
||||||
|
SQLite::Statement query(db, "SELECT * FROM test");
|
||||||
|
EXPECT_STREQ("SELECT * FROM test", query.getQuery().c_str());
|
||||||
|
EXPECT_EQ(4, query.getColumnCount());
|
||||||
|
|
||||||
|
// Insert one row with all variants of bindNoCopy()
|
||||||
|
{
|
||||||
|
const char* txt1 = "first";
|
||||||
|
const std::string txt2 = "sec\0nd";
|
||||||
|
const char blob[] = { 'b','l','\0','b' };
|
||||||
|
insert.bindNoCopy("@txt1", txt1);
|
||||||
|
insert.bindNoCopy("@txt2", txt2);
|
||||||
|
insert.bindNoCopy("@blob", blob, sizeof(blob));
|
||||||
|
EXPECT_EQ(1, insert.exec());
|
||||||
|
EXPECT_EQ(SQLITE_DONE, db.getErrorCode());
|
||||||
|
|
||||||
|
// Check the result
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE(query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_EQ(1, query.getColumn(0).getInt64());
|
||||||
|
EXPECT_STREQ(txt1, query.getColumn(1).getText());
|
||||||
|
EXPECT_EQ(0, memcmp(&txt2[0], &query.getColumn(2).getString()[0], txt2.size()));
|
||||||
|
EXPECT_EQ(0, memcmp(blob, &query.getColumn(3).getString()[0], sizeof(blob)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Statement, isColumnNull) {
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
ASSERT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
|
||||||
|
// Create a new table
|
||||||
|
EXPECT_EQ(0, db.exec("CREATE TABLE test (msg TEXT, int INTEGER, double REAL)"));
|
||||||
|
ASSERT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
|
||||||
|
// Create a first row with no null values, then other rows with each time a NULL value
|
||||||
|
ASSERT_EQ(1, db.exec("INSERT INTO test VALUES (\"first\", 123, 0.123)"));
|
||||||
|
ASSERT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, 123, 0.123)"));
|
||||||
|
ASSERT_EQ(1, db.exec("INSERT INTO test VALUES (\"first\", NULL, 0.123)"));
|
||||||
|
ASSERT_EQ(1, db.exec("INSERT INTO test VALUES (\"first\", 123, NULL)"));
|
||||||
|
|
||||||
|
// Compile a SQL query
|
||||||
|
const std::string select("SELECT * FROM test");
|
||||||
|
SQLite::Statement query(db, select);
|
||||||
|
EXPECT_EQ(select, query.getQuery());
|
||||||
|
EXPECT_EQ(3, query.getColumnCount());
|
||||||
|
|
||||||
|
// Get the first non-null row
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_THROW(query.isColumnNull(-1), SQLite::Exception);
|
||||||
|
EXPECT_EQ(false, query.isColumnNull(0));
|
||||||
|
EXPECT_EQ(false, query.isColumnNull(1));
|
||||||
|
EXPECT_EQ(false, query.isColumnNull(2));
|
||||||
|
EXPECT_THROW(query.isColumnNull(3), SQLite::Exception);
|
||||||
|
|
||||||
|
// Get the second row with null text
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_THROW(query.isColumnNull(-1), SQLite::Exception);
|
||||||
|
EXPECT_EQ(true, query.isColumnNull(0));
|
||||||
|
EXPECT_EQ(false, query.isColumnNull(1));
|
||||||
|
EXPECT_EQ(false, query.isColumnNull(2));
|
||||||
|
EXPECT_THROW(query.isColumnNull(3), SQLite::Exception);
|
||||||
|
|
||||||
|
// Get the second row with null integer
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_THROW(query.isColumnNull(-1), SQLite::Exception);
|
||||||
|
EXPECT_EQ(false, query.isColumnNull(0));
|
||||||
|
EXPECT_EQ(true, query.isColumnNull(1));
|
||||||
|
EXPECT_EQ(false, query.isColumnNull(2));
|
||||||
|
EXPECT_THROW(query.isColumnNull(3), SQLite::Exception);
|
||||||
|
|
||||||
|
// Get the third row with null float
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_THROW(query.isColumnNull(-1), SQLite::Exception);
|
||||||
|
EXPECT_EQ(false, query.isColumnNull(0));
|
||||||
|
EXPECT_EQ(false, query.isColumnNull(1));
|
||||||
|
EXPECT_EQ(true, query.isColumnNull(2));
|
||||||
|
EXPECT_THROW(query.isColumnNull(3), SQLite::Exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Statement, isColumnNullByName) {
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE);
|
||||||
|
ASSERT_EQ(SQLITE_OK, db.getErrorCode());
|
||||||
|
|
||||||
|
// Create a new table
|
||||||
|
EXPECT_EQ(0, db.exec("CREATE TABLE test (msg TEXT, int INTEGER, double REAL)"));
|
||||||
|
ASSERT_EQ(SQLITE_OK, db.getErrorCode());
|
||||||
|
|
||||||
|
// Create a first row with no null values, then other rows with each time a NULL value
|
||||||
|
ASSERT_EQ(1, db.exec("INSERT INTO test VALUES (\"first\", 123, 0.123)"));
|
||||||
|
ASSERT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, 123, 0.123)"));
|
||||||
|
ASSERT_EQ(1, db.exec("INSERT INTO test VALUES (\"first\", NULL, 0.123)"));
|
||||||
|
ASSERT_EQ(1, db.exec("INSERT INTO test VALUES (\"first\", 123, NULL)"));
|
||||||
|
|
||||||
|
// Compile a SQL query
|
||||||
|
const std::string select("SELECT * FROM test");
|
||||||
|
SQLite::Statement query(db, select);
|
||||||
|
EXPECT_EQ(select, query.getQuery());
|
||||||
|
EXPECT_EQ(3, query.getColumnCount());
|
||||||
|
|
||||||
|
// Get the first non-null row
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_THROW(query.isColumnNull(""), SQLite::Exception);
|
||||||
|
EXPECT_EQ(false, query.isColumnNull("msg"));
|
||||||
|
EXPECT_EQ(false, query.isColumnNull("int"));
|
||||||
|
EXPECT_EQ(false, query.isColumnNull("double"));
|
||||||
|
EXPECT_THROW(query.isColumnNull(3), SQLite::Exception);
|
||||||
|
|
||||||
|
// Get the second row with null text
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_THROW(query.isColumnNull(""), SQLite::Exception);
|
||||||
|
EXPECT_EQ(true, query.isColumnNull("msg"));
|
||||||
|
EXPECT_EQ(false, query.isColumnNull(1));
|
||||||
|
EXPECT_EQ(false, query.isColumnNull("double"));
|
||||||
|
EXPECT_THROW(query.isColumnNull(3), SQLite::Exception);
|
||||||
|
|
||||||
|
// Get the second row with null integer
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_THROW(query.isColumnNull(""), SQLite::Exception);
|
||||||
|
EXPECT_EQ(false, query.isColumnNull("msg"));
|
||||||
|
EXPECT_EQ(true, query.isColumnNull("int"));
|
||||||
|
EXPECT_EQ(false, query.isColumnNull("double"));
|
||||||
|
EXPECT_THROW(query.isColumnNull(3), SQLite::Exception);
|
||||||
|
|
||||||
|
// Get the third row with null float
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
EXPECT_THROW(query.isColumnNull(""), SQLite::Exception);
|
||||||
|
EXPECT_EQ(false, query.isColumnNull("msg"));
|
||||||
|
EXPECT_EQ(false, query.isColumnNull("int"));
|
||||||
|
EXPECT_EQ(true, query.isColumnNull("double"));
|
||||||
|
EXPECT_THROW(query.isColumnNull(3), SQLite::Exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Statement, getColumnByName) {
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getExtendedErrorCode());
|
||||||
|
|
||||||
|
// Create a new table
|
||||||
|
EXPECT_EQ(0, db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, msg TEXT, int INTEGER, double REAL)"));
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getExtendedErrorCode());
|
||||||
|
|
||||||
|
// Create a first row
|
||||||
|
EXPECT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, \"first\", 123, 0.123)"));
|
||||||
|
EXPECT_EQ(1, db.getLastInsertRowid());
|
||||||
|
EXPECT_EQ(1, db.getTotalChanges());
|
||||||
|
|
||||||
|
// Compile a SQL query
|
||||||
|
SQLite::Statement query(db, "SELECT * FROM test");
|
||||||
|
EXPECT_STREQ("SELECT * FROM test", query.getQuery().c_str());
|
||||||
|
EXPECT_EQ(4, query.getColumnCount());
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE (query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
|
||||||
|
// Look for non-existing columns
|
||||||
|
EXPECT_THROW(query.getColumn("unknown"), SQLite::Exception);
|
||||||
|
EXPECT_THROW(query.getColumn(""), SQLite::Exception);
|
||||||
|
|
||||||
|
const std::string msg = query.getColumn("msg");
|
||||||
|
const int integer = query.getColumn("int");
|
||||||
|
const double real = query.getColumn("double");
|
||||||
|
EXPECT_EQ("first", msg);
|
||||||
|
EXPECT_EQ(123, integer);
|
||||||
|
EXPECT_EQ(0.123, real);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Statement, getName) {
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
EXPECT_EQ(0, db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, msg TEXT)"));
|
||||||
|
|
||||||
|
// Compile a SQL query, using the "id" column name as-is, but aliasing the "msg" column with new name "value"
|
||||||
|
SQLite::Statement query(db, "SELECT id, msg as value FROM test");
|
||||||
|
query.executeStep();
|
||||||
|
|
||||||
|
const std::string name0 = query.getColumnName(0);
|
||||||
|
const std::string name1 = query.getColumnName(1);
|
||||||
|
EXPECT_EQ("id", name0);
|
||||||
|
EXPECT_EQ("value", name1);
|
||||||
|
|
||||||
|
#ifdef SQLITE_ENABLE_COLUMN_METADATA
|
||||||
|
// Show how to get origin names of the table columns from which theses result columns come from.
|
||||||
|
// Requires the SQLITE_ENABLE_COLUMN_METADATA preprocessor macro to be
|
||||||
|
// also defined at compile times of the SQLite library itself.
|
||||||
|
const std::string oname0 = query.getColumnOriginName(0);
|
||||||
|
const std::string oname1 = query.getColumnOriginName(1);
|
||||||
|
EXPECT_EQ("id", oname0);
|
||||||
|
EXPECT_EQ("msg", oname1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if __cplusplus >= 201402L || (defined(_MSC_VER) && _MSC_VER >= 1900)
|
||||||
|
TEST(Statement, getColumns) {
|
||||||
|
struct GetRowTestStruct
|
||||||
|
{
|
||||||
|
int id;
|
||||||
|
std::string msg;
|
||||||
|
int integer;
|
||||||
|
double real;
|
||||||
|
GetRowTestStruct(int _id, std::string _msg, int _integer, double _real)
|
||||||
|
: id(_id), msg(_msg), integer(_integer), real(_real)
|
||||||
|
{}
|
||||||
|
|
||||||
|
GetRowTestStruct(int _id, const std::string& _msg)
|
||||||
|
: id(_id), msg(_msg), integer(-1), real(0.0)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE | SQLite::OPEN_CREATE);
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getExtendedErrorCode());
|
||||||
|
|
||||||
|
// Create a new table
|
||||||
|
EXPECT_EQ(0, db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, msg TEXT, int INTEGER, double REAL)"));
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getExtendedErrorCode());
|
||||||
|
|
||||||
|
// Create a first row
|
||||||
|
EXPECT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, \"first\", 123, 0.123)"));
|
||||||
|
EXPECT_EQ(1, db.getLastInsertRowid());
|
||||||
|
EXPECT_EQ(1, db.getTotalChanges());
|
||||||
|
|
||||||
|
// Compile a SQL query
|
||||||
|
SQLite::Statement query(db, "SELECT * FROM test");
|
||||||
|
EXPECT_STREQ("SELECT * FROM test", query.getQuery().c_str());
|
||||||
|
EXPECT_EQ(4, query.getColumnCount());
|
||||||
|
query.executeStep();
|
||||||
|
EXPECT_TRUE(query.isOk());
|
||||||
|
EXPECT_FALSE(query.isDone());
|
||||||
|
|
||||||
|
// Get all columns
|
||||||
|
auto testStruct = query.getColumns<GetRowTestStruct, 4>();
|
||||||
|
EXPECT_EQ(1, testStruct.id);
|
||||||
|
EXPECT_EQ("first", testStruct.msg);
|
||||||
|
EXPECT_EQ(123, testStruct.integer);
|
||||||
|
EXPECT_EQ(0.123, testStruct.real);
|
||||||
|
|
||||||
|
// Get only the first 2 columns
|
||||||
|
auto testStruct2 = query.getColumns<GetRowTestStruct, 2>();
|
||||||
|
EXPECT_EQ(1, testStruct2.id);
|
||||||
|
EXPECT_EQ("first", testStruct2.msg);
|
||||||
|
EXPECT_EQ(-1, testStruct2.integer);
|
||||||
|
EXPECT_EQ(0.0, testStruct2.real);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
103
3rd-party/SRombauts-SQLiteCpp-f69986a/tests/Transaction_test.cpp
vendored
Normal file
103
3rd-party/SRombauts-SQLiteCpp-f69986a/tests/Transaction_test.cpp
vendored
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
/**
|
||||||
|
* @file Transaction_test.cpp
|
||||||
|
* @ingroup tests
|
||||||
|
* @brief Test of a SQLite Transaction.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <SQLiteCpp/Transaction.h>
|
||||||
|
#include <SQLiteCpp/Database.h>
|
||||||
|
#include <SQLiteCpp/Statement.h>
|
||||||
|
#include <SQLiteCpp/Exception.h>
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
TEST(Transaction, commitRollback) {
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
|
||||||
|
{
|
||||||
|
// Begin transaction
|
||||||
|
SQLite::Transaction transaction(db);
|
||||||
|
|
||||||
|
EXPECT_EQ(0, db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT)"));
|
||||||
|
EXPECT_EQ(SQLite::OK, db.getErrorCode());
|
||||||
|
|
||||||
|
// Insert a first value
|
||||||
|
EXPECT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, \"first\")"));
|
||||||
|
EXPECT_EQ(1, db.getLastInsertRowid());
|
||||||
|
|
||||||
|
// Commit transaction
|
||||||
|
transaction.commit();
|
||||||
|
|
||||||
|
// Commit again throw an exception
|
||||||
|
EXPECT_THROW(transaction.commit(), SQLite::Exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auto rollback if no commit() before the end of scope
|
||||||
|
{
|
||||||
|
// Begin transaction
|
||||||
|
SQLite::Transaction transaction(db);
|
||||||
|
|
||||||
|
// Insert a second value (that will be rollbacked)
|
||||||
|
EXPECT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, \"third\")"));
|
||||||
|
EXPECT_EQ(2, db.getLastInsertRowid());
|
||||||
|
|
||||||
|
// end of scope: automatic rollback
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auto rollback of a transaction on error/exception
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Begin transaction
|
||||||
|
SQLite::Transaction transaction(db);
|
||||||
|
|
||||||
|
// Insert a second value (that will be rollbacked)
|
||||||
|
EXPECT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, \"second\")"));
|
||||||
|
EXPECT_EQ(2, db.getLastInsertRowid());
|
||||||
|
|
||||||
|
// Execute with an error => exception with auto-rollback
|
||||||
|
db.exec("DesiredSyntaxError to raise an exception to rollback the transaction");
|
||||||
|
|
||||||
|
GTEST_FATAL_FAILURE_("we should never get there");
|
||||||
|
transaction.commit(); // We should never get there
|
||||||
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
std::cout << "SQLite exception: " << e.what() << std::endl;
|
||||||
|
// expected error, see above
|
||||||
|
}
|
||||||
|
|
||||||
|
// Double rollback with a manual command before the end of scope
|
||||||
|
{
|
||||||
|
// Begin transaction
|
||||||
|
SQLite::Transaction transaction(db);
|
||||||
|
|
||||||
|
// Insert a second value (that will be rollbacked)
|
||||||
|
EXPECT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, \"third\")"));
|
||||||
|
EXPECT_EQ(2, db.getLastInsertRowid());
|
||||||
|
|
||||||
|
// Execute a manual rollback (no real use case I can think of, so no rollback() method)
|
||||||
|
db.exec("ROLLBACK");
|
||||||
|
|
||||||
|
// end of scope: the automatic rollback should not raise an error because it is harmless
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check the results (expect only one row of result, as all other one have been rollbacked)
|
||||||
|
SQLite::Statement query(db, "SELECT * FROM test");
|
||||||
|
int nbRows = 0;
|
||||||
|
while (query.executeStep())
|
||||||
|
{
|
||||||
|
nbRows++;
|
||||||
|
EXPECT_EQ(1, query.getColumn(0).getInt());
|
||||||
|
EXPECT_STREQ("first", query.getColumn(1).getText());
|
||||||
|
}
|
||||||
|
EXPECT_EQ(1, nbRows);
|
||||||
|
}
|
72
3rd-party/SRombauts-SQLiteCpp-f69986a/tests/VariadicBind_test.cpp
vendored
Normal file
72
3rd-party/SRombauts-SQLiteCpp-f69986a/tests/VariadicBind_test.cpp
vendored
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
/**
|
||||||
|
* @file VariadicBind_test.cpp
|
||||||
|
* @ingroup tests
|
||||||
|
* @brief Test of variadic bind
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 Paul Dreik (github@pauldreik.se)
|
||||||
|
* Copyright (c) 2016 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
*
|
||||||
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
* or copy at http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <SQLiteCpp/Database.h>
|
||||||
|
#include <SQLiteCpp/Statement.h>
|
||||||
|
#include <SQLiteCpp/VariadicBind.h>
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
#if (__cplusplus >= 201402L) || ( defined(_MSC_VER) && (_MSC_VER >= 1900) ) // c++14: Visual Studio 2015
|
||||||
|
TEST(VariadicBind, invalid) {
|
||||||
|
// Create a new database
|
||||||
|
SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||||
|
|
||||||
|
EXPECT_EQ(0, db.exec("DROP TABLE IF EXISTS test"));
|
||||||
|
EXPECT_EQ(0,
|
||||||
|
db.exec(
|
||||||
|
"CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT DEFAULT 'default') "));
|
||||||
|
EXPECT_TRUE(db.tableExists("test"));
|
||||||
|
|
||||||
|
{
|
||||||
|
SQLite::Statement query(db, "INSERT INTO test VALUES (?, ?)");
|
||||||
|
|
||||||
|
// zero arguments - should give compile time error through a static assert
|
||||||
|
// SQLite::bind(query);
|
||||||
|
|
||||||
|
// bind one argument less than expected - should be fine.
|
||||||
|
// the unspecified argument should be set to null, not the default.
|
||||||
|
SQLite::bind(query, 1);
|
||||||
|
EXPECT_EQ(1, query.exec());
|
||||||
|
query.reset();
|
||||||
|
|
||||||
|
// bind all arguments - should work just fine
|
||||||
|
SQLite::bind(query, 2, "two");
|
||||||
|
EXPECT_EQ(1, query.exec());
|
||||||
|
query.reset();
|
||||||
|
|
||||||
|
// bind too many arguments - should throw.
|
||||||
|
EXPECT_THROW(SQLite::bind(query, 3, "three", 0), SQLite::Exception);
|
||||||
|
EXPECT_EQ(1, query.exec());
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure the content is as expected
|
||||||
|
{
|
||||||
|
using namespace std::string_literals;
|
||||||
|
|
||||||
|
SQLite::Statement query(db, "SELECT id, value FROM test ORDER BY id"s);
|
||||||
|
std::vector<std::pair<int, std::string> > results;
|
||||||
|
while (query.executeStep()) {
|
||||||
|
const int id = query.getColumn(0);
|
||||||
|
std::string value = query.getColumn(1);
|
||||||
|
results.emplace_back( id, std::move(value) );
|
||||||
|
}
|
||||||
|
EXPECT_EQ(std::size_t(3), results.size());
|
||||||
|
|
||||||
|
EXPECT_EQ(std::make_pair(1,""s), results.at(0));
|
||||||
|
EXPECT_EQ(std::make_pair(2,"two"s), results.at(1));
|
||||||
|
EXPECT_EQ(std::make_pair(3,"three"s), results.at(2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // c++14
|
@@ -243,6 +243,9 @@
|
|||||||
<ProjectReference Include="..\3rd-party\curl-7.52.1\projects\Windows\VC14\lib\libcurl.vcxproj">
|
<ProjectReference Include="..\3rd-party\curl-7.52.1\projects\Windows\VC14\lib\libcurl.vcxproj">
|
||||||
<Project>{da6f56b4-06a4-441d-ad70-ac5a7d51fadb}</Project>
|
<Project>{da6f56b4-06a4-441d-ad70-ac5a7d51fadb}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\3rd-party\SRombauts-SQLiteCpp-f69986a\build\SQLiteCpp.vcxproj">
|
||||||
|
<Project>{be7ee71d-6608-36dd-9687-d84aae20c0a3}</Project>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
252
SiaDrive.sln
252
SiaDrive.sln
@@ -21,6 +21,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SiaDrive.Api", "SiaDrive.Ap
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SiaDrive.Dokan.Api", "SiaDrive.Dokan.Api\SiaDrive.Dokan.Api.vcxproj", "{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SiaDrive.Dokan.Api", "SiaDrive.Dokan.Api\SiaDrive.Dokan.Api.vcxproj", "{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLiteCpp", "3rd-party\SRombauts-SQLiteCpp-f69986a\build\SQLiteCpp.vcxproj", "{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -110,9 +112,15 @@ Global
|
|||||||
LIB Release|Any CPU = LIB Release|Any CPU
|
LIB Release|Any CPU = LIB Release|Any CPU
|
||||||
LIB Release|x64 = LIB Release|x64
|
LIB Release|x64 = LIB Release|x64
|
||||||
LIB Release|x86 = LIB Release|x86
|
LIB Release|x86 = LIB Release|x86
|
||||||
|
MinSizeRel|Any CPU = MinSizeRel|Any CPU
|
||||||
|
MinSizeRel|x64 = MinSizeRel|x64
|
||||||
|
MinSizeRel|x86 = MinSizeRel|x86
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
Release|x64 = Release|x64
|
Release|x64 = Release|x64
|
||||||
Release|x86 = Release|x86
|
Release|x86 = Release|x86
|
||||||
|
RelWithDebInfo|Any CPU = RelWithDebInfo|Any CPU
|
||||||
|
RelWithDebInfo|x64 = RelWithDebInfo|x64
|
||||||
|
RelWithDebInfo|x86 = RelWithDebInfo|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{259223F4-FC6D-4715-855C-E64681D9BEB2}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||||
@@ -288,11 +296,23 @@ Global
|
|||||||
{259223F4-FC6D-4715-855C-E64681D9BEB2}.LIB Release|x64.Build.0 = Release|x64
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.LIB Release|x64.Build.0 = Release|x64
|
||||||
{259223F4-FC6D-4715-855C-E64681D9BEB2}.LIB Release|x86.ActiveCfg = Release|Win32
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.LIB Release|x86.ActiveCfg = Release|Win32
|
||||||
{259223F4-FC6D-4715-855C-E64681D9BEB2}.LIB Release|x86.Build.0 = Release|Win32
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.LIB Release|x86.Build.0 = Release|Win32
|
||||||
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.MinSizeRel|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.MinSizeRel|Any CPU.Build.0 = Release|x64
|
||||||
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.MinSizeRel|x64.ActiveCfg = Release|x64
|
||||||
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.MinSizeRel|x64.Build.0 = Release|x64
|
||||||
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.MinSizeRel|x86.ActiveCfg = Release|Win32
|
||||||
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.MinSizeRel|x86.Build.0 = Release|Win32
|
||||||
{259223F4-FC6D-4715-855C-E64681D9BEB2}.Release|Any CPU.ActiveCfg = Release|Win32
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||||
{259223F4-FC6D-4715-855C-E64681D9BEB2}.Release|x64.ActiveCfg = Release|x64
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.Release|x64.ActiveCfg = Release|x64
|
||||||
{259223F4-FC6D-4715-855C-E64681D9BEB2}.Release|x64.Build.0 = Release|x64
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.Release|x64.Build.0 = Release|x64
|
||||||
{259223F4-FC6D-4715-855C-E64681D9BEB2}.Release|x86.ActiveCfg = Release|Win32
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{259223F4-FC6D-4715-855C-E64681D9BEB2}.Release|x86.Build.0 = Release|Win32
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.RelWithDebInfo|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.RelWithDebInfo|Any CPU.Build.0 = Release|x64
|
||||||
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.RelWithDebInfo|x64.ActiveCfg = Release|x64
|
||||||
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.RelWithDebInfo|x64.Build.0 = Release|x64
|
||||||
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
|
||||||
|
{259223F4-FC6D-4715-855C-E64681D9BEB2}.RelWithDebInfo|x86.Build.0 = Release|Win32
|
||||||
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Debug|Any CPU.ActiveCfg = LIB Release|Win32
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Debug|Any CPU.ActiveCfg = LIB Release|Win32
|
||||||
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Debug|Any CPU.Build.0 = LIB Release|Win32
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Debug|Any CPU.Build.0 = LIB Release|Win32
|
||||||
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Debug|x64.ActiveCfg = LIB Debug|x64
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Debug|x64.ActiveCfg = LIB Debug|x64
|
||||||
@@ -439,12 +459,24 @@ Global
|
|||||||
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.LIB Release|x64.Build.0 = LIB Release|x64
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.LIB Release|x64.Build.0 = LIB Release|x64
|
||||||
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.LIB Release|x86.ActiveCfg = LIB Release|Win32
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.LIB Release|x86.ActiveCfg = LIB Release|Win32
|
||||||
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.LIB Release|x86.Build.0 = LIB Release|Win32
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.LIB Release|x86.Build.0 = LIB Release|Win32
|
||||||
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.MinSizeRel|Any CPU.ActiveCfg = LIB Release|x64
|
||||||
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.MinSizeRel|Any CPU.Build.0 = LIB Release|x64
|
||||||
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.MinSizeRel|x64.ActiveCfg = LIB Release|x64
|
||||||
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.MinSizeRel|x64.Build.0 = LIB Release|x64
|
||||||
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.MinSizeRel|x86.ActiveCfg = LIB Release - LIB wolfSSL|Win32
|
||||||
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.MinSizeRel|x86.Build.0 = LIB Release - LIB wolfSSL|Win32
|
||||||
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Release|Any CPU.ActiveCfg = LIB Release|Win32
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Release|Any CPU.ActiveCfg = LIB Release|Win32
|
||||||
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Release|Any CPU.Build.0 = LIB Release|Win32
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Release|Any CPU.Build.0 = LIB Release|Win32
|
||||||
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Release|x64.ActiveCfg = LIB Release|x64
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Release|x64.ActiveCfg = LIB Release|x64
|
||||||
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Release|x64.Build.0 = LIB Release|x64
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Release|x64.Build.0 = LIB Release|x64
|
||||||
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Release|x86.ActiveCfg = LIB Release|Win32
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Release|x86.ActiveCfg = LIB Release|Win32
|
||||||
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Release|x86.Build.0 = LIB Release|Win32
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.Release|x86.Build.0 = LIB Release|Win32
|
||||||
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.RelWithDebInfo|Any CPU.ActiveCfg = LIB Release|x64
|
||||||
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.RelWithDebInfo|Any CPU.Build.0 = LIB Release|x64
|
||||||
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.RelWithDebInfo|x64.ActiveCfg = LIB Release|x64
|
||||||
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.RelWithDebInfo|x64.Build.0 = LIB Release|x64
|
||||||
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.RelWithDebInfo|x86.ActiveCfg = LIB Release - LIB wolfSSL|Win32
|
||||||
|
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}.RelWithDebInfo|x86.Build.0 = LIB Release - LIB wolfSSL|Win32
|
||||||
{3D027D51-B3C6-4036-BC63-46E503597466}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
{3D027D51-B3C6-4036-BC63-46E503597466}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||||
{3D027D51-B3C6-4036-BC63-46E503597466}.Debug|x64.ActiveCfg = Debug|x64
|
{3D027D51-B3C6-4036-BC63-46E503597466}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{3D027D51-B3C6-4036-BC63-46E503597466}.Debug|x64.Build.0 = Debug|x64
|
{3D027D51-B3C6-4036-BC63-46E503597466}.Debug|x64.Build.0 = Debug|x64
|
||||||
@@ -618,11 +650,23 @@ Global
|
|||||||
{3D027D51-B3C6-4036-BC63-46E503597466}.LIB Release|x64.Build.0 = Release|x64
|
{3D027D51-B3C6-4036-BC63-46E503597466}.LIB Release|x64.Build.0 = Release|x64
|
||||||
{3D027D51-B3C6-4036-BC63-46E503597466}.LIB Release|x86.ActiveCfg = Release|Win32
|
{3D027D51-B3C6-4036-BC63-46E503597466}.LIB Release|x86.ActiveCfg = Release|Win32
|
||||||
{3D027D51-B3C6-4036-BC63-46E503597466}.LIB Release|x86.Build.0 = Release|Win32
|
{3D027D51-B3C6-4036-BC63-46E503597466}.LIB Release|x86.Build.0 = Release|Win32
|
||||||
|
{3D027D51-B3C6-4036-BC63-46E503597466}.MinSizeRel|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{3D027D51-B3C6-4036-BC63-46E503597466}.MinSizeRel|Any CPU.Build.0 = Release|x64
|
||||||
|
{3D027D51-B3C6-4036-BC63-46E503597466}.MinSizeRel|x64.ActiveCfg = Release|x64
|
||||||
|
{3D027D51-B3C6-4036-BC63-46E503597466}.MinSizeRel|x64.Build.0 = Release|x64
|
||||||
|
{3D027D51-B3C6-4036-BC63-46E503597466}.MinSizeRel|x86.ActiveCfg = Release|Win32
|
||||||
|
{3D027D51-B3C6-4036-BC63-46E503597466}.MinSizeRel|x86.Build.0 = Release|Win32
|
||||||
{3D027D51-B3C6-4036-BC63-46E503597466}.Release|Any CPU.ActiveCfg = Release|Win32
|
{3D027D51-B3C6-4036-BC63-46E503597466}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||||
{3D027D51-B3C6-4036-BC63-46E503597466}.Release|x64.ActiveCfg = Release|x64
|
{3D027D51-B3C6-4036-BC63-46E503597466}.Release|x64.ActiveCfg = Release|x64
|
||||||
{3D027D51-B3C6-4036-BC63-46E503597466}.Release|x64.Build.0 = Release|x64
|
{3D027D51-B3C6-4036-BC63-46E503597466}.Release|x64.Build.0 = Release|x64
|
||||||
{3D027D51-B3C6-4036-BC63-46E503597466}.Release|x86.ActiveCfg = Release|Win32
|
{3D027D51-B3C6-4036-BC63-46E503597466}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{3D027D51-B3C6-4036-BC63-46E503597466}.Release|x86.Build.0 = Release|Win32
|
{3D027D51-B3C6-4036-BC63-46E503597466}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{3D027D51-B3C6-4036-BC63-46E503597466}.RelWithDebInfo|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{3D027D51-B3C6-4036-BC63-46E503597466}.RelWithDebInfo|Any CPU.Build.0 = Release|x64
|
||||||
|
{3D027D51-B3C6-4036-BC63-46E503597466}.RelWithDebInfo|x64.ActiveCfg = Release|x64
|
||||||
|
{3D027D51-B3C6-4036-BC63-46E503597466}.RelWithDebInfo|x64.Build.0 = Release|x64
|
||||||
|
{3D027D51-B3C6-4036-BC63-46E503597466}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
|
||||||
|
{3D027D51-B3C6-4036-BC63-46E503597466}.RelWithDebInfo|x86.Build.0 = Release|Win32
|
||||||
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||||
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.Debug|x64.ActiveCfg = Debug|x64
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.Debug|x64.Build.0 = Debug|x64
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.Debug|x64.Build.0 = Debug|x64
|
||||||
@@ -796,11 +840,23 @@ Global
|
|||||||
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.LIB Release|x64.Build.0 = Release|x64
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.LIB Release|x64.Build.0 = Release|x64
|
||||||
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.LIB Release|x86.ActiveCfg = Release|Win32
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.LIB Release|x86.ActiveCfg = Release|Win32
|
||||||
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.LIB Release|x86.Build.0 = Release|Win32
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.LIB Release|x86.Build.0 = Release|Win32
|
||||||
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.MinSizeRel|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.MinSizeRel|Any CPU.Build.0 = Release|x64
|
||||||
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.MinSizeRel|x64.ActiveCfg = Release|x64
|
||||||
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.MinSizeRel|x64.Build.0 = Release|x64
|
||||||
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.MinSizeRel|x86.ActiveCfg = Release|Win32
|
||||||
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.MinSizeRel|x86.Build.0 = Release|Win32
|
||||||
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.Release|Any CPU.ActiveCfg = Release|Win32
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||||
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.Release|x64.ActiveCfg = Release|x64
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.Release|x64.ActiveCfg = Release|x64
|
||||||
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.Release|x64.Build.0 = Release|x64
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.Release|x64.Build.0 = Release|x64
|
||||||
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.Release|x86.ActiveCfg = Release|Win32
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.Release|x86.Build.0 = Release|Win32
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.RelWithDebInfo|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.RelWithDebInfo|Any CPU.Build.0 = Release|x64
|
||||||
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.RelWithDebInfo|x64.ActiveCfg = Release|x64
|
||||||
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.RelWithDebInfo|x64.Build.0 = Release|x64
|
||||||
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
|
||||||
|
{AA357195-D159-4CB7-BFFF-CC8666D7AD77}.RelWithDebInfo|x86.Build.0 = Release|Win32
|
||||||
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||||
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.Debug|x64.ActiveCfg = Debug|x64
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.Debug|x64.Build.0 = Debug|x64
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.Debug|x64.Build.0 = Debug|x64
|
||||||
@@ -974,11 +1030,207 @@ Global
|
|||||||
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.LIB Release|x64.Build.0 = Release|x64
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.LIB Release|x64.Build.0 = Release|x64
|
||||||
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.LIB Release|x86.ActiveCfg = Release|Win32
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.LIB Release|x86.ActiveCfg = Release|Win32
|
||||||
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.LIB Release|x86.Build.0 = Release|Win32
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.LIB Release|x86.Build.0 = Release|Win32
|
||||||
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.MinSizeRel|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.MinSizeRel|Any CPU.Build.0 = Release|x64
|
||||||
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.MinSizeRel|x64.ActiveCfg = Release|x64
|
||||||
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.MinSizeRel|x64.Build.0 = Release|x64
|
||||||
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.MinSizeRel|x86.ActiveCfg = Release|Win32
|
||||||
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.MinSizeRel|x86.Build.0 = Release|Win32
|
||||||
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.Release|Any CPU.ActiveCfg = Release|Win32
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||||
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.Release|x64.ActiveCfg = Release|x64
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.Release|x64.ActiveCfg = Release|x64
|
||||||
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.Release|x64.Build.0 = Release|x64
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.Release|x64.Build.0 = Release|x64
|
||||||
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.Release|x86.ActiveCfg = Release|Win32
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.Release|x86.Build.0 = Release|Win32
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.RelWithDebInfo|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.RelWithDebInfo|Any CPU.Build.0 = Release|x64
|
||||||
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.RelWithDebInfo|x64.ActiveCfg = Release|x64
|
||||||
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.RelWithDebInfo|x64.Build.0 = Release|x64
|
||||||
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
|
||||||
|
{B3DF927F-A1CE-4F50-A621-A4C3A06E4F8A}.RelWithDebInfo|x86.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.Debug|x64.ActiveCfg = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL OpenSSL - DLL LibSSH2|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL OpenSSL - DLL LibSSH2|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL OpenSSL - DLL LibSSH2|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL OpenSSL - DLL LibSSH2|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL OpenSSL - DLL LibSSH2|x86.ActiveCfg = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL OpenSSL - DLL LibSSH2|x86.Build.0 = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL OpenSSL|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL OpenSSL|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL OpenSSL|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL OpenSSL|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL OpenSSL|x86.ActiveCfg = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL OpenSSL|x86.Build.0 = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL Windows SSPI - DLL WinIDN|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL Windows SSPI - DLL WinIDN|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL Windows SSPI - DLL WinIDN|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL Windows SSPI - DLL WinIDN|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL Windows SSPI - DLL WinIDN|x86.ActiveCfg = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL Windows SSPI - DLL WinIDN|x86.Build.0 = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL Windows SSPI|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL Windows SSPI|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL Windows SSPI|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL Windows SSPI|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL Windows SSPI|x86.ActiveCfg = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL Windows SSPI|x86.Build.0 = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL wolfSSL|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL wolfSSL|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL wolfSSL|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL wolfSSL|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL wolfSSL|x86.ActiveCfg = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug - DLL wolfSSL|x86.Build.0 = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL OpenSSL - DLL LibSSH2|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL OpenSSL - DLL LibSSH2|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL OpenSSL - DLL LibSSH2|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL OpenSSL - DLL LibSSH2|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL OpenSSL - DLL LibSSH2|x86.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL OpenSSL - DLL LibSSH2|x86.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL OpenSSL|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL OpenSSL|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL OpenSSL|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL OpenSSL|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL OpenSSL|x86.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL OpenSSL|x86.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL Windows SSPI - DLL WinIDN|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL Windows SSPI - DLL WinIDN|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL Windows SSPI - DLL WinIDN|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL Windows SSPI - DLL WinIDN|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL Windows SSPI - DLL WinIDN|x86.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL Windows SSPI - DLL WinIDN|x86.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL Windows SSPI|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL Windows SSPI|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL Windows SSPI|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL Windows SSPI|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL Windows SSPI|x86.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL Windows SSPI|x86.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL wolfSSL|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL wolfSSL|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL wolfSSL|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL wolfSSL|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL wolfSSL|x86.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release - DLL wolfSSL|x86.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.DLL Release|x86.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL OpenSSL - DLL LibSSH2|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL OpenSSL - DLL LibSSH2|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL OpenSSL - DLL LibSSH2|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL OpenSSL - DLL LibSSH2|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL OpenSSL - DLL LibSSH2|x86.ActiveCfg = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL OpenSSL - DLL LibSSH2|x86.Build.0 = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL OpenSSL|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL OpenSSL|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL OpenSSL|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL OpenSSL|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL OpenSSL|x86.ActiveCfg = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL OpenSSL|x86.Build.0 = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL Windows SSPI - DLL WinIDN|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL Windows SSPI - DLL WinIDN|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL Windows SSPI - DLL WinIDN|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL Windows SSPI - DLL WinIDN|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL Windows SSPI - DLL WinIDN|x86.ActiveCfg = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL Windows SSPI - DLL WinIDN|x86.Build.0 = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL Windows SSPI|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL Windows SSPI|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL Windows SSPI|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL Windows SSPI|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL Windows SSPI|x86.ActiveCfg = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - DLL Windows SSPI|x86.Build.0 = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - LIB OpenSSL - LIB LibSSH2|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - LIB OpenSSL - LIB LibSSH2|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - LIB OpenSSL - LIB LibSSH2|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - LIB OpenSSL - LIB LibSSH2|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - LIB OpenSSL - LIB LibSSH2|x86.ActiveCfg = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - LIB OpenSSL - LIB LibSSH2|x86.Build.0 = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - LIB OpenSSL|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - LIB OpenSSL|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - LIB OpenSSL|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - LIB OpenSSL|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - LIB OpenSSL|x86.ActiveCfg = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - LIB OpenSSL|x86.Build.0 = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - LIB wolfSSL|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - LIB wolfSSL|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - LIB wolfSSL|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - LIB wolfSSL|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - LIB wolfSSL|x86.ActiveCfg = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug - LIB wolfSSL|x86.Build.0 = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL OpenSSL - DLL LibSSH2|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL OpenSSL - DLL LibSSH2|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL OpenSSL - DLL LibSSH2|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL OpenSSL - DLL LibSSH2|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL OpenSSL - DLL LibSSH2|x86.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL OpenSSL - DLL LibSSH2|x86.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL OpenSSL|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL OpenSSL|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL OpenSSL|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL OpenSSL|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL OpenSSL|x86.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL OpenSSL|x86.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL Windows SSPI - DLL WinIDN|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL Windows SSPI - DLL WinIDN|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL Windows SSPI - DLL WinIDN|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL Windows SSPI - DLL WinIDN|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL Windows SSPI - DLL WinIDN|x86.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL Windows SSPI - DLL WinIDN|x86.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL Windows SSPI|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL Windows SSPI|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL Windows SSPI|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL Windows SSPI|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL Windows SSPI|x86.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - DLL Windows SSPI|x86.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - LIB OpenSSL - LIB LibSSH2|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - LIB OpenSSL - LIB LibSSH2|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - LIB OpenSSL - LIB LibSSH2|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - LIB OpenSSL - LIB LibSSH2|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - LIB OpenSSL - LIB LibSSH2|x86.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - LIB OpenSSL - LIB LibSSH2|x86.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - LIB OpenSSL|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - LIB OpenSSL|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - LIB OpenSSL|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - LIB OpenSSL|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - LIB OpenSSL|x86.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - LIB OpenSSL|x86.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - LIB wolfSSL|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - LIB wolfSSL|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - LIB wolfSSL|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - LIB wolfSSL|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - LIB wolfSSL|x86.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release - LIB wolfSSL|x86.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release|Any CPU.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release|x64.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.LIB Release|x86.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.MinSizeRel|Any CPU.ActiveCfg = MinSizeRel|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.MinSizeRel|x64.ActiveCfg = MinSizeRel|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.MinSizeRel|x86.ActiveCfg = MinSizeRel|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.MinSizeRel|x86.Build.0 = MinSizeRel|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.Release|x64.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.RelWithDebInfo|Any CPU.ActiveCfg = RelWithDebInfo|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|Win32
|
||||||
|
{BE7EE71D-6608-36DD-9687-D84AAE20C0A3}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
Reference in New Issue
Block a user