- added optional SQLite Full Text Search support

- Powershell build fixes:
  1) Add platform for MSbuild
  2) fixed omit array handling
This commit is contained in:
Alex Fabijanic 2014-04-18 21:32:30 -05:00
parent 835845422c
commit 0a54661bb0
9 changed files with 142 additions and 23 deletions

View File

@ -274,6 +274,7 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="include\Poco\Data\SQLite\Binder.h" />
<ClInclude Include="include\Poco\Data\SQLite\Config.h" />
<ClInclude Include="include\Poco\Data\SQLite\Connector.h" />
<ClInclude Include="include\Poco\Data\SQLite\Extractor.h" />
<ClInclude Include="include\Poco\Data\SQLite\Notifier.h" />

View File

@ -0,0 +1,69 @@
//
// Config.h
//
// $Id: //poco/Main/Data/SQLite/include/Poco/Data/SQLite/Config.h#3 $
//
// Library: SQLite
// Package: SQLite
// Module: SQLite
//
// Basic configuration definitions for the underlying SQLite library.
// In order for configuration definitions to take effect, this file must
// be included from sqlite3.c file.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef SQLite_Config_INCLUDED
#define SQLite_Config_INCLUDED
#include "Poco/Config.h"
//
// Thread safety mode defaults to "serialized".
// See http://www.sqlite.org/threadsafe.html for details.
// Threading mode may significantly affect performance
// (see TestSuite::benchmarkThreadModesTiming)
//
#ifndef SQLITE_THREADSAFE
#define SQLITE_THREADSAFE 1
#endif // SQLITE_THREADSAFE
#ifdef POCO_DATA_SQLITE_FTS
#ifndef SQLITE_ENABLE_FTS3
#define SQLITE_ENABLE_FTS3
#endif
#ifndef SQLITE_ENABLE_FTS3_PARENTHESIS
#define SQLITE_ENABLE_FTS3_PARENTHESIS
#endif
#endif // POCO_DATA_SQLITE_FTS
#endif // SQLite_SQLite_INCLUDED

View File

@ -4,7 +4,7 @@
// $Id: //poco/Main/Data/SQLite/include/Poco/Data/SQLite/SQLite.h#3 $
//
// Library: SQLite
// Package: SQLIte
// Package: SQLite
// Module: SQLite
//
// Basic definitions for the Poco SQLite library.
@ -81,15 +81,4 @@
#endif
//
// Thread safety mode defaults to "serialized".
// See http://www.sqlite.org/threadsafe.html for details.
// Threading mode may significantly affect performance
// (see TestSuite::benchmarkThreadModesTiming)
//
#ifndef SQLITE_THREADSAFE
#define SQLITE_THREADSAFE 1
#endif
#endif // SQLite_SQLite_INCLUDED

View File

