From 557d0383ffb2c8aa78d217d4eacda7b7b3568113 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 18 Feb 2016 16:16:43 +0000 Subject: [PATCH 01/66] Remove SQLITE_TEST macros from fts5_test_mi.c. Add the SQLITE_FTS5_ENABLE_TEST_MI compile time symbol - to make it easier to create builds that include the fts5 matchinfo demo by default. FossilOrigin-Name: e2ef6667772eeac6eee3aed5d0609c2a0ef5d8cf --- ext/fts5/fts5_main.c | 11 +++++++++++ ext/fts5/fts5_test_mi.c | 3 --- manifest | 24 +++++++++++++----------- manifest.uuid | 2 +- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/ext/fts5/fts5_main.c b/ext/fts5/fts5_main.c index fe1d72e2b0..28f3f3e62c 100644 --- a/ext/fts5/fts5_main.c +++ b/ext/fts5/fts5_main.c @@ -2665,6 +2665,17 @@ static int fts5Init(sqlite3 *db){ ); } } + + /* If SQLITE_FTS5_ENABLE_TEST_MI is defined, assume that the file + ** fts5_test_mi.c is compiled and linked into the executable. And call + ** its entry point to enable the matchinfo() demo. */ +#ifdef SQLITE_FTS5_ENABLE_TEST_MI + if( rc==SQLITE_OK ){ + extern int sqlite3Fts5TestRegisterMatchinfo(sqlite3*); + rc = sqlite3Fts5TestRegisterMatchinfo(db); + } +#endif + return rc; } diff --git a/ext/fts5/fts5_test_mi.c b/ext/fts5/fts5_test_mi.c index 28331773c0..0987e9e137 100644 --- a/ext/fts5/fts5_test_mi.c +++ b/ext/fts5/fts5_test_mi.c @@ -41,11 +41,9 @@ */ -#ifdef SQLITE_TEST #ifdef SQLITE_ENABLE_FTS5 #include "fts5.h" -#include #include #include @@ -420,5 +418,4 @@ int sqlite3Fts5TestRegisterMatchinfo(sqlite3 *db){ } #endif /* SQLITE_ENABLE_FTS5 */ -#endif /* SQLITE_TEST */ diff --git a/manifest b/manifest index a33ec564a2..4e7c23afdd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Version\s3.11.0 -D 2016-02-15T17:29:24.141 +C Remove\sSQLITE_TEST\smacros\sfrom\sfts5_test_mi.c.\sAdd\sthe\sSQLITE_FTS5_ENABLE_TEST_MI\scompile\stime\ssymbol\s-\sto\smake\sit\seasier\sto\screate\sbuilds\sthat\sinclude\sthe\sfts5\smatchinfo\sdemo\sby\sdefault. +D 2016-02-18T16:16:43.028 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 30f075dc4f27a07abb76088946b2944178d85347 @@ -105,10 +105,10 @@ F ext/fts5/fts5_config.c 35c5173cae4eb17e82164a7f5aeef56a48903079 F ext/fts5/fts5_expr.c 8e8e4635f655133eb39018072fc0f0942a2c4337 F ext/fts5/fts5_hash.c f3a7217c86eb8f272871be5f6aa1b6798960a337 F ext/fts5/fts5_index.c c6cd5190c7e5dd94151cb17acd939c82e5c7be2d -F ext/fts5/fts5_main.c 0e01ead4e817483e378e7e38e6d902f50b68d29e +F ext/fts5/fts5_main.c db24ac714c6c4a1b3c24a1f8c25889f2952148c1 F ext/fts5/fts5_storage.c f8343db90d8c95a4d4b52f6676e354b4649ffd6e F ext/fts5/fts5_tcl.c f8731e0508299bd43f1a2eff7dbeaac870768966 -F ext/fts5/fts5_test_mi.c 1ec66ffdf7632077fbd773b7a6df5153272ec070 +F ext/fts5/fts5_test_mi.c 31a42dc3dcf1eb6127a0a1acf42ab4aa1d5e5c81 F ext/fts5/fts5_test_tok.c db08af63673c3a7d39f053b36fd6e065017706be F ext/fts5/fts5_tokenize.c 2ce7b44183538ec46b7907726262ee43ffdd39a8 F ext/fts5/fts5_unicode2.c b450b209b157d598f7b9df9f837afb75a14c24bf @@ -1427,10 +1427,12 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh ef6ebc6fd8d2dc35db3b622015c16a023d4fef4f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f694e60a79024967a3f4574e3928f0b28589d381 -R f2e9debe8cf42a0179962a66a44645cf -T +bgcolor * #d0c0ff -T +sym-release * -T +sym-version-3.11.0 * -U drh -Z e719a8e2c047e401006dde85de2084bf +P 3d862f207e3adc00f78066799ac5a8c282430a5f +Q +31d8b69e9e0747e573516570bfe2770384e99134 +Q +87e6e225aea3a4d10476d16eab4a6403a4a128c9 +R 484f9306b9fcc0db5560ffd225058ba6 +T *branch * branch-3.11-matchinfo +T *sym-branch-3.11-matchinfo * +T -sym-trunk * +U dan +Z 3fda90a50bad45cca94156f3729f0ff4 diff --git a/manifest.uuid b/manifest.uuid index 474c1210cb..6fc4c0871b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3d862f207e3adc00f78066799ac5a8c282430a5f \ No newline at end of file +e2ef6667772eeac6eee3aed5d0609c2a0ef5d8cf \ No newline at end of file From 9e2cfad18a5566411b6da5aa200d73b80c3fa6d2 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 19 Feb 2016 10:19:43 +0000 Subject: [PATCH 02/66] Add an "#ifndef SQLITE_AMALGAMATION" guard around a typedef in fts5_test_mi.c to avoid redefining "u32" if it is compiled as part of the amalgamation. Cherrypick of [f9c49ba1]. FossilOrigin-Name: ce0f1ed517e387ca6a687b805088d7c529cd257b --- ext/fts5/fts5_test_mi.c | 3 +++ manifest | 18 +++++++----------- manifest.uuid | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ext/fts5/fts5_test_mi.c b/ext/fts5/fts5_test_mi.c index 0987e9e137..7bbb4ed600 100644 --- a/ext/fts5/fts5_test_mi.c +++ b/ext/fts5/fts5_test_mi.c @@ -48,7 +48,10 @@ #include typedef struct Fts5MatchinfoCtx Fts5MatchinfoCtx; + +#ifndef SQLITE_AMALGAMATION typedef unsigned int u32; +#endif struct Fts5MatchinfoCtx { int nCol; /* Number of cols in FTS5 table */ diff --git a/manifest b/manifest index 4e7c23afdd..8c52a9794a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sSQLITE_TEST\smacros\sfrom\sfts5_test_mi.c.\sAdd\sthe\sSQLITE_FTS5_ENABLE_TEST_MI\scompile\stime\ssymbol\s-\sto\smake\sit\seasier\sto\screate\sbuilds\sthat\sinclude\sthe\sfts5\smatchinfo\sdemo\sby\sdefault. -D 2016-02-18T16:16:43.028 +C Add\san\s"#ifndef\sSQLITE_AMALGAMATION"\sguard\saround\sa\stypedef\sin\sfts5_test_mi.c\sto\savoid\sredefining\s"u32"\sif\sit\sis\scompiled\sas\spart\sof\sthe\samalgamation.\sCherrypick\sof\s[f9c49ba1]. +D 2016-02-19T10:19:43.655 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 30f075dc4f27a07abb76088946b2944178d85347 @@ -108,7 +108,7 @@ F ext/fts5/fts5_index.c c6cd5190c7e5dd94151cb17acd939c82e5c7be2d F ext/fts5/fts5_main.c db24ac714c6c4a1b3c24a1f8c25889f2952148c1 F ext/fts5/fts5_storage.c f8343db90d8c95a4d4b52f6676e354b4649ffd6e F ext/fts5/fts5_tcl.c f8731e0508299bd43f1a2eff7dbeaac870768966 -F ext/fts5/fts5_test_mi.c 31a42dc3dcf1eb6127a0a1acf42ab4aa1d5e5c81 +F ext/fts5/fts5_test_mi.c 6f76bfc2ec56ce258763c5ace7608636c8745956 F ext/fts5/fts5_test_tok.c db08af63673c3a7d39f053b36fd6e065017706be F ext/fts5/fts5_tokenize.c 2ce7b44183538ec46b7907726262ee43ffdd39a8 F ext/fts5/fts5_unicode2.c b450b209b157d598f7b9df9f837afb75a14c24bf @@ -1427,12 +1427,8 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh ef6ebc6fd8d2dc35db3b622015c16a023d4fef4f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 3d862f207e3adc00f78066799ac5a8c282430a5f -Q +31d8b69e9e0747e573516570bfe2770384e99134 -Q +87e6e225aea3a4d10476d16eab4a6403a4a128c9 -R 484f9306b9fcc0db5560ffd225058ba6 -T *branch * branch-3.11-matchinfo -T *sym-branch-3.11-matchinfo * -T -sym-trunk * +P e2ef6667772eeac6eee3aed5d0609c2a0ef5d8cf +Q +f9c49ba1edf13cb8c48d73f1b2e3f80c46b3c030 +R 86861d7afb256ba49d3c7d2e1e2e6725 U dan -Z 3fda90a50bad45cca94156f3729f0ff4 +Z 1618528e1896e183cb510df07cb30bf4 diff --git a/manifest.uuid b/manifest.uuid index 6fc4c0871b..6c518eaaf7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e2ef6667772eeac6eee3aed5d0609c2a0ef5d8cf \ No newline at end of file +ce0f1ed517e387ca6a687b805088d7c529cd257b \ No newline at end of file From 7aa3ebee0fb7df401fa0ecd6a20f3a7f0da50f05 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Wed, 24 Feb 2016 21:42:03 +0000 Subject: [PATCH 03/66] Initial work on an automated VSIX testing tool. Not working or tested yet. FossilOrigin-Name: 496e4ac984b2548dd5f2f969cd34656b586cfcfe --- manifest | 36 ++- manifest.uuid | 2 +- vsixtest/App.xaml | 8 + vsixtest/App.xaml.cpp | 120 ++++++++++ vsixtest/App.xaml.h | 27 +++ vsixtest/Assets/LockScreenLogo.scale-200.png | Bin 0 -> 1430 bytes vsixtest/Assets/SplashScreen.scale-200.png | Bin 0 -> 7700 bytes .../Assets/Square150x150Logo.scale-200.png | Bin 0 -> 2937 bytes vsixtest/Assets/Square44x44Logo.scale-200.png | Bin 0 -> 1647 bytes ...x44Logo.targetsize-24_altform-unplated.png | Bin 0 -> 1255 bytes vsixtest/Assets/StoreLogo.png | Bin 0 -> 1451 bytes vsixtest/Assets/Wide310x150Logo.scale-200.png | Bin 0 -> 3204 bytes vsixtest/MainPage.xaml | 13 ++ vsixtest/MainPage.xaml.cpp | 27 +++ vsixtest/MainPage.xaml.h | 21 ++ vsixtest/Package.appxmanifest | 49 ++++ vsixtest/pch.cpp | 6 + vsixtest/pch.h | 11 + vsixtest/vsixtest.sln | 40 ++++ vsixtest/vsixtest.tcl | 215 ++++++++++++++++++ vsixtest/vsixtest.vcxproj | 213 +++++++++++++++++ vsixtest/vsixtest.vcxproj.filters | 24 ++ vsixtest/vsixtest_TemporaryKey.pfx | Bin 0 -> 2520 bytes 23 files changed, 805 insertions(+), 7 deletions(-) create mode 100644 vsixtest/App.xaml create mode 100644 vsixtest/App.xaml.cpp create mode 100644 vsixtest/App.xaml.h create mode 100644 vsixtest/Assets/LockScreenLogo.scale-200.png create mode 100644 vsixtest/Assets/SplashScreen.scale-200.png create mode 100644 vsixtest/Assets/Square150x150Logo.scale-200.png create mode 100644 vsixtest/Assets/Square44x44Logo.scale-200.png create mode 100644 vsixtest/Assets/Square44x44Logo.targetsize-24_altform-unplated.png create mode 100644 vsixtest/Assets/StoreLogo.png create mode 100644 vsixtest/Assets/Wide310x150Logo.scale-200.png create mode 100644 vsixtest/MainPage.xaml create mode 100644 vsixtest/MainPage.xaml.cpp create mode 100644 vsixtest/MainPage.xaml.h create mode 100644 vsixtest/Package.appxmanifest create mode 100644 vsixtest/pch.cpp create mode 100644 vsixtest/pch.h create mode 100644 vsixtest/vsixtest.sln create mode 100644 vsixtest/vsixtest.tcl create mode 100644 vsixtest/vsixtest.vcxproj create mode 100644 vsixtest/vsixtest.vcxproj.filters create mode 100644 vsixtest/vsixtest_TemporaryKey.pfx diff --git a/manifest b/manifest index a6c34eb4bb..e9256df548 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Extend\s[3e9ed1ae]\sso\sthat\scovering\sindexes\son\sWITHOUT\sROWID\stables\sare\salso\sidentified. -D 2016-02-24T20:16:28.164 +C Initial\swork\son\san\sautomated\sVSIX\stesting\stool.\s\sNot\sworking\sor\stested\syet. +D 2016-02-24T21:42:03.852 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 @@ -1429,7 +1429,31 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh a98af506df552f3b3c0d904f94e4cdc4e1a6d598 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 56f62e34ae9d5c7db07367f0007df258b2e76bd2 -R baac3e94ca81a0031c96821cb1862aed -U dan -Z 255768a198e66c588af8c08668af4632 +F vsixtest/App.xaml 7af5a2a527aa5783e208c436c5227a21b1023cec +F vsixtest/App.xaml.cpp c4aaab1774e771d2b6f662cbd247fd31df087a22 +F vsixtest/App.xaml.h f723ae437a141cd496adfccae517a6011dd95dfb +F vsixtest/Assets/LockScreenLogo.scale-200.png e820c9a3deb909197081b0bf3216c06e13905f0a +F vsixtest/Assets/SplashScreen.scale-200.png cab70988ca71bebec7bfeb3b6dbafe17b9ab0b4a +F vsixtest/Assets/Square150x150Logo.scale-200.png e17b40817db7a239fc239d83efcc951fb824e3ff +F vsixtest/Assets/Square44x44Logo.scale-200.png 2f166237094dea94d952d10b9eeae81806844f1c +F vsixtest/Assets/Square44x44Logo.targetsize-24_altform-unplated.png 5f6a6d391b95a3061ccca6e6fdd6955ede63b4ed +F vsixtest/Assets/StoreLogo.png 0828b7257db74a4ecd5eeb6b7b4971f0fdc4d9d1 +F vsixtest/Assets/Wide310x150Logo.scale-200.png 04ddefe5bc5f43ae12a7433f6f236ddab101ac42 +F vsixtest/MainPage.xaml b17ae614fc9aab5ee0068e16c9a3e3461d13b6d1 +F vsixtest/MainPage.xaml.cpp 66f81d6149d9a09de5c6c7846c6557cdd7a76b15 +F vsixtest/MainPage.xaml.h 5b8d65dc2b9e59e29bc0a6bca81211ff27ac830a +F vsixtest/Package.appxmanifest 0535b2e6708c44ad45ed7fb1dfd4de5de351dd7a +F vsixtest/pch.cpp 681cc12ddc215c95fe300ee8a3dde057fa2ec308 +F vsixtest/pch.h 9d2475a4f6d5c921b86c8f61060b6b04421f1010 +F vsixtest/vsixtest.sln 8950e044dd04a07046990d04bf77e60738e2d136 +F vsixtest/vsixtest.tcl d452077319cd94e626e37a8ea323f4e739dbc5a6 +F vsixtest/vsixtest.vcxproj 15407f0e35e914fecc65ed422ac08b28e52b3e4f +F vsixtest/vsixtest.vcxproj.filters 443739cb985bb81620dc66f375a845b25debe116 +F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 +P e721975faa0925be4029330550ff2a9666041ff7 +R 5235a7354869742aeac200c2498e03f2 +T *branch * vsixTest +T *sym-vsixTest * +T -sym-trunk * +U mistachkin +Z 30aae13ef1f9c0b59510b9ed5eae30fc diff --git a/manifest.uuid b/manifest.uuid index 56555f4bc2..8ebfae5b16 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e721975faa0925be4029330550ff2a9666041ff7 \ No newline at end of file +496e4ac984b2548dd5f2f969cd34656b586cfcfe \ No newline at end of file diff --git a/vsixtest/App.xaml b/vsixtest/App.xaml new file mode 100644 index 0000000000..7f023fe5d7 --- /dev/null +++ b/vsixtest/App.xaml @@ -0,0 +1,8 @@ + + + diff --git a/vsixtest/App.xaml.cpp b/vsixtest/App.xaml.cpp new file mode 100644 index 0000000000..5d60058f6b --- /dev/null +++ b/vsixtest/App.xaml.cpp @@ -0,0 +1,120 @@ +// +// App.xaml.cpp +// Implementation of the App class. +// + +#include "pch.h" +#include "MainPage.xaml.h" + +using namespace vsixtest; + +using namespace Platform; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::UI::Xaml::Controls::Primitives; +using namespace Windows::UI::Xaml::Data; +using namespace Windows::UI::Xaml::Input; +using namespace Windows::UI::Xaml::Interop; +using namespace Windows::UI::Xaml::Media; +using namespace Windows::UI::Xaml::Navigation; + +/// +/// Initializes the singleton application object. This is the first line of authored code +/// executed, and as such is the logical equivalent of main() or WinMain(). +/// +App::App() +{ + InitializeComponent(); + Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending); +} + +/// +/// Invoked when the application is launched normally by the end user. Other entry points +/// will be used such as when the application is launched to open a specific file. +/// +/// Details about the launch request and process. +void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) +{ + +#if _DEBUG + // Show graphics profiling information while debugging. + if (IsDebuggerPresent()) + { + // Display the current frame rate counters + DebugSettings->EnableFrameRateCounter = true; + } +#endif + + auto rootFrame = dynamic_cast(Window::Current->Content); + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (rootFrame == nullptr) + { + // Create a Frame to act as the navigation context and associate it with + // a SuspensionManager key + rootFrame = ref new Frame(); + + rootFrame->NavigationFailed += ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler(this, &App::OnNavigationFailed); + + if (e->PreviousExecutionState == ApplicationExecutionState::Terminated) + { + // TODO: Restore the saved session state only when appropriate, scheduling the + // final launch steps after the restore is complete + + } + + if (rootFrame->Content == nullptr) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); + } + // Place the frame in the current Window + Window::Current->Content = rootFrame; + // Ensure the current window is active + Window::Current->Activate(); + } + else + { + if (rootFrame->Content == nullptr) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); + } + // Ensure the current window is active + Window::Current->Activate(); + } +} + +/// +/// Invoked when application execution is being suspended. Application state is saved +/// without knowing whether the application will be terminated or resumed with the contents +/// of memory still intact. +/// +/// The source of the suspend request. +/// Details about the suspend request. +void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e) +{ + (void) sender; // Unused parameter + (void) e; // Unused parameter + + //TODO: Save application state and stop any background activity +} + +/// +/// Invoked when Navigation to a certain page fails +/// +/// The Frame which failed navigation +/// Details about the navigation failure +void App::OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e) +{ + throw ref new FailureException("Failed to load Page " + e->SourcePageType.Name); +} \ No newline at end of file diff --git a/vsixtest/App.xaml.h b/vsixtest/App.xaml.h new file mode 100644 index 0000000000..7322d11b9c --- /dev/null +++ b/vsixtest/App.xaml.h @@ -0,0 +1,27 @@ +// +// App.xaml.h +// Declaration of the App class. +// + +#pragma once + +#include "App.g.h" + +namespace vsixtest +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + ref class App sealed + { + protected: + virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override; + + internal: + App(); + + private: + void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e); + void OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e); + }; +} diff --git a/vsixtest/Assets/LockScreenLogo.scale-200.png b/vsixtest/Assets/LockScreenLogo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..735f57adb5dfc01886d137b4e493d7e97cf13af3 GIT binary patch literal 1430 zcmaJ>TTC2P7~aKltDttVHYH6u8Io4i*}3fO&d$gd*bA_<3j~&e7%8(eXJLfhS!M@! zKrliY>>6yT4+Kr95$!DoD(Qn-5TP|{V_KS`k~E6(LGS@#`v$hQo&^^BKsw3HIsZBT z_y6C2n`lK@apunKojRQ^(_P}Mgewt$(^BBKCTZ;*xa?J3wQ7~@S0lUvbcLeq1Bg4o zH-bvQi|wt~L7q$~a-gDFP!{&TQfc3fX*6=uHv* zT&1&U(-)L%Xp^djI2?~eBF2cxC@YOP$+9d?P&h?lPy-9M2UT9fg5jKm1t$m#iWE{M zIf%q9@;fyT?0UP>tcw-bLkz;s2LlKl2qeP0w zECS7Ate+Awk|KQ+DOk;fl}Xsy4o^CY=pwq%QAAKKl628_yNPsK>?A>%D8fQG6IgdJ ztnxttBz#NI_a@fk7SU`WtrpsfZsNs9^0(2a z@C3#YO3>k~w7?2hipBf{#b6`}Xw1hlG$yi?;1dDs7k~xDAw@jiI*+tc;t2Lflg&bM)0!Y;0_@=w%`LW^8DsYpS#-bLOklX9r?Ei}TScw|4DbpW%+7 zFgAI)f51s}{y-eWb|vrU-Ya!GuYKP)J7z#*V_k^Xo>4!1Yqj*m)x&0L^tg3GJbVAJ zJ-Pl$R=NAabouV=^z_t;^K*0AvFs!vYU>_<|I^#c?>>CR<(T?=%{;U=aI*SbZADLH z&(f2wz_Y0??Tf|g;?|1Znw6}6U43Q#qNRwv1vp9uFn1)V#*4p&%$mP9x&15^OaBiDS(XppT|z^>;B{PLVEbS3IFYV yGvCsSX*m literal 0 HcmV?d00001 diff --git a/vsixtest/Assets/SplashScreen.scale-200.png b/vsixtest/Assets/SplashScreen.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..023e7f1feda78d5100569825acedfd213a0d84e9 GIT binary patch literal 7700 zcmeHLYj~4Yw%(;oxoEH#Kxq-eR|+VkP17b#Vk;?4QwkI+A{L04G+#<<(x#Un1#+h5>eArRq zTw$)ZvTWW_Y?bDho0nPVTh08+s`sp!j74rJTTtXIDww0SILedFv?sZ?yb@@}GN;#8 znk_b~Q(A0YR#uV4ef!osoV1M3;vQ8N$O|fStfgf$S5;ddUNv`tWtGjM;koG#N;7M< zP*84lnx(bn_KF&9Z5Ai$)#Cs3a|$OFw>WKCT$of*L7_CqQEinflT|W{JT+aKp-E0v zsxmYg)1(T>DROm+LN1eQw8}KCTp=C!$H7`PU!t9_Hw@TsTI2`udRZv*!a5`#A9hK6Y95L(CDUX&_@QxKV z_feX{UhA#ZWlvgpL$#w^D#lq`_A4AzDqd|Zv6y9PX&DNcN|l}_D^{q@GG&H^Pg583 z8FI6N8^H7b5WjGp;urW)d7F+_lcp%KsLX0viCmE(OHH+=%ZfD_=`voUuoUxFO^L;- z;!;2{g-YiiO6m4bs89OuF9!p{FGtH-f%8<2gY!h9s)4ciN%{Kh1+`}{^}M~+TDH9N z^Z5PlgVXMC&2&k*Hw^Lb9gny#ro$MOIxIt{+r)EA10$VR3 zanN8D{TUkl+v0CQ_>ZoHP<M-x#8@8ZiT#$Kh`(uRaX1g$Bg|qy$<#7 zSSAi{Nb8Y=lvNVeio+UGLCAtoLBfL`iOv`)yoJMDJBN>4IH@(l7YRF;61@>qq1iM9 zr@b#OC~SAxSle?5Pp8Z78{VO0YFr1x7kZU64Z23eLf2T2#6J_t;-E}DkB?NufZ0Ug zi?J&byXeaB-uTNVhuiM!UVQw}bZrJ3GtAETYp->!{q#zfN7D3AS9@Q7*V^85jGx#R z(QxYV(wW#F0XF9^^s>>H8pPlVJ>)3Oz z&_X8Sf@~?cH_O*cgi$U#`v`RRfv#y3m(ZpKk^5uLup+lVs$~}FZU$r_+}#hl%?g5m z-u-}-666ssp-xWQak~>PPy$mRc|~?pVSs1_@mBEXpPVfLF6(Ktf1S* zPPh@QZ=tFMs?LM2(5P3L2;l_6XX6s&cYsP1ip#eg0`ZEP0HGYh{UmS@o`MihLLvkU zgyAG0G`b1|qjxxh1(ODKFE%AP}Dq=3vK$P7TXP4GrM1kQ72!GUVMDl`rDC&2;TA}*nF z8$nQD&6ys_nc1*E7$*1S@R8$ymy(sQV}imGSedB@{!QR5P&N_H=-^o!?LsWs+2|mH z-e=)T^SvI)=_JIm7}j4;@*Z17=(#}m=~YF~z~CLI+vdAGlJDcdF$TM?CVI1%LhUrN zaa6DJ=Yh$)$k&Oz{-~8yw^GM^8prYxSxo zvI4k#ibryMa%%*8oI-5m61Koa_A_xg=(fwp0aBX{;X4Q;NXUhtaoJDo1>TqhWtn=_ zd5~chq#&6~c%8JZK#t_&J(9EVUU&upYeIovLt1>vaHe}UUq>#RGQj!EN#5+0@T`(@ z^g~>*c`VGRiSt;!$_4+0hk^I!@O3``5=sZ8IwlxWW7km1B&_t&E*u0_9UBa#VqwY* zz>nxv?FAsVnRaD(Bui=6i==BFUw0k4n$>`umU`F2l?7CYTD^)c2X+d9X&ddS9|gj? zM?knGkGCX&W8offw8aLC2$D{PjC3nVZwd4k?eZH8*mZ)U@3Qk8RDFOz_#WUA#vnzy zyP>KrCfKwSXea7}jgJjBc}PGY+4#6%lbZyjhy`5sZd_Vy6Wz;ixa?czkN}J9It1K6 zY!eu>|AwF^fwZlLAYyQI*lM@^>O>Iu6Vf6i>Q$?v!SeUS<{>UYMwz$*%Aq?w^`j{h z!$GZbhu=^D{&ET8;))LL%ZBDZkQqRd2;u~!d9bHGmLRhLDctNgYyjsuvoSZ#iVdoB z2!f--UUA#U;<{je#?cYt^{PIyKa%hW>}uepWMyAI{{Zo7?2>?$c9;whJae%oN|I-kpTQSx_C$Z&;f zi2i)qmEn=y4U0uvk)$m;zKfjPK@oc?I`}1Jzl$Q~aoKBd3kt7L#7gyt|A_qgz6ai< z=X%D1i!d2h?rHR^R8SUj&G||dkC?DT>{o#Yau<@uqVT{Xef&XG}5*E4aPk{}~ zplx&XhaV)&1EfI3Em;Bw#O5SV^c;{twb-1Rw)+=0!e_BLbd7tYmXCH0wrlOSS+~`7He8Iqx0{CN+DVit9;*6L~JAN zD&cyT)2?h}xnYmL?^)<7YyzZ3$FHU^Eg;DLqAV{#wv#Wj7S`Jdl1pX&{3(uZ?!uh} zDc$ZTNV*7le_W6}Hju~GMTxZQ1aWCeUc%!jv3MHAzt>Y-nQK%zfT*3ebDQA5b?iGn; zBjv3B+GhLTexd_(CzZDP4|#n5^~scvB6#Pk%Ho!kQ>yYw((Dv{6=$g3jT1!u6gORW zx5#`7Wy-ZHRa~IxGHdrp(bm%lf>2%J660nj$fCqN(epv@y!l9s7@k6EvxS{AMP>WY zX4$@F8^kayphIx-RGO$+LYl9YdoI5d|4#q9##`_F5Xnx`&GPzp2fB{-{P@ATw=X@~ z_|&^UMWAKD;jjBKTK(~o?cUFRK8EX=6>cXpfzg4ZpMB>*w_^8GSiT-Jp|xBOnzM+j z*09-@-~qJ(eqWq5@R4i^u4^{McCP(!3}C|v_WsTR*bIUxN(Nx`u##3B4{sE`Z`v8w zAwIG`?1~PkID~W{uDzmqH98Pew_1(;x2%8r^vY{)_&J2K)cN{W+h5+g)ZcjP&Ci#O zgy|8K@4kyMfwilHd&6TDlhb%++Pk!>9HRld6HT7gwyZGrxS$}CsD6`>6!!2K1@Mjf z(P0WYB7V_OFZyeWrbOFb>O54BNXf~K&?}3=^v;v_wT{DKr?jN^DtN&DXwX%u?s*c6`%8>WFz z7}YW^tp0bp^NriE)AB6M2l<7rn7fzePtR*omOevpfm9n?}2V*+0iW;S)C zhg`NAjL?D=W#k*$aR{>pGf~lD-rVtD;5jW1_*Jn1j1=es@Kcx4ySM_bwcQCT=d+DV z>Sz~L=Hj@(X%31nK$mWI@7d>}ORB`K(p=+`UD)+99YUGQc7y^bHZ1F(8|tL0 zdK*DT0kSXG_{BKTpP2*2PecdKV9;dq$^ZZDP;Nyq1kp-&GI5eAyZsK!e3V zK@rPy*{(`KIfo+lc878mDKk^V#`VT05}64kBtk%DgwLrOvLMj5-;*GNKv6c6pzMuL z6EP%ob|_0IW}lLRXCP2!9wWhEw3LA7iF#1O1mIZ@Z=6&bz41F;@S_GvYAG-#CW3z{ zP3+6vHhvP&A3$##Vo9$dT^#MoGg^|MDm=Bt1d2RRwSZ<;ZHICpLBv5Xs!D?BH^(9_ z7`H=N&^v|Z-%mP}wNzG{aiFCsRgwzwq!N6obW9+7(R; z(SZ=23`|`>qil!LMGG{_Heq!BD>(Y-zV9wD)}hz25JA37YR%39;kI4y9pgtcUass6 zP24}ZY$vvYeI`zy&)A_X#nY3017ap*0&jx|mVwyGhg3;!keU53a}Uhm3BZI$N$6Se zLWlAmy1S0xKJm4G_U@sN_Tm=`$xWJSEwKU98rZ&)1R^*$$1vA3oG#&*%SMxY_~oGP zP&PFJatFLM-Ps%84IV-+Ow)T{C7cqUAvauy4C z(FRz&?6$Rypj{xO!`y=*J5o4@U8Q-(y5(*=YoKeZ+-1YdljXxkA#B)zo=FeQH#?Le zycNUmEEHWO9a=X^pb#&cOq7-`7UA87#|S22)<7RUtZo|(zibX=w;K3qur9vy#`MNV z6UUcf9ZwEnKCCp+OoBnF@OdbvH)ANXO0o~Pi9l8=x3))}L<#vO0-~O4!~--Ket?d} zJaqsj<@CD1%S2cTW%rOP{Vto%0sGW~1RMa_j^)5nil0Yw- z0EE#bP+l4#P^%PQ+N*oxu1Zq05xZ!bXfYTg>9c{(Iw*lnjR^>kz%lAN^zFce7rppy zY8zA~3GD=A6d*hze&l4D_wA~+O!56)BZTe_rEu}Ezi<4!kG|W#amBZ5{&XS2@6R~H z{9o^y*BkH4$~yX9U&@CgbOzX1bn9xqF|zh$Dh0Y5y*E0e90*$!ObrHY3Ok0`2=O~r zCuke6KrP9KOf?V(YDsM<6pX2nVoN%M$LT^q#FmtaF?1^27F*IcNX~XRB(|hCFvdcc zc)$=S-)acdk$g4?_>jRqxpI6M3vHZk?0c^3=byamYDNf;uB{3NlKW5IhnOS3DNkMV z?tK8?kJ}pmvp%&&eTVOVjHP`q34hN1@!aK}H(K!vI`~gf|Gv+FNEQD5Yd<~yX7k_l h&G-K)@HZb3BABY{)U1?^%I#E6`MGoTtustd{~yM6srvu` literal 0 HcmV?d00001 diff --git a/vsixtest/Assets/Square150x150Logo.scale-200.png b/vsixtest/Assets/Square150x150Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..af49fec1a5484db1d52a7f9b5ec90a27c7030186 GIT binary patch literal 2937 zcma)84OCO-8BSud5)jwMLRVKgX(S?$n?Ld|vrsm<$CF7)&zTbyy1FE5bU`Q17MRv`9ue$;R(@8kR;#vJ*IM0>cJIAOte!d7oRgdH zd%ySjdB6L9=gX^A6)VzH7p2l@v~3zJAMw|DFy#^)F@@F*`mqUn=Il>l)8_+ab;nOW{%+iPx z+s{Eu|&pIs)Z7{La9~?xKfyl z#43?gjEL15d4WbOZo#SiP%>DB^+BcnJ=7dHEe;r#G=tuw|ka z%q@}##Uh7;tc%L_64m(kHtw74ty%BJMb)_1)#S0j`)F8_1jF7vScpsnH=0V19bO8y zR`0SjIdCUo&=>JwMQF8KHA<{ODHTiQh}0^@5QRmCA?gOH6_H3K^-_sNB^RrdNuK-R zOO*vOrKCVvDwgUck`kF(E7j{I#iiN;b*ZdCt4m@HPA`EuEqGGf4%!K<;(=I=&Vyrw z%TwcWtxa}8mCZ%Cyf&ActJ6_$ox5z6-D!0-dvnRx6t7y3d+h6QYpKWO;8OdnvERo7 zuEf>ih5`wqY)~o@OeVt-wM?Q!>QzdGRj!bz6fzYrfw$hZfAKzr2-M+D+R>}~oT574c;_3zquHcElqKIsryILt3g8n3jcMb+j?i?-L3FpZJ z2WRVBRdDPc+G5aaYg#5hpE+6nQ|(VSoxT3|biF;BUq#==-27Xi=gihDPYP$7?=9cP zYKE$jeQ|3~_L0VG-(F~2ZPyD0=k{J4Q~h(t__{-mz_w8{JDY9{`1ouzz!Vr5!ECdE z6U~O1k8c}24V7~zzXWTV-Pe4)y}wQJS&q%H5`Fo_f_JvIU489aCX$;P`u#!I-=^4ijC2{&9!O&h>mi?9oYD=GC#%)6{GzN6nQYw+Fal50!#x^asjBBR50i`+mho*ttoqV)ubM2KD9S~k7+FR4>{29?6 z{!l6kDdyTN0YJ9LgkPWeXm|gyi@zM3?0@{&pXT12w|78&W-q!RRF)&iLCEZVH<|fR zN0fr2^t8H(>L?>K#>^+jWROLral(Qy-xoBq1U7A&DV||wClb)Otd9?(gZ|8znMF}D zf<1haWz^s0qgecz;RFGt0C-B4g`jNGHsFU+;{<%t65v^sjk^h$lmWn#B0#_)9ij&d z-~lc`A)YYExi^7sBuPM^Y|wA2g*5?`K?#7tzELQYNxGo$UB$4J8RJp1k(8Jj+~hMT zlN~>M@KTTh^--8y3PK_NZ@AC!{PT=CziBzGd+wTJ^@icH!Bd}%)g8V)%K?|c&WTUk zy}qv1C%(fjRoZ4ozC3{O%@5?)XzH35zHns$pgU*Q?fj4v?fp1Qbm+j;3l;9jam9Da zXVcKjPlQ73x78QPu|Ffm6x?`~e3oD=gl=4kYK?={kD5j~QCXU)`HSdduNNENzA*2$ zOm3PzF!lN5e*06-f1Uot67wY#{o-S1!KZ7E=!~7ynnk9_iJR#kFoNbAOT#^2Gd17F zMmvU6>lndZQGd|ax9kUoXXO+$N?|j@6qpsF&_j7YXvwo_C{JpmLw5&#e6k>atv%es z5)7r*Wvv_JkUpT}M!_o!nVlEk1Zbl=a*2hQ*<|%*K1Glj^FcF`6kTzGQ3lz~2tCc@ z&x|tj;aH&1&9HwcJBcT`;{?a+pnej;M1HO(6Z{#J!cZA04hnFl;NXA+&`=7bjW_^o zfC40u3LMG?NdPtwGl>Tq6u}*QG)}-y;)lu-_>ee3kibW(69n0$0Zy!}9rQz%*v1iO zT9_H>99yIrSPYVy6^);rR}7Yo=J_T@hi+qhTZXnVWyf;JDYm5#eYLTxr*?kiNn!+Y zQ+LUkBafNJ#rH#C(?d5^;gw9o#%daEI{mA*LHPIHPU`#|H$hD zwm>0&+kahQ)E#%~k>&5@&#Vg82H?s%71=)(soi@174pi9--2{w{1$}Sz4zGn3Du&x bht0Iza^2ykEt4(epJ78uh5nDlX8(TxzDYwP literal 0 HcmV?d00001 diff --git a/vsixtest/Assets/Square44x44Logo.scale-200.png b/vsixtest/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..ce342a2ec8a61291ba76c54604aea7e9d20af11b GIT binary patch literal 1647 zcmaJ?eM}Q)7(e+G1Q(|`V9JhTI2>MkceK4;p;PR&$Pi?ejk3YQ_3o`S&|W_dsOZ8# zWPTt69g`t$ab`0cj-Y0yiBSOqmd)tG7G(}M5aP0_%&9TijB#&)I{zSE^4@#z^FF`l z`8{8`o%wlL(UI|y2!cdsuVamHH~H86F!*-15em4)NqUpCQM5?aoC_eCf@lV4wvF2a zjDQn1JBL69f&@2M3rvzJcfE!eZ8FZUBlFlC5RD)it33{mF9#B82AiyQE%w)`vlwa> zv{<1sm&kSKK$&%2jSFn7$t&P%%6Ue>R=EAnG8N7fqynWG8L3p!4801a;8{+nliO(qd(jNJ_?+9W3#hLIDLoT6~3fx9=`CC-D}-AMrpEO7HK zt3$GicGPc?GmDjy7K2P@La;eu4!$zWCZ`ym{Z$b zu-O6RM&K4JT|BIZB`E-gxqG%FzanI#+2FFmqHqXG7yxWB=w55RGOM)$xMb(>kSNR z2w=1AZi%z=AmG~yea~XaXJR!v7vLn(RUnELfiB1|6D84ICOS}^Zo2AdN}<&*h}G_u z{xZ!(%>tLT3J3<5XhWy-tg+6)0nmUUENLW8TWA{R6bgVd3X;anYFZ^IRis*_P-C-r z;i>%1^eL3UI2-{w8nuFFcs0e~7J{O2k^~Ce%+Ly4U?|=!0LH=t6()xi<^I-rs+9sF z*q{E-CxZbGPeu#a;XJwE;9S1?#R&uns>^0G3p`hEUF*v`M?@h%T%J%RChmD|EVydq zmHWh*_=S%emRC*mhxaVLzT@>Z2SX0u9v*DIJ@WC^kLVdlGV6LpK$KIrlJqc zpJ921)+3JJdTx|<`G&kXpKkjGJv=76R`yYIQ{#c-`%+`#V(7}Q;&@6U8!Td1`d;?N z_9mnI#?AA}4J!r)LN4!E-@H5eXauuB7TOawS>Y|{-P?NNx-lq+z1W-+y(;39P&&LP zL{N80?&=C*qKmdA^moMZRuPcD!B<*mq$ch=0Cnlitw#txRWhb3%TQvPqjkC`F69G4b! ze7z9MZ#+;_#l?H37UqUhDFb^l&s2{oM$3I0o^Q!yx;;V)QmCMo)Tb_ui|mit8MS?U zm##6$sZZ1$@|s%?l@>4Z<*Q}sRBSKMhb4I{e5LdEhsHIHTe8Bod5c>6QtT>$XgUBz z6MK`kO$=jmt@FqggOhJ5j~e@ygRbG;<{Vu)*+nn9aQeo0;$#j;|MS=S$&L?BeV25z xs3B`@=#`5TF{^6(A1rvdY@|-RtQ|iS5{tyX+wH?;n8E)G$kykv-D^wh{{!TZT%7;_ literal 0 HcmV?d00001 diff --git a/vsixtest/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/vsixtest/Assets/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 0000000000000000000000000000000000000000..f6c02ce97e0a802b85f6021e822c89f8bf57d5cd GIT binary patch literal 1255 zcmaJ>TWs4@7*5+{G#S+&C!qC#> zf>5N3P6jO*Cz>ug*(_DmW=)kea&m$gZ^+nyiF`;j%w@}y8)>p*SH}C`m?DXeieF2U zyQHecc_L%Gh!7GMt+hG06y;+|p4>m~}PjA}rKViGiEnn7G0ZO<>G|7q;2?NwGCM3s?eued6%hd$B+ z*kQJ{#~$S=DFE(%=E+UkmlEI*%3llUf~8Ja9YU1Vui0IbGBkW_gHB%Rd&!!ioX zs40O?i9I{};kle7GMvE7(rk`la=gTI)47=>%?q@^iL-nUo3}h4S}N-KHn8t5mVP8w z&bSErwp+37 zNJJ8?a|{r5Q3R0Z5s-LB1WHOwYC@7pCHWND#cL1cZ?{kJ368_*(UDWUDyb<}0y@o# zfMF016iMWPCb6obAxT$JlB6(2DrlXDTB&!0`!m??4F(qWMhjVZo?JXQmz`1*58Z=& zcDmB|S-E@j?BoFGix0flckqdS4jsPNzhfWyWIM98GxcLs89C(~dw%$_t;JjX-SD}E zfiGV;{8Q%8r}w9x>EEigW81>`kvnU@pK)4+xk9@+bNj9L!AAZ@SZ@q|)&BmY3+HZx zul~BeG4|}-;L%cHViQGQX?^zFfO0&#cHwel=d`lH9sJ-@Sl@n*(8J2>%Ac`IxyY?Q z{=GhWvC#gu-~Ia7*n{=+;qM?Ul_wy1+u7ho;=`>EwP^g~R@{unBds`!#@}tluZQpS zm)M~nYEifJWJGx?_6DcTy>#uh%>!H9=hb^(v`=m3F1{L>db=<5_tm+_&knAQ2EU$s Mu9UqpbNZeC0BbUo^Z)<= literal 0 HcmV?d00001 diff --git a/vsixtest/Assets/StoreLogo.png b/vsixtest/Assets/StoreLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..7385b56c0e4d3c6b0efe3324aa1194157d837826 GIT binary patch literal 1451 zcmaJ>eN5D57_Z|bH;{0+1#mbl)eTU3{h)Wf7EZV?;HD@XL@{B`Ui%(2aMxQ~xdXSv z5nzWi(LW)U2=Vc-cY@s7nPt{i0hc6!7xN4NNHI#EQl>YNBy8l4%x9gr_W-j zEZMQmmTIy(>;lblRfh`dIyTgc9W5d!VP$L4(kKrN1c5G~(O_#xG zAJCNTstD^5SeXFB+&$h=ToJP2H>xr$iqPs-#O*;4(!Fjw25-!gEb*)mU}=)J;Iu>w zxK(5XoD0wrPSKQ~rbL^Cw6O_03*l*}i=ydbu7adJ6y;%@tjFeXIXT+ms30pmbOP%Q zX}S;+LBh8Tea~TSkHzvX6$rYb)+n&{kSbIqh|c7hmlxmwSiq5iVhU#iEQ<>a18|O^Sln-8t&+t`*{qBWo5M?wFM(JuimAOb5!K#D}XbslM@#1ZVz_;!9U zpfEpLAOz=0g@bd6Xj_ILi-x^!M}73h^o@}hM$1jflTs|Yuj9AL@A3<-?MV4!^4q`e z)fO@A;{9K^?W?DbnesnPr6kK>$zaKo&;FhFd(GYFCIU^T+OIMb%Tqo+P%oq(IdX7S zf6+HLO?7o0m+p>~Tp5UrXWh!UH!wZ5kv!E`_w)PTpI(#Iw{AS`gH4^b(bm^ZCq^FZ zY9DD7bH}rq9mg88+KgA$Zp!iWncuU2n1AuIa@=sWvUR-s`Qb{R*kk(SPU^`$6BXz8 zn#7yaFOIK%qGxyi`dYtm#&qqox0$h=pNi#u=M8zUG@bpiZ=3sT=1}Trr}39cC)H|v zbL?W)=&s4zrh)7>L(|cc%$1#!zfL?HjpeP%T+x_a+jZ16b^iKOHxFEX$7d|8${H-* zIrOJ5w&i$>*D>AKaIoYg`;{L@jM((Kt?$N$5OnuPqVvq**Nm}(f0wwOF%iX_Pba;V z;m@wxX&NcV3?<1+u?A{y_DIj7#m3Af1rCE)o`D&Y3}0%7E;iX1yMDiS)sh0wKi!36 zL!Wmq?P^Ku&rK~HJd97KkLTRl>ScGFYZNlYytWnhmuu|)L&ND8_PmkayQb{HOY640 bno1(wj@u8DCVuFR|31B*4ek@pZJqxCDDe1x literal 0 HcmV?d00001 diff --git a/vsixtest/Assets/Wide310x150Logo.scale-200.png b/vsixtest/Assets/Wide310x150Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..288995b397fdbef1fb7e85afd71445d5de1952c5 GIT binary patch literal 3204 zcmbVPeQXow8NYmBd90>}0NP?GhXW~VaeThm=a0tV#EwJMI!)6M3}|c4_Bl3=Kd>G0 z(GHx1wl<7(tP?FsOQkTilSo*iIvF%uArExJ73~P zSv1xEy!U(Wd4A9D`FQV@W3@F^qJ@PEF$@z`Z!*BbFsS(^?B zyiAzJ+q})bkgiQHWqEb*jJD-coHYr1^iocg)l!Qa{Xqs-l~6J}p-|##ZHYofskQ3$ zI0;xzXyhazBeXhIsg5A=%ufo@f)1yy&ScKS0;HF^!r_2UE^lpZEom(+@duma3awTv zCrCL-%D_SvYWIcdHkmI}#50(fkUi)Qgx!80ju>g1za^}ff>JI8Z@^-iCiaCgg@TgF z+vtE?Q9{VQUX&MW9SYYmGcxA14%N2@7FwBTD4N<(2{nWgV8$e3?-F=L^&FrtWn~(U_Q~~^uYiyeY6-KoTnfh9AWz@ zIKje0)u!_Lw)E}G!#kEfwKVdNt(UAf9*f>tEL_(=xco-T%jTi@7YlC3hs2ik%Le0H ztj}RTeCF(5mwvi3_56>-yB?l;J>-1%!9~=fs|QcNG3J~a@JCu`4SB460s0ZO+##4fFUSGLcj_ja^fL4&BKALfb#$6$O?>P@qx2Agl^x0i&ugt zsy5Pyu=()`7HRMG3IB7F1@`_ z+-!J%#i6e^U$e#+C%Q>_qVRzWRsG^W_n+@OcX@vzI&z;mzHNb!GQ?LWA(wtpqHqTM z1OFw_{Zn?fD)p)`c`kOgv{de=v@suGRqY{N^U7gI1VF3*F=obwaXI6ob5__Yn zVTguS!%(NI09J8x#AO_aW!9W7k*UvB;IWDFC3srwftr{kHj%g)fvnAm;&h_dnl~

MY- zf+K}sCe8qU6Ujs`3ua{U0Of$R_gVQBuUA za0v=mu#vIOqiiAZOr&h*$WyOw&k-xr$;G4Ixa!#TJNr>95(h>l%)PUy4p+^SgR(uR zta%k*?ny-+nAr8spEk1fo{J4i!b^Fia`N{_F6@zidA2ZTTrjl#^5Z-2KfB@Cu}l9s z(*|Z2jc?p~vn2f)3y9i*7zJV1L{$?|&q)4oaT;uXi6>1GkRXVTOzAz(RHEmr=eFIi z`}<>-Q?K0GN8!IYxeP1XKXO+jsJbp~o^);Bc;%b7Flpe7;1`Ny@3r7ZR;?R)aJt8C ziNlEC<@3f_lIV4TwV}&e;D!Ee5_|e#g0LUh=5vmYWYm7&2h*M>QPKvGh9-)wfMMW3 z8J9b%1k7dzPzO0_NGQy92BZ^FR6R~6;^6?lqO;-QUP4BY%cG%3vEhbm#>4vIhPBh3 z-+pZGjh$x%Hp{?=FHsMp0&wNPlj00us{&`1ZOZTqs8%4X&xH=UDr*xyBW(Zp&Em94 zf)ZSfn#yg0N)>!1kWdkqJ^S*z0FF5|fj&qcE#Na|%OY0$uO>!&hP+1ywfD_WXk@4J(?MBftK7>$Nvqh@tDuarN%PrTLQ2Uzysx>UV=V zk^RrDSvdQ?0;=hY67EgII-f4`t=+i*yS=Y~!XlqIy_4x&%+OdfbKOFPXS2X5%4R{N z$SQMX^AK6(fA + + + + + diff --git a/vsixtest/MainPage.xaml.cpp b/vsixtest/MainPage.xaml.cpp new file mode 100644 index 0000000000..f615f4d89e --- /dev/null +++ b/vsixtest/MainPage.xaml.cpp @@ -0,0 +1,27 @@ +// +// MainPage.xaml.cpp +// Implementation of the MainPage class. +// + +#include "pch.h" +#include "MainPage.xaml.h" + +using namespace vsixtest; + +using namespace Platform; +using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::UI::Xaml::Controls::Primitives; +using namespace Windows::UI::Xaml::Data; +using namespace Windows::UI::Xaml::Input; +using namespace Windows::UI::Xaml::Media; +using namespace Windows::UI::Xaml::Navigation; + +// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 + +MainPage::MainPage() +{ + InitializeComponent(); +} diff --git a/vsixtest/MainPage.xaml.h b/vsixtest/MainPage.xaml.h new file mode 100644 index 0000000000..cf95007d17 --- /dev/null +++ b/vsixtest/MainPage.xaml.h @@ -0,0 +1,21 @@ +// +// MainPage.xaml.h +// Declaration of the MainPage class. +// + +#pragma once + +#include "MainPage.g.h" + +namespace vsixtest +{ + ///

+ /// An empty page that can be used on its own or navigated to within a Frame. + /// + public ref class MainPage sealed + { + public: + MainPage(); + + }; +} diff --git a/vsixtest/Package.appxmanifest b/vsixtest/Package.appxmanifest new file mode 100644 index 0000000000..49e45cbc3e --- /dev/null +++ b/vsixtest/Package.appxmanifest @@ -0,0 +1,49 @@ + + + + + + + + + + vsixtest + mistachkin + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vsixtest/pch.cpp b/vsixtest/pch.cpp new file mode 100644 index 0000000000..ef288d82ad --- /dev/null +++ b/vsixtest/pch.cpp @@ -0,0 +1,6 @@ +// +// pch.cpp +// Include the standard header and generate the precompiled header. +// + +#include "pch.h" diff --git a/vsixtest/pch.h b/vsixtest/pch.h new file mode 100644 index 0000000000..e5006e81d3 --- /dev/null +++ b/vsixtest/pch.h @@ -0,0 +1,11 @@ +// +// pch.h +// Header for standard system include files. +// + +#pragma once + +#include +#include + +#include "App.xaml.h" diff --git a/vsixtest/vsixtest.sln b/vsixtest/vsixtest.sln new file mode 100644 index 0000000000..bebec6355b --- /dev/null +++ b/vsixtest/vsixtest.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vsixtest", "vsixtest.vcxproj", "{60BB14A5-0871-4656-BC38-4F0958230F9A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|ARM.ActiveCfg = Debug|ARM + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|ARM.Build.0 = Debug|ARM + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|ARM.Deploy.0 = Debug|ARM + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x64.ActiveCfg = Debug|x64 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x64.Build.0 = Debug|x64 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x64.Deploy.0 = Debug|x64 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x86.ActiveCfg = Debug|Win32 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x86.Build.0 = Debug|Win32 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x86.Deploy.0 = Debug|Win32 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|ARM.ActiveCfg = Release|ARM + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|ARM.Build.0 = Release|ARM + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|ARM.Deploy.0 = Release|ARM + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x64.ActiveCfg = Release|x64 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x64.Build.0 = Release|x64 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x64.Deploy.0 = Release|x64 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x86.ActiveCfg = Release|Win32 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x86.Build.0 = Release|Win32 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x86.Deploy.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/vsixtest/vsixtest.tcl b/vsixtest/vsixtest.tcl new file mode 100644 index 0000000000..3c0a8dbf56 --- /dev/null +++ b/vsixtest/vsixtest.tcl @@ -0,0 +1,215 @@ +#!/usr/bin/tclsh +# +# This script is used to quickly test a VSIX (Visual Studio Extension) file +# with Visual Studio 2015 on Windows. +# +# PREREQUISITES +# +# 1. Tcl 8.4 and later are supported, earlier versions have not been tested. +# +# 2. The "sqlite-UWP-output.vsix" file is assumed to exist in the parent +# directory of the directory containing this script. The [optional] first +# command line argument to this script may be used to specify an alternate +# file. However, currently, the file must be compatible with both Visual +# Studio 2015 and the Universal Windows Platform. +# +# 3. The temporary directory specified in the TEMP or TMP environment variables +# must refer to an existing directory writable by the current user. +# +# 4. The VS140COMNTOOLS environment variable must refer to the Visual Studio +# 2015 common tools directory. +# +# USAGE +# +# The first argument to this script is optional. If specified, it must be the +# name of the VSIX file to test. +# +package require Tcl 8.4 + +proc fail { {error ""} {usage false} } { + if {[string length $error] > 0} then { + puts stdout $error + if {!$usage} then {exit 1} + } + + puts stdout "usage:\ +[file tail [info nameofexecutable]]\ +[file tail [info script]] \[vsixFile\]" + + exit 1 +} + +proc getEnvironmentVariable { name } { + # + # NOTE: Returns the value of the specified environment variable or an empty + # string for environment variables that do not exist in the current + # process environment. + # + return [expr {[info exists ::env($name)] ? $::env($name) : ""}] +} + +proc getTemporaryPath {} { + # + # NOTE: Returns the normalized path to the first temporary directory found + # in the typical set of environment variables used for that purpose + # or an empty string to signal a failure to locate such a directory. + # + set names [list] + + foreach name [list TEMP TMP] { + lappend names [string toupper $name] [string tolower $name] \ + [string totitle $name] + } + + foreach name $names { + set value [getEnvironmentVariable $name] + + if {[string length $value] > 0} then { + return [file normalize $value] + } + } + + return "" +} + +proc appendArgs { args } { + # + # NOTE: Returns all passed arguments joined together as a single string with + # no intervening spaces between arguments. + # + eval append result $args +} + +# +# NOTE: This is the entry point for this script. +# +set script [file normalize [info script]] + +if {[string length $script] == 0} then { + fail "script file currently being evaluated is unknown" true +} + +set path [file dirname $script] + +############################################################################### + +# +# NOTE: Process and verify all the command line arguments. +# +set argc [llength $argv] +if {$argc > 1} then {fail} + +if {$argc == 1} then { + set fileName [lindex $argv 0] +} else { + set fileName [file join [file dirname $path] sqlite-UWP-output.vsix] +} + +if {[string length $fileName] == 0} then { + fail "invalid VSIX file name" +} + +if {![file exists $fileName] || ![file isfile $fileName]} then { + fail [appendArgs "VSIX file \"" $fileName "\" does not exist"] +} + +set envVarName VS140COMNTOOLS +set vsDirectory [getEnvironmentVariable $envVarName] + +if {[string length $vsDirectory] == 0} then { + fail [appendArgs \ + "Visual Studio 2015 environment variable \"" $envVarName "\" missing"] +} + +if {![file exists $vsDirectory] || ![file isdirectory $vsDirectory]} then { + fail [appendArgs \ + "Visual Studio 2015 directory \"" $vsDirectory \ + "\" does not exist"] +} + +set vsixInstaller [file join [file dirname $vsDirectory] IDE VSIXInstaller.exe] + +if {![file exists $vsixInstaller] || ![file isfile $vsixInstaller]} then { + fail [appendArgs \ + "Visual Studio 2015 VSIX installer \"" $vsixInstaller \ + "\" does not exist"] +} + +set envVarName ProgramFiles +set programFiles [getEnvironmentVariable $envVarName] + +if {[string length $programFiles] == 0} then { + fail [appendArgs \ + "Windows environment variable \"" $envVarName "\" missing"] +} + +if {![file exists $programFiles] || ![file isdirectory $programFiles]} then { + fail [appendArgs \ + "Program Files directory \"" $programFiles "\" does not exist"] +} + +set msBuild [file join $programFiles MSBuild 14.0 Bin MSBuild.exe] + +if {![file exists $msBuild] || ![file isfile $msBuild]} then { + fail [appendArgs \ + "MSBuild 14.0 executable file \"" $msBuild "\" does not exist"] +} + +set temporaryDirectory [getTemporaryPath] + +if {[string length $temporaryDirectory] == 0 || \ + ![file exists $temporaryDirectory] || \ + ![file isdirectory $temporaryDirectory]} then { + fail "cannot locate a usable temporary directory" +} + +set installLogFileName [appendArgs \ + [file rootname [file tail $fileName]] -install- [pid] .log] + +set buildLogFileName [appendArgs \ + [file rootname [file tail $fileName]] -build- [pid] .log] + +set uninstallLogFileName [appendArgs \ + [file rootname [file tail $fileName]] -uninstall- [pid] .log] + +set command(1) [list exec [file nativename $vsixInstaller] /quiet /norepair] +lappend command(1) [appendArgs /logFile: $installLogFileName] +lappend command(1) [file nativename $fileName] + +set command(2) [list exec [file nativename $msBuild]] +lappend command(2) [file nativename [file join $path vsixtest.sln]] +lappend command(2) /target:Rebuild /property:Configuration=Release + +lappend command(2) [appendArgs \ + /logger:FileLogger,Microsoft.Build.Engine\;Logfile= \ + [file nativename [file join $temporaryDirectory $buildLogFileName]] \ + \;Verbosity=diagnostic] + +set command(3) [list exec [file nativename $vsixInstaller] /quiet /norepair] +lappend command(3) [appendArgs /logFile: $uninstallLogFileName] +lappend command(3) [appendArgs /uninstall:SQLite.UWP.2015] + +puts stdout [appendArgs \ + "Install log will be \"" [file nativename [file join \ + $temporaryDirectory $installLogFileName]] "\"."] + +puts stdout [appendArgs \ + "Build log will be \"" [file nativename [file join \ + $temporaryDirectory $buildLogFileName]] "\"."] + +puts stdout [appendArgs \ + "Uninstall log will be \"" [file nativename [file join \ + $temporaryDirectory $uninstallLogFileName]] "\"."] + +puts stdout [appendArgs \ + "First command is \"" $command(1) "\"."] + +puts stdout [appendArgs \ + "Second command is \"" $command(2) "\"."] + +puts stdout [appendArgs \ + "Third command is \"" $command(3) "\"."] + +# eval exec $command(1) +# eval exec $command(2) +# eval exec $command(3) diff --git a/vsixtest/vsixtest.vcxproj b/vsixtest/vsixtest.vcxproj new file mode 100644 index 0000000000..a7b4fd302b --- /dev/null +++ b/vsixtest/vsixtest.vcxproj @@ -0,0 +1,213 @@ + + + + {60bb14a5-0871-4656-bc38-4f0958230f9a} + vsixtest + en-US + 14.0 + true + Windows Store + 10.0.10586.0 + 10.0.10586.0 + 10.0 + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + Application + true + v140 + + + Application + true + v140 + + + Application + true + v140 + + + Application + false + true + v140 + true + + + Application + false + true + v140 + true + + + Application + false + true + v140 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + vsixtest_TemporaryKey.pfx + + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + + + App.xaml + + + MainPage.xaml + + + + + + Designer + + + Designer + + + + + + Designer + + + + + + + + + + + + + + + + + + + App.xaml + + + MainPage.xaml + + + + Create + Create + Create + Create + Create + Create + + + + + + + + + diff --git a/vsixtest/vsixtest.vcxproj.filters b/vsixtest/vsixtest.vcxproj.filters new file mode 100644 index 0000000000..a4a1a305a8 --- /dev/null +++ b/vsixtest/vsixtest.vcxproj.filters @@ -0,0 +1,24 @@ + + + + + 60bb14a5-0871-4656-bc38-4f0958230f9a + + + e6271362-8f96-476d-907f-4da227b02435 + bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + Assets + + + Assets + + + Assets + + + Assets + + + diff --git a/vsixtest/vsixtest_TemporaryKey.pfx b/vsixtest/vsixtest_TemporaryKey.pfx new file mode 100644 index 0000000000000000000000000000000000000000..e6787bcad0527ecc86a43ea007ba8776c4b26215 GIT binary patch literal 2520 zcmY*ac|6o>7ypeJ!=Nx|G_o{dY||aaG7*=uRdx}&bTP8McB-MVjL1zQ`_@>78g~pM zA?Xf@v>;?lA^YyizFzOI`+48{e%{ade4q22?>Xl=&p*%i!BY{vTo5Rpib#PYl;Ta} zw~jz~Aca&!42+7PfHWCT<=*|j6!!v*$~^ zY4Gr)FkYQeF~j*M(BHYZc)DOz*q}&)S9!g{H0k1#-rUN(n(H$|6{LPDexJiZ-kU&FbKR@6F34qKTFux@xniVPiG3Im6+bkmhv?r))l&Dh z+rGAjRwjvXTA0-DCAE3)udY3mp1vfqB3r%W%g$US-xNB~H$WB(SFOM2DM~Wb`WBSD zrsmnx6crY!JKAQdDOCEnQ5#8nJ>48`5K7FJFeu*hS-7x2Y$2yv`B>Nx-3hmP;(RFy z>4r0O+foVl^mk0SOzpMr@0RX8mCUL5tlyl{MKF0b;i|tRD>LlIMi~&oU!IG7AxM`F zd_#_lI(}YT;&5QhZ+qcdpq3+<;;1m9=S>c>udYxaep@Dvv^}7m$fO>mSS38a5RhJ6 zp-1GMa^ics&P9wCvgLhqgvMPaCFq6dHGY*&sET#^P??s~ts;S1JG!ou^>D}dQmSjt1sMDg_CQC%AyT@e zMd7E`TfZE>FFm5?)Q$>8wZZ0VB>N!J@)r83mQBqaF}Y{Uwi%mz)NkpyE3B;@=v5}}d$e3g6>CQ4uG3CVAPb8E{o(WDWx64dZr zp~GyP4l06CQ6(2E;~nvGUC7z+hVM-7p?<&URkIz5MT@xX$>*0mA1g!F3`(i~we1?> zCme&g0u{bUVnnHIuSxUgYmd71`BL_R*$o++|bK}tOlc$|~C=(DW z&rQ$s(beUf`fbWSPAX_@_3*gC*Pkr9Yphb#z6pFcxnVw45Y=$<_o5u#Z_=V`n9!zz zu)AsO#IDlGltwGD^nU@JbmfQa8rJ={g`Km$J)Ta=Pd1Z6YsPH0D+QJE2dCV$Z;mRI zoyfEnsZE4uRpk571wJ}vL|(m}H{2-3%p*&Vn2nbA%Z=y0XEDc((lKYlJv)TC>;1l{ z4O+%tJU7;gv*DgXg{FE!g~fLkvE1lRk_skAi?6>_chzTNljJ+_axug1@=%PeWB%0Y zZx${;(*_#DG_0;p@A?Y9U^3>$)UmrQ#fxUW;;Vns_?~!>9+eAzIa9V4%IASYmApcF z%JBQ$bLiT+QY3$;Vb67wcR@TzA`POm7enC3ZEnyb6f!7AO1VbsZpaJYTo8C3S`57| zib#6NF2;0k*oxm5IQb~biC%Ilb4$wJT?c9XTEws}tY+sLtuz1`yKZw@cF0ubssp1c zsrJo*BF$6j?XPg1Y{hG@mGJXpv)&=crtdfV3DmC&tEcKL<)ULX(L`jYyE!8px{zbP zdcV+{=k8NPMs9i?<7q~8ki-zKG0b$`U)-gMXFKhc0}U67EBYJ~Z%a(oY5lr`<-5oy zH+1oHbv!E+fu0J{^=?;<>A;KpBbNvP0D2z#VV}p$e#h-WBvX zKm#;QaE}AjK_h_~9B>A}10Eo701>PvfpupppN3TP0xDgON^?RXv4sJk^KVx0KFp@SC#Ri>(&9VxcHC3dS?;)F)TWn|xj%(VJ3 z?BI|MHp9_6I#{*17;l37liej`h=-Ca6?L&By%5V;q{3x*D>k(vPJVCyEv&7uJXYo% z`;aL*(Xf#x!O0$>BRgIW^>r~tePV%+pyjw** zk#KpMa)N4+fIjYL{witoF=GL3nQ#>6VURDreL& z;+XWM^-=}m0p0s-z#CP%=~x~n{!7Wma!&{A9~LhUX0X)%-UCX(CLz2T92^D@sI+U@p4S%bFf zuBKCWyS+m`-R;8L+8BouJXjmaBoWznxBFaMql1&t9#(R1%2LWMEzjnN&_X$kt647= z?@6{FoIXEqpW|P0Yan0FI)Mqy{4^nXZ?_B}Y!}4;hL|`Wwnw?p8qjp^wxiS`Z8(W% ze_U458SQ|L%qoqZZ!)U>GH3Z<}rm!iAu)PJfu6%(D`ZS;c)h+(>7zq-s~-0TiS8^=Zq#g60fDwvpi)UWfH^ zk-&0}S@!2@#YsE()`jPgMQ-2rjQtJ5^3%|_Ch^?iMYS>zd>0rju3O#f6!sHHJ!^tBb zDZ7Q;qZ(Sillt1*f-02@<4O^;t9Am&{hY+1%H+{^ubidQN*j-*o#kUV$N5(&)pqV< z>m2PDzKKBfp8fGUMJXRfnKRBDv6{3k@yF}nrSUv)Zsns;E;LLu%ZHQS71R@}Q`~3B lyiSSy3ZJrriAr|rpzb`|H|fj2WbtYE^sH7-kL-^J_itHiY_0$R literal 0 HcmV?d00001 From 78007b2f22f62eaf5ba18e67258557f0a9244e1f Mon Sep 17 00:00:00 2001 From: mistachkin Date: Wed, 24 Feb 2016 23:25:23 +0000 Subject: [PATCH 04/66] Test build all supported configurations and platforms during VSIX testing. FossilOrigin-Name: cce40a0b8ee792482fb7031113eb190ad316d01a --- manifest | 15 ++++++------- manifest.uuid | 2 +- vsixtest/vsixtest.tcl | 50 ++++++++++++++++++++++++++++--------------- 3 files changed, 40 insertions(+), 27 deletions(-) diff --git a/manifest b/manifest index e9256df548..929cd10cb8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Initial\swork\son\san\sautomated\sVSIX\stesting\stool.\s\sNot\sworking\sor\stested\syet. -D 2016-02-24T21:42:03.852 +C Test\sbuild\sall\ssupported\sconfigurations\sand\splatforms\sduring\sVSIX\stesting. +D 2016-02-24T23:25:23.355 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 @@ -1446,14 +1446,11 @@ F vsixtest/Package.appxmanifest 0535b2e6708c44ad45ed7fb1dfd4de5de351dd7a F vsixtest/pch.cpp 681cc12ddc215c95fe300ee8a3dde057fa2ec308 F vsixtest/pch.h 9d2475a4f6d5c921b86c8f61060b6b04421f1010 F vsixtest/vsixtest.sln 8950e044dd04a07046990d04bf77e60738e2d136 -F vsixtest/vsixtest.tcl d452077319cd94e626e37a8ea323f4e739dbc5a6 +F vsixtest/vsixtest.tcl 0f16064663d4e8362381529a4f7f675f242b7b18 F vsixtest/vsixtest.vcxproj 15407f0e35e914fecc65ed422ac08b28e52b3e4f F vsixtest/vsixtest.vcxproj.filters 443739cb985bb81620dc66f375a845b25debe116 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P e721975faa0925be4029330550ff2a9666041ff7 -R 5235a7354869742aeac200c2498e03f2 -T *branch * vsixTest -T *sym-vsixTest * -T -sym-trunk * +P 496e4ac984b2548dd5f2f969cd34656b586cfcfe +R 5a3c0879fbd24c05458da7451d8d9c43 U mistachkin -Z 30aae13ef1f9c0b59510b9ed5eae30fc +Z bb333cc3788a57a462cd7d4a3c9c3a93 diff --git a/manifest.uuid b/manifest.uuid index 8ebfae5b16..a73309b7ad 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -496e4ac984b2548dd5f2f969cd34656b586cfcfe \ No newline at end of file +cce40a0b8ee792482fb7031113eb190ad316d01a \ No newline at end of file diff --git a/vsixtest/vsixtest.tcl b/vsixtest/vsixtest.tcl index 3c0a8dbf56..ae7b91bf2c 100644 --- a/vsixtest/vsixtest.tcl +++ b/vsixtest/vsixtest.tcl @@ -167,27 +167,30 @@ set installLogFileName [appendArgs \ [file rootname [file tail $fileName]] -install- [pid] .log] set buildLogFileName [appendArgs \ - [file rootname [file tail $fileName]] -build- [pid] .log] + [file rootname [file tail $fileName]] \ + -build-%configuration%-%platform%- [pid] .log] set uninstallLogFileName [appendArgs \ [file rootname [file tail $fileName]] -uninstall- [pid] .log] -set command(1) [list exec [file nativename $vsixInstaller] /quiet /norepair] -lappend command(1) [appendArgs /logFile: $installLogFileName] -lappend command(1) [file nativename $fileName] +set commands(1) [list exec [file nativename $vsixInstaller] /quiet /norepair] +lappend commands(1) [appendArgs /logFile: $installLogFileName] +lappend commands(1) [file nativename $fileName] -set command(2) [list exec [file nativename $msBuild]] -lappend command(2) [file nativename [file join $path vsixtest.sln]] -lappend command(2) /target:Rebuild /property:Configuration=Release +set commands(2) [list exec [file nativename $msBuild]] +lappend commands(2) [file nativename [file join $path vsixtest.sln]] +lappend commands(2) /target:Rebuild +lappend commands(2) /property:Configuration=%configuration% +lappend commands(2) /property:Platform=%clatform% -lappend command(2) [appendArgs \ +lappend commands(2) [appendArgs \ /logger:FileLogger,Microsoft.Build.Engine\;Logfile= \ [file nativename [file join $temporaryDirectory $buildLogFileName]] \ \;Verbosity=diagnostic] -set command(3) [list exec [file nativename $vsixInstaller] /quiet /norepair] -lappend command(3) [appendArgs /logFile: $uninstallLogFileName] -lappend command(3) [appendArgs /uninstall:SQLite.UWP.2015] +set commands(3) [list exec [file nativename $vsixInstaller] /quiet /norepair] +lappend commands(3) [appendArgs /logFile: $uninstallLogFileName] +lappend commands(3) [appendArgs /uninstall:SQLite.UWP.2015] puts stdout [appendArgs \ "Install log will be \"" [file nativename [file join \ @@ -202,14 +205,27 @@ puts stdout [appendArgs \ $temporaryDirectory $uninstallLogFileName]] "\"."] puts stdout [appendArgs \ - "First command is \"" $command(1) "\"."] + "First command is \"" $commands(1) "\"."] puts stdout [appendArgs \ - "Second command is \"" $command(2) "\"."] + "Second command is \"" $commands(2) "\"."] puts stdout [appendArgs \ - "Third command is \"" $command(3) "\"."] + "Third command is \"" $commands(3) "\"."] -# eval exec $command(1) -# eval exec $command(2) -# eval exec $command(3) +if {0} then { + # eval $commands(1) + + set platforms [list Win32 x64 ARM] + set configurations [list Debug Release] + + foreach platform $platforms { + foreach configuration $configurations { + eval [string map [list \ + %platform% $platform %configuration% \ + $configuration] $commands(2)] + } + } + + # eval $commands(3) +} From 5dad68d3c75014a1a9e9a38c1480f5f96524688e Mon Sep 17 00:00:00 2001 From: mistachkin Date: Wed, 24 Feb 2016 23:31:14 +0000 Subject: [PATCH 05/66] Fix typo. Improve interim debugging. FossilOrigin-Name: e0029bdf20df90abd8b81e5b08133866665b1c87 --- manifest | 12 ++++++------ manifest.uuid | 2 +- vsixtest/vsixtest.tcl | 12 +++++++++--- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 929cd10cb8..14d86ffce0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Test\sbuild\sall\ssupported\sconfigurations\sand\splatforms\sduring\sVSIX\stesting. -D 2016-02-24T23:25:23.355 +C Fix\stypo.\s\sImprove\sinterim\sdebugging. +D 2016-02-24T23:31:14.464 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 @@ -1446,11 +1446,11 @@ F vsixtest/Package.appxmanifest 0535b2e6708c44ad45ed7fb1dfd4de5de351dd7a F vsixtest/pch.cpp 681cc12ddc215c95fe300ee8a3dde057fa2ec308 F vsixtest/pch.h 9d2475a4f6d5c921b86c8f61060b6b04421f1010 F vsixtest/vsixtest.sln 8950e044dd04a07046990d04bf77e60738e2d136 -F vsixtest/vsixtest.tcl 0f16064663d4e8362381529a4f7f675f242b7b18 +F vsixtest/vsixtest.tcl e1f20568f5551ae58f395af6440a3f3b65368682 F vsixtest/vsixtest.vcxproj 15407f0e35e914fecc65ed422ac08b28e52b3e4f F vsixtest/vsixtest.vcxproj.filters 443739cb985bb81620dc66f375a845b25debe116 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 496e4ac984b2548dd5f2f969cd34656b586cfcfe -R 5a3c0879fbd24c05458da7451d8d9c43 +P cce40a0b8ee792482fb7031113eb190ad316d01a +R 599ba9dab9a4637ded30c8413d19596a U mistachkin -Z bb333cc3788a57a462cd7d4a3c9c3a93 +Z a097fb629010575b51e2f4b031c45e27 diff --git a/manifest.uuid b/manifest.uuid index a73309b7ad..32d31d334d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cce40a0b8ee792482fb7031113eb190ad316d01a \ No newline at end of file +e0029bdf20df90abd8b81e5b08133866665b1c87 \ No newline at end of file diff --git a/vsixtest/vsixtest.tcl b/vsixtest/vsixtest.tcl index ae7b91bf2c..47357c155b 100644 --- a/vsixtest/vsixtest.tcl +++ b/vsixtest/vsixtest.tcl @@ -181,7 +181,7 @@ set commands(2) [list exec [file nativename $msBuild]] lappend commands(2) [file nativename [file join $path vsixtest.sln]] lappend commands(2) /target:Rebuild lappend commands(2) /property:Configuration=%configuration% -lappend commands(2) /property:Platform=%clatform% +lappend commands(2) /property:Platform=%platform% lappend commands(2) [appendArgs \ /logger:FileLogger,Microsoft.Build.Engine\;Logfile= \ @@ -213,7 +213,7 @@ puts stdout [appendArgs \ puts stdout [appendArgs \ "Third command is \"" $commands(3) "\"."] -if {0} then { +if {1} then { # eval $commands(1) set platforms [list Win32 x64 ARM] @@ -221,9 +221,15 @@ if {0} then { foreach platform $platforms { foreach configuration $configurations { - eval [string map [list \ + puts stdout [string map [list \ %platform% $platform %configuration% \ $configuration] $commands(2)] + + if {0} then { + eval [string map [list \ + %platform% $platform %configuration% \ + $configuration] $commands(2)] + } } } From c32db469f4fc67e2decbc200af3598093093c9ec Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 25 Feb 2016 02:49:58 +0000 Subject: [PATCH 06/66] More work. Install and build steps are now tested. FossilOrigin-Name: 0ab74373bd37d48d6afa7aecb67885afcd3a85b1 --- manifest | 36 +- manifest.uuid | 2 +- vsixtest/App.xaml | 16 +- vsixtest/App.xaml.cpp | 238 +++++----- vsixtest/App.xaml.h | 54 +-- vsixtest/MainPage.xaml | 26 +- vsixtest/MainPage.xaml.cpp | 80 ++-- vsixtest/MainPage.xaml.h | 43 +- vsixtest/Package.appxmanifest | 96 ++-- vsixtest/pch.cpp | 12 +- vsixtest/pch.h | 22 +- vsixtest/vsixtest.sln | 79 ++-- vsixtest/vsixtest.tcl | 126 ++++-- ...vsixtest.vcxproj => vsixtest.vcxproj.data} | 411 +++++++++--------- vsixtest/vsixtest.vcxproj.filters | 81 +++- 15 files changed, 705 insertions(+), 617 deletions(-) rename vsixtest/{vsixtest.vcxproj => vsixtest.vcxproj.data} (67%) diff --git a/manifest b/manifest index 14d86ffce0..0207e92d3e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\stypo.\s\sImprove\sinterim\sdebugging. -D 2016-02-24T23:31:14.464 +C More\swork.\s\sInstall\sand\sbuild\ssteps\sare\snow\stested. +D 2016-02-25T02:49:58.520 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 @@ -1429,9 +1429,9 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh a98af506df552f3b3c0d904f94e4cdc4e1a6d598 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -F vsixtest/App.xaml 7af5a2a527aa5783e208c436c5227a21b1023cec -F vsixtest/App.xaml.cpp c4aaab1774e771d2b6f662cbd247fd31df087a22 -F vsixtest/App.xaml.h f723ae437a141cd496adfccae517a6011dd95dfb +F vsixtest/App.xaml b76d3b48860e7454775c47ea38ffea9c4abe3e85 +F vsixtest/App.xaml.cpp c465147f50871165c60ca16955219f6c5812d6d8 +F vsixtest/App.xaml.h 4a9768e2983d05600ad1e1c2f1b00a132967da9f F vsixtest/Assets/LockScreenLogo.scale-200.png e820c9a3deb909197081b0bf3216c06e13905f0a F vsixtest/Assets/SplashScreen.scale-200.png cab70988ca71bebec7bfeb3b6dbafe17b9ab0b4a F vsixtest/Assets/Square150x150Logo.scale-200.png e17b40817db7a239fc239d83efcc951fb824e3ff @@ -1439,18 +1439,18 @@ F vsixtest/Assets/Square44x44Logo.scale-200.png 2f166237094dea94d952d10b9eeae818 F vsixtest/Assets/Square44x44Logo.targetsize-24_altform-unplated.png 5f6a6d391b95a3061ccca6e6fdd6955ede63b4ed F vsixtest/Assets/StoreLogo.png 0828b7257db74a4ecd5eeb6b7b4971f0fdc4d9d1 F vsixtest/Assets/Wide310x150Logo.scale-200.png 04ddefe5bc5f43ae12a7433f6f236ddab101ac42 -F vsixtest/MainPage.xaml b17ae614fc9aab5ee0068e16c9a3e3461d13b6d1 -F vsixtest/MainPage.xaml.cpp 66f81d6149d9a09de5c6c7846c6557cdd7a76b15 -F vsixtest/MainPage.xaml.h 5b8d65dc2b9e59e29bc0a6bca81211ff27ac830a -F vsixtest/Package.appxmanifest 0535b2e6708c44ad45ed7fb1dfd4de5de351dd7a -F vsixtest/pch.cpp 681cc12ddc215c95fe300ee8a3dde057fa2ec308 -F vsixtest/pch.h 9d2475a4f6d5c921b86c8f61060b6b04421f1010 -F vsixtest/vsixtest.sln 8950e044dd04a07046990d04bf77e60738e2d136 -F vsixtest/vsixtest.tcl e1f20568f5551ae58f395af6440a3f3b65368682 -F vsixtest/vsixtest.vcxproj 15407f0e35e914fecc65ed422ac08b28e52b3e4f -F vsixtest/vsixtest.vcxproj.filters 443739cb985bb81620dc66f375a845b25debe116 +F vsixtest/MainPage.xaml 34f49897e3ca533a7e74506ba0759b66eebce151 +F vsixtest/MainPage.xaml.cpp 7f31fc6de751b64676c0924c97a5485d950a91d7 +F vsixtest/MainPage.xaml.h cc05cca10d50a003f6c6e4448b701cdd07f52f29 +F vsixtest/Package.appxmanifest 6b6db1eb7df3a315c5d681059754d5f0e0c47a93 +F vsixtest/pch.cpp cb823cfac36f1a39a7eb0acbd7e9a0b0de8f23af +F vsixtest/pch.h 9cab7980f2ac4baa40807d8b5e52af32a21cf78c +F vsixtest/vsixtest.sln 77cadbe4e96c1fe1bf51cd77de9e9b0a12ada547 +F vsixtest/vsixtest.tcl 63aff906d5b2635ade235599a45fcc95a7e296bc +F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc w vsixtest/vsixtest.vcxproj +F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P cce40a0b8ee792482fb7031113eb190ad316d01a -R 599ba9dab9a4637ded30c8413d19596a +P e0029bdf20df90abd8b81e5b08133866665b1c87 +R fd73554594351ac51b867a9ca61df57d U mistachkin -Z a097fb629010575b51e2f4b031c45e27 +Z 85ba38141fc589bcd3be4f139cce818c diff --git a/manifest.uuid b/manifest.uuid index 32d31d334d..6408a12e3d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e0029bdf20df90abd8b81e5b08133866665b1c87 \ No newline at end of file +0ab74373bd37d48d6afa7aecb67885afcd3a85b1 \ No newline at end of file diff --git a/vsixtest/App.xaml b/vsixtest/App.xaml index 7f023fe5d7..80889024ca 100644 --- a/vsixtest/App.xaml +++ b/vsixtest/App.xaml @@ -1,8 +1,8 @@ - - - + + + diff --git a/vsixtest/App.xaml.cpp b/vsixtest/App.xaml.cpp index 5d60058f6b..da8f327fa0 100644 --- a/vsixtest/App.xaml.cpp +++ b/vsixtest/App.xaml.cpp @@ -1,120 +1,120 @@ -// -// App.xaml.cpp -// Implementation of the App class. -// - -#include "pch.h" -#include "MainPage.xaml.h" - -using namespace vsixtest; - -using namespace Platform; -using namespace Windows::ApplicationModel; -using namespace Windows::ApplicationModel::Activation; -using namespace Windows::Foundation; -using namespace Windows::Foundation::Collections; -using namespace Windows::UI::Xaml; -using namespace Windows::UI::Xaml::Controls; -using namespace Windows::UI::Xaml::Controls::Primitives; -using namespace Windows::UI::Xaml::Data; -using namespace Windows::UI::Xaml::Input; -using namespace Windows::UI::Xaml::Interop; -using namespace Windows::UI::Xaml::Media; -using namespace Windows::UI::Xaml::Navigation; - -/// -/// Initializes the singleton application object. This is the first line of authored code -/// executed, and as such is the logical equivalent of main() or WinMain(). -/// -App::App() -{ - InitializeComponent(); - Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending); -} - -/// -/// Invoked when the application is launched normally by the end user. Other entry points -/// will be used such as when the application is launched to open a specific file. -/// -/// Details about the launch request and process. -void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) -{ - -#if _DEBUG - // Show graphics profiling information while debugging. - if (IsDebuggerPresent()) - { - // Display the current frame rate counters - DebugSettings->EnableFrameRateCounter = true; - } -#endif - - auto rootFrame = dynamic_cast(Window::Current->Content); - - // Do not repeat app initialization when the Window already has content, - // just ensure that the window is active - if (rootFrame == nullptr) - { - // Create a Frame to act as the navigation context and associate it with - // a SuspensionManager key - rootFrame = ref new Frame(); - - rootFrame->NavigationFailed += ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler(this, &App::OnNavigationFailed); - - if (e->PreviousExecutionState == ApplicationExecutionState::Terminated) - { - // TODO: Restore the saved session state only when appropriate, scheduling the - // final launch steps after the restore is complete - - } - - if (rootFrame->Content == nullptr) - { - // When the navigation stack isn't restored navigate to the first page, - // configuring the new page by passing required information as a navigation - // parameter - rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); - } - // Place the frame in the current Window - Window::Current->Content = rootFrame; - // Ensure the current window is active - Window::Current->Activate(); - } - else - { - if (rootFrame->Content == nullptr) - { - // When the navigation stack isn't restored navigate to the first page, - // configuring the new page by passing required information as a navigation - // parameter - rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); - } - // Ensure the current window is active - Window::Current->Activate(); - } -} - -/// -/// Invoked when application execution is being suspended. Application state is saved -/// without knowing whether the application will be terminated or resumed with the contents -/// of memory still intact. -/// -/// The source of the suspend request. -/// Details about the suspend request. -void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e) -{ - (void) sender; // Unused parameter - (void) e; // Unused parameter - - //TODO: Save application state and stop any background activity -} - -/// -/// Invoked when Navigation to a certain page fails -/// -/// The Frame which failed navigation -/// Details about the navigation failure -void App::OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e) -{ - throw ref new FailureException("Failed to load Page " + e->SourcePageType.Name); +// +// App.xaml.cpp +// Implementation of the App class. +// + +#include "pch.h" +#include "MainPage.xaml.h" + +using namespace vsixtest; + +using namespace Platform; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::UI::Xaml::Controls::Primitives; +using namespace Windows::UI::Xaml::Data; +using namespace Windows::UI::Xaml::Input; +using namespace Windows::UI::Xaml::Interop; +using namespace Windows::UI::Xaml::Media; +using namespace Windows::UI::Xaml::Navigation; + +/// +/// Initializes the singleton application object. This is the first line of authored code +/// executed, and as such is the logical equivalent of main() or WinMain(). +/// +App::App() +{ + InitializeComponent(); + Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending); +} + +/// +/// Invoked when the application is launched normally by the end user. Other entry points +/// will be used such as when the application is launched to open a specific file. +/// +/// Details about the launch request and process. +void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) +{ + +#if _DEBUG + // Show graphics profiling information while debugging. + if (IsDebuggerPresent()) + { + // Display the current frame rate counters + DebugSettings->EnableFrameRateCounter = true; + } +#endif + + auto rootFrame = dynamic_cast(Window::Current->Content); + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (rootFrame == nullptr) + { + // Create a Frame to act as the navigation context and associate it with + // a SuspensionManager key + rootFrame = ref new Frame(); + + rootFrame->NavigationFailed += ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler(this, &App::OnNavigationFailed); + + if (e->PreviousExecutionState == ApplicationExecutionState::Terminated) + { + // TODO: Restore the saved session state only when appropriate, scheduling the + // final launch steps after the restore is complete + + } + + if (rootFrame->Content == nullptr) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); + } + // Place the frame in the current Window + Window::Current->Content = rootFrame; + // Ensure the current window is active + Window::Current->Activate(); + } + else + { + if (rootFrame->Content == nullptr) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); + } + // Ensure the current window is active + Window::Current->Activate(); + } +} + +/// +/// Invoked when application execution is being suspended. Application state is saved +/// without knowing whether the application will be terminated or resumed with the contents +/// of memory still intact. +/// +/// The source of the suspend request. +/// Details about the suspend request. +void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e) +{ + (void) sender; // Unused parameter + (void) e; // Unused parameter + + //TODO: Save application state and stop any background activity +} + +/// +/// Invoked when Navigation to a certain page fails +/// +/// The Frame which failed navigation +/// Details about the navigation failure +void App::OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e) +{ + throw ref new FailureException("Failed to load Page " + e->SourcePageType.Name); } \ No newline at end of file diff --git a/vsixtest/App.xaml.h b/vsixtest/App.xaml.h index 7322d11b9c..5fa8837d38 100644 --- a/vsixtest/App.xaml.h +++ b/vsixtest/App.xaml.h @@ -1,27 +1,27 @@ -// -// App.xaml.h -// Declaration of the App class. -// - -#pragma once - -#include "App.g.h" - -namespace vsixtest -{ - /// - /// Provides application-specific behavior to supplement the default Application class. - /// - ref class App sealed - { - protected: - virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override; - - internal: - App(); - - private: - void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e); - void OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e); - }; -} +// +// App.xaml.h +// Declaration of the App class. +// + +#pragma once + +#include "App.g.h" + +namespace vsixtest +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + ref class App sealed + { + protected: + virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override; + + internal: + App(); + + private: + void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e); + void OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e); + }; +} diff --git a/vsixtest/MainPage.xaml b/vsixtest/MainPage.xaml index 76724544e1..7472ad8626 100644 --- a/vsixtest/MainPage.xaml +++ b/vsixtest/MainPage.xaml @@ -1,13 +1,13 @@ - - - - - - + + + + + + diff --git a/vsixtest/MainPage.xaml.cpp b/vsixtest/MainPage.xaml.cpp index f615f4d89e..e67dcb83b2 100644 --- a/vsixtest/MainPage.xaml.cpp +++ b/vsixtest/MainPage.xaml.cpp @@ -1,27 +1,53 @@ -// -// MainPage.xaml.cpp -// Implementation of the MainPage class. -// - -#include "pch.h" -#include "MainPage.xaml.h" - -using namespace vsixtest; - -using namespace Platform; -using namespace Windows::Foundation; -using namespace Windows::Foundation::Collections; -using namespace Windows::UI::Xaml; -using namespace Windows::UI::Xaml::Controls; -using namespace Windows::UI::Xaml::Controls::Primitives; -using namespace Windows::UI::Xaml::Data; -using namespace Windows::UI::Xaml::Input; -using namespace Windows::UI::Xaml::Media; -using namespace Windows::UI::Xaml::Navigation; - -// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 - -MainPage::MainPage() -{ - InitializeComponent(); -} +// +// MainPage.xaml.cpp +// Implementation of the MainPage class. +// + +#include "pch.h" +#include "MainPage.xaml.h" +#include "sqlite3.h" + +using namespace vsixtest; + +using namespace Platform; +using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::UI::Xaml::Controls::Primitives; +using namespace Windows::UI::Xaml::Data; +using namespace Windows::UI::Xaml::Input; +using namespace Windows::UI::Xaml::Media; +using namespace Windows::UI::Xaml::Navigation; + +// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 + +MainPage::MainPage() +{ + InitializeComponent(); + UseSQLite(); +} + +void MainPage::UseSQLite(void) +{ + int rc = SQLITE_OK; + sqlite3 *pDb = nullptr; + + rc = sqlite3_open_v2("test.db", &pDb, + SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr); + + if (rc != SQLITE_OK) + throw ref new FailureException("Failed to open database."); + + rc = sqlite3_exec(pDb, "VACUUM;", nullptr, nullptr, nullptr); + + if (rc != SQLITE_OK) + throw ref new FailureException("Failed to vacuum database."); + + rc = sqlite3_close(pDb); + + if (rc != SQLITE_OK) + throw ref new FailureException("Failed to close database."); + + pDb = nullptr; +} diff --git a/vsixtest/MainPage.xaml.h b/vsixtest/MainPage.xaml.h index cf95007d17..ea327a3e4c 100644 --- a/vsixtest/MainPage.xaml.h +++ b/vsixtest/MainPage.xaml.h @@ -1,21 +1,22 @@ -// -// MainPage.xaml.h -// Declaration of the MainPage class. -// - -#pragma once - -#include "MainPage.g.h" - -namespace vsixtest -{ - /// - /// An empty page that can be used on its own or navigated to within a Frame. - /// - public ref class MainPage sealed - { - public: - MainPage(); - - }; -} +// +// MainPage.xaml.h +// Declaration of the MainPage class. +// + +#pragma once + +#include "MainPage.g.h" + +namespace vsixtest +{ + /// + /// An empty page that can be used on its own or navigated to within a Frame. + /// + public ref class MainPage sealed + { + public: + MainPage(); + void UseSQLite(void); + + }; +} diff --git a/vsixtest/Package.appxmanifest b/vsixtest/Package.appxmanifest index 49e45cbc3e..106b3f1e41 100644 --- a/vsixtest/Package.appxmanifest +++ b/vsixtest/Package.appxmanifest @@ -1,49 +1,49 @@ - - - - - - - - - - vsixtest - mistachkin - Assets\StoreLogo.png - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + vsixtest + mistachkin + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vsixtest/pch.cpp b/vsixtest/pch.cpp index ef288d82ad..97b544ec11 100644 --- a/vsixtest/pch.cpp +++ b/vsixtest/pch.cpp @@ -1,6 +1,6 @@ -// -// pch.cpp -// Include the standard header and generate the precompiled header. -// - -#include "pch.h" +// +// pch.cpp +// Include the standard header and generate the precompiled header. +// + +#include "pch.h" diff --git a/vsixtest/pch.h b/vsixtest/pch.h index e5006e81d3..b793236d02 100644 --- a/vsixtest/pch.h +++ b/vsixtest/pch.h @@ -1,11 +1,11 @@ -// -// pch.h -// Header for standard system include files. -// - -#pragma once - -#include -#include - -#include "App.xaml.h" +// +// pch.h +// Header for standard system include files. +// + +#pragma once + +#include +#include + +#include "App.xaml.h" diff --git a/vsixtest/vsixtest.sln b/vsixtest/vsixtest.sln index bebec6355b..1ab6e064f9 100644 --- a/vsixtest/vsixtest.sln +++ b/vsixtest/vsixtest.sln @@ -1,40 +1,39 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vsixtest", "vsixtest.vcxproj", "{60BB14A5-0871-4656-BC38-4F0958230F9A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM = Debug|ARM - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|ARM = Release|ARM - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|ARM.ActiveCfg = Debug|ARM - {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|ARM.Build.0 = Debug|ARM - {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|ARM.Deploy.0 = Debug|ARM - {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x64.ActiveCfg = Debug|x64 - {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x64.Build.0 = Debug|x64 - {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x64.Deploy.0 = Debug|x64 - {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x86.ActiveCfg = Debug|Win32 - {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x86.Build.0 = Debug|Win32 - {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x86.Deploy.0 = Debug|Win32 - {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|ARM.ActiveCfg = Release|ARM - {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|ARM.Build.0 = Release|ARM - {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|ARM.Deploy.0 = Release|ARM - {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x64.ActiveCfg = Release|x64 - {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x64.Build.0 = Release|x64 - {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x64.Deploy.0 = Release|x64 - {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x86.ActiveCfg = Release|Win32 - {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x86.Build.0 = Release|Win32 - {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x86.Deploy.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vsixtest", "vsixtest.vcxproj", "{60BB14A5-0871-4656-BC38-4F0958230F9A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|ARM.ActiveCfg = Debug|ARM + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|ARM.Build.0 = Debug|ARM + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|ARM.Deploy.0 = Debug|ARM + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x64.ActiveCfg = Debug|x64 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x64.Build.0 = Debug|x64 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x64.Deploy.0 = Debug|x64 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x86.ActiveCfg = Debug|Win32 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x86.Build.0 = Debug|Win32 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x86.Deploy.0 = Debug|Win32 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|ARM.ActiveCfg = Release|ARM + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|ARM.Build.0 = Release|ARM + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|ARM.Deploy.0 = Release|ARM + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x64.ActiveCfg = Release|x64 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x64.Build.0 = Release|x64 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x64.Deploy.0 = Release|x64 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x86.ActiveCfg = Release|Win32 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x86.Build.0 = Release|Win32 + {60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x86.Deploy.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/vsixtest/vsixtest.tcl b/vsixtest/vsixtest.tcl index 47357c155b..d25c51d9b6 100644 --- a/vsixtest/vsixtest.tcl +++ b/vsixtest/vsixtest.tcl @@ -13,10 +13,14 @@ # file. However, currently, the file must be compatible with both Visual # Studio 2015 and the Universal Windows Platform. # -# 3. The temporary directory specified in the TEMP or TMP environment variables +# 3. The "VERSION" file is assumed to exist in the parent directory of the +# directory containing this script. It must contain a version number that +# matches the VSIX file being tested. +# +# 4. The temporary directory specified in the TEMP or TMP environment variables # must refer to an existing directory writable by the current user. # -# 4. The VS140COMNTOOLS environment variable must refer to the Visual Studio +# 5. The VS140COMNTOOLS environment variable must refer to the Visual Studio # 2015 common tools directory. # # USAGE @@ -80,6 +84,35 @@ proc appendArgs { args } { eval append result $args } +proc readFile { fileName } { + # + # NOTE: Reads and returns the entire contents of the specified file, which + # may contain binary data. + # + set file_id [open $fileName RDONLY] + fconfigure $file_id -encoding binary -translation binary + set result [read $file_id] + close $file_id + return $result +} + +proc writeFile { fileName data } { + # + # NOTE: Writes the entire contents of the specified file, which may contain + # binary data. + # + set file_id [open $fileName {WRONLY CREAT TRUNC}] + fconfigure $file_id -encoding binary -translation binary + puts -nonewline $file_id $data + close $file_id + return "" +} + +proc putsAndEval { command } { + catch {puts stdout $command} + return [uplevel 1 $command] +} + # # NOTE: This is the entry point for this script. # @@ -100,17 +133,32 @@ set argc [llength $argv] if {$argc > 1} then {fail} if {$argc == 1} then { - set fileName [lindex $argv 0] + set vsixFileName [lindex $argv 0] } else { - set fileName [file join [file dirname $path] sqlite-UWP-output.vsix] + set vsixFileName [file join [file dirname $path] sqlite-UWP-output.vsix] } -if {[string length $fileName] == 0} then { +if {[string length $vsixFileName] == 0} then { fail "invalid VSIX file name" } -if {![file exists $fileName] || ![file isfile $fileName]} then { - fail [appendArgs "VSIX file \"" $fileName "\" does not exist"] +if {![file exists $vsixFileName] || ![file isfile $vsixFileName]} then { + fail [appendArgs "VSIX file \"" $vsixFileName "\" does not exist"] +} + +set versionFileName [file join [file dirname $path] VERSION] + +if {![file exists $versionFileName] || ![file isfile $versionFileName]} then { + fail [appendArgs "Version file \"" $versionFileName "\" does not exist"] +} + +set projectTemplateFileName [file join $path vsixtest.vcxproj.data] +set projectFileName [file join $path vsixtest.vcxproj] + +if {![file exists $projectTemplateFileName] || \ + ![file isfile $projectTemplateFileName]} then { + fail [appendArgs \ + "Project template file \"" $projectTemplateFileName "\" does not exist"] } set envVarName VS140COMNTOOLS @@ -164,18 +212,18 @@ if {[string length $temporaryDirectory] == 0 || \ } set installLogFileName [appendArgs \ - [file rootname [file tail $fileName]] -install- [pid] .log] + [file rootname [file tail $vsixFileName]] -install- [pid] .log] set buildLogFileName [appendArgs \ - [file rootname [file tail $fileName]] \ + [file rootname [file tail $vsixFileName]] \ -build-%configuration%-%platform%- [pid] .log] set uninstallLogFileName [appendArgs \ - [file rootname [file tail $fileName]] -uninstall- [pid] .log] + [file rootname [file tail $vsixFileName]] -uninstall- [pid] .log] set commands(1) [list exec [file nativename $vsixInstaller] /quiet /norepair] lappend commands(1) [appendArgs /logFile: $installLogFileName] -lappend commands(1) [file nativename $fileName] +lappend commands(1) [file nativename $vsixFileName] set commands(2) [list exec [file nativename $msBuild]] lappend commands(2) [file nativename [file join $path vsixtest.sln]] @@ -192,46 +240,42 @@ set commands(3) [list exec [file nativename $vsixInstaller] /quiet /norepair] lappend commands(3) [appendArgs /logFile: $uninstallLogFileName] lappend commands(3) [appendArgs /uninstall:SQLite.UWP.2015] -puts stdout [appendArgs \ - "Install log will be \"" [file nativename [file join \ - $temporaryDirectory $installLogFileName]] "\"."] - -puts stdout [appendArgs \ - "Build log will be \"" [file nativename [file join \ - $temporaryDirectory $buildLogFileName]] "\"."] - -puts stdout [appendArgs \ - "Uninstall log will be \"" [file nativename [file join \ - $temporaryDirectory $uninstallLogFileName]] "\"."] - -puts stdout [appendArgs \ - "First command is \"" $commands(1) "\"."] - -puts stdout [appendArgs \ - "Second command is \"" $commands(2) "\"."] - -puts stdout [appendArgs \ - "Third command is \"" $commands(3) "\"."] +############################################################################### if {1} then { - # eval $commands(1) + puts stdout [appendArgs \ + "Install log will be \"" [file nativename [file join \ + $temporaryDirectory $installLogFileName]] "\"."] - set platforms [list Win32 x64 ARM] + puts stdout [appendArgs \ + "Build log will be \"" [file nativename [file join \ + $temporaryDirectory $buildLogFileName]] "\"."] + + puts stdout [appendArgs \ + "Uninstall log will be \"" [file nativename [file join \ + $temporaryDirectory $uninstallLogFileName]] "\"."] +} + +############################################################################### + +if {1} then { + # putsAndEval $commands(1) + + set versionNumber [string trim [readFile $versionFileName]] + set data [readFile $projectTemplateFileName] + set data [string map [list %versionNumber% $versionNumber] $data] + writeFile $projectFileName $data + + set platforms [list x86 x64 ARM] set configurations [list Debug Release] foreach platform $platforms { foreach configuration $configurations { - puts stdout [string map [list \ + putsAndEval [string map [list \ %platform% $platform %configuration% \ $configuration] $commands(2)] - - if {0} then { - eval [string map [list \ - %platform% $platform %configuration% \ - $configuration] $commands(2)] - } } } - # eval $commands(3) + # putsAndEval $commands(3) } diff --git a/vsixtest/vsixtest.vcxproj b/vsixtest/vsixtest.vcxproj.data similarity index 67% rename from vsixtest/vsixtest.vcxproj rename to vsixtest/vsixtest.vcxproj.data index a7b4fd302b..a64584c3a2 100644 --- a/vsixtest/vsixtest.vcxproj +++ b/vsixtest/vsixtest.vcxproj.data @@ -1,213 +1,198 @@ - - - - {60bb14a5-0871-4656-bc38-4f0958230f9a} - vsixtest - en-US - 14.0 - true - Windows Store - 10.0.10586.0 - 10.0.10586.0 - 10.0 - - - - - Debug - ARM - - - Debug - Win32 - - - Debug - x64 - - - Release - ARM - - - Release - Win32 - - - Release - x64 - - - - Application - true - v140 - - - Application - true - v140 - - - Application - true - v140 - - - Application - false - true - v140 - true - - - Application - false - true - v140 - true - - - Application - false - true - v140 - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - vsixtest_TemporaryKey.pfx - - - - - - /bigobj %(AdditionalOptions) - 4453;28204 - - - - - /bigobj %(AdditionalOptions) - 4453;28204 - - - - - /bigobj %(AdditionalOptions) - 4453;28204 - - - - - /bigobj %(AdditionalOptions) - 4453;28204 - - - - - /bigobj %(AdditionalOptions) - 4453;28204 - - - - - /bigobj %(AdditionalOptions) - 4453;28204 - - - - - - - App.xaml - - - MainPage.xaml - - - - - - Designer - - - Designer - - - - - - Designer - - - - - - - - - - - - - - - - - - - App.xaml - - - MainPage.xaml - - - - Create - Create - Create - Create - Create - Create - - - - - - - - - + + + + {60bb14a5-0871-4656-bc38-4f0958230f9a} + vsixtest + en-US + 14.0 + true + Windows Store + 10.0.10586.0 + 10.0.10586.0 + 10.0 + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + Application + true + v140 + + + Application + true + v140 + + + Application + true + v140 + + + Application + false + true + v140 + true + + + Application + false + true + v140 + true + + + Application + false + true + v140 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + vsixtest_TemporaryKey.pfx + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + + App.xaml + + + MainPage.xaml + + + + + Designer + + + Designer + + + + + Designer + + + + + + + + + + + + + + + App.xaml + + + MainPage.xaml + + + Create + Create + Create + Create + Create + Create + + + + + + + + + \ No newline at end of file diff --git a/vsixtest/vsixtest.vcxproj.filters b/vsixtest/vsixtest.vcxproj.filters index a4a1a305a8..ac1dfca421 100644 --- a/vsixtest/vsixtest.vcxproj.filters +++ b/vsixtest/vsixtest.vcxproj.filters @@ -1,24 +1,57 @@ - - - - - 60bb14a5-0871-4656-bc38-4f0958230f9a - - - e6271362-8f96-476d-907f-4da227b02435 - bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png - - - Assets - - - Assets - - - Assets - - - Assets - - - + + + + + 60bb14a5-0871-4656-bc38-4f0958230f9a + + + e6271362-8f96-476d-907f-4da227b02435 + bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + + + + + + + + + + + + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + + + + + + + \ No newline at end of file From 6ae4d84fdfbe4168ec6e15e4995d78dc31d2f90a Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 25 Feb 2016 02:56:53 +0000 Subject: [PATCH 07/66] Enable all steps and add/update comments. FossilOrigin-Name: 788f99f47f40be42f30d3f324983f39e84d8cfbb --- manifest | 14 +++++++------- manifest.uuid | 2 +- vsixtest/vsixtest.tcl | 16 +++++++++------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index 0207e92d3e..dd58c45981 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C More\swork.\s\sInstall\sand\sbuild\ssteps\sare\snow\stested. -D 2016-02-25T02:49:58.520 +C Enable\sall\ssteps\sand\sadd/update\scomments. +D 2016-02-25T02:56:53.408 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 @@ -1446,11 +1446,11 @@ F vsixtest/Package.appxmanifest 6b6db1eb7df3a315c5d681059754d5f0e0c47a93 F vsixtest/pch.cpp cb823cfac36f1a39a7eb0acbd7e9a0b0de8f23af F vsixtest/pch.h 9cab7980f2ac4baa40807d8b5e52af32a21cf78c F vsixtest/vsixtest.sln 77cadbe4e96c1fe1bf51cd77de9e9b0a12ada547 -F vsixtest/vsixtest.tcl 63aff906d5b2635ade235599a45fcc95a7e296bc -F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc w vsixtest/vsixtest.vcxproj +F vsixtest/vsixtest.tcl b80b4e1f007448d382e4a0d4f3751dba0fc47ba9 +F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P e0029bdf20df90abd8b81e5b08133866665b1c87 -R fd73554594351ac51b867a9ca61df57d +P 0ab74373bd37d48d6afa7aecb67885afcd3a85b1 +R ba41dee91dbb0324b1abb0791f91a36f U mistachkin -Z 85ba38141fc589bcd3be4f139cce818c +Z c3b39230971278db58f1c6301bccf9b2 diff --git a/manifest.uuid b/manifest.uuid index 6408a12e3d..c103aecccb 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0ab74373bd37d48d6afa7aecb67885afcd3a85b1 \ No newline at end of file +788f99f47f40be42f30d3f324983f39e84d8cfbb \ No newline at end of file diff --git a/vsixtest/vsixtest.tcl b/vsixtest/vsixtest.tcl index d25c51d9b6..7c30e579cf 100644 --- a/vsixtest/vsixtest.tcl +++ b/vsixtest/vsixtest.tcl @@ -5,22 +5,24 @@ # # PREREQUISITES # -# 1. Tcl 8.4 and later are supported, earlier versions have not been tested. +# 1. This tool must be executed with "elevated administrator" privileges. # -# 2. The "sqlite-UWP-output.vsix" file is assumed to exist in the parent +# 2. Tcl 8.4 and later are supported, earlier versions have not been tested. +# +# 3. The "sqlite-UWP-output.vsix" file is assumed to exist in the parent # directory of the directory containing this script. The [optional] first # command line argument to this script may be used to specify an alternate # file. However, currently, the file must be compatible with both Visual # Studio 2015 and the Universal Windows Platform. # -# 3. The "VERSION" file is assumed to exist in the parent directory of the +# 4. The "VERSION" file is assumed to exist in the parent directory of the # directory containing this script. It must contain a version number that # matches the VSIX file being tested. # -# 4. The temporary directory specified in the TEMP or TMP environment variables +# 5. The temporary directory specified in the TEMP or TMP environment variables # must refer to an existing directory writable by the current user. # -# 5. The VS140COMNTOOLS environment variable must refer to the Visual Studio +# 6. The VS140COMNTOOLS environment variable must refer to the Visual Studio # 2015 common tools directory. # # USAGE @@ -259,7 +261,7 @@ if {1} then { ############################################################################### if {1} then { - # putsAndEval $commands(1) + putsAndEval $commands(1) set versionNumber [string trim [readFile $versionFileName]] set data [readFile $projectTemplateFileName] @@ -277,5 +279,5 @@ if {1} then { } } - # putsAndEval $commands(3) + putsAndEval $commands(3) } From 77b7e2afb1ced6604a561826366908afe695d076 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 25 Feb 2016 08:02:16 +0000 Subject: [PATCH 08/66] Improve readability and logging of the vsixtest script. FossilOrigin-Name: 4fe7c4e90b7adbb1630b4aa15709968a1fcc7d83 --- manifest | 12 +-- manifest.uuid | 2 +- vsixtest/vsixtest.tcl | 176 ++++++++++++++++++++++++++---------------- 3 files changed, 116 insertions(+), 74 deletions(-) diff --git a/manifest b/manifest index dd58c45981..d0f724c2b1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enable\sall\ssteps\sand\sadd/update\scomments. -D 2016-02-25T02:56:53.408 +C Improve\sreadability\sand\slogging\sof\sthe\svsixtest\sscript. +D 2016-02-25T08:02:16.943 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 @@ -1446,11 +1446,11 @@ F vsixtest/Package.appxmanifest 6b6db1eb7df3a315c5d681059754d5f0e0c47a93 F vsixtest/pch.cpp cb823cfac36f1a39a7eb0acbd7e9a0b0de8f23af F vsixtest/pch.h 9cab7980f2ac4baa40807d8b5e52af32a21cf78c F vsixtest/vsixtest.sln 77cadbe4e96c1fe1bf51cd77de9e9b0a12ada547 -F vsixtest/vsixtest.tcl b80b4e1f007448d382e4a0d4f3751dba0fc47ba9 +F vsixtest/vsixtest.tcl 41268d1a0937c517f3c2e3f6538c90da70d155f8 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 0ab74373bd37d48d6afa7aecb67885afcd3a85b1 -R ba41dee91dbb0324b1abb0791f91a36f +P 788f99f47f40be42f30d3f324983f39e84d8cfbb +R 27bc664c4897fa05fbab9ef38c37f4b7 U mistachkin -Z c3b39230971278db58f1c6301bccf9b2 +Z e145e455c738e58b5464d9cf81ba3318 diff --git a/manifest.uuid b/manifest.uuid index c103aecccb..0838b3b9ba 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -788f99f47f40be42f30d3f324983f39e84d8cfbb \ No newline at end of file +4fe7c4e90b7adbb1630b4aa15709968a1fcc7d83 \ No newline at end of file diff --git a/vsixtest/vsixtest.tcl b/vsixtest/vsixtest.tcl index 7c30e579cf..999c859776 100644 --- a/vsixtest/vsixtest.tcl +++ b/vsixtest/vsixtest.tcl @@ -80,8 +80,8 @@ proc getTemporaryPath {} { proc appendArgs { args } { # - # NOTE: Returns all passed arguments joined together as a single string with - # no intervening spaces between arguments. + # NOTE: Returns all passed arguments joined together as a single string + # with no intervening spaces between arguments. # eval append result $args } @@ -111,10 +111,43 @@ proc writeFile { fileName data } { } proc putsAndEval { command } { - catch {puts stdout $command} + # + # NOTE: Outputs a command to the standard output channel and then evaluates + # it in the callers context. + # + catch { + puts stdout [appendArgs "Running: " [lrange $command 1 end] ...\n] + } + return [uplevel 1 $command] } +proc isBadDirectory { directory } { + # + # NOTE: Returns non-zero if the directory is empty, does not exist, -OR- is + # not a directory. + # + catch { + puts stdout [appendArgs "Checking directory \"" $directory \"...\n] + } + + return [expr {[string length $directory] == 0 || \ + ![file exists $directory] || ![file isdirectory $directory]}] +} + +proc isBadFile { fileName } { + # + # NOTE: Returns non-zero if the file name is empty, does not exist, -OR- is + # not a regular file. + # + catch { + puts stdout [appendArgs "Checking file \"" $fileName \"...\n] + } + + return [expr {[string length $fileName] == 0 || \ + ![file exists $fileName] || ![file isfile $fileName]}] +} + # # NOTE: This is the entry point for this script. # @@ -124,62 +157,52 @@ if {[string length $script] == 0} then { fail "script file currently being evaluated is unknown" true } -set path [file dirname $script] - -############################################################################### - -# -# NOTE: Process and verify all the command line arguments. -# -set argc [llength $argv] -if {$argc > 1} then {fail} +set path [file normalize [file dirname $script]] +set argc [llength $argv]; if {$argc > 1} then {fail "" true} if {$argc == 1} then { set vsixFileName [lindex $argv 0] } else { - set vsixFileName [file join [file dirname $path] sqlite-UWP-output.vsix] + set vsixFileName [file join \ + [file dirname $path] sqlite-UWP-output.vsix] } -if {[string length $vsixFileName] == 0} then { - fail "invalid VSIX file name" -} +############################################################################### -if {![file exists $vsixFileName] || ![file isfile $vsixFileName]} then { - fail [appendArgs "VSIX file \"" $vsixFileName "\" does not exist"] +if {[isBadFile $vsixFileName]} then { + fail [appendArgs \ + "VSIX file \"" $vsixFileName "\" does not exist"] } set versionFileName [file join [file dirname $path] VERSION] -if {![file exists $versionFileName] || ![file isfile $versionFileName]} then { - fail [appendArgs "Version file \"" $versionFileName "\" does not exist"] +if {[isBadFile $versionFileName]} then { + fail [appendArgs \ + "Version file \"" $versionFileName "\" does not exist"] } set projectTemplateFileName [file join $path vsixtest.vcxproj.data] -set projectFileName [file join $path vsixtest.vcxproj] -if {![file exists $projectTemplateFileName] || \ - ![file isfile $projectTemplateFileName]} then { +if {[isBadFile $projectTemplateFileName]} then { fail [appendArgs \ - "Project template file \"" $projectTemplateFileName "\" does not exist"] + "Project template file \"" $projectTemplateFileName \ + "\" does not exist"] } set envVarName VS140COMNTOOLS set vsDirectory [getEnvironmentVariable $envVarName] -if {[string length $vsDirectory] == 0} then { - fail [appendArgs \ - "Visual Studio 2015 environment variable \"" $envVarName "\" missing"] -} - -if {![file exists $vsDirectory] || ![file isdirectory $vsDirectory]} then { +if {[isBadDirectory $vsDirectory]} then { fail [appendArgs \ "Visual Studio 2015 directory \"" $vsDirectory \ + "\" from environment variable \"" $envVarName \ "\" does not exist"] } -set vsixInstaller [file join [file dirname $vsDirectory] IDE VSIXInstaller.exe] +set vsixInstaller [file join \ + [file dirname $vsDirectory] IDE VSIXInstaller.exe] -if {![file exists $vsixInstaller] || ![file isfile $vsixInstaller]} then { +if {[isBadFile $vsixInstaller]} then { fail [appendArgs \ "Visual Studio 2015 VSIX installer \"" $vsixInstaller \ "\" does not exist"] @@ -188,46 +211,49 @@ if {![file exists $vsixInstaller] || ![file isfile $vsixInstaller]} then { set envVarName ProgramFiles set programFiles [getEnvironmentVariable $envVarName] -if {[string length $programFiles] == 0} then { +if {[isBadDirectory $programFiles]} then { fail [appendArgs \ - "Windows environment variable \"" $envVarName "\" missing"] -} - -if {![file exists $programFiles] || ![file isdirectory $programFiles]} then { - fail [appendArgs \ - "Program Files directory \"" $programFiles "\" does not exist"] + "Program Files directory \"" $programFiles \ + "\" from environment variable \"" $envVarName \ + "\" does not exist"] } set msBuild [file join $programFiles MSBuild 14.0 Bin MSBuild.exe] -if {![file exists $msBuild] || ![file isfile $msBuild]} then { +if {[isBadFile $msBuild]} then { fail [appendArgs \ - "MSBuild 14.0 executable file \"" $msBuild "\" does not exist"] + "MSBuild v14.0 executable file \"" $msBuild \ + "\" does not exist"] } set temporaryDirectory [getTemporaryPath] -if {[string length $temporaryDirectory] == 0 || \ - ![file exists $temporaryDirectory] || \ - ![file isdirectory $temporaryDirectory]} then { - fail "cannot locate a usable temporary directory" +if {[isBadDirectory $temporaryDirectory]} then { + fail [appendArgs \ + "Temporary directory \"" $temporaryDirectory \ + "\" does not exist"] } +############################################################################### + set installLogFileName [appendArgs \ - [file rootname [file tail $vsixFileName]] -install- [pid] .log] + [file rootname [file tail $vsixFileName]] \ + -install- [pid] .log] + +set commands(1) [list exec [file nativename $vsixInstaller]] + +lappend commands(1) /quiet /norepair +lappend commands(1) [appendArgs /logFile: $installLogFileName] +lappend commands(1) [file nativename $vsixFileName] + +############################################################################### set buildLogFileName [appendArgs \ [file rootname [file tail $vsixFileName]] \ -build-%configuration%-%platform%- [pid] .log] -set uninstallLogFileName [appendArgs \ - [file rootname [file tail $vsixFileName]] -uninstall- [pid] .log] - -set commands(1) [list exec [file nativename $vsixInstaller] /quiet /norepair] -lappend commands(1) [appendArgs /logFile: $installLogFileName] -lappend commands(1) [file nativename $vsixFileName] - set commands(2) [list exec [file nativename $msBuild]] + lappend commands(2) [file nativename [file join $path vsixtest.sln]] lappend commands(2) /target:Rebuild lappend commands(2) /property:Configuration=%configuration% @@ -235,27 +261,41 @@ lappend commands(2) /property:Platform=%platform% lappend commands(2) [appendArgs \ /logger:FileLogger,Microsoft.Build.Engine\;Logfile= \ - [file nativename [file join $temporaryDirectory $buildLogFileName]] \ - \;Verbosity=diagnostic] + [file nativename [file join $temporaryDirectory \ + $buildLogFileName]] \;Verbosity=diagnostic] -set commands(3) [list exec [file nativename $vsixInstaller] /quiet /norepair] +############################################################################### + +set uninstallLogFileName [appendArgs \ + [file rootname [file tail $vsixFileName]] \ + -uninstall- [pid] .log] + +set commands(3) [list exec [file nativename $vsixInstaller]] + +lappend commands(3) /quiet /norepair lappend commands(3) [appendArgs /logFile: $uninstallLogFileName] lappend commands(3) [appendArgs /uninstall:SQLite.UWP.2015] ############################################################################### if {1} then { - puts stdout [appendArgs \ - "Install log will be \"" [file nativename [file join \ - $temporaryDirectory $installLogFileName]] "\"."] + catch { + puts stdout [appendArgs \ + "Install log: \"" [file nativename [file join \ + $temporaryDirectory $installLogFileName]] \"\n] + } - puts stdout [appendArgs \ - "Build log will be \"" [file nativename [file join \ - $temporaryDirectory $buildLogFileName]] "\"."] + catch { + puts stdout [appendArgs \ + "Build logs: \"" [file nativename [file join \ + $temporaryDirectory $buildLogFileName]] \"\n] + } - puts stdout [appendArgs \ - "Uninstall log will be \"" [file nativename [file join \ - $temporaryDirectory $uninstallLogFileName]] "\"."] + catch { + puts stdout [appendArgs \ + "Uninstall log: \"" [file nativename [file join \ + $temporaryDirectory $uninstallLogFileName]] \"\n] + } } ############################################################################### @@ -266,6 +306,8 @@ if {1} then { set versionNumber [string trim [readFile $versionFileName]] set data [readFile $projectTemplateFileName] set data [string map [list %versionNumber% $versionNumber] $data] + + set projectFileName [file join $path vsixtest.vcxproj] writeFile $projectFileName $data set platforms [list x86 x64 ARM] @@ -274,8 +316,8 @@ if {1} then { foreach platform $platforms { foreach configuration $configurations { putsAndEval [string map [list \ - %platform% $platform %configuration% \ - $configuration] $commands(2)] + %platform% $platform %configuration% $configuration] \ + $commands(2)] } } From aa9ffaba4af5949feed95660523cae0d5c30c755 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 25 Feb 2016 20:17:55 +0000 Subject: [PATCH 09/66] Disable the RESTRICT foreign key action if "PRAGMA defer_foreign_keys" is set. FossilOrigin-Name: 9ffff484bb4b67c29dda6180d7d766ad13988fe1 --- manifest | 18 ++++++++--------- manifest.uuid | 2 +- src/fkey.c | 3 +++ test/fkey6.test | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index cd7f610e12..c7fe7c9c81 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Query\splanner\simprovements:\s\sTake\sthe\sLIMIT\sinto\saccount\swhen\sestimated\sthe\ncost\sof\san\sORDER\sBY.\s\sAvoid\sautomatic\sindexes\son\squery\sloops\sthat\sare\sexpected\nto\srun\sless\sthan\stwice. -D 2016-02-25T18:40:18.408 +C Disable\sthe\sRESTRICT\sforeign\skey\saction\sif\s"PRAGMA\sdefer_foreign_keys"\sis\sset. +D 2016-02-25T20:17:55.205 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 @@ -304,7 +304,7 @@ F src/dbstat.c c845548d4346e606e2f2b7d2e714ace2b8a7dd1b F src/delete.c 48802aa3ee6339f576d074336d3ae1b5f40e240f F src/expr.c 9adb58153f6e943b703d43e9a1f67f77b5a75721 F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb -F src/fkey.c 08edad1fce30f761f14b3997e89bad58f9f7f4e0 +F src/fkey.c a842533c411b9aef63a2814bbdc24f8a21e14cd8 F src/func.c 552d300265aed09eea21f68ac742a440550c0062 F src/global.c ded7b97efd16efda5062b65e857198e46c40e652 F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5 @@ -640,7 +640,7 @@ F test/fkey2.test f3d27ecba480a348c328965d154214719bb158a9 F test/fkey3.test 76d475c80b84ee7a5d062e56ccb6ea68882e2b49 F test/fkey4.test 86446017011273aad8f9a99c1a65019e7bd9ca9d F test/fkey5.test 5a373303f201ac03c22ba1ef17a733d3f56e611a -F test/fkey6.test abb59f866c1b44926fd02d1fdd217d831fe04f48 +F test/fkey6.test ce3c39cd4f910184f5fd4a48db6783c59956224f F test/fkey7.test 72e915890ee4a005daaf3002cb208e8fe973ac13 F test/fkey8.test 7bd1dd0174a0e29a90c62c517b9e2a410a0b345d F test/fkey_malloc.test 594a7ea1fbab553c036c70813cd8bd9407d63749 @@ -1429,8 +1429,8 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh a98af506df552f3b3c0d904f94e4cdc4e1a6d598 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 2e67a1c823c7003e7d2619c7d8b6db6ce046c527 aab53a21894ba51d325fd8f8f4bb4163ece74391 -R 8a8e5a80c02a4dfa694df7d4a40dc042 -T +closed aab53a21894ba51d325fd8f8f4bb4163ece74391 -U drh -Z a9e5cc9fdd4504d0ecf5a0daa8c57736 +P bf46179d4484376909dce40ffcc06fecb19b3544 +Q +8fea1166016c659ece83e0045bc348f478a9ba6a +R c44565069d5be6a8f7796f6b44b6c97f +U dan +Z 38dd13c1fd26f5b1e4d5f260c4aeb7b1 diff --git a/manifest.uuid b/manifest.uuid index 6a068ab962..5cb14812a5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bf46179d4484376909dce40ffcc06fecb19b3544 \ No newline at end of file +9ffff484bb4b67c29dda6180d7d766ad13988fe1 \ No newline at end of file diff --git a/src/fkey.c b/src/fkey.c index 38fd4f756b..97eba1ddd7 100644 --- a/src/fkey.c +++ b/src/fkey.c @@ -1163,6 +1163,9 @@ static Trigger *fkActionTrigger( action = pFKey->aAction[iAction]; pTrigger = pFKey->apTrigger[iAction]; + if( (db->flags & SQLITE_DeferFKs) && action==OE_Restrict ){ + return 0; + } if( action!=OE_None && !pTrigger ){ char const *zFrom; /* Name of child table */ diff --git a/test/fkey6.test b/test/fkey6.test index 6fc3de211c..45ad1ef2cc 100644 --- a/test/fkey6.test +++ b/test/fkey6.test @@ -23,6 +23,7 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl +set testprefix fkey6 ifcapable {!foreignkey} { finish_test @@ -171,5 +172,58 @@ do_execsql_test fkey6-2.6 { PRAGMA defer_foreign_keys; } {0} +#-------------------------------------------------------------------------- +# Test that defer_foreign_keys disables RESTRICT. +# +do_execsql_test 3.1 { + CREATE TABLE p2(a PRIMARY KEY, b); + CREATE TABLE c2(x, y REFERENCES p2 ON DELETE RESTRICT ON UPDATE RESTRICT); + INSERT INTO p2 VALUES(1, 'one'); + INSERT INTO p2 VALUES(2, 'two'); + INSERT INTO c2 VALUES('i', 1); +} + +do_catchsql_test 3.2.1 { + BEGIN; + UPDATE p2 SET a=a-1; +} {1 {FOREIGN KEY constraint failed}} +do_execsql_test 3.2.2 { COMMIT } + +do_execsql_test 3.2.3 { + BEGIN; + PRAGMA defer_foreign_keys = 1; + UPDATE p2 SET a=a-1; + COMMIT; +} + +do_execsql_test 3.2.4 { + BEGIN; + PRAGMA defer_foreign_keys = 1; + UPDATE p2 SET a=a-1; +} +do_catchsql_test 3.2.5 { + COMMIT; +} {1 {FOREIGN KEY constraint failed}} +do_execsql_test 3.2.6 { ROLLBACK } + +do_execsql_test 3.3.1 { + CREATE TRIGGER p2t AFTER DELETE ON p2 BEGIN + INSERT INTO p2 VALUES(old.a, 'deleted!'); + END; +} +do_catchsql_test 3.3.2 { + BEGIN; + DELETE FROM p2 WHERE a=1; +} {1 {FOREIGN KEY constraint failed}} +do_execsql_test 3.3.3 { COMMIT } + +do_execsql_test 3.3.4 { + BEGIN; + PRAGMA defer_foreign_keys = 1; + DELETE FROM p2 WHERE a=1; + COMMIT; + SELECT * FROM p2; +} {0 one 1 deleted!} + finish_test From d566c95179c41be3ae89e32636f4de428d3cdeb7 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 25 Feb 2016 21:19:03 +0000 Subject: [PATCH 10/66] Change the "PRAGMA stats" command to report size values in LogEst units. The eliminates the need for sqlite3LogEstToInt() unless non-standard compile-time options are used, so leave it out except in those cases. FossilOrigin-Name: 832c237fcbe83dd4f5a18a06acb0aeb7e2b9e712 --- manifest | 19 +++++++++---------- manifest.uuid | 2 +- src/pragma.c | 8 ++++---- src/sqliteInt.h | 4 ++++ src/util.c | 7 +++++++ 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index c7fe7c9c81..808e1297d9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Disable\sthe\sRESTRICT\sforeign\skey\saction\sif\s"PRAGMA\sdefer_foreign_keys"\sis\sset. -D 2016-02-25T20:17:55.205 +C Change\sthe\s"PRAGMA\sstats"\scommand\sto\sreport\ssize\svalues\sin\sLogEst\sunits.\nThe\seliminates\sthe\sneed\sfor\ssqlite3LogEstToInt()\sunless\snon-standard\ncompile-time\soptions\sare\sused,\sso\sleave\sit\sout\sexcept\sin\sthose\scases. +D 2016-02-25T21:19:03.487 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 @@ -342,7 +342,7 @@ F src/parse.y c3ce2c4a7cbf0b699239be6b2a945c5cb51875e2 F src/pcache.c 647bb53a86b7bbcf55ad88089b3ea5a9170b90df F src/pcache.h 4d0ccaad264d360981ec5e6a2b596d6e85242545 F src/pcache1.c 72f644dc9e1468c72922eff5904048427b817051 -F src/pragma.c 80ee77226d0008d9188356a6cbbe6010866e1bee +F src/pragma.c d6028d23a9495a8b55f2075e3244ec9a0485e03e F src/pragma.h 64c78a648751b9f4f297276c4eb7507b14b4628c F src/prepare.c 22df6171aec1d86904ed2ad30c2348a5748aa04e F src/printf.c 63e6fb12bbe702dd664dc3703776c090383a5a26 @@ -354,7 +354,7 @@ F src/shell.c 89b73e894e737cc2f21e4bce0feb3ea21cc61124 F src/sqlite.h.in a7caa805a345d6a14136c11ccfa6f4c1a6ef6e7b F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d -F src/sqliteInt.h 5a87bccd05996f4c3facd8f831cf92a05b818b6f +F src/sqliteInt.h b9ac8b9c9798f57d80a9756f86abf1dbd9424ec9 F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9 @@ -412,7 +412,7 @@ F src/treeview.c c525282442111b3f61eb176784567cd6654db5dc F src/trigger.c e14840ee0c3e549e758ec9bf3e4146e166002280 F src/update.c a7eeeaffad59c6506f01303a071dac11de8269ca F src/utf.c 699001c79f28e48e9bcdf8a463da029ea660540c -F src/util.c 38c06684c922694809ccb988a13562c16890a3d5 +F src/util.c 6ed9d7bdd3b0a30742027b6d8e8e1a9e2b14f373 F src/vacuum.c feb1eabb20987983d9350cad98299b21fa811f52 F src/vdbe.c 87ae3a5657fefed7875f3eb30e7ababd48013d71 F src/vdbe.h c743791f723049db94f009e3e30958952bc2d512 @@ -1429,8 +1429,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh a98af506df552f3b3c0d904f94e4cdc4e1a6d598 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P bf46179d4484376909dce40ffcc06fecb19b3544 -Q +8fea1166016c659ece83e0045bc348f478a9ba6a -R c44565069d5be6a8f7796f6b44b6c97f -U dan -Z 38dd13c1fd26f5b1e4d5f260c4aeb7b1 +P 9ffff484bb4b67c29dda6180d7d766ad13988fe1 +R 23bd8dd7478d22b4cba45c8ed3333a25 +U drh +Z bce9cf80c6d6995d2550774b29ef2e7b diff --git a/manifest.uuid b/manifest.uuid index 5cb14812a5..a4a0d9c71b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9ffff484bb4b67c29dda6180d7d766ad13988fe1 \ No newline at end of file +832c237fcbe83dd4f5a18a06acb0aeb7e2b9e712 \ No newline at end of file diff --git a/src/pragma.c b/src/pragma.c index c34d5421c2..8b8f1f7bfd 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -1102,14 +1102,14 @@ void sqlite3Pragma( sqlite3VdbeMultiLoad(v, 1, "ssii", pTab->zName, 0, - (int)sqlite3LogEstToInt(pTab->szTabRow), - (int)sqlite3LogEstToInt(pTab->nRowLogEst)); + pTab->szTabRow, + pTab->nRowLogEst); sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 4); for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ sqlite3VdbeMultiLoad(v, 2, "sii", pIdx->zName, - (int)sqlite3LogEstToInt(pIdx->szIdxRow), - (int)sqlite3LogEstToInt(pIdx->aiRowLogEst[0])); + pIdx->szIdxRow, + pIdx->aiRowLogEst[0]); sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 4); } } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 7924ed9dc8..a62ffb6b69 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3686,7 +3686,11 @@ LogEst sqlite3LogEstAdd(LogEst,LogEst); #ifndef SQLITE_OMIT_VIRTUALTABLE LogEst sqlite3LogEstFromDouble(double); #endif +#if defined(SQLITE_ENABLE_STMT_SCANSTAT) || \ + defined(SQLITE_ENABLE_STAT3_OR_STAT4) || \ + defined(SQLITE_EXPLAIN_ESTIMATED_ROWS) u64 sqlite3LogEstToInt(LogEst); +#endif /* ** Routines to read and write variable-length integers. These used to diff --git a/src/util.c b/src/util.c index e325a7311b..d00a739e53 100644 --- a/src/util.c +++ b/src/util.c @@ -1400,8 +1400,14 @@ LogEst sqlite3LogEstFromDouble(double x){ } #endif /* SQLITE_OMIT_VIRTUALTABLE */ +#if defined(SQLITE_ENABLE_STMT_SCANSTAT) || \ + defined(SQLITE_ENABLE_STAT3_OR_STAT4) || \ + defined(SQLITE_EXPLAIN_ESTIMATED_ROWS) /* ** Convert a LogEst into an integer. +** +** Note that this routine is only used when one or more of various +** non-standard compile-time options is enabled. */ u64 sqlite3LogEstToInt(LogEst x){ u64 n; @@ -1415,3 +1421,4 @@ u64 sqlite3LogEstToInt(LogEst x){ } return (n+8)>>(3-x); } +#endif /* defined SCANSTAT or STAT4 or ESTIMATED_ROWS */ From 27b6649f39183010e4959685e7b5e2a011c3ffc6 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 25 Feb 2016 21:27:03 +0000 Subject: [PATCH 11/66] Change the srcck1.c utility program to use only unsigned characters. FossilOrigin-Name: d64d005eb5df2e3eb1248fc8eff8b1b683e48c74 --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/srcck1.c | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 808e1297d9..c83b1eba09 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sthe\s"PRAGMA\sstats"\scommand\sto\sreport\ssize\svalues\sin\sLogEst\sunits.\nThe\seliminates\sthe\sneed\sfor\ssqlite3LogEstToInt()\sunless\snon-standard\ncompile-time\soptions\sare\sused,\sso\sleave\sit\sout\sexcept\sin\sthose\scases. -D 2016-02-25T21:19:03.487 +C Change\sthe\ssrcck1.c\sutility\sprogram\sto\suse\sonly\sunsigned\scharacters. +D 2016-02-25T21:27:03.339 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 @@ -1418,7 +1418,7 @@ F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 7ce07da76b5e745783e703a834417d725b7d45fd F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c F tool/sqldiff.c 5a26205111e6fa856d9b1535b1637744dcdb930b -F tool/srcck1.c 4c39bdfa9a92edd20233ee720df84dbeb2417602 +F tool/srcck1.c 4f65e1a6748e42f24c0ea629dddc934d821c729a F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43 F tool/symbols-mingw.sh 4dbcea7e74768305384c9fd2ed2b41bbf9f0414d F tool/symbols.sh fec58532668296d7c7dc48be9c87f75ccdb5814f @@ -1429,7 +1429,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh a98af506df552f3b3c0d904f94e4cdc4e1a6d598 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9ffff484bb4b67c29dda6180d7d766ad13988fe1 -R 23bd8dd7478d22b4cba45c8ed3333a25 +P 832c237fcbe83dd4f5a18a06acb0aeb7e2b9e712 +R 0714ab3705e4d9ae10258587d2894689 U drh -Z bce9cf80c6d6995d2550774b29ef2e7b +Z 6cd1ed7303c3e6dd998ffd3867295c4f diff --git a/manifest.uuid b/manifest.uuid index a4a0d9c71b..f5d99d5c44 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -832c237fcbe83dd4f5a18a06acb0aeb7e2b9e712 \ No newline at end of file +d64d005eb5df2e3eb1248fc8eff8b1b683e48c74 \ No newline at end of file diff --git a/tool/srcck1.c b/tool/srcck1.c index e95765185f..f92610f544 100644 --- a/tool/srcck1.c +++ b/tool/srcck1.c @@ -111,11 +111,11 @@ static unsigned int findCloseParen(const char *z){ ** Print error messages whenever a side effect is found. Return the number ** of problems seen. */ -static unsigned int findAllSideEffects(const char *z){ +static unsigned int findAllSideEffects(const unsigned char *z){ unsigned int lineno = 1; /* Line number */ unsigned int i; unsigned int nErr = 0; - char c, prevC = 0; + unsigned char c, prevC = 0; for(i=0; (c = z[i])!=0; prevC=c, i++){ if( c=='\n' ){ lineno++; continue; } if( isalpha(c) && !isalpha(prevC) ){ @@ -125,7 +125,7 @@ static unsigned int findAllSideEffects(const char *z){ || strncmp(&z[i],"testcase(",9)==0 ){ unsigned int n; - const char *z2 = &z[i+5]; + unsigned const char *z2 = &z[i+5]; while( z2[0]!='(' ){ z2++; } z2++; n = findCloseParen(z2); @@ -141,7 +141,7 @@ static unsigned int findAllSideEffects(const char *z){ } int main(int argc, char **argv){ - char *z; + unsigned char *z; unsigned int nErr = 0; if( argc!=2 ){ fprintf(stderr, "Usage: %s FILENAME\n", argv[0]); From 9d970c3c9358ee0217eab620bd3a348be954deca Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 25 Feb 2016 21:38:28 +0000 Subject: [PATCH 12/66] Small optimization in FK handling. FossilOrigin-Name: e0d25913b73a813f5987aa70b364b00f19351663 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/fkey.c | 5 +++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index c83b1eba09..1b636cf075 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sthe\ssrcck1.c\sutility\sprogram\sto\suse\sonly\sunsigned\scharacters. -D 2016-02-25T21:27:03.339 +C Small\soptimization\sin\sFK\shandling. +D 2016-02-25T21:38:28.541 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 @@ -304,7 +304,7 @@ F src/dbstat.c c845548d4346e606e2f2b7d2e714ace2b8a7dd1b F src/delete.c 48802aa3ee6339f576d074336d3ae1b5f40e240f F src/expr.c 9adb58153f6e943b703d43e9a1f67f77b5a75721 F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb -F src/fkey.c a842533c411b9aef63a2814bbdc24f8a21e14cd8 +F src/fkey.c 5cb42d9a59e2a590776fd3fc8ff6f61d40df3c6e F src/func.c 552d300265aed09eea21f68ac742a440550c0062 F src/global.c ded7b97efd16efda5062b65e857198e46c40e652 F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5 @@ -1429,7 +1429,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh a98af506df552f3b3c0d904f94e4cdc4e1a6d598 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 832c237fcbe83dd4f5a18a06acb0aeb7e2b9e712 -R 0714ab3705e4d9ae10258587d2894689 -U drh -Z 6cd1ed7303c3e6dd998ffd3867295c4f +P d64d005eb5df2e3eb1248fc8eff8b1b683e48c74 +R ab8765cbaf5fbfbed19ecf7263e09682 +U mistachkin +Z ff9c90565884f74ae6db48ba3f5b6f95 diff --git a/manifest.uuid b/manifest.uuid index f5d99d5c44..90985bbea9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d64d005eb5df2e3eb1248fc8eff8b1b683e48c74 \ No newline at end of file +e0d25913b73a813f5987aa70b364b00f19351663 \ No newline at end of file diff --git a/src/fkey.c b/src/fkey.c index 97eba1ddd7..9a1a85fec0 100644 --- a/src/fkey.c +++ b/src/fkey.c @@ -1162,11 +1162,12 @@ static Trigger *fkActionTrigger( int iAction = (pChanges!=0); /* 1 for UPDATE, 0 for DELETE */ action = pFKey->aAction[iAction]; - pTrigger = pFKey->apTrigger[iAction]; - if( (db->flags & SQLITE_DeferFKs) && action==OE_Restrict ){ + if( action==OE_Restrict && (db->flags & SQLITE_DeferFKs) ){ return 0; } + pTrigger = pFKey->apTrigger[iAction]; + if( action!=OE_None && !pTrigger ){ char const *zFrom; /* Name of child table */ int nFrom; /* Length in bytes of zFrom */ From 8c098e61b6e9c278df73096198c44cb2d6619745 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 25 Feb 2016 23:21:41 +0000 Subject: [PATCH 13/66] Fix an incorrect cost computation for sorting (introduced just a few check-ins ago). Should be NlogN, not NloglogN. FossilOrigin-Name: 2459d3238853951bc3a507dd975e7ec921cf8446 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/where.c | 5 ++--- test/where.test | 12 +++++++++--- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index 1b636cf075..0683bae1ec 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Small\soptimization\sin\sFK\shandling. -D 2016-02-25T21:38:28.541 +C Fix\san\sincorrect\scost\scomputation\sfor\ssorting\s(introduced\sjust\sa\sfew\ncheck-ins\sago).\s\sShould\sbe\sNlogN,\snot\sNloglogN. +D 2016-02-25T23:21:41.832 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 @@ -428,7 +428,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c 10deb6b43887662691e5f53d10b3c171c401169b F src/wal.h 2f7c831cf3b071fa548bf2d5cac640846a7ff19c F src/walker.c 0f142b5bd3ed2041fc52d773880748b212e63354 -F src/where.c b21a2b3cee42e1db4f14c8fc5124f607e0c668c0 +F src/where.c 32051597188dc632bafb32d50a9c3a04fb97ce39 F src/whereInt.h 93297d56edd137b7ea004490690fb6e2ce028a34 F src/wherecode.c 39c1ef4598bedf1d66249334c74efd23ddd182ac F src/whereexpr.c fb87944b1254234e5bba671aaf6dee476241506a @@ -1327,7 +1327,7 @@ F test/walro.test 34422d1d95aaff0388f0791ec20edb34e2a3ed57 F test/walshared.test 0befc811dcf0b287efae21612304d15576e35417 F test/walslow.test c05c68d4dc2700a982f89133ce103a1a84cc285f F test/walthread.test de8dbaf6d9e41481c460ba31ca61e163d7348f8e -F test/where.test 9902a3d84e9bc80357a2c54ed0e76c0d6d04a867 +F test/where.test c33bf57e48a34d6cc98018d779a577c2f61ff312 F test/where2.test af78c55589cbc82d793449493adba0dc3d659f23 F test/where3.test 1ad55ba900bd7747f98b6082e65bd3e442c5004e F test/where4.test 4a371bfcc607f41d233701bdec33ac2972908ba8 @@ -1429,7 +1429,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh a98af506df552f3b3c0d904f94e4cdc4e1a6d598 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d64d005eb5df2e3eb1248fc8eff8b1b683e48c74 -R ab8765cbaf5fbfbed19ecf7263e09682 -U mistachkin -Z ff9c90565884f74ae6db48ba3f5b6f95 +P e0d25913b73a813f5987aa70b364b00f19351663 +R 8ecd868c4f09ad809b17fd8b0dd4a502 +U drh +Z 87b6be9293374710fdcde53ff54603a2 diff --git a/manifest.uuid b/manifest.uuid index 90985bbea9..59f4369738 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e0d25913b73a813f5987aa70b364b00f19351663 \ No newline at end of file +2459d3238853951bc3a507dd975e7ec921cf8446 \ No newline at end of file diff --git a/src/where.c b/src/where.c index a68dcf5bfc..71d3cb01ef 100644 --- a/src/where.c +++ b/src/where.c @@ -3463,9 +3463,8 @@ static LogEst whereSortingCost( /* Multiple by log(M) where M is the number of output rows. ** Use the LIMIT for M if it is smaller */ - if( (pWInfo->wctrlFlags & WHERE_USE_LIMIT)!=0 ){ - LogEst m = sqlite3LogEst(pWInfo->iLimit); - if( mwctrlFlags & WHERE_USE_LIMIT)!=0 && pWInfo->iLimitiLimit; } rSortCost += estLog(nRow); return rSortCost; diff --git a/test/where.test b/test/where.test index 0b5bb934d0..2b0b7dcfaf 100644 --- a/test/where.test +++ b/test/where.test @@ -573,11 +573,17 @@ do_test where-6.6 { SELECT * FROM t3 WHERE a>0 ORDER BY a LIMIT 3 } } {1 100 4 2 99 9 3 98 16 nosort} -do_test where-6.7 { +do_test where-6.7.1 { cksort { - SELECT * FROM t3 WHERE b>0 ORDER BY a LIMIT 3 + SELECT * FROM t3 WHERE b>0 ORDER BY a LIMIT 10 } -} {1 100 4 2 99 9 3 98 16 nosort} +} {/1 100 4 2 99 9 3 98 16 .* nosort/} +do_test where-6.7.2 { + cksort { + SELECT * FROM t3 WHERE b>0 ORDER BY a LIMIT 1 + } +} {1 100 4 sort} +exit ifcapable subquery { do_test where-6.8a { cksort { From 7856c1c0eb26da861787d14b7ce1d470944c0310 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 25 Feb 2016 23:22:26 +0000 Subject: [PATCH 14/66] Enhance checking of prerequisites in the vsixtest tool. FossilOrigin-Name: 799d5f09ed058898167e43bd9c8d1bf8c5df23ba --- manifest | 12 +++++------ manifest.uuid | 2 +- vsixtest/vsixtest.tcl | 46 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index d0f724c2b1..ba74fc32b8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improve\sreadability\sand\slogging\sof\sthe\svsixtest\sscript. -D 2016-02-25T08:02:16.943 +C Enhance\schecking\sof\sprerequisites\sin\sthe\svsixtest\stool. +D 2016-02-25T23:22:26.535 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 @@ -1446,11 +1446,11 @@ F vsixtest/Package.appxmanifest 6b6db1eb7df3a315c5d681059754d5f0e0c47a93 F vsixtest/pch.cpp cb823cfac36f1a39a7eb0acbd7e9a0b0de8f23af F vsixtest/pch.h 9cab7980f2ac4baa40807d8b5e52af32a21cf78c F vsixtest/vsixtest.sln 77cadbe4e96c1fe1bf51cd77de9e9b0a12ada547 -F vsixtest/vsixtest.tcl 41268d1a0937c517f3c2e3f6538c90da70d155f8 +F vsixtest/vsixtest.tcl 463b7aa846f8f1bdadf2aadb1ac84c34c247437c F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 788f99f47f40be42f30d3f324983f39e84d8cfbb -R 27bc664c4897fa05fbab9ef38c37f4b7 +P 4fe7c4e90b7adbb1630b4aa15709968a1fcc7d83 +R fa3049ef82e4175b0a6df31159094b76 U mistachkin -Z e145e455c738e58b5464d9cf81ba3318 +Z bc452bd15f3f1d06988b3918e97baf68 diff --git a/manifest.uuid b/manifest.uuid index 0838b3b9ba..27c4b9427d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4fe7c4e90b7adbb1630b4aa15709968a1fcc7d83 \ No newline at end of file +799d5f09ed058898167e43bd9c8d1bf8c5df23ba \ No newline at end of file diff --git a/vsixtest/vsixtest.tcl b/vsixtest/vsixtest.tcl index 999c859776..7baed3af6a 100644 --- a/vsixtest/vsixtest.tcl +++ b/vsixtest/vsixtest.tcl @@ -45,6 +45,44 @@ proc fail { {error ""} {usage false} } { exit 1 } +proc isWindows {} { + # + # NOTE: Returns non-zero only when running on Windows. + # + return [expr {[info exists ::tcl_platform(platform)] && \ + $::tcl_platform(platform) eq "windows"}] +} + +proc isAdministrator {} { + # + # NOTE: Returns non-zero only when running as "elevated administrator". + # + if {[isWindows]} then { + if {[catch {exec -- whoami /groups} groups] == 0} then { + set groups [string map [list \r\n \n] $groups] + + foreach group [split $groups \n] { + # + # NOTE: Match this group line against the "well-known" SID for + # the "Administrators" group on Windows. + # + if {[regexp -- {\sS-1-5-32-544\s} $group]} then { + # + # NOTE: Match this group line against the attributes column + # sub-value that should be present when running with + # elevated administrator credentials. + # + if {[regexp -- {\sEnabled group(?:,|\s)} $group]} then { + return true + } + } + } + } + } + + return false +} + proc getEnvironmentVariable { name } { # # NOTE: Returns the value of the specified environment variable or an empty @@ -157,6 +195,14 @@ if {[string length $script] == 0} then { fail "script file currently being evaluated is unknown" true } +if {![isWindows]} then { + fail "this tool only works properly on Windows" +} + +if {![isAdministrator]} then { + fail "this tool must run with \"elevated administrator\" privileges" +} + set path [file normalize [file dirname $script]] set argc [llength $argv]; if {$argc > 1} then {fail "" true} From 74c2f06668ad09dde5acd12b45e7f4624b21e342 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 25 Feb 2016 23:27:02 +0000 Subject: [PATCH 15/66] Add some comments in the VSIX test tool. FossilOrigin-Name: c871473ffee6dbb0f5b47f1c1329c84b902368ae --- manifest | 13 ++++++------- manifest.uuid | 2 +- vsixtest/vsixtest.tcl | 14 ++++++++------ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index 157cf92745..c46c3db9da 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\stool\sfor\ssmoke-testing\sthe\sUWP\sVSIX\spackage. -D 2016-02-25T23:25:00.511 +C Add\ssome\scomments\sin\sthe\sVSIX\stest\stool. +D 2016-02-25T23:27:02.855 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 @@ -1446,12 +1446,11 @@ F vsixtest/Package.appxmanifest 6b6db1eb7df3a315c5d681059754d5f0e0c47a93 F vsixtest/pch.cpp cb823cfac36f1a39a7eb0acbd7e9a0b0de8f23af F vsixtest/pch.h 9cab7980f2ac4baa40807d8b5e52af32a21cf78c F vsixtest/vsixtest.sln 77cadbe4e96c1fe1bf51cd77de9e9b0a12ada547 -F vsixtest/vsixtest.tcl 463b7aa846f8f1bdadf2aadb1ac84c34c247437c +F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 2459d3238853951bc3a507dd975e7ec921cf8446 799d5f09ed058898167e43bd9c8d1bf8c5df23ba -R a2c41dee5fc3fcec68335e2bea7b9721 -T +closed 799d5f09ed058898167e43bd9c8d1bf8c5df23ba +P d27f32c6d72182198ae6d6cf8e385be76335dc65 +R eaa06d7471a7f3afc4a0fae5257d24c3 U mistachkin -Z 00dca86db1b95b6beaa7d7daeb4c1114 +Z cdb877e6651172a6d5d6ba712087b34e diff --git a/manifest.uuid b/manifest.uuid index a1977c0d14..307808ef47 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d27f32c6d72182198ae6d6cf8e385be76335dc65 \ No newline at end of file +c871473ffee6dbb0f5b47f1c1329c84b902368ae \ No newline at end of file diff --git a/vsixtest/vsixtest.tcl b/vsixtest/vsixtest.tcl index 7baed3af6a..5dce821dc4 100644 --- a/vsixtest/vsixtest.tcl +++ b/vsixtest/vsixtest.tcl @@ -5,24 +5,26 @@ # # PREREQUISITES # -# 1. This tool must be executed with "elevated administrator" privileges. +# 1. This tool is Windows only. # -# 2. Tcl 8.4 and later are supported, earlier versions have not been tested. +# 2. This tool must be executed with "elevated administrator" privileges. # -# 3. The "sqlite-UWP-output.vsix" file is assumed to exist in the parent +# 3. Tcl 8.4 and later are supported, earlier versions have not been tested. +# +# 4. The "sqlite-UWP-output.vsix" file is assumed to exist in the parent # directory of the directory containing this script. The [optional] first # command line argument to this script may be used to specify an alternate # file. However, currently, the file must be compatible with both Visual # Studio 2015 and the Universal Windows Platform. # -# 4. The "VERSION" file is assumed to exist in the parent directory of the +# 5. The "VERSION" file is assumed to exist in the parent directory of the # directory containing this script. It must contain a version number that # matches the VSIX file being tested. # -# 5. The temporary directory specified in the TEMP or TMP environment variables +# 6. The temporary directory specified in the TEMP or TMP environment variables # must refer to an existing directory writable by the current user. # -# 6. The VS140COMNTOOLS environment variable must refer to the Visual Studio +# 7. The VS140COMNTOOLS environment variable must refer to the Visual Studio # 2015 common tools directory. # # USAGE From c9eaeef1fe3bca902c3cb32db978bb2c671e221f Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 26 Feb 2016 04:04:07 +0000 Subject: [PATCH 16/66] Remove a debuggin "exit" command mistakenly left in the "where.test" module. FossilOrigin-Name: beda0b8c76c2c7328a44156257c978cf8f5df59b --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/where.test | 1 - 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index c46c3db9da..38c37f9331 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\ssome\scomments\sin\sthe\sVSIX\stest\stool. -D 2016-02-25T23:27:02.855 +C Remove\sa\sdebuggin\s"exit"\scommand\smistakenly\sleft\sin\sthe\s"where.test"\smodule. +D 2016-02-26T04:04:07.156 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 @@ -1327,7 +1327,7 @@ F test/walro.test 34422d1d95aaff0388f0791ec20edb34e2a3ed57 F test/walshared.test 0befc811dcf0b287efae21612304d15576e35417 F test/walslow.test c05c68d4dc2700a982f89133ce103a1a84cc285f F test/walthread.test de8dbaf6d9e41481c460ba31ca61e163d7348f8e -F test/where.test c33bf57e48a34d6cc98018d779a577c2f61ff312 +F test/where.test f0c325563acde44f2c4ea6ba348e9e29f7121757 F test/where2.test af78c55589cbc82d793449493adba0dc3d659f23 F test/where3.test 1ad55ba900bd7747f98b6082e65bd3e442c5004e F test/where4.test 4a371bfcc607f41d233701bdec33ac2972908ba8 @@ -1450,7 +1450,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d27f32c6d72182198ae6d6cf8e385be76335dc65 -R eaa06d7471a7f3afc4a0fae5257d24c3 -U mistachkin -Z cdb877e6651172a6d5d6ba712087b34e +P c871473ffee6dbb0f5b47f1c1329c84b902368ae +R 6fc01093db6658e430bdeb2c14b7bd88 +U drh +Z 4d54711e77d505069a1e93ab6ffa4de0 diff --git a/manifest.uuid b/manifest.uuid index 307808ef47..368053ee95 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c871473ffee6dbb0f5b47f1c1329c84b902368ae \ No newline at end of file +beda0b8c76c2c7328a44156257c978cf8f5df59b \ No newline at end of file diff --git a/test/where.test b/test/where.test index 2b0b7dcfaf..d4f04e8063 100644 --- a/test/where.test +++ b/test/where.test @@ -583,7 +583,6 @@ do_test where-6.7.2 { SELECT * FROM t3 WHERE b>0 ORDER BY a LIMIT 1 } } {1 100 4 sort} -exit ifcapable subquery { do_test where-6.8a { cksort { From 26bcc7cf4084151d7926f48c8d3802eb6d611f93 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 26 Feb 2016 04:13:39 +0000 Subject: [PATCH 17/66] Ephemeral tables used to hold manifested views may not be unordered since they might be subject to an ordered comparison if they are part of a join. FossilOrigin-Name: 3ef6a3153267d5328202fea24fd29ff4d5409295 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/select.c | 1 - src/vdbeInt.h | 2 +- test/misc8.test | 13 +++++++++++++ 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 38c37f9331..c74fbbede1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sa\sdebuggin\s"exit"\scommand\smistakenly\sleft\sin\sthe\s"where.test"\smodule. -D 2016-02-26T04:04:07.156 +C Ephemeral\stables\sused\sto\shold\smanifested\sviews\smay\snot\sbe\sunordered\ssince\nthey\smight\sbe\ssubject\sto\san\sordered\scomparison\sif\sthey\sare\spart\sof\sa\sjoin. +D 2016-02-26T04:13:39.081 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 @@ -349,7 +349,7 @@ F src/printf.c 63e6fb12bbe702dd664dc3703776c090383a5a26 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c b8f7174e5f8c33c44ded3a25a973d0bb89228c20 F src/rowset.c 9fe4b3ad7cc00944386bb600233d8f523de07a6e -F src/select.c dbc73a63bee99bf7cfac6052477ffc21e899bb08 +F src/select.c 1bacfde7b7cec134d2b354cbcf67bafc67078431 F src/shell.c 89b73e894e737cc2f21e4bce0feb3ea21cc61124 F src/sqlite.h.in a7caa805a345d6a14136c11ccfa6f4c1a6ef6e7b F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 @@ -416,7 +416,7 @@ F src/util.c 6ed9d7bdd3b0a30742027b6d8e8e1a9e2b14f373 F src/vacuum.c feb1eabb20987983d9350cad98299b21fa811f52 F src/vdbe.c 87ae3a5657fefed7875f3eb30e7ababd48013d71 F src/vdbe.h c743791f723049db94f009e3e30958952bc2d512 -F src/vdbeInt.h 84827a809229917fdd3cc05af719dbb61314a5a3 +F src/vdbeInt.h 49a74fe5ece206d2d8666ba9afaf1abeda5f123b F src/vdbeapi.c 95b1f8e527240a18a9aea41a655b013bf07a7009 F src/vdbeaux.c 2c15cf88de4df97428318c8cfac0dea873dae451 F src/vdbeblob.c 3b570b730109e8f653d9d2081649f6e7015113db @@ -897,7 +897,7 @@ F test/misc4.test 0d8be3466adf123a7791a66ba2bc8e8d229e87f3 F test/misc5.test f96428ea95b3820aafc6f1c50cf48a09e4597ee1 F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91 F test/misc7.test edd0b63e2ee29a256900b0514f6fff27e19e9bb2 -F test/misc8.test fc2754d38892f7dac30c22db3616c2764f117d66 +F test/misc8.test 21ac9d35a5e110279ae9e1588b8914f54de1c60b F test/misuse.test 3c34719944ba045cc6c188a4852ba04680728912 F test/mmap1.test 44a5ff1c1bcc7dcf2de50227d1f997e75a8ef1ae F test/mmap2.test 9d6dd9ddb4ad2379f29cc78f38ce1e63ed418022 @@ -1450,7 +1450,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c871473ffee6dbb0f5b47f1c1329c84b902368ae -R 6fc01093db6658e430bdeb2c14b7bd88 +P beda0b8c76c2c7328a44156257c978cf8f5df59b +R 5d471132c02d748b5b7a9c957a1aab1e U drh -Z 4d54711e77d505069a1e93ab6ffa4de0 +Z 02d11a44d61806b13a4d06a9e5d2f12b diff --git a/manifest.uuid b/manifest.uuid index 368053ee95..18803bd46f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -beda0b8c76c2c7328a44156257c978cf8f5df59b \ No newline at end of file +3ef6a3153267d5328202fea24fd29ff4d5409295 \ No newline at end of file diff --git a/src/select.c b/src/select.c index bde278b43c..aa1f214855 100644 --- a/src/select.c +++ b/src/select.c @@ -2225,7 +2225,6 @@ static int multiSelect( if( dest.eDest==SRT_EphemTab ){ assert( p->pEList ); sqlite3VdbeAddOp2(v, OP_OpenEphemeral, dest.iSDParm, p->pEList->nExpr); - sqlite3VdbeChangeP5(v, BTREE_UNORDERED); dest.eDest = SRT_Table; } diff --git a/src/vdbeInt.h b/src/vdbeInt.h index 710c725e62..b53952fd44 100644 --- a/src/vdbeInt.h +++ b/src/vdbeInt.h @@ -87,7 +87,7 @@ struct VdbeCursor { #endif Bool isEphemeral:1; /* True for an ephemeral table */ Bool useRandomRowid:1;/* Generate new record numbers semi-randomly */ - Bool isOrdered:1; /* True if the underlying table is BTREE_UNORDERED */ + Bool isOrdered:1; /* True if the table is not BTREE_UNORDERED */ Pgno pgnoRoot; /* Root page of the open btree cursor */ i16 nField; /* Number of fields in the header */ u16 nHdrParsed; /* Number of header fields parsed so far */ diff --git a/test/misc8.test b/test/misc8.test index 3ff52e56f1..3817cadf94 100644 --- a/test/misc8.test +++ b/test/misc8.test @@ -94,5 +94,18 @@ do_execsql_test misc8-2.1 { 0 10 {} 10 {} {} } +# 2016-02-26: An assertion fault found by the libFuzzer project +# +do_execsql_test misc8-3.0 { + SELECT * + FROM + ( + (SELECT 0 AS i) AS x1, + (SELECT 1) AS x2 + ) AS x3, + (SELECT 6 AS j UNION ALL SELECT 7) AS x4 + WHERE i Date: Fri, 26 Feb 2016 13:22:21 +0000 Subject: [PATCH 18/66] Fix a typo in a comment (though an important comment in that it is used to generate documentation). FossilOrigin-Name: ff3d7f845e1875d6729f64f5231db1c376892f31 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/sqlite.h.in | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index c74fbbede1..f3c7712c00 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Ephemeral\stables\sused\sto\shold\smanifested\sviews\smay\snot\sbe\sunordered\ssince\nthey\smight\sbe\ssubject\sto\san\sordered\scomparison\sif\sthey\sare\spart\sof\sa\sjoin. -D 2016-02-26T04:13:39.081 +C Fix\sa\stypo\sin\sa\scomment\s(though\san\simportant\scomment\sin\sthat\sit\sis\sused\s\nto\sgenerate\sdocumentation). +D 2016-02-26T13:22:21.836 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 @@ -351,7 +351,7 @@ F src/resolve.c b8f7174e5f8c33c44ded3a25a973d0bb89228c20 F src/rowset.c 9fe4b3ad7cc00944386bb600233d8f523de07a6e F src/select.c 1bacfde7b7cec134d2b354cbcf67bafc67078431 F src/shell.c 89b73e894e737cc2f21e4bce0feb3ea21cc61124 -F src/sqlite.h.in a7caa805a345d6a14136c11ccfa6f4c1a6ef6e7b +F src/sqlite.h.in 42203c6bf167b8b13c4e6637cbdf8ad2cb2f8685 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d F src/sqliteInt.h b9ac8b9c9798f57d80a9756f86abf1dbd9424ec9 @@ -1450,7 +1450,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P beda0b8c76c2c7328a44156257c978cf8f5df59b -R 5d471132c02d748b5b7a9c957a1aab1e +P 3ef6a3153267d5328202fea24fd29ff4d5409295 +R 77993d5bd700ce83f039b073c94a1fa4 U drh -Z 02d11a44d61806b13a4d06a9e5d2f12b +Z 9609a7717e93d89e1b3f63c437689c08 diff --git a/manifest.uuid b/manifest.uuid index 18803bd46f..af3baca687 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3ef6a3153267d5328202fea24fd29ff4d5409295 \ No newline at end of file +ff3d7f845e1875d6729f64f5231db1c376892f31 \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index dcbda15ce5..829eeb86ce 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -1228,7 +1228,7 @@ struct sqlite3_vfs { const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName); /* ** The methods above are in versions 1 through 3 of the sqlite_vfs object. - ** New fields may be appended in figure versions. The iVersion + ** New fields may be appended in future versions. The iVersion ** value will increment whenever this happens. */ }; From d42908fb0e09d6ed2df334b4a5f3be6de40292e4 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 26 Feb 2016 15:38:24 +0000 Subject: [PATCH 19/66] Provide the new SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER option to sqlite3_db_config() that can be used to activate the two-argument version of fts3_tokenizer() for a specific database connection at run-time. FossilOrigin-Name: 374b5108087a2eae03676c0f3469b37a272145bf --- ext/fts3/fts3_tokenizer.c | 71 +++++++++++++++++---------------- manifest | 26 ++++++------ manifest.uuid | 2 +- src/main.c | 8 +++- src/sqlite.h.in | 20 ++++++++-- src/sqliteInt.h | 1 + src/test1.c | 48 ++++++++++++++++++++++ src/test_config.c | 6 --- test/fts3atoken.test | 83 ++++++++++++++++++++------------------- test/fts4langid.test | 47 +++++++++++----------- 10 files changed, 189 insertions(+), 123 deletions(-) diff --git a/ext/fts3/fts3_tokenizer.c b/ext/fts3/fts3_tokenizer.c index fcabe5cca2..b7d9d2b3b2 100644 --- a/ext/fts3/fts3_tokenizer.c +++ b/ext/fts3/fts3_tokenizer.c @@ -29,6 +29,18 @@ #include #include +/* +** Return true if the two-argument version of fts3_tokenizer() +** has been activated via a prior call to sqlite3_db_config(db, +** SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, 1, 0); +*/ +static int fts3TokenizerEnabled(sqlite3_context *context){ + sqlite3 *db = sqlite3_context_db_handle(context); + int isEnabled = 0; + sqlite3_db_config(db,SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER,-1,&isEnabled); + return isEnabled; +} + /* ** Implementation of the SQL scalar function for accessing the underlying ** hash table. This function may be called as follows: @@ -49,7 +61,7 @@ ** is a blob containing the pointer stored as the hash data corresponding ** to string (after the hash-table is updated, if applicable). */ -static void scalarFunc( +static void fts3TokenizerFunc( sqlite3_context *context, int argc, sqlite3_value **argv @@ -67,27 +79,23 @@ static void scalarFunc( nName = sqlite3_value_bytes(argv[0])+1; if( argc==2 ){ -#ifdef SQLITE_ENABLE_FTS3_TOKENIZER - void *pOld; - int n = sqlite3_value_bytes(argv[1]); - if( zName==0 || n!=sizeof(pPtr) ){ - sqlite3_result_error(context, "argument type mismatch", -1); + if( fts3TokenizerEnabled(context) ){ + void *pOld; + int n = sqlite3_value_bytes(argv[1]); + if( zName==0 || n!=sizeof(pPtr) ){ + sqlite3_result_error(context, "argument type mismatch", -1); + return; + } + pPtr = *(void **)sqlite3_value_blob(argv[1]); + pOld = sqlite3Fts3HashInsert(pHash, (void *)zName, nName, pPtr); + if( pOld==pPtr ){ + sqlite3_result_error(context, "out of memory", -1); + } + }else{ + sqlite3_result_error(context, "fts3tokenize disabled", -1); return; } - pPtr = *(void **)sqlite3_value_blob(argv[1]); - pOld = sqlite3Fts3HashInsert(pHash, (void *)zName, nName, pPtr); - if( pOld==pPtr ){ - sqlite3_result_error(context, "out of memory", -1); - return; - } -#else - sqlite3_result_error(context, "fts3tokenize: " - "disabled - rebuild with -DSQLITE_ENABLE_FTS3_TOKENIZER", -1 - ); - return; -#endif /* SQLITE_ENABLE_FTS3_TOKENIZER */ - }else - { + }else{ if( zName ){ pPtr = sqlite3Fts3HashFind(pHash, zName, nName); } @@ -98,7 +106,6 @@ static void scalarFunc( return; } } - sqlite3_result_blob(context, (void *)&pPtr, sizeof(pPtr), SQLITE_TRANSIENT); } @@ -336,7 +343,6 @@ finish: Tcl_DecrRefCount(pRet); } -#ifdef SQLITE_ENABLE_FTS3_TOKENIZER static int registerTokenizer( sqlite3 *db, @@ -358,7 +364,6 @@ int registerTokenizer( return sqlite3_finalize(pStmt); } -#endif /* SQLITE_ENABLE_FTS3_TOKENIZER */ static @@ -431,13 +436,13 @@ static void intTestFunc( assert( 0==strcmp(sqlite3_errmsg(db), "unknown tokenizer: nosuchtokenizer") ); /* Test the storage function */ -#ifdef SQLITE_ENABLE_FTS3_TOKENIZER - rc = registerTokenizer(db, "nosuchtokenizer", p1); - assert( rc==SQLITE_OK ); - rc = queryTokenizer(db, "nosuchtokenizer", &p2); - assert( rc==SQLITE_OK ); - assert( p2==p1 ); -#endif + if( fts3TokenizerEnabled(context) ){ + rc = registerTokenizer(db, "nosuchtokenizer", p1); + assert( rc==SQLITE_OK ); + rc = queryTokenizer(db, "nosuchtokenizer", &p2); + assert( rc==SQLITE_OK ); + assert( p2==p1 ); + } sqlite3_result_text(context, "ok", -1, SQLITE_STATIC); } @@ -453,7 +458,7 @@ static void intTestFunc( ** sqlite3Fts3HashInit(pHash, FTS3_HASH_STRING, 1); ** ** This function adds a scalar function (see header comment above -** scalarFunc() in this file for details) and, if ENABLE_TABLE is +** fts3TokenizerFunc() in this file for details) and, if ENABLE_TABLE is ** defined at compilation time, a temporary virtual table (see header ** comment above struct HashTableVtab) to the database schema. Both ** provide read/write access to the contents of *pHash. @@ -482,10 +487,10 @@ int sqlite3Fts3InitHashTable( #endif if( SQLITE_OK==rc ){ - rc = sqlite3_create_function(db, zName, 1, any, p, scalarFunc, 0, 0); + rc = sqlite3_create_function(db, zName, 1, any, p, fts3TokenizerFunc, 0, 0); } if( SQLITE_OK==rc ){ - rc = sqlite3_create_function(db, zName, 2, any, p, scalarFunc, 0, 0); + rc = sqlite3_create_function(db, zName, 2, any, p, fts3TokenizerFunc, 0, 0); } #ifdef SQLITE_TEST if( SQLITE_OK==rc ){ diff --git a/manifest b/manifest index f3c7712c00..b196f4d2fb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\stypo\sin\sa\scomment\s(though\san\simportant\scomment\sin\sthat\sit\sis\sused\s\nto\sgenerate\sdocumentation). -D 2016-02-26T13:22:21.836 +C Provide\sthe\snew\sSQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER\soption\sto\s\nsqlite3_db_config()\sthat\scan\sbe\sused\sto\sactivate\sthe\stwo-argument\sversion\nof\sfts3_tokenizer()\sfor\sa\sspecific\sdatabase\sconnection\sat\srun-time. +D 2016-02-26T15:38:24.549 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 @@ -83,7 +83,7 @@ F ext/fts3/fts3_snippet.c 68ae118b0f834ea53d2b89e4087fc0f0b8c4ee4e F ext/fts3/fts3_term.c 88c55a6fa1a51ab494e33dced0401a6c28791fd7 F ext/fts3/fts3_test.c 11e36437b0f3f2266acea5b4787f615e4337a237 F ext/fts3/fts3_tokenize_vtab.c a27593ab19657166f6fa5ec073b678cc29a75860 -F ext/fts3/fts3_tokenizer.c 4bd72f767f61c9ce5a7575c844e8d1ed2c3c561a +F ext/fts3/fts3_tokenizer.c 3cf21cd2212db17a88d4ef7da0fd8a80275979a1 F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3 F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004 F ext/fts3/fts3_unicode.c a93f5edc0aff44ef8b06d7cb55b52026541ca145 @@ -314,7 +314,7 @@ F src/insert.c 9ca97272e9f74ed0efddf3b4350ee12740cebbef F src/journal.c fe3a3e2559ce3ce9d371afd30fbabbc074174575 F src/legacy.c 75d3023be8f0d2b99d60f905090341a03358c58e F src/loadext.c 9e2a41adcaff16ebc1ebff1f336cbf33de55396f -F src/main.c d7415cd68121ef24c2e76b9e81ec96ffc90e6517 +F src/main.c be9309f442ec291177642d2e48e82290e0951f4b F src/malloc.c 1443d1ad95d67c21d77af7ae3f44678252f0efec F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 6919bcf12f221868ea066eec27e579fed95ce98b @@ -351,15 +351,15 @@ F src/resolve.c b8f7174e5f8c33c44ded3a25a973d0bb89228c20 F src/rowset.c 9fe4b3ad7cc00944386bb600233d8f523de07a6e F src/select.c 1bacfde7b7cec134d2b354cbcf67bafc67078431 F src/shell.c 89b73e894e737cc2f21e4bce0feb3ea21cc61124 -F src/sqlite.h.in 42203c6bf167b8b13c4e6637cbdf8ad2cb2f8685 +F src/sqlite.h.in 6bf029bcb077c6db633a77b7fda5ffd5b7c950b7 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d -F src/sqliteInt.h b9ac8b9c9798f57d80a9756f86abf1dbd9424ec9 +F src/sqliteInt.h 63c0e1b5b5d608a1ba2303fe3a554b859a120406 F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9 F src/tclsqlite.c 13debcc6a5ca1217486f8903768c01114fbe8b58 -F src/test1.c 8b17b1ff53aad71e7f9318a2fda247beddeaa601 +F src/test1.c f14a6f9e2cff6cba4d83e2b0c52857f61886cead F src/test2.c 5586f43fcd9a1be0830793cf9d354082c261b25b F src/test3.c a8887dabbbee3059af338f20d290084a63ed1b0f F src/test4.c d168f83cc78d02e8d35567bb5630e40dcd85ac1e @@ -373,7 +373,7 @@ F src/test_autoext.c dea8a01a7153b9adc97bd26161e4226329546e12 F src/test_backup.c 2e6e6a081870150f20c526a2e9d0d29cda47d803 F src/test_blob.c b2551a9b5573232db5f66f292307c37067937239 F src/test_btree.c 2e9978eca99a9a4bfa8cae949efb00886860a64f -F src/test_config.c 7985332c806d1cece793475c75a6abcccde9d331 +F src/test_config.c 0dee90328e3dedf8ba002ee94b6a7e7ea7726fe4 F src/test_demovfs.c 0de72c2c89551629f58486fde5734b7d90758852 F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc F src/test_fs.c f10f840ca4f8c72e4837908bd8347ac4bcab074b @@ -698,7 +698,7 @@ F test/fts3al.test 07d64326e79bbdbab20ee87fc3328fbf01641c9f F test/fts3am.test 218aa6ba0dfc50c7c16b2022aac5c6be593d08d8 F test/fts3an.test a49ccadc07a2f7d646ec1b81bc09da2d85a85b18 F test/fts3ao.test 3e4e3d5e75c076520341d0bdf4eb17c00e8cbde2 -F test/fts3atoken.test 76262be798f23a390717d14266f0df551e52a7ee +F test/fts3atoken.test 4b4c16fdcfc972f2cdbba212375a060a86ccf5f1 F test/fts3auto.test b981fea19b132b4e6878f50d7c1f369b28f68eb9 F test/fts3aux1.test f8f287a4a73f381f8fa15b6a70f36245f903d221 F test/fts3aux2.test 7ae2b2c13aefdf4169279a27a5f51780ce57f6ba @@ -745,7 +745,7 @@ F test/fts4docid.test e33c383cfbdff0284685604d256f347a18fdbf01 F test/fts4growth.test 60d6bb3f78e25b34f533797dd9f2f9402310a13a F test/fts4growth2.test 13ad4e76451af6e6906c95cdc725d01b00044269 F test/fts4incr.test 4e353a0bd886ea984e56fce9e77724fc923b8d0d -F test/fts4langid.test 8bd8759e0d4b04d71771544b861193a6841fee84 +F test/fts4langid.test 9794addcc8faaee85ac60eceecdb52feb0c70f68 F test/fts4merge.test c424309743fdd203f8e56a1f1cd7872cd66cc0ee F test/fts4merge2.test 5faa558d1b672f82b847d2a337465fa745e46891 F test/fts4merge3.test aab02a09f50fe6baaddc2e159c3eabc116d45fc7 @@ -1450,7 +1450,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3ef6a3153267d5328202fea24fd29ff4d5409295 -R 77993d5bd700ce83f039b073c94a1fa4 +P ff3d7f845e1875d6729f64f5231db1c376892f31 +R 31d803939428fd2d10225002a384e77a U drh -Z 9609a7717e93d89e1b3f63c437689c08 +Z 2070e36304d2e6c69aaa4c28fc3295af diff --git a/manifest.uuid b/manifest.uuid index af3baca687..dcf6861a1e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ff3d7f845e1875d6729f64f5231db1c376892f31 \ No newline at end of file +374b5108087a2eae03676c0f3469b37a272145bf \ No newline at end of file diff --git a/src/main.c b/src/main.c index 4ffc426b08..2a258da662 100644 --- a/src/main.c +++ b/src/main.c @@ -796,8 +796,9 @@ int sqlite3_db_config(sqlite3 *db, int op, ...){ int op; /* The opcode */ u32 mask; /* Mask of the bit in sqlite3.flags to set/clear */ } aFlagOp[] = { - { SQLITE_DBCONFIG_ENABLE_FKEY, SQLITE_ForeignKeys }, - { SQLITE_DBCONFIG_ENABLE_TRIGGER, SQLITE_EnableTrigger }, + { SQLITE_DBCONFIG_ENABLE_FKEY, SQLITE_ForeignKeys }, + { SQLITE_DBCONFIG_ENABLE_TRIGGER, SQLITE_EnableTrigger }, + { SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, SQLITE_Fts3Tokenizer }, }; unsigned int i; rc = SQLITE_ERROR; /* IMP: R-42790-23372 */ @@ -2811,6 +2812,9 @@ static int openDatabase( #endif #if defined(SQLITE_ENABLE_OVERSIZE_CELL_CHECK) | SQLITE_CellSizeCk +#endif +#if defined(SQLITE_ENABLE_FTS3_TOKENIZER) + | SQLITE_Fts3Tokenizer #endif ; sqlite3HashInit(&db->aCollSeq); diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 829eeb86ce..60e2e3b61c 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -1904,11 +1904,25 @@ struct sqlite3_mem_methods { ** following this call. The second parameter may be a NULL pointer, in ** which case the trigger setting is not reported back. ** +**
SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
+**
^This option is used to enable or disable the two-argument +** version of the [fts3_tokenizer()] function which is part of the +** [FTS3] full-text search engine extension. +** There should be two additional arguments. +** The first argument is an integer which is 0 to disable fts3_tokenizer() or +** positive to enable fts3_tokenizer() or negative to leave the setting +** unchanged. +** The second parameter is a pointer to an integer into which +** is written 0 or 1 to indicate whether fts3_tokenizer is disabled or enabled +** following this call. The second parameter may be a NULL pointer, in +** which case the new setting is not reported back.
+** ** */ -#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ -#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ -#define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ +#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ +#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ +#define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ +#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */ /* diff --git a/src/sqliteInt.h b/src/sqliteInt.h index a62ffb6b69..759d7ca5e1 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1327,6 +1327,7 @@ struct sqlite3 { #define SQLITE_VdbeEQP 0x04000000 /* Debug EXPLAIN QUERY PLAN */ #define SQLITE_Vacuum 0x08000000 /* Currently in a VACUUM */ #define SQLITE_CellSizeCk 0x10000000 /* Check btree cell sizes on load */ +#define SQLITE_Fts3Tokenizer 0x20000000 /* Enable fts3_tokenizer(2) */ /* diff --git a/src/test1.c b/src/test1.c index 713152b824..744b400b2a 100644 --- a/src/test1.c +++ b/src/test1.c @@ -6920,6 +6920,53 @@ static int test_register_dbstat_vtab( #endif /* SQLITE_OMIT_VIRTUALTABLE */ } +/* +** tclcmd: sqlite3_db_config DB SETTING VALUE +** +** Invoke sqlite3_db_config() for one of the setting values. +*/ +static int test_sqlite3_db_config( + void *clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[] +){ + static const struct { + const char *zName; + int eVal; + } aSetting[] = { + { "FKEY", SQLITE_DBCONFIG_ENABLE_FKEY }, + { "TRIGGER", SQLITE_DBCONFIG_ENABLE_TRIGGER }, + { "FTS3_TOKENIZER", SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER }, + }; + int i; + int v; + const char *zSetting; + sqlite3 *db; + + if( objc!=4 ){ + Tcl_WrongNumArgs(interp, 1, objv, "DB SETTING VALUE"); + return TCL_ERROR; + } + if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; + zSetting = Tcl_GetString(objv[2]); + if( sqlite3_strglob("SQLITE_*", zSetting)==0 ) zSetting += 7; + if( sqlite3_strglob("DBCONFIG_*", zSetting)==0 ) zSetting += 9; + if( sqlite3_strglob("ENABLE_*", zSetting)==0 ) zSetting += 7; + for(i=0; i=ArraySize(aSetting) ){ + Tcl_SetObjResult(interp, + Tcl_NewStringObj("unknown sqlite3_db_config setting", -1)); + return TCL_ERROR; + } + if( Tcl_GetIntFromObj(interp, objv[3], &v) ) return TCL_ERROR; + sqlite3_db_config(db, aSetting[i].eVal, v, &v); + Tcl_SetObjResult(interp, Tcl_NewIntObj(v)); + return TCL_OK; +} + /* ** Register commands with the TCL interpreter. */ @@ -6989,6 +7036,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ Tcl_ObjCmdProc *xProc; void *clientData; } aObjCmd[] = { + { "sqlite3_db_config", test_sqlite3_db_config, 0 }, { "bad_behavior", test_bad_behavior, (void*)&iZero }, { "register_dbstat_vtab", test_register_dbstat_vtab }, { "sqlite3_connection_pointer", get_sqlite_pointer, 0 }, diff --git a/src/test_config.c b/src/test_config.c index 5db7117555..30b421e00b 100644 --- a/src/test_config.c +++ b/src/test_config.c @@ -370,12 +370,6 @@ static void set_options(Tcl_Interp *interp){ Tcl_SetVar2(interp, "sqlite_options", "fts3", "0", TCL_GLOBAL_ONLY); #endif -#ifdef SQLITE_ENABLE_FTS3_TOKENIZER - Tcl_SetVar2(interp, "sqlite_options", "fts3_tokenizer", "1", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "fts3_tokenizer", "0", TCL_GLOBAL_ONLY); -#endif - #ifdef SQLITE_ENABLE_FTS5 Tcl_SetVar2(interp, "sqlite_options", "fts5", "1", TCL_GLOBAL_ONLY); #else diff --git a/test/fts3atoken.test b/test/fts3atoken.test index 2cdea79a98..4ce38762d6 100644 --- a/test/fts3atoken.test +++ b/test/fts3atoken.test @@ -56,40 +56,41 @@ proc escape_string {str} { # # 5: Test that the table created to use tokenizer 'blah' is usable. # -ifcapable fts3_tokenizer { - do_test fts3atoken-1.1 { - catchsql { - CREATE VIRTUAL TABLE t1 USING fts3(content, tokenize blah); - } - } {1 {unknown tokenizer: blah}} - do_test fts3atoken-1.2 { - execsql { - SELECT fts3_tokenizer('blah', fts3_tokenizer('simple')) IS NULL; - } - } {0} - do_test fts3atoken-1.3 { - execsql { - SELECT fts3_tokenizer('blah') == fts3_tokenizer('simple'); - } - } {1} - do_test fts3atoken-1.4 { - catchsql { - CREATE VIRTUAL TABLE t1 USING fts3(content, tokenize blah); - } - } {0 {}} - do_test fts3atoken-1.5 { - execsql { - INSERT INTO t1(content) VALUES('There was movement at the station'); - INSERT INTO t1(content) VALUES('For the word has passed around'); - INSERT INTO t1(content) VALUES('That the colt from ol regret had got'); - SELECT content FROM t1 WHERE content MATCH 'movement' - } - } {{There was movement at the station}} -} else { - do_catchsql_test 1.6 { +sqlite3_db_config db SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1 +do_test fts3atoken-1.1 { + catchsql { + CREATE VIRTUAL TABLE t1 USING fts3(content, tokenize blah); + } +} {1 {unknown tokenizer: blah}} +do_test fts3atoken-1.2 { + execsql { SELECT fts3_tokenizer('blah', fts3_tokenizer('simple')) IS NULL; - } {1 {fts3tokenize: disabled - rebuild with -DSQLITE_ENABLE_FTS3_TOKENIZER}} -} + } +} {0} +do_test fts3atoken-1.3 { + execsql { + SELECT fts3_tokenizer('blah') == fts3_tokenizer('simple'); + } +} {1} +do_test fts3atoken-1.4 { + catchsql { + CREATE VIRTUAL TABLE t1 USING fts3(content, tokenize blah); + } +} {0 {}} +do_test fts3atoken-1.5 { + execsql { + INSERT INTO t1(content) VALUES('There was movement at the station'); + INSERT INTO t1(content) VALUES('For the word has passed around'); + INSERT INTO t1(content) VALUES('That the colt from ol regret had got'); + SELECT content FROM t1 WHERE content MATCH 'movement' + } +} {{There was movement at the station}} + +sqlite3_db_config db SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 0 +do_catchsql_test 1.6 { + SELECT fts3_tokenizer('blah', fts3_tokenizer('simple')) IS NULL; +} {1 {fts3tokenize disabled}} + #-------------------------------------------------------------------------- # Test cases fts3atoken-2.* test error cases in the scalar function based @@ -212,14 +213,14 @@ do_catchsql_test 6.1.3 { do_catchsql_test 6.2.1 { SELECT fts3_tokenizer(NULL); } {1 {unknown tokenizer: }} -ifcapable fts3_tokenizer { - do_catchsql_test 6.2.2 { - SELECT fts3_tokenizer(NULL, X'1234567812345678'); - } {1 {argument type mismatch}} - do_catchsql_test 6.2.3 { - SELECT fts3_tokenizer(NULL, X'12345678'); - } {1 {argument type mismatch}} -} + +sqlite3_db_config db SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1 +do_catchsql_test 6.2.2 { + SELECT fts3_tokenizer(NULL, X'1234567812345678'); +} {1 {argument type mismatch}} +do_catchsql_test 6.2.3 { + SELECT fts3_tokenizer(NULL, X'12345678'); +} {1 {argument type mismatch}} finish_test diff --git a/test/fts4langid.test b/test/fts4langid.test index a3059931e7..eb3602b4b8 100644 --- a/test/fts4langid.test +++ b/test/fts4langid.test @@ -358,31 +358,30 @@ proc build_multilingual_db_2 {db} { } } -ifcapable fts3_tokenizer { - do_test 4.1.0 { - reset_db - set ptr [fts3_test_tokenizer] - execsql { SELECT fts3_tokenizer('testtokenizer', $ptr) } - build_multilingual_db_2 db - } {} - do_execsql_test 4.1.1 { - SELECT docid FROM t4 WHERE t4 MATCH 'quick'; - } {0} - do_execsql_test 4.1.2 { - SELECT docid FROM t4 WHERE t4 MATCH 'quick' AND lid=1; - } {} - do_execsql_test 4.1.3 { - SELECT docid FROM t4 WHERE t4 MATCH 'Quick' AND lid=1; - } {1} - for {set i 0} {$i < 50} {incr i} { - do_execsql_test 4.1.4.$i { - SELECT count(*) FROM t4 WHERE t4 MATCH 'fox' AND lid=$i; - } [expr 0==($i%2)] - } - do_catchsql_test 4.1.5 { - INSERT INTO t4(content, lid) VALUES('hello world', 101) - } {1 {SQL logic error or missing database}} +do_test 4.1.0 { + reset_db + set ptr [fts3_test_tokenizer] + sqlite3_db_config db SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1 + execsql { SELECT fts3_tokenizer('testtokenizer', $ptr) } + build_multilingual_db_2 db +} {} +do_execsql_test 4.1.1 { + SELECT docid FROM t4 WHERE t4 MATCH 'quick'; +} {0} +do_execsql_test 4.1.2 { + SELECT docid FROM t4 WHERE t4 MATCH 'quick' AND lid=1; +} {} +do_execsql_test 4.1.3 { + SELECT docid FROM t4 WHERE t4 MATCH 'Quick' AND lid=1; +} {1} +for {set i 0} {$i < 50} {incr i} { + do_execsql_test 4.1.4.$i { + SELECT count(*) FROM t4 WHERE t4 MATCH 'fox' AND lid=$i; + } [expr 0==($i%2)] } +do_catchsql_test 4.1.5 { + INSERT INTO t4(content, lid) VALUES('hello world', 101) +} {1 {SQL logic error or missing database}} #------------------------------------------------------------------------- # Test cases 5.* From 38c3d3d8a5369a03ed4d796acd7df3d369f2a9b8 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 26 Feb 2016 16:03:29 +0000 Subject: [PATCH 20/66] Fix the ICU extension LIKE function so that it does not read past the end of a buffer if it it passed malformed utf-8. FossilOrigin-Name: 424b7aee3310b9782bd312589dc3d9f287aa04b8 --- ext/icu/icu.c | 64 +++++++++++++++++++++++++++++++++++++-------------- manifest | 14 +++++------ manifest.uuid | 2 +- 3 files changed, 55 insertions(+), 25 deletions(-) diff --git a/ext/icu/icu.c b/ext/icu/icu.c index a2ff49274c..56543667ca 100644 --- a/ext/icu/icu.c +++ b/ext/icu/icu.c @@ -60,6 +60,38 @@ static void xFree(void *p){ sqlite3_free(p); } +/* +** This lookup table is used to help decode the first byte of +** a multi-byte UTF8 character. It is copied here from SQLite source +** code file utf8.c. +*/ +static const unsigned char icuUtf8Trans1[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x00, 0x00, +}; + +#define SQLITE_ICU_READ_UTF8(zIn, c) \ + c = *(zIn++); \ + if( c>=0xc0 ){ \ + c = icuUtf8Trans1[c-0xc0]; \ + while( (*zIn & 0xc0)==0x80 ){ \ + c = (c<<6) + (0x3f & *(zIn++)); \ + } \ + } + +#define SQLITE_ICU_SKIP_UTF8(zIn) \ + assert( *zIn ); \ + if( *(zIn++)>=0xc0 ){ \ + while( (*zIn & 0xc0)==0x80 ){zIn++;} \ + } + + /* ** Compare two UTF-8 strings for equality where the first string is ** a "LIKE" expression. Return true (1) if they are the same and @@ -73,16 +105,14 @@ static int icuLikeCompare( static const int MATCH_ONE = (UChar32)'_'; static const int MATCH_ALL = (UChar32)'%'; - int iPattern = 0; /* Current byte index in zPattern */ - int iString = 0; /* Current byte index in zString */ - int prevEscape = 0; /* True if the previous character was uEsc */ - while( zPattern[iPattern]!=0 ){ + while( 1 ){ /* Read (and consume) the next character from the input pattern. */ UChar32 uPattern; - U8_NEXT_UNSAFE(zPattern, iPattern, uPattern); + SQLITE_ICU_READ_UTF8(zPattern, uPattern); + if( uPattern==0 ) break; /* There are now 4 possibilities: ** @@ -99,28 +129,28 @@ static int icuLikeCompare( ** MATCH_ALL. For each MATCH_ONE, skip one character in the ** test string. */ - while( (c=zPattern[iPattern]) == MATCH_ALL || c == MATCH_ONE ){ + while( (c=*zPattern) == MATCH_ALL || c == MATCH_ONE ){ if( c==MATCH_ONE ){ - if( zString[iString]==0 ) return 0; - U8_FWD_1_UNSAFE(zString, iString); + if( *zString==0 ) return 0; + SQLITE_ICU_SKIP_UTF8(zString); } - iPattern++; + zPattern++; } - if( zPattern[iPattern]==0 ) return 1; + if( *zPattern==0 ) return 1; - while( zString[iString] ){ - if( icuLikeCompare(&zPattern[iPattern], &zString[iString], uEsc) ){ + while( *zString ){ + if( icuLikeCompare(zPattern, zString, uEsc) ){ return 1; } - U8_FWD_1_UNSAFE(zString, iString); + SQLITE_ICU_SKIP_UTF8(zString); } return 0; }else if( !prevEscape && uPattern==MATCH_ONE ){ /* Case 2. */ - if( zString[iString]==0 ) return 0; - U8_FWD_1_UNSAFE(zString, iString); + if( *zString==0 ) return 0; + SQLITE_ICU_SKIP_UTF8(zString); }else if( !prevEscape && uPattern==uEsc){ /* Case 3. */ @@ -129,7 +159,7 @@ static int icuLikeCompare( }else{ /* Case 4. */ UChar32 uString; - U8_NEXT_UNSAFE(zString, iString, uString); + SQLITE_ICU_READ_UTF8(zString, uString); uString = u_foldCase(uString, U_FOLD_CASE_DEFAULT); uPattern = u_foldCase(uPattern, U_FOLD_CASE_DEFAULT); if( uString!=uPattern ){ @@ -139,7 +169,7 @@ static int icuLikeCompare( } } - return zString[iString]==0; + return *zString==0; } /* diff --git a/manifest b/manifest index b196f4d2fb..046a24e640 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Provide\sthe\snew\sSQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER\soption\sto\s\nsqlite3_db_config()\sthat\scan\sbe\sused\sto\sactivate\sthe\stwo-argument\sversion\nof\sfts3_tokenizer()\sfor\sa\sspecific\sdatabase\sconnection\sat\srun-time. -D 2016-02-26T15:38:24.549 +C Fix\sthe\sICU\sextension\sLIKE\sfunction\sso\sthat\sit\sdoes\snot\sread\spast\sthe\send\sof\sa\sbuffer\sif\sit\sit\spassed\smalformed\sutf-8. +D 2016-02-26T16:03:29.500 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 @@ -198,7 +198,7 @@ F ext/fts5/tool/loadfts5.tcl 95b03429ee6b138645703c6ca192c3ac96eaf093 F ext/fts5/tool/mkfts5c.tcl d1c2a9ab8e0ec690a52316f33dd9b1d379942f45 F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/icu/README.txt d9fbbad0c2f647c3fdf715fc9fd64af53aedfc43 -F ext/icu/icu.c b2732aef0b076e4276d9b39b5a33cec7a05e1413 +F ext/icu/icu.c 194e972ff3545084b56c459131eb80e1485da75e F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37 F ext/misc/amatch.c a1a8f66c29d40bd71b075546ddeddb477b17a2bb F ext/misc/closure.c 0d2a038df8fbae7f19de42e7c7d71f2e4dc88704 @@ -1450,7 +1450,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P ff3d7f845e1875d6729f64f5231db1c376892f31 -R 31d803939428fd2d10225002a384e77a -U drh -Z 2070e36304d2e6c69aaa4c28fc3295af +P 374b5108087a2eae03676c0f3469b37a272145bf +R 1de55b3a8f2d3749e97e04af07972bbe +U dan +Z 5dfcb2d8f6d42b01529359e44d97d92b diff --git a/manifest.uuid b/manifest.uuid index dcf6861a1e..b891f1a561 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -374b5108087a2eae03676c0f3469b37a272145bf \ No newline at end of file +424b7aee3310b9782bd312589dc3d9f287aa04b8 \ No newline at end of file From 9b88ace82262165380f88befc0aad6beeef33ff0 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Fri, 26 Feb 2016 21:01:37 +0000 Subject: [PATCH 21/66] Further refinements to the MSVC batch build process. FossilOrigin-Name: 4e54e9c0fefe417f94a2d95921acf61b1dda5ca4 --- Makefile.msc | 42 +++++++++++++++++++++++++----------------- autoconf/Makefile.msc | 14 +++++++++----- manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 42 insertions(+), 30 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index d84df8345e..8a6d7fd954 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -472,20 +472,24 @@ CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) # when linking. # !IFNDEF CORE_LINK_DEP -!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0 +!IF $(DYNAMIC_SHELL)!=0 CORE_LINK_DEP = -!ELSE +!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86" CORE_LINK_DEP = sqlite3.def +!ELSE +CORE_LINK_DEP = !ENDIF !ENDIF # These are additional linker options used for the core library. # !IFNDEF CORE_LINK_OPTS -!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0 +!IF $(DYNAMIC_SHELL)!=0 CORE_LINK_OPTS = -!ELSE +!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86" CORE_LINK_OPTS = /DEF:sqlite3.def +!ELSE +CORE_LINK_OPTS = !ENDIF !ENDIF @@ -1387,11 +1391,11 @@ all: dll libsqlite3.lib shell $(ALL_TCL_TARGETS) # Dynamic link library section. # -dll: $(SQLITE3DLL) +dll: $(SQLITE3DLL) # Shell executable. # -shell: $(SQLITE3EXE) +shell: $(SQLITE3EXE) # <> libsqlite3.lib: $(LIBOBJ) @@ -1401,14 +1405,14 @@ libtclsqlite3.lib: tclsqlite.lo libsqlite3.lib $(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCLSTUB) $(TLIBS) # <> -$(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP) +$(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP) $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS) # <> -sqlite3.def: libsqlite3.lib +sqlite3.def: libsqlite3.lib echo EXPORTS > sqlite3.def dumpbin /all libsqlite3.lib \ - | $(TCLSH_CMD) $(TOP)\tool\replace.tcl include "^\s+1 _?(sqlite3_.*)$$" \1 \ + | $(TCLSH_CMD) $(TOP)\tool\replace.tcl include "^\s+1 _?(sqlite3_[^@]*)(?:@\d+)?$$" \1 \ | sort >> sqlite3.def # <> @@ -1784,7 +1788,7 @@ parse.c: $(TOP)\src\parse.y lemon.exe $(TOP)\tool\addopcodes.tcl $(SQLITE3H): $(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION $(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > $(SQLITE3H) -sqlite3ext.h: .target_source +sqlite3ext.h: .target_source copy tsrc\sqlite3ext.h . mkkeywordhash.exe: $(TOP)\tool\mkkeywordhash.c @@ -1885,9 +1889,9 @@ fts5parse.c: $(TOP)\ext\fts5\fts5parse.y lemon.exe del /Q fts5parse.h 2>NUL .\lemon.exe $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS) $(OPTS) fts5parse.y -fts5parse.h: fts5parse.c +fts5parse.h: fts5parse.c -fts5.c: $(FTS5_SRC) +fts5.c: $(FTS5_SRC) $(TCLSH_CMD) $(TOP)\ext\fts5\tool\mkfts5c.tcl copy $(TOP)\ext\fts5\fts5.h . @@ -1928,7 +1932,7 @@ testfixture.exe: $(TESTFIXTURE_SRC) $(SQLITE3H) $(LIBRESOBJS) $(HDR) $(TESTFIXTURE_SRC) \ /link $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS) -extensiontest: testfixture.exe testloadext.dll +extensiontest: testfixture.exe testloadext.dll @set PATH=$(LIBTCLPATH);$(PATH) .\testfixture.exe $(TOP)\test\loadext.test $(TESTOPTS) @@ -1971,7 +1975,7 @@ smoketest: $(TESTPROGS) @set PATH=$(LIBTCLPATH);$(PATH) .\testfixture.exe $(TOP)\test\main.test $(TESTOPTS) -sqlite3_analyzer.c: $(SQLITE3C) $(SQLITE3H) $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl +sqlite3_analyzer.c: $(SQLITE3C) $(SQLITE3H) $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl echo #define TCLSH 2 > $@ echo #define SQLITE_ENABLE_DBSTAT_VTAB 1 >> $@ copy $@ + $(SQLITE3C) + $(TOP)\src\tclsqlite.c $@ @@ -1987,7 +1991,7 @@ sqlite3_analyzer.exe: sqlite3_analyzer.c $(LIBRESOBJS) testloadext.lo: $(TOP)\src\test_loadext.c $(LTCOMPILE) $(NO_WARN) -c $(TOP)\src\test_loadext.c -testloadext.dll: testloadext.lo +testloadext.dll: testloadext.lo $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /OUT:$@ testloadext.lo showdb.exe: $(TOP)\tool\showdb.c $(SQLITE3C) $(SQLITE3H) @@ -2025,9 +2029,12 @@ speedtest1.exe: $(TOP)\test\speedtest1.c $(SQLITE3C) $(SQLITE3H) $(LTLINK) $(NO_WARN) -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \ $(TOP)\test\speedtest1.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS) -rbu.exe: $(TOP)\ext\rbu\rbu.c $(TOP)\ext\rbu\sqlite3rbu.c $(SQLITE3C) $(SQLITE3H) +rbu.exe: $(TOP)\ext\rbu\rbu.c $(TOP)\ext\rbu\sqlite3rbu.c $(SQLITE3C) $(SQLITE3H) $(LTLINK) $(NO_WARN) -DSQLITE_ENABLE_RBU -Fe$@ \ $(TOP)\ext\rbu\rbu.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS) + +moreclean: clean + del /Q $(SQLITE3C) $(SQLITE3H) 2>NUL # <> clean: @@ -2035,7 +2042,8 @@ clean: del /Q *.bsc *.def *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL del /Q $(SQLITE3EXE) $(SQLITE3DLL) 2>NUL # <> - del /Q $(SQLITE3C) $(SQLITE3H) opcodes.c opcodes.h 2>NUL + del /Q sqlite3.c sqlite3.h 2>NUL + del /Q opcodes.c opcodes.h 2>NUL del /Q lemon.* lempar.c parse.* 2>NUL del /Q mkkeywordhash.* keywordhash.h 2>NUL del /Q notasharedlib.* 2>NUL diff --git a/autoconf/Makefile.msc b/autoconf/Makefile.msc index 52f0d91e0c..ca7c62e3d4 100644 --- a/autoconf/Makefile.msc +++ b/autoconf/Makefile.msc @@ -457,7 +457,9 @@ CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) # when linking. # !IFNDEF CORE_LINK_DEP -!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0 +!IF $(DYNAMIC_SHELL)!=0 +CORE_LINK_DEP = +!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86" CORE_LINK_DEP = !ELSE CORE_LINK_DEP = @@ -467,7 +469,9 @@ CORE_LINK_DEP = # These are additional linker options used for the core library. # !IFNDEF CORE_LINK_OPTS -!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0 +!IF $(DYNAMIC_SHELL)!=0 +CORE_LINK_OPTS = +!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86" CORE_LINK_OPTS = !ELSE CORE_LINK_OPTS = @@ -874,14 +878,14 @@ all: dll shell # Dynamic link library section. # -dll: $(SQLITE3DLL) +dll: $(SQLITE3DLL) # Shell executable. # -shell: $(SQLITE3EXE) +shell: $(SQLITE3EXE) -$(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP) +$(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP) $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS) diff --git a/manifest b/manifest index e8f5966687..5d644993fb 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -C Use\sthe\sarguments\sto\sNMAKE\sconsistently\sin\sthe\sMSVC\sbatch\sbuild\stool. -D 2016-02-19T19:29:44.729 +C Further\srefinements\sto\sthe\sMSVC\sbatch\sbuild\sprocess. +D 2016-02-26T21:01:37.745 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 -F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 +F Makefile.msc 56ea123a975690bf9ed38b31bb89ff87b02a7c2b F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION 866588d1edf0ccb5b0d33896974338f97564f719 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -11,7 +11,7 @@ F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am 29e2a6e8d0c5e32723a48b4faf6b168854dde5f4 -F autoconf/Makefile.msc d5ab32cf30d6ba8b5ce20835b4042f6cc2a4cb39 +F autoconf/Makefile.msc 3cbf11c911fafd4d95fbe8aec059b5aa586a0157 F autoconf/README.first 6c4f34fe115ff55d4e8dbfa3cecf04a0188292f7 F autoconf/README.txt 7c31da66232f7590bb987cfcd4e2381744b25d24 F autoconf/configure.ac 72a5e42beb090b32bca580285dc0ab3c4670adb8 @@ -1427,7 +1427,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh ef6ebc6fd8d2dc35db3b622015c16a023d4fef4f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 66a9ad4a6df513f4c35c3d337d4e2e80cd38d586 -R abade97baee8abed51650334fbde09aa +P 480e5049486b8b047f533d78b040daa47dd6b946 +R 87ed83a4b8ba227fd93efdc4c65e0468 U mistachkin -Z 7b92d09a61d34a4957d04f9633ed77f9 +Z ceeeca002bf9c099753e1f0c14c10004 diff --git a/manifest.uuid b/manifest.uuid index 613e1048a0..a39c79627c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -480e5049486b8b047f533d78b040daa47dd6b946 \ No newline at end of file +4e54e9c0fefe417f94a2d95921acf61b1dda5ca4 \ No newline at end of file From 88a1650859cd828a80261f4c228247fef5635790 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 26 Feb 2016 21:20:57 +0000 Subject: [PATCH 22/66] Fix a potential buffer overflow in the ICU upper() function. FossilOrigin-Name: b8dc1b9f5d413000387bfe784b69f5d0ee5c0489 --- ext/icu/icu.c | 48 ++++++++++++++++++++++++++++-------------------- manifest | 16 ++++++++-------- manifest.uuid | 2 +- test/icu.test | 9 +++++++++ 4 files changed, 46 insertions(+), 29 deletions(-) diff --git a/ext/icu/icu.c b/ext/icu/icu.c index 56543667ca..263cd98275 100644 --- a/ext/icu/icu.c +++ b/ext/icu/icu.c @@ -355,11 +355,11 @@ static void icuRegexpFunc(sqlite3_context *p, int nArg, sqlite3_value **apArg){ */ static void icuCaseFunc16(sqlite3_context *p, int nArg, sqlite3_value **apArg){ const UChar *zInput; - UChar *zOutput; + UChar *zOutput = 0; int nInput; - int nOutput; - - UErrorCode status = U_ZERO_ERROR; + int nOut; + int cnt; + UErrorCode status; const char *zLocale = 0; assert(nArg==1 || nArg==2); @@ -371,26 +371,34 @@ static void icuCaseFunc16(sqlite3_context *p, int nArg, sqlite3_value **apArg){ if( !zInput ){ return; } - nInput = sqlite3_value_bytes16(apArg[0]); - - nOutput = nInput * 2 + 2; - zOutput = sqlite3_malloc(nOutput); - if( !zOutput ){ + nOut = nInput = sqlite3_value_bytes16(apArg[0]); + if( nOut==0 ){ + sqlite3_result_text16(p, "", 0, SQLITE_STATIC); return; } - if( sqlite3_user_data(p) ){ - u_strToUpper(zOutput, nOutput/2, zInput, nInput/2, zLocale, &status); - }else{ - u_strToLower(zOutput, nOutput/2, zInput, nInput/2, zLocale, &status); + for(cnt=0; cnt<2; cnt++){ + UChar *zNew = sqlite3_realloc(zOutput, nOut); + if( zNew==0 ){ + sqlite3_free(zOutput); + sqlite3_result_error_nomem(p); + return; + } + zOutput = zNew; + status = U_ZERO_ERROR; + if( sqlite3_user_data(p) ){ + nOut = 2*u_strToUpper(zOutput,nOut/2,zInput,nInput/2,zLocale,&status); + }else{ + nOut = 2*u_strToLower(zOutput,nOut/2,zInput,nInput/2,zLocale,&status); + } + if( !U_SUCCESS(status) ){ + if( status==U_BUFFER_OVERFLOW_ERROR ) continue; + icuFunctionError(p, + sqlite3_user_data(p) ? "u_strToUpper()" : "u_strToLower", status); + return; + } } - - if( !U_SUCCESS(status) ){ - icuFunctionError(p, "u_strToLower()/u_strToUpper", status); - return; - } - - sqlite3_result_text16(p, zOutput, -1, xFree); + sqlite3_result_text16(p, zOutput, nOut, xFree); } /* diff --git a/manifest b/manifest index 3b14fffa3a..6f2f8535ef 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Further\srefinements\sto\sthe\sMSVC\sbatch\sbuild\sprocess. -D 2016-02-26T21:03:16.418 +C Fix\sa\spotential\sbuffer\soverflow\sin\sthe\sICU\supper()\sfunction. +D 2016-02-26T21:20:57.225 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 56ea123a975690bf9ed38b31bb89ff87b02a7c2b @@ -198,7 +198,7 @@ F ext/fts5/tool/loadfts5.tcl 95b03429ee6b138645703c6ca192c3ac96eaf093 F ext/fts5/tool/mkfts5c.tcl d1c2a9ab8e0ec690a52316f33dd9b1d379942f45 F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/icu/README.txt d9fbbad0c2f647c3fdf715fc9fd64af53aedfc43 -F ext/icu/icu.c 194e972ff3545084b56c459131eb80e1485da75e +F ext/icu/icu.c be1f90d8babafe6d1a55a6912161bcac75baee0e F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37 F ext/misc/amatch.c a1a8f66c29d40bd71b075546ddeddb477b17a2bb F ext/misc/closure.c 0d2a038df8fbae7f19de42e7c7d71f2e4dc88704 @@ -777,7 +777,7 @@ F test/genesis.tcl 1e2e2e8e5cc4058549a154ff1892fe5c9de19f98 F test/hexlit.test d7b0a5f41123df1e43985b91b8b2e70f95282d21 F test/hidden.test 23c1393a79e846d68fd902d72c85d5e5dcf98711 F test/hook.test 162d7cef7a2d2b04839fe14402934e6a1b79442f -F test/icu.test 70df4faca133254c042d02ae342c0a141f2663f4 +F test/icu.test 73956798bace8982909c00476b216714a6d0559a F test/ieee754.test 806fc0ce7f305f57e3331eaceeddcfec9339e607 F test/imposter1.test c3f1db2d3db2c24611a6596a3fc0ffc14f1466c8 F test/in.test 61a24ae38d4b64ec69f06ccdf022992f68a98176 @@ -1450,7 +1450,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 424b7aee3310b9782bd312589dc3d9f287aa04b8 4e54e9c0fefe417f94a2d95921acf61b1dda5ca4 -R 7da9769ad29c99be35565d7e5f8b1154 -U mistachkin -Z 7d4c099032b4aee5af44d708663be688 +P cf4e4fbdb6a29b7fbd5150958ab4f8f2a1cd7f21 +R a5aa0b45f5ae16ce5e364c4bc7498593 +U drh +Z d4cfa74b26d8bc26b2ff43ad0d4d53e2 diff --git a/manifest.uuid b/manifest.uuid index 07b70ce13e..38c7afbca2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cf4e4fbdb6a29b7fbd5150958ab4f8f2a1cd7f21 \ No newline at end of file +b8dc1b9f5d413000387bfe784b69f5d0ee5c0489 \ No newline at end of file diff --git a/test/icu.test b/test/icu.test index 73cb9b913e..743bcfaea1 100644 --- a/test/icu.test +++ b/test/icu.test @@ -72,6 +72,10 @@ test_expr icu-2.6 {i1=$::OGRAVE} {upper(i1)} $::OGRAVE test_expr icu-2.7 {i1=$::szlig} {upper(i1)} "SS" test_expr icu-2.8 {i1='SS'} {lower(i1)} "ss" +do_execsql_test icu-2.9 { + SELECT upper(char(0xfb04,0xfb04,0xfb04,0xfb04)); +} {FFLFFLFFLFFL} + # In turkish (locale="tr_TR"), the lower case version of I # is "small dotless i" (code point 0x131 (decimal 305)). # @@ -133,4 +137,9 @@ do_catchsql_test icu-5.4 { do_catchsql_test icu-5.4 { SELECT 'abc' REGEXP } {1 {near " ": syntax error}} do_catchsql_test icu-5.5 { SELECT 'abc' REGEXP, 1 } {1 {near ",": syntax error}} + +do_malloc_test icu-6.10 -sqlbody { + SELECT upper(char(0xfb04,0xdf,0xfb04,0xe8,0xfb04)); +} + finish_test From 9aeb971ceb39390e388d3c6946be9b11f74e9955 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Fri, 26 Feb 2016 23:13:16 +0000 Subject: [PATCH 23/66] Support generating the '.def' file using the autoconf Makefile for MSVC. FossilOrigin-Name: 3617564cb630ed418badf43d2c0291c11c166d12 --- Makefile.msc | 12 ++- autoconf/Makefile.msc | 20 +++- autoconf/README.txt | 4 +- manifest | 23 +++-- manifest.uuid | 2 +- tool/Replace.cs | 223 +++++++++++++++++++++++++++++++++++++++++ tool/mkautoconfamal.sh | 1 + tool/mkmsvcmin.tcl | 17 +++- 8 files changed, 282 insertions(+), 20 deletions(-) create mode 100644 tool/Replace.cs diff --git a/Makefile.msc b/Makefile.msc index 8a6d7fd954..db9c83c6c7 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -306,6 +306,14 @@ PROGRAMFILES_X86 = $(PROGRAMFILES_X86:\\=\) CC = cl.exe !ENDIF +# Check for the predefined command macro CSC. This should point to a working +# C Sharp compiler binary. If it is not defined, simply define it to the +# legacy default value 'csc.exe'. +# +!IFNDEF CSC +CSC = csc.exe +!ENDIF + # Check for the command macro LD. This should point to the linker binary for # the target platform. If it is not defined, simply define it to the legacy # default value 'link.exe'. @@ -1408,13 +1416,13 @@ libtclsqlite3.lib: tclsqlite.lo libsqlite3.lib $(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP) $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS) -# <> +# <> sqlite3.def: libsqlite3.lib echo EXPORTS > sqlite3.def dumpbin /all libsqlite3.lib \ | $(TCLSH_CMD) $(TOP)\tool\replace.tcl include "^\s+1 _?(sqlite3_[^@]*)(?:@\d+)?$$" \1 \ | sort >> sqlite3.def -# <> +# <> $(SQLITE3EXE): $(TOP)\src\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H) $(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) $(TOP)\src\shell.c $(SHELL_CORE_SRC) \ diff --git a/autoconf/Makefile.msc b/autoconf/Makefile.msc index ca7c62e3d4..b453b93c33 100644 --- a/autoconf/Makefile.msc +++ b/autoconf/Makefile.msc @@ -291,6 +291,14 @@ PROGRAMFILES_X86 = $(PROGRAMFILES_X86:\\=\) CC = cl.exe !ENDIF +# Check for the predefined command macro CSC. This should point to a working +# C Sharp compiler binary. If it is not defined, simply define it to the +# legacy default value 'csc.exe'. +# +!IFNDEF CSC +CSC = csc.exe +!ENDIF + # Check for the command macro LD. This should point to the linker binary for # the target platform. If it is not defined, simply define it to the legacy # default value 'link.exe'. @@ -460,7 +468,7 @@ CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) !IF $(DYNAMIC_SHELL)!=0 CORE_LINK_DEP = !ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86" -CORE_LINK_DEP = +CORE_LINK_DEP = sqlite3.def !ELSE CORE_LINK_DEP = !ENDIF @@ -472,7 +480,7 @@ CORE_LINK_DEP = !IF $(DYNAMIC_SHELL)!=0 CORE_LINK_OPTS = !ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86" -CORE_LINK_OPTS = +CORE_LINK_OPTS = /DEF:sqlite3.def !ELSE CORE_LINK_OPTS = !ENDIF @@ -888,6 +896,14 @@ shell: $(SQLITE3EXE) $(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP) $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS) +Replace.exe: + $(CSC) /target:exe $(TOP)\Replace.cs + +sqlite3.def: Replace.exe $(LIBOBJ) + echo EXPORTS > sqlite3.def + dumpbin /all $(LIBOBJ) \ + | .\Replace.exe "^\s+/EXPORT:_?(sqlite3_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \ + | sort >> sqlite3.def $(SQLITE3EXE): $(TOP)\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H) $(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) $(TOP)\shell.c $(SHELL_CORE_SRC) \ diff --git a/autoconf/README.txt b/autoconf/README.txt index 2d6db4f07f..6e62a4e138 100644 --- a/autoconf/README.txt +++ b/autoconf/README.txt @@ -6,8 +6,8 @@ This package contains: * the shell.c file used to build the sqlite3 command-line shell program * autoconf/automake installation infrastucture for building on POSIX compliant systems - * a Makefile.msc and sqlite3.rc for building with Microsoft Visual C++ on - Windows + * a Makefile.msc, sqlite3.rc, and Replace.cs for building with Microsoft + Visual C++ on Windows SUMMARY OF HOW TO BUILD ======================= diff --git a/manifest b/manifest index 6f2f8535ef..1c5c27a015 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -C Fix\sa\spotential\sbuffer\soverflow\sin\sthe\sICU\supper()\sfunction. -D 2016-02-26T21:20:57.225 +C Support\sgenerating\sthe\s'.def'\sfile\susing\sthe\sautoconf\sMakefile\sfor\sMSVC. +D 2016-02-26T23:13:16.711 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 -F Makefile.msc 56ea123a975690bf9ed38b31bb89ff87b02a7c2b +F Makefile.msc b6eb7a434c2e160a042036bd5047c3bd89eedacc F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION c6b1f51809551d60ad001e6d87cf3ab2c7f54b6f F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -11,9 +11,9 @@ F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am 29e2a6e8d0c5e32723a48b4faf6b168854dde5f4 -F autoconf/Makefile.msc 3cbf11c911fafd4d95fbe8aec059b5aa586a0157 +F autoconf/Makefile.msc 91fe02447e4a90b9368b2b1406d51ee5f7e83c6a F autoconf/README.first 6c4f34fe115ff55d4e8dbfa3cecf04a0188292f7 -F autoconf/README.txt 7c31da66232f7590bb987cfcd4e2381744b25d24 +F autoconf/README.txt 4f04b0819303aabaa35fff5f7b257fb0c1ef95f1 F autoconf/configure.ac 72a5e42beb090b32bca580285dc0ab3c4670adb8 F autoconf/tea/Makefile.in b438a7020446c8a8156e8d97c8914a04833da6fd F autoconf/tea/README 3e9a3c060f29a44344ab50aec506f4db903fb873 @@ -1368,6 +1368,7 @@ F test/zeroblob.test 3857870fe681b8185654414a9bccfde80b62a0fa F test/zerodamage.test cf6748bad89553cc1632be51a6f54e487e4039ac F tool/GetFile.cs a15e08acb5dd7539b75ba23501581d7c2b462cb5 F tool/GetTclKit.bat 629d87562e0487c386db630033931d12d62e6372 +F tool/Replace.cs 02c67258801c2fb5f63231e0ac0f220b4b36ba91 F tool/addopcodes.tcl 4ca9c3ef196f08da30add5d07ce0c9458dc8c633 F tool/build-all-msvc.bat 55be1cf8545dabd69df2ba6b3de6868da0c26f52 x F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367 @@ -1384,9 +1385,9 @@ F tool/lemon.c 251f5c3f21b553240cbdd42dd187a51bb2372cd3 F tool/lempar.c d5114c7d13aa3af1e27ff3d02e4dea6eadec7ddf F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862 F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6 -F tool/mkautoconfamal.sh c78caa3214f25dc28ea157b5a82abb311f209906 +F tool/mkautoconfamal.sh e855df211ecbcc7131dee817110ff386cfb112f7 F tool/mkkeywordhash.c f7f3b342211ac6a14258b9726d5b97cf4f548f22 -F tool/mkmsvcmin.tcl f9fc6f6a373084c0e0feef972485212bd0869c06 +F tool/mkmsvcmin.tcl 2f12f7fa8858bbe61cf81820a2da96c79ed1ca8d F tool/mkopcodec.tcl d1b6362bd3aa80d5520d4d6f3765badf01f6c43c F tool/mkopcodeh.tcl 385c62d78c38b2d92146dcb5abd319dbbc33506d F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e @@ -1450,7 +1451,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P cf4e4fbdb6a29b7fbd5150958ab4f8f2a1cd7f21 -R a5aa0b45f5ae16ce5e364c4bc7498593 -U drh -Z d4cfa74b26d8bc26b2ff43ad0d4d53e2 +P b8dc1b9f5d413000387bfe784b69f5d0ee5c0489 +R e824451697993aa684f279d9331c397b +U mistachkin +Z bb33bef608d1de79741a7de07ef806b0 diff --git a/manifest.uuid b/manifest.uuid index 38c7afbca2..3c4acbdac1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b8dc1b9f5d413000387bfe784b69f5d0ee5c0489 \ No newline at end of file +3617564cb630ed418badf43d2c0291c11c166d12 \ No newline at end of file diff --git a/tool/Replace.cs b/tool/Replace.cs new file mode 100644 index 0000000000..3475a47e6e --- /dev/null +++ b/tool/Replace.cs @@ -0,0 +1,223 @@ +/* +** 2016 February 26 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains C# code to perform regular expression replacements +** using the standard input and output channels. +*/ + +using System; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Text.RegularExpressions; + +/////////////////////////////////////////////////////////////////////////////// + +#region Assembly Metadata +[assembly: AssemblyTitle("Replace Tool")] +[assembly: AssemblyDescription("Replace text using standard input/output.")] +[assembly: AssemblyCompany("SQLite Development Team")] +[assembly: AssemblyProduct("SQLite")] +[assembly: AssemblyCopyright("Public Domain")] +[assembly: ComVisible(false)] +[assembly: Guid("95a0513f-8863-48cd-a76f-cb80868cb578")] +[assembly: AssemblyVersion("1.0.*")] + +#if DEBUG +[assembly: AssemblyConfiguration("Debug")] +#else +[assembly: AssemblyConfiguration("Release")] +#endif +#endregion + +/////////////////////////////////////////////////////////////////////////////// + +namespace Replace +{ + /// + /// This enumeration is used to represent all the possible exit codes from + /// this tool. + /// + internal enum ExitCode + { + /// + /// The file download was a success. + /// + Success = 0, + + /// + /// The command line arguments are missing (i.e. null). Generally, + /// this should not happen. + /// + MissingArgs = 1, + + /// + /// The wrong number of command line arguments was supplied. + /// + WrongNumArgs = 2, + + /// + /// The "matchingOnly" flag could not be converted to a value of the + /// type. + /// + BadMatchingOnlyFlag = 3, + + /// + /// An exception was caught in . Generally, this + /// should not happen. + /// + Exception = 4 + } + + /////////////////////////////////////////////////////////////////////////// + + internal static class Replace + { + #region Private Support Methods + /// + /// This method displays an error message to the console and/or + /// displays the command line usage information for this tool. + /// + /// + /// The error message to display, if any. + /// + /// + /// Non-zero to display the command line usage information. + /// + private static void Error( + string message, + bool usage + ) + { + if (message != null) + Console.WriteLine(message); + + string fileName = Path.GetFileName( + Process.GetCurrentProcess().MainModule.FileName); + + Console.WriteLine(String.Format( + "usage: {0} ", + fileName)); + } + #endregion + + /////////////////////////////////////////////////////////////////////// + + #region Program Entry Point + /// + /// This is the entry-point for this tool. It handles processing the + /// command line arguments, reading from the standard input channel, + /// replacing any matching lines of text, and writing to the standard + /// output channel. + /// + /// + /// The command line arguments. + /// + /// + /// Zero upon success; non-zero on failure. This will be one of the + /// values from the enumeration. + /// + private static int Main( + string[] args + ) + { + // + // NOTE: Sanity check the command line arguments. + // + if (args == null) + { + Error(null, true); + return (int)ExitCode.MissingArgs; + } + + if (args.Length != 3) + { + Error(null, true); + return (int)ExitCode.WrongNumArgs; + } + + try + { + // + // NOTE: Create a regular expression from the first command + // line argument. Then, grab the replacement string, + // which is the second argument. + // + Regex regEx = new Regex(args[0]); + string replacement = args[1]; + + // + // NOTE: Attempt to convert the third argument to a boolean. + // + bool matchingOnly; + + if (!bool.TryParse(args[2], out matchingOnly)) + { + Error(null, true); + return (int)ExitCode.BadMatchingOnlyFlag; + } + + // + // NOTE: Grab the standard input and output channels from the + // console. + // + TextReader inputTextReader = Console.In; + TextWriter outputTextWriter = Console.Out; + + // + // NOTE: Loop until end-of-file is hit on the standard input + // stream. + // + while (true) + { + // + // NOTE: Read a line from the standard input channel. If + // null is returned here, there is no more input and + // we are done. + // + string inputLine = inputTextReader.ReadLine(); + + if (inputLine == null) + break; + + // + // NOTE: Perform regular expression replacements on this + // line, if any. Then, write the modified line to + // the standard output channel. + // + string outputLine = regEx.Replace(inputLine, replacement); + + if (!matchingOnly || !String.Equals( + inputLine, outputLine, StringComparison.Ordinal)) + { + outputTextWriter.WriteLine(outputLine); + } + } + + // + // NOTE: At this point, everything has succeeded. + // + return (int)ExitCode.Success; + } + catch (Exception e) + { + // + // NOTE: An exception was caught. Report it via the console + // and return failure. + // + Error(e.ToString(), false); + return (int)ExitCode.Exception; + } + } + #endregion + } +} diff --git a/tool/mkautoconfamal.sh b/tool/mkautoconfamal.sh index 75a0b09a4c..4864ee85c3 100644 --- a/tool/mkautoconfamal.sh +++ b/tool/mkautoconfamal.sh @@ -53,6 +53,7 @@ cp $TOP/sqlite3.1 $TMPSPACE cp $TOP/sqlite3.pc.in $TMPSPACE cp $TOP/src/shell.c $TMPSPACE cp $TOP/src/sqlite3.rc $TMPSPACE +cp $TOP/tool/Replace.cs $TMPSPACE cat $TMPSPACE/configure.ac | sed "s/--SQLITE-VERSION--/$VERSION/" > $TMPSPACE/tmp diff --git a/tool/mkmsvcmin.tcl b/tool/mkmsvcmin.tcl index 41754cd576..88e7f9184e 100644 --- a/tool/mkmsvcmin.tcl +++ b/tool/mkmsvcmin.tcl @@ -72,6 +72,21 @@ $(LIBRESOBJS): $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H) $(LTRCOMPILE) -fo $(LIBRESOBJS) -DRC_VERONLY $(TOP)\sqlite3.rc }]] +# +# NOTE: This block is used to replace the section marked <> in +# the Makefile, if it exists. +# +set blocks(2) [string trimleft [string map [list \\\\ \\] { +Replace.exe: + $(CSC) /target:exe $(TOP)\Replace.cs + +sqlite3.def: Replace.exe $(LIBOBJ) + echo EXPORTS > sqlite3.def + dumpbin /all $(LIBOBJ) \\ + | .\Replace.exe "^\s+/EXPORT:_?(sqlite3_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \\ + | sort >> sqlite3.def +}]] + set data "#### DO NOT EDIT ####\n" append data "# This makefile is automatically " append data "generated from the [file tail $fromFileName] at\n" @@ -90,8 +105,6 @@ foreach i [lsort -integer [array names blocks]] { } set data [string map [list " -I\$(TOP)\\src" ""] $data] -set data [string map [list " /DEF:sqlite3.def" ""] $data] -set data [string map [list " sqlite3.def" ""] $data] set data [string map [list " libsqlite3.lib" ""] $data] set data [string map [list " \$(ALL_TCL_TARGETS)" ""] $data] set data [string map [list "\$(TOP)\\src\\" "\$(TOP)\\"] $data] From fee1e8d3176ec188fff82b38954da0d8f3cd80f1 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 27 Feb 2016 00:07:18 +0000 Subject: [PATCH 24/66] Make sure the Replace.cs file is included in the autoconf tarball. FossilOrigin-Name: b850df483d4dfc677ec61b119d8c1162b6a823d6 --- autoconf/Makefile.am | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/autoconf/Makefile.am b/autoconf/Makefile.am index 0e09cfcd95..7b6934adde 100644 --- a/autoconf/Makefile.am +++ b/autoconf/Makefile.am @@ -13,7 +13,7 @@ sqlite3_CFLAGS = $(AM_CFLAGS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS include_HEADERS = sqlite3.h sqlite3ext.h -EXTRA_DIST = sqlite3.1 tea Makefile.msc sqlite3.rc README.txt +EXTRA_DIST = sqlite3.1 tea Makefile.msc sqlite3.rc README.txt Replace.cs pkgconfigdir = ${libdir}/pkgconfig pkgconfig_DATA = sqlite3.pc diff --git a/manifest b/manifest index 1c5c27a015..5cf128e470 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Support\sgenerating\sthe\s'.def'\sfile\susing\sthe\sautoconf\sMakefile\sfor\sMSVC. -D 2016-02-26T23:13:16.711 +C Make\ssure\sthe\sReplace.cs\sfile\sis\sincluded\sin\sthe\sautoconf\starball. +D 2016-02-27T00:07:18.719 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc b6eb7a434c2e160a042036bd5047c3bd89eedacc @@ -10,7 +10,7 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 -F autoconf/Makefile.am 29e2a6e8d0c5e32723a48b4faf6b168854dde5f4 +F autoconf/Makefile.am 4b8bd7896fffb6b22a57747f1f98cba1da9108ae F autoconf/Makefile.msc 91fe02447e4a90b9368b2b1406d51ee5f7e83c6a F autoconf/README.first 6c4f34fe115ff55d4e8dbfa3cecf04a0188292f7 F autoconf/README.txt 4f04b0819303aabaa35fff5f7b257fb0c1ef95f1 @@ -1451,7 +1451,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b8dc1b9f5d413000387bfe784b69f5d0ee5c0489 -R e824451697993aa684f279d9331c397b -U mistachkin -Z bb33bef608d1de79741a7de07ef806b0 +P 3617564cb630ed418badf43d2c0291c11c166d12 +R 093da9a09b9ba8463976ad6bb6eea8a3 +U drh +Z 9a8d22871125a4adc384815a430d82c9 diff --git a/manifest.uuid b/manifest.uuid index 3c4acbdac1..34a75f85e9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3617564cb630ed418badf43d2c0291c11c166d12 \ No newline at end of file +b850df483d4dfc677ec61b119d8c1162b6a823d6 \ No newline at end of file From 62ab81001491f639eadb77dcf72076f882b4c4db Mon Sep 17 00:00:00 2001 From: mistachkin Date: Sat, 27 Feb 2016 00:21:16 +0000 Subject: [PATCH 25/66] Fix typo in ICU error message. FossilOrigin-Name: 00c8fffd47cec763857389e1e91c026ba3179182 --- ext/icu/icu.c | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ext/icu/icu.c b/ext/icu/icu.c index 263cd98275..3f45646194 100644 --- a/ext/icu/icu.c +++ b/ext/icu/icu.c @@ -394,7 +394,7 @@ static void icuCaseFunc16(sqlite3_context *p, int nArg, sqlite3_value **apArg){ if( !U_SUCCESS(status) ){ if( status==U_BUFFER_OVERFLOW_ERROR ) continue; icuFunctionError(p, - sqlite3_user_data(p) ? "u_strToUpper()" : "u_strToLower", status); + sqlite3_user_data(p) ? "u_strToUpper" : "u_strToLower", status); return; } } diff --git a/manifest b/manifest index 5cf128e470..8fd100b1fd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\ssure\sthe\sReplace.cs\sfile\sis\sincluded\sin\sthe\sautoconf\starball. -D 2016-02-27T00:07:18.719 +C Fix\stypo\sin\sICU\serror\smessage. +D 2016-02-27T00:21:16.746 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc b6eb7a434c2e160a042036bd5047c3bd89eedacc @@ -198,7 +198,7 @@ F ext/fts5/tool/loadfts5.tcl 95b03429ee6b138645703c6ca192c3ac96eaf093 F ext/fts5/tool/mkfts5c.tcl d1c2a9ab8e0ec690a52316f33dd9b1d379942f45 F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/icu/README.txt d9fbbad0c2f647c3fdf715fc9fd64af53aedfc43 -F ext/icu/icu.c be1f90d8babafe6d1a55a6912161bcac75baee0e +F ext/icu/icu.c 4bdf4c5daedabcd8e6eb6e6a377657f7b978f9f7 F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37 F ext/misc/amatch.c a1a8f66c29d40bd71b075546ddeddb477b17a2bb F ext/misc/closure.c 0d2a038df8fbae7f19de42e7c7d71f2e4dc88704 @@ -1451,7 +1451,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3617564cb630ed418badf43d2c0291c11c166d12 -R 093da9a09b9ba8463976ad6bb6eea8a3 -U drh -Z 9a8d22871125a4adc384815a430d82c9 +P b850df483d4dfc677ec61b119d8c1162b6a823d6 +R d5cc203073b9c279291539df551306ee +U mistachkin +Z c6ab413d3c48c517b60705cf4b24dfd0 diff --git a/manifest.uuid b/manifest.uuid index 34a75f85e9..6a7495bec3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b850df483d4dfc677ec61b119d8c1162b6a823d6 \ No newline at end of file +00c8fffd47cec763857389e1e91c026ba3179182 \ No newline at end of file From fe41a98fd660727383882c40f199f892f0f1eff9 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Sat, 27 Feb 2016 00:21:44 +0000 Subject: [PATCH 26/66] Add 'Replace.exe' to the MSVC clean target. FossilOrigin-Name: c2277fab12d2aecf9e0f69683741a194df17e854 --- Makefile.msc | 2 +- autoconf/Makefile.msc | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index db9c83c6c7..de225305f5 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -2048,7 +2048,7 @@ moreclean: clean clean: del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL del /Q *.bsc *.def *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL - del /Q $(SQLITE3EXE) $(SQLITE3DLL) 2>NUL + del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL # <> del /Q sqlite3.c sqlite3.h 2>NUL del /Q opcodes.c opcodes.h 2>NUL diff --git a/autoconf/Makefile.msc b/autoconf/Makefile.msc index b453b93c33..ad829bffa0 100644 --- a/autoconf/Makefile.msc +++ b/autoconf/Makefile.msc @@ -943,4 +943,4 @@ $(LIBRESOBJS): $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H) clean: del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL del /Q *.bsc *.def *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL - del /Q $(SQLITE3EXE) $(SQLITE3DLL) 2>NUL + del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL diff --git a/manifest b/manifest index 8fd100b1fd..761f1250c8 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -C Fix\stypo\sin\sICU\serror\smessage. -D 2016-02-27T00:21:16.746 +C Add\s'Replace.exe'\sto\sthe\sMSVC\sclean\starget. +D 2016-02-27T00:21:44.269 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 -F Makefile.msc b6eb7a434c2e160a042036bd5047c3bd89eedacc +F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION c6b1f51809551d60ad001e6d87cf3ab2c7f54b6f F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -11,7 +11,7 @@ F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am 4b8bd7896fffb6b22a57747f1f98cba1da9108ae -F autoconf/Makefile.msc 91fe02447e4a90b9368b2b1406d51ee5f7e83c6a +F autoconf/Makefile.msc b8ada5177e6f39c126a88295af5ad0255e08d280 F autoconf/README.first 6c4f34fe115ff55d4e8dbfa3cecf04a0188292f7 F autoconf/README.txt 4f04b0819303aabaa35fff5f7b257fb0c1ef95f1 F autoconf/configure.ac 72a5e42beb090b32bca580285dc0ab3c4670adb8 @@ -1451,7 +1451,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b850df483d4dfc677ec61b119d8c1162b6a823d6 -R d5cc203073b9c279291539df551306ee +P 00c8fffd47cec763857389e1e91c026ba3179182 +R 5d5d8a8010dbfa6bc274c104c226fec0 U mistachkin -Z c6ab413d3c48c517b60705cf4b24dfd0 +Z b85e54c141d3cf5bd3e41d9206ec3bb6 diff --git a/manifest.uuid b/manifest.uuid index 6a7495bec3..92117cb7f2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -00c8fffd47cec763857389e1e91c026ba3179182 \ No newline at end of file +c2277fab12d2aecf9e0f69683741a194df17e854 \ No newline at end of file From d892ac97bbf4bc8d32ec7b356f6d61dc6edf1f9b Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 27 Feb 2016 14:00:07 +0000 Subject: [PATCH 27/66] Enhance documentation of sqlite3_snapshot_open() to explain that the database connection must have participated in at least one read operation prior to the beginning of the transaction for which the snapshot is to be opened. Add test cases for this fact. FossilOrigin-Name: 33dd671cb9c17f08dbc61aed91e80eaeb84bfaf5 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/sqlite.h.in | 6 +++++- test/snapshot.test | 20 ++++++++++++++++++++ 4 files changed, 34 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 761f1250c8..c218f74566 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\s'Replace.exe'\sto\sthe\sMSVC\sclean\starget. -D 2016-02-27T00:21:44.269 +C Enhance\sdocumentation\sof\ssqlite3_snapshot_open()\sto\sexplain\sthat\sthe\sdatabase\nconnection\smust\shave\sparticipated\sin\sat\sleast\sone\sread\soperation\sprior\sto\nthe\sbeginning\sof\sthe\stransaction\sfor\swhich\sthe\ssnapshot\sis\sto\sbe\sopened.\nAdd\stest\scases\sfor\sthis\sfact. +D 2016-02-27T14:00:07.182 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -351,7 +351,7 @@ F src/resolve.c b8f7174e5f8c33c44ded3a25a973d0bb89228c20 F src/rowset.c 9fe4b3ad7cc00944386bb600233d8f523de07a6e F src/select.c 1bacfde7b7cec134d2b354cbcf67bafc67078431 F src/shell.c 89b73e894e737cc2f21e4bce0feb3ea21cc61124 -F src/sqlite.h.in 6bf029bcb077c6db633a77b7fda5ffd5b7c950b7 +F src/sqlite.h.in 57d2a02b14c9ec4f7cb294153eaf62294dc5aa68 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d F src/sqliteInt.h 63c0e1b5b5d608a1ba2303fe3a554b859a120406 @@ -1034,7 +1034,7 @@ F test/skipscan2.test d1d1450952b7275f0b0a3a981f0230532743951a F test/skipscan3.test ec5bab3f81c7038b43450e7b3062e04a198bdbb5 F test/skipscan5.test 67817a4b6857c47e0e33ba3e506da6f23ef68de2 F test/skipscan6.test 5866039d03a56f5bd0b3d172a012074a1d90a15b -F test/snapshot.test 5ec4651d16c3d1eb6c010d102febe32b3614bf56 +F test/snapshot.test c03eb5ba1602df33c1edc1d12393d6ca7a282a46 F test/snapshot_fault.test 25973aeb1b86a280800e0bcf1eb5ce70e9ef57ab F test/soak.test 0b5b6375c9f4110c828070b826b3b4b0bb65cd5f F test/softheap1.test 843cd84db9891b2d01b9ab64cef3e9020f98d087 @@ -1451,7 +1451,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 00c8fffd47cec763857389e1e91c026ba3179182 -R 5d5d8a8010dbfa6bc274c104c226fec0 -U mistachkin -Z b85e54c141d3cf5bd3e41d9206ec3bb6 +P c2277fab12d2aecf9e0f69683741a194df17e854 +R d50b04aa37cc4844a3040bb1385bb8e7 +U drh +Z f370d53fd3d226317497efdfe8ae225f diff --git a/manifest.uuid b/manifest.uuid index 92117cb7f2..4954cc1e24 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c2277fab12d2aecf9e0f69683741a194df17e854 \ No newline at end of file +33dd671cb9c17f08dbc61aed91e80eaeb84bfaf5 \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 60e2e3b61c..c81a9d0c43 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -7968,7 +7968,11 @@ SQLITE_EXPERIMENTAL int sqlite3_snapshot_get( ** the first operation, apart from other sqlite3_snapshot_open() calls, ** following the [BEGIN] that starts a new read transaction. ** ^A [snapshot] will fail to open if it has been overwritten by a -** [checkpoint]. +** [checkpoint]. +** ^A [snapshot] will fail to open if the database connection D has not +** previously completed at least one read operation against the database +** file. (Hint: Run "[PRAGMA application_id]" against a newly opened +** database connection in order to make it ready to use snapshots.) ** ** The [sqlite3_snapshot_open()] interface is only available when the ** SQLITE_ENABLE_SNAPSHOT compile-time option is used. diff --git a/test/snapshot.test b/test/snapshot.test index 63a0e30175..ba3a666796 100644 --- a/test/snapshot.test +++ b/test/snapshot.test @@ -334,6 +334,26 @@ do_test 6.3 { sqlite3_snapshot_open db2 main $::snapshot db2 eval { SELECT * FROM x1 } } {z zz zzz} +do_test 6.4 { + db2 close + sqlite3 db2 test.db + db2 eval "PRAGMA application_id" + db2 eval "BEGIN" + sqlite3_snapshot_open db2 main $::snapshot + db2 eval { SELECT * FROM x1 } +} {z zz zzz} + +# EVIDENCE-OF: R-55491-50411 A snapshot will fail to open if the +# database connection D has not previously completed at least one read +# operation against the database file. +# +do_test 6.5 { + db2 close + sqlite3 db2 test.db + db2 eval "BEGIN" + list [catch {sqlite3_snapshot_open db2 main $::snapshot} msg] $msg +} {1 SQLITE_ERROR} + sqlite3_snapshot_free $snapshot finish_test From 4f8f5e4446f9e49ef25b58d2dbc772f458d50b83 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 27 Feb 2016 14:04:27 +0000 Subject: [PATCH 28/66] Fix a requirement mark to conform to a typo fix in the documentation. FossilOrigin-Name: d1392c627934b89cdb86d82e73d56e8f76952b30 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/e_walhook.test | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index c218f74566..bd340d4ad4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhance\sdocumentation\sof\ssqlite3_snapshot_open()\sto\sexplain\sthat\sthe\sdatabase\nconnection\smust\shave\sparticipated\sin\sat\sleast\sone\sread\soperation\sprior\sto\nthe\sbeginning\sof\sthe\stransaction\sfor\swhich\sthe\ssnapshot\sis\sto\sbe\sopened.\nAdd\stest\scases\sfor\sthis\sfact. -D 2016-02-27T14:00:07.182 +C Fix\sa\srequirement\smark\sto\sconform\sto\sa\stypo\sfix\sin\sthe\sdocumentation. +D 2016-02-27T14:04:27.011 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -617,7 +617,7 @@ F test/e_vacuum.test 5bfbdc21b65c0abf24398d0ba31dc88d93ca77a9 F test/e_wal.test ae9a593207a77d711443ee69ffe081fda9243625 F test/e_walauto.test 280714ddf14e1a47dcbc59d515cd0b026dfd5567 F test/e_walckpt.test 28c371a6bb5e5fe7f31679c1df1763a19d19e8a0 -F test/e_walhook.test da3ea8b3483d1af72190337bda50155a91a4b664 +F test/e_walhook.test 4c0613a0c76e7a9d5c4c211e1b4cbcc1143914df F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea F test/enc2.test 83437a79ba1545a55fb549309175c683fb334473 F test/enc3.test 6807f7a7740a00361ca8d0ccd66bc60c8dc5f2b6 @@ -1451,7 +1451,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c2277fab12d2aecf9e0f69683741a194df17e854 -R d50b04aa37cc4844a3040bb1385bb8e7 +P 33dd671cb9c17f08dbc61aed91e80eaeb84bfaf5 +R 262f28bf043321d0cb2a0438d4f47c13 U drh -Z f370d53fd3d226317497efdfe8ae225f +Z 7540cf66865728ef817082a1a3c276f6 diff --git a/manifest.uuid b/manifest.uuid index 4954cc1e24..6fe6cf3e16 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -33dd671cb9c17f08dbc61aed91e80eaeb84bfaf5 \ No newline at end of file +d1392c627934b89cdb86d82e73d56e8f76952b30 \ No newline at end of file diff --git a/test/e_walhook.test b/test/e_walhook.test index c8c8819493..c963524a97 100644 --- a/test/e_walhook.test +++ b/test/e_walhook.test @@ -161,10 +161,10 @@ do_test 5.2 { -# EVIDENCE-OF: R-42842-27162 Note that the sqlite3_wal_autocheckpoint() +# EVIDENCE-OF: R-57445-43425 Note that the sqlite3_wal_autocheckpoint() # interface and the wal_autocheckpoint pragma both invoke -# sqlite3_wal_hook() and will those overwrite any prior -# sqlite3_wal_hook() settings. +# sqlite3_wal_hook() and will overwrite any prior sqlite3_wal_hook() +# settings. # set ::old_wal_hook 0 proc my_old_wal_hook {args} { incr ::old_wal_hook ; return 0 } From 3478490332bab33437a00f3a4d94c0204acf7f8a Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 27 Feb 2016 17:12:36 +0000 Subject: [PATCH 29/66] Enhance the ".stats" command in sqlite3.exe to show one-time stats information if invoked with one argument. Also show /proc/PID/io information if run on Linux. FossilOrigin-Name: 3c36948f16b58fe8042c37d0df634308b4e48217 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/shell.c | 47 +++++++++++++++++++++++++++++++++++++++++++++-- test/shell1.test | 8 ++++---- test/shell4.test | 8 ++++---- 5 files changed, 62 insertions(+), 19 deletions(-) diff --git a/manifest b/manifest index bd340d4ad4..435c15b0a4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\srequirement\smark\sto\sconform\sto\sa\stypo\sfix\sin\sthe\sdocumentation. -D 2016-02-27T14:04:27.011 +C Enhance\sthe\s".stats"\scommand\sin\ssqlite3.exe\sto\sshow\sone-time\sstats\sinformation\nif\sinvoked\swith\sone\sargument.\s\sAlso\sshow\s/proc/PID/io\sinformation\sif\srun\son\nLinux. +D 2016-02-27T17:12:36.918 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -350,7 +350,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c b8f7174e5f8c33c44ded3a25a973d0bb89228c20 F src/rowset.c 9fe4b3ad7cc00944386bb600233d8f523de07a6e F src/select.c 1bacfde7b7cec134d2b354cbcf67bafc67078431 -F src/shell.c 89b73e894e737cc2f21e4bce0feb3ea21cc61124 +F src/shell.c f30efdd675007ec6006d51193fc47aabda2984a5 F src/sqlite.h.in 57d2a02b14c9ec4f7cb294153eaf62294dc5aa68 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d @@ -1020,10 +1020,10 @@ F test/sharedA.test 0cdf1a76dfa00e6beee66af5b534b1e8df2720f5 F test/sharedB.test 16cc7178e20965d75278f410943109b77b2e645e F test/shared_err.test 2f2aee20db294b9924e81f6ccbe60f19e21e8506 F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304 -F test/shell1.test ce5e744870387164703bf2dee2cc9753e4a71513 +F test/shell1.test a45b424ec23a4b946848ff9e1af5186c677162ab F test/shell2.test 12b8bf901b0e3a8ac58cf5c0c63a0a388d4d1862 F test/shell3.test 5e8545ec72c4413a0e8d4c6be56496e3c257ca29 -F test/shell4.test ddf0a99044e2245a87fc17423e3aaa1445b3243b +F test/shell4.test f43e250139dc5dc5f0f2ec1752c50284a1ede102 F test/shell5.test c04e9f9f948305706b88377c464c7f08ce7479f9 F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3 F test/show_speedtest1_rtree.tcl 32e6c5f073d7426148a6936a0408f4b5b169aba5 @@ -1451,7 +1451,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 33dd671cb9c17f08dbc61aed91e80eaeb84bfaf5 -R 262f28bf043321d0cb2a0438d4f47c13 +P d1392c627934b89cdb86d82e73d56e8f76952b30 +R cc008a8c941c26feeb254cac8325586b U drh -Z 7540cf66865728ef817082a1a3c276f6 +Z 0f34ce71f4553990685c1f98cc5c169c diff --git a/manifest.uuid b/manifest.uuid index 6fe6cf3e16..31a87c6516 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d1392c627934b89cdb86d82e73d56e8f76952b30 \ No newline at end of file +3c36948f16b58fe8042c37d0df634308b4e48217 \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 95b75fa877..303fd008ad 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1284,6 +1284,43 @@ static char *save_err_msg( return zErrMsg; } +#ifdef __linux__ +/* +** Attempt to display I/O stats on Linux using /proc/PID/io +*/ +static void displayLinuxIoStats(FILE *out){ + FILE *in; + char z[200]; + sqlite3_snprintf(sizeof(z), z, "/proc/%d/io", getpid()); + in = fopen(z, "rb"); + if( in==0 ) return; + while( fgets(z, sizeof(z), in)!=0 ){ + static const struct { + const char *zPattern; + const char *zDesc; + } aTrans[] = { + { "rchar: ", "Number of bytes received by read():" }, + { "wchar: ", "Number of bytes sent to write():" }, + { "syscr: ", "Number of read() system calls:" }, + { "syscw: ", "Number of write() system calls:" }, + { "read_bytes: ", "Number of bytes from storage:" }, + { "write_bytes: ", "Number of bytes sent to storage:" }, + { "cancelled_write_bytes: ", "Cancelled write bytes:" }, + }; + int i; + for(i=0; iout, "Virtual Machine Steps: %d\n", iCur); } +#ifdef __linux__ + displayLinuxIoStats(pArg->out); +#endif + /* Do not remove this machine readable comment: extra-stats-output-here */ return 0; @@ -1957,7 +1998,7 @@ static char zHelp[] = " separator for both the output mode and .import\n" ".shell CMD ARGS... Run CMD ARGS... in a system shell\n" ".show Show the current values for various settings\n" - ".stats on|off Turn stats on or off\n" + ".stats ?on|off? Show stats or turn stats on or off\n" ".system CMD ARGS... Run CMD ARGS... in a system shell\n" ".tables ?TABLE? List names of tables\n" " If TABLE specified, only list tables matching\n" @@ -3835,8 +3876,10 @@ static int do_meta_command(char *zLine, ShellState *p){ if( c=='s' && strncmp(azArg[0], "stats", n)==0 ){ if( nArg==2 ){ p->statsOn = booleanValue(azArg[1]); + }else if( nArg==1 ){ + display_stats(p->db, p, 0); }else{ - raw_printf(stderr, "Usage: .stats on|off\n"); + raw_printf(stderr, "Usage: .stats ?on|off?\n"); rc = 1; } }else diff --git a/test/shell1.test b/test/shell1.test index 2fda62ee13..1b9ea1d383 100644 --- a/test/shell1.test +++ b/test/shell1.test @@ -625,9 +625,9 @@ do_test shell1-3.23.2 { } {1 {Usage: .show}} # .stats ON|OFF Turn stats on or off -do_test shell1-3.23b.1 { - catchcmd "test.db" ".stats" -} {1 {Usage: .stats on|off}} +#do_test shell1-3.23b.1 { +# catchcmd "test.db" ".stats" +#} {1 {Usage: .stats on|off}} do_test shell1-3.23b.2 { catchcmd "test.db" ".stats ON" } {0 {}} @@ -637,7 +637,7 @@ do_test shell1-3.23b.3 { do_test shell1-3.23b.4 { # too many arguments catchcmd "test.db" ".stats OFF BAD" -} {1 {Usage: .stats on|off}} +} {1 {Usage: .stats ?on|off?}} # .tables ?TABLE? List names of tables # If TABLE specified, only list tables matching diff --git a/test/shell4.test b/test/shell4.test index fcb0b2b715..18e7d7fdf6 100644 --- a/test/shell4.test +++ b/test/shell4.test @@ -61,9 +61,9 @@ do_test shell4-1.2.2 { } {0} # .stats ON|OFF Turn stats on or off -do_test shell4-1.3.1 { - catchcmd "test.db" ".stats" -} {1 {Usage: .stats on|off}} +#do_test shell4-1.3.1 { +# catchcmd "test.db" ".stats" +#} {1 {Usage: .stats on|off}} do_test shell4-1.3.2 { catchcmd "test.db" ".stats ON" } {0 {}} @@ -73,7 +73,7 @@ do_test shell4-1.3.3 { do_test shell4-1.3.4 { # too many arguments catchcmd "test.db" ".stats OFF BAD" -} {1 {Usage: .stats on|off}} +} {1 {Usage: .stats ?on|off?}} # NB. whitespace is important do_test shell4-1.4.1 { From fc1a84c57b52c582cb87e00a1366f6a4ee232b02 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 27 Feb 2016 19:19:22 +0000 Subject: [PATCH 30/66] Tighter description of I/O stats in the shell. Show I/O stats on speedtest1.c. FossilOrigin-Name: f681d800340e0e710f73d0f7c09101f899249183 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/shell.c | 14 +++++++------- test/speedtest1.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index 435c15b0a4..706e06deb0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhance\sthe\s".stats"\scommand\sin\ssqlite3.exe\sto\sshow\sone-time\sstats\sinformation\nif\sinvoked\swith\sone\sargument.\s\sAlso\sshow\s/proc/PID/io\sinformation\sif\srun\son\nLinux. -D 2016-02-27T17:12:36.918 +C Tighter\sdescription\sof\sI/O\sstats\sin\sthe\sshell.\s\sShow\sI/O\sstats\son\sspeedtest1.c. +D 2016-02-27T19:19:22.849 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -350,7 +350,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c b8f7174e5f8c33c44ded3a25a973d0bb89228c20 F src/rowset.c 9fe4b3ad7cc00944386bb600233d8f523de07a6e F src/select.c 1bacfde7b7cec134d2b354cbcf67bafc67078431 -F src/shell.c f30efdd675007ec6006d51193fc47aabda2984a5 +F src/shell.c 5e0ab1e708dc294330ccd8230536e1801f60822e F src/sqlite.h.in 57d2a02b14c9ec4f7cb294153eaf62294dc5aa68 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d @@ -1052,7 +1052,7 @@ F test/speed3.test d32043614c08c53eafdc80f33191d5bd9b920523 F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715 F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b -F test/speedtest1.c 947421c324f5cd4cb3dcae1ec214e4be763df718 +F test/speedtest1.c 1478cb3fb64ad30f291ddca87ca9dbd72ff552aa F test/spellfix.test f9c1f431e2c096c8775fec032952320c0e4700db F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3 F test/spellfix3.test f7bf7b3482971473d32b6b00f6944c5c066cff97 @@ -1451,7 +1451,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d1392c627934b89cdb86d82e73d56e8f76952b30 -R cc008a8c941c26feeb254cac8325586b +P 3c36948f16b58fe8042c37d0df634308b4e48217 +R 2b473c8c6b36608ca875feba0d8cbb83 U drh -Z 0f34ce71f4553990685c1f98cc5c169c +Z 565e8454d2408a569a86791d9e6b12a6 diff --git a/manifest.uuid b/manifest.uuid index 31a87c6516..546a6418d6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3c36948f16b58fe8042c37d0df634308b4e48217 \ No newline at end of file +f681d800340e0e710f73d0f7c09101f899249183 \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 303fd008ad..789a464d09 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1299,13 +1299,13 @@ static void displayLinuxIoStats(FILE *out){ const char *zPattern; const char *zDesc; } aTrans[] = { - { "rchar: ", "Number of bytes received by read():" }, - { "wchar: ", "Number of bytes sent to write():" }, - { "syscr: ", "Number of read() system calls:" }, - { "syscw: ", "Number of write() system calls:" }, - { "read_bytes: ", "Number of bytes from storage:" }, - { "write_bytes: ", "Number of bytes sent to storage:" }, - { "cancelled_write_bytes: ", "Cancelled write bytes:" }, + { "rchar: ", "Bytes received by read():" }, + { "wchar: ", "Bytes sent to write():" }, + { "syscr: ", "Read() system calls:" }, + { "syscw: ", "Write() system calls:" }, + { "read_bytes: ", "Bytes read from storage:" }, + { "write_bytes: ", "Bytes written to storage:" }, + { "cancelled_write_bytes: ", "Cancelled write bytes:" }, }; int i; for(i=0; i +#include + +/* +** Attempt to display I/O stats on Linux using /proc/PID/io +*/ +static void displayLinuxIoStats(FILE *out){ + FILE *in; + char z[200]; + sqlite3_snprintf(sizeof(z), z, "/proc/%d/io", getpid()); + in = fopen(z, "rb"); + if( in==0 ) return; + while( fgets(z, sizeof(z), in)!=0 ){ + static const struct { + const char *zPattern; + const char *zDesc; + } aTrans[] = { + { "rchar: ", "Bytes received by read():" }, + { "wchar: ", "Bytes sent to write():" }, + { "syscr: ", "Read() system calls:" }, + { "syscw: ", "Write() system calls:" }, + { "read_bytes: ", "Bytes rcvd from storage:" }, + { "write_bytes: ", "Bytes sent to storage:" }, + { "cancelled_write_bytes: ", "Cancelled write bytes:" }, + }; + int i; + for(i=0; i Date: Sat, 27 Feb 2016 20:14:55 +0000 Subject: [PATCH 31/66] Extend the code in memjournal.c so that it subsumes the role of journal.c. And (untested) can flush journal or statement journal files to disk after they grow to a specified size. FossilOrigin-Name: e0b0b4316531fc8afa74b4882d9c74a91030ec69 --- manifest | 25 ++-- manifest.uuid | 2 +- src/journal.c | 2 + src/memjournal.c | 362 ++++++++++++++++++++++++++++++++++------------- src/os.c | 2 +- src/pager.c | 24 +--- src/sqliteInt.h | 5 +- 7 files changed, 288 insertions(+), 134 deletions(-) diff --git a/manifest b/manifest index 706e06deb0..7546ccd6d9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Tighter\sdescription\sof\sI/O\sstats\sin\sthe\sshell.\s\sShow\sI/O\sstats\son\sspeedtest1.c. -D 2016-02-27T19:19:22.849 +C Extend\sthe\scode\sin\smemjournal.c\sso\sthat\sit\ssubsumes\sthe\srole\sof\sjournal.c.\sAnd\s(untested)\scan\sflush\sjournal\sor\sstatement\sjournal\sfiles\sto\sdisk\safter\sthey\sgrow\sto\sa\sspecified\ssize. +D 2016-02-27T20:14:55.339 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -311,7 +311,7 @@ F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5 F src/hash.h c8f3c31722cf3277d03713909761e152a5b81094 F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08 F src/insert.c 9ca97272e9f74ed0efddf3b4350ee12740cebbef -F src/journal.c fe3a3e2559ce3ce9d371afd30fbabbc074174575 +F src/journal.c 673cbdde5676eb0c55848f561575d45b609c820d F src/legacy.c 75d3023be8f0d2b99d60f905090341a03358c58e F src/loadext.c 9e2a41adcaff16ebc1ebff1f336cbf33de55396f F src/main.c be9309f442ec291177642d2e48e82290e0951f4b @@ -321,7 +321,7 @@ F src/mem1.c 6919bcf12f221868ea066eec27e579fed95ce98b F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3 F src/mem3.c 8768ac94694f31ffaf8b4d0ea5dc08af7010a35a F src/mem5.c 9bf955937b07f8c32541c8a9991f33ce3173d944 -F src/memjournal.c 349a04fb803db40532cde0993e39758f1acaecce +F src/memjournal.c 8d045e50120e9988e63bb0af69187e1e5e35122f F src/msvc.h d9ba56c6851227ab44b3f228a35f3f5772296495 F src/mutex.c 8e45800ee78e0cd1f1f3fe8e398853307f4a085c F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85 @@ -329,14 +329,14 @@ F src/mutex_noop.c 9d4309c075ba9cc7249e19412d3d62f7f94839c4 F src/mutex_unix.c 27bb6cc49485ee46711a6580ab7b3f1402211d23 F src/mutex_w32.c 5e6fe1c298fb5a8a15aaed4161d5759311431c17 F src/notify.c 9711a7575036f0d3040ba61bc6e217f13a9888e7 -F src/os.c ca9a104b677328ee037cfdf1a54a16fd1805e8c9 +F src/os.c f89e3ca1c2e3d5015b847aec60371c474acbac82 F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c 3a6f20736dfb8a0949cdd66553fdf59f6604be35 F src/os_win.c f0d7aa603eb6262143d7169a222aea07c4fca91d F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca -F src/pager.c d034c69b958c01289eb8070cbf902e1a68cd7e0b +F src/pager.c e2bf43b506447d649e9d9266e988007ae7248699 F src/pager.h e1d38a2f14849e219df0f91f8323504d134c8a56 F src/parse.y c3ce2c4a7cbf0b699239be6b2a945c5cb51875e2 F src/pcache.c 647bb53a86b7bbcf55ad88089b3ea5a9170b90df @@ -354,7 +354,7 @@ F src/shell.c 5e0ab1e708dc294330ccd8230536e1801f60822e F src/sqlite.h.in 57d2a02b14c9ec4f7cb294153eaf62294dc5aa68 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d -F src/sqliteInt.h 63c0e1b5b5d608a1ba2303fe3a554b859a120406 +F src/sqliteInt.h 3c4ed7e5dcb8b7d4cd4ab258ee7d0e0d0368f014 F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9 @@ -1451,7 +1451,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3c36948f16b58fe8042c37d0df634308b4e48217 -R 2b473c8c6b36608ca875feba0d8cbb83 -U drh -Z 565e8454d2408a569a86791d9e6b12a6 +P f681d800340e0e710f73d0f7c09101f899249183 +R f456c30e495865d50fc2c9c2ddb305ed +T *branch * memjournal-exp +T *sym-memjournal-exp * +T -sym-trunk * +U dan +Z dad681f00ca4c98b68e43d3727f3c92e diff --git a/manifest.uuid b/manifest.uuid index 546a6418d6..b15150144a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f681d800340e0e710f73d0f7c09101f899249183 \ No newline at end of file +e0b0b4316531fc8afa74b4882d9c74a91030ec69 \ No newline at end of file diff --git a/src/journal.c b/src/journal.c index a5cf8c8e2f..da59db0e50 100644 --- a/src/journal.c +++ b/src/journal.c @@ -24,6 +24,7 @@ ** buffer, or ** 2) The sqlite3JournalCreate() function is called. */ +#if 0 #ifdef SQLITE_ENABLE_ATOMIC_WRITE #include "sqliteInt.h" @@ -254,3 +255,4 @@ int sqlite3JournalSize(sqlite3_vfs *pVfs){ return (pVfs->szOsFile+sizeof(JournalFile)); } #endif +#endif diff --git a/src/memjournal.c b/src/memjournal.c index 62594530e0..6e1bf4edf7 100644 --- a/src/memjournal.c +++ b/src/memjournal.c @@ -21,24 +21,28 @@ typedef struct MemJournal MemJournal; typedef struct FilePoint FilePoint; typedef struct FileChunk FileChunk; -/* Space to hold the rollback journal is allocated in increments of -** this many bytes. -** -** The size chosen is a little less than a power of two. That way, -** the FileChunk object will have a size that almost exactly fills -** a power-of-two allocation. This minimizes wasted space in power-of-two -** memory allocators. -*/ -#define JOURNAL_CHUNKSIZE ((int)(1024-sizeof(FileChunk*))) - /* ** The rollback journal is composed of a linked list of these structures. +** +** The zChunk array is always at least 8 bytes in size - usually much more. +** Its actual size is stored in the MemJournal.nChunkSize variable. */ struct FileChunk { FileChunk *pNext; /* Next chunk in the journal */ - u8 zChunk[JOURNAL_CHUNKSIZE]; /* Content of this chunk */ + u8 zChunk[8]; /* Content of this chunk */ }; +/* +** By default, allocate this many bytes of memory for each FileChunk object. +*/ +#define MEMJOURNAL_DFLT_FILECHUNKSIZE 1024 + +/* +** For chunk size nChunkSize, return the number of bytes that should +** be allocated for each FileChunk structure. +*/ +#define fileChunkSize(nChunkSize) (sizeof(FileChunk) + ((nChunkSize)-8)) + /* ** An instance of this object serves as a cursor into the rollback journal. ** The cursor can be either for reading or writing. @@ -49,14 +53,23 @@ struct FilePoint { }; /* -** This subclass is a subclass of sqlite3_file. Each open memory-journal +** This structure is a subclass of sqlite3_file. Each open memory-journal ** is an instance of this class. */ struct MemJournal { - sqlite3_io_methods *pMethod; /* Parent class. MUST BE FIRST */ + const sqlite3_io_methods *pMethod; /* Parent class. MUST BE FIRST */ + int nChunkSize; /* In-memory chunk-size */ + + int nBuf; /* Bytes of data before flushing */ + int nSize; /* Bytes of data currently in memory */ FileChunk *pFirst; /* Head of in-memory chunk-list */ FilePoint endpoint; /* Pointer to the end of the file */ FilePoint readpoint; /* Pointer to the end of the last xRead() */ + + int flags; /* xOpen flags */ + sqlite3_vfs *pVfs; /* The "real" underlying VFS */ + const char *zJournal; /* Name of the journal file */ + sqlite3_file *pReal; /* The "real" underlying file descriptor */ }; /* @@ -70,41 +83,96 @@ static int memjrnlRead( sqlite_int64 iOfst /* Begin reading at this offset */ ){ MemJournal *p = (MemJournal *)pJfd; - u8 *zOut = zBuf; - int nRead = iAmt; - int iChunkOffset; - FileChunk *pChunk; - - /* SQLite never tries to read past the end of a rollback journal file */ - assert( iOfst+iAmt<=p->endpoint.iOffset ); - - if( p->readpoint.iOffset!=iOfst || iOfst==0 ){ - sqlite3_int64 iOff = 0; - for(pChunk=p->pFirst; - ALWAYS(pChunk) && (iOff+JOURNAL_CHUNKSIZE)<=iOfst; - pChunk=pChunk->pNext - ){ - iOff += JOURNAL_CHUNKSIZE; - } + if( p->pReal ){ + return sqlite3OsRead(p->pReal, zBuf, iAmt, iOfst); + }else if( (iAmt+iOfst)>p->endpoint.iOffset ){ + return SQLITE_IOERR_SHORT_READ; }else{ - pChunk = p->readpoint.pChunk; - } + u8 *zOut = zBuf; + int nRead = iAmt; + int iChunkOffset; + FileChunk *pChunk; - iChunkOffset = (int)(iOfst%JOURNAL_CHUNKSIZE); - do { - int iSpace = JOURNAL_CHUNKSIZE - iChunkOffset; - int nCopy = MIN(nRead, (JOURNAL_CHUNKSIZE - iChunkOffset)); - memcpy(zOut, &pChunk->zChunk[iChunkOffset], nCopy); - zOut += nCopy; - nRead -= iSpace; - iChunkOffset = 0; - } while( nRead>=0 && (pChunk=pChunk->pNext)!=0 && nRead>0 ); - p->readpoint.iOffset = iOfst+iAmt; - p->readpoint.pChunk = pChunk; + if( p->readpoint.iOffset!=iOfst || iOfst==0 ){ + sqlite3_int64 iOff = 0; + for(pChunk=p->pFirst; + ALWAYS(pChunk) && (iOff+p->nChunkSize)<=iOfst; + pChunk=pChunk->pNext + ){ + iOff += p->nChunkSize; + } + }else{ + pChunk = p->readpoint.pChunk; + } + + iChunkOffset = (int)(iOfst%p->nChunkSize); + do { + int iSpace = p->nChunkSize - iChunkOffset; + int nCopy = MIN(nRead, (p->nChunkSize - iChunkOffset)); + memcpy(zOut, &pChunk->zChunk[iChunkOffset], nCopy); + zOut += nCopy; + nRead -= iSpace; + iChunkOffset = 0; + } while( nRead>=0 && (pChunk=pChunk->pNext)!=0 && nRead>0 ); + p->readpoint.iOffset = iOfst+iAmt; + p->readpoint.pChunk = pChunk; + } return SQLITE_OK; } +/* +** Free the list of FileChunk structures headed at MemJournal.pFirst. +*/ +static void memjrnlFreeChunks(MemJournal *p){ + FileChunk *pIter; + FileChunk *pNext; + for(pIter=p->pFirst; pIter; pIter=pNext){ + pNext = pIter->pNext; + sqlite3_free(pIter); + } + p->pFirst = 0; +} + +/* +** Flush the contents of memory to a real file on disk. +*/ +static int createFile(MemJournal *p){ + int rc = SQLITE_OK; + if( !p->pReal ){ + sqlite3_file *pReal = (sqlite3_file *)&p[1]; + rc = sqlite3OsOpen(p->pVfs, p->zJournal, pReal, p->flags, 0); + if( rc==SQLITE_OK ){ + int nChunk = p->nChunkSize; + i64 iOff = 0; + FileChunk *pIter; + p->pReal = pReal; + for(pIter=p->pFirst; pIter && rc==SQLITE_OK; pIter=pIter->pNext){ + int nWrite = nChunk; + if( pIter==p->endpoint.pChunk ){ + nWrite = p->endpoint.iOffset % p->nChunkSize; + if( nWrite==0 ) nWrite = p->nChunkSize; + } + rc = sqlite3OsWrite(pReal, pIter->zChunk, nWrite, iOff); + iOff += nWrite; + } + if( rc!=SQLITE_OK ){ + /* If an error occurred while writing to the file, close it before + ** returning. This way, SQLite uses the in-memory journal data to + ** roll back changes made to the internal page-cache before this + ** function was called. */ + sqlite3OsClose(pReal); + p->pReal = 0; + }else{ + /* No error has occurred. Free the in-memory buffers. */ + memjrnlFreeChunks(p); + } + } + } + return rc; +} + + /* ** Write data to the file. */ @@ -118,38 +186,61 @@ static int memjrnlWrite( int nWrite = iAmt; u8 *zWrite = (u8 *)zBuf; - /* An in-memory journal file should only ever be appended to. Random - ** access writes are not required by sqlite. - */ - assert( iOfst==p->endpoint.iOffset ); - UNUSED_PARAMETER(iOfst); + /* If the file has already been created on disk. */ + if( p->pReal ){ + return sqlite3OsWrite(p->pReal, zBuf, iAmt, iOfst); + } - while( nWrite>0 ){ - FileChunk *pChunk = p->endpoint.pChunk; - int iChunkOffset = (int)(p->endpoint.iOffset%JOURNAL_CHUNKSIZE); - int iSpace = MIN(nWrite, JOURNAL_CHUNKSIZE - iChunkOffset); - - if( iChunkOffset==0 ){ - /* New chunk is required to extend the file. */ - FileChunk *pNew = sqlite3_malloc(sizeof(FileChunk)); - if( !pNew ){ - return SQLITE_IOERR_NOMEM_BKPT; - } - pNew->pNext = 0; - if( pChunk ){ - assert( p->pFirst ); - pChunk->pNext = pNew; - }else{ - assert( !p->pFirst ); - p->pFirst = pNew; - } - p->endpoint.pChunk = pNew; + /* If the file should be created now. */ + else if( p->nBuf>0 && (iAmt+iOfst)>p->nBuf ){ + int rc = createFile(p); + if( rc==SQLITE_OK ){ + rc = memjrnlWrite(pJfd, zBuf, iAmt, iOfst); } + return rc; + } - memcpy(&p->endpoint.pChunk->zChunk[iChunkOffset], zWrite, iSpace); - zWrite += iSpace; - nWrite -= iSpace; - p->endpoint.iOffset += iSpace; + /* If the contents of this write should be stored in memory */ + else{ + /* An in-memory journal file should only ever be appended to. Random + ** access writes are not required. The only exception to this is when + ** the in-memory journal is being used by a connection using the + ** atomic-write optimization. In this case the first 28 bytes of the + ** journal file may be written as part of committing the transaction. */ + assert( iOfst==p->endpoint.iOffset || iOfst==0 ); + if( iOfst==0 && p->pFirst ){ + assert( p->nChunkSize>iAmt ); + memcpy(p->pFirst->zChunk, zBuf, iAmt); + }else{ + while( nWrite>0 ){ + FileChunk *pChunk = p->endpoint.pChunk; + int iChunkOffset = (int)(p->endpoint.iOffset%p->nChunkSize); + int iSpace = MIN(nWrite, p->nChunkSize - iChunkOffset); + + if( iChunkOffset==0 ){ + /* New chunk is required to extend the file. */ + FileChunk *pNew = sqlite3_malloc(fileChunkSize(p->nChunkSize)); + if( !pNew ){ + return SQLITE_IOERR_NOMEM_BKPT; + } + pNew->pNext = 0; + if( pChunk ){ + assert( p->pFirst ); + pChunk->pNext = pNew; + }else{ + assert( !p->pFirst ); + p->pFirst = pNew; + } + p->endpoint.pChunk = pNew; + } + + memcpy(&p->endpoint.pChunk->zChunk[iChunkOffset], zWrite, iSpace); + zWrite += iSpace; + nWrite -= iSpace; + p->endpoint.iOffset += iSpace; + } + p->nSize = iAmt + iOfst; + } } return SQLITE_OK; @@ -160,16 +251,16 @@ static int memjrnlWrite( */ static int memjrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){ MemJournal *p = (MemJournal *)pJfd; - FileChunk *pChunk; - assert(size==0); - UNUSED_PARAMETER(size); - pChunk = p->pFirst; - while( pChunk ){ - FileChunk *pTmp = pChunk; - pChunk = pChunk->pNext; - sqlite3_free(pTmp); + if( p->pReal ){ + return sqlite3OsTruncate(p->pReal, size); + }else if( size==0 ){ + memjrnlFreeChunks(p); + p->nSize = 0; + p->endpoint.pChunk = 0; + p->endpoint.iOffset = 0; + p->readpoint.pChunk = 0; + p->readpoint.iOffset = 0; } - sqlite3MemJournalOpen(pJfd); return SQLITE_OK; } @@ -177,21 +268,23 @@ static int memjrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){ ** Close the file. */ static int memjrnlClose(sqlite3_file *pJfd){ - memjrnlTruncate(pJfd, 0); + MemJournal *p = (MemJournal *)pJfd; + memjrnlFreeChunks(p); + if( p->pReal ) sqlite3OsClose(p->pReal); return SQLITE_OK; } - /* ** Sync the file. ** -** Syncing an in-memory journal is a no-op. And, in fact, this routine -** is never called in a working implementation. This implementation -** exists purely as a contingency, in case some malfunction in some other -** part of SQLite causes Sync to be called by mistake. +** If the real file has been created, call its xSync method. Otherwise, +** syncing an in-memory journal is a no-op. */ -static int memjrnlSync(sqlite3_file *NotUsed, int NotUsed2){ - UNUSED_PARAMETER2(NotUsed, NotUsed2); +static int memjrnlSync(sqlite3_file *pJfd, int flags){ + MemJournal *p = (MemJournal *)pJfd; + if( p->pReal ){ + return sqlite3OsSync(p->pReal, flags); + } return SQLITE_OK; } @@ -200,6 +293,9 @@ static int memjrnlSync(sqlite3_file *NotUsed, int NotUsed2){ */ static int memjrnlFileSize(sqlite3_file *pJfd, sqlite_int64 *pSize){ MemJournal *p = (MemJournal *)pJfd; + if( p->pReal ){ + return sqlite3OsFileSize(p->pReal, pSize); + } *pSize = (sqlite_int64) p->endpoint.iOffset; return SQLITE_OK; } @@ -230,26 +326,92 @@ static const struct sqlite3_io_methods MemJournalMethods = { }; /* -** Open a journal file. +** Open a journal file. +** +** The behaviour of the journal file depends on the value of parameter +** nBuf. If nBuf is 0, then the journal file is always create and +** accessed using the underlying VFS. If nBuf is less than zero, then +** all content is always stored in main-memory. Finally, if nBuf is a +** positive value, then the journal file is initially created in-memory +** but may be flushed to disk later on. In this case the journal file is +** flushed to disk either when it grows larger than nBuf bytes in size, +** or when sqlite3JournalCreate() is called. */ -void sqlite3MemJournalOpen(sqlite3_file *pJfd){ - MemJournal *p = (MemJournal *)pJfd; - assert( EIGHT_BYTE_ALIGNMENT(p) ); - memset(p, 0, sqlite3MemJournalSize()); - p->pMethod = (sqlite3_io_methods*)&MemJournalMethods; +int sqlite3JournalOpen( + sqlite3_vfs *pVfs, /* The VFS to use for actual file I/O */ + const char *zName, /* Name of the journal file */ + sqlite3_file *pJfd, /* Preallocated, blank file handle */ + int flags, /* Opening flags */ + int nBuf /* Bytes buffered before opening the file */ +){ + MemJournal *p = (MemJournal*)pJfd; + + /* Zero the file-handle object. If nBuf was passed zero, initialize + ** it using the sqlite3OsOpen() function of the underlying VFS. In this + ** case none of the code in this module is executed as a result of calls + ** made on the journal file-handle. */ + memset(p, 0, sizeof(MemJournal)); + if( nBuf==0 ){ + return sqlite3OsOpen(pVfs, zName, pJfd, flags, 0); + } + + if( nBuf>0 ){ + p->nChunkSize = nBuf; + }else{ + p->nChunkSize = 8 + MEMJOURNAL_DFLT_FILECHUNKSIZE - sizeof(FileChunk); + assert( MEMJOURNAL_DFLT_FILECHUNKSIZE==fileChunkSize(p->nChunkSize) ); + } + + p->pMethod = (const sqlite3_io_methods*)&MemJournalMethods; + p->nBuf = nBuf; + p->flags = flags; + p->zJournal = zName; + p->pVfs = pVfs; + return SQLITE_OK; } /* -** Return true if the file-handle passed as an argument is -** an in-memory journal +** Open an in-memory journal file. +*/ +void sqlite3MemJournalOpen(sqlite3_file *pJfd){ + sqlite3JournalOpen(0, 0, pJfd, 0, -1); +} + +/* +** Return true if the file-handle passed as an argument is an in-memory +** journal. */ int sqlite3IsMemJournal(sqlite3_file *pJfd){ - return pJfd->pMethods==&MemJournalMethods; + return pJfd->pMethods==&MemJournalMethods && ((MemJournal*)pJfd)->pReal==0; +} + +/* +** If the argument p points to a MemJournal structure that is not an +** in-memory-only journal file, and the underlying file has not yet been +** created, create it now. +*/ +int sqlite3JournalCreate(sqlite3_file *p){ + int rc = SQLITE_OK; + if( p->pMethods==&MemJournalMethods && ((MemJournal*)p)->nBuf>=0 ){ + rc = createFile((MemJournal*)p); + } + return rc; +} + +/* +** The file-handle passed as teh only argument is open on a journal file. +** Return true if this "journal file" is actually stored in heap memory, +** or false otherwise. +*/ +int sqlite3JournalIsInMemory(sqlite3_file *p){ + return p->pMethods==&MemJournalMethods && ((MemJournal*)p)->pReal==0; } /* -** Return the number of bytes required to store a MemJournal file descriptor. +** Return the number of bytes required to store a JournalFile that uses vfs +** pVfs to create the underlying on-disk files. */ -int sqlite3MemJournalSize(void){ - return sizeof(MemJournal); +int sqlite3JournalSize(sqlite3_vfs *pVfs){ + return pVfs->szOsFile + sizeof(MemJournal); } + diff --git a/src/os.c b/src/os.c index 2fd44abf85..eed7828538 100644 --- a/src/os.c +++ b/src/os.c @@ -66,7 +66,7 @@ int sqlite3_open_file_count = 0; #if defined(SQLITE_TEST) int sqlite3_memdebug_vfs_oom_test = 1; #define DO_OS_MALLOC_TEST(x) \ - if (sqlite3_memdebug_vfs_oom_test && (!x || !sqlite3IsMemJournal(x))) { \ + if (sqlite3_memdebug_vfs_oom_test && (!x || !sqlite3JournalIsInMemory(x))) { \ void *pTstAlloc = sqlite3Malloc(10); \ if (!pTstAlloc) return SQLITE_IOERR_NOMEM_BKPT; \ sqlite3_free(pTstAlloc); \ diff --git a/src/pager.c b/src/pager.c index 51bd45e486..5998a57831 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1724,7 +1724,7 @@ static void releaseAllSavepoints(Pager *pPager){ for(ii=0; iinSavepoint; ii++){ sqlite3BitvecDestroy(pPager->aSavepoint[ii].pInSavepoint); } - if( !pPager->exclusiveMode || sqlite3IsMemJournal(pPager->sjfd) ){ + if( !pPager->exclusiveMode || sqlite3JournalIsInMemory(pPager->sjfd) ){ sqlite3OsClose(pPager->sjfd); } sqlite3_free(pPager->aSavepoint); @@ -1962,8 +1962,8 @@ static int pager_end_transaction(Pager *pPager, int hasMaster, int bCommit){ assert( !pagerUseWal(pPager) ); /* Finalize the journal file. */ - if( sqlite3IsMemJournal(pPager->jfd) ){ - assert( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ); + if( sqlite3JournalIsInMemory(pPager->jfd) ){ + /* assert( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ); */ sqlite3OsClose(pPager->jfd); }else if( pPager->journalMode==PAGER_JOURNALMODE_TRUNCATE ){ if( pPager->journalOff==0 ){ @@ -1991,7 +1991,7 @@ static int pager_end_transaction(Pager *pPager, int hasMaster, int bCommit){ ** file should be closed and deleted. If this connection writes to ** the database file, it will do so using an in-memory journal. */ - int bDelete = (!pPager->tempFile && sqlite3JournalExists(pPager->jfd)); + int bDelete = (!pPager->tempFile&&!sqlite3JournalIsInMemory(pPager->jfd)); assert( pPager->journalMode==PAGER_JOURNALMODE_DELETE || pPager->journalMode==PAGER_JOURNALMODE_MEMORY || pPager->journalMode==PAGER_JOURNALMODE_WAL @@ -4578,18 +4578,8 @@ int sqlite3PagerOpen( int nUri = 0; /* Number of bytes of URI args at *zUri */ /* Figure out how much space is required for each journal file-handle - ** (there are two of them, the main journal and the sub-journal). This - ** is the maximum space required for an in-memory journal file handle - ** and a regular journal file-handle. Note that a "regular journal-handle" - ** may be a wrapper capable of caching the first portion of the journal - ** file in memory to implement the atomic-write optimization (see - ** source file journal.c). - */ - if( sqlite3JournalSize(pVfs)>sqlite3MemJournalSize() ){ - journalFileSize = ROUND8(sqlite3JournalSize(pVfs)); - }else{ - journalFileSize = ROUND8(sqlite3MemJournalSize()); - } + ** (there are two of them, the main journal and the sub-journal). */ + journalFileSize = ROUND8(sqlite3JournalSize(pVfs)); /* Set the output variable to NULL in case an error occurs. */ *ppPager = 0; @@ -6667,7 +6657,7 @@ int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){ if( op==SAVEPOINT_RELEASE ){ if( nNew==0 && isOpen(pPager->sjfd) ){ /* Only truncate if it is an in-memory sub-journal. */ - if( sqlite3IsMemJournal(pPager->sjfd) ){ + if( sqlite3JournalIsInMemory(pPager->sjfd) ){ rc = sqlite3OsTruncate(pPager->sjfd, 0); assert( rc==SQLITE_OK ); } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 759d7ca5e1..4cbb7f3d06 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -4004,15 +4004,12 @@ int sqlite3FindInIndex(Parse *, Expr *, u32, int*); int sqlite3JournalOpen(sqlite3_vfs *, const char *, sqlite3_file *, int, int); int sqlite3JournalSize(sqlite3_vfs *); int sqlite3JournalCreate(sqlite3_file *); - int sqlite3JournalExists(sqlite3_file *p); #else #define sqlite3JournalSize(pVfs) ((pVfs)->szOsFile) - #define sqlite3JournalExists(p) 1 #endif +int sqlite3JournalIsInMemory(sqlite3_file *p); void sqlite3MemJournalOpen(sqlite3_file *); -int sqlite3MemJournalSize(void); -int sqlite3IsMemJournal(sqlite3_file *); void sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p); #if SQLITE_MAX_EXPR_DEPTH>0 From 94fa9c414a4998f60d99d6a65e1d104fe62d2436 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 27 Feb 2016 21:16:04 +0000 Subject: [PATCH 32/66] Eliminate the need for the Column.zDflt (using Column.pDflt instead) to reduce the amount of memory needed to hold the schema. FossilOrigin-Name: d8c94a46dfa94930732c2de2aa79675c5087d36e --- manifest | 28 ++++++++++++++-------------- manifest.uuid | 2 +- src/alter.c | 4 ++-- src/build.c | 14 +++++++++----- src/expr.c | 1 + src/insert.c | 14 +++++++++----- src/pragma.c | 3 ++- src/sqliteInt.h | 1 - src/treeview.c | 6 ++++++ src/vdbemem.c | 2 +- tool/addopcodes.tcl | 1 + 11 files changed, 46 insertions(+), 30 deletions(-) diff --git a/manifest b/manifest index 706e06deb0..571cd071e6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Tighter\sdescription\sof\sI/O\sstats\sin\sthe\sshell.\s\sShow\sI/O\sstats\son\sspeedtest1.c. -D 2016-02-27T19:19:22.849 +C Eliminate\sthe\sneed\sfor\sthe\sColumn.zDflt\s(using\sColumn.pDflt\sinstead)\sto\sreduce\nthe\samount\sof\smemory\sneeded\sto\shold\sthe\sschema. +D 2016-02-27T21:16:04.996 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -285,7 +285,7 @@ F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786 F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a -F src/alter.c 7603afbd61f55e7c644b8de4a42f33e58c0b7eaa +F src/alter.c 44e18dfd78e8942d65d3cdaec4de972b5cd9f1f2 F src/analyze.c ab57b6763dd4c6170a20673d14882c033affd188 F src/attach.c a3724c64de1099d85e30751213d285752aed9505 F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 @@ -295,14 +295,14 @@ F src/btmutex.c bc87dd3b062cc26edfe79918de2200ccb8d41e73 F src/btree.c 7bb920c473c277380fcb3e8a8ee28ce1a48e0abc F src/btree.h a5008b9afe56e8e54ade6c436a910f112defcca9 F src/btreeInt.h c18b7d2a3494695133e4e60ee36061d37f45d9a5 -F src/build.c 6661513c8f90a23d44ed5e5ada7ea40fac6b6b77 +F src/build.c 6854e717e3257957b1bd87aadd6371d63937a023 F src/callback.c 2e76147783386374bf01b227f752c81ec872d730 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c 60e135af364d777a9ab41c97e5e89cd224da6198 F src/date.c 0b73e681c11fca867fec554750c07fe0d4e417c1 F src/dbstat.c c845548d4346e606e2f2b7d2e714ace2b8a7dd1b F src/delete.c 48802aa3ee6339f576d074336d3ae1b5f40e240f -F src/expr.c 9adb58153f6e943b703d43e9a1f67f77b5a75721 +F src/expr.c c4dad2cd6cec00387b75fef4551aff655430dcd2 F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c 5cb42d9a59e2a590776fd3fc8ff6f61d40df3c6e F src/func.c 552d300265aed09eea21f68ac742a440550c0062 @@ -310,7 +310,7 @@ F src/global.c ded7b97efd16efda5062b65e857198e46c40e652 F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5 F src/hash.h c8f3c31722cf3277d03713909761e152a5b81094 F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08 -F src/insert.c 9ca97272e9f74ed0efddf3b4350ee12740cebbef +F src/insert.c 723d5d708cdb61bdd47c00b9f07c75be45aefc09 F src/journal.c fe3a3e2559ce3ce9d371afd30fbabbc074174575 F src/legacy.c 75d3023be8f0d2b99d60f905090341a03358c58e F src/loadext.c 9e2a41adcaff16ebc1ebff1f336cbf33de55396f @@ -342,7 +342,7 @@ F src/parse.y c3ce2c4a7cbf0b699239be6b2a945c5cb51875e2 F src/pcache.c 647bb53a86b7bbcf55ad88089b3ea5a9170b90df F src/pcache.h 4d0ccaad264d360981ec5e6a2b596d6e85242545 F src/pcache1.c 72f644dc9e1468c72922eff5904048427b817051 -F src/pragma.c d6028d23a9495a8b55f2075e3244ec9a0485e03e +F src/pragma.c 35619c4e9f79049cce964ef8ed9710ae3e5b9ca1 F src/pragma.h 64c78a648751b9f4f297276c4eb7507b14b4628c F src/prepare.c 22df6171aec1d86904ed2ad30c2348a5748aa04e F src/printf.c 63e6fb12bbe702dd664dc3703776c090383a5a26 @@ -354,7 +354,7 @@ F src/shell.c 5e0ab1e708dc294330ccd8230536e1801f60822e F src/sqlite.h.in 57d2a02b14c9ec4f7cb294153eaf62294dc5aa68 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d -F src/sqliteInt.h 63c0e1b5b5d608a1ba2303fe3a554b859a120406 +F src/sqliteInt.h bcfbf4785436f318459cdbde07a8cce3de7e6f1a F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9 @@ -408,7 +408,7 @@ F src/test_windirent.h b12055cab6227f7be10f5c19296f67c60cc5e2a5 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c F src/tokenize.c 3d338cdd00d916ce8a05c397001d64ed58e6fe1c -F src/treeview.c c525282442111b3f61eb176784567cd6654db5dc +F src/treeview.c e4b41a37530a191579d3c53142cc44ee2eb99373 F src/trigger.c e14840ee0c3e549e758ec9bf3e4146e166002280 F src/update.c a7eeeaffad59c6506f01303a071dac11de8269ca F src/utf.c 699001c79f28e48e9bcdf8a463da029ea660540c @@ -420,7 +420,7 @@ F src/vdbeInt.h 49a74fe5ece206d2d8666ba9afaf1abeda5f123b F src/vdbeapi.c 95b1f8e527240a18a9aea41a655b013bf07a7009 F src/vdbeaux.c 2c15cf88de4df97428318c8cfac0dea873dae451 F src/vdbeblob.c 3b570b730109e8f653d9d2081649f6e7015113db -F src/vdbemem.c be8381ed6de54eb9cb9dfa802823cdeb5166d855 +F src/vdbemem.c 9b0cb32cc267ef026515f15a3594d5ff91fe4dfc F src/vdbesort.c 307460bfa4de4d1c3901fcd42089159131e34062 F src/vdbetrace.c f75c5455d8cf389ef86a8bfdfd3177e0e3692484 F src/vtab.c 943c23b355f0a8f859f9583e7315d64bebdb0899 @@ -1369,7 +1369,7 @@ F test/zerodamage.test cf6748bad89553cc1632be51a6f54e487e4039ac F tool/GetFile.cs a15e08acb5dd7539b75ba23501581d7c2b462cb5 F tool/GetTclKit.bat 629d87562e0487c386db630033931d12d62e6372 F tool/Replace.cs 02c67258801c2fb5f63231e0ac0f220b4b36ba91 -F tool/addopcodes.tcl 4ca9c3ef196f08da30add5d07ce0c9458dc8c633 +F tool/addopcodes.tcl 2b089684eb8b7d0db64cf9d8e6d2fe1b6d279e8d F tool/build-all-msvc.bat 55be1cf8545dabd69df2ba6b3de6868da0c26f52 x F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367 F tool/cg_anno.tcl 692ce4b8693d59e3a3de77ca97f4139ecfa641b0 x @@ -1451,7 +1451,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3c36948f16b58fe8042c37d0df634308b4e48217 -R 2b473c8c6b36608ca875feba0d8cbb83 +P f681d800340e0e710f73d0f7c09101f899249183 +R 68cf98086fc7541dd6cf15ff81e4d2e2 U drh -Z 565e8454d2408a569a86791d9e6b12a6 +Z bde0bd56c07a366738817149aa7f9a7d diff --git a/manifest.uuid b/manifest.uuid index 546a6418d6..629362c836 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f681d800340e0e710f73d0f7c09101f899249183 \ No newline at end of file +d8c94a46dfa94930732c2de2aa79675c5087d36e \ No newline at end of file diff --git a/src/alter.c b/src/alter.c index f10a85022a..9edd7fff3c 100644 --- a/src/alter.c +++ b/src/alter.c @@ -628,7 +628,8 @@ void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ ** literal NULL, then set pDflt to 0. This simplifies checking ** for an SQL NULL default below. */ - if( pDflt && pDflt->op==TK_NULL ){ + assert( pDflt==0 || pDflt->op==TK_SPAN ); + if( pDflt && pDflt->pLeft->op==TK_NULL ){ pDflt = 0; } @@ -787,7 +788,6 @@ void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){ pCol->zColl = 0; pCol->zType = 0; pCol->pDflt = 0; - pCol->zDflt = 0; } pNew->pSchema = db->aDb[iDb].pSchema; pNew->addColOffset = pTab->addColOffset; diff --git a/src/build.c b/src/build.c index b14d45f6da..bcf71442de 100644 --- a/src/build.c +++ b/src/build.c @@ -571,7 +571,6 @@ void sqlite3DeleteColumnNames(sqlite3 *db, Table *pTable){ for(i=0; inCol; i++, pCol++){ sqlite3DbFree(db, pCol->zName); sqlite3ExprDelete(db, pCol->pDflt); - sqlite3DbFree(db, pCol->zDflt); sqlite3DbFree(db, pCol->zType); sqlite3DbFree(db, pCol->zColl); } @@ -1231,11 +1230,16 @@ void sqlite3AddDefaultValue(Parse *pParse, ExprSpan *pSpan){ ** tokens that point to volatile memory. The 'span' of the expression ** is required by pragma table_info. */ + Expr x; sqlite3ExprDelete(db, pCol->pDflt); - pCol->pDflt = sqlite3ExprDup(db, pSpan->pExpr, EXPRDUP_REDUCE); - sqlite3DbFree(db, pCol->zDflt); - pCol->zDflt = sqlite3DbStrNDup(db, (char*)pSpan->zStart, - (int)(pSpan->zEnd - pSpan->zStart)); + memset(&x, 0, sizeof(x)); + x.op = TK_SPAN; + x.u.zToken = sqlite3DbStrNDup(db, (char*)pSpan->zStart, + (int)(pSpan->zEnd - pSpan->zStart)); + x.pLeft = pSpan->pExpr; + x.flags = EP_Skip; + pCol->pDflt = sqlite3ExprDup(db, &x, EXPRDUP_REDUCE); + sqlite3DbFree(db, x.u.zToken); } } sqlite3ExprDelete(db, pSpan->pExpr); diff --git a/src/expr.c b/src/expr.c index 3070de96fa..8a69732195 100644 --- a/src/expr.c +++ b/src/expr.c @@ -3070,6 +3070,7 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){ sqlite3ReleaseTempReg(pParse, r4); break; } + case TK_SPAN: case TK_COLLATE: case TK_UPLUS: { inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target); diff --git a/src/insert.c b/src/insert.c index 7ff884b8c3..03fdf09acc 100644 --- a/src/insert.c +++ b/src/insert.c @@ -1999,11 +1999,15 @@ static int xferOptimization( return 0; /* tab2 must be NOT NULL if tab1 is */ } /* Default values for second and subsequent columns need to match. */ - if( i>0 - && ((pDestCol->zDflt==0)!=(pSrcCol->zDflt==0) - || (pDestCol->zDflt && strcmp(pDestCol->zDflt, pSrcCol->zDflt)!=0)) - ){ - return 0; /* Default values must be the same for all columns */ + if( i>0 ){ + assert( pDestCol->pDflt==0 || pDestCol->pDflt->op==TK_SPAN ); + assert( pSrcCol->pDflt==0 || pSrcCol->pDflt->op==TK_SPAN ); + if( (pDestCol->pDflt==0)!=(pSrcCol->pDflt==0) + || (pDestCol->pDflt && strcmp(pDestCol->pDflt->u.zToken, + pSrcCol->pDflt->u.zToken)!=0) + ){ + return 0; /* Default values must be the same for all columns */ + } } } for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){ diff --git a/src/pragma.c b/src/pragma.c index 8b8f1f7bfd..0460f663fd 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -1076,12 +1076,13 @@ void sqlite3Pragma( }else{ for(k=1; k<=pTab->nCol && pPk->aiColumn[k-1]!=i; k++){} } + assert( pCol->pDflt==0 || pCol->pDflt->op==TK_SPAN ); sqlite3VdbeMultiLoad(v, 1, "issisi", i-nHidden, pCol->zName, pCol->zType ? pCol->zType : "", pCol->notNull ? 1 : 0, - pCol->zDflt, + pCol->pDflt ? pCol->pDflt->u.zToken : 0, k); sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 6); } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 759d7ca5e1..7d1757e4d8 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1545,7 +1545,6 @@ struct Module { struct Column { char *zName; /* Name of this column */ Expr *pDflt; /* Default value of this column */ - char *zDflt; /* Original text of the default value */ char *zType; /* Data type for this column */ char *zColl; /* Collating sequence. If NULL, use the default */ u8 notNull; /* An OE_ code for handling a NOT NULL constraint */ diff --git a/src/treeview.c b/src/treeview.c index ff3b4be5aa..907159c06d 100644 --- a/src/treeview.c +++ b/src/treeview.c @@ -339,6 +339,12 @@ void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){ case TK_ISNULL: zUniOp = "ISNULL"; break; case TK_NOTNULL: zUniOp = "NOTNULL"; break; + case TK_SPAN: { + sqlite3TreeViewLine(pView, "SPAN %Q", pExpr->u.zToken); + sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); + break; + } + case TK_COLLATE: { sqlite3TreeViewLine(pView, "COLLATE %Q", pExpr->u.zToken); sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); diff --git a/src/vdbemem.c b/src/vdbemem.c index 87d233b980..b5139fe32e 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -1285,7 +1285,7 @@ static int valueFromExpr( *ppVal = 0; return SQLITE_OK; } - while( (op = pExpr->op)==TK_UPLUS ) pExpr = pExpr->pLeft; + while( (op = pExpr->op)==TK_UPLUS || op==TK_SPAN ) pExpr = pExpr->pLeft; if( NEVER(op==TK_REGISTER) ) op = pExpr->op2; /* Compressed expressions only appear when parsing the DEFAULT clause diff --git a/tool/addopcodes.tcl b/tool/addopcodes.tcl index 84e3994ce8..9b34cf2e03 100644 --- a/tool/addopcodes.tcl +++ b/tool/addopcodes.tcl @@ -38,6 +38,7 @@ set extras { UPLUS REGISTER ASTERISK + SPAN SPACE ILLEGAL } From 2881ab6298a431d2e37c7040a722b56c17a33ea6 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 27 Feb 2016 23:25:36 +0000 Subject: [PATCH 33/66] Update the parser so that it pulls out the column name and type all in one go, rather than using separate reductions. FossilOrigin-Name: ad3ffe2eec8e8ea2591a78c723d2665735553cb0 --- manifest | 19 +++++++++++-------- manifest.uuid | 2 +- src/build.c | 39 ++++++++++----------------------------- src/parse.y | 10 +++------- src/sqliteInt.h | 3 +-- 5 files changed, 26 insertions(+), 47 deletions(-) diff --git a/manifest b/manifest index 571cd071e6..ca7a05fd5c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Eliminate\sthe\sneed\sfor\sthe\sColumn.zDflt\s(using\sColumn.pDflt\sinstead)\sto\sreduce\nthe\samount\sof\smemory\sneeded\sto\shold\sthe\sschema. -D 2016-02-27T21:16:04.996 +C Update\sthe\sparser\sso\sthat\sit\spulls\sout\sthe\scolumn\sname\sand\stype\sall\sin\sone\ngo,\srather\sthan\susing\sseparate\sreductions. +D 2016-02-27T23:25:36.278 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -295,7 +295,7 @@ F src/btmutex.c bc87dd3b062cc26edfe79918de2200ccb8d41e73 F src/btree.c 7bb920c473c277380fcb3e8a8ee28ce1a48e0abc F src/btree.h a5008b9afe56e8e54ade6c436a910f112defcca9 F src/btreeInt.h c18b7d2a3494695133e4e60ee36061d37f45d9a5 -F src/build.c 6854e717e3257957b1bd87aadd6371d63937a023 +F src/build.c 8bde0b1cf0bfd94562398d31592b6b8b2b6ba719 F src/callback.c 2e76147783386374bf01b227f752c81ec872d730 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c 60e135af364d777a9ab41c97e5e89cd224da6198 @@ -338,7 +338,7 @@ F src/os_win.c f0d7aa603eb6262143d7169a222aea07c4fca91d F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/pager.c d034c69b958c01289eb8070cbf902e1a68cd7e0b F src/pager.h e1d38a2f14849e219df0f91f8323504d134c8a56 -F src/parse.y c3ce2c4a7cbf0b699239be6b2a945c5cb51875e2 +F src/parse.y 3a29fc291600c48827ea94d5c630972db33e0b81 F src/pcache.c 647bb53a86b7bbcf55ad88089b3ea5a9170b90df F src/pcache.h 4d0ccaad264d360981ec5e6a2b596d6e85242545 F src/pcache1.c 72f644dc9e1468c72922eff5904048427b817051 @@ -354,7 +354,7 @@ F src/shell.c 5e0ab1e708dc294330ccd8230536e1801f60822e F src/sqlite.h.in 57d2a02b14c9ec4f7cb294153eaf62294dc5aa68 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d -F src/sqliteInt.h bcfbf4785436f318459cdbde07a8cce3de7e6f1a +F src/sqliteInt.h 01b43972162c2b5ed864060a23502af3abe0e4f4 F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9 @@ -1451,7 +1451,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f681d800340e0e710f73d0f7c09101f899249183 -R 68cf98086fc7541dd6cf15ff81e4d2e2 +P d8c94a46dfa94930732c2de2aa79675c5087d36e +R 08160a7958aa5578e4603f69af85b704 +T *branch * schema-storage +T *sym-schema-storage * +T -sym-trunk * U drh -Z bde0bd56c07a366738817149aa7f9a7d +Z 64cdb714f146eadb7f54fce29197df77 diff --git a/manifest.uuid b/manifest.uuid index 629362c836..fea3e74ff6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d8c94a46dfa94930732c2de2aa79675c5087d36e \ No newline at end of file +ad3ffe2eec8e8ea2591a78c723d2665735553cb0 \ No newline at end of file diff --git a/src/build.c b/src/build.c index bcf71442de..a655c9a301 100644 --- a/src/build.c +++ b/src/build.c @@ -1038,7 +1038,7 @@ void sqlite3ColumnPropertiesFromName(Table *pTab, Column *pCol){ ** first to get things going. Then this routine is called for each ** column. */ -void sqlite3AddColumn(Parse *pParse, Token *pName){ +void sqlite3AddColumn(Parse *pParse, Token *pName, Token *pType){ Table *p; int i; char *z; @@ -1074,12 +1074,15 @@ void sqlite3AddColumn(Parse *pParse, Token *pName){ pCol->zName = z; sqlite3ColumnPropertiesFromName(p, pCol); - /* If there is no type specified, columns have the default affinity - ** 'BLOB'. If there is a type specified, then sqlite3AddColumnType() will - ** be called next to set pCol->affinity correctly. - */ - pCol->affinity = SQLITE_AFF_BLOB; - pCol->szEst = 1; + if( pType==0 ){ + /* If there is no type specified, columns have the default affinity + ** 'BLOB'. */ + pCol->affinity = SQLITE_AFF_BLOB; + pCol->szEst = 1; + }else{ + pCol->zType = sqlite3NameFromToken(pParse->db, pType); + pCol->affinity = sqlite3AffinityType(pCol->zType, &pCol->szEst); + } p->nCol++; } @@ -1183,28 +1186,6 @@ char sqlite3AffinityType(const char *zIn, u8 *pszEst){ return aff; } -/* -** This routine is called by the parser while in the middle of -** parsing a CREATE TABLE statement. The pFirst token is the first -** token in the sequence of tokens that describe the type of the -** column currently under construction. pLast is the last token -** in the sequence. Use this information to construct a string -** that contains the typename of the column and store that string -** in zType. -*/ -void sqlite3AddColumnType(Parse *pParse, Token *pType){ - Table *p; - Column *pCol; - - p = pParse->pNewTable; - if( p==0 || NEVER(p->nCol<1) ) return; - pCol = &p->aCol[p->nCol-1]; - assert( pCol->zType==0 || CORRUPT_DB ); - sqlite3DbFree(pParse->db, pCol->zType); - pCol->zType = sqlite3NameFromToken(pParse->db, pType); - pCol->affinity = sqlite3AffinityType(pCol->zType, &pCol->szEst); -} - /* ** The expression is the default value for the most recently added column ** of the table currently under construction. diff --git a/src/parse.y b/src/parse.y index e7e0d1d953..b8ae8c8dc1 100644 --- a/src/parse.y +++ b/src/parse.y @@ -198,13 +198,11 @@ columnlist ::= column. // datatype, and other keywords such as PRIMARY KEY, UNIQUE, REFERENCES, // NOT NULL and so forth. // -column(A) ::= columnid(A) type carglist. { +column(A) ::= columnname(A) carglist. { A.n = (int)(pParse->sLastToken.z-A.z) + pParse->sLastToken.n; } -columnid(A) ::= nm(A). { - sqlite3AddColumn(pParse,&A); - pParse->constraintName.n = 0; -} +columnname(A) ::= nm(A) typetoken(Y). {sqlite3AddColumn(pParse,&A,&Y);} +columnname(A) ::= nm(A). {sqlite3AddColumn(pParse,&A,0);} // An IDENTIFIER can be a generic identifier, or one of several @@ -269,8 +267,6 @@ nm(A) ::= JOIN_KW(A). // Multiple tokens are concatenated to form the value of the typetoken. // %type typetoken {Token} -type ::= . -type ::= typetoken(X). {sqlite3AddColumnType(pParse,&X);} typetoken(A) ::= typename(A). typetoken(A) ::= typename(A) LP signed RP(Y). { A.n = (int)(&Y.z[Y.n] - A.z); diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 7d1757e4d8..d6acc3227b 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3413,11 +3413,10 @@ void sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int); #else # define sqlite3ColumnPropertiesFromName(T,C) /* no-op */ #endif -void sqlite3AddColumn(Parse*,Token*); +void sqlite3AddColumn(Parse*,Token*,Token*); void sqlite3AddNotNull(Parse*, int); void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int); void sqlite3AddCheckConstraint(Parse*, Expr*); -void sqlite3AddColumnType(Parse*,Token*); void sqlite3AddDefaultValue(Parse*,ExprSpan*); void sqlite3AddCollateType(Parse*, Token*); void sqlite3EndTable(Parse*,Token*,Token*,u8,Select*); From 986dde705234f9a9e9e60f4d75eb60dd0c94ccf3 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 29 Feb 2016 13:37:21 +0000 Subject: [PATCH 34/66] Further simplifications to the grammar. FossilOrigin-Name: 519fd03b845c9b53df9e5397282df2e99f36a672 --- manifest | 17 +++++++---------- manifest.uuid | 2 +- src/build.c | 3 ++- src/parse.y | 24 ++++++++---------------- 4 files changed, 18 insertions(+), 28 deletions(-) diff --git a/manifest b/manifest index ca7a05fd5c..d09c8a0810 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthe\sparser\sso\sthat\sit\spulls\sout\sthe\scolumn\sname\sand\stype\sall\sin\sone\ngo,\srather\sthan\susing\sseparate\sreductions. -D 2016-02-27T23:25:36.278 +C Further\ssimplifications\sto\sthe\sgrammar. +D 2016-02-29T13:37:21.189 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -295,7 +295,7 @@ F src/btmutex.c bc87dd3b062cc26edfe79918de2200ccb8d41e73 F src/btree.c 7bb920c473c277380fcb3e8a8ee28ce1a48e0abc F src/btree.h a5008b9afe56e8e54ade6c436a910f112defcca9 F src/btreeInt.h c18b7d2a3494695133e4e60ee36061d37f45d9a5 -F src/build.c 8bde0b1cf0bfd94562398d31592b6b8b2b6ba719 +F src/build.c 5a3e2c884c7fd30f1cc46424fc1f816cc1218f5d F src/callback.c 2e76147783386374bf01b227f752c81ec872d730 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c 60e135af364d777a9ab41c97e5e89cd224da6198 @@ -338,7 +338,7 @@ F src/os_win.c f0d7aa603eb6262143d7169a222aea07c4fca91d F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/pager.c d034c69b958c01289eb8070cbf902e1a68cd7e0b F src/pager.h e1d38a2f14849e219df0f91f8323504d134c8a56 -F src/parse.y 3a29fc291600c48827ea94d5c630972db33e0b81 +F src/parse.y 5ea8c81c5c41b27887f41b4a7e1c58470d7d3821 F src/pcache.c 647bb53a86b7bbcf55ad88089b3ea5a9170b90df F src/pcache.h 4d0ccaad264d360981ec5e6a2b596d6e85242545 F src/pcache1.c 72f644dc9e1468c72922eff5904048427b817051 @@ -1451,10 +1451,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d8c94a46dfa94930732c2de2aa79675c5087d36e -R 08160a7958aa5578e4603f69af85b704 -T *branch * schema-storage -T *sym-schema-storage * -T -sym-trunk * +P ad3ffe2eec8e8ea2591a78c723d2665735553cb0 +R 4784b7c67e30974242406c3dce382bf0 U drh -Z 64cdb714f146eadb7f54fce29197df77 +Z 37a93f7c979e487a92cbbe58a4d1f8f4 diff --git a/manifest.uuid b/manifest.uuid index fea3e74ff6..eb7843b3f9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ad3ffe2eec8e8ea2591a78c723d2665735553cb0 \ No newline at end of file +519fd03b845c9b53df9e5397282df2e99f36a672 \ No newline at end of file diff --git a/src/build.c b/src/build.c index a655c9a301..ec8770a454 100644 --- a/src/build.c +++ b/src/build.c @@ -1074,7 +1074,7 @@ void sqlite3AddColumn(Parse *pParse, Token *pName, Token *pType){ pCol->zName = z; sqlite3ColumnPropertiesFromName(p, pCol); - if( pType==0 ){ + if( pType->n==0 ){ /* If there is no type specified, columns have the default affinity ** 'BLOB'. */ pCol->affinity = SQLITE_AFF_BLOB; @@ -1084,6 +1084,7 @@ void sqlite3AddColumn(Parse *pParse, Token *pName, Token *pType){ pCol->affinity = sqlite3AffinityType(pCol->zType, &pCol->szEst); } p->nCol++; + pParse->constraintName.n = 0; } /* diff --git a/src/parse.y b/src/parse.y index b8ae8c8dc1..20492edb80 100644 --- a/src/parse.y +++ b/src/parse.y @@ -190,20 +190,9 @@ table_options(A) ::= WITHOUT nm(X). { sqlite3ErrorMsg(pParse, "unknown table option: %.*s", X.n, X.z); } } -columnlist ::= columnlist COMMA column. -columnlist ::= column. - -// A "column" is a complete description of a single column in a -// CREATE TABLE statement. This includes the column name, its -// datatype, and other keywords such as PRIMARY KEY, UNIQUE, REFERENCES, -// NOT NULL and so forth. -// -column(A) ::= columnname(A) carglist. { - A.n = (int)(pParse->sLastToken.z-A.z) + pParse->sLastToken.n; -} +columnlist ::= columnlist COMMA columnname carglist. +columnlist ::= columnname carglist. columnname(A) ::= nm(A) typetoken(Y). {sqlite3AddColumn(pParse,&A,&Y);} -columnname(A) ::= nm(A). {sqlite3AddColumn(pParse,&A,0);} - // An IDENTIFIER can be a generic identifier, or one of several // keywords. Any non-standard keyword can also be an identifier. @@ -262,11 +251,12 @@ nm(A) ::= id(A). nm(A) ::= STRING(A). nm(A) ::= JOIN_KW(A). -// A typetoken is really one or more tokens that form a type name such +// A typetoken is really zero or more tokens that form a type name such // as can be found after the column name in a CREATE TABLE statement. // Multiple tokens are concatenated to form the value of the typetoken. // %type typetoken {Token} +typetoken(A) ::= . {A.n = 0; A.z = 0;} typetoken(A) ::= typename(A). typetoken(A) ::= typename(A) LP signed RP(Y). { A.n = (int)(&Y.z[Y.n] - A.z); @@ -576,7 +566,7 @@ selcollist(A) ::= sclp(A) nm(X) DOT STAR(Y). { %type as {Token} as(X) ::= AS nm(Y). {X = Y;} as(X) ::= ids(X). -as(X) ::= . {X.n = 0;} +as(X) ::= . {X.n = 0; X.z = 0;} %type seltablist {SrcList*} @@ -1495,7 +1485,9 @@ cmd ::= ANALYZE nm(X) dbnm(Y). {sqlite3Analyze(pParse, &X, &Y);} cmd ::= ALTER TABLE fullname(X) RENAME TO nm(Z). { sqlite3AlterRenameTable(pParse,X,&Z); } -cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column(Y). { +cmd ::= ALTER TABLE add_column_fullname + ADD kwcolumn_opt columnname(Y) carglist. { + Y.n = (int)(pParse->sLastToken.z-Y.z) + pParse->sLastToken.n; sqlite3AlterFinishAddColumn(pParse, &Y); } add_column_fullname ::= fullname(X). { From 94eaafa9ce6e044b834c56c712d18ba3c1f6d91d Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 29 Feb 2016 15:53:11 +0000 Subject: [PATCH 35/66] Reduce the amount of heap required to store many schemas by storing each column datatype appended to the column name, rather than as a separate allocation. FossilOrigin-Name: 842b21162713bb141b845b01c136457a31af4ab0 --- manifest | 30 ++++++++++++++++-------------- manifest.uuid | 2 +- src/alter.c | 1 - src/build.c | 22 ++++++++++++++-------- src/main.c | 3 ++- src/pragma.c | 6 ++++-- src/select.c | 9 +++------ src/sqliteInt.h | 4 ++-- src/util.c | 8 ++++++++ src/vtab.c | 4 ++-- 10 files changed, 52 insertions(+), 37 deletions(-) diff --git a/manifest b/manifest index cb3d41bb09..a8c210da9f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Very\sminor\simprovement\sto\sthe\sperformance\sand\sreduction\sin\ssize\sto\sthe\nparser\sby\scapturing\sthe\sname\sand\sdatatype\sof\stable\scolumns\sin\sa\ssingle\ngrammar\srule\sreduction. -D 2016-02-29T13:44:38.497 +C Reduce\sthe\samount\sof\sheap\srequired\sto\sstore\smany\sschemas\sby\sstoring\seach\ncolumn\sdatatype\sappended\sto\sthe\scolumn\sname,\srather\sthan\sas\sa\sseparate\nallocation. +D 2016-02-29T15:53:11.458 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -285,7 +285,7 @@ F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786 F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a -F src/alter.c 44e18dfd78e8942d65d3cdaec4de972b5cd9f1f2 +F src/alter.c 1bb0709b3048e24217b80ec6bd78a3e99a47c01b F src/analyze.c ab57b6763dd4c6170a20673d14882c033affd188 F src/attach.c a3724c64de1099d85e30751213d285752aed9505 F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 @@ -295,7 +295,7 @@ F src/btmutex.c bc87dd3b062cc26edfe79918de2200ccb8d41e73 F src/btree.c 7bb920c473c277380fcb3e8a8ee28ce1a48e0abc F src/btree.h a5008b9afe56e8e54ade6c436a910f112defcca9 F src/btreeInt.h c18b7d2a3494695133e4e60ee36061d37f45d9a5 -F src/build.c 5a3e2c884c7fd30f1cc46424fc1f816cc1218f5d +F src/build.c 43b93fe757bfffe00f97462596418b052eefdccd F src/callback.c 2e76147783386374bf01b227f752c81ec872d730 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c 60e135af364d777a9ab41c97e5e89cd224da6198 @@ -314,7 +314,7 @@ F src/insert.c 723d5d708cdb61bdd47c00b9f07c75be45aefc09 F src/journal.c fe3a3e2559ce3ce9d371afd30fbabbc074174575 F src/legacy.c 75d3023be8f0d2b99d60f905090341a03358c58e F src/loadext.c 9e2a41adcaff16ebc1ebff1f336cbf33de55396f -F src/main.c be9309f442ec291177642d2e48e82290e0951f4b +F src/main.c 32c45647866429f34d7a13a717172a8e7d0a1056 F src/malloc.c 1443d1ad95d67c21d77af7ae3f44678252f0efec F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 6919bcf12f221868ea066eec27e579fed95ce98b @@ -342,19 +342,19 @@ F src/parse.y 5ea8c81c5c41b27887f41b4a7e1c58470d7d3821 F src/pcache.c 647bb53a86b7bbcf55ad88089b3ea5a9170b90df F src/pcache.h 4d0ccaad264d360981ec5e6a2b596d6e85242545 F src/pcache1.c 72f644dc9e1468c72922eff5904048427b817051 -F src/pragma.c 35619c4e9f79049cce964ef8ed9710ae3e5b9ca1 +F src/pragma.c 42b3f1475b483710ba1dd1cc1ecc0c0f8db59a2e F src/pragma.h 64c78a648751b9f4f297276c4eb7507b14b4628c F src/prepare.c 22df6171aec1d86904ed2ad30c2348a5748aa04e F src/printf.c 63e6fb12bbe702dd664dc3703776c090383a5a26 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c b8f7174e5f8c33c44ded3a25a973d0bb89228c20 F src/rowset.c 9fe4b3ad7cc00944386bb600233d8f523de07a6e -F src/select.c 1bacfde7b7cec134d2b354cbcf67bafc67078431 +F src/select.c 137b31daa84d57d67847bf621bb54f3353e2077b F src/shell.c 5e0ab1e708dc294330ccd8230536e1801f60822e F src/sqlite.h.in 57d2a02b14c9ec4f7cb294153eaf62294dc5aa68 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d -F src/sqliteInt.h 01b43972162c2b5ed864060a23502af3abe0e4f4 +F src/sqliteInt.h 8aa9992cb35289ede0946f7ba8e993070e040fc4 F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9 @@ -412,7 +412,7 @@ F src/treeview.c e4b41a37530a191579d3c53142cc44ee2eb99373 F src/trigger.c e14840ee0c3e549e758ec9bf3e4146e166002280 F src/update.c a7eeeaffad59c6506f01303a071dac11de8269ca F src/utf.c 699001c79f28e48e9bcdf8a463da029ea660540c -F src/util.c 6ed9d7bdd3b0a30742027b6d8e8e1a9e2b14f373 +F src/util.c a64585a74aef6feb16dfe4e090b5de01e26eba3b F src/vacuum.c feb1eabb20987983d9350cad98299b21fa811f52 F src/vdbe.c 87ae3a5657fefed7875f3eb30e7ababd48013d71 F src/vdbe.h c743791f723049db94f009e3e30958952bc2d512 @@ -423,7 +423,7 @@ F src/vdbeblob.c 3b570b730109e8f653d9d2081649f6e7015113db F src/vdbemem.c 9b0cb32cc267ef026515f15a3594d5ff91fe4dfc F src/vdbesort.c 307460bfa4de4d1c3901fcd42089159131e34062 F src/vdbetrace.c f75c5455d8cf389ef86a8bfdfd3177e0e3692484 -F src/vtab.c 943c23b355f0a8f859f9583e7315d64bebdb0899 +F src/vtab.c fd69fd398e23e57ea4ea377d8a44b6998fc569c7 F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c 10deb6b43887662691e5f53d10b3c171c401169b F src/wal.h 2f7c831cf3b071fa548bf2d5cac640846a7ff19c @@ -1451,8 +1451,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d8c94a46dfa94930732c2de2aa79675c5087d36e 519fd03b845c9b53df9e5397282df2e99f36a672 -R 4784b7c67e30974242406c3dce382bf0 -T +closed 519fd03b845c9b53df9e5397282df2e99f36a672 +P 4b55c520f554163edc174e5995e66242f169cb04 +R 124650c3359b5cb373643178bc007cde +T *branch * schema-storage +T *sym-schema-storage * +T -sym-trunk * U drh -Z 5a7ee41f15f54141d2ddaa0e30d16756 +Z 9b6160e72c73eb18b594df11fb333e9a diff --git a/manifest.uuid b/manifest.uuid index 6cb702eb1f..472d0208d0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4b55c520f554163edc174e5995e66242f169cb04 \ No newline at end of file +842b21162713bb141b845b01c136457a31af4ab0 \ No newline at end of file diff --git a/src/alter.c b/src/alter.c index 9edd7fff3c..642c1fb677 100644 --- a/src/alter.c +++ b/src/alter.c @@ -786,7 +786,6 @@ void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){ Column *pCol = &pNew->aCol[i]; pCol->zName = sqlite3DbStrDup(db, pCol->zName); pCol->zColl = 0; - pCol->zType = 0; pCol->pDflt = 0; } pNew->pSchema = db->aDb[iDb].pSchema; diff --git a/src/build.c b/src/build.c index ec8770a454..a32dfbd029 100644 --- a/src/build.c +++ b/src/build.c @@ -571,7 +571,6 @@ void sqlite3DeleteColumnNames(sqlite3 *db, Table *pTable){ for(i=0; inCol; i++, pCol++){ sqlite3DbFree(db, pCol->zName); sqlite3ExprDelete(db, pCol->pDflt); - sqlite3DbFree(db, pCol->zType); sqlite3DbFree(db, pCol->zColl); } sqlite3DbFree(db, pTable->aCol); @@ -1042,6 +1041,7 @@ void sqlite3AddColumn(Parse *pParse, Token *pName, Token *pType){ Table *p; int i; char *z; + char *zType; Column *pCol; sqlite3 *db = pParse->db; if( (p = pParse->pNewTable)==0 ) return; @@ -1051,8 +1051,14 @@ void sqlite3AddColumn(Parse *pParse, Token *pName, Token *pType){ return; } #endif - z = sqlite3NameFromToken(db, pName); + z = sqlite3DbMallocRaw(db, pName->n + pType->n + 2); if( z==0 ) return; + memcpy(z, pName->z, pName->n); + z[pName->n] = 0; + sqlite3Dequote(z); + zType = z + sqlite3Strlen30(z) + 1; + memcpy(zType, pType->z, pType->n); + zType[pType->n] = 0; for(i=0; inCol; i++){ if( sqlite3_stricmp(z, p->aCol[i].zName)==0 ){ sqlite3ErrorMsg(pParse, "duplicate column name: %s", z); @@ -1080,8 +1086,7 @@ void sqlite3AddColumn(Parse *pParse, Token *pName, Token *pType){ pCol->affinity = SQLITE_AFF_BLOB; pCol->szEst = 1; }else{ - pCol->zType = sqlite3NameFromToken(pParse->db, pType); - pCol->affinity = sqlite3AffinityType(pCol->zType, &pCol->szEst); + pCol->affinity = sqlite3AffinityType(zType, &pCol->szEst); } p->nCol++; pParse->constraintName.n = 0; @@ -1277,7 +1282,7 @@ void sqlite3AddPrimaryKey( int sortOrder /* SQLITE_SO_ASC or SQLITE_SO_DESC */ ){ Table *pTab = pParse->pNewTable; - char *zType = 0; + const char *zName = 0; int iCol = -1, i; int nTerm; if( pTab==0 || IN_DECLARE_VTAB ) goto primary_key_exit; @@ -1290,7 +1295,7 @@ void sqlite3AddPrimaryKey( if( pList==0 ){ iCol = pTab->nCol - 1; pTab->aCol[iCol].colFlags |= COLFLAG_PRIMKEY; - zType = pTab->aCol[iCol].zType; + zName = pTab->aCol[iCol].zName; nTerm = 1; }else{ nTerm = pList->nExpr; @@ -1303,7 +1308,7 @@ void sqlite3AddPrimaryKey( for(iCol=0; iColnCol; iCol++){ if( sqlite3StrICmp(zCName, pTab->aCol[iCol].zName)==0 ){ pTab->aCol[iCol].colFlags |= COLFLAG_PRIMKEY; - zType = pTab->aCol[iCol].zType; + zName = pTab->aCol[iCol].zName; break; } } @@ -1311,7 +1316,8 @@ void sqlite3AddPrimaryKey( } } if( nTerm==1 - && zType && sqlite3StrICmp(zType, "INTEGER")==0 + && zName + && sqlite3StrICmp(sqlite3StrNext(zName), "INTEGER")==0 && sortOrder!=SQLITE_SO_DESC ){ pTab->iPKey = iCol; diff --git a/src/main.c b/src/main.c index 2a258da662..3ba5972fa6 100644 --- a/src/main.c +++ b/src/main.c @@ -3335,7 +3335,8 @@ int sqlite3_table_column_metadata( ** explicitly declared column. Copy meta information from *pCol. */ if( pCol ){ - zDataType = pCol->zType; + zDataType = sqlite3StrNext(pCol->zName); + if( zDataType[0]==0 ) zDataType = 0; zCollSeq = pCol->zColl; notnull = pCol->notNull!=0; primarykey = (pCol->colFlags & COLFLAG_PRIMKEY)!=0; diff --git a/src/pragma.c b/src/pragma.c index 0460f663fd..1d62914310 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -1065,6 +1065,7 @@ void sqlite3Pragma( setAllColumnNames(v, 6, azCol); assert( 6==ArraySize(azCol) ); sqlite3ViewGetColumnNames(pParse, pTab); for(i=0, pCol=pTab->aCol; inCol; i++, pCol++){ + const char *zName; if( IsHiddenColumn(pCol) ){ nHidden++; continue; @@ -1077,10 +1078,11 @@ void sqlite3Pragma( for(k=1; k<=pTab->nCol && pPk->aiColumn[k-1]!=i; k++){} } assert( pCol->pDflt==0 || pCol->pDflt->op==TK_SPAN ); + zName = pCol->zName; sqlite3VdbeMultiLoad(v, 1, "issisi", i-nHidden, - pCol->zName, - pCol->zType ? pCol->zType : "", + zName, + sqlite3StrNext(zName), pCol->notNull ? 1 : 0, pCol->pDflt ? pCol->pDflt->u.zToken : 0, k); diff --git a/src/select.c b/src/select.c index aa1f214855..c9bc389b2f 100644 --- a/src/select.c +++ b/src/select.c @@ -1429,8 +1429,8 @@ static const char *columnTypeImpl( zType = "INTEGER"; zOrigCol = "rowid"; }else{ - zType = pTab->aCol[iCol].zType; zOrigCol = pTab->aCol[iCol].zName; + zType = sqlite3StrNext(zOrigCol); estWidth = pTab->aCol[iCol].szEst; } zOrigTab = pTab->zName; @@ -1442,7 +1442,7 @@ static const char *columnTypeImpl( if( iCol<0 ){ zType = "INTEGER"; }else{ - zType = pTab->aCol[iCol].zType; + zType = sqlite3StrNext(pTab->aCol[iCol].zName); estWidth = pTab->aCol[iCol].szEst; } #endif @@ -1727,10 +1727,7 @@ static void selectAddColumnTypeAndCollation( a = pSelect->pEList->a; for(i=0, pCol=pTab->aCol; inCol; i++, pCol++){ p = a[i].pExpr; - if( pCol->zType==0 ){ - pCol->zType = sqlite3DbStrDup(db, - columnType(&sNC, p,0,0,0, &pCol->szEst)); - } + columnType(&sNC, p, 0, 0, 0, &pCol->szEst); szAll += pCol->szEst; pCol->affinity = sqlite3ExprAffinity(p); if( pCol->affinity==0 ) pCol->affinity = SQLITE_AFF_BLOB; diff --git a/src/sqliteInt.h b/src/sqliteInt.h index d6acc3227b..a37da33ed2 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1543,9 +1543,8 @@ struct Module { ** of this structure. */ struct Column { - char *zName; /* Name of this column */ + char *zName; /* Name of this column, \000, then the type */ Expr *pDflt; /* Default value of this column */ - char *zType; /* Data type for this column */ char *zColl; /* Collating sequence. If NULL, use the default */ u8 notNull; /* An OE_ code for handling a NOT NULL constraint */ char affinity; /* One of the SQLITE_AFF_... values */ @@ -3258,6 +3257,7 @@ int sqlite3IsIdChar(u8); */ int sqlite3StrICmp(const char*,const char*); int sqlite3Strlen30(const char*); +const char *sqlite3StrNext(const char*); #define sqlite3StrNICmp sqlite3_strnicmp int sqlite3MallocInit(void); diff --git a/src/util.c b/src/util.c index d00a739e53..81274260f4 100644 --- a/src/util.c +++ b/src/util.c @@ -109,6 +109,14 @@ int sqlite3Strlen30(const char *z){ return 0x3fffffff & (int)strlen(z); } +/* +** The string z[] is followed immediately by another string. Return +** a poiner to that other string. +*/ +const char *sqlite3StrNext(const char *z){ + return z + strlen(z) + 1; +} + /* ** Set the current error code to err_code and clear any prior error message. */ diff --git a/src/vtab.c b/src/vtab.c index fa19548199..ad8caef3bc 100644 --- a/src/vtab.c +++ b/src/vtab.c @@ -564,10 +564,10 @@ static int vtabCallConstructor( pTab->pVTable = pVTable; for(iCol=0; iColnCol; iCol++){ - char *zType = pTab->aCol[iCol].zType; + char *zType = (char*)sqlite3StrNext(pTab->aCol[iCol].zName); int nType; int i = 0; - if( !zType ){ + if( !zType[0] ){ pTab->tabFlags |= oooHidden; continue; } From 437a54eabaa3b2d92157bcf087c1342642189e34 Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 29 Feb 2016 17:16:26 +0000 Subject: [PATCH 36/66] Fix an fts5 problem causing 'optimize' to corrupt the fts index under some circumstances. FossilOrigin-Name: 251d6473f7c9ad95adbdcc49cb8eaf7c0956764b --- ext/fts5/fts5_index.c | 5 ++++- ext/fts5/test/fts5simple.test | 20 ++++++++++++++++++++ manifest | 17 ++++++++--------- manifest.uuid | 2 +- 4 files changed, 33 insertions(+), 11 deletions(-) diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c index 57d242bc3c..cb6360ad67 100644 --- a/ext/fts5/fts5_index.c +++ b/ext/fts5/fts5_index.c @@ -4499,7 +4499,10 @@ int sqlite3Fts5IndexOptimize(Fts5Index *p){ if( pLvl->aSeg ){ int iLvl, iSeg; int iSegOut = 0; - for(iLvl=0; iLvlnLevel; iLvl++){ + /* Iterate through all segments, from oldest to newest. Add them to + ** the new Fts5Level object so that pLvl->aSeg[0] is the oldest + ** segment in the data structure. */ + for(iLvl=pStruct->nLevel-1; iLvl>=0; iLvl--){ for(iSeg=0; iSegaLevel[iLvl].nSeg; iSeg++){ pLvl->aSeg[iSegOut] = pStruct->aLevel[iLvl].aSeg[iSeg]; iSegOut++; diff --git a/ext/fts5/test/fts5simple.test b/ext/fts5/test/fts5simple.test index a095a16230..01111d78c8 100644 --- a/ext/fts5/test/fts5simple.test +++ b/ext/fts5/test/fts5simple.test @@ -409,5 +409,25 @@ do_catchsql_test 19.2 { SELECT * FROM x1 WHERE x1 MATCH 'c0 AND (c1 AND (c2 AND (c3 AND (c4 AND (c5 AND (c6 AND (c7 AND (c8 AND (c9 AND (c10 AND (c11 AND (c12 AND (c13 AND (c14 AND (c15 AND (c16 AND (c17 AND (c18 AND (c19 AND (c20 AND (c21 AND (c22 AND (c23 AND (c24 AND (c25 AND (c26 AND (c27 AND (c28 AND (c29 AND (c30 AND (c31 AND (c32 AND (c33 AND (c34 AND (c35 AND (c36 AND (c37 AND (c38 AND (c39 AND (c40 AND (c41 AND (c42 AND (c43 AND (c44 AND (c45 AND (c46 AND (c47 AND (c48 AND (c49 AND (c50 AND (c51 AND (c52 AND (c53 AND (c54 AND (c55 AND (c56 AND (c57 AND (c58 AND (c59 AND (c60 AND (c61 AND (c62 AND (c63 AND (c64 AND (c65 AND (c66 AND (c67 AND (c68 AND (c69 AND (c70 AND (c71 AND (c72 AND (c73 AND (c74 AND (c75 AND (c76 AND (c77 AND (c78 AND (c79 AND (c80 AND (c81 AND (c82 AND (c83 AND (c84 AND (c85 AND (c86 AND (c87 AND (c88 AND (c89 AND (c90 AND (c91 AND (c92 AND (c93 AND (c94 AND (c95 AND (c96 AND (c97 AND (c98 AND (c99 AND (c100 AND (c101 AND (c102 AND (c103 AND (c104 AND (c105 AND (c106 AND (c107 AND (c108 AND (c109 AND (c110 AND (c111 AND (c112 AND (c113 AND (c114 AND (c115 AND (c116 AND (c117 AND (c118 AND (c119 AND (c120 AND (c121 AND (c122 AND (c123 AND (c124 AND (c125 AND (c126 AND (c127 AND (c128 AND (c129 AND (c130 AND (c131 AND (c132 AND (c133 AND (c134 AND (c135 AND (c136 AND (c137 AND (c138 AND (c139 AND (c140 AND (c141 AND (c142 AND (c143 AND (c144 AND (c145 AND (c146 AND (c147 AND (c148 AND (c149 AND (c150 AND (c151 AND (c152 AND (c153 AND (c154 AND (c155 AND (c156 AND (c157 AND (c158 AND (c159 AND (c160 AND (c161 AND (c162 AND (c163 AND (c164 AND (c165 AND (c166 AND (c167 AND (c168 AND (c169 AND (c170 AND (c171 AND (c172 AND (c173 AND (c174 AND (c175 AND (c176 AND (c177 AND (c178 AND (c179 AND (c180 AND (c181 AND (c182 AND (c183 AND (c184 AND (c185 AND (c186 AND (c187 AND (c188 AND (c189 AND (c190 AND (c191 AND (c192 AND (c193 AND (c194 AND (c195 AND (c196 AND (c197 AND (c198 AND (c199 AND c200)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'; } {1 {fts5: parser stack overflow}} +#------------------------------------------------------------------------- +reset_db +breakpoint +do_execsql_test 20.0 { + CREATE VIRTUAL TABLE x1 USING fts5(x); + INSERT INTO x1(x1, rank) VALUES('pgsz', 32); + INSERT INTO x1(rowid, x) VALUES(11111, 'onetwothree'); +} +do_test 20.1 { + for {set i 1} {$i <= 200} {incr i} { + execsql { INSERT INTO x1(rowid, x) VALUES($i, 'one two three'); } + } + execsql { INSERT INTO x1(x1) VALUES('optimize'); } + execsql { DELETE FROM x1 WHERE rowid = 4; } +} {} +do_execsql_test 20.2 { + INSERT INTO x1(x1) VALUES('optimize'); + INSERT INTO x1(x1) VALUES('integrity-check'); +} {} + finish_test diff --git a/manifest b/manifest index cb3d41bb09..0a0a2a762c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Very\sminor\simprovement\sto\sthe\sperformance\sand\sreduction\sin\ssize\sto\sthe\nparser\sby\scapturing\sthe\sname\sand\sdatatype\sof\stable\scolumns\sin\sa\ssingle\ngrammar\srule\sreduction. -D 2016-02-29T13:44:38.497 +C Fix\san\sfts5\sproblem\scausing\s'optimize'\sto\scorrupt\sthe\sfts\sindex\sunder\ssome\scircumstances. +D 2016-02-29T17:16:26.225 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -104,7 +104,7 @@ F ext/fts5/fts5_buffer.c 4c1502d4c956cd092c89ce4480867f9d8bf325cd F ext/fts5/fts5_config.c 35c5173cae4eb17e82164a7f5aeef56a48903079 F ext/fts5/fts5_expr.c 8e8e4635f655133eb39018072fc0f0942a2c4337 F ext/fts5/fts5_hash.c f3a7217c86eb8f272871be5f6aa1b6798960a337 -F ext/fts5/fts5_index.c 78069efb54559a17c35906a741362d0b5c899bd0 +F ext/fts5/fts5_index.c 745bc6f0e0c13c3b659be0bae72fa6067d1708c9 F ext/fts5/fts5_main.c db24ac714c6c4a1b3c24a1f8c25889f2952148c1 F ext/fts5/fts5_storage.c f8343db90d8c95a4d4b52f6676e354b4649ffd6e F ext/fts5/fts5_tcl.c f8731e0508299bd43f1a2eff7dbeaac870768966 @@ -177,7 +177,7 @@ F ext/fts5/test/fts5rank.test 7e9e64eac7245637f6f2033aec4b292aaf611aab F ext/fts5/test/fts5rebuild.test 03935f617ace91ed23a6099c7c74d905227ff29b F ext/fts5/test/fts5restart.test c17728fdea26e7d0f617d22ad5b4b2862b994c17 F ext/fts5/test/fts5rowid.test 16908a99d6efc9ba21081b4f2b86b3fc699839a6 -F ext/fts5/test/fts5simple.test e6fe2fb10a2b9193648b32bbc2caecabdf8c333d +F ext/fts5/test/fts5simple.test 92e06be1c119f88a73ea11a05599a276ec3ff7fd F ext/fts5/test/fts5simple2.test 98377ae1ff7749a42c21fe1a139c1ed312522c46 F ext/fts5/test/fts5simple3.test 8e71733b3d1b0e695011d02c68ebc5ca40b6124e F ext/fts5/test/fts5synonym.test 6475d189c2e20d60795808f83e36bf9318708d48 @@ -1451,8 +1451,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d8c94a46dfa94930732c2de2aa79675c5087d36e 519fd03b845c9b53df9e5397282df2e99f36a672 -R 4784b7c67e30974242406c3dce382bf0 -T +closed 519fd03b845c9b53df9e5397282df2e99f36a672 -U drh -Z 5a7ee41f15f54141d2ddaa0e30d16756 +P 4b55c520f554163edc174e5995e66242f169cb04 +R e6d22f9f71f3990f592583cd83eb05c9 +U dan +Z fe2b648248ba7cac53004b260ee02700 diff --git a/manifest.uuid b/manifest.uuid index 6cb702eb1f..6e08bfef94 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4b55c520f554163edc174e5995e66242f169cb04 \ No newline at end of file +251d6473f7c9ad95adbdcc49cb8eaf7c0956764b \ No newline at end of file From 4e9d0d54183e8790a1055a92b34d27580910d18c Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 29 Feb 2016 17:34:16 +0000 Subject: [PATCH 37/66] Fix a problem in fts5 where a corrupt db could lead to a (huge) buffer overread. FossilOrigin-Name: c9a30e117f2c6c9ef0cc0c6ca5227d2961715b8f --- ext/fts5/fts5_index.c | 5 +++++ manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c index cb6360ad67..ac97a7d75f 100644 --- a/ext/fts5/fts5_index.c +++ b/ext/fts5/fts5_index.c @@ -698,6 +698,7 @@ static Fts5Data *fts5DataRead(Fts5Index *p, i64 iRowid){ return pRet; } + /* ** Release a reference to data record returned by an earlier call to ** fts5DataRead(). @@ -2154,6 +2155,10 @@ static void fts5LeafSeek( iPgidx = szLeaf; iPgidx += fts5GetVarint32(&a[iPgidx], iTermOff); iOff = iTermOff; + if( iOff>n ){ + p->rc = FTS5_CORRUPT; + return; + } while( 1 ){ diff --git a/manifest b/manifest index 0a0a2a762c..bacddf080c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\san\sfts5\sproblem\scausing\s'optimize'\sto\scorrupt\sthe\sfts\sindex\sunder\ssome\scircumstances. -D 2016-02-29T17:16:26.225 +C Fix\sa\sproblem\sin\sfts5\swhere\sa\scorrupt\sdb\scould\slead\sto\sa\s(huge)\sbuffer\soverread. +D 2016-02-29T17:34:16.069 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -104,7 +104,7 @@ F ext/fts5/fts5_buffer.c 4c1502d4c956cd092c89ce4480867f9d8bf325cd F ext/fts5/fts5_config.c 35c5173cae4eb17e82164a7f5aeef56a48903079 F ext/fts5/fts5_expr.c 8e8e4635f655133eb39018072fc0f0942a2c4337 F ext/fts5/fts5_hash.c f3a7217c86eb8f272871be5f6aa1b6798960a337 -F ext/fts5/fts5_index.c 745bc6f0e0c13c3b659be0bae72fa6067d1708c9 +F ext/fts5/fts5_index.c 26a4a6112864feb599a6f6144d06a78bb179736a F ext/fts5/fts5_main.c db24ac714c6c4a1b3c24a1f8c25889f2952148c1 F ext/fts5/fts5_storage.c f8343db90d8c95a4d4b52f6676e354b4649ffd6e F ext/fts5/fts5_tcl.c f8731e0508299bd43f1a2eff7dbeaac870768966 @@ -1451,7 +1451,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 4b55c520f554163edc174e5995e66242f169cb04 -R e6d22f9f71f3990f592583cd83eb05c9 +P 251d6473f7c9ad95adbdcc49cb8eaf7c0956764b +R 1a43d3061a1f154a38fc05ffa17e1f4a U dan -Z fe2b648248ba7cac53004b260ee02700 +Z 0ef60cd2035dd9bea82e9df13f5bcf57 diff --git a/manifest.uuid b/manifest.uuid index 6e08bfef94..2a4a25da5e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -251d6473f7c9ad95adbdcc49cb8eaf7c0956764b \ No newline at end of file +c9a30e117f2c6c9ef0cc0c6ca5227d2961715b8f \ No newline at end of file From 5f37ed5121b705f6e2683b071a4bf34f66005cb9 Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 29 Feb 2016 20:00:13 +0000 Subject: [PATCH 38/66] Fix minor problems with new code in memjournal.c. FossilOrigin-Name: 9fd3f7b9c93325a83cdbe7dc9ee312b22a9c2898 --- manifest | 17 +++++++---------- manifest.uuid | 2 +- src/memjournal.c | 25 +++++++++++-------------- src/pager.c | 8 +++++--- 4 files changed, 24 insertions(+), 28 deletions(-) diff --git a/manifest b/manifest index 7546ccd6d9..97a63c3c19 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Extend\sthe\scode\sin\smemjournal.c\sso\sthat\sit\ssubsumes\sthe\srole\sof\sjournal.c.\sAnd\s(untested)\scan\sflush\sjournal\sor\sstatement\sjournal\sfiles\sto\sdisk\safter\sthey\sgrow\sto\sa\sspecified\ssize. -D 2016-02-27T20:14:55.339 +C Fix\sminor\sproblems\swith\snew\scode\sin\smemjournal.c. +D 2016-02-29T20:00:13.233 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -321,7 +321,7 @@ F src/mem1.c 6919bcf12f221868ea066eec27e579fed95ce98b F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3 F src/mem3.c 8768ac94694f31ffaf8b4d0ea5dc08af7010a35a F src/mem5.c 9bf955937b07f8c32541c8a9991f33ce3173d944 -F src/memjournal.c 8d045e50120e9988e63bb0af69187e1e5e35122f +F src/memjournal.c 9b71f171dd20827022e9edd874adf8dba2b8d218 F src/msvc.h d9ba56c6851227ab44b3f228a35f3f5772296495 F src/mutex.c 8e45800ee78e0cd1f1f3fe8e398853307f4a085c F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85 @@ -336,7 +336,7 @@ F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c 3a6f20736dfb8a0949cdd66553fdf59f6604be35 F src/os_win.c f0d7aa603eb6262143d7169a222aea07c4fca91d F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca -F src/pager.c e2bf43b506447d649e9d9266e988007ae7248699 +F src/pager.c 24dd5e463f527427dd55fccc338c62260ae09b3a F src/pager.h e1d38a2f14849e219df0f91f8323504d134c8a56 F src/parse.y c3ce2c4a7cbf0b699239be6b2a945c5cb51875e2 F src/pcache.c 647bb53a86b7bbcf55ad88089b3ea5a9170b90df @@ -1451,10 +1451,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f681d800340e0e710f73d0f7c09101f899249183 -R f456c30e495865d50fc2c9c2ddb305ed -T *branch * memjournal-exp -T *sym-memjournal-exp * -T -sym-trunk * +P e0b0b4316531fc8afa74b4882d9c74a91030ec69 +R 662914373e55c4521cf0e8e3f2bf03da U dan -Z dad681f00ca4c98b68e43d3727f3c92e +Z 9ebd4b81ff0d949546d50775b32308aa diff --git a/manifest.uuid b/manifest.uuid index b15150144a..9b400a9c26 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e0b0b4316531fc8afa74b4882d9c74a91030ec69 \ No newline at end of file +9fd3f7b9c93325a83cdbe7dc9ee312b22a9c2898 \ No newline at end of file diff --git a/src/memjournal.c b/src/memjournal.c index 6e1bf4edf7..632f9dc023 100644 --- a/src/memjournal.c +++ b/src/memjournal.c @@ -248,6 +248,10 @@ static int memjrnlWrite( /* ** Truncate the file. +** +** If the journal file is already on disk, truncate it there. Or, if it +** is still in main memory but is being truncated to zero bytes in size, +** ignore */ static int memjrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){ MemJournal *p = (MemJournal *)pJfd; @@ -350,7 +354,7 @@ int sqlite3JournalOpen( ** it using the sqlite3OsOpen() function of the underlying VFS. In this ** case none of the code in this module is executed as a result of calls ** made on the journal file-handle. */ - memset(p, 0, sizeof(MemJournal)); + memset(p, 0, sizeof(MemJournal) + pVfs ? pVfs->szOsFile : 0); if( nBuf==0 ){ return sqlite3OsOpen(pVfs, zName, pJfd, flags, 0); } @@ -377,30 +381,23 @@ void sqlite3MemJournalOpen(sqlite3_file *pJfd){ sqlite3JournalOpen(0, 0, pJfd, 0, -1); } -/* -** Return true if the file-handle passed as an argument is an in-memory -** journal. -*/ -int sqlite3IsMemJournal(sqlite3_file *pJfd){ - return pJfd->pMethods==&MemJournalMethods && ((MemJournal*)pJfd)->pReal==0; -} - /* ** If the argument p points to a MemJournal structure that is not an -** in-memory-only journal file, and the underlying file has not yet been -** created, create it now. +** in-memory-only journal file (i.e. is one that was opened with a +ve +** nBuf parameter), and the underlying file has not yet been created, +** create it now. */ int sqlite3JournalCreate(sqlite3_file *p){ int rc = SQLITE_OK; - if( p->pMethods==&MemJournalMethods && ((MemJournal*)p)->nBuf>=0 ){ + if( p->pMethods==&MemJournalMethods && ((MemJournal*)p)->nBuf>0 ){ rc = createFile((MemJournal*)p); } return rc; } /* -** The file-handle passed as teh only argument is open on a journal file. -** Return true if this "journal file" is actually stored in heap memory, +** The file-handle passed as the only argument is open on a journal file. +** Return true if this "journal file" is currently stored in heap memory, ** or false otherwise. */ int sqlite3JournalIsInMemory(sqlite3_file *p){ diff --git a/src/pager.c b/src/pager.c index 5998a57831..81c6572c9d 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1343,6 +1343,7 @@ static i64 journalHdrOffset(Pager *pPager){ static int zeroJournalHdr(Pager *pPager, int doTruncate){ int rc = SQLITE_OK; /* Return code */ assert( isOpen(pPager->jfd) ); + assert( !sqlite3JournalIsInMemory(pPager->jfd) ); if( pPager->journalOff ){ const i64 iLimit = pPager->journalSizeLimit; /* Local cache of jsl */ @@ -1989,9 +1990,10 @@ static int pager_end_transaction(Pager *pPager, int hasMaster, int bCommit){ /* This branch may be executed with Pager.journalMode==MEMORY if ** a hot-journal was just rolled back. In this case the journal ** file should be closed and deleted. If this connection writes to - ** the database file, it will do so using an in-memory journal. + ** the database file, it will do so using an in-memory journal. */ - int bDelete = (!pPager->tempFile&&!sqlite3JournalIsInMemory(pPager->jfd)); + int bDelete = !pPager->tempFile; + assert( sqlite3JournalIsInMemory(pPager->jfd)==0 ); assert( pPager->journalMode==PAGER_JOURNALMODE_DELETE || pPager->journalMode==PAGER_JOURNALMODE_MEMORY || pPager->journalMode==PAGER_JOURNALMODE_WAL @@ -2729,7 +2731,7 @@ static int pager_playback(Pager *pPager, int isHot){ ** TODO: Technically the following is an error because it assumes that ** buffer Pager.pTmpSpace is (mxPathname+1) bytes or larger. i.e. that ** (pPager->pageSize >= pPager->pVfs->mxPathname+1). Using os_unix.c, - ** mxPathname is 512, which is the same as the minimum allowable value + ** mxPathname is 512, which is the same as the minimum allowable value ** for pageSize. */ zMaster = pPager->pTmpSpace; From 6e76326d185bc37d386a25181fe275fe3fd7b18e Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 29 Feb 2016 20:18:21 +0000 Subject: [PATCH 39/66] When using a temporary file for a statement journal, store the first 64KiB in memory. If the file grows larger than that, flush it to disk and free the memory. Hardcoding to 64KiB is just an experiment to check that the memjournal.c code works. FossilOrigin-Name: 44b2dc18e200e87cf062cb8f1659727c53fa36e9 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/memjournal.c | 2 +- src/pager.c | 9 ++++++--- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 97a63c3c19..0f2eb5c9d9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sminor\sproblems\swith\snew\scode\sin\smemjournal.c. -D 2016-02-29T20:00:13.233 +C When\susing\sa\stemporary\sfile\sfor\sa\sstatement\sjournal,\sstore\sthe\sfirst\s64KiB\sin\smemory.\sIf\sthe\sfile\sgrows\slarger\sthan\sthat,\sflush\sit\sto\sdisk\sand\sfree\sthe\smemory.\sHardcoding\sto\s64KiB\sis\sjust\san\sexperiment\sto\scheck\sthat\sthe\smemjournal.c\scode\sworks. +D 2016-02-29T20:18:21.986 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -321,7 +321,7 @@ F src/mem1.c 6919bcf12f221868ea066eec27e579fed95ce98b F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3 F src/mem3.c 8768ac94694f31ffaf8b4d0ea5dc08af7010a35a F src/mem5.c 9bf955937b07f8c32541c8a9991f33ce3173d944 -F src/memjournal.c 9b71f171dd20827022e9edd874adf8dba2b8d218 +F src/memjournal.c fea987c5809993211da554ba109816fae7e04dae F src/msvc.h d9ba56c6851227ab44b3f228a35f3f5772296495 F src/mutex.c 8e45800ee78e0cd1f1f3fe8e398853307f4a085c F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85 @@ -336,7 +336,7 @@ F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c 3a6f20736dfb8a0949cdd66553fdf59f6604be35 F src/os_win.c f0d7aa603eb6262143d7169a222aea07c4fca91d F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca -F src/pager.c 24dd5e463f527427dd55fccc338c62260ae09b3a +F src/pager.c 2bc43817697b5a4e88fd6a2cdb2cb25f2223505c F src/pager.h e1d38a2f14849e219df0f91f8323504d134c8a56 F src/parse.y c3ce2c4a7cbf0b699239be6b2a945c5cb51875e2 F src/pcache.c 647bb53a86b7bbcf55ad88089b3ea5a9170b90df @@ -1451,7 +1451,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P e0b0b4316531fc8afa74b4882d9c74a91030ec69 -R 662914373e55c4521cf0e8e3f2bf03da +P 9fd3f7b9c93325a83cdbe7dc9ee312b22a9c2898 +R 498bd0458994e1419985675b963a5c33 U dan -Z 9ebd4b81ff0d949546d50775b32308aa +Z de04134d7998c131f105dcb3752be845 diff --git a/manifest.uuid b/manifest.uuid index 9b400a9c26..f58d5d3e8e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9fd3f7b9c93325a83cdbe7dc9ee312b22a9c2898 \ No newline at end of file +44b2dc18e200e87cf062cb8f1659727c53fa36e9 \ No newline at end of file diff --git a/src/memjournal.c b/src/memjournal.c index 632f9dc023..eaa4d4f83a 100644 --- a/src/memjournal.c +++ b/src/memjournal.c @@ -354,7 +354,7 @@ int sqlite3JournalOpen( ** it using the sqlite3OsOpen() function of the underlying VFS. In this ** case none of the code in this module is executed as a result of calls ** made on the journal file-handle. */ - memset(p, 0, sizeof(MemJournal) + pVfs ? pVfs->szOsFile : 0); + memset(p, 0, sizeof(MemJournal) + (pVfs ? pVfs->szOsFile : 0)); if( nBuf==0 ){ return sqlite3OsOpen(pVfs, zName, pJfd, flags, 0); } diff --git a/src/pager.c b/src/pager.c index 81c6572c9d..c74748c8e4 100644 --- a/src/pager.c +++ b/src/pager.c @@ -4355,11 +4355,14 @@ static int pager_write_pagelist(Pager *pPager, PgHdr *pList){ static int openSubJournal(Pager *pPager){ int rc = SQLITE_OK; if( !isOpen(pPager->sjfd) ){ + const int flags = SQLITE_OPEN_SUBJOURNAL | SQLITE_OPEN_READWRITE + | SQLITE_OPEN_CREATE | SQLITE_OPEN_EXCLUSIVE + | SQLITE_OPEN_DELETEONCLOSE; + int nBuf = 64*1024; if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY || pPager->subjInMemory ){ - sqlite3MemJournalOpen(pPager->sjfd); - }else{ - rc = pagerOpentemp(pPager, pPager->sjfd, SQLITE_OPEN_SUBJOURNAL); + nBuf = -1; } + rc = sqlite3JournalOpen(pPager->pVfs, 0, pPager->sjfd, flags, nBuf); } return rc; } From 889cb33b8f1321233d79dead07a8089dcf28ef13 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 1 Mar 2016 02:11:50 +0000 Subject: [PATCH 40/66] Better estimatedCost in the xBestIndex method of the generate_series vtab. FossilOrigin-Name: f2c16094a536e7ef62444d0fe38cbee2a4999426 --- ext/misc/series.c | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ext/misc/series.c b/ext/misc/series.c index 2ae312effa..4e6341c33b 100644 --- a/ext/misc/series.c +++ b/ext/misc/series.c @@ -337,7 +337,7 @@ static int seriesBestIndex( if( (idxNum & 3)==3 ){ /* Both start= and stop= boundaries are available. This is the ** the preferred case */ - pIdxInfo->estimatedCost = (double)1; + pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0)); pIdxInfo->estimatedRows = 1000; if( pIdxInfo->nOrderBy==1 ){ if( pIdxInfo->aOrderBy[0].desc ) idxNum |= 8; diff --git a/manifest b/manifest index bacddf080c..3cdd9396b7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\sin\sfts5\swhere\sa\scorrupt\sdb\scould\slead\sto\sa\s(huge)\sbuffer\soverread. -D 2016-02-29T17:34:16.069 +C Better\sestimatedCost\sin\sthe\sxBestIndex\smethod\sof\sthe\sgenerate_series\svtab. +D 2016-03-01T02:11:50.810 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -212,7 +212,7 @@ F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342 F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63 F ext/misc/regexp.c af92cdaa5058fcec1451e49becc7ba44dba023dc F ext/misc/rot13.c 1ac6f95f99b575907b9b09c81a349114cf9be45a -F ext/misc/series.c b8fb7befd85b3a9b4a10e701b30b2b79ca92b6d4 +F ext/misc/series.c 235d6281397003ad5226582de216507642aa0095 F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52 F ext/misc/spellfix.c 525190484b7a9dbc6be646c4842274fff4f27d53 F ext/misc/totype.c 4a167594e791abeed95e0a8db028822b5e8fe512 @@ -1451,7 +1451,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 251d6473f7c9ad95adbdcc49cb8eaf7c0956764b -R 1a43d3061a1f154a38fc05ffa17e1f4a -U dan -Z 0ef60cd2035dd9bea82e9df13f5bcf57 +P c9a30e117f2c6c9ef0cc0c6ca5227d2961715b8f +R 78072d3e9e5d5130b27dfb7458df9d26 +U drh +Z 00eb8a065721ce5867f81f8e93fd77c0 diff --git a/manifest.uuid b/manifest.uuid index 2a4a25da5e..ead2aaed5e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c9a30e117f2c6c9ef0cc0c6ca5227d2961715b8f \ No newline at end of file +f2c16094a536e7ef62444d0fe38cbee2a4999426 \ No newline at end of file From 45a0e4eb599fcf398abf8741d16150d14b675887 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 1 Mar 2016 14:50:55 +0000 Subject: [PATCH 41/66] Fix an fts5 problem causing 'optimize' to corrupt the fts index under some circumstances. Cherrypick of [251d6473f7]. FossilOrigin-Name: 5b1b7ab5d67f3d691e52ba57dbc14c52d90c6631 --- ext/fts5/fts5_index.c | 5 ++++- ext/fts5/test/fts5simple.test | 20 ++++++++++++++++++++ manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c index c40ffbcbb5..8e2fb35f0f 100644 --- a/ext/fts5/fts5_index.c +++ b/ext/fts5/fts5_index.c @@ -4499,7 +4499,10 @@ int sqlite3Fts5IndexOptimize(Fts5Index *p){ if( pLvl->aSeg ){ int iLvl, iSeg; int iSegOut = 0; - for(iLvl=0; iLvlnLevel; iLvl++){ + /* Iterate through all segments, from oldest to newest. Add them to + ** the new Fts5Level object so that pLvl->aSeg[0] is the oldest + ** segment in the data structure. */ + for(iLvl=pStruct->nLevel-1; iLvl>=0; iLvl--){ for(iSeg=0; iSegaLevel[iLvl].nSeg; iSeg++){ pLvl->aSeg[iSegOut] = pStruct->aLevel[iLvl].aSeg[iSeg]; iSegOut++; diff --git a/ext/fts5/test/fts5simple.test b/ext/fts5/test/fts5simple.test index a095a16230..01111d78c8 100644 --- a/ext/fts5/test/fts5simple.test +++ b/ext/fts5/test/fts5simple.test @@ -409,5 +409,25 @@ do_catchsql_test 19.2 { SELECT * FROM x1 WHERE x1 MATCH 'c0 AND (c1 AND (c2 AND (c3 AND (c4 AND (c5 AND (c6 AND (c7 AND (c8 AND (c9 AND (c10 AND (c11 AND (c12 AND (c13 AND (c14 AND (c15 AND (c16 AND (c17 AND (c18 AND (c19 AND (c20 AND (c21 AND (c22 AND (c23 AND (c24 AND (c25 AND (c26 AND (c27 AND (c28 AND (c29 AND (c30 AND (c31 AND (c32 AND (c33 AND (c34 AND (c35 AND (c36 AND (c37 AND (c38 AND (c39 AND (c40 AND (c41 AND (c42 AND (c43 AND (c44 AND (c45 AND (c46 AND (c47 AND (c48 AND (c49 AND (c50 AND (c51 AND (c52 AND (c53 AND (c54 AND (c55 AND (c56 AND (c57 AND (c58 AND (c59 AND (c60 AND (c61 AND (c62 AND (c63 AND (c64 AND (c65 AND (c66 AND (c67 AND (c68 AND (c69 AND (c70 AND (c71 AND (c72 AND (c73 AND (c74 AND (c75 AND (c76 AND (c77 AND (c78 AND (c79 AND (c80 AND (c81 AND (c82 AND (c83 AND (c84 AND (c85 AND (c86 AND (c87 AND (c88 AND (c89 AND (c90 AND (c91 AND (c92 AND (c93 AND (c94 AND (c95 AND (c96 AND (c97 AND (c98 AND (c99 AND (c100 AND (c101 AND (c102 AND (c103 AND (c104 AND (c105 AND (c106 AND (c107 AND (c108 AND (c109 AND (c110 AND (c111 AND (c112 AND (c113 AND (c114 AND (c115 AND (c116 AND (c117 AND (c118 AND (c119 AND (c120 AND (c121 AND (c122 AND (c123 AND (c124 AND (c125 AND (c126 AND (c127 AND (c128 AND (c129 AND (c130 AND (c131 AND (c132 AND (c133 AND (c134 AND (c135 AND (c136 AND (c137 AND (c138 AND (c139 AND (c140 AND (c141 AND (c142 AND (c143 AND (c144 AND (c145 AND (c146 AND (c147 AND (c148 AND (c149 AND (c150 AND (c151 AND (c152 AND (c153 AND (c154 AND (c155 AND (c156 AND (c157 AND (c158 AND (c159 AND (c160 AND (c161 AND (c162 AND (c163 AND (c164 AND (c165 AND (c166 AND (c167 AND (c168 AND (c169 AND (c170 AND (c171 AND (c172 AND (c173 AND (c174 AND (c175 AND (c176 AND (c177 AND (c178 AND (c179 AND (c180 AND (c181 AND (c182 AND (c183 AND (c184 AND (c185 AND (c186 AND (c187 AND (c188 AND (c189 AND (c190 AND (c191 AND (c192 AND (c193 AND (c194 AND (c195 AND (c196 AND (c197 AND (c198 AND (c199 AND c200)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'; } {1 {fts5: parser stack overflow}} +#------------------------------------------------------------------------- +reset_db +breakpoint +do_execsql_test 20.0 { + CREATE VIRTUAL TABLE x1 USING fts5(x); + INSERT INTO x1(x1, rank) VALUES('pgsz', 32); + INSERT INTO x1(rowid, x) VALUES(11111, 'onetwothree'); +} +do_test 20.1 { + for {set i 1} {$i <= 200} {incr i} { + execsql { INSERT INTO x1(rowid, x) VALUES($i, 'one two three'); } + } + execsql { INSERT INTO x1(x1) VALUES('optimize'); } + execsql { DELETE FROM x1 WHERE rowid = 4; } +} {} +do_execsql_test 20.2 { + INSERT INTO x1(x1) VALUES('optimize'); + INSERT INTO x1(x1) VALUES('integrity-check'); +} {} + finish_test diff --git a/manifest b/manifest index 8c52a9794a..afbce79f63 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\san\s"#ifndef\sSQLITE_AMALGAMATION"\sguard\saround\sa\stypedef\sin\sfts5_test_mi.c\sto\savoid\sredefining\s"u32"\sif\sit\sis\scompiled\sas\spart\sof\sthe\samalgamation.\sCherrypick\sof\s[f9c49ba1]. -D 2016-02-19T10:19:43.655 +C Fix\san\sfts5\sproblem\scausing\s'optimize'\sto\scorrupt\sthe\sfts\sindex\sunder\ssome\scircumstances.\sCherrypick\sof\s[251d6473f7]. +D 2016-03-01T14:50:55.628 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 30f075dc4f27a07abb76088946b2944178d85347 @@ -104,7 +104,7 @@ F ext/fts5/fts5_buffer.c 4c1502d4c956cd092c89ce4480867f9d8bf325cd F ext/fts5/fts5_config.c 35c5173cae4eb17e82164a7f5aeef56a48903079 F ext/fts5/fts5_expr.c 8e8e4635f655133eb39018072fc0f0942a2c4337 F ext/fts5/fts5_hash.c f3a7217c86eb8f272871be5f6aa1b6798960a337 -F ext/fts5/fts5_index.c c6cd5190c7e5dd94151cb17acd939c82e5c7be2d +F ext/fts5/fts5_index.c a32f4059b48ee800a94e8a286bf953d67b75185e F ext/fts5/fts5_main.c db24ac714c6c4a1b3c24a1f8c25889f2952148c1 F ext/fts5/fts5_storage.c f8343db90d8c95a4d4b52f6676e354b4649ffd6e F ext/fts5/fts5_tcl.c f8731e0508299bd43f1a2eff7dbeaac870768966 @@ -176,7 +176,7 @@ F ext/fts5/test/fts5rank.test 7e9e64eac7245637f6f2033aec4b292aaf611aab F ext/fts5/test/fts5rebuild.test 03935f617ace91ed23a6099c7c74d905227ff29b F ext/fts5/test/fts5restart.test c17728fdea26e7d0f617d22ad5b4b2862b994c17 F ext/fts5/test/fts5rowid.test 16908a99d6efc9ba21081b4f2b86b3fc699839a6 -F ext/fts5/test/fts5simple.test e6fe2fb10a2b9193648b32bbc2caecabdf8c333d +F ext/fts5/test/fts5simple.test 92e06be1c119f88a73ea11a05599a276ec3ff7fd F ext/fts5/test/fts5simple2.test 98377ae1ff7749a42c21fe1a139c1ed312522c46 F ext/fts5/test/fts5simple3.test 8e71733b3d1b0e695011d02c68ebc5ca40b6124e F ext/fts5/test/fts5synonym.test 6475d189c2e20d60795808f83e36bf9318708d48 @@ -1427,8 +1427,8 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh ef6ebc6fd8d2dc35db3b622015c16a023d4fef4f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e2ef6667772eeac6eee3aed5d0609c2a0ef5d8cf -Q +f9c49ba1edf13cb8c48d73f1b2e3f80c46b3c030 -R 86861d7afb256ba49d3c7d2e1e2e6725 +P ce0f1ed517e387ca6a687b805088d7c529cd257b +Q +251d6473f7c9ad95adbdcc49cb8eaf7c0956764b +R 5f7a25988e6c8801d10d40ebf8cc999a U dan -Z 1618528e1896e183cb510df07cb30bf4 +Z 645a7ae1e10094786fc6e926b7bb55a9 diff --git a/manifest.uuid b/manifest.uuid index 6c518eaaf7..ef13a6ec43 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ce0f1ed517e387ca6a687b805088d7c529cd257b \ No newline at end of file +5b1b7ab5d67f3d691e52ba57dbc14c52d90c6631 \ No newline at end of file From b1e8d31edfa3b09210ad21dca1f4939ff934742b Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 1 Mar 2016 14:51:36 +0000 Subject: [PATCH 42/66] Fix a problem in fts5 where a corrupt db could lead to a (huge) buffer overread. Cherrypick of [c9a30e117f]. FossilOrigin-Name: daef5869f4d62ebb24eb03b79fe4be0812fa0496 --- ext/fts5/fts5_index.c | 5 +++++ manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c index 8e2fb35f0f..7f9a931b02 100644 --- a/ext/fts5/fts5_index.c +++ b/ext/fts5/fts5_index.c @@ -698,6 +698,7 @@ static Fts5Data *fts5DataRead(Fts5Index *p, i64 iRowid){ return pRet; } + /* ** Release a reference to data record returned by an earlier call to ** fts5DataRead(). @@ -2154,6 +2155,10 @@ static void fts5LeafSeek( iPgidx = szLeaf; iPgidx += fts5GetVarint32(&a[iPgidx], iTermOff); iOff = iTermOff; + if( iOff>n ){ + p->rc = FTS5_CORRUPT; + return; + } while( 1 ){ diff --git a/manifest b/manifest index afbce79f63..329486cbd8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\san\sfts5\sproblem\scausing\s'optimize'\sto\scorrupt\sthe\sfts\sindex\sunder\ssome\scircumstances.\sCherrypick\sof\s[251d6473f7]. -D 2016-03-01T14:50:55.628 +C Fix\sa\sproblem\sin\sfts5\swhere\sa\scorrupt\sdb\scould\slead\sto\sa\s(huge)\sbuffer\soverread.\sCherrypick\sof\s[c9a30e117f]. +D 2016-03-01T14:51:36.262 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 30f075dc4f27a07abb76088946b2944178d85347 @@ -104,7 +104,7 @@ F ext/fts5/fts5_buffer.c 4c1502d4c956cd092c89ce4480867f9d8bf325cd F ext/fts5/fts5_config.c 35c5173cae4eb17e82164a7f5aeef56a48903079 F ext/fts5/fts5_expr.c 8e8e4635f655133eb39018072fc0f0942a2c4337 F ext/fts5/fts5_hash.c f3a7217c86eb8f272871be5f6aa1b6798960a337 -F ext/fts5/fts5_index.c a32f4059b48ee800a94e8a286bf953d67b75185e +F ext/fts5/fts5_index.c ecc70368618c6bae4bb59124abc343c02634ad0c F ext/fts5/fts5_main.c db24ac714c6c4a1b3c24a1f8c25889f2952148c1 F ext/fts5/fts5_storage.c f8343db90d8c95a4d4b52f6676e354b4649ffd6e F ext/fts5/fts5_tcl.c f8731e0508299bd43f1a2eff7dbeaac870768966 @@ -1427,8 +1427,8 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh ef6ebc6fd8d2dc35db3b622015c16a023d4fef4f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ce0f1ed517e387ca6a687b805088d7c529cd257b -Q +251d6473f7c9ad95adbdcc49cb8eaf7c0956764b -R 5f7a25988e6c8801d10d40ebf8cc999a +P 5b1b7ab5d67f3d691e52ba57dbc14c52d90c6631 +Q +c9a30e117f2c6c9ef0cc0c6ca5227d2961715b8f +R 9e1a768531e15f702b1609ee77fd97cc U dan -Z 645a7ae1e10094786fc6e926b7bb55a9 +Z 25f98900ae0232bf213e8bdd46c5ac6f diff --git a/manifest.uuid b/manifest.uuid index ef13a6ec43..45cc164a6f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5b1b7ab5d67f3d691e52ba57dbc14c52d90c6631 \ No newline at end of file +daef5869f4d62ebb24eb03b79fe4be0812fa0496 \ No newline at end of file From 5ec04f094313be24e4db725874186a50787534dc Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 1 Mar 2016 15:41:31 +0000 Subject: [PATCH 43/66] Increase the version number to 3.11.1 FossilOrigin-Name: 2dcd2fdafe933b74e2d90923986c5ee5791d8223 --- VERSION | 2 +- configure | 18 +++++++++--------- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/VERSION b/VERSION index afad818663..371cfe355d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.11.0 +3.11.1 diff --git a/configure b/configure index b2cb4d1308..8fdbb45ec8 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sqlite 3.11.0. +# Generated by GNU Autoconf 2.69 for sqlite 3.11.1. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -726,8 +726,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.11.0' -PACKAGE_STRING='sqlite 3.11.0' +PACKAGE_VERSION='3.11.1' +PACKAGE_STRING='sqlite 3.11.1' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1460,7 +1460,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.11.0 to adapt to many kinds of systems. +\`configure' configures sqlite 3.11.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1525,7 +1525,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.11.0:";; + short | recursive ) echo "Configuration of sqlite 3.11.1:";; esac cat <<\_ACEOF @@ -1646,7 +1646,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.11.0 +sqlite configure 3.11.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2065,7 +2065,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.11.0, which was +It was created by sqlite $as_me 3.11.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -12079,7 +12079,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.11.0, which was +This file was extended by sqlite $as_me 3.11.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12145,7 +12145,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sqlite config.status 3.11.0 +sqlite config.status 3.11.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/manifest b/manifest index 2ef2f4d6b6..6eb0c4b8d7 100644 --- a/manifest +++ b/manifest @@ -1,10 +1,10 @@ -C Merge\sbranch-3.11-matchinfo\sinto\sthis\sbranch. -D 2016-03-01T15:09:15.371 +C Increase\sthe\sversion\snumber\sto\s3.11.1 +D 2016-03-01T15:41:31.146 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 56ea123a975690bf9ed38b31bb89ff87b02a7c2b F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 -F VERSION 866588d1edf0ccb5b0d33896974338f97564f719 +F VERSION 1a9f17ac8a5066544976a390298fe62228c58a9e F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 @@ -30,7 +30,7 @@ F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63 F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977 F config.h.in 42b71ad3fe21c9e88fa59e8458ca1a6bc72eb0c0 F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55 -F configure 12d96e3798e612e0ffa53a7a8c4d7fb1090df80e x +F configure 2ea99f0951819177c002c70727b78e51818624b3 x F configure.ac a2224b1162f79848982d3618ac1deffcd94e88ec F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/lemon.html 334dbf6621b8fb8790297ec1abf3cfa4621709d1 @@ -1427,7 +1427,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh ef6ebc6fd8d2dc35db3b622015c16a023d4fef4f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 4e54e9c0fefe417f94a2d95921acf61b1dda5ca4 daef5869f4d62ebb24eb03b79fe4be0812fa0496 -R 941c7c2c1d8ea45171acb610a804d763 -U dan -Z 0133e19e04cb90ccecc941fa59f3b459 +P 42358170b35cc3e25c42f20e56f3f67e809001ba +R 85cb3c3574d71e33da57a24aa6b9d049 +U drh +Z c5c8b142342c3d43dce53788f70a0a50 diff --git a/manifest.uuid b/manifest.uuid index 4e289c8410..fbd4d4c630 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -42358170b35cc3e25c42f20e56f3f67e809001ba \ No newline at end of file +2dcd2fdafe933b74e2d90923986c5ee5791d8223 \ No newline at end of file From fb02bad04f1c432e47fb605203b5fc622267c76a Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 1 Mar 2016 15:52:41 +0000 Subject: [PATCH 44/66] Remove a forgotten "breakpoint" command from an FTS5 test script. FossilOrigin-Name: 61927c8f3156c6e61b768318b3cd3bcc4144e17b --- ext/fts5/test/fts5simple.test | 2 -- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/ext/fts5/test/fts5simple.test b/ext/fts5/test/fts5simple.test index 01111d78c8..d1b5647604 100644 --- a/ext/fts5/test/fts5simple.test +++ b/ext/fts5/test/fts5simple.test @@ -411,7 +411,6 @@ do_catchsql_test 19.2 { #------------------------------------------------------------------------- reset_db -breakpoint do_execsql_test 20.0 { CREATE VIRTUAL TABLE x1 USING fts5(x); INSERT INTO x1(x1, rank) VALUES('pgsz', 32); @@ -430,4 +429,3 @@ do_execsql_test 20.2 { } {} finish_test - diff --git a/manifest b/manifest index 6eb0c4b8d7..35437e3eb6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Increase\sthe\sversion\snumber\sto\s3.11.1 -D 2016-03-01T15:41:31.146 +C Remove\sa\sforgotten\s"breakpoint"\scommand\sfrom\san\sFTS5\stest\sscript. +D 2016-03-01T15:52:41.571 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 56ea123a975690bf9ed38b31bb89ff87b02a7c2b @@ -176,7 +176,7 @@ F ext/fts5/test/fts5rank.test 7e9e64eac7245637f6f2033aec4b292aaf611aab F ext/fts5/test/fts5rebuild.test 03935f617ace91ed23a6099c7c74d905227ff29b F ext/fts5/test/fts5restart.test c17728fdea26e7d0f617d22ad5b4b2862b994c17 F ext/fts5/test/fts5rowid.test 16908a99d6efc9ba21081b4f2b86b3fc699839a6 -F ext/fts5/test/fts5simple.test 92e06be1c119f88a73ea11a05599a276ec3ff7fd +F ext/fts5/test/fts5simple.test 09420cb1137f3a19d02dacb5b4b6831d2e683773 F ext/fts5/test/fts5simple2.test 98377ae1ff7749a42c21fe1a139c1ed312522c46 F ext/fts5/test/fts5simple3.test 8e71733b3d1b0e695011d02c68ebc5ca40b6124e F ext/fts5/test/fts5synonym.test 6475d189c2e20d60795808f83e36bf9318708d48 @@ -1427,7 +1427,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh ef6ebc6fd8d2dc35db3b622015c16a023d4fef4f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 42358170b35cc3e25c42f20e56f3f67e809001ba -R 85cb3c3574d71e33da57a24aa6b9d049 +P 2dcd2fdafe933b74e2d90923986c5ee5791d8223 +R 58e98448c6fb190107b5ef844b8497ab U drh -Z c5c8b142342c3d43dce53788f70a0a50 +Z d57af09b65899a042bcd085eed028813 diff --git a/manifest.uuid b/manifest.uuid index fbd4d4c630..87652f5d83 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2dcd2fdafe933b74e2d90923986c5ee5791d8223 \ No newline at end of file +61927c8f3156c6e61b768318b3cd3bcc4144e17b \ No newline at end of file From e82126c9d0f784f395923fab3732a80ceadc809b Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 1 Mar 2016 16:02:57 +0000 Subject: [PATCH 45/66] Add -DSQLITE_ENABLE_FTS5 to one of the release-test configurations in releasetest.tcl. Run fts5 tests as part of "make test" if SQLITE_ENABLE_FTS5 is defined. FossilOrigin-Name: 3cee93716f2aece03bf9b835fb7b5294e4ddc176 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- test/permutations.test | 10 +++++++--- test/releasetest.tcl | 1 + 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 35437e3eb6..deaacdfcf2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sa\sforgotten\s"breakpoint"\scommand\sfrom\san\sFTS5\stest\sscript. -D 2016-03-01T15:52:41.571 +C Add\s-DSQLITE_ENABLE_FTS5\sto\sone\sof\sthe\srelease-test\sconfigurations\sin\sreleasetest.tcl.\sRun\sfts5\stests\sas\spart\sof\s"make\stest"\sif\sSQLITE_ENABLE_FTS5\sis\sdefined. +D 2016-03-01T16:02:57.526 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 56ea123a975690bf9ed38b31bb89ff87b02a7c2b @@ -944,7 +944,7 @@ F test/parser1.test 222b5cbf3e2e659fec1bf7d723488c8b9c94f1d0 F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442 F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff -F test/permutations.test 382a43c49f49bafe6fddffe904ea33d6bb3ff33e +F test/permutations.test ea7d077b4644ba0ed6804666915595e9fc3b1950 F test/pragma.test 507ac7ef2ea5682241ea0ef041799ca70bb5e0bf F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c @@ -964,7 +964,7 @@ F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736 F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8 F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 975449bf742b8bb9025208292208af816a1fcb58 +F test/releasetest.tcl a246ecb14ed594bf44bf77bd21df873971d779bf F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test 8435d6ff0f13f51d2a4181c232e706005fa90fc5 @@ -1427,7 +1427,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh ef6ebc6fd8d2dc35db3b622015c16a023d4fef4f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 2dcd2fdafe933b74e2d90923986c5ee5791d8223 -R 58e98448c6fb190107b5ef844b8497ab -U drh -Z d57af09b65899a042bcd085eed028813 +P 61927c8f3156c6e61b768318b3cd3bcc4144e17b +R bfee7792832173f4b2f2e0f85f5783ce +U dan +Z d07cc313679c906c74090dbeca08d604 diff --git a/manifest.uuid b/manifest.uuid index 87652f5d83..065199ced8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -61927c8f3156c6e61b768318b3cd3bcc4144e17b \ No newline at end of file +3cee93716f2aece03bf9b835fb7b5294e4ddc176 \ No newline at end of file diff --git a/test/permutations.test b/test/permutations.test index c099889067..5c62218d48 100644 --- a/test/permutations.test +++ b/test/permutations.test @@ -85,8 +85,11 @@ proc test_set {args} { # $allquicktests # set alltests [list] -foreach f [glob $testdir/*.test] { lappend alltests [file tail $f] } -foreach f [glob -nocomplain $testdir/../ext/rtree/*.test] { +foreach f [glob -nocomplain \ + $testdir/*.test \ + $testdir/../ext/rtree/*.test \ + $testdir/../ext/fts5/test/*.test \ +] { lappend alltests $f } @@ -157,7 +160,8 @@ test_suite "veryquick" -prefix "" -description { This test suite is the same as the "quick" tests, except that some files that test malloc and IO errors are omitted. } -files [ - test_set $allquicktests -exclude *malloc* *ioerr* *fault* *bigfile* *_err* + test_set $allquicktests -exclude *malloc* *ioerr* *fault* *bigfile* *_err* \ + *fts5corrupt* *fts5big* *fts5aj* ] test_suite "extraquick" -prefix "" -description { diff --git a/test/releasetest.tcl b/test/releasetest.tcl index bb902eec3e..2bcf1aa511 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -203,6 +203,7 @@ array set ::Configs [strip_comments { -DSQLITE_MAX_ATTACHED=30 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS4 + -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_FTS4_PARENTHESIS -DSQLITE_DISABLE_FTS4_DEFERRED -DSQLITE_ENABLE_RTREE From bce50c734b937a9756793c46b4f6db832b381036 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 1 Mar 2016 16:56:26 +0000 Subject: [PATCH 46/66] Do not attempt to run fts5bigtok.test or fts5merge2.test if FTS5 is not compiled in. FossilOrigin-Name: f7ed373953c2dea0919a85dfb461dfef512cd5fc --- ext/fts5/test/fts5_common.tcl | 11 ++++------- ext/fts5/test/fts5bigtok.test | 1 + ext/fts5/test/fts5merge2.test | 3 ++- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/ext/fts5/test/fts5_common.tcl b/ext/fts5/test/fts5_common.tcl index cf688dcc0d..93a8bab806 100644 --- a/ext/fts5/test/fts5_common.tcl +++ b/ext/fts5/test/fts5_common.tcl @@ -16,7 +16,10 @@ if {![info exists testdir]} { source $testdir/tester.tcl ifcapable !fts5 { - finish_test + proc return_if_no_fts5 {} { + finish_test + return -code return + } return } @@ -25,12 +28,6 @@ catch { reset_db } -# If SQLITE_ENABLE_FTS5 is not defined, skip this test. -ifcapable !fts5 { - finish_test - return -} - proc fts5_test_poslist {cmd} { set res [list] for {set i 0} {$i < [$cmd xInstCount]} {incr i} { diff --git a/ext/fts5/test/fts5bigtok.test b/ext/fts5/test/fts5bigtok.test index 2267be5058..9ccaf6c860 100644 --- a/ext/fts5/test/fts5bigtok.test +++ b/ext/fts5/test/fts5bigtok.test @@ -14,6 +14,7 @@ source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5bigtok +return_if_no_fts5 proc rndterm {} { set L [list a b c d e f g h i j k l m n o p q r s t u v w x y z] diff --git a/ext/fts5/test/fts5merge2.test b/ext/fts5/test/fts5merge2.test index 87dbf14332..cd515cc29e 100644 --- a/ext/fts5/test/fts5merge2.test +++ b/ext/fts5/test/fts5merge2.test @@ -13,7 +13,8 @@ # source [file join [file dirname [info script]] fts5_common.tcl] -set testprefix fts5merge +set testprefix fts5merge2 +return_if_no_fts5 proc dump_structure {} { db eval {SELECT fts5_decode(id, block) AS t FROM t1_data WHERE id=10} { diff --git a/manifest b/manifest index deaacdfcf2..9293374902 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\s-DSQLITE_ENABLE_FTS5\sto\sone\sof\sthe\srelease-test\sconfigurations\sin\sreleasetest.tcl.\sRun\sfts5\stests\sas\spart\sof\s"make\stest"\sif\sSQLITE_ENABLE_FTS5\sis\sdefined. -D 2016-03-01T16:02:57.526 +C Do\snot\sattempt\sto\srun\sfts5bigtok.test\sor\sfts5merge2.test\sif\sFTS5\sis\snot\scompiled\sin. +D 2016-03-01T16:56:26.421 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 56ea123a975690bf9ed38b31bb89ff87b02a7c2b @@ -116,7 +116,7 @@ F ext/fts5/fts5_varint.c a5aceacda04dafcbae725413d7a16818ecd65738 F ext/fts5/fts5_vocab.c dba72ca393d71c2588548b51380387f6b44c77a8 F ext/fts5/fts5parse.y 59432ea369f1aa65511bad465f55d31a22f9f223 F ext/fts5/mkportersteps.tcl 5acf962d2e0074f701620bb5308155fa1e4a63ba -F ext/fts5/test/fts5_common.tcl 61ff0d1a29d98a91c4553b20b3f410d858834ee9 +F ext/fts5/test/fts5_common.tcl fbbf457b1433151789a006f9f94c00780a5e3f78 F ext/fts5/test/fts5aa.test 7e814df4a0e6c22a6fe2d84f210fdc0b5068a084 F ext/fts5/test/fts5ab.test 30325a89453280160106be411bba3acf138e6d1b F ext/fts5/test/fts5ac.test 55cad4275a1f5acabfe14d8442a8046b47e49e5f @@ -134,7 +134,7 @@ F ext/fts5/test/fts5auto.test 401c20e89f1114d733b94809be1e6f893e16c09e F ext/fts5/test/fts5aux.test 8c687c948cc98e9a94be014df7d518acc1b3b74f F ext/fts5/test/fts5auxdata.test 141a7cbffcceb1bd2799b4b29c183ff8780d586e F ext/fts5/test/fts5bigpl.test 04ee0d7eebbebf17c31f5a0b5c5f9494eac3a0cb -F ext/fts5/test/fts5bigtok.test 981b2790f6fa02773c889bd35d42c6b97f80f0f4 +F ext/fts5/test/fts5bigtok.test 017a9397b14e7598883a6328ead4a6539b42d59a F ext/fts5/test/fts5columnsize.test a8cfef21ffa1c264b9f670a7d94eeaccb5341c07 F ext/fts5/test/fts5config.test 8b2bc6dcc0eb06fa2b7dd65b2ce2db09e829e873 F ext/fts5/test/fts5conflict.test 26f4e46c4d31e16221794832a990dc4e30e18de5 @@ -162,7 +162,7 @@ F ext/fts5/test/fts5hash.test 06f9309ccb4d5050a131594e9e47d0b21456837d F ext/fts5/test/fts5integrity.test f5e4f8d284385875068ad0f3e894ce43e9de835d F ext/fts5/test/fts5matchinfo.test 86569026d20f1ed748236587ce798de8a96615f1 F ext/fts5/test/fts5merge.test 8f3cdba2ec9c5e7e568246e81b700ad37f764367 -F ext/fts5/test/fts5merge2.test c0cb66eb38a41c26cc5848fb9e50093e0f59ac93 +F ext/fts5/test/fts5merge2.test 8faa829aa3238a25a200200b54780a9bd5d97c14 F ext/fts5/test/fts5near.test b214cddb1c1f1bddf45c75af768f20145f7e71cc F ext/fts5/test/fts5onepass.test 7ed9608e258132cb8d55e7c479b08676ad68810c F ext/fts5/test/fts5optimize.test 42741e7c085ee0a1276140a752d4407d97c2c9f5 @@ -1427,7 +1427,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh ef6ebc6fd8d2dc35db3b622015c16a023d4fef4f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 61927c8f3156c6e61b768318b3cd3bcc4144e17b -R bfee7792832173f4b2f2e0f85f5783ce +P 3cee93716f2aece03bf9b835fb7b5294e4ddc176 +R ea05f03539d26243966fe5b0665aa396 U dan -Z d07cc313679c906c74090dbeca08d604 +Z 26014b2cea95bca862f77aab9147f990 diff --git a/manifest.uuid b/manifest.uuid index 065199ced8..670de7851f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3cee93716f2aece03bf9b835fb7b5294e4ddc176 \ No newline at end of file +f7ed373953c2dea0919a85dfb461dfef512cd5fc \ No newline at end of file From 8e4251b6336bb16cabf45938bf59e276d1bc4419 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 1 Mar 2016 18:07:43 +0000 Subject: [PATCH 47/66] Add test code useful for testing the planners use of teh virtual table xBestIndex() method. FossilOrigin-Name: de034c0db66298454ae8418949d58eb6e223c0de --- main.mk | 1 + manifest | 21 ++- manifest.uuid | 2 +- src/tclsqlite.c | 2 + src/test_bestindex.c | 436 +++++++++++++++++++++++++++++++++++++++++++ test/bestindex1.test | 61 ++++++ 6 files changed, 514 insertions(+), 9 deletions(-) create mode 100644 src/test_bestindex.c create mode 100644 test/bestindex1.test diff --git a/main.mk b/main.mk index e9920180d9..78cb0ad137 100644 --- a/main.mk +++ b/main.mk @@ -285,6 +285,7 @@ TESTSRC = \ $(TOP)/src/test_autoext.c \ $(TOP)/src/test_async.c \ $(TOP)/src/test_backup.c \ + $(TOP)/src/test_bestindex.c \ $(TOP)/src/test_blob.c \ $(TOP)/src/test_btree.c \ $(TOP)/src/test_config.c \ diff --git a/manifest b/manifest index 3cdd9396b7..ca3e2793bd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Better\sestimatedCost\sin\sthe\sxBestIndex\smethod\sof\sthe\sgenerate_series\svtab. -D 2016-03-01T02:11:50.810 +C Add\stest\scode\suseful\sfor\stesting\sthe\splanners\suse\sof\steh\svirtual\stable\sxBestIndex()\smethod. +D 2016-03-01T18:07:43.649 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -273,7 +273,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk 791597b87204f6bd56cdf7b2ab2feeecd608c60d +F main.mk 31027cdd40130bdbb3a0862bb97a8c837c5987d9 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 @@ -358,7 +358,7 @@ F src/sqliteInt.h 01b43972162c2b5ed864060a23502af3abe0e4f4 F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9 -F src/tclsqlite.c 13debcc6a5ca1217486f8903768c01114fbe8b58 +F src/tclsqlite.c 54dca4eaf3a9cb0a4b845ef54ffa99225c30a52e F src/test1.c f14a6f9e2cff6cba4d83e2b0c52857f61886cead F src/test2.c 5586f43fcd9a1be0830793cf9d354082c261b25b F src/test3.c a8887dabbbee3059af338f20d290084a63ed1b0f @@ -371,6 +371,7 @@ F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60 F src/test_async.c 21e11293a2f72080eda70e1124e9102044531cd8 F src/test_autoext.c dea8a01a7153b9adc97bd26161e4226329546e12 F src/test_backup.c 2e6e6a081870150f20c526a2e9d0d29cda47d803 +F src/test_bestindex.c 2004eeca2d227fe62ed581776dc7fd349d45b8f3 F src/test_blob.c b2551a9b5573232db5f66f292307c37067937239 F src/test_btree.c 2e9978eca99a9a4bfa8cae949efb00886860a64f F src/test_config.c 0dee90328e3dedf8ba002ee94b6a7e7ea7726fe4 @@ -492,6 +493,7 @@ F test/backup_malloc.test 7162d604ec2b4683c4b3799a48657fb8b5e2d450 F test/badutf.test d5360fc31f643d37a973ab0d8b4fb85799c3169f F test/badutf2.test f5bc7f2d280670ecd79b9cf4f0f1760c607fe51f F test/bc_common.tcl 3eda41ef9cda7d5f6c205462c96228b301da4191 +F test/bestindex1.test a7213b26f039edfcdb4c0cc13392b79cd4a23779 F test/between.test 34d375fb5ce1ae283ffe82b6b233e9f38e84fc6c F test/bigfile.test aa74f4e5db51c8e54a1d9de9fa65d01d1eb20b59 F test/bigfile2.test 1b489a3a39ae90c7f027b79110d6b4e1dbc71bfc @@ -1451,7 +1453,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c9a30e117f2c6c9ef0cc0c6ca5227d2961715b8f -R 78072d3e9e5d5130b27dfb7458df9d26 -U drh -Z 00eb8a065721ce5867f81f8e93fd77c0 +P f2c16094a536e7ef62444d0fe38cbee2a4999426 +R c8660859b43a9c62a3adc82692a6c451 +T *branch * test-bestindex +T *sym-test-bestindex * +T -sym-trunk * +U dan +Z 7443660e56c432a07b1f019ab23aa0dc diff --git a/manifest.uuid b/manifest.uuid index ead2aaed5e..3fb12f3617 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f2c16094a536e7ef62444d0fe38cbee2a4999426 \ No newline at end of file +de034c0db66298454ae8418949d58eb6e223c0de \ No newline at end of file diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 77da6eef52..4e19f92644 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -3774,6 +3774,7 @@ static void init_all(Tcl_Interp *interp){ extern int SqlitetestSyscall_Init(Tcl_Interp*); extern int Fts5tcl_Init(Tcl_Interp *); extern int SqliteRbu_Init(Tcl_Interp*); + extern int Sqlitetesttcl_Init(Tcl_Interp*); #if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4) extern int Sqlitetestfts3_Init(Tcl_Interp *interp); #endif @@ -3818,6 +3819,7 @@ static void init_all(Tcl_Interp *interp){ SqlitetestSyscall_Init(interp); Fts5tcl_Init(interp); SqliteRbu_Init(interp); + Sqlitetesttcl_Init(interp); #if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4) Sqlitetestfts3_Init(interp); diff --git a/src/test_bestindex.c b/src/test_bestindex.c new file mode 100644 index 0000000000..051a784c6d --- /dev/null +++ b/src/test_bestindex.c @@ -0,0 +1,436 @@ +/* +** 2013 Jan 11 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** Code for testing the virtual table xBestIndex method and the query +** planner. +*/ + + +/* +** INSTRUCTIONS +** +** This module exports a single tcl command - [register_tcl_module]. When +** invoked, it registers a special virtual table module with a database +** connection. +** +** The virtual table is currently read-only. And always returns zero rows. +** It is created with a single argument - the name of a Tcl command - as +** follows: +** +** CREATE VIRTUAL TABLE x1 USING tcl(tcl_command); +** +** The command [tcl_command] is invoked when the table is first created (or +** connected) and when the xBestIndex() method is invoked. When it is created +** (or connected), it is invoked as follows: +** +** tcl_command xConnect +** +** In this case the return value of the script is passed to the +** sqlite3_declare_vtab() function to create the virtual table schema. +** +** When the xBestIndex() method is called by SQLite, the Tcl command is +** invoked as: +** +** tcl_command xBestIndex CONSTRAINTS ORDERBY MASK +** +** where CONSTRAINTS is a tcl representation of the aConstraints[] array, +** ORDERBY is a representation of the contents of the aOrderBy[] array and +** MASK is a copy of sqlite3_index_info.colUsed. For example if the virtual +** table is declared as: +** +** CREATE TABLE x1(a, b, c) +** +** and the query is: +** +** SELECT * FROM x1 WHERE a=? AND c module name ("fs") +** argv[1] -> database name +** argv[2] -> table name +** argv[...] -> other module argument fields. +*/ +static int tclConnect( + sqlite3 *db, + void *pAux, + int argc, const char *const*argv, + sqlite3_vtab **ppVtab, + char **pzErr +){ + Tcl_Interp *interp = (Tcl_Interp*)pAux; + tcl_vtab *pTab; + const char *zCmd; + Tcl_Obj *pScript = 0; + int rc; + + if( argc!=4 ){ + *pzErr = sqlite3_mprintf("wrong number of arguments"); + return SQLITE_ERROR; + } + zCmd = argv[3]; + + pTab = (tcl_vtab*)sqlite3_malloc(sizeof(tcl_vtab)); + if( pTab==0 ) return SQLITE_NOMEM; + memset(pTab, 0, sizeof(tcl_vtab)); + + pTab->pCmd = Tcl_NewStringObj(zCmd, -1); + pTab->interp = interp; + Tcl_IncrRefCount(pTab->pCmd); + + pScript = Tcl_DuplicateObj(pTab->pCmd); + Tcl_IncrRefCount(pScript); + Tcl_ListObjAppendElement(interp, pScript, Tcl_NewStringObj("xConnect", -1)); + + rc = Tcl_EvalObjEx(interp, pScript, TCL_EVAL_GLOBAL); + if( rc!=TCL_OK ){ + *pzErr = sqlite3_mprintf("%s", Tcl_GetStringResult(interp)); + rc = SQLITE_ERROR; + }else{ + rc = sqlite3_declare_vtab(db, Tcl_GetStringResult(interp)); + } + + if( rc!=SQLITE_OK ){ + sqlite3_free(pTab); + pTab = 0; + } + + *ppVtab = &pTab->base; + return rc; +} + +/* The xDisconnect and xDestroy methods are also the same */ +static int tclDisconnect(sqlite3_vtab *pVtab){ + tcl_vtab *pTab = (tcl_vtab*)pVtab; + Tcl_DecrRefCount(pTab->pCmd); + sqlite3_free(pTab); + return SQLITE_OK; +} + +/* +** Open a new tcl cursor. +*/ +static int tclOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ + tcl_cursor *pCur; + pCur = sqlite3_malloc(sizeof(tcl_cursor)); + if( pCur==0 ) return SQLITE_NOMEM; + memset(pCur, 0, sizeof(tcl_cursor)); + *ppCursor = &pCur->base; + return SQLITE_OK; +} + +/* +** Close a tcl cursor. +*/ +static int tclClose(sqlite3_vtab_cursor *cur){ + tcl_cursor *pCur = (tcl_cursor *)cur; + sqlite3_free(pCur); + return SQLITE_OK; +} + +static int tclNext(sqlite3_vtab_cursor *cur){ + return SQLITE_OK; +} + +static int tclFilter( + sqlite3_vtab_cursor *pVtabCursor, + int idxNum, const char *idxStr, + int argc, sqlite3_value **argv +){ + return SQLITE_OK; +} + +static int tclColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){ + return SQLITE_OK; +} + +static int tclRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){ + return SQLITE_OK; +} + +static int tclEof(sqlite3_vtab_cursor *cur){ + return 1; +} + +static int tclBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ + tcl_vtab *pTab = (tcl_vtab*)tab; + Tcl_Interp *interp = pTab->interp; + Tcl_Obj *pArg; + Tcl_Obj *pScript; + int ii; + int rc = SQLITE_OK; + + pScript = Tcl_DuplicateObj(pTab->pCmd); + Tcl_IncrRefCount(pScript); + Tcl_ListObjAppendElement(interp, pScript, Tcl_NewStringObj("xBestIndex", -1)); + + pArg = Tcl_NewObj(); + Tcl_IncrRefCount(pArg); + for(ii=0; iinConstraint; ii++){ + struct sqlite3_index_constraint const *pCons = &pIdxInfo->aConstraint[ii]; + Tcl_Obj *pElem = Tcl_NewObj(); + const char *zOp = "?"; + + Tcl_IncrRefCount(pElem); + + switch( pCons->op ){ + case SQLITE_INDEX_CONSTRAINT_EQ: + zOp = "eq"; break; + case SQLITE_INDEX_CONSTRAINT_GT: + zOp = "gt"; break; + case SQLITE_INDEX_CONSTRAINT_LE: + zOp = "le"; break; + case SQLITE_INDEX_CONSTRAINT_LT: + zOp = "lt"; break; + case SQLITE_INDEX_CONSTRAINT_GE: + zOp = "ge"; break; + case SQLITE_INDEX_CONSTRAINT_MATCH: + zOp = "match"; break; + case SQLITE_INDEX_CONSTRAINT_LIKE: + zOp = "like"; break; + case SQLITE_INDEX_CONSTRAINT_GLOB: + zOp = "glob"; break; + case SQLITE_INDEX_CONSTRAINT_REGEXP: + zOp = "regexp"; break; + } + + Tcl_ListObjAppendElement(0, pElem, Tcl_NewStringObj("op", -1)); + Tcl_ListObjAppendElement(0, pElem, Tcl_NewStringObj(zOp, -1)); + Tcl_ListObjAppendElement(0, pElem, Tcl_NewStringObj("column", -1)); + Tcl_ListObjAppendElement(0, pElem, Tcl_NewIntObj(pCons->iColumn)); + Tcl_ListObjAppendElement(0, pElem, Tcl_NewStringObj("usable", -1)); + Tcl_ListObjAppendElement(0, pElem, Tcl_NewIntObj(pCons->usable)); + + Tcl_ListObjAppendElement(0, pArg, pElem); + Tcl_DecrRefCount(pElem); + } + + Tcl_ListObjAppendElement(0, pScript, pArg); + Tcl_DecrRefCount(pArg); + + pArg = Tcl_NewObj(); + Tcl_IncrRefCount(pArg); + for(ii=0; iinOrderBy; ii++){ + struct sqlite3_index_orderby const *pOrder = &pIdxInfo->aOrderBy[ii]; + Tcl_Obj *pElem = Tcl_NewObj(); + Tcl_IncrRefCount(pElem); + + Tcl_ListObjAppendElement(0, pElem, Tcl_NewStringObj("column", -1)); + Tcl_ListObjAppendElement(0, pElem, Tcl_NewIntObj(pOrder->iColumn)); + Tcl_ListObjAppendElement(0, pElem, Tcl_NewStringObj("desc", -1)); + Tcl_ListObjAppendElement(0, pElem, Tcl_NewIntObj(pOrder->desc)); + + Tcl_ListObjAppendElement(0, pArg, pElem); + Tcl_DecrRefCount(pElem); + } + + Tcl_ListObjAppendElement(0, pScript, pArg); + Tcl_DecrRefCount(pArg); + + Tcl_ListObjAppendElement(0, pScript, Tcl_NewWideIntObj(pIdxInfo->colUsed)); + + rc = Tcl_EvalObjEx(interp, pScript, TCL_EVAL_GLOBAL); + Tcl_DecrRefCount(pScript); + if( rc!=TCL_OK ){ + const char *zErr = Tcl_GetStringResult(interp); + rc = SQLITE_ERROR; + pTab->base.zErrMsg = sqlite3_mprintf("%s", zErr); + }else{ + /* Analyze the scripts return value. The return value should be a tcl + ** list object with an even number of elements. The first element of each + ** pair must be one of: + ** + ** "orderby" (value of orderByConsumed flag) + ** "cost" (value of estimatedCost field) + ** "rows" (value of estimatedRows field) + ** "use" (index of used constraint in aConstraint[]) + ** "idxnum" (value of idxNum field) + ** "idxstr" (value of idxStr field) + */ + Tcl_Obj *pRes = Tcl_GetObjResult(interp); + Tcl_Obj **apElem = 0; + int nElem; + rc = Tcl_ListObjGetElements(interp, pRes, &nElem, &apElem); + if( rc!=TCL_OK ){ + const char *zErr = Tcl_GetStringResult(interp); + rc = SQLITE_ERROR; + pTab->base.zErrMsg = sqlite3_mprintf("%s", zErr); + }else{ + int iArgv = 1; + for(ii=0; rc==SQLITE_OK && iiestimatedCost); + }else + if( sqlite3_stricmp("orderby", zCmd)==0 ){ + rc = Tcl_GetIntFromObj(interp, p, &pIdxInfo->orderByConsumed); + }else + if( sqlite3_stricmp("idxnum", zCmd)==0 ){ + rc = Tcl_GetIntFromObj(interp, p, &pIdxInfo->idxNum); + }else + if( sqlite3_stricmp("idxstr", zCmd)==0 ){ + sqlite3_free(pIdxInfo->idxStr); + pIdxInfo->idxStr = sqlite3_mprintf("%s", Tcl_GetString(p)); + }else + if( sqlite3_stricmp("rows", zCmd)==0 ){ + rc = Tcl_GetWideIntFromObj(interp, p, &pIdxInfo->estimatedRows); + }else + if( sqlite3_stricmp("use", zCmd)==0 ){ + int iCons; + rc = Tcl_GetIntFromObj(interp, p, &iCons); + if( rc==SQLITE_OK ){ + if( iCons<0 || iCons>=pIdxInfo->nConstraint ){ + rc = SQLITE_ERROR; + pTab->base.zErrMsg = sqlite3_mprintf("unexpected: %d", iCons); + }else{ + pIdxInfo->aConstraintUsage[iCons].argvIndex = iArgv++; + } + } + }else{ + rc = SQLITE_ERROR; + pTab->base.zErrMsg = sqlite3_mprintf("unexpected: %s", zCmd); + } + if( rc!=SQLITE_OK && pTab->base.zErrMsg==0 ){ + const char *zErr = Tcl_GetStringResult(interp); + pTab->base.zErrMsg = sqlite3_mprintf("%s", zErr); + } + } + } + } + + return rc; +} + +/* +** A virtual table module that provides read-only access to a +** Tcl global variable namespace. +*/ +static sqlite3_module tclModule = { + 0, /* iVersion */ + tclConnect, + tclConnect, + tclBestIndex, + tclDisconnect, + tclDisconnect, + tclOpen, /* xOpen - open a cursor */ + tclClose, /* xClose - close a cursor */ + tclFilter, /* xFilter - configure scan constraints */ + tclNext, /* xNext - advance a cursor */ + tclEof, /* xEof - check for end of scan */ + tclColumn, /* xColumn - read data */ + tclRowid, /* xRowid - read data */ + 0, /* xUpdate */ + 0, /* xBegin */ + 0, /* xSync */ + 0, /* xCommit */ + 0, /* xRollback */ + 0, /* xFindMethod */ + 0, /* xRename */ +}; + +/* +** Decode a pointer to an sqlite3 object. +*/ +extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb); + +/* +** Register the echo virtual table module. +*/ +static int register_tcl_module( + ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ + Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ + int objc, /* Number of arguments */ + Tcl_Obj *CONST objv[] /* Command arguments */ +){ + sqlite3 *db; + if( objc!=2 ){ + Tcl_WrongNumArgs(interp, 1, objv, "DB"); + return TCL_ERROR; + } + if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; +#ifndef SQLITE_OMIT_VIRTUALTABLE + sqlite3_create_module(db, "tcl", &tclModule, (void *)interp); +#endif + return TCL_OK; +} + +#endif + + +/* +** Register commands with the TCL interpreter. +*/ +int Sqlitetesttcl_Init(Tcl_Interp *interp){ +#ifndef SQLITE_OMIT_VIRTUALTABLE + static struct { + char *zName; + Tcl_ObjCmdProc *xProc; + void *clientData; + } aObjCmd[] = { + { "register_tcl_module", register_tcl_module, 0 }, + }; + int i; + for(i=0; i Date: Tue, 1 Mar 2016 18:24:36 +0000 Subject: [PATCH 48/66] Allow test_bestindex.c to set the omit flag for a constraint. FossilOrigin-Name: 759b9d5b22aa60cc1d6b606f81eb7366c28cbcbe --- manifest | 17 +++++++---------- manifest.uuid | 2 +- src/test_bestindex.c | 7 ++++++- test/bestindex1.test | 4 ++-- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index ca3e2793bd..6d84721ebf 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\stest\scode\suseful\sfor\stesting\sthe\splanners\suse\sof\steh\svirtual\stable\sxBestIndex()\smethod. -D 2016-03-01T18:07:43.649 +C Allow\stest_bestindex.c\sto\sset\sthe\somit\sflag\sfor\sa\sconstraint. +D 2016-03-01T18:24:36.515 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -371,7 +371,7 @@ F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60 F src/test_async.c 21e11293a2f72080eda70e1124e9102044531cd8 F src/test_autoext.c dea8a01a7153b9adc97bd26161e4226329546e12 F src/test_backup.c 2e6e6a081870150f20c526a2e9d0d29cda47d803 -F src/test_bestindex.c 2004eeca2d227fe62ed581776dc7fd349d45b8f3 +F src/test_bestindex.c 6448b9b7ef9729f04093462be539255938d256db F src/test_blob.c b2551a9b5573232db5f66f292307c37067937239 F src/test_btree.c 2e9978eca99a9a4bfa8cae949efb00886860a64f F src/test_config.c 0dee90328e3dedf8ba002ee94b6a7e7ea7726fe4 @@ -493,7 +493,7 @@ F test/backup_malloc.test 7162d604ec2b4683c4b3799a48657fb8b5e2d450 F test/badutf.test d5360fc31f643d37a973ab0d8b4fb85799c3169f F test/badutf2.test f5bc7f2d280670ecd79b9cf4f0f1760c607fe51f F test/bc_common.tcl 3eda41ef9cda7d5f6c205462c96228b301da4191 -F test/bestindex1.test a7213b26f039edfcdb4c0cc13392b79cd4a23779 +F test/bestindex1.test 8d8ae7e96a98079f43518cae536535cc52aee49b F test/between.test 34d375fb5ce1ae283ffe82b6b233e9f38e84fc6c F test/bigfile.test aa74f4e5db51c8e54a1d9de9fa65d01d1eb20b59 F test/bigfile2.test 1b489a3a39ae90c7f027b79110d6b4e1dbc71bfc @@ -1453,10 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f2c16094a536e7ef62444d0fe38cbee2a4999426 -R c8660859b43a9c62a3adc82692a6c451 -T *branch * test-bestindex -T *sym-test-bestindex * -T -sym-trunk * +P de034c0db66298454ae8418949d58eb6e223c0de +R 25f59441195481b2d87b75ea969fe23e U dan -Z 7443660e56c432a07b1f019ab23aa0dc +Z 102ea7e54c5366f48aedd548677f81f2 diff --git a/manifest.uuid b/manifest.uuid index 3fb12f3617..d72f0e3eaf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -de034c0db66298454ae8418949d58eb6e223c0de \ No newline at end of file +759b9d5b22aa60cc1d6b606f81eb7366c28cbcbe \ No newline at end of file diff --git a/src/test_bestindex.c b/src/test_bestindex.c index 051a784c6d..e58c363db5 100644 --- a/src/test_bestindex.c +++ b/src/test_bestindex.c @@ -302,6 +302,7 @@ static int tclBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ ** "use" (index of used constraint in aConstraint[]) ** "idxnum" (value of idxNum field) ** "idxstr" (value of idxStr field) + ** "omit" (index of omitted constraint in aConstraint[]) */ Tcl_Obj *pRes = Tcl_GetObjResult(interp); Tcl_Obj **apElem = 0; @@ -332,7 +333,9 @@ static int tclBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ if( sqlite3_stricmp("rows", zCmd)==0 ){ rc = Tcl_GetWideIntFromObj(interp, p, &pIdxInfo->estimatedRows); }else - if( sqlite3_stricmp("use", zCmd)==0 ){ + if( sqlite3_stricmp("use", zCmd)==0 + || sqlite3_stricmp("omit", zCmd)==0 + ){ int iCons; rc = Tcl_GetIntFromObj(interp, p, &iCons); if( rc==SQLITE_OK ){ @@ -340,7 +343,9 @@ static int tclBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ rc = SQLITE_ERROR; pTab->base.zErrMsg = sqlite3_mprintf("unexpected: %d", iCons); }else{ + int bOmit = (zCmd[0]=='o' || zCmd[0]=='O'); pIdxInfo->aConstraintUsage[iCons].argvIndex = iArgv++; + pIdxInfo->aConstraintUsage[iCons].omit = bOmit; } } }else{ diff --git a/test/bestindex1.test b/test/bestindex1.test index e3443ddc77..7b1fb86228 100644 --- a/test/bestindex1.test +++ b/test/bestindex1.test @@ -29,7 +29,7 @@ proc vtab_command {method args} { catch { array unset C } array set C [lindex $clist 0] if {$C(usable)} { - return "use 0 cost 0 rows 1 idxnum 555 idxstr eq!" + return "omit 0 cost 0 rows 1 idxnum 555 idxstr eq!" } else { return "cost 1000000 rows 0 idxnum 0 idxstr scan..." } @@ -50,11 +50,11 @@ do_eqp_test 1.1 { 0 0 0 {SCAN TABLE x1 VIRTUAL TABLE INDEX 555:eq!} } -#set sqlite_where_trace 0x3ff do_eqp_test 1.2 { SELECT * FROM x1 WHERE a IN ('abc', 'def'); } { 0 0 0 {SCAN TABLE x1 VIRTUAL TABLE INDEX 555:eq!} + 0 0 0 {EXECUTE LIST SUBQUERY 1} } finish_test From 23c3c38dd63e5c8bd8568f18ce6839672d7f2ebe Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 1 Mar 2016 18:35:55 +0000 Subject: [PATCH 49/66] Fix a memory leak in the test code on this branch. FossilOrigin-Name: 7a1add56341f43dc41adc7b370e58860f4dd50a3 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/test_bestindex.c | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 6d84721ebf..775d6d0fdb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Allow\stest_bestindex.c\sto\sset\sthe\somit\sflag\sfor\sa\sconstraint. -D 2016-03-01T18:24:36.515 +C Fix\sa\smemory\sleak\sin\sthe\stest\scode\son\sthis\sbranch. +D 2016-03-01T18:35:55.112 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -371,7 +371,7 @@ F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60 F src/test_async.c 21e11293a2f72080eda70e1124e9102044531cd8 F src/test_autoext.c dea8a01a7153b9adc97bd26161e4226329546e12 F src/test_backup.c 2e6e6a081870150f20c526a2e9d0d29cda47d803 -F src/test_bestindex.c 6448b9b7ef9729f04093462be539255938d256db +F src/test_bestindex.c 31ac82f4b21395572e26c6693bf47fdd032d6e61 F src/test_blob.c b2551a9b5573232db5f66f292307c37067937239 F src/test_btree.c 2e9978eca99a9a4bfa8cae949efb00886860a64f F src/test_config.c 0dee90328e3dedf8ba002ee94b6a7e7ea7726fe4 @@ -1453,7 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P de034c0db66298454ae8418949d58eb6e223c0de -R 25f59441195481b2d87b75ea969fe23e +P 759b9d5b22aa60cc1d6b606f81eb7366c28cbcbe +R e9150850334c910fa82ad79b36b013cf U dan -Z 102ea7e54c5366f48aedd548677f81f2 +Z bc3fb098cb9eaf89cb42b29f1b53a09a diff --git a/manifest.uuid b/manifest.uuid index d72f0e3eaf..0849f0a941 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -759b9d5b22aa60cc1d6b606f81eb7366c28cbcbe \ No newline at end of file +7a1add56341f43dc41adc7b370e58860f4dd50a3 \ No newline at end of file diff --git a/src/test_bestindex.c b/src/test_bestindex.c index e58c363db5..4fbf63bf19 100644 --- a/src/test_bestindex.c +++ b/src/test_bestindex.c @@ -329,6 +329,7 @@ static int tclBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ if( sqlite3_stricmp("idxstr", zCmd)==0 ){ sqlite3_free(pIdxInfo->idxStr); pIdxInfo->idxStr = sqlite3_mprintf("%s", Tcl_GetString(p)); + pIdxInfo->needToFreeIdxStr = 1; }else if( sqlite3_stricmp("rows", zCmd)==0 ){ rc = Tcl_GetWideIntFromObj(interp, p, &pIdxInfo->estimatedRows); From 4fb48e4eb1ebfec2ea07f0871edef28a188a6c52 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 1 Mar 2016 22:41:27 +0000 Subject: [PATCH 50/66] Improved debugging output with wheretrace. Fix some typos in test script comments. FossilOrigin-Name: 13a37fd487ce7d4f98a12f7a67a9c05dadc66557 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/where.c | 3 ++- test/analyze9.test | 2 +- test/analyzeD.test | 5 ++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index 3cdd9396b7..e8fac4d6a2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Better\sestimatedCost\sin\sthe\sxBestIndex\smethod\sof\sthe\sgenerate_series\svtab. -D 2016-03-01T02:11:50.810 +C Improved\sdebugging\soutput\swith\swheretrace.\s\sFix\ssome\stypos\sin\stest\sscript\ncomments. +D 2016-03-01T22:41:27.874 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -428,7 +428,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c 10deb6b43887662691e5f53d10b3c171c401169b F src/wal.h 2f7c831cf3b071fa548bf2d5cac640846a7ff19c F src/walker.c 0f142b5bd3ed2041fc52d773880748b212e63354 -F src/where.c 32051597188dc632bafb32d50a9c3a04fb97ce39 +F src/where.c 6282e53fcc612a8918262f1432d6fd7fbc24af40 F src/whereInt.h 93297d56edd137b7ea004490690fb6e2ce028a34 F src/wherecode.c 39c1ef4598bedf1d66249334c74efd23ddd182ac F src/whereexpr.c fb87944b1254234e5bba671aaf6dee476241506a @@ -451,11 +451,11 @@ F test/analyze5.test 765c4e284aa69ca172772aa940946f55629bc8c4 F test/analyze6.test f1c552ce39cca4ec922a7e4e0e5d0203d6b3281f F test/analyze7.test bb1409afc9e8629e414387ef048b8e0e3e0bdc4f F test/analyze8.test c05a461d0a6b05991106467d0c47480f2e709c82 -F test/analyze9.test 88c1f2aa20b614236f03e1cc38c3619e7e8a38b4 +F test/analyze9.test b817b8e798315fc65b820a5463f73ad5f48ed8dd F test/analyzeA.test 3335697f6700c7052295cfd0067fc5b2aacddf9a F test/analyzeB.test a4c1c3048f6d9e090eb76e83eecb18bcf6d31a70 F test/analyzeC.test 555a6cc388b9818b6eda6df816f01ce0a75d3a93 -F test/analyzeD.test f3d77cd0fefe2849d784897d52df13beee19271d +F test/analyzeD.test 42af58de25a6436502e43006e9e59e2d71bcb0cf F test/analyzeE.test 8684e8ac5722fb97c251887ad97e5d496a98af1d F test/analyzeF.test 5d1fe1024ba2dfea3c18bede8c1ccef8aba1ab34 F test/analyzer1.test 498e2ff4b62740c2751c3a2f8b744fe26689fae9 @@ -1451,7 +1451,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c9a30e117f2c6c9ef0cc0c6ca5227d2961715b8f -R 78072d3e9e5d5130b27dfb7458df9d26 +P f2c16094a536e7ef62444d0fe38cbee2a4999426 +R 8bf9dc83caf7a5f48b09e10ce3dd712c U drh -Z 00eb8a065721ce5867f81f8e93fd77c0 +Z cbae5a3ad8eb0cbd1b6534802cfd9e9b diff --git a/manifest.uuid b/manifest.uuid index ead2aaed5e..1fa5c8f4d5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f2c16094a536e7ef62444d0fe38cbee2a4999426 \ No newline at end of file +13a37fd487ce7d4f98a12f7a67a9c05dadc66557 \ No newline at end of file diff --git a/src/where.c b/src/where.c index 71d3cb01ef..e2a482cf90 100644 --- a/src/where.c +++ b/src/where.c @@ -1561,7 +1561,8 @@ static int whereEqualScanEst( pBuilder->nRecValid = nEq; whereKeyStats(pParse, p, pRec, 0, a); - WHERETRACE(0x10,("equality scan regions: %d\n", (int)a[1])); + WHERETRACE(0x10,("equality scan regions %s(%d): %d\n", + p->zName, nEq-1, (int)a[1])); *pnRow = a[1]; return rc; diff --git a/test/analyze9.test b/test/analyze9.test index e24f3dd49d..918577bd19 100644 --- a/test/analyze9.test +++ b/test/analyze9.test @@ -1180,7 +1180,7 @@ do_execsql_test 26.1.3 { # # There should be no other samples that start with (x=10000). So it knows # that (x=10000 AND y<50) must match somewhere between 0 and 99 rows, but -# know more than that. Guessing less than 20 is therefore unreasonable. +# no more than that. Guessing less than 20 is therefore unreasonable. # # At one point though, due to a problem in whereKeyStats(), the planner was # estimating that (x=10000 AND y<50) would match only 2 rows. diff --git a/test/analyzeD.test b/test/analyzeD.test index 7ef1094f82..4588aaeebc 100644 --- a/test/analyzeD.test +++ b/test/analyzeD.test @@ -1,4 +1,4 @@ -# 2005 July 22 +# 2014-10-04 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: @@ -11,7 +11,6 @@ # This file implements regression tests for SQLite library. # This file implements tests for the ANALYZE command. # -# $Id: analyze.test,v 1.9 2008/08/11 18:44:58 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -75,7 +74,7 @@ do_test 1.3 { } {} # Without stat1, because 3001 is larger than all samples in the stat4 -# table, SQLite things that a=3001 matches just 1 row. So it (incorrectly) +# table, SQLite thinks that a=3001 matches just 1 row. So it (incorrectly) # chooses it over the c=150 index (5 rows). Even with stat1 data, things # worked this way before commit [e6f7f97dbc]. # From 47784529cc3c667c214a6fa5ea37182b26a32a89 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 2 Mar 2016 00:58:49 +0000 Subject: [PATCH 51/66] Add the optional -DSERIES_OMIT_CONSTRAINT_VERIFY=0 option to the series.c extension that implements the generate_series() virtual table. FossilOrigin-Name: 3d9daa929c0abe6dc01e800ef343b0eef2f0c76a --- ext/misc/series.c | 14 +++++++++++--- manifest | 13 ++++++------- manifest.uuid | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/ext/misc/series.c b/ext/misc/series.c index 4e6341c33b..f2e0a39658 100644 --- a/ext/misc/series.c +++ b/ext/misc/series.c @@ -217,6 +217,14 @@ static int seriesEof(sqlite3_vtab_cursor *cur){ } } +/* True to omit run-time checking of the start=, stop=, and/or step= +** parameters. The only reason to not omit these is for testing the +** constraint checking logic for virtual tables in the SQLite core. +*/ +#ifndef SERIES_OMIT_CONSTRAINT_VERIFY +# define SERIES_OMIT_CONSTRAINT_VERIFY 1 +#endif + /* ** This method is called to "rewind" the series_cursor object back ** to the first row of output. This method is always called at least @@ -324,15 +332,15 @@ static int seriesBestIndex( } if( startIdx>=0 ){ pIdxInfo->aConstraintUsage[startIdx].argvIndex = ++nArg; - pIdxInfo->aConstraintUsage[startIdx].omit = 1; + pIdxInfo->aConstraintUsage[startIdx].omit = SERIES_OMIT_CONSTRAINT_VERIFY; } if( stopIdx>=0 ){ pIdxInfo->aConstraintUsage[stopIdx].argvIndex = ++nArg; - pIdxInfo->aConstraintUsage[stopIdx].omit = 1; + pIdxInfo->aConstraintUsage[stopIdx].omit = SERIES_OMIT_CONSTRAINT_VERIFY; } if( stepIdx>=0 ){ pIdxInfo->aConstraintUsage[stepIdx].argvIndex = ++nArg; - pIdxInfo->aConstraintUsage[stepIdx].omit = 1; + pIdxInfo->aConstraintUsage[stepIdx].omit = SERIES_OMIT_CONSTRAINT_VERIFY; } if( (idxNum & 3)==3 ){ /* Both start= and stop= boundaries are available. This is the diff --git a/manifest b/manifest index 7784cb3c77..bfe67e6715 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C New\stest\scases\sand\sinfrastructure\sfor\stesting\sthe\sxBestIndex\smethod\sof\s\nvirtual\stables. -D 2016-03-01T22:48:00.766 +C Add\sthe\soptional\s-DSERIES_OMIT_CONSTRAINT_VERIFY=0\soption\sto\sthe\sseries.c\nextension\sthat\simplements\sthe\sgenerate_series()\svirtual\stable. +D 2016-03-02T00:58:49.570 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -212,7 +212,7 @@ F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342 F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63 F ext/misc/regexp.c af92cdaa5058fcec1451e49becc7ba44dba023dc F ext/misc/rot13.c 1ac6f95f99b575907b9b09c81a349114cf9be45a -F ext/misc/series.c 235d6281397003ad5226582de216507642aa0095 +F ext/misc/series.c e1ef8bc23328d4e2196835737f62b324bdcd1c0d F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52 F ext/misc/spellfix.c 525190484b7a9dbc6be646c4842274fff4f27d53 F ext/misc/totype.c 4a167594e791abeed95e0a8db028822b5e8fe512 @@ -1453,8 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 13a37fd487ce7d4f98a12f7a67a9c05dadc66557 7a1add56341f43dc41adc7b370e58860f4dd50a3 -R 0985007e1a98dc617470e125c83c71f2 -T +closed 7a1add56341f43dc41adc7b370e58860f4dd50a3 +P 1d41c161165006d6c2af47e476f05fb13039f8b8 +R 7bc50a1ee335d764bdfff403c9ca0d5d U drh -Z 971ab7ec7b38808209f8a28c1ffc2c5d +Z d249d93e08651d834742ccb923f02a0e diff --git a/manifest.uuid b/manifest.uuid index ab5413d9af..67149f5847 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1d41c161165006d6c2af47e476f05fb13039f8b8 \ No newline at end of file +3d9daa929c0abe6dc01e800ef343b0eef2f0c76a \ No newline at end of file From dbc49161c0bc186351d56743a2ad0e1bac56a3da Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 2 Mar 2016 03:28:07 +0000 Subject: [PATCH 52/66] Allow the left-hand side of IN operators on virtual tables to have the aConstraintUsage[].omit flag clear. FossilOrigin-Name: 1622623cbbfc4325c53d731aba78ca9c382ec612 --- Makefile.in | 1 + Makefile.msc | 1 + ext/misc/series.c | 14 +++++++------- main.mk | 3 ++- manifest | 27 +++++++++++++++------------ manifest.uuid | 2 +- src/where.c | 7 ------- src/wherecode.c | 45 ++++++++++++++++++++++++++++++++++++++++----- test/tabfunc01.test | 15 +++++++++++++++ 9 files changed, 82 insertions(+), 33 deletions(-) diff --git a/Makefile.in b/Makefile.in index 013cf442d1..891329719a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1050,6 +1050,7 @@ sqlite3rbu.lo: $(TOP)/ext/rbu/sqlite3rbu.c $(HDR) $(EXTHDR) TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE TESTFIXTURE_FLAGS += -DBUILD_sqlite +TESTFIXTURE_FLAGS += -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 TESTFIXTURE_SRC0 = $(TESTSRC2) libsqlite3.la TESTFIXTURE_SRC1 = sqlite3.c diff --git a/Makefile.msc b/Makefile.msc index de225305f5..d9af285c06 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1925,6 +1925,7 @@ sqlite3rbu.lo: $(TOP)\ext\rbu\sqlite3rbu.c $(HDR) $(EXTHDR) TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN) +TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C) diff --git a/ext/misc/series.c b/ext/misc/series.c index f2e0a39658..9f80bb46ca 100644 --- a/ext/misc/series.c +++ b/ext/misc/series.c @@ -217,12 +217,12 @@ static int seriesEof(sqlite3_vtab_cursor *cur){ } } -/* True to omit run-time checking of the start=, stop=, and/or step= -** parameters. The only reason to not omit these is for testing the +/* True to cause run-time checking of the start=, stop=, and/or step= +** parameters. The only reason to do this is for testing the ** constraint checking logic for virtual tables in the SQLite core. */ -#ifndef SERIES_OMIT_CONSTRAINT_VERIFY -# define SERIES_OMIT_CONSTRAINT_VERIFY 1 +#ifndef SQLITE_SERIES_CONSTRAINT_VERIFY +# define SQLITE_SERIES_CONSTRAINT_VERIFY 0 #endif /* @@ -332,15 +332,15 @@ static int seriesBestIndex( } if( startIdx>=0 ){ pIdxInfo->aConstraintUsage[startIdx].argvIndex = ++nArg; - pIdxInfo->aConstraintUsage[startIdx].omit = SERIES_OMIT_CONSTRAINT_VERIFY; + pIdxInfo->aConstraintUsage[startIdx].omit= !SQLITE_SERIES_CONSTRAINT_VERIFY; } if( stopIdx>=0 ){ pIdxInfo->aConstraintUsage[stopIdx].argvIndex = ++nArg; - pIdxInfo->aConstraintUsage[stopIdx].omit = SERIES_OMIT_CONSTRAINT_VERIFY; + pIdxInfo->aConstraintUsage[stopIdx].omit = !SQLITE_SERIES_CONSTRAINT_VERIFY; } if( stepIdx>=0 ){ pIdxInfo->aConstraintUsage[stepIdx].argvIndex = ++nArg; - pIdxInfo->aConstraintUsage[stepIdx].omit = SERIES_OMIT_CONSTRAINT_VERIFY; + pIdxInfo->aConstraintUsage[stepIdx].omit = !SQLITE_SERIES_CONSTRAINT_VERIFY; } if( (idxNum & 3)==3 ){ /* Both start= and stop= boundaries are available. This is the diff --git a/main.mk b/main.mk index 78cb0ad137..97dc254378 100644 --- a/main.mk +++ b/main.mk @@ -726,7 +726,8 @@ sqlite3_analyzer$(EXE): sqlite3_analyzer.c # Rules to build the 'testfixture' application. # TESTFIXTURE_FLAGS = -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 -TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE +TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE +TESTFIXTURE_FLAGS += -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \ diff --git a/manifest b/manifest index bfe67e6715..3c5171c6ed 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -C Add\sthe\soptional\s-DSERIES_OMIT_CONSTRAINT_VERIFY=0\soption\sto\sthe\sseries.c\nextension\sthat\simplements\sthe\sgenerate_series()\svirtual\stable. -D 2016-03-02T00:58:49.570 -F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 +C Allow\sthe\sleft-hand\sside\sof\sIN\soperators\son\svirtual\stables\sto\shave\sthe\naConstraintUsage[].omit\sflag\sclear. +D 2016-03-02T03:28:07.978 +F Makefile.in e335453db0b16da00c884ad51bb56d1c091a74de F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 -F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 +F Makefile.msc dbd4621ecc585c2ef0c2aa0874698c54675754f1 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION c6b1f51809551d60ad001e6d87cf3ab2c7f54b6f F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -212,7 +212,7 @@ F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342 F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63 F ext/misc/regexp.c af92cdaa5058fcec1451e49becc7ba44dba023dc F ext/misc/rot13.c 1ac6f95f99b575907b9b09c81a349114cf9be45a -F ext/misc/series.c e1ef8bc23328d4e2196835737f62b324bdcd1c0d +F ext/misc/series.c e11e534ada797d5b816d7e7a93c022306563ca35 F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52 F ext/misc/spellfix.c 525190484b7a9dbc6be646c4842274fff4f27d53 F ext/misc/totype.c 4a167594e791abeed95e0a8db028822b5e8fe512 @@ -273,7 +273,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk 31027cdd40130bdbb3a0862bb97a8c837c5987d9 +F main.mk 518d93f9f606d515628f99ce03f9e909f4f8a2e3 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 @@ -429,9 +429,9 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c 10deb6b43887662691e5f53d10b3c171c401169b F src/wal.h 2f7c831cf3b071fa548bf2d5cac640846a7ff19c F src/walker.c 0f142b5bd3ed2041fc52d773880748b212e63354 -F src/where.c 6282e53fcc612a8918262f1432d6fd7fbc24af40 +F src/where.c 56948ada5aacc3bf2628db3776986e8bf4085383 F src/whereInt.h 93297d56edd137b7ea004490690fb6e2ce028a34 -F src/wherecode.c 39c1ef4598bedf1d66249334c74efd23ddd182ac +F src/wherecode.c 3ca820435c5b597bb50e63ed11e938786fe5c23e F src/whereexpr.c fb87944b1254234e5bba671aaf6dee476241506a F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd @@ -1074,7 +1074,7 @@ F test/symlink.test c9ebe7330d228249e447038276bfc8a7b22f4849 F test/sync.test 2f607e1821aa3af3c5c53b58835c05e511c95899 F test/syscall.test f59ba4e25f7ba4a4c031026cc2ef8b6e4b4c639c F test/sysfault.test c9f2b0d8d677558f74de750c75e12a5454719d04 -F test/tabfunc01.test cc33684f9480fcf1fd5ce287ac28d22971cad1cc +F test/tabfunc01.test f977868fa8bb7beb4b2072883190411653473906 F test/table.test b708f3e5fa2542fa51dfab21fc07b36ea445cb2f F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126 F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930 @@ -1453,7 +1453,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 1d41c161165006d6c2af47e476f05fb13039f8b8 -R 7bc50a1ee335d764bdfff403c9ca0d5d +P 3d9daa929c0abe6dc01e800ef343b0eef2f0c76a +R c059a6ee769a0309e913921e43679d8c +T *branch * vtab-IN-opt +T *sym-vtab-IN-opt * +T -sym-trunk * U drh -Z d249d93e08651d834742ccb923f02a0e +Z f36b44043e8c4337262495e2c87317b9 diff --git a/manifest.uuid b/manifest.uuid index 67149f5847..a061607f33 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3d9daa929c0abe6dc01e800ef343b0eef2f0c76a \ No newline at end of file +1622623cbbfc4325c53d731aba78ca9c382ec612 \ No newline at end of file diff --git a/src/where.c b/src/where.c index e2a482cf90..ed90f61443 100644 --- a/src/where.c +++ b/src/where.c @@ -2898,13 +2898,6 @@ static int whereLoopAddVirtual( testcase( iTerm==16 ); if( iTerm<16 && pUsage[i].omit ) pNew->u.vtab.omitMask |= 1<eOperator & WO_IN)!=0 ){ - if( pUsage[i].omit==0 ){ - /* Do not attempt to use an IN constraint if the virtual table - ** says that the equivalent EQ constraint cannot be safely omitted. - ** If we do attempt to use such a constraint, some rows might be - ** repeated in the output. */ - break; - } /* A virtual table that is constrained by an IN clause may not ** consume the ORDER BY clause because (1) the order of IN terms ** is not necessarily related to the order of output terms and diff --git a/src/wherecode.c b/src/wherecode.c index accc140866..bfc52fb470 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -874,6 +874,7 @@ Bitmask sqlite3WhereCodeOneLoopStart( int iReg; /* P3 Value for OP_VFilter */ int addrNotFound; int nConstraint = pLoop->nLTerm; + int iIn; /* Counter for IN constraints */ sqlite3ExprCachePush(pParse); iReg = sqlite3GetTempRange(pParse, nConstraint+2); @@ -896,14 +897,48 @@ Bitmask sqlite3WhereCodeOneLoopStart( pLoop->u.vtab.needFree ? P4_MPRINTF : P4_STATIC); VdbeCoverage(v); pLoop->u.vtab.needFree = 0; - for(j=0; ju.vtab.omitMask>>j)&1 ){ - disableTerm(pLevel, pLoop->aLTerm[j]); - } - } pLevel->p1 = iCur; pLevel->op = pWInfo->eOnePass ? OP_Noop : OP_VNext; pLevel->p2 = sqlite3VdbeCurrentAddr(v); + iIn = pLevel->u.in.nIn; + for(j=nConstraint-1; j>=0; j--){ + pTerm = pLoop->aLTerm[j]; + if( j<16 && (pLoop->u.vtab.omitMask>>j)&1 ){ + disableTerm(pLevel, pTerm); + }else if( (pTerm->eOperator & WO_IN)!=0 ){ + Expr *pCompare; /* The comparison operator */ + Expr *pRight; /* RHS of the comparison */ + VdbeOp *pOp; /* Opcode to access the value of the IN constraint */ + + /* Reload the constraint value into reg[iReg+j+2]. The same value + ** was loaded into the same register prior to the OP_VFilter, but + ** the xFilter implementation might have changed the datatype or + ** encoding of the value in the register, so it *must* be reloaded. */ + assert( pLevel->u.in.aInLoop!=0 || db->mallocFailed ); + if( pLevel->u.in.aInLoop!=0 ){ + assert( iIn>0 ); + pOp = sqlite3VdbeGetOp(v, pLevel->u.in.aInLoop[--iIn].addrInTop); + assert( pOp->opcode==OP_Column || pOp->opcode==OP_Rowid ); + assert( pOp->opcode!=OP_Column || pOp->p3==iReg+j+2 ); + assert( pOp->opcode!=OP_Rowid || pOp->p2==iReg+j+2 ); + testcase( pOp->opcode==OP_Rowid ); + sqlite3VdbeAddOp3(v, pOp->opcode, pOp->p1, pOp->p2, pOp->p3); + } + + /* Generate code that will continue to the next row if + ** the IN constraint is not satisfied */ + pCompare = sqlite3PExpr(pParse, TK_EQ, 0, 0, 0); + assert( pCompare!=0 || db->mallocFailed ); + if( pCompare ){ + pCompare->pLeft = pTerm->pExpr->pLeft; + pCompare->pRight = pRight = sqlite3Expr(db, TK_REGISTER, 0); + if( pRight ) pRight->iTable = iReg+j+2; + sqlite3ExprIfFalse(pParse, pCompare, pLevel->addrCont, 0); + pCompare->pLeft = 0; + sqlite3ExprDelete(db, pCompare); + } + } + } sqlite3ReleaseTempRange(pParse, iReg, nConstraint+2); sqlite3ExprCachePop(pParse); }else diff --git a/test/tabfunc01.test b/test/tabfunc01.test index d85cb20ff5..879a045b8e 100644 --- a/test/tabfunc01.test +++ b/test/tabfunc01.test @@ -120,4 +120,19 @@ do_catchsql_test tabfunc01-4.3 { SELECT * FROM aux1.generate_series(1,4) } {1 {no such table: aux1.generate_series}} +# The next series of tests is verifying that virtual table are able +# to optimize the IN operator, even on terms that are not marked "omit". +# When the generate_series virtual table is compiled for the testfixture, +# the special -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 option is used, which +# causes the xBestIndex method of generate_series to leave the +# sqlite3_index_constraint_usage.omit flag set to 0, which should cause +# the SQLite core to verify the start=, stop=, and step= constraints on +# each step of output. At one point, the IN operator could not be used +# by virtual tables unless omit was set. +# +do_execsql_test tabfunc01-500 { + SELECT * FROM generate_series WHERE start IN (1,7) AND stop=20 AND step=10 + ORDER BY +1; +} {1 7 11 17} + finish_test From e18ec6acc281d1c213fdfeb0000d7c0a2509b698 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 2 Mar 2016 13:26:19 +0000 Subject: [PATCH 53/66] Fix an error in an fts5 test script. FossilOrigin-Name: b2a03e2d479aec2fc68dfc83a1fa34c740f44e13 --- ext/fts5/test/fts5_common.tcl | 2 ++ ext/fts5/test/fts5merge2.test | 2 -- manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ext/fts5/test/fts5_common.tcl b/ext/fts5/test/fts5_common.tcl index 93a8bab806..32691d1c81 100644 --- a/ext/fts5/test/fts5_common.tcl +++ b/ext/fts5/test/fts5_common.tcl @@ -21,6 +21,8 @@ ifcapable !fts5 { return -code return } return +} else { + proc return_if_no_fts5 {} {} } catch { diff --git a/ext/fts5/test/fts5merge2.test b/ext/fts5/test/fts5merge2.test index cd515cc29e..0d3fad8b08 100644 --- a/ext/fts5/test/fts5merge2.test +++ b/ext/fts5/test/fts5merge2.test @@ -27,8 +27,6 @@ proc dump_structure {} { foreach_detail_mode $testprefix { -if {[detail_is_none]==0} continue - do_execsql_test 1.0 { CREATE VIRTUAL TABLE t1 USING fts5(x, detail=%DETAIL%); INSERT INTO t1(t1, rank) VALUES('pgsz', 32); diff --git a/manifest b/manifest index 9293374902..2738351d63 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\snot\sattempt\sto\srun\sfts5bigtok.test\sor\sfts5merge2.test\sif\sFTS5\sis\snot\scompiled\sin. -D 2016-03-01T16:56:26.421 +C Fix\san\serror\sin\san\sfts5\stest\sscript. +D 2016-03-02T13:26:19.396 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 56ea123a975690bf9ed38b31bb89ff87b02a7c2b @@ -116,7 +116,7 @@ F ext/fts5/fts5_varint.c a5aceacda04dafcbae725413d7a16818ecd65738 F ext/fts5/fts5_vocab.c dba72ca393d71c2588548b51380387f6b44c77a8 F ext/fts5/fts5parse.y 59432ea369f1aa65511bad465f55d31a22f9f223 F ext/fts5/mkportersteps.tcl 5acf962d2e0074f701620bb5308155fa1e4a63ba -F ext/fts5/test/fts5_common.tcl fbbf457b1433151789a006f9f94c00780a5e3f78 +F ext/fts5/test/fts5_common.tcl b9b1fed811c0390511cef8b254826ea15d380f4d F ext/fts5/test/fts5aa.test 7e814df4a0e6c22a6fe2d84f210fdc0b5068a084 F ext/fts5/test/fts5ab.test 30325a89453280160106be411bba3acf138e6d1b F ext/fts5/test/fts5ac.test 55cad4275a1f5acabfe14d8442a8046b47e49e5f @@ -162,7 +162,7 @@ F ext/fts5/test/fts5hash.test 06f9309ccb4d5050a131594e9e47d0b21456837d F ext/fts5/test/fts5integrity.test f5e4f8d284385875068ad0f3e894ce43e9de835d F ext/fts5/test/fts5matchinfo.test 86569026d20f1ed748236587ce798de8a96615f1 F ext/fts5/test/fts5merge.test 8f3cdba2ec9c5e7e568246e81b700ad37f764367 -F ext/fts5/test/fts5merge2.test 8faa829aa3238a25a200200b54780a9bd5d97c14 +F ext/fts5/test/fts5merge2.test a6da3c16d694235938d1939f503cfa53f0943d75 F ext/fts5/test/fts5near.test b214cddb1c1f1bddf45c75af768f20145f7e71cc F ext/fts5/test/fts5onepass.test 7ed9608e258132cb8d55e7c479b08676ad68810c F ext/fts5/test/fts5optimize.test 42741e7c085ee0a1276140a752d4407d97c2c9f5 @@ -1427,7 +1427,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh ef6ebc6fd8d2dc35db3b622015c16a023d4fef4f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 3cee93716f2aece03bf9b835fb7b5294e4ddc176 -R ea05f03539d26243966fe5b0665aa396 +P f7ed373953c2dea0919a85dfb461dfef512cd5fc +R fb67c5bfcdd18aefee22c2054e345c4e U dan -Z 26014b2cea95bca862f77aab9147f990 +Z 0301af39ef437e67ac6a081e34e72ea7 diff --git a/manifest.uuid b/manifest.uuid index 670de7851f..6bb6c19871 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f7ed373953c2dea0919a85dfb461dfef512cd5fc \ No newline at end of file +b2a03e2d479aec2fc68dfc83a1fa34c740f44e13 \ No newline at end of file From 341b20fb125bcc386f8ca4c0035cb8e971021ed0 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 2 Mar 2016 15:37:50 +0000 Subject: [PATCH 54/66] Fix a recently introduced problem in permutations.test causing an error when the QUICKTEST_OMIT environment variable is defined. FossilOrigin-Name: 45bc9557722cc2a1398a53fdb2acd8b6692f3121 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/permutations.test | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 2738351d63..6154587dc0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\san\serror\sin\san\sfts5\stest\sscript. -D 2016-03-02T13:26:19.396 +C Fix\sa\srecently\sintroduced\sproblem\sin\spermutations.test\scausing\san\serror\swhen\sthe\sQUICKTEST_OMIT\senvironment\svariable\sis\sdefined. +D 2016-03-02T15:37:50.695 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 56ea123a975690bf9ed38b31bb89ff87b02a7c2b @@ -944,7 +944,7 @@ F test/parser1.test 222b5cbf3e2e659fec1bf7d723488c8b9c94f1d0 F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442 F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff -F test/permutations.test ea7d077b4644ba0ed6804666915595e9fc3b1950 +F test/permutations.test 7c9e145c9b888f719daa28a843db2c25f04f8b1d F test/pragma.test 507ac7ef2ea5682241ea0ef041799ca70bb5e0bf F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c @@ -1427,7 +1427,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh ef6ebc6fd8d2dc35db3b622015c16a023d4fef4f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f7ed373953c2dea0919a85dfb461dfef512cd5fc -R fb67c5bfcdd18aefee22c2054e345c4e +P b2a03e2d479aec2fc68dfc83a1fa34c740f44e13 +R c3f5f569c1111b59b7a7b8d3cc840098 U dan -Z 0301af39ef437e67ac6a081e34e72ea7 +Z 3f6f2fabdb87bc8705a94a5cd070d288 diff --git a/manifest.uuid b/manifest.uuid index 6bb6c19871..2e84c0697d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b2a03e2d479aec2fc68dfc83a1fa34c740f44e13 \ No newline at end of file +45bc9557722cc2a1398a53fdb2acd8b6692f3121 \ No newline at end of file diff --git a/test/permutations.test b/test/permutations.test index 5c62218d48..6d1b1d7c05 100644 --- a/test/permutations.test +++ b/test/permutations.test @@ -85,8 +85,8 @@ proc test_set {args} { # $allquicktests # set alltests [list] +foreach f [glob $testdir/*.test] { lappend alltests [file tail $f] } foreach f [glob -nocomplain \ - $testdir/*.test \ $testdir/../ext/rtree/*.test \ $testdir/../ext/fts5/test/*.test \ ] { From 9cc24c8002c9bbfe0615aee849c8043f7ac702e3 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 2 Mar 2016 16:01:41 +0000 Subject: [PATCH 55/66] Enhance test_bestindex.c so that it can be used to test plans generated by xBestIndex. FossilOrigin-Name: 3c15a9bf45cd7dae2fbd99123b8dd75ce278d6e4 --- manifest | 16 ++--- manifest.uuid | 2 +- src/test_bestindex.c | 146 +++++++++++++++++++++++++++++++++++++++---- test/bestindex1.test | 96 ++++++++++++++++++++++++++++ 4 files changed, 240 insertions(+), 20 deletions(-) diff --git a/manifest b/manifest index bfe67e6715..18c08f648b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\soptional\s-DSERIES_OMIT_CONSTRAINT_VERIFY=0\soption\sto\sthe\sseries.c\nextension\sthat\simplements\sthe\sgenerate_series()\svirtual\stable. -D 2016-03-02T00:58:49.570 +C Enhance\stest_bestindex.c\sso\sthat\sit\scan\sbe\sused\sto\stest\splans\sgenerated\sby\sxBestIndex. +D 2016-03-02T16:01:41.146 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079 @@ -371,7 +371,7 @@ F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60 F src/test_async.c 21e11293a2f72080eda70e1124e9102044531cd8 F src/test_autoext.c dea8a01a7153b9adc97bd26161e4226329546e12 F src/test_backup.c 2e6e6a081870150f20c526a2e9d0d29cda47d803 -F src/test_bestindex.c cd2eb53d7abf082665bca161e6762c4ba395f17a +F src/test_bestindex.c a711473c79e812e4082fbf045ed6c18c99c16058 F src/test_blob.c b2551a9b5573232db5f66f292307c37067937239 F src/test_btree.c 2e9978eca99a9a4bfa8cae949efb00886860a64f F src/test_config.c 0dee90328e3dedf8ba002ee94b6a7e7ea7726fe4 @@ -493,7 +493,7 @@ F test/backup_malloc.test 7162d604ec2b4683c4b3799a48657fb8b5e2d450 F test/badutf.test d5360fc31f643d37a973ab0d8b4fb85799c3169f F test/badutf2.test f5bc7f2d280670ecd79b9cf4f0f1760c607fe51f F test/bc_common.tcl 3eda41ef9cda7d5f6c205462c96228b301da4191 -F test/bestindex1.test 41c763428e403663b3e15b2acba7f07b40b22592 +F test/bestindex1.test ca4a6457c276f564d9db91e22980a9fa08e66e6b F test/between.test 34d375fb5ce1ae283ffe82b6b233e9f38e84fc6c F test/bigfile.test aa74f4e5db51c8e54a1d9de9fa65d01d1eb20b59 F test/bigfile2.test 1b489a3a39ae90c7f027b79110d6b4e1dbc71bfc @@ -1453,7 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 1d41c161165006d6c2af47e476f05fb13039f8b8 -R 7bc50a1ee335d764bdfff403c9ca0d5d -U drh -Z d249d93e08651d834742ccb923f02a0e +P 3d9daa929c0abe6dc01e800ef343b0eef2f0c76a +R 10e42f20a022f81e947260641e83d066 +U dan +Z 32cbbe1a7e810bc34e8a7796bb6fedf4 diff --git a/manifest.uuid b/manifest.uuid index 67149f5847..a4b1d5378e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3d9daa929c0abe6dc01e800ef343b0eef2f0c76a \ No newline at end of file +3c15a9bf45cd7dae2fbd99123b8dd75ce278d6e4 \ No newline at end of file diff --git a/src/test_bestindex.c b/src/test_bestindex.c index c0e67299f4..6982ce3ca9 100644 --- a/src/test_bestindex.c +++ b/src/test_bestindex.c @@ -28,8 +28,9 @@ ** CREATE VIRTUAL TABLE x1 USING tcl(tcl_command); ** ** The command [tcl_command] is invoked when the table is first created (or -** connected) and when the xBestIndex() method is invoked. When it is created -** (or connected), it is invoked as follows: +** connected), when the xBestIndex() method is invoked and when the xFilter() +** method is called. When it is created (or connected), it is invoked as +** follows: ** ** tcl_command xConnect ** @@ -67,10 +68,27 @@ ** "cost" (value of estimatedCost field) ** "rows" (value of estimatedRows field) ** "use" (index of used constraint in aConstraint[]) +** "omit" (like "use", but also sets omit flag) ** "idxnum" (value of idxNum field) ** "idxstr" (value of idxStr field) ** ** Refer to code below for further details. +** +** When SQLite calls the xFilter() method, this module invokes the following +** Tcl script: +** +** tcl_command xFilter IDXNUM IDXSTR ARGLIST +** +** IDXNUM and IDXSTR are the values of the idxNum and idxStr parameters +** passed to xFilter. ARGLIST is a Tcl list containing each of the arguments +** passed to xFilter in text form. +** +** As with xBestIndex(), the return value of the script is interpreted as a +** list of key-value pairs. There is currently only one key defined - "sql". +** The value must be the full text of an SQL statement that returns the data +** for the current scan. The leftmost column returned by the SELECT is assumed +** to contain the rowid. Other columns must follow, in order from left to +** right. */ @@ -89,11 +107,13 @@ struct tcl_vtab { sqlite3_vtab base; Tcl_Interp *interp; Tcl_Obj *pCmd; + sqlite3 *db; }; /* A tcl cursor object */ struct tcl_cursor { sqlite3_vtab_cursor base; + sqlite3_stmt *pStmt; /* Read data from here */ }; /* @@ -132,6 +152,7 @@ static int tclConnect( pTab->pCmd = Tcl_NewStringObj(zCmd, -1); pTab->interp = interp; + pTab->db = db; Tcl_IncrRefCount(pTab->pCmd); pScript = Tcl_DuplicateObj(pTab->pCmd); @@ -180,11 +201,29 @@ static int tclOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ */ static int tclClose(sqlite3_vtab_cursor *cur){ tcl_cursor *pCur = (tcl_cursor *)cur; - sqlite3_free(pCur); + if( pCur ){ + sqlite3_finalize(pCur->pStmt); + sqlite3_free(pCur); + } return SQLITE_OK; } -static int tclNext(sqlite3_vtab_cursor *cur){ +static int tclNext(sqlite3_vtab_cursor *pVtabCursor){ + tcl_cursor *pCsr = (tcl_cursor*)pVtabCursor; + tcl_vtab *pTab = (tcl_vtab*)(pVtabCursor->pVtab); + if( pCsr->pStmt ){ + tcl_vtab *pTab = (tcl_vtab*)(pVtabCursor->pVtab); + int rc = sqlite3_step(pCsr->pStmt); + if( rc!=SQLITE_ROW ){ + const char *zErr; + rc = sqlite3_finalize(pCsr->pStmt); + pCsr->pStmt = 0; + if( rc!=SQLITE_OK ){ + zErr = sqlite3_errmsg(pTab->db); + pTab->base.zErrMsg = sqlite3_mprintf("%s", zErr); + } + } + } return SQLITE_OK; } @@ -193,19 +232,104 @@ static int tclFilter( int idxNum, const char *idxStr, int argc, sqlite3_value **argv ){ + tcl_cursor *pCsr = (tcl_cursor*)pVtabCursor; + tcl_vtab *pTab = (tcl_vtab*)(pVtabCursor->pVtab); + Tcl_Interp *interp = pTab->interp; + Tcl_Obj *pScript; + Tcl_Obj *pArg; + int ii; + int rc; + + pScript = Tcl_DuplicateObj(pTab->pCmd); + Tcl_IncrRefCount(pScript); + Tcl_ListObjAppendElement(interp, pScript, Tcl_NewStringObj("xFilter", -1)); + Tcl_ListObjAppendElement(interp, pScript, Tcl_NewIntObj(idxNum)); + if( idxStr ){ + Tcl_ListObjAppendElement(interp, pScript, Tcl_NewStringObj(idxStr, -1)); + }else{ + Tcl_ListObjAppendElement(interp, pScript, Tcl_NewStringObj("", -1)); + } + + pArg = Tcl_NewObj(); + Tcl_IncrRefCount(pArg); + for(ii=0; iibase.zErrMsg = sqlite3_mprintf("%s", zErr); + }else{ + /* Analyze the scripts return value. The return value should be a tcl + ** list object with an even number of elements. The first element of each + ** pair must be one of: + ** + ** "sql" (SQL statement to return data) + */ + Tcl_Obj *pRes = Tcl_GetObjResult(interp); + Tcl_Obj **apElem = 0; + int nElem; + rc = Tcl_ListObjGetElements(interp, pRes, &nElem, &apElem); + if( rc!=TCL_OK ){ + const char *zErr = Tcl_GetStringResult(interp); + rc = SQLITE_ERROR; + pTab->base.zErrMsg = sqlite3_mprintf("%s", zErr); + }else{ + int iArgv = 1; + for(ii=0; rc==SQLITE_OK && iidb, zSql, -1, &pCsr->pStmt, 0); + if( rc!=SQLITE_OK ){ + const char *zErr = sqlite3_errmsg(pTab->db); + pTab->base.zErrMsg = sqlite3_mprintf("unexpected: %s", zErr); + } + }else{ + rc = SQLITE_ERROR; + pTab->base.zErrMsg = sqlite3_mprintf("unexpected: %s", zCmd); + } + } + } + } + + if( rc==SQLITE_OK ){ + rc = tclNext(pVtabCursor); + } + return rc; +} + +static int tclColumn( + sqlite3_vtab_cursor *pVtabCursor, + sqlite3_context *ctx, + int i +){ + tcl_cursor *pCsr = (tcl_cursor*)pVtabCursor; + sqlite3_result_value(ctx, sqlite3_column_value(pCsr->pStmt, i+1)); return SQLITE_OK; } -static int tclColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){ +static int tclRowid(sqlite3_vtab_cursor *pVtabCursor, sqlite_int64 *pRowid){ + tcl_cursor *pCsr = (tcl_cursor*)pVtabCursor; + *pRowid = sqlite3_column_int64(pCsr->pStmt, 0); return SQLITE_OK; } -static int tclRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){ - return SQLITE_OK; -} - -static int tclEof(sqlite3_vtab_cursor *cur){ - return 1; +static int tclEof(sqlite3_vtab_cursor *pVtabCursor){ + tcl_cursor *pCsr = (tcl_cursor*)pVtabCursor; + return (pCsr->pStmt==0); } static int tclBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ diff --git a/test/bestindex1.test b/test/bestindex1.test index 840219b620..87ec9cc56a 100644 --- a/test/bestindex1.test +++ b/test/bestindex1.test @@ -57,4 +57,100 @@ do_eqp_test 1.2 { 0 0 0 {EXECUTE LIST SUBQUERY 1} } +#------------------------------------------------------------------------- +# +reset_db +register_tcl_module db + +# Parameter $mode may be one of: +# +# "omit" - Implement filtering. Set the omit flag. +# "use" - Implement filtering. Use the constraint, but do not set omit. +# "use2" - Do not implement filtering. Use the constraint anyway. +# +# +proc t1_vtab {mode method args} { + switch -- $method { + xConnect { + return "CREATE TABLE t1(a, b)" + } + + xBestIndex { + set SQL_FILTER {SELECT * FROM t1x WHERE a='%1%'} + set SQL_SCAN {SELECT * FROM t1x} + + set clist [lindex $args 0] + set idx 0 + for {set idx 0} {$idx < [llength $clist]} {incr idx} { + array unset C + array set C [lindex $clist $idx] + if {$C(column)==0 && $C(op)=="eq" && $C(usable)} { + switch -- $mode { + "omit" { + return [list omit $idx rows 10 cost 10 idxstr $SQL_FILTER] + } + "use" { + return [list use $idx rows 10 cost 10 idxstr $SQL_FILTER] + } + "use2" { + return [list use $idx rows 10 cost 10 idxstr $SQL_SCAN] + } + default { + error "Bad mode - $mode" + } + } + } + } + + return [list idxstr {SELECT * FROM t1x}] + } + + xFilter { + set map [list %1% [lindex $args 2 0]] + set sql [string map $map [lindex $args 1]] + return [list sql $sql] + } + } + + return {} +} + +do_execsql_test 2.1 { + CREATE TABLE t1x(i INTEGER PRIMARY KEY, a, b); + INSERT INTO t1x VALUES(1, 'one', 1); + INSERT INTO t1x VALUES(2, 'two', 2); + INSERT INTO t1x VALUES(3, 'three', 3); + INSERT INTO t1x VALUES(4, 'four', 4); +} + +foreach {tn mode} { + 1 use 2 omit 3 use2 +} { + do_execsql_test 2.2.$mode.1 " + DROP TABLE IF EXISTS t1; + CREATE VIRTUAL TABLE t1 USING tcl(t1_vtab $mode); + " + + do_execsql_test 2.2.$mode.2 {SELECT * FROM t1} {one 1 two 2 three 3 four 4} + do_execsql_test 2.2.$mode.3 {SELECT rowid FROM t1} {1 2 3 4} + do_execsql_test 2.2.$mode.4 {SELECT rowid FROM t1 WHERE a='two'} {2} + + do_execsql_test 2.2.$mode.5 { + SELECT rowid FROM t1 WHERE a IN ('one', 'four') ORDER BY +rowid + } {1 4} + + set plan(use) {0 0 0 {SCAN TABLE t1 VIRTUAL TABLE INDEX 0:SELECT * FROM t1x}} + set plan(use2) {0 0 0 {SCAN TABLE t1 VIRTUAL TABLE INDEX 0:SELECT * FROM t1x}} + set plan(omit) { + 0 0 0 {SCAN TABLE t1 VIRTUAL TABLE INDEX 0:SELECT * FROM t1x WHERE a='%1%'} + 0 0 0 {EXECUTE LIST SUBQUERY 1} + } + + do_eqp_test 2.2.$mode.6 { + SELECT rowid FROM t1 WHERE a IN ('one', 'four') ORDER BY +rowid + } [concat $plan($mode) {0 0 0 {USE TEMP B-TREE FOR ORDER BY}}] +} + finish_test + + From b78b83a2f68cea70e50b07978d16bee912e46465 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 2 Mar 2016 17:57:53 +0000 Subject: [PATCH 56/66] Add new test script bestindex1.test to the utf16 permutation. FossilOrigin-Name: 5893e97244126c80762e55249461f21a4e81bb70 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/permutations.test | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 7914b48dc3..80c0005276 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\san\sextra\stest\sfor\sthe\schange\son\sthis\sbranch. -D 2016-03-02T16:13:53.809 +C Add\snew\stest\sscript\sbestindex1.test\sto\sthe\sutf16\spermutation. +D 2016-03-02T17:57:53.035 F Makefile.in e335453db0b16da00c884ad51bb56d1c091a74de F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc dbd4621ecc585c2ef0c2aa0874698c54675754f1 @@ -947,7 +947,7 @@ F test/parser1.test 222b5cbf3e2e659fec1bf7d723488c8b9c94f1d0 F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442 F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff -F test/permutations.test 382a43c49f49bafe6fddffe904ea33d6bb3ff33e +F test/permutations.test 7872debaba9e4513dfc7bb52ff32f5a1429985e4 F test/pragma.test 507ac7ef2ea5682241ea0ef041799ca70bb5e0bf F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c @@ -1453,7 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 1622623cbbfc4325c53d731aba78ca9c382ec612 3c15a9bf45cd7dae2fbd99123b8dd75ce278d6e4 -R bdc2b3d0e5cbd463ccc4765d0aeeef84 +P d2d28251566d2a0ec1a07fe5b8ed047136840bfd +R f53f8a06609558c5e139632a3abf7f8d U dan -Z d9e37a89daaed1ba1547f52769e0ebb4 +Z 9060a915fc132a5c0981e5ef43325748 diff --git a/manifest.uuid b/manifest.uuid index 562b522fef..2e05ec2241 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d2d28251566d2a0ec1a07fe5b8ed047136840bfd \ No newline at end of file +5893e97244126c80762e55249461f21a4e81bb70 \ No newline at end of file diff --git a/test/permutations.test b/test/permutations.test index c099889067..975021a611 100644 --- a/test/permutations.test +++ b/test/permutations.test @@ -612,6 +612,7 @@ test_suite "utf16" -description { trace.test trigger1.test trigger2.test trigger3.test trigger4.test types2.test types.test unique.test update.test vacuum.test view.test where.test + bestindex1.test } # Run some tests in exclusive locking mode. From 2396fce54ec748917837ab0b41a6d8e05079bd92 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 3 Mar 2016 15:16:15 +0000 Subject: [PATCH 57/66] Increase the default upper bound on scope to 30. FossilOrigin-Name: b1258814f6100f594210775e9e3007b5b0c65025 --- ext/misc/spellfix.c | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ext/misc/spellfix.c b/ext/misc/spellfix.c index cac1edcff8..5734d04f41 100644 --- a/ext/misc/spellfix.c +++ b/ext/misc/spellfix.c @@ -1775,7 +1775,7 @@ static void scriptCodeSqlFunc( */ /* Maximum length of a phonehash used for querying the shadow table */ -#define SPELLFIX_MX_HASH 8 +#define SPELLFIX_MX_HASH 32 /* Maximum number of hash strings to examine per query */ #define SPELLFIX_MX_RUN 1 diff --git a/manifest b/manifest index 6154587dc0..437867ecc2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\srecently\sintroduced\sproblem\sin\spermutations.test\scausing\san\serror\swhen\sthe\sQUICKTEST_OMIT\senvironment\svariable\sis\sdefined. -D 2016-03-02T15:37:50.695 +C Increase\sthe\sdefault\supper\sbound\son\sscope\sto\s30. +D 2016-03-03T15:16:15.336 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 56ea123a975690bf9ed38b31bb89ff87b02a7c2b @@ -213,7 +213,7 @@ F ext/misc/regexp.c af92cdaa5058fcec1451e49becc7ba44dba023dc F ext/misc/rot13.c 1ac6f95f99b575907b9b09c81a349114cf9be45a F ext/misc/series.c b8fb7befd85b3a9b4a10e701b30b2b79ca92b6d4 F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52 -F ext/misc/spellfix.c 525190484b7a9dbc6be646c4842274fff4f27d53 +F ext/misc/spellfix.c 194b5fc3a9a63cb6c5680d8f713800012bddca7c F ext/misc/totype.c 4a167594e791abeed95e0a8db028822b5e8fe512 F ext/misc/vfslog.c fe40fab5c077a40477f7e5eba994309ecac6cc95 F ext/misc/vtshim.c babb0dc2bf116029e3e7c9a618b8a1377045303e @@ -1427,7 +1427,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh ef6ebc6fd8d2dc35db3b622015c16a023d4fef4f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b2a03e2d479aec2fc68dfc83a1fa34c740f44e13 -R c3f5f569c1111b59b7a7b8d3cc840098 -U dan -Z 3f6f2fabdb87bc8705a94a5cd070d288 +P 45bc9557722cc2a1398a53fdb2acd8b6692f3121 +R da5680e10572eb2ee67e7f4f853b931e +U drh +Z 04cb77a072223fec31cd6c5dab87e3c4 diff --git a/manifest.uuid b/manifest.uuid index 2e84c0697d..28ed117fc7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -45bc9557722cc2a1398a53fdb2acd8b6692f3121 \ No newline at end of file +b1258814f6100f594210775e9e3007b5b0c65025 \ No newline at end of file From c5c1507612e0e5d45b8683ba406e12fe6ac9c94a Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 3 Mar 2016 16:17:53 +0000 Subject: [PATCH 58/66] Version 3.11.1 FossilOrigin-Name: f047920ce16971e573bc6ec9a48b118c9de2b3a7 --- manifest | 11 +++++++---- manifest.uuid | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/manifest b/manifest index 437867ecc2..907e6740e1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Increase\sthe\sdefault\supper\sbound\son\sscope\sto\s30. -D 2016-03-03T15:16:15.336 +C Version\s3.11.1 +D 2016-03-03T16:17:53.102 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 56ea123a975690bf9ed38b31bb89ff87b02a7c2b @@ -1427,7 +1427,10 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh ef6ebc6fd8d2dc35db3b622015c16a023d4fef4f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 45bc9557722cc2a1398a53fdb2acd8b6692f3121 +P b1258814f6100f594210775e9e3007b5b0c65025 R da5680e10572eb2ee67e7f4f853b931e +T +bgcolor * #d0c0ff +T +sym-release * +T +sym-version-3.11.1 * U drh -Z 04cb77a072223fec31cd6c5dab87e3c4 +Z ad71638129773a9e26cf148e72895b35 diff --git a/manifest.uuid b/manifest.uuid index 28ed117fc7..6b480a26b8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b1258814f6100f594210775e9e3007b5b0c65025 \ No newline at end of file +f047920ce16971e573bc6ec9a48b118c9de2b3a7 \ No newline at end of file From ff6b82663181c0ebdd4b57a0e858466c3658c78d Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 4 Mar 2016 00:13:29 +0000 Subject: [PATCH 59/66] Get in-memory subjournals working for builds without SQLITE_ENABLE_ATOMIC_WRITE. FossilOrigin-Name: b5378dcea53d4cd1744d13ddee5e50869607b771 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/memjournal.c | 3 ++- src/sqliteInt.h | 6 ++---- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index c50e674c64..9f2d2fdb74 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\sthe\slatest\supdates\sfrom\strunk. -D 2016-03-03T21:29:10.682 +C Get\sin-memory\ssubjournals\sworking\sfor\sbuilds\swithout\sSQLITE_ENABLE_ATOMIC_WRITE. +D 2016-03-04T00:13:29.040 F Makefile.in e335453db0b16da00c884ad51bb56d1c091a74de F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc dbd4621ecc585c2ef0c2aa0874698c54675754f1 @@ -321,7 +321,7 @@ F src/mem1.c 6919bcf12f221868ea066eec27e579fed95ce98b F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3 F src/mem3.c 8768ac94694f31ffaf8b4d0ea5dc08af7010a35a F src/mem5.c 9bf955937b07f8c32541c8a9991f33ce3173d944 -F src/memjournal.c fea987c5809993211da554ba109816fae7e04dae +F src/memjournal.c 56c7688565cf407c5f22f03e3be478d3a92bdc81 F src/msvc.h d9ba56c6851227ab44b3f228a35f3f5772296495 F src/mutex.c 8e45800ee78e0cd1f1f3fe8e398853307f4a085c F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85 @@ -354,7 +354,7 @@ F src/shell.c 5e0ab1e708dc294330ccd8230536e1801f60822e F src/sqlite.h.in 57d2a02b14c9ec4f7cb294153eaf62294dc5aa68 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d -F src/sqliteInt.h 57da6fd6aa35dff72eb946064ff4999eab6bc616 +F src/sqliteInt.h 8a4810fa90b17eb08acab43649b877e894ea1e98 F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9 @@ -1453,7 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 44b2dc18e200e87cf062cb8f1659727c53fa36e9 16fbf2e19c22df9441aef5c8b7f5670adc38a6b6 -R bdaefcabe5bf87c04d8b11c17326d65d +P 55c00f716dc98b188c91f3a5a010242c9497785f +R 9e3fbc3007cf6215e63dd7896623508e U drh -Z 002d922341500f2c0dc185f71a114083 +Z 727109808ff36a69d33c43dee6d82c50 diff --git a/manifest.uuid b/manifest.uuid index 5a1d0fe44a..7f1e0b5ee4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -55c00f716dc98b188c91f3a5a010242c9497785f \ No newline at end of file +b5378dcea53d4cd1744d13ddee5e50869607b771 \ No newline at end of file diff --git a/src/memjournal.c b/src/memjournal.c index eaa4d4f83a..9ecd2a9ba3 100644 --- a/src/memjournal.c +++ b/src/memjournal.c @@ -381,6 +381,7 @@ void sqlite3MemJournalOpen(sqlite3_file *pJfd){ sqlite3JournalOpen(0, 0, pJfd, 0, -1); } +#ifdef SQLITE_ENABLE_ATOMIC_WRITE /* ** If the argument p points to a MemJournal structure that is not an ** in-memory-only journal file (i.e. is one that was opened with a +ve @@ -394,6 +395,7 @@ int sqlite3JournalCreate(sqlite3_file *p){ } return rc; } +#endif /* ** The file-handle passed as the only argument is open on a journal file. @@ -411,4 +413,3 @@ int sqlite3JournalIsInMemory(sqlite3_file *p){ int sqlite3JournalSize(sqlite3_vfs *pVfs){ return pVfs->szOsFile + sizeof(MemJournal); } - diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 69cbb6c604..387bb7436b 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3998,12 +3998,10 @@ const char *sqlite3JournalModename(int); #define IN_INDEX_LOOP 0x0004 /* IN operator used as a loop */ int sqlite3FindInIndex(Parse *, Expr *, u32, int*); +int sqlite3JournalOpen(sqlite3_vfs *, const char *, sqlite3_file *, int, int); +int sqlite3JournalSize(sqlite3_vfs *); #ifdef SQLITE_ENABLE_ATOMIC_WRITE - int sqlite3JournalOpen(sqlite3_vfs *, const char *, sqlite3_file *, int, int); - int sqlite3JournalSize(sqlite3_vfs *); int sqlite3JournalCreate(sqlite3_file *); -#else - #define sqlite3JournalSize(pVfs) ((pVfs)->szOsFile) #endif int sqlite3JournalIsInMemory(sqlite3_file *p); From e32a256acd23dcde4671a662426afa8a6d3a354b Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 4 Mar 2016 02:38:00 +0000 Subject: [PATCH 60/66] Update the configure script to detect pread/pwrite and update os_unix.c to use those routines if they are available. FossilOrigin-Name: 2cffb9e50bed77d1079603f5b4a71b7559de7294 --- config.h.in | 12 ++++++++++++ configure | 2 +- configure.ac | 2 +- manifest | 19 +++++++++---------- manifest.uuid | 2 +- src/os_unix.c | 37 +++++++++++++++++++++++++++---------- 6 files changed, 51 insertions(+), 23 deletions(-) diff --git a/config.h.in b/config.h.in index 36fd60781c..f2ba7d4fc4 100644 --- a/config.h.in +++ b/config.h.in @@ -45,6 +45,18 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the pread() function. */ +#undef HAVE_PREAD + +/* Define to 1 if you have the pread64() function. */ +#undef HAVE_PREAD64 + +/* Define to 1 if you have the pwrite() function. */ +#undef HAVE_PWRITE + +/* Define to 1 if you have the pwrite64() function. */ +#undef HAVE_PWRITE64 + /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H diff --git a/configure b/configure index 09fba81eae..8363818c6f 100755 --- a/configure +++ b/configure @@ -10273,7 +10273,7 @@ done ######### # Figure out whether or not we have these functions # -for ac_func in fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime +for ac_func in fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64 do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/configure.ac b/configure.ac index 19f85dc875..08c8867f06 100644 --- a/configure.ac +++ b/configure.ac @@ -108,7 +108,7 @@ AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h malloc.h]) ######### # Figure out whether or not we have these functions # -AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime]) +AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64]) ######### # By default, we use the amalgamation (this may be changed below...) diff --git a/manifest b/manifest index 7f70989146..06e5c8c969 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Reduce\sthe\samount\sof\sheap\smemory\srequired\sto\sstore\smany\sschemas\sby\sstoring\s\nthe\scolumn\sdatatype\sappended\sto\sthe\scolumn\sname\s(with\sa\s\\000\sseparator),\s\nrather\sthan\sin\sseparate\smemory\sallocation. -D 2016-03-03T21:22:53.735 +C Update\sthe\sconfigure\sscript\sto\sdetect\spread/pwrite\sand\supdate\sos_unix.c\sto\nuse\sthose\sroutines\sif\sthey\sare\savailable. +D 2016-03-04T02:38:00.565 F Makefile.in e335453db0b16da00c884ad51bb56d1c091a74de F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc dbd4621ecc585c2ef0c2aa0874698c54675754f1 @@ -28,10 +28,10 @@ F autoconf/tea/win/makefile.vc f89d0184d0eee5f7e356ea407964dcd139939928 F autoconf/tea/win/nmakehlp.c 247538ad8e8c508f33c03ec1fbd67d3a07ef6291 F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63 F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977 -F config.h.in 42b71ad3fe21c9e88fa59e8458ca1a6bc72eb0c0 +F config.h.in 6376abec766e9a0785178b1823b5a587e9f1ccbc F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55 -F configure 0339a635cd2943a3b56000a10a11b4b2e6ed6d1b x -F configure.ac a2224b1162f79848982d3618ac1deffcd94e88ec +F configure c01a159fdf7ea0171ad01ce2937283f2c7972bde x +F configure.ac 89e4e02a83d8a1528011f8395621b8c3186b4089 F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/lemon.html c30255bea0fd87a81f082d17a72c9dffbc3f6dd9 F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710 @@ -333,7 +333,7 @@ F src/os.c ca9a104b677328ee037cfdf1a54a16fd1805e8c9 F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa -F src/os_unix.c 3a6f20736dfb8a0949cdd66553fdf59f6604be35 +F src/os_unix.c a1aaf2d8d253138e63d2a8a972693f9f624f885d F src/os_win.c f0d7aa603eb6262143d7169a222aea07c4fca91d F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/pager.c d034c69b958c01289eb8070cbf902e1a68cd7e0b @@ -1453,8 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3eb74342740cd393e03aa38cd01690ccab173b76 842b21162713bb141b845b01c136457a31af4ab0 -R 8594cd13d54710bae620a17d4ba5114b -T +closed 842b21162713bb141b845b01c136457a31af4ab0 +P 16fbf2e19c22df9441aef5c8b7f5670adc38a6b6 +R 8390ec5e0d9e5eb3999e5eee0cb5ce81 U drh -Z 4f9819dace7a151b6043885dfe386959 +Z b764ac5f33b779f6bf5d09a763220c12 diff --git a/manifest.uuid b/manifest.uuid index 82610772e0..ec9225526f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -16fbf2e19c22df9441aef5c8b7f5670adc38a6b6 \ No newline at end of file +2cffb9e50bed77d1079603f5b4a71b7559de7294 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index ea07bd99f3..9bcefb1195 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -71,6 +71,20 @@ # endif #endif +/* Use pread() and pwrite() if they are available */ +#if defined(HAVE_PREAD64) && defined(HAVE_PWRITE64) +# undef USE_PREAD +# undef USE_PWRITE +# define USE_PREAD64 1 +# define USE_PWRITE64 1 +#elif defined(HAVE_PREAD) && defined(HAVE_PWRITE) +# undef USE_PREAD +# undef USE_PWRITE +# define USE_PREAD64 1 +# define USE_PWRITE64 1 +#endif + + /* ** standard include files. */ @@ -200,6 +214,9 @@ struct unixFile { const char *zPath; /* Name of the file */ unixShm *pShm; /* Shared memory segment information */ int szChunk; /* Configured by FCNTL_CHUNK_SIZE */ +#if !defined(USE_PREAD) && !defined(USE_PREAD64) + off64_t iOfst; /* Current offset */ +#endif #if SQLITE_MAX_MMAP_SIZE>0 int nFetchOut; /* Number of outstanding xFetch refs */ sqlite3_int64 mmapSize; /* Usable size of mapping at pMapRegion */ @@ -3097,9 +3114,6 @@ static int nfsUnlock(sqlite3_file *id, int eFileLock){ static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){ int got; int prior = 0; -#if (!defined(USE_PREAD) && !defined(USE_PREAD64)) - i64 newOffset; -#endif TIMER_START; assert( cnt==(cnt&0x1ffff) ); assert( id->h>2 ); @@ -3111,13 +3125,15 @@ static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){ got = osPread64(id->h, pBuf, cnt, offset); SimulateIOError( got = -1 ); #else - newOffset = lseek(id->h, offset, SEEK_SET); - SimulateIOError( newOffset = -1 ); - if( newOffset<0 ){ - storeLastErrno((unixFile*)id, errno); - return -1; - } - got = osRead(id->h, pBuf, cnt); + if( offset!=id->iOfst ){ + id->iOfst = lseek(id->h, offset, SEEK_SET); + SimulateIOError( id->iOfst = -1 ); + if( id->iOfst<0 ){ + storeLastErrno((unixFile*)id, errno); + return -1; + } + got = osRead(id->h, pBuf, cnt); + if( got>=0 ) id->iOfst += got; #endif if( got==cnt ) break; if( got<0 ){ @@ -3223,6 +3239,7 @@ static int seekAndWriteFd( do{ rc = (int)osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR); #else do{ + if( iOff!=fd i64 iSeek = lseek(fd, iOff, SEEK_SET); SimulateIOError( iSeek = -1 ); if( iSeek<0 ){ From ddebf16f1f209dca695f813c6f87e4ad72c639ec Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 4 Mar 2016 02:59:35 +0000 Subject: [PATCH 61/66] Add the test_bestindex.c file to Makefile.in and Makefile.msc so that "make test" will work again. FossilOrigin-Name: 6ec6b6a97e62be1abe1e349b5bc04c6f5ae88968 --- Makefile.in | 1 + Makefile.msc | 1 + manifest | 15 +++++++-------- manifest.uuid | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile.in b/Makefile.in index 891329719a..93d4181e8d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -376,6 +376,7 @@ TESTSRC = \ $(TOP)/src/test_autoext.c \ $(TOP)/src/test_async.c \ $(TOP)/src/test_backup.c \ + $(TOP)/src/test_bestindex.c \ $(TOP)/src/test_blob.c \ $(TOP)/src/test_btree.c \ $(TOP)/src/test_config.c \ diff --git a/Makefile.msc b/Makefile.msc index d9af285c06..c5130beb1e 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1236,6 +1236,7 @@ TESTSRC = \ $(TOP)\src\test_autoext.c \ $(TOP)\src\test_async.c \ $(TOP)\src\test_backup.c \ + $(TOP)\src\test_bestindex.c \ $(TOP)\src\test_blob.c \ $(TOP)\src\test_btree.c \ $(TOP)\src\test_config.c \ diff --git a/manifest b/manifest index 7f70989146..d5a273c8df 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -C Reduce\sthe\samount\sof\sheap\smemory\srequired\sto\sstore\smany\sschemas\sby\sstoring\s\nthe\scolumn\sdatatype\sappended\sto\sthe\scolumn\sname\s(with\sa\s\\000\sseparator),\s\nrather\sthan\sin\sseparate\smemory\sallocation. -D 2016-03-03T21:22:53.735 -F Makefile.in e335453db0b16da00c884ad51bb56d1c091a74de +C Add\sthe\stest_bestindex.c\sfile\sto\sMakefile.in\sand\sMakefile.msc\sso\sthat\n"make\stest"\swill\swork\sagain. +D 2016-03-04T02:59:35.823 +F Makefile.in 4c3d3d1b98454bf60e8977223b26ef30777a2bf2 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 -F Makefile.msc dbd4621ecc585c2ef0c2aa0874698c54675754f1 +F Makefile.msc 0dc13352b84b257d81736076d8101a584940c409 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION c6b1f51809551d60ad001e6d87cf3ab2c7f54b6f F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -1453,8 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3eb74342740cd393e03aa38cd01690ccab173b76 842b21162713bb141b845b01c136457a31af4ab0 -R 8594cd13d54710bae620a17d4ba5114b -T +closed 842b21162713bb141b845b01c136457a31af4ab0 +P 16fbf2e19c22df9441aef5c8b7f5670adc38a6b6 +R 7c159ecc947e100f72a0b55ddd229f42 U drh -Z 4f9819dace7a151b6043885dfe386959 +Z bb6e56d7a0bd406da0bf812970d93fdb diff --git a/manifest.uuid b/manifest.uuid index 82610772e0..d8612046f6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -16fbf2e19c22df9441aef5c8b7f5670adc38a6b6 \ No newline at end of file +6ec6b6a97e62be1abe1e349b5bc04c6f5ae88968 \ No newline at end of file From a46cadc42e5cc1da7ea8a739b50a7b4c9a7d9e84 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 4 Mar 2016 03:02:06 +0000 Subject: [PATCH 62/66] Fix the build for cases when pread()/pwrite() are not available. FossilOrigin-Name: 7d67d876b70c7a4199697c5b112d809c600e140e --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/os_unix.c | 24 ++++++++++-------------- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/manifest b/manifest index 06e5c8c969..1d5201bf29 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthe\sconfigure\sscript\sto\sdetect\spread/pwrite\sand\supdate\sos_unix.c\sto\nuse\sthose\sroutines\sif\sthey\sare\savailable. -D 2016-03-04T02:38:00.565 +C Fix\sthe\sbuild\sfor\scases\swhen\spread()/pwrite()\sare\snot\savailable. +D 2016-03-04T03:02:06.930 F Makefile.in e335453db0b16da00c884ad51bb56d1c091a74de F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc dbd4621ecc585c2ef0c2aa0874698c54675754f1 @@ -333,7 +333,7 @@ F src/os.c ca9a104b677328ee037cfdf1a54a16fd1805e8c9 F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa -F src/os_unix.c a1aaf2d8d253138e63d2a8a972693f9f624f885d +F src/os_unix.c 14a28aeb3b77102a90ed645534a8d319b8ac6082 F src/os_win.c f0d7aa603eb6262143d7169a222aea07c4fca91d F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/pager.c d034c69b958c01289eb8070cbf902e1a68cd7e0b @@ -1453,7 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 16fbf2e19c22df9441aef5c8b7f5670adc38a6b6 -R 8390ec5e0d9e5eb3999e5eee0cb5ce81 +P 2cffb9e50bed77d1079603f5b4a71b7559de7294 +R 340d2ced6d6364f0299bbd36b34b2f41 U drh -Z b764ac5f33b779f6bf5d09a763220c12 +Z a704f390d3e95dbf657db754d417ef5a diff --git a/manifest.uuid b/manifest.uuid index ec9225526f..6b0c506b3d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2cffb9e50bed77d1079603f5b4a71b7559de7294 \ No newline at end of file +7d67d876b70c7a4199697c5b112d809c600e140e \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 9bcefb1195..844a1c46e1 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -84,7 +84,6 @@ # define USE_PWRITE64 1 #endif - /* ** standard include files. */ @@ -214,9 +213,6 @@ struct unixFile { const char *zPath; /* Name of the file */ unixShm *pShm; /* Shared memory segment information */ int szChunk; /* Configured by FCNTL_CHUNK_SIZE */ -#if !defined(USE_PREAD) && !defined(USE_PREAD64) - off64_t iOfst; /* Current offset */ -#endif #if SQLITE_MAX_MMAP_SIZE>0 int nFetchOut; /* Number of outstanding xFetch refs */ sqlite3_int64 mmapSize; /* Usable size of mapping at pMapRegion */ @@ -3114,6 +3110,9 @@ static int nfsUnlock(sqlite3_file *id, int eFileLock){ static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){ int got; int prior = 0; +#if (!defined(USE_PREAD) && !defined(USE_PREAD64)) + i64 newOffset; +#endif TIMER_START; assert( cnt==(cnt&0x1ffff) ); assert( id->h>2 ); @@ -3125,15 +3124,13 @@ static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){ got = osPread64(id->h, pBuf, cnt, offset); SimulateIOError( got = -1 ); #else - if( offset!=id->iOfst ){ - id->iOfst = lseek(id->h, offset, SEEK_SET); - SimulateIOError( id->iOfst = -1 ); - if( id->iOfst<0 ){ - storeLastErrno((unixFile*)id, errno); - return -1; - } - got = osRead(id->h, pBuf, cnt); - if( got>=0 ) id->iOfst += got; + newOffset = lseek(id->h, offset, SEEK_SET); + SimulateIOError( newOffset = -1 ); + if( newOffset<0 ){ + storeLastErrno((unixFile*)id, errno); + return -1; + } + got = osRead(id->h, pBuf, cnt); #endif if( got==cnt ) break; if( got<0 ){ @@ -3239,7 +3236,6 @@ static int seekAndWriteFd( do{ rc = (int)osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR); #else do{ - if( iOff!=fd i64 iSeek = lseek(fd, iOff, SEEK_SET); SimulateIOError( iSeek = -1 ); if( iSeek<0 ){ From 79a2ca394467bdddb4ac5f607b1d0c54d176bc42 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 4 Mar 2016 03:14:39 +0000 Subject: [PATCH 63/66] Further fixes to the pread()/pwrite() enabling logic. FossilOrigin-Name: 38fb54e7854ac0500a88585ff9dd7487b4b2e586 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/os_unix.c | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index 1d5201bf29..be929a8bc7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\sbuild\sfor\scases\swhen\spread()/pwrite()\sare\snot\savailable. -D 2016-03-04T03:02:06.930 +C Further\sfixes\sto\sthe\spread()/pwrite()\senabling\slogic. +D 2016-03-04T03:14:39.390 F Makefile.in e335453db0b16da00c884ad51bb56d1c091a74de F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc dbd4621ecc585c2ef0c2aa0874698c54675754f1 @@ -333,7 +333,7 @@ F src/os.c ca9a104b677328ee037cfdf1a54a16fd1805e8c9 F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa -F src/os_unix.c 14a28aeb3b77102a90ed645534a8d319b8ac6082 +F src/os_unix.c f5bac8e74aaefc4ea520e43b4540793c3b8a9e8f F src/os_win.c f0d7aa603eb6262143d7169a222aea07c4fca91d F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/pager.c d034c69b958c01289eb8070cbf902e1a68cd7e0b @@ -1453,7 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 2cffb9e50bed77d1079603f5b4a71b7559de7294 -R 340d2ced6d6364f0299bbd36b34b2f41 +P 7d67d876b70c7a4199697c5b112d809c600e140e +R ce4934ea34542df91b05d44a6acdf078 U drh -Z a704f390d3e95dbf657db754d417ef5a +Z 4e6c0c7126b5fe5706a071d24d8aba5f diff --git a/manifest.uuid b/manifest.uuid index 6b0c506b3d..0966145f3c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7d67d876b70c7a4199697c5b112d809c600e140e \ No newline at end of file +38fb54e7854ac0500a88585ff9dd7487b4b2e586 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 844a1c46e1..d6fbd80588 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -72,16 +72,16 @@ #endif /* Use pread() and pwrite() if they are available */ +#if defined(__APPLE__) +# define HAVE_PREAD 1 +# define HAVE_PWRITE 1 +#endif #if defined(HAVE_PREAD64) && defined(HAVE_PWRITE64) # undef USE_PREAD -# undef USE_PWRITE # define USE_PREAD64 1 -# define USE_PWRITE64 1 #elif defined(HAVE_PREAD) && defined(HAVE_PWRITE) -# undef USE_PREAD -# undef USE_PWRITE -# define USE_PREAD64 1 -# define USE_PWRITE64 1 +# undef USE_PREAD64 +# define USE_PREAD 1 #endif /* From 9878fefd6fcc28dbe4a40a2dfa8659c1dcce14bc Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 4 Mar 2016 03:43:10 +0000 Subject: [PATCH 64/66] Change the default page size for new database files to 4096 (from 1024). Except, when building the testfixture, preserve the legacy page size. Also fix a comment on SQLITE_MAX_ATTACHED. FossilOrigin-Name: 2e8a9ca9d3d6efddc31f01074d14acae56568c37 --- Makefile.in | 1 + Makefile.msc | 1 + main.mk | 1 + manifest | 19 +++++++++---------- manifest.uuid | 2 +- src/sqliteLimit.h | 7 ++++--- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Makefile.in b/Makefile.in index 93d4181e8d..61d4d671ce 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1052,6 +1052,7 @@ TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE TESTFIXTURE_FLAGS += -DBUILD_sqlite TESTFIXTURE_FLAGS += -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 +TESTFIXTURE_FLAGS += -DSQLITE_DEFAULT_PAGE_SIZE=1024 TESTFIXTURE_SRC0 = $(TESTSRC2) libsqlite3.la TESTFIXTURE_SRC1 = sqlite3.c diff --git a/Makefile.msc b/Makefile.msc index c5130beb1e..59ce3c2ec2 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1927,6 +1927,7 @@ TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN) TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 +TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_DEFAULT_PAGE_SIZE=1024 TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C) diff --git a/main.mk b/main.mk index 97dc254378..2ea493d111 100644 --- a/main.mk +++ b/main.mk @@ -728,6 +728,7 @@ sqlite3_analyzer$(EXE): sqlite3_analyzer.c TESTFIXTURE_FLAGS = -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE TESTFIXTURE_FLAGS += -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 +TESTFIXTURE_FLAGS += -DSQLITE_DEFAULT_PAGE_SIZE=1024 testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c $(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \ diff --git a/manifest b/manifest index 5f2a222724..6ef4154770 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -C Detect\sthe\spresence\sof\spread()/pwrite()\ssystem\scalls\son\sunix\ssystems\sand\nuse\sthem\sif\savailable. -D 2016-03-04T03:20:05.475 -F Makefile.in 4c3d3d1b98454bf60e8977223b26ef30777a2bf2 +C Change\sthe\sdefault\spage\ssize\sfor\snew\sdatabase\sfiles\sto\s4096\s(from\s1024).\nExcept,\swhen\sbuilding\sthe\stestfixture,\spreserve\sthe\slegacy\spage\ssize.\nAlso\sfix\sa\scomment\son\sSQLITE_MAX_ATTACHED. +D 2016-03-04T03:43:10.844 +F Makefile.in ead489fe5d3313b8a2a8d5f3710173a4b50dd2e0 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 -F Makefile.msc 0dc13352b84b257d81736076d8101a584940c409 +F Makefile.msc d68db8ddac21ea2576ea5b446f12cf9ebe897a03 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION c6b1f51809551d60ad001e6d87cf3ab2c7f54b6f F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -273,7 +273,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk 518d93f9f606d515628f99ce03f9e909f4f8a2e3 +F main.mk d9982cb6a42b1c9da7d61cebae973cd6b034de61 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 @@ -355,7 +355,7 @@ F src/sqlite.h.in 57d2a02b14c9ec4f7cb294153eaf62294dc5aa68 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d F src/sqliteInt.h 8aa9992cb35289ede0946f7ba8e993070e040fc4 -F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 +F src/sqliteLimit.h 7c17293db62f238ccdec1498dd855fc126fa07a9 F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9 F src/tclsqlite.c 54dca4eaf3a9cb0a4b845ef54ffa99225c30a52e @@ -1453,8 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 6ec6b6a97e62be1abe1e349b5bc04c6f5ae88968 38fb54e7854ac0500a88585ff9dd7487b4b2e586 -R 2f3feca250b12264f442f8836aa34529 -T +closed 38fb54e7854ac0500a88585ff9dd7487b4b2e586 +P 82cbf5ad2ed988a006106e188e98096a52e6779d +R 0406775a6be9491c81a210a63da6c171 U drh -Z 6deed976f37e6ab4c44908da24567cb0 +Z 4f7c554d47a12cc14f56cbfb2a874afa diff --git a/manifest.uuid b/manifest.uuid index a3b88f39bd..5cef88240a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -82cbf5ad2ed988a006106e188e98096a52e6779d \ No newline at end of file +2e8a9ca9d3d6efddc31f01074d14acae56568c37 \ No newline at end of file diff --git a/src/sqliteLimit.h b/src/sqliteLimit.h index 75cad1274b..ac06881953 100644 --- a/src/sqliteLimit.h +++ b/src/sqliteLimit.h @@ -120,8 +120,9 @@ /* ** The maximum number of attached databases. This must be between 0 -** and 62. The upper bound on 62 is because a 64-bit integer bitmap -** is used internally to track attached databases. +** and 125. The upper bound of 125 is because the attached databases are +** counted using a signed 8-bit integer which has a maximum value of 127 +** and we have to allow 2 extra counts for the "main" and "temp" databases. */ #ifndef SQLITE_MAX_ATTACHED # define SQLITE_MAX_ATTACHED 10 @@ -156,7 +157,7 @@ ** The default size of a database page. */ #ifndef SQLITE_DEFAULT_PAGE_SIZE -# define SQLITE_DEFAULT_PAGE_SIZE 1024 +# define SQLITE_DEFAULT_PAGE_SIZE 4096 #endif #if SQLITE_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE # undef SQLITE_DEFAULT_PAGE_SIZE From 94580868f5b9eea4b52710b7304a423006a44f98 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 4 Mar 2016 04:01:43 +0000 Subject: [PATCH 65/66] Change the default cache_size to -2000 (which means 2000*1024 bytes independent of page_size). FossilOrigin-Name: 2682e8e413fadbca0673f242769af17bfd291559 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/sqliteLimit.h | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 6ef4154770..d39a07ce5c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sthe\sdefault\spage\ssize\sfor\snew\sdatabase\sfiles\sto\s4096\s(from\s1024).\nExcept,\swhen\sbuilding\sthe\stestfixture,\spreserve\sthe\slegacy\spage\ssize.\nAlso\sfix\sa\scomment\son\sSQLITE_MAX_ATTACHED. -D 2016-03-04T03:43:10.844 +C Change\sthe\sdefault\scache_size\sto\s-2000\s(which\smeans\s2000*1024\sbytes\nindependent\sof\spage_size). +D 2016-03-04T04:01:43.190 F Makefile.in ead489fe5d3313b8a2a8d5f3710173a4b50dd2e0 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc d68db8ddac21ea2576ea5b446f12cf9ebe897a03 @@ -355,7 +355,7 @@ F src/sqlite.h.in 57d2a02b14c9ec4f7cb294153eaf62294dc5aa68 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d F src/sqliteInt.h 8aa9992cb35289ede0946f7ba8e993070e040fc4 -F src/sqliteLimit.h 7c17293db62f238ccdec1498dd855fc126fa07a9 +F src/sqliteLimit.h 7b28cf72cbd52f178bfc97ea266445e351f2cd24 F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9 F src/tclsqlite.c 54dca4eaf3a9cb0a4b845ef54ffa99225c30a52e @@ -1453,7 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 82cbf5ad2ed988a006106e188e98096a52e6779d -R 0406775a6be9491c81a210a63da6c171 +P 2e8a9ca9d3d6efddc31f01074d14acae56568c37 +R bce4d7ea1e35eefbc9f3bc83f2294e5c U drh -Z 4f7c554d47a12cc14f56cbfb2a874afa +Z 8be75f8161fe6fe960ec420b19540c0b diff --git a/manifest.uuid b/manifest.uuid index 5cef88240a..0d4fa9e4a9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2e8a9ca9d3d6efddc31f01074d14acae56568c37 \ No newline at end of file +2682e8e413fadbca0673f242769af17bfd291559 \ No newline at end of file diff --git a/src/sqliteLimit.h b/src/sqliteLimit.h index ac06881953..4b5ddaadec 100644 --- a/src/sqliteLimit.h +++ b/src/sqliteLimit.h @@ -102,12 +102,12 @@ ** the main database table and for temporary tables. ** ** IMPLEMENTATION-OF: R-31093-59126 The default suggested cache size -** is 2000 pages. +** is 2000*1024 bytes. ** IMPLEMENTATION-OF: R-48205-43578 The default suggested cache size can be ** altered using the SQLITE_DEFAULT_CACHE_SIZE compile-time options. */ #ifndef SQLITE_DEFAULT_CACHE_SIZE -# define SQLITE_DEFAULT_CACHE_SIZE 2000 +# define SQLITE_DEFAULT_CACHE_SIZE -2000 #endif /* From 3ac9a86415ad92af53f10964b6b522ef96c03afb Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 4 Mar 2016 14:23:10 +0000 Subject: [PATCH 66/66] Update test cases to taken deferred statement-journal opening into account. FossilOrigin-Name: 5b2fe5219ab9ad15969e3374894a75979b65cb3c --- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- test/conflict.test | 12 +++++++----- test/conflict2.test | 23 +++++++++++++---------- test/exclusive.test | 9 ++++++--- test/stmt.test | 10 ++++++---- test/tempdb.test | 2 +- 7 files changed, 44 insertions(+), 34 deletions(-) diff --git a/manifest b/manifest index 58b8efaa39..b827dc21f1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\schanges\sfrom\strunk. -D 2016-03-04T13:08:35.636 +C Update\stest\scases\sto\staken\sdeferred\sstatement-journal\sopening\sinto\saccount. +D 2016-03-04T14:23:10.937 F Makefile.in ead489fe5d3313b8a2a8d5f3710173a4b50dd2e0 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc d68db8ddac21ea2576ea5b446f12cf9ebe897a03 @@ -541,8 +541,8 @@ F test/collate9.test 3adcc799229545940df2f25308dd1ad65869145a F test/collateA.test b8218ab90d1fa5c59dcf156efabb1b2599c580d6 F test/colmeta.test 2c765ea61ee37bc43bbe6d6047f89004e6508eb1 F test/colname.test 08948a4809d22817e0e5de89c7c0a8bd90cb551b -F test/conflict.test 841bcf7cabbfca39c577eb8411ea8601843b46a8 -F test/conflict2.test a82dd3b9b41fceb5dd6ff0707c5c7ffba208d538 +F test/conflict.test 029faa2d81a0d1cafb5f88614beb663d972c01db +F test/conflict2.test bb0b94cf7196c64a3cbd815c66d3ee98c2fecd9c F test/conflict3.test dec0634c0f31dec9a4b01c63063e939f0cd21b6b F test/contrib01.test 2a1cbc0f2f48955d7d073f725765da6fbceda6b4 F test/corrupt.test 141c39ea650c1365e85a49e402fa05cb9617fb97 @@ -627,7 +627,7 @@ F test/enc4.test c8f1ce3618508fd0909945beb8b8831feef2c020 F test/eqp.test 85873fa5816c48915c82c4e74cb5c35a5b48160f F test/errmsg.test f31592a594b44ee121371d25ddd5d63497bb3401 F test/eval.test a64c9105d6ff163df7cf09d6ac29cdad5922078c -F test/exclusive.test c7ebbc756eacf544c108b15eed64d7d4e5f86b75 +F test/exclusive.test f48243eaf40e0957215501a12f510a8644d13a02 F test/exclusive2.test 32798111aae78a5deec980eee383213f189df308 F test/exec.test e949714dc127eaa5ecc7d723efec1ec27118fdd7 F test/exists.test 8f7b27b61c2fbe5822f0a1f899c715d14e416e30 @@ -1063,7 +1063,7 @@ F test/sqllimits1.test a74ee2a3740b9f9c2437c246d8fb77354862a142 F test/sqllog.test 6af6cb0b09f4e44e1917e06ce85be7670302517a F test/stat.test acc91e80517fff447ae8adcfd953cfdaa5efc0af F test/statfault.test f525a7bf633e50afd027700e9a486090684b1ac1 -F test/stmt.test 25d64e3dbf9a3ce89558667d7f39d966fe2a71b9 +F test/stmt.test 64844332db69cf1a735fcb3e11548557fc95392f F test/subquery.test d7268d193dd33d5505df965399d3a594e76ae13f F test/subquery2.test 438f8a7da1457277b22e4176510f7659b286995f F test/subselect.test d24fd8757daf97dafd2e889c73ea4c4272dcf4e4 @@ -1079,7 +1079,7 @@ F test/table.test b708f3e5fa2542fa51dfab21fc07b36ea445cb2f F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126 F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930 F test/tclsqlite.test 7fb866443c7deceed22b63948ccd6f76b52ad054 -F test/tempdb.test 19d0f66e2e3eeffd68661a11c83ba5e6ace9128c +F test/tempdb.test bd92eba8f20e16a9136e434e20b280794de3cdb6 F test/temptable.test d2c9b87a54147161bcd1822e30c1d1cd891e5b30 F test/temptrigger.test 8ec228b0db5d7ebc4ee9b458fc28cb9e7873f5e1 F test/tester.tcl 750365ff97047ded5f2d6e28df82a998f7c66ae0 @@ -1453,7 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b5378dcea53d4cd1744d13ddee5e50869607b771 2682e8e413fadbca0673f242769af17bfd291559 -R 1d5f238c78a751f41b8ce4e327b6fc98 +P a87305dfd49ee17632d0bce66ce7c2e9407b7b3e +R bcfeac6deb0b24b3190e8b427e406c58 U drh -Z 35e5851abb6d53f81aa001148a407eb0 +Z 82bd4288d2e4175a3c31e21a46f9d82d diff --git a/manifest.uuid b/manifest.uuid index 7ae252503c..5596275a80 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a87305dfd49ee17632d0bce66ce7c2e9407b7b3e \ No newline at end of file +5b2fe5219ab9ad15969e3374894a75979b65cb3c \ No newline at end of file diff --git a/test/conflict.test b/test/conflict.test index af5668ed72..a39988adb0 100644 --- a/test/conflict.test +++ b/test/conflict.test @@ -285,15 +285,17 @@ do_test conflict-6.0 { # t3 Number of temporary files for tables # t4 Number of temporary files for statement journals # -# Update: Since temporary table files are now opened lazily, and none -# of the following tests use large quantities of data, t3 is always 0. +# Update (2007-08-21): Since temporary table files are now opened lazily, +# and none of the following tests use large quantities of data, t3 is always 0. +# +# Update (2016-03-04): Subjournals now also open lazily, so t4 is also always 0. # foreach {i conf1 cmd t0 t1 t2 t3 t4} { - 1 {} UPDATE 1 {6 7 8 9} 1 0 1 + 1 {} UPDATE 1 {6 7 8 9} 1 0 0 2 REPLACE UPDATE 0 {7 6 9} 1 0 0 3 IGNORE UPDATE 0 {6 7 3 9} 1 0 0 4 FAIL UPDATE 1 {6 7 3 4} 1 0 0 - 5 ABORT UPDATE 1 {1 2 3 4} 1 0 1 + 5 ABORT UPDATE 1 {1 2 3 4} 1 0 0 6 ROLLBACK UPDATE 1 {1 2 3 4} 0 0 0 7 REPLACE {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 8 IGNORE {UPDATE OR REPLACE} 0 {7 6 9} 1 0 0 @@ -303,7 +305,7 @@ foreach {i conf1 cmd t0 t1 t2 t3 t4} { 12 {} {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 13 {} {UPDATE OR REPLACE} 0 {7 6 9} 1 0 0 14 {} {UPDATE OR FAIL} 1 {6 7 3 4} 1 0 0 - 15 {} {UPDATE OR ABORT} 1 {1 2 3 4} 1 0 1 + 15 {} {UPDATE OR ABORT} 1 {1 2 3 4} 1 0 0 16 {} {UPDATE OR ROLLBACK} 1 {1 2 3 4} 0 0 0 } { if {$t0} {set t1 {UNIQUE constraint failed: t1.a}} diff --git a/test/conflict2.test b/test/conflict2.test index 6496913849..f33e01d582 100644 --- a/test/conflict2.test +++ b/test/conflict2.test @@ -287,22 +287,25 @@ do_test conflict2-6.0 { # Update: Since temporary table files are now opened lazily, and none # of the following tests use large quantities of data, t3 is always 0. # +# Update (2016-03-04): Subjournals now only open when their size +# exceeds 64KB. +# foreach {i conf1 cmd t0 t1 t2 t3 t4} { - 1 {} UPDATE 1 {6 7 8 9} 1 0 1 - 2 REPLACE UPDATE 0 {7 6 9} 1 0 1 - 3 IGNORE UPDATE 0 {6 7 3 9} 1 0 1 - 4 FAIL UPDATE 1 {6 7 3 4} 1 0 1 - 5 ABORT UPDATE 1 {1 2 3 4} 1 0 1 - 6 ROLLBACK UPDATE 1 {1 2 3 4} 0 0 1 + 1 {} UPDATE 1 {6 7 8 9} 1 0 0 + 2 REPLACE UPDATE 0 {7 6 9} 1 0 0 + 3 IGNORE UPDATE 0 {6 7 3 9} 1 0 0 + 4 FAIL UPDATE 1 {6 7 3 4} 1 0 0 + 5 ABORT UPDATE 1 {1 2 3 4} 1 0 0 + 6 ROLLBACK UPDATE 1 {1 2 3 4} 0 0 0 7 REPLACE {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 - 8 IGNORE {UPDATE OR REPLACE} 0 {7 6 9} 1 0 1 + 8 IGNORE {UPDATE OR REPLACE} 0 {7 6 9} 1 0 0 9 FAIL {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 - 10 ABORT {UPDATE OR REPLACE} 0 {7 6 9} 1 0 1 + 10 ABORT {UPDATE OR REPLACE} 0 {7 6 9} 1 0 0 11 ROLLBACK {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 12 {} {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 - 13 {} {UPDATE OR REPLACE} 0 {7 6 9} 1 0 1 + 13 {} {UPDATE OR REPLACE} 0 {7 6 9} 1 0 0 14 {} {UPDATE OR FAIL} 1 {6 7 3 4} 1 0 0 - 15 {} {UPDATE OR ABORT} 1 {1 2 3 4} 1 0 1 + 15 {} {UPDATE OR ABORT} 1 {1 2 3 4} 1 0 0 16 {} {UPDATE OR ROLLBACK} 1 {1 2 3 4} 0 0 0 } { diff --git a/test/exclusive.test b/test/exclusive.test index c000dfefa4..c7b88cfbca 100644 --- a/test/exclusive.test +++ b/test/exclusive.test @@ -420,9 +420,10 @@ do_test exclusive-5.0 { } {} do_test exclusive-5.1 { # Three files are open: The db, journal and statement-journal. + # (2016-03-04) The statement-journal is now opened lazily set sqlite_open_file_count expr $sqlite_open_file_count-$extrafds -} [expr 3 - ($TEMP_STORE>=2)] +} [expr 2 - ($TEMP_STORE>=2)] do_test exclusive-5.2 { execsql { COMMIT; @@ -446,17 +447,19 @@ do_test exclusive-5.4 { INSERT INTO abc SELECT a+10, b+10, c+10 FROM abc; } # Three files are open: The db, journal and statement-journal. + # 2016-03-04: The statement-journal open is deferred set sqlite_open_file_count expr $sqlite_open_file_count-$extrafds -} [expr 3 - ($TEMP_STORE>=2)] +} [expr 2 - ($TEMP_STORE>=2)] do_test exclusive-5.5 { execsql { COMMIT; } # Three files are still open: The db, journal and statement-journal. + # 2016-03-04: The statement-journal open is deferred set sqlite_open_file_count expr $sqlite_open_file_count-$extrafds -} [expr 3 - ($TEMP_STORE>=2)] +} [expr 2 - ($TEMP_STORE>=2)] do_test exclusive-5.6 { execsql { PRAGMA locking_mode = normal; diff --git a/test/stmt.test b/test/stmt.test index 49a41414b7..df501f7654 100644 --- a/test/stmt.test +++ b/test/stmt.test @@ -46,7 +46,8 @@ do_test stmt-1.4 { INSERT INTO t1 SELECT a+1, b+1 FROM t1; } set sqlite_open_file_count -} {3} + # 2016-03-04: statement-journal open deferred +} {2} do_test stmt-1.5 { execsql COMMIT set sqlite_open_file_count @@ -61,7 +62,8 @@ do_test stmt-1.6.1 { do_test stmt-1.6.2 { execsql { INSERT INTO t1 SELECT a+4, b+4 FROM t1 } set sqlite_open_file_count -} {3} + # 2016-03-04: statement-journal open deferred +} {2} do_test stmt-1.7 { execsql COMMIT set sqlite_open_file_count @@ -84,7 +86,7 @@ filecount stmt-2.3 { INSERT INTO t1 SELECT 9, 9 } 2 filecount stmt-2.4 { INSERT INTO t1 SELECT 9, 9; INSERT INTO t1 SELECT 10, 10; -} 3 +} 2 do_test stmt-2.5 { execsql { CREATE INDEX i1 ON t1(b) } @@ -92,6 +94,6 @@ do_test stmt-2.5 { filecount stmt-2.6 { REPLACE INTO t1 VALUES(5, 5); REPLACE INTO t1 VALUES(5, 5); -} 3 +} 2 finish_test diff --git a/test/tempdb.test b/test/tempdb.test index ecd23d4e32..61416ec81c 100644 --- a/test/tempdb.test +++ b/test/tempdb.test @@ -76,7 +76,7 @@ do_test tempdb-2.2 { } catchsql { INSERT INTO t1 SELECT * FROM t2 } set sqlite_open_file_count -} [expr 1 + (0==$jrnl_in_memory) + (0==$subj_in_memory)] +} [expr 1 + (0==$jrnl_in_memory)] do_test tempdb-2.3 { execsql { PRAGMA temp_store = 'memory';