@ -1,3 +1,4 @@
#include "Poco/Data/SQLite/Config.h"
/******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite
** version 3.8.4.1. By combining all the individual C code files into this

View File

@ -3287,6 +3287,53 @@ void SQLiteTest::testTransactor()
}
#ifdef POCO_DATA_SQLITE_FTS
void SQLiteTest::testFTS3()
{
Session session(Poco::Data::SQLite::Connector::KEY, "dummy.db");
assert(session.isConnected());
session << "DROP TABLE IF EXISTS docs", now;
session << "CREATE VIRTUAL TABLE docs USING fts3()", now;
session << "INSERT INTO docs(docid, content) VALUES(1, 'a database is a software system')", now;
session << "INSERT INTO docs(docid, content) VALUES(2, 'sqlite is a software system')", now;
session << "INSERT INTO docs(docid, content) VALUES(3, 'sqlite is a database')", now;
int docid = 0;
session << "SELECT docid FROM docs WHERE docs MATCH 'sqlite AND database'", into(docid), now;
assert(docid == 3);
docid = 0;
session << "SELECT docid FROM docs WHERE docs MATCH 'database sqlite'", into(docid), now;
assert(docid == 3);
std::vector<int> docids;
session << "SELECT docid FROM docs WHERE docs MATCH 'sqlite OR database' ORDER BY docid",
into(docids), now;
assert(docids.size() == 3);
assert(docids[0] == 1);
assert(docids[1] == 2);
assert(docids[2] == 3);
std::string content;
docid = 0;
session << "SELECT docid, content FROM docs WHERE docs MATCH 'database NOT sqlite'",
into(docid), into(content), now;
assert(docid == 1);
assert(content == "a database is a software system");
docid = 0;
session << "SELECT count(*) FROM docs WHERE docs MATCH 'database and sqlite'", into(docid), now;
assert(docid == 0);
}
#endif // POCO_DATA_SQLITE_FTS
void SQLiteTest::setUp()
{
}
@ -3385,6 +3432,7 @@ CppUnit::Test* SQLiteTest::suite()
CppUnit_addTest(pSuite, SQLiteTest, testSessionTransaction);
CppUnit_addTest(pSuite, SQLiteTest, testTransaction);
CppUnit_addTest(pSuite, SQLiteTest, testTransactor);
CppUnit_addTest(pSuite, SQLiteTest, testFTS3);
return pSuite;
}

View File

@ -152,6 +152,8 @@ public:
void testTransaction();
void testTransactor();
void testFTS3();
void setUp();
void tearDown();

View File

@ -176,6 +176,10 @@
// #define POCO_NET_NO_IPv6
// Enable SQLite Full Text Search
#define POCO_DATA_SQLITE_FTS
// Windows CE has no locale support
#if defined(_WIN32_WCE)
#define POCO_NO_LOCALE

View File

@ -60,9 +60,6 @@ Param
)
$omitArray = @()
function Set-Environment
{
if ($poco_base -eq '') { $script:poco_base = Get-Location }
@ -172,10 +169,6 @@ function Process-Input
if ($omit -ne '')
{
Write-Host "Omit: $omit"
$omit.Split(',;') | ForEach {
$omitArray += "$_"
}
}
if ($openssl_base -ne '')
@ -208,14 +201,14 @@ function Build-MSBuild([string] $vsProject)
{
$projectConfig = "$cfg"
$projectConfig += "_$mode"
Invoke-Expression "msbuild $vsProject /t:$action /p:Configuration=$projectConfig"
Invoke-Expression "msbuild $vsProject /t:$action /p:Configuration=$projectConfig /p:Platform=$platform"
}
}
else #config
{
$projectConfig = "$config"
$projectConfig += "_$mode"
Invoke-Expression "msbuild $vsProject /t:$action /p:Configuration=$projectConfig"
Invoke-Expression "msbuild $vsProject /t:$action /p:Configuration=$projectConfig /p:Platform=$platform"
}
}
}
@ -228,14 +221,14 @@ function Build-MSBuild([string] $vsProject)
{
$projectConfig = "$cfg"
$projectConfig += "_$mode"
Invoke-Expression "msbuild $vsProject /t:$action /p:Configuration=$projectConfig"
Invoke-Expression "msbuild $vsProject /t:$action /p:Configuration=$projectConfig /p:Platform=$platform"
}
}
else #config
{
$projectConfig = "$config"
$projectConfig += "_$linkmode"
Invoke-Expression "msbuild $vsProject /t:$action /p:Configuration=$projectConfig"
Invoke-Expression "msbuild $vsProject /t:$action /p:Configuration=$projectConfig /p:Platform=$platform"
}
}
}
@ -322,6 +315,11 @@ function Build
$componentArr = $_.split('/')
$componentName = $componentArr[$componentArr.Length - 1]
$suffix = "_vs$vs_version"
$omitArray = @()
$omit.Split(',;') | ForEach {
$omitArray += "$_"
}
if ($omitArray -NotContains $component)
{

7
configure vendored
View File

@ -63,6 +63,10 @@ Options:
Compile with -DPOCO_NET_NO_IPv6.
For systems that don't support IPv6.
--sqlite-fts=<path>
Compile with -DPOCO_DATA_SQLITE_FTS.
Compile SQLite with Full Text Search support.
--omit=<component>{,<component>}
Do not build the specified component(s).
Example: --omit=Data/MySQL,Data/ODBC,Zip
@ -173,6 +177,9 @@ while [ $# -ge 1 ]; do
--no-ipv6)
flags="$flags -DPOCO_NET_NO_IPv6" ;;
--sqlite-fts)
flags="$flags -DPOCO_DATA_SQLITE_FTS" ;;
--poquito)
flags="$flags -DPOCO_NO_FILECHANNEL -DPOCO_NO_SPLITTERCHANNEL -DPOCO_NO_SYSLOGCHANNEL -DPOCO_UTIL_NO_INIFILECONFIGURATION -DPOCO_UTIL_NO_JSONCONFIGURATION -DPOCO_UTIL_NO_XMLCONFIGURATION" ;;