From de0f4e58b51ed1cdf91ba7550ff8aa20e7d819c3 Mon Sep 17 00:00:00 2001 From: Francis ANDRE Date: Tue, 23 Aug 2016 08:42:16 +0200 Subject: [PATCH 01/31] Added a new 'useenv' parameter ('env' | 'noenv'), defaulted to 'env' To be used with msbuild for specifying to use the environement variables or the %LOCALAPPDATA%\Microsoft\MSBuild\v4.0\Microsoft.Cpp.X.user.props --- buildwin.cmd | 130 ++++++++++++++++++++++++++++----------------------- 1 file changed, 71 insertions(+), 59 deletions(-) diff --git a/buildwin.cmd b/buildwin.cmd index 154b5586d..ef7b6619b 100644 --- a/buildwin.cmd +++ b/buildwin.cmd @@ -1,4 +1,5 @@ @echo off +setlocal enableextensions setlocal enabledelayedexpansion rem @@ -17,7 +18,7 @@ rem Modified by Guenter Obiltschnig. rem rem Usage: rem ------ -rem buildwin VS_VERSION [ACTION] [LINKMODE] [CONFIGURATION] [PLATFORM] [SAMPLES] [TESTS] [TOOL [VERBOSITY [LOGGER] ] ] +rem buildwin VS_VERSION [ACTION] [LINKMODE] [CONFIGURATION] [PLATFORM] [SAMPLES] [TESTS] [TOOL] [ENV] [VERBOSITY [LOGGER] ] ] rem VS_VERSION: 90|100|110|120|140 rem ACTION: build|rebuild|clean rem LINKMODE: static_mt|static_md|shared|all @@ -26,18 +27,12 @@ rem PLATFORM: Win32|x64|WinCE|WEC2013 rem SAMPLES: samples|nosamples rem TESTS: tests|notests rem TOOL: devenv|vcexpress|wdexpress|msbuild +rem ENV: env|noenv (active only with msbuild, defaulted to env) rem VERBOSITY quiet|minimal|normal|detailed|diagnostic rem LOGGER see msbuild /? rem rem VS_VERSION is required argument. Default is build all. -rem Change MYSQL_DIR to match your setup -set MYSQL_DIR=C:\PROGRA~1\MySQL\MYSQLS~1.5 -set MYSQL_INCLUDE=%MYSQL_DIR%\include -set MYSQL_LIB=%MYSQL_DIR%\lib -set INCLUDE=%INCLUDE%;%MYSQL_INCLUDE% -set LIB=%LIB%;%MYSQL_LIB% - set POCO_BASE=%CD% set PATH=%POCO_BASE%\bin64;%POCO_BASE%\bin;%PATH% @@ -45,16 +40,52 @@ rem VS_VERSION {90 | 100 | 110 | 120 | 140} if "%1"=="" goto usage set VS_VERSION=vs%1 set VS_64_BIT_ENV=VC\bin\x86_amd64\vcvarsx86_amd64.bat + shift /1 +rem ACTION [build|rebuild|clean] +set ACTION=%1 +if "%ACTION%"=="" (set ACTION=build) +if not "%ACTION%"=="build" ( +if not "%ACTION%"=="rebuild" ( +if not "%ACTION%"=="clean" goto usage)) + +shift /1 +rem LINKMODE [static_mt|static_md|shared|all] +set LINK_MODE=%1 +if "%LINK_MODE%"=="" (set LINK_MODE=all) +if not "%LINK_MODE%"=="static_mt" ( +if not "%LINK_MODE%"=="static_md" ( +if not "%LINK_MODE%"=="shared" ( +if not "%LINK_MODE%"=="all" goto usage))) + +rem CONFIGURATION [release|debug|both] +set CONFIGURATION=%2 +if "%CONFIGURATION%"=="" (set CONFIGURATION=both) +if not "%CONFIGURATION%"=="release" ( +if not "%CONFIGURATION%"=="debug" ( +if not "%CONFIGURATION%"=="both" goto usage)) rem PLATFORM [Win32|x64|WinCE|WEC2013] -set PLATFORM=%4 +set PLATFORM=%3 if "%PLATFORM%"=="" (set PLATFORM=Win32) if not "%PLATFORM%"=="Win32" ( if not "%PLATFORM%"=="x64" ( if not "%PLATFORM%"=="WinCE" ( if not "%PLATFORM%"=="WEC2013" goto usage))) +if "%PLATFORM%"=="Win32" (set PLATFORM_SUFFIX=) else ( +if "%PLATFORM%"=="x64" (set PLATFORM_SUFFIX=_x64) else ( +if "%PLATFORM%"=="WinCE" (set PLATFORM_SUFFIX=_CE) else ( +if "%PLATFORM%"=="WEC2013" (set PLATFORM_SUFFIX=_WEC2013)))) + +rem SAMPLES [samples|nosamples] +set SAMPLES=%4 +if "%SAMPLES%"=="" (set SAMPLES=samples) + +rem TESTS [tests|notests] +set TESTS=%5 +if "%TESTS%"=="" (set TESTS=notests) + if not defined VCINSTALLDIR ( if %VS_VERSION%==vs90 ( if %PLATFORM%==x64 ( @@ -104,6 +135,19 @@ if not defined VSINSTALLDIR ( goto :EOF ) +set VCPROJ_EXT=vcproj +if %VS_VERSION%==vs100 (set VCPROJ_EXT=vcxproj) +if %VS_VERSION%==vs110 (set VCPROJ_EXT=vcxproj) +if %VS_VERSION%==vs120 (set VCPROJ_EXT=vcxproj) +if %VS_VERSION%==vs140 (set VCPROJ_EXT=vcxproj) + + +rem ENV env|noenv +set USEENV=%7 +if "%USEENV%"=="" (set USEENV=env) +if not "%USEENV%"=="env" ( +if not "%USEENV%"=="noenv" goto usage) + rem VERBOSITY quiet|minimal|normal|detailed set VERBOSITY=%8 if "%VERBOSITY%"=="" (set VERBOSITY=minimal) @@ -113,17 +157,8 @@ if not "%VERBOSITY%"=="normal" ( if not "%VERBOSITY%"=="detailed" ( if not "%VERBOSITY%"=="diagnostic" goto usage)))) -rem LOGGER see msbuild /? -set LOGGER=%9 - -set VCPROJ_EXT=vcproj -if %VS_VERSION%==vs100 (set VCPROJ_EXT=vcxproj) -if %VS_VERSION%==vs110 (set VCPROJ_EXT=vcxproj) -if %VS_VERSION%==vs120 (set VCPROJ_EXT=vcxproj) -if %VS_VERSION%==vs140 (set VCPROJ_EXT=vcxproj) - -if "%7"=="" goto use_devenv -set BUILD_TOOL=%7 +if "%6"=="" goto use_devenv +set BUILD_TOOL=%6 goto use_custom :use_devenv set BUILD_TOOL=devenv @@ -132,22 +167,32 @@ if "%VS_VERSION%"=="vs110" (set BUILD_TOOL=msbuild) if "%VS_VERSION%"=="vs120" (set BUILD_TOOL=msbuild) if "%VS_VERSION%"=="vs140" (set BUILD_TOOL=msbuild) :use_custom -if not "%BUILD_TOOL%"=="msbuild" (set USEENV=/useenv) if "%BUILD_TOOL%"=="msbuild" ( set ACTIONSW=/t: set CONFIGSW=/p:Configuration= set EXTRASW=/m set USEENV=/p:UseEnv=true + if "%USEENV%"=="noenv" set USEENV=/p:UseEnv=false set BUILD_TOOL_FLAGS=/clp:NoSummary set BUILD_TOOL_FLAGS=!BUILD_TOOL_FLAGS! /nologo /v:%VERBOSITY% - if not %LOGGER%X==X ( - set BUILD_TOOL_FLAGS=!BUILD_TOOL_FLAGS! /logger:%LOGGER% - ) ) if not "%BUILD_TOOL%"=="msbuild" ( + set USEENV=/useenv set ACTIONSW=/ ) + + +rem LOGGER see msbuild /? +set LOGGER=%9 +if not "%LOGGER%"=="" ( + if "%BUILD_TOOL%"=="msbuild" ( + if not %LOGGER%X==X ( + set BUILD_TOOL_FLAGS=!BUILD_TOOL_FLAGS! /logger:%LOGGER% + ) + ) +) + if "%VS_VERSION%"=="vs100" (goto msbuildok) if "%VS_VERSION%"=="vs110" (goto msbuildok) if "%VS_VERSION%"=="vs120" (goto msbuildok) @@ -158,32 +203,6 @@ if "%BUILD_TOOL%"=="msbuild" ( ) :msbuildok -rem ACTION [build|rebuild|clean] -set ACTION=%1 -if "%ACTION%"=="" (set ACTION=build) -if not "%ACTION%"=="build" ( -if not "%ACTION%"=="rebuild" ( -if not "%ACTION%"=="clean" goto usage)) - -rem LINKMODE [static_mt|static_md|shared|all] -set LINK_MODE=%2 -if "%LINK_MODE%"=="" (set LINK_MODE=all) -if not "%LINK_MODE%"=="static_mt" ( -if not "%LINK_MODE%"=="static_md" ( -if not "%LINK_MODE%"=="shared" ( -if not "%LINK_MODE%"=="all" goto usage))) - -rem CONFIGURATION [release|debug|both] -set CONFIGURATION=%3 -if "%CONFIGURATION%"=="" (set CONFIGURATION=both) -if not "%CONFIGURATION%"=="release" ( -if not "%CONFIGURATION%"=="debug" ( -if not "%CONFIGURATION%"=="both" goto usage)) - -if "%PLATFORM%"=="Win32" (set PLATFORM_SUFFIX=) else ( -if "%PLATFORM%"=="x64" (set PLATFORM_SUFFIX=_x64) else ( -if "%PLATFORM%"=="WinCE" (set PLATFORM_SUFFIX=_CE) else ( -if "%PLATFORM%"=="WEC2013" (set PLATFORM_SUFFIX=_WEC2013)))) if "%PLATFORM%"=="WEC2013" ( if "%WEC2013_PLATFORM%"=="" ( @@ -197,14 +216,6 @@ if %VS_VERSION%==vs120 (set EXTRASW=/m /p:VisualStudioVersion=12.0) if %VS_VERSION%==vs140 (set EXTRASW=/m /p:VisualStudioVersion=14.0) ) -rem SAMPLES [samples|nosamples] -set SAMPLES=%5 -if "%SAMPLES%"=="" (set SAMPLES=samples) - -rem TESTS [tests|notests] -set TESTS=%6 -if "%TESTS%"=="" (set TESTS=notests) - set DEBUG_SHARED=0 set RELEASE_SHARED=0 @@ -569,7 +580,7 @@ exit /b 1 :usage echo Usage: echo ------ -echo buildwin VS_VERSION [ACTION] [LINKMODE] [CONFIGURATION] [PLATFORM] [SAMPLES] [TESTS] [TOOL [VERBOSITY] ] +echo buildwin VS_VERSION [ACTION] [LINKMODE] [CONFIGURATION] [PLATFORM] [SAMPLES] [TESTS] [TOOL] {ENV] [VERBOSITY] echo VS_VERSION: "90|100|110|120|140" echo ACTION: "build|rebuild|clean" echo LINKMODE: "static_mt|static_md|shared|all" @@ -578,6 +589,7 @@ echo PLATFORM: "Win32|x64|WinCE|WEC2013" echo SAMPLES: "samples|nosamples" echo TESTS: "tests|notests" echo TOOL: "devenv|vcexpress|wdexpress|msbuild" +echo ENV: "env|noenv" (active only with msbuild, defaulted to env) echo VERBOSITY: "quiet|minimal|normal|detailed|diagnostic" only for msbuild echo. echo Default is build all. From 0268de2aad9a5b90a85f3b75f5a3d514c330b3a1 Mon Sep 17 00:00:00 2001 From: Francis ANDRE Date: Tue, 23 Aug 2016 08:42:53 +0200 Subject: [PATCH 02/31] Set useenv parameters to noenv --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 37627b96a..9f65ccd18 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -388,7 +388,7 @@ build_script: $verbosity='minimal'; $process = Start-Process -PassThru -nnw -Wait -FilePath "$env:poco_base\buildwin.cmd" -RSO cout -RSE cerr ` - -EA Stop -Args "$env:vsver build $env:linkmode $env:configuration $env:platform samples tests msbuild $verbosity $logger"; + -EA Stop -Args "$env:vsver build $env:linkmode $env:configuration $env:platform samples tests msbuild env $verbosity $logger"; gc cout; gc cerr; Write-Host -ForegroundColor Yellow '>>> current directory is ' $(get-location).Path; } From 9d81f54067937e3727b30ce14e0dc5aed9c39432 Mon Sep 17 00:00:00 2001 From: CREMARENCO Cosmin Date: Wed, 24 Aug 2016 11:42:33 +0200 Subject: [PATCH 03/31] Shell expansion rules say that tilde must be replaced with HOME if it exists and only after that we can look at getpwuid --- Foundation/src/Path_UNIX.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Foundation/src/Path_UNIX.cpp b/Foundation/src/Path_UNIX.cpp index 50d7cda43..6861e0a2c 100644 --- a/Foundation/src/Path_UNIX.cpp +++ b/Foundation/src/Path_UNIX.cpp @@ -204,7 +204,19 @@ std::string PathImpl::expandImpl(const std::string& path) ++it; if (it != end && *it == '/') { - result += homeImpl(); ++it; + const char* homeEnv = getenv("HOME"); + if (homeEnv) + { + result += homeEnv; + std::string::size_type resultSize = result.size(); + if (resultSize > 0 && result[resultSize - 1] != '/') + result.append("/"); + } + else + { + result += homeImpl(); + } + ++it; } else result += '~'; } From d1727dd2ea5617f83383ea52f53fd6df79b2dc9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Thu, 25 Aug 2016 13:28:18 +0200 Subject: [PATCH 04/31] re-generated project files to include /bigobj --- Data/Data.progen | 1 + Data/Data_CE_vs90.vcproj | 12 +++--- Data/Data_WEC2013_vs110.vcxproj | 6 +++ Data/Data_WEC2013_vs110.vcxproj.filters | 18 ++++---- Data/Data_WEC2013_vs120.vcxproj | 6 +++ Data/Data_WEC2013_vs120.vcxproj.filters | 18 ++++---- Data/Data_vs100.vcxproj.filters | 18 ++++---- Data/Data_vs110.vcxproj.filters | 18 ++++---- Data/Data_vs120.vcxproj | 53 +++++++++++------------ Data/Data_vs120.vcxproj.filters | 18 ++++---- Data/Data_vs140.vcxproj | 2 +- Data/Data_vs140.vcxproj.filters | 18 ++++---- Data/Data_x64_vs100.vcxproj.filters | 18 ++++---- Data/Data_x64_vs110.vcxproj.filters | 18 ++++---- Data/Data_x64_vs120.vcxproj | 56 +++++++++++-------------- Data/Data_x64_vs120.vcxproj.filters | 18 ++++---- Data/Data_x64_vs140.vcxproj | 2 +- Data/Data_x64_vs140.vcxproj.filters | 18 ++++---- 18 files changed, 161 insertions(+), 157 deletions(-) diff --git a/Data/Data.progen b/Data/Data.progen index da7505747..a89e62a62 100644 --- a/Data/Data.progen +++ b/Data/Data.progen @@ -13,5 +13,6 @@ vc.project.compiler.defines.shared = ${vc.project.name}_EXPORTS vc.project.compiler.defines.debug_shared = ${vc.project.compiler.defines.shared} vc.project.compiler.defines.release_shared = ${vc.project.compiler.defines.shared} vc.project.compiler.additionalOptions.x64 = /bigobj +vc.project.compiler.additionalOptions.WinCE = /bigobj vc.solution.create = true vc.solution.include = testsuite\\TestSuite diff --git a/Data/Data_CE_vs90.vcproj b/Data/Data_CE_vs90.vcproj index 013c73460..53f00c6fe 100644 --- a/Data/Data_CE_vs90.vcproj +++ b/Data/Data_CE_vs90.vcproj @@ -45,7 +45,7 @@ DisableSpecificWarnings="4800;" CompileForArchitecture="2" InterworkCalls="false" - AdditionalOptions=""/> + AdditionalOptions="/bigobj"/> + AdditionalOptions="/bigobj"/> + AdditionalOptions="/bigobj"/> + AdditionalOptions="/bigobj"/> + AdditionalOptions="/bigobj"/> + AdditionalOptions="/bigobj"/> true Level3 ProgramDatabase + /bigobj %(AdditionalOptions) ..\bin\$(Platform)\PocoDatad.dll @@ -162,6 +163,7 @@ true Level3 ProgramDatabase + /bigobj %(AdditionalOptions) ..\bin\$(Platform)\PocoData.dll @@ -189,6 +191,7 @@ Level3 ProgramDatabase Default + /bigobj %(AdditionalOptions) ..\lib\$(Platform)\PocoDatamtd.lib @@ -210,6 +213,7 @@ Level3 ProgramDatabase Default + /bigobj %(AdditionalOptions) ..\lib\$(Platform)\PocoDatamt.lib @@ -230,6 +234,7 @@ Level3 ProgramDatabase Default + /bigobj %(AdditionalOptions) ..\lib\$(Platform)\PocoDatamdd.lib @@ -251,6 +256,7 @@ Level3 ProgramDatabase Default + /bigobj %(AdditionalOptions) ..\lib\$(Platform)\PocoDatamd.lib diff --git a/Data/Data_WEC2013_vs110.vcxproj.filters b/Data/Data_WEC2013_vs110.vcxproj.filters index 9d2e7d45a..b6fa9c70a 100644 --- a/Data/Data_WEC2013_vs110.vcxproj.filters +++ b/Data/Data_WEC2013_vs110.vcxproj.filters @@ -2,31 +2,31 @@ - {afbe04f4-c69d-4aa6-babe-74358ec23a11} + {f87c8a84-3196-4d2e-9935-7ea88aebaf5e} - {d1251bfb-7216-448b-9c0d-80f2903cede1} + {c8d109ee-52c7-436d-8884-8a4edb5f361d} - {1f439df2-f931-4c1f-82ae-ea11d441d15f} + {a15fefe5-7963-4ea6-bf80-10ce7e41ac2a} - {3f8e9d0d-856d-419d-89fb-16904fa29e75} + {150a698a-1d8a-4b75-b0a1-291ba83d6b0a} - {b57716e0-d030-4913-900e-bd96775f8104} + {36549b6a-0c38-49ea-ac43-f1b0cc180c09} - {8025d438-78ca-430a-8d22-78167c783e60} + {f88bffc9-470e-4edb-b840-73ffecc62d9b} - {3308a18c-dd06-4ff2-a3eb-3b6b4c951692} + {ee5fe068-558a-4390-9e3a-4118ed72bf83} - {542b344c-2aa2-48f8-be67-6fd1a163c65c} + {b68d1602-cd2a-4c43-b1d5-168adb99a762} - {bcf7a9da-332c-4e6b-81f1-37a0e116d440} + {96d0e845-3de2-4a06-91c5-ea2c469151f9} diff --git a/Data/Data_WEC2013_vs120.vcxproj b/Data/Data_WEC2013_vs120.vcxproj index df148d87b..1fe0c5043 100644 --- a/Data/Data_WEC2013_vs120.vcxproj +++ b/Data/Data_WEC2013_vs120.vcxproj @@ -136,6 +136,7 @@ true Level3 ProgramDatabase + /bigobj %(AdditionalOptions) ..\bin\$(Platform)\PocoDatad.dll @@ -162,6 +163,7 @@ true Level3 ProgramDatabase + /bigobj %(AdditionalOptions) ..\bin\$(Platform)\PocoData.dll @@ -189,6 +191,7 @@ Level3 ProgramDatabase Default + /bigobj %(AdditionalOptions) ..\lib\$(Platform)\PocoDatamtd.lib @@ -210,6 +213,7 @@ Level3 ProgramDatabase Default + /bigobj %(AdditionalOptions) ..\lib\$(Platform)\PocoDatamt.lib @@ -230,6 +234,7 @@ Level3 ProgramDatabase Default + /bigobj %(AdditionalOptions) ..\lib\$(Platform)\PocoDatamdd.lib @@ -251,6 +256,7 @@ Level3 ProgramDatabase Default + /bigobj %(AdditionalOptions) ..\lib\$(Platform)\PocoDatamd.lib diff --git a/Data/Data_WEC2013_vs120.vcxproj.filters b/Data/Data_WEC2013_vs120.vcxproj.filters index ae275887a..8893fb10d 100644 --- a/Data/Data_WEC2013_vs120.vcxproj.filters +++ b/Data/Data_WEC2013_vs120.vcxproj.filters @@ -2,31 +2,31 @@ - {354b9974-53b2-41e9-9c2e-3ac1cd8eb8d3} + {1a050aaf-729b-4e84-89e0-e0bc5f8d4808} - {5d9f9bc9-be52-4e03-ac89-2b65dc319a89} + {339f38e1-8161-4cb6-a5dc-dad2fce05e9e} - {af5514fc-85fd-4cc6-8ec1-dea22f75254b} + {cded9a4f-4bf2-492f-9eb2-8082db20d6ae} - {4322305c-46ae-47e4-8f31-dd781863da06} + {f716c8b5-eeb5-44b6-9ac1-3f237b0a61f2} - {f9f2d600-a830-4875-93b3-95ca11c98c84} + {963f7f76-883a-43be-a993-27f567ad14e1} - {e62f6698-aec4-4277-b174-a01c7787d74e} + {8719d7fe-2dae-4494-bdd6-7be980746428} - {45b79b11-4c90-47b9-a699-ea7ae733f83c} + {65f85cda-73ac-4a9e-bc3e-deb1320701cf} - {6cc994a0-ce43-4776-8e76-bf115b162172} + {e7012572-1727-4fd7-82d5-534c31eade48} - {5178771d-b672-4247-877d-9c244c4208f5} + {d5733a91-9ad0-4d82-98cd-0f51d3d18e42} diff --git a/Data/Data_vs100.vcxproj.filters b/Data/Data_vs100.vcxproj.filters index bcb962a0a..206534a7b 100644 --- a/Data/Data_vs100.vcxproj.filters +++ b/Data/Data_vs100.vcxproj.filters @@ -2,31 +2,31 @@ - {be69cd09-bdcb-445d-a786-c3281f3e2b95} + {195c7544-a2f6-4e47-a142-323671e3bab6} - {f5c6a3bb-d7c4-4b8c-a73b-0665c3fd7d95} + {2c097f27-ed40-4fd4-904d-7517c34621dd} - {549457d8-8db4-4b04-a0a7-d519a9d02022} + {98170258-7dde-4fc6-a3a7-c11d6baa524e} - {8ab4fb6b-1a8e-447d-b040-83de61742648} + {6b3a9a63-90aa-40f8-b329-b7c14345d83f} - {157043c4-81e2-4ddd-8072-34fba98fc592} + {577ed43d-b38a-4ee4-bef6-4fe55cda516d} - {108ed356-cffa-474c-a869-1fc054ed7055} + {a82a3627-f508-4efb-8627-2adbbbb72946} - {9548a9ac-16cb-476a-a421-2b1c10c5a81b} + {616e0636-200d-439d-987a-17c2aba4f3d6} - {7d225c11-32c6-4dd5-aff5-a8a77dfa9a35} + {79fae8e0-1cc5-4f8b-beaa-8a8a3f734441} - {f353e68d-4b10-4cb2-b16d-74daff8b79aa} + {1d4b636e-7ff7-4a77-9b55-13d1e819de7c} diff --git a/Data/Data_vs110.vcxproj.filters b/Data/Data_vs110.vcxproj.filters index bf80b2fd5..d73011f7d 100644 --- a/Data/Data_vs110.vcxproj.filters +++ b/Data/Data_vs110.vcxproj.filters @@ -2,31 +2,31 @@ - {13941e34-926f-4790-884e-388490d4b01d} + {9fe260ab-7757-413f-abea-17563af61b3c} - {baa01be7-9bc1-41f8-865d-a0b8d9d4754e} + {c1d6f727-ee9e-42bc-a045-fb61809246ec} - {d2bb2ec8-5b51-47ee-a1c1-9fd5787ae588} + {a8053e7a-22ba-46e1-8257-f25b20bb4709} - {655c43a6-82ba-4280-b46f-bc2634a70243} + {ef6203b2-f28a-4a3c-a798-8dc24f79d3b3} - {b9d07856-a3ab-4ba0-a427-c374dfbd1f86} + {09e7ead5-7613-47b6-8999-61311a5ff64c} - {f1ef23ca-f09d-4446-8e62-fcde07be98fa} + {8510f047-e146-46cc-aabd-3f6deb91077b} - {b5220b8e-2aca-4343-b230-ee448396856f} + {c598c05b-aca7-44ab-8d5f-c3d16b0d78c9} - {e008522f-0e91-4fbc-a41e-05cfec564b95} + {3829c3f7-34fd-4b53-88ea-6635b5ba56ae} - {849d4fbc-dd98-48ce-81f7-a0e5557e5010} + {bcc6fdf6-084a-4dad-bfe0-c8bad7756f3f} diff --git a/Data/Data_vs120.vcxproj b/Data/Data_vs120.vcxproj index 621e408a1..c79317c55 100644 --- a/Data/Data_vs120.vcxproj +++ b/Data/Data_vs120.vcxproj @@ -1,4 +1,4 @@ - + @@ -32,7 +32,7 @@ Data Win32Proj - + StaticLibrary MultiByte @@ -63,27 +63,27 @@ MultiByte v120 - - + + - + - + - + - + - + - + - + <_ProjectFileVersion>12.0.30501.0 PocoDatad @@ -125,18 +125,17 @@ .\include;..\Foundation\include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;Data_EXPORTS;%(PreprocessorDefinitions) true - false + true EnableFastChecks MultiThreadedDebugDLL true true true true - + Level3 ProgramDatabase Default - true ..\bin\PocoDatad.dll @@ -164,9 +163,9 @@ true true true - + Level3 - + Default @@ -187,19 +186,18 @@ .\include;..\Foundation\include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) true - false + true EnableFastChecks MultiThreadedDebug true true true true - + ..\lib\PocoDatamtd.pdb Level3 ProgramDatabase Default - true ..\lib\PocoDatamtd.lib @@ -220,9 +218,9 @@ true true true - + Level3 - + Default @@ -235,19 +233,18 @@ .\include;..\Foundation\include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) true - false + true EnableFastChecks MultiThreadedDebugDLL true true true true - + ..\lib\PocoDatamdd.pdb Level3 ProgramDatabase Default - true ..\lib\PocoDatamdd.lib @@ -268,10 +265,10 @@ true true true - + ..\lib\PocoDatamd.pdb Level3 - + Default @@ -368,6 +365,6 @@ - - + + diff --git a/Data/Data_vs120.vcxproj.filters b/Data/Data_vs120.vcxproj.filters index 642db3d96..8358cb4b4 100644 --- a/Data/Data_vs120.vcxproj.filters +++ b/Data/Data_vs120.vcxproj.filters @@ -2,31 +2,31 @@ - {96284adb-5513-4ea1-bda9-6d1567822723} + {17de01f2-f14f-48fe-9e73-161e4b57c5a5} - {71da1e92-4917-4c21-9731-27f533096f39} + {d1f541d9-8e3d-4284-bc74-0960ba0e9c01} - {ddf362d8-b56a-4045-9224-158eaa585af4} + {4d6d61e1-b19e-4872-8320-b658a6a9144c} - {b503747f-b110-4760-907d-9f0f5fde8e41} + {a58cf5a7-34ce-49e2-942d-8f56b1402571} - {28633c43-cd5e-4b47-8bc4-0e1d4efc63fd} + {adf6a79e-6949-45db-ad1c-c0dcb5ef5086} - {40eef1ac-a741-44b8-be26-944ccdcc9591} + {65ff7f18-a297-484e-94e8-696d66aa87e5} - {7254f23a-e098-4d53-bda4-04d2e9c03ae9} + {88bac24b-28b7-4f77-a84d-31e742021503} - {f5ad66d8-f2ff-4155-aeaa-0c47ad2649d0} + {7b5d2081-f7c9-4120-bfcf-2f1334168b9f} - {a5858e96-5d61-432d-bb65-0bb9769b2c3b} + {dfbbc564-620d-4b82-b0b2-718731ac532d} diff --git a/Data/Data_vs140.vcxproj b/Data/Data_vs140.vcxproj index fcca520e0..5287d48fd 100644 --- a/Data/Data_vs140.vcxproj +++ b/Data/Data_vs140.vcxproj @@ -85,7 +85,7 @@ - <_ProjectFileVersion>14.0.23107.0 + <_ProjectFileVersion>14.0.25420.1 PocoDatad PocoDatamdd PocoDatamtd diff --git a/Data/Data_vs140.vcxproj.filters b/Data/Data_vs140.vcxproj.filters index 13987a13f..6955f3014 100644 --- a/Data/Data_vs140.vcxproj.filters +++ b/Data/Data_vs140.vcxproj.filters @@ -2,31 +2,31 @@ - {c9a20005-1ded-42be-a359-190ef39ca747} + {f9d1e08b-dbe5-4e6f-aa50-2d1d55759e57} - {33c36126-d215-40ef-be12-f2f97f2fe103} + {4f916936-1861-4e69-988d-aabafd646070} - {431ef26e-9ce2-42fa-81ec-9d9db1329187} + {3fa3dc58-a602-44bb-9ef6-e325bc5ddb19} - {b8b99283-8810-4e67-8258-8fe6c7ccb546} + {0ce6a211-601d-4ab5-ae69-35556a1cc335} - {7cb5f78d-d3bc-4ef0-9043-cf65aed74a99} + {71c8985a-a573-40ea-9faa-050f2c9b4076} - {42ed5eaf-46d7-46ee-9b0d-3a1d91aaad9e} + {2e2bdcea-c03e-4113-9545-66227073ba9b} - {341a7c31-5f1f-4159-b87a-cb6b4d3b05a7} + {7163d8d2-820f-409c-b62a-73a7cad2c1a3} - {ffd5686d-ea8c-44e4-97fe-61eb063fb434} + {56dff3f3-ff8c-4434-b86f-ee6fe5ea1335} - {772470a2-aaa6-4a14-94c5-98a471a4b769} + {a131b91f-6d66-44ed-9fa2-abf33275d265} diff --git a/Data/Data_x64_vs100.vcxproj.filters b/Data/Data_x64_vs100.vcxproj.filters index 4ab347b89..f590bb066 100644 --- a/Data/Data_x64_vs100.vcxproj.filters +++ b/Data/Data_x64_vs100.vcxproj.filters @@ -2,31 +2,31 @@ - {67cf767e-e296-4d25-a81b-b5aa6f29f7ce} + {aae7c27e-e0b8-4ed1-8ccd-77bdbfece66d} - {5f440626-1ced-451c-9bdb-fa3e6de7db42} + {28fa46ec-5c6b-4b2c-81da-d8d39cb480da} - {cda06993-f08e-4a0d-9554-ccf479c58704} + {815b2129-0e33-4a85-a654-2c47ab400a75} - {add1dd78-0f4d-46d3-ac01-47319cace033} + {caa238cb-56d8-4fad-977c-5b5e78b09dfa} - {32bc0385-c3cd-4525-993d-d22c4486b13f} + {dda8fd23-ece8-4483-a0ba-ac3775253941} - {7cc87a93-7176-4b51-a874-0f20463589f7} + {9050df9b-c059-48bf-9461-7b952218d800} - {e9bf763a-a2c4-4e09-898c-07102909a8df} + {eed6c9f4-e742-4d9d-91b3-8f60c21ded9c} - {e87ae4ea-35d1-4620-8f2f-3480104d264b} + {27414f90-5279-496e-8f80-57eab728e10f} - {4841b0ad-623c-4314-9a63-cd5594730000} + {87340dd6-b394-42df-adff-e0729cebee9f} diff --git a/Data/Data_x64_vs110.vcxproj.filters b/Data/Data_x64_vs110.vcxproj.filters index 1d0968ed0..a84356f44 100644 --- a/Data/Data_x64_vs110.vcxproj.filters +++ b/Data/Data_x64_vs110.vcxproj.filters @@ -2,31 +2,31 @@ - {351b94c7-ddf8-4fd4-a1f0-f2fc3ef80835} + {b52ea91d-788d-45c7-9d11-e44e651017d9} - {a796da8d-189c-4fdf-9568-ba65cc01a492} + {54e95e40-5ced-4ce6-b40a-2f48cc8fb2c1} - {84de6d34-c63b-4832-8aa7-6ba626785fb9} + {33327b91-0a83-4e0b-bfee-8dc9c187b7b8} - {a447b486-38e9-41fb-8a95-e9c933e7615d} + {688c8e99-370b-4738-8ea8-7966648e90fe} - {121ec0b1-6e84-498c-b42f-b66f46848b9b} + {774a400e-5098-4463-89da-baae8e036fc6} - {658a8428-7533-40f3-a3df-3ecac65bb2b8} + {86736c5a-9aaf-4dbe-be69-7b023c184704} - {5a30c806-beb9-429b-b435-23c284e2bd9e} + {8a19035a-a0ce-47f7-beb5-7900373c83f6} - {2fd504a3-8dd8-4236-8277-f7370c99a6ab} + {f0427ef3-c39a-47ba-a655-26a54e83064e} - {ef9093b3-204f-4590-afd8-8e1f360ad64f} + {b18eaa6e-77a4-4bc0-9c3a-bf95f15f0606} diff --git a/Data/Data_x64_vs120.vcxproj b/Data/Data_x64_vs120.vcxproj index 256bf3644..75d41a25b 100644 --- a/Data/Data_x64_vs120.vcxproj +++ b/Data/Data_x64_vs120.vcxproj @@ -1,4 +1,4 @@ - + @@ -32,7 +32,7 @@ Data Win32Proj - + StaticLibrary MultiByte @@ -63,27 +63,27 @@ MultiByte v120 - - + + - + - + - + - + - + - + - + <_ProjectFileVersion>12.0.30501.0 PocoData64d @@ -125,19 +125,18 @@ .\include;..\Foundation\include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;Data_EXPORTS;%(PreprocessorDefinitions) true - false + true EnableFastChecks MultiThreadedDebugDLL true true true true - + Level3 ProgramDatabase Default /bigobj %(AdditionalOptions) - true ..\bin64\PocoData64d.dll @@ -165,12 +164,11 @@ true true true - + Level3 - + Default /bigobj %(AdditionalOptions) - true ..\bin64\PocoData64.dll @@ -190,20 +188,19 @@ .\include;..\Foundation\include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) true - false + true EnableFastChecks MultiThreadedDebug true true true true - + ..\lib64\PocoDatamtd.pdb Level3 ProgramDatabase Default /bigobj %(AdditionalOptions) - true ..\lib64\PocoDatamtd.lib @@ -224,12 +221,11 @@ true true true - + Level3 - + Default /bigobj %(AdditionalOptions) - true ..\lib64\PocoDatamt.lib @@ -241,20 +237,19 @@ .\include;..\Foundation\include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) true - false + true EnableFastChecks MultiThreadedDebugDLL true true true true - + ..\lib64\PocoDatamdd.pdb Level3 ProgramDatabase Default /bigobj %(AdditionalOptions) - true ..\lib64\PocoDatamdd.lib @@ -275,12 +270,11 @@ true true true - + Level3 - + Default /bigobj %(AdditionalOptions) - true ..\lib64\PocoDatamd.lib @@ -376,6 +370,6 @@ - - + + diff --git a/Data/Data_x64_vs120.vcxproj.filters b/Data/Data_x64_vs120.vcxproj.filters index 4e03cefab..9cf8cf269 100644 --- a/Data/Data_x64_vs120.vcxproj.filters +++ b/Data/Data_x64_vs120.vcxproj.filters @@ -2,31 +2,31 @@ - {03057cf0-0a45-4f05-b3f1-49efe69676b6} + {2adcb9d4-ca0b-45d9-9d6c-321f49efaa7b} - {3ab9e6b0-fe0f-459c-8a11-e5abab3ba5e4} + {b8485689-0235-47a1-9186-064392e2ce6f} - {f65032c5-960b-4de0-a633-4e866549ede3} + {5fbd641e-49c7-46e8-a4f3-eb9566f47366} - {4ad5318f-4fd1-40cc-8ab7-b793d43f7235} + {1fdf18f6-7baf-41f4-b99d-f32da11b2c15} - {958bdce1-8813-4dc8-9b20-f66ac7489960} + {b9641b25-aa24-4487-b0c0-9499e1bd0b89} - {5439178f-11b9-4417-bbe3-55840d9e4676} + {ed62bb74-1d19-4ac9-a961-b7170a337c4f} - {e7d1d571-4a86-4db3-8689-5c16fce4db5c} + {c05b5acd-78b5-48e1-b67c-f0ab159b815a} - {8632f9be-aff4-4f36-8d38-9a0d7ea6aa3f} + {867791b2-de44-4fce-823e-7f0ed0e35182} - {433c5e7f-11d4-415f-8640-1e2d0b75af57} + {1a31af19-6f22-4505-bc15-98703e5db8aa} diff --git a/Data/Data_x64_vs140.vcxproj b/Data/Data_x64_vs140.vcxproj index 699cd75e0..3d52f66fa 100644 --- a/Data/Data_x64_vs140.vcxproj +++ b/Data/Data_x64_vs140.vcxproj @@ -85,7 +85,7 @@ - <_ProjectFileVersion>14.0.23107.0 + <_ProjectFileVersion>14.0.25420.1 PocoData64d PocoDatamdd PocoDatamtd diff --git a/Data/Data_x64_vs140.vcxproj.filters b/Data/Data_x64_vs140.vcxproj.filters index 80ab2ad91..c288b332e 100644 --- a/Data/Data_x64_vs140.vcxproj.filters +++ b/Data/Data_x64_vs140.vcxproj.filters @@ -2,31 +2,31 @@ - {481d77ce-a8a4-4f05-8f77-6f06a8e55645} + {28f51acf-99fe-4049-b2e6-dc1ba8aa2cd4} - {45ade786-0777-42c7-b8be-d4b7c818284b} + {26710ac5-bf0d-4c12-98ff-ad3f749445e9} - {6d816a93-6f3d-45b6-996a-e3043ad35887} + {b0f5810b-abe5-4455-9800-69a886d2a75b} - {44fab889-d748-4174-8ed9-d949417225d5} + {ec8969d0-e356-4554-9d98-857c0817276b} - {a8237ad5-fd6b-43f1-9778-69e3742cb54e} + {e6f737b6-75ae-4133-a6f4-47baad8e0ff1} - {5b6e2fdb-f6b3-4e3f-9478-e6c1c1520786} + {650c5609-65a3-4276-9aac-a66f52dfb051} - {2ad0073c-bc68-492b-832b-4c751aff292e} + {581ed0aa-4507-4247-bf44-1eabc8c4b989} - {4317a37c-d531-459c-b9ce-3e237d0c573a} + {639652eb-b8ae-4e9a-bbdf-012608808d79} - {e8125eb5-7713-403b-8e01-9b2f4890dcbf} + {b3c5fa32-47a1-4bbe-b639-2746ea8ef8b9} From 6b85acab078ff20fd6bdefdf22de47df6878eb7e Mon Sep 17 00:00:00 2001 From: Guenter Obiltschnig Date: Sat, 27 Aug 2016 08:22:25 +0200 Subject: [PATCH 05/31] added Poco::SingletonHolder::reset() --- Foundation/include/Poco/SingletonHolder.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Foundation/include/Poco/SingletonHolder.h b/Foundation/include/Poco/SingletonHolder.h index d3ddf0a22..4c91a8658 100644 --- a/Foundation/include/Poco/SingletonHolder.h +++ b/Foundation/include/Poco/SingletonHolder.h @@ -59,6 +59,14 @@ public: return _pS; } + void reset() + /// Deletes the singleton object. + { + FastMutex::ScopedLock lock(_m); + delete _pS; + _pS = 0; + } + private: S* _pS; FastMutex _m; From 7150a6da00f61dafe675b29dc4d9dd3b225478f6 Mon Sep 17 00:00:00 2001 From: Guenter Obiltschnig Date: Sat, 27 Aug 2016 08:34:46 +0200 Subject: [PATCH 06/31] style fix --- Foundation/src/Path_UNIX.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Foundation/src/Path_UNIX.cpp b/Foundation/src/Path_UNIX.cpp index 6861e0a2c..0f67b59a2 100644 --- a/Foundation/src/Path_UNIX.cpp +++ b/Foundation/src/Path_UNIX.cpp @@ -204,19 +204,19 @@ std::string PathImpl::expandImpl(const std::string& path) ++it; if (it != end && *it == '/') { - const char* homeEnv = getenv("HOME"); - if (homeEnv) - { - result += homeEnv; - std::string::size_type resultSize = result.size(); - if (resultSize > 0 && result[resultSize - 1] != '/') - result.append("/"); - } - else - { - result += homeImpl(); - } - ++it; + const char* homeEnv = getenv("HOME"); + if (homeEnv) + { + result += homeEnv; + std::string::size_type resultSize = result.size(); + if (resultSize > 0 && result[resultSize - 1] != '/') + result.append("/"); + } + else + { + result += homeImpl(); + } + ++it; } else result += '~'; } From aee7583d16eb8c1c2f291a80b2c9dcdaf8a2e1da Mon Sep 17 00:00:00 2001 From: Guenter Obiltschnig Date: Sat, 27 Aug 2016 08:45:01 +0200 Subject: [PATCH 07/31] updated sqlite to 3.14.1 --- Data/SQLite/src/sqlite3.c | 5238 ++++++++++++++++++++++--------------- Data/SQLite/src/sqlite3.h | 214 +- 2 files changed, 3317 insertions(+), 2135 deletions(-) diff --git a/Data/SQLite/src/sqlite3.c b/Data/SQLite/src/sqlite3.c index e19867890..ccddfe69b 100644 --- a/Data/SQLite/src/sqlite3.c +++ b/Data/SQLite/src/sqlite3.c @@ -1,6 +1,6 @@ /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.13.0. By combining all the individual C code files into this +** version 3.14.1. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements @@ -37,8 +37,8 @@ ** Internal interface definitions for SQLite. ** */ -#ifndef _SQLITEINT_H_ -#define _SQLITEINT_H_ +#ifndef SQLITEINT_H +#define SQLITEINT_H /* Special Comments: ** @@ -67,6 +67,14 @@ ** asterisks and the comment text. */ +/* +** Make sure the Tcl calling convention macro is defined. This macro is +** only used by test code and Tcl integration code. +*/ +#ifndef SQLITE_TCLAPI +# define SQLITE_TCLAPI +#endif + /* ** Make sure that rand_s() is available on Windows systems with MSVC 2005 ** or higher. @@ -97,8 +105,8 @@ ** ** This file contains code that is specific to MSVC. */ -#ifndef _MSVC_H_ -#define _MSVC_H_ +#ifndef SQLITE_MSVC_H +#define SQLITE_MSVC_H #if defined(_MSC_VER) #pragma warning(disable : 4054) @@ -118,7 +126,7 @@ #pragma warning(disable : 4706) #endif /* defined(_MSC_VER) */ -#endif /* _MSVC_H_ */ +#endif /* SQLITE_MSVC_H */ /************** End of msvc.h ************************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ @@ -282,8 +290,8 @@ ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. */ -#ifndef _SQLITE3_H_ -#define _SQLITE3_H_ +#ifndef SQLITE3_H +#define SQLITE3_H #include /* Needed for the definition of va_list */ /* @@ -306,8 +314,17 @@ extern "C" { #ifndef SQLITE_CDECL # define SQLITE_CDECL #endif +#ifndef SQLITE_APICALL +# define SQLITE_APICALL +#endif #ifndef SQLITE_STDCALL -# define SQLITE_STDCALL +# define SQLITE_STDCALL SQLITE_APICALL +#endif +#ifndef SQLITE_CALLBACK +# define SQLITE_CALLBACK +#endif +#ifndef SQLITE_SYSAPI +# define SQLITE_SYSAPI #endif /* @@ -363,9 +380,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.13.0" -#define SQLITE_VERSION_NUMBER 3013000 -#define SQLITE_SOURCE_ID "2016-05-18 10:57:30 fc49f556e48970561d7ab6a2f24fdd7d9eb81ff2" +#define SQLITE_VERSION "3.14.1" +#define SQLITE_VERSION_NUMBER 3014001 +#define SQLITE_SOURCE_ID "2016-08-11 18:53:32 a12d8059770df4bca59e321c266410344242bf7b" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -758,6 +775,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_exec( #define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8)) #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8)) #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8)) +#define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8)) /* ** CAPI3REF: Flags For File Open Operations @@ -1287,6 +1305,16 @@ struct sqlite3_io_methods { */ typedef struct sqlite3_mutex sqlite3_mutex; +/* +** CAPI3REF: Loadable Extension Thunk +** +** A pointer to the opaque sqlite3_api_routines structure is passed as +** the third parameter to entry points of [loadable extensions]. This +** structure must be typedefed in order to work around compiler warnings +** on some platforms. +*/ +typedef struct sqlite3_api_routines sqlite3_api_routines; + /* ** CAPI3REF: OS Interface Object ** @@ -2191,7 +2219,7 @@ struct sqlite3_mem_methods { ** C-API [sqlite3_load_extension()] and the SQL function [load_extension()]. ** There should be two additional arguments. ** When the first argument to this interface is 1, then only the C-API is -** enabled and the SQL function remains disabled. If the first argment to +** enabled and the SQL function remains disabled. If the first argument to ** this interface is 0, then both the C-API and the SQL function are disabled. ** If the first argument is -1, then no changes are made to state of either the ** C-API or the SQL function. @@ -2484,7 +2512,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_complete16(const void *sql); ** A busy handler must not close the database connection ** or [prepared statement] that invoked the busy handler. */ -SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*); +SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*); /* ** CAPI3REF: Set A Busy Timeout @@ -3006,6 +3034,9 @@ SQLITE_API int SQLITE_STDCALL sqlite3_set_authorizer( ** CAPI3REF: Tracing And Profiling Functions ** METHOD: sqlite3 ** +** These routines are deprecated. Use the [sqlite3_trace_v2()] interface +** instead of the routines described here. +** ** These routines register callback functions that can be used for ** tracing and profiling the execution of SQL statements. ** @@ -3031,10 +3062,104 @@ SQLITE_API int SQLITE_STDCALL sqlite3_set_authorizer( ** sqlite3_profile() function is considered experimental and is ** subject to change in future versions of SQLite. */ -SQLITE_API void *SQLITE_STDCALL sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); -SQLITE_API SQLITE_EXPERIMENTAL void *SQLITE_STDCALL sqlite3_profile(sqlite3*, +SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_trace(sqlite3*, + void(*xTrace)(void*,const char*), void*); +SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_profile(sqlite3*, void(*xProfile)(void*,const char*,sqlite3_uint64), void*); +/* +** CAPI3REF: SQL Trace Event Codes +** KEYWORDS: SQLITE_TRACE +** +** These constants identify classes of events that can be monitored +** using the [sqlite3_trace_v2()] tracing logic. The third argument +** to [sqlite3_trace_v2()] is an OR-ed combination of one or more of +** the following constants. ^The first argument to the trace callback +** is one of the following constants. +** +** New tracing constants may be added in future releases. +** +** ^A trace callback has four arguments: xCallback(T,C,P,X). +** ^The T argument is one of the integer type codes above. +** ^The C argument is a copy of the context pointer passed in as the +** fourth argument to [sqlite3_trace_v2()]. +** The P and X arguments are pointers whose meanings depend on T. +** +**
+** [[SQLITE_TRACE_STMT]]
SQLITE_TRACE_STMT
+**
^An SQLITE_TRACE_STMT callback is invoked when a prepared statement +** first begins running and possibly at other times during the +** execution of the prepared statement, such as at the start of each +** trigger subprogram. ^The P argument is a pointer to the +** [prepared statement]. ^The X argument is a pointer to a string which +** is the unexpanded SQL text of the prepared statement or an SQL comment +** that indicates the invocation of a trigger. ^The callback can compute +** the same text that would have been returned by the legacy [sqlite3_trace()] +** interface by using the X argument when X begins with "--" and invoking +** [sqlite3_expanded_sql(P)] otherwise. +** +** [[SQLITE_TRACE_PROFILE]]
SQLITE_TRACE_PROFILE
+**
^An SQLITE_TRACE_PROFILE callback provides approximately the same +** information as is provided by the [sqlite3_profile()] callback. +** ^The P argument is a pointer to the [prepared statement] and the +** X argument points to a 64-bit integer which is the estimated of +** the number of nanosecond that the prepared statement took to run. +** ^The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes. +** +** [[SQLITE_TRACE_ROW]]
SQLITE_TRACE_ROW
+**
^An SQLITE_TRACE_ROW callback is invoked whenever a prepared +** statement generates a single row of result. +** ^The P argument is a pointer to the [prepared statement] and the +** X argument is unused. +** +** [[SQLITE_TRACE_CLOSE]]
SQLITE_TRACE_CLOSE
+**
^An SQLITE_TRACE_CLOSE callback is invoked when a database +** connection closes. +** ^The P argument is a pointer to the [database connection] object +** and the X argument is unused. +**
+*/ +#define SQLITE_TRACE_STMT 0x01 +#define SQLITE_TRACE_PROFILE 0x02 +#define SQLITE_TRACE_ROW 0x04 +#define SQLITE_TRACE_CLOSE 0x08 + +/* +** CAPI3REF: SQL Trace Hook +** METHOD: sqlite3 +** +** ^The sqlite3_trace_v2(D,M,X,P) interface registers a trace callback +** function X against [database connection] D, using property mask M +** and context pointer P. ^If the X callback is +** NULL or if the M mask is zero, then tracing is disabled. The +** M argument should be the bitwise OR-ed combination of +** zero or more [SQLITE_TRACE] constants. +** +** ^Each call to either sqlite3_trace() or sqlite3_trace_v2() overrides +** (cancels) any prior calls to sqlite3_trace() or sqlite3_trace_v2(). +** +** ^The X callback is invoked whenever any of the events identified by +** mask M occur. ^The integer return value from the callback is currently +** ignored, though this may change in future releases. Callback +** implementations should return zero to ensure future compatibility. +** +** ^A trace callback is invoked with four arguments: callback(T,C,P,X). +** ^The T argument is one of the [SQLITE_TRACE] +** constants to indicate why the callback was invoked. +** ^The C argument is a copy of the context pointer. +** The P and X arguments are pointers whose meanings depend on T. +** +** The sqlite3_trace_v2() interface is intended to replace the legacy +** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which +** are deprecated. +*/ +SQLITE_API int SQLITE_STDCALL sqlite3_trace_v2( + sqlite3*, + unsigned uMask, + int(*xCallback)(unsigned,void*,void*,void*), + void *pCtx +); + /* ** CAPI3REF: Query Progress Callbacks ** METHOD: sqlite3 @@ -3653,11 +3778,35 @@ SQLITE_API int SQLITE_STDCALL sqlite3_prepare16_v2( ** CAPI3REF: Retrieving Statement SQL ** METHOD: sqlite3_stmt ** -** ^This interface can be used to retrieve a saved copy of the original -** SQL text used to create a [prepared statement] if that statement was -** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. +** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8 +** SQL text used to create [prepared statement] P if P was +** created by either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. +** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8 +** string containing the SQL text of prepared statement P with +** [bound parameters] expanded. +** +** ^(For example, if a prepared statement is created using the SQL +** text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345 +** and parameter :xyz is unbound, then sqlite3_sql() will return +** the original string, "SELECT $abc,:xyz" but sqlite3_expanded_sql() +** will return "SELECT 2345,NULL".)^ +** +** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory +** is available to hold the result, or if the result would exceed the +** the maximum string length determined by the [SQLITE_LIMIT_LENGTH]. +** +** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of +** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time +** option causes sqlite3_expanded_sql() to always return NULL. +** +** ^The string returned by sqlite3_sql(P) is managed by SQLite and is +** automatically freed when the prepared statement is finalized. +** ^The string returned by sqlite3_expanded_sql(P), on the other hand, +** is obtained from [sqlite3_malloc()] and must be free by the application +** by passing it to [sqlite3_free()]. */ SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt); +SQLITE_API char *SQLITE_STDCALL sqlite3_expanded_sql(sqlite3_stmt *pStmt); /* ** CAPI3REF: Determine If An SQL Statement Writes The Database @@ -4815,12 +4964,13 @@ SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_context_db_handle(sqlite3_context*); ** SQLite will invoke the destructor function X with parameter P exactly ** once, when the metadata is discarded. ** SQLite is free to discard the metadata at any time, including:
    -**
  • when the corresponding function parameter changes, or -**
  • when [sqlite3_reset()] or [sqlite3_finalize()] is called for the -** SQL statement, or -**
  • when sqlite3_set_auxdata() is invoked again on the same parameter, or -**
  • during the original sqlite3_set_auxdata() call when a memory -** allocation error occurs.
)^ +**
  • ^(when the corresponding function parameter changes)^, or +**
  • ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the +** SQL statement)^, or +**
  • ^(when sqlite3_set_auxdata() is invoked again on the same +** parameter)^, or +**
  • ^(during the original sqlite3_set_auxdata() call when a memory +** allocation error occurs.)^ ** ** Note the last bullet in particular. The destructor X in ** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the @@ -5647,7 +5797,7 @@ SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_soft_heap_limit(int N); ** column exists. ^The sqlite3_table_column_metadata() interface returns ** SQLITE_ERROR and if the specified column does not exist. ** ^If the column-name parameter to sqlite3_table_column_metadata() is a -** NULL pointer, then this routine simply checks for the existance of the +** NULL pointer, then this routine simply checks for the existence of the ** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it ** does not. ** @@ -5781,8 +5931,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_load_extension( ** ** ^This interface enables or disables both the C-API ** [sqlite3_load_extension()] and the SQL function [load_extension()]. -** Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..) -** to enable or disable only the C-API. +** ^(Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..) +** to enable or disable only the C-API.)^ ** ** Security warning: It is recommended that extension loading ** be disabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method @@ -5802,7 +5952,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_enable_load_extension(sqlite3 *db, int ono ** ** ^(Even though the function prototype shows that xEntryPoint() takes ** no arguments and returns void, SQLite invokes xEntryPoint() with three -** arguments and expects and integer result as if the signature of the +** arguments and expects an integer result as if the signature of the ** entry point where as follows: ** **
    @@ -5828,7 +5978,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_enable_load_extension(sqlite3 *db, int ono
     ** See also: [sqlite3_reset_auto_extension()]
     ** and [sqlite3_cancel_auto_extension()]
     */
    -SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void (*xEntryPoint)(void));
    +SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void(*xEntryPoint)(void));
     
     /*
     ** CAPI3REF: Cancel Automatic Extension Loading
    @@ -5840,7 +5990,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void (*xEntryPoint)(void));
     ** unregistered and it returns 0 if X was not on the list of initialization
     ** routines.
     */
    -SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void (*xEntryPoint)(void));
    +SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
     
     /*
     ** CAPI3REF: Reset Automatic Extension Loading
    @@ -7016,6 +7166,18 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_status(sqlite3*, int op, int *pCur, int
     ** memory used by all pager caches associated with the database connection.)^
     ** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
     **
    +** [[SQLITE_DBSTATUS_CACHE_USED_SHARED]] 
    +** ^(
    SQLITE_DBSTATUS_CACHE_USED_SHARED
    +**
    This parameter is similar to DBSTATUS_CACHE_USED, except that if a +** pager cache is shared between two or more connections the bytes of heap +** memory used by that pager cache is divided evenly between the attached +** connections.)^ In other words, if none of the pager caches associated +** with the database connection are shared, this request returns the same +** value as DBSTATUS_CACHE_USED. Or, if one or more or the pager caches are +** shared, the value returned by this call will be smaller than that returned +** by DBSTATUS_CACHE_USED. ^The highwater mark associated with +** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0. +** ** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(
    SQLITE_DBSTATUS_SCHEMA_USED
    **
    This parameter returns the approximate number of bytes of heap ** memory used to store the schema for all databases associated @@ -7073,7 +7235,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_status(sqlite3*, int op, int *pCur, int #define SQLITE_DBSTATUS_CACHE_MISS 8 #define SQLITE_DBSTATUS_CACHE_WRITE 9 #define SQLITE_DBSTATUS_DEFERRED_FKS 10 -#define SQLITE_DBSTATUS_MAX 10 /* Largest defined DBSTATUS */ +#define SQLITE_DBSTATUS_CACHE_USED_SHARED 11 +#define SQLITE_DBSTATUS_MAX 11 /* Largest defined DBSTATUS */ /* @@ -8229,7 +8392,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3*); ** ^The second parameter to the preupdate callback is a pointer to ** the [database connection] that registered the preupdate hook. ** ^The third parameter to the preupdate callback is one of the constants -** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to indentify the +** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to identify the ** kind of update operation that is about to occur. ** ^(The fourth parameter to the preupdate callback is the name of the ** database within the database connection that is being modified. This @@ -8456,7 +8619,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_cmp( #if 0 } /* End of the 'extern "C"' block */ #endif -#endif /* _SQLITE3_H_ */ +#endif /* SQLITE3_H */ /******** Begin file sqlite3rtree.h *********/ /* @@ -10176,7 +10339,7 @@ struct Fts5ExtensionApi { ** behaviour. The structure methods are expected to function as follows: ** ** xCreate: -** This function is used to allocate and inititalize a tokenizer instance. +** This function is used to allocate and initialize a tokenizer instance. ** A tokenizer instance is required to actually tokenize text. ** ** The first argument passed to this function is a copy of the (void*) @@ -10436,7 +10599,6 @@ struct fts5_api { #endif /* _FTS5_H */ - /******** End of fts5.h *********/ /************** End of sqlite3.h *********************************************/ @@ -10734,7 +10896,7 @@ struct fts5_api { ** the SQLITE_DISABLE_INTRINSIC define. */ #if !defined(SQLITE_DISABLE_INTRINSIC) -# if defined(_MSC_VER) && _MSC_VER>=1300 +# if defined(_MSC_VER) && _MSC_VER>=1400 # if !defined(_WIN32_WCE) # include # pragma intrinsic(_byteswap_ushort) @@ -11011,8 +11173,8 @@ SQLITE_PRIVATE void sqlite3Coverage(int); ** This is the header file for the generic hash-table implementation ** used in SQLite. */ -#ifndef _SQLITE_HASH_H_ -#define _SQLITE_HASH_H_ +#ifndef SQLITE_HASH_H +#define SQLITE_HASH_H /* Forward declarations of structures. */ typedef struct Hash Hash; @@ -11092,7 +11254,7 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*); */ /* #define sqliteHashCount(H) ((H)->count) // NOT USED */ -#endif /* _SQLITE_HASH_H_ */ +#endif /* SQLITE_HASH_H */ /************** End of hash.h ************************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ @@ -11840,8 +12002,8 @@ typedef struct With With; ** subsystem. See comments in the source code for a detailed description ** of what each interface routine does. */ -#ifndef _BTREE_H_ -#define _BTREE_H_ +#ifndef SQLITE_BTREE_H +#define SQLITE_BTREE_H /* TODO: This definition is just included so other modules compile. It ** needs to be revisited. @@ -11866,6 +12028,7 @@ typedef struct With With; typedef struct Btree Btree; typedef struct BtCursor BtCursor; typedef struct BtShared BtShared; +typedef struct BtreePayload BtreePayload; SQLITE_PRIVATE int sqlite3BtreeOpen( @@ -12077,19 +12240,43 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor*, u8 flags); #define BTREE_SAVEPOSITION 0x02 /* Leave cursor pointing at NEXT or PREV */ #define BTREE_AUXDELETE 0x04 /* not the primary delete operation */ -SQLITE_PRIVATE int sqlite3BtreeInsert(BtCursor*, const void *pKey, i64 nKey, - const void *pData, int nData, - int nZero, int bias, int seekResult); +/* An instance of the BtreePayload object describes the content of a single +** entry in either an index or table btree. +** +** Index btrees (used for indexes and also WITHOUT ROWID tables) contain +** an arbitrary key and no data. These btrees have pKey,nKey set to their +** key and pData,nData,nZero set to zero. +** +** Table btrees (used for rowid tables) contain an integer rowid used as +** the key and passed in the nKey field. The pKey field is zero. +** pData,nData hold the content of the new entry. nZero extra zero bytes +** are appended to the end of the content when constructing the entry. +** +** This object is used to pass information into sqlite3BtreeInsert(). The +** same information used to be passed as five separate parameters. But placing +** the information into this object helps to keep the interface more +** organized and understandable, and it also helps the resulting code to +** run a little faster by using fewer registers for parameter passing. +*/ +struct BtreePayload { + const void *pKey; /* Key content for indexes. NULL for tables */ + sqlite3_int64 nKey; /* Size of pKey for indexes. PRIMARY KEY for tabs */ + const void *pData; /* Data for tables. NULL for indexes */ + int nData; /* Size of pData. 0 if none. */ + int nZero; /* Extra zero data appended after pData,nData */ +}; + +SQLITE_PRIVATE int sqlite3BtreeInsert(BtCursor*, const BtreePayload *pPayload, + int bias, int seekResult); SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor*, int *pRes); SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor*, int *pRes); SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor*, int *pRes); SQLITE_PRIVATE int sqlite3BtreeEof(BtCursor*); SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor*, int *pRes); -SQLITE_PRIVATE int sqlite3BtreeKeySize(BtCursor*, i64 *pSize); +SQLITE_PRIVATE i64 sqlite3BtreeIntegerKey(BtCursor*); SQLITE_PRIVATE int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*); -SQLITE_PRIVATE const void *sqlite3BtreeKeyFetch(BtCursor*, u32 *pAmt); -SQLITE_PRIVATE const void *sqlite3BtreeDataFetch(BtCursor*, u32 *pAmt); -SQLITE_PRIVATE int sqlite3BtreeDataSize(BtCursor*, u32 *pSize); +SQLITE_PRIVATE const void *sqlite3BtreePayloadFetch(BtCursor*, u32 *pAmt); +SQLITE_PRIVATE u32 sqlite3BtreePayloadSize(BtCursor*); SQLITE_PRIVATE int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*); SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*); @@ -12130,11 +12317,13 @@ SQLITE_PRIVATE void sqlite3BtreeEnter(Btree*); SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3*); SQLITE_PRIVATE int sqlite3BtreeSharable(Btree*); SQLITE_PRIVATE void sqlite3BtreeEnterCursor(BtCursor*); +SQLITE_PRIVATE int sqlite3BtreeConnectionCount(Btree*); #else # define sqlite3BtreeEnter(X) # define sqlite3BtreeEnterAll(X) # define sqlite3BtreeSharable(X) 0 # define sqlite3BtreeEnterCursor(X) +# define sqlite3BtreeConnectionCount(X) 1 #endif #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE @@ -12159,7 +12348,7 @@ SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3*,int,Schema*); #endif -#endif /* _BTREE_H_ */ +#endif /* SQLITE_BTREE_H */ /************** End of btree.h ***********************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ @@ -12182,8 +12371,8 @@ SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3*,int,Schema*); ** or VDBE. The VDBE implements an abstract machine that runs a ** simple program to access and modify the underlying database. */ -#ifndef _SQLITE_VDBE_H_ -#define _SQLITE_VDBE_H_ +#ifndef SQLITE_VDBE_H +#define SQLITE_VDBE_H /* #include */ /* @@ -12368,8 +12557,8 @@ typedef struct VdbeOpList VdbeOpList; #define OP_NoConflict 29 /* synopsis: key=r[P3@P4] */ #define OP_NotFound 30 /* synopsis: key=r[P3@P4] */ #define OP_Found 31 /* synopsis: key=r[P3@P4] */ -#define OP_NotExists 32 /* synopsis: intkey=r[P3] */ -#define OP_Last 33 +#define OP_SeekRowid 32 /* synopsis: intkey=r[P3] */ +#define OP_NotExists 33 /* synopsis: intkey=r[P3] */ #define OP_IsNull 34 /* same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */ #define OP_NotNull 35 /* same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */ #define OP_Ne 36 /* same as TK_NE, synopsis: if r[P1]!=r[P3] goto P2 */ @@ -12378,7 +12567,7 @@ typedef struct VdbeOpList VdbeOpList; #define OP_Le 39 /* same as TK_LE, synopsis: if r[P1]<=r[P3] goto P2 */ #define OP_Lt 40 /* same as TK_LT, synopsis: if r[P1]=r[P3] goto P2 */ -#define OP_SorterSort 42 +#define OP_Last 42 #define OP_BitAnd 43 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */ #define OP_BitOr 44 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */ #define OP_ShiftLeft 45 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<0 then r[P1]-=P3, goto P2 */ -#define OP_IfNotZero 65 /* synopsis: if r[P1]!=0 then r[P1]-=P3, goto P2 */ -#define OP_DecrJumpZero 66 /* synopsis: if (--r[P1])==0 goto P2 */ -#define OP_IncrVacuum 67 -#define OP_VNext 68 -#define OP_Init 69 /* synopsis: Start at P2 */ -#define OP_Return 70 -#define OP_EndCoroutine 71 -#define OP_HaltIfNull 72 /* synopsis: if r[P3]=null halt */ -#define OP_Halt 73 -#define OP_Integer 74 /* synopsis: r[P2]=P1 */ -#define OP_Int64 75 /* synopsis: r[P2]=P4 */ -#define OP_String 76 /* synopsis: r[P2]='P4' (len=P1) */ -#define OP_Null 77 /* synopsis: r[P2..P3]=NULL */ -#define OP_SoftNull 78 /* synopsis: r[P1]=NULL */ -#define OP_Blob 79 /* synopsis: r[P2]=P4 (len=P1) */ -#define OP_Variable 80 /* synopsis: r[P2]=parameter(P1,P4) */ -#define OP_Move 81 /* synopsis: r[P2@P3]=r[P1@P3] */ -#define OP_Copy 82 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ -#define OP_SCopy 83 /* synopsis: r[P2]=r[P1] */ -#define OP_IntCopy 84 /* synopsis: r[P2]=r[P1] */ -#define OP_ResultRow 85 /* synopsis: output=r[P1@P2] */ -#define OP_CollSeq 86 -#define OP_Function0 87 /* synopsis: r[P3]=func(r[P2@P5]) */ -#define OP_Function 88 /* synopsis: r[P3]=func(r[P2@P5]) */ -#define OP_AddImm 89 /* synopsis: r[P1]=r[P1]+P2 */ -#define OP_RealAffinity 90 -#define OP_Cast 91 /* synopsis: affinity(r[P1]) */ -#define OP_Permutation 92 -#define OP_Compare 93 /* synopsis: r[P1@P3] <-> r[P2@P3] */ -#define OP_Column 94 /* synopsis: r[P3]=PX */ -#define OP_Affinity 95 /* synopsis: affinity(r[P1@P2]) */ -#define OP_MakeRecord 96 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ +#define OP_Sort 55 +#define OP_Rewind 56 +#define OP_IdxLE 57 /* synopsis: key=r[P3@P4] */ +#define OP_IdxGT 58 /* synopsis: key=r[P3@P4] */ +#define OP_IdxLT 59 /* synopsis: key=r[P3@P4] */ +#define OP_IdxGE 60 /* synopsis: key=r[P3@P4] */ +#define OP_RowSetRead 61 /* synopsis: r[P3]=rowset(P1) */ +#define OP_RowSetTest 62 /* synopsis: if r[P3] in rowset(P1) goto P2 */ +#define OP_Program 63 +#define OP_FkIfZero 64 /* synopsis: if fkctr[P1]==0 goto P2 */ +#define OP_IfPos 65 /* synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */ +#define OP_IfNotZero 66 /* synopsis: if r[P1]!=0 then r[P1]-=P3, goto P2 */ +#define OP_DecrJumpZero 67 /* synopsis: if (--r[P1])==0 goto P2 */ +#define OP_IncrVacuum 68 +#define OP_VNext 69 +#define OP_Init 70 /* synopsis: Start at P2 */ +#define OP_Return 71 +#define OP_EndCoroutine 72 +#define OP_HaltIfNull 73 /* synopsis: if r[P3]=null halt */ +#define OP_Halt 74 +#define OP_Integer 75 /* synopsis: r[P2]=P1 */ +#define OP_Int64 76 /* synopsis: r[P2]=P4 */ +#define OP_String 77 /* synopsis: r[P2]='P4' (len=P1) */ +#define OP_Null 78 /* synopsis: r[P2..P3]=NULL */ +#define OP_SoftNull 79 /* synopsis: r[P1]=NULL */ +#define OP_Blob 80 /* synopsis: r[P2]=P4 (len=P1) */ +#define OP_Variable 81 /* synopsis: r[P2]=parameter(P1,P4) */ +#define OP_Move 82 /* synopsis: r[P2@P3]=r[P1@P3] */ +#define OP_Copy 83 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ +#define OP_SCopy 84 /* synopsis: r[P2]=r[P1] */ +#define OP_IntCopy 85 /* synopsis: r[P2]=r[P1] */ +#define OP_ResultRow 86 /* synopsis: output=r[P1@P2] */ +#define OP_CollSeq 87 +#define OP_Function0 88 /* synopsis: r[P3]=func(r[P2@P5]) */ +#define OP_Function 89 /* synopsis: r[P3]=func(r[P2@P5]) */ +#define OP_AddImm 90 /* synopsis: r[P1]=r[P1]+P2 */ +#define OP_RealAffinity 91 +#define OP_Cast 92 /* synopsis: affinity(r[P1]) */ +#define OP_Permutation 93 +#define OP_Compare 94 /* synopsis: r[P1@P3] <-> r[P2@P3] */ +#define OP_Column 95 /* synopsis: r[P3]=PX */ +#define OP_Affinity 96 /* synopsis: affinity(r[P1@P2]) */ #define OP_String8 97 /* same as TK_STRING, synopsis: r[P2]='P4' */ -#define OP_Count 98 /* synopsis: r[P2]=count() */ -#define OP_ReadCookie 99 -#define OP_SetCookie 100 -#define OP_ReopenIdx 101 /* synopsis: root=P2 iDb=P3 */ -#define OP_OpenRead 102 /* synopsis: root=P2 iDb=P3 */ -#define OP_OpenWrite 103 /* synopsis: root=P2 iDb=P3 */ -#define OP_OpenAutoindex 104 /* synopsis: nColumn=P2 */ -#define OP_OpenEphemeral 105 /* synopsis: nColumn=P2 */ -#define OP_SorterOpen 106 -#define OP_SequenceTest 107 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ -#define OP_OpenPseudo 108 /* synopsis: P3 columns in r[P2] */ -#define OP_Close 109 -#define OP_ColumnsUsed 110 -#define OP_Sequence 111 /* synopsis: r[P2]=cursor[P1].ctr++ */ -#define OP_NewRowid 112 /* synopsis: r[P2]=rowid */ -#define OP_Insert 113 /* synopsis: intkey=r[P3] data=r[P2] */ -#define OP_InsertInt 114 /* synopsis: intkey=P3 data=r[P2] */ -#define OP_Delete 115 -#define OP_ResetCount 116 -#define OP_SorterCompare 117 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ -#define OP_SorterData 118 /* synopsis: r[P2]=data */ -#define OP_RowKey 119 /* synopsis: r[P2]=key */ -#define OP_RowData 120 /* synopsis: r[P2]=data */ -#define OP_Rowid 121 /* synopsis: r[P2]=rowid */ -#define OP_NullRow 122 -#define OP_SorterInsert 123 -#define OP_IdxInsert 124 /* synopsis: key=r[P2] */ -#define OP_IdxDelete 125 /* synopsis: key=r[P2@P3] */ -#define OP_Seek 126 /* synopsis: Move P3 to P1.rowid */ -#define OP_IdxRowid 127 /* synopsis: r[P2]=rowid */ -#define OP_Destroy 128 -#define OP_Clear 129 -#define OP_ResetSorter 130 -#define OP_CreateIndex 131 /* synopsis: r[P2]=root iDb=P1 */ -#define OP_CreateTable 132 /* synopsis: r[P2]=root iDb=P1 */ +#define OP_MakeRecord 98 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ +#define OP_Count 99 /* synopsis: r[P2]=count() */ +#define OP_ReadCookie 100 +#define OP_SetCookie 101 +#define OP_ReopenIdx 102 /* synopsis: root=P2 iDb=P3 */ +#define OP_OpenRead 103 /* synopsis: root=P2 iDb=P3 */ +#define OP_OpenWrite 104 /* synopsis: root=P2 iDb=P3 */ +#define OP_OpenAutoindex 105 /* synopsis: nColumn=P2 */ +#define OP_OpenEphemeral 106 /* synopsis: nColumn=P2 */ +#define OP_SorterOpen 107 +#define OP_SequenceTest 108 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ +#define OP_OpenPseudo 109 /* synopsis: P3 columns in r[P2] */ +#define OP_Close 110 +#define OP_ColumnsUsed 111 +#define OP_Sequence 112 /* synopsis: r[P2]=cursor[P1].ctr++ */ +#define OP_NewRowid 113 /* synopsis: r[P2]=rowid */ +#define OP_Insert 114 /* synopsis: intkey=r[P3] data=r[P2] */ +#define OP_InsertInt 115 /* synopsis: intkey=P3 data=r[P2] */ +#define OP_Delete 116 +#define OP_ResetCount 117 +#define OP_SorterCompare 118 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ +#define OP_SorterData 119 /* synopsis: r[P2]=data */ +#define OP_RowKey 120 /* synopsis: r[P2]=key */ +#define OP_RowData 121 /* synopsis: r[P2]=data */ +#define OP_Rowid 122 /* synopsis: r[P2]=rowid */ +#define OP_NullRow 123 +#define OP_SorterInsert 124 +#define OP_IdxInsert 125 /* synopsis: key=r[P2] */ +#define OP_IdxDelete 126 /* synopsis: key=r[P2@P3] */ +#define OP_Seek 127 /* synopsis: Move P3 to P1.rowid */ +#define OP_IdxRowid 128 /* synopsis: r[P2]=rowid */ +#define OP_Destroy 129 +#define OP_Clear 130 +#define OP_ResetSorter 131 +#define OP_CreateIndex 132 /* synopsis: r[P2]=root iDb=P1 */ #define OP_Real 133 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ -#define OP_ParseSchema 134 -#define OP_LoadAnalysis 135 -#define OP_DropTable 136 -#define OP_DropIndex 137 -#define OP_DropTrigger 138 -#define OP_IntegrityCk 139 -#define OP_RowSetAdd 140 /* synopsis: rowset(P1)=r[P2] */ -#define OP_Param 141 -#define OP_FkCounter 142 /* synopsis: fkctr[P1]+=P2 */ -#define OP_MemMax 143 /* synopsis: r[P1]=max(r[P1],r[P2]) */ -#define OP_OffsetLimit 144 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ -#define OP_AggStep0 145 /* synopsis: accum=r[P3] step(r[P2@P5]) */ -#define OP_AggStep 146 /* synopsis: accum=r[P3] step(r[P2@P5]) */ -#define OP_AggFinal 147 /* synopsis: accum=r[P1] N=P2 */ -#define OP_Expire 148 -#define OP_TableLock 149 /* synopsis: iDb=P1 root=P2 write=P3 */ -#define OP_VBegin 150 -#define OP_VCreate 151 -#define OP_VDestroy 152 -#define OP_VOpen 153 -#define OP_VColumn 154 /* synopsis: r[P3]=vcolumn(P2) */ -#define OP_VRename 155 -#define OP_Pagecount 156 -#define OP_MaxPgcnt 157 -#define OP_CursorHint 158 -#define OP_Noop 159 -#define OP_Explain 160 +#define OP_CreateTable 134 /* synopsis: r[P2]=root iDb=P1 */ +#define OP_ParseSchema 135 +#define OP_LoadAnalysis 136 +#define OP_DropTable 137 +#define OP_DropIndex 138 +#define OP_DropTrigger 139 +#define OP_IntegrityCk 140 +#define OP_RowSetAdd 141 /* synopsis: rowset(P1)=r[P2] */ +#define OP_Param 142 +#define OP_FkCounter 143 /* synopsis: fkctr[P1]+=P2 */ +#define OP_MemMax 144 /* synopsis: r[P1]=max(r[P1],r[P2]) */ +#define OP_OffsetLimit 145 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ +#define OP_AggStep0 146 /* synopsis: accum=r[P3] step(r[P2@P5]) */ +#define OP_AggStep 147 /* synopsis: accum=r[P3] step(r[P2@P5]) */ +#define OP_AggFinal 148 /* synopsis: accum=r[P1] N=P2 */ +#define OP_Expire 149 +#define OP_TableLock 150 /* synopsis: iDb=P1 root=P2 write=P3 */ +#define OP_VBegin 151 +#define OP_VCreate 152 +#define OP_VDestroy 153 +#define OP_VOpen 154 +#define OP_VColumn 155 /* synopsis: r[P3]=vcolumn(P2) */ +#define OP_VRename 156 +#define OP_Pagecount 157 +#define OP_MaxPgcnt 158 +#define OP_CursorHint 159 +#define OP_Noop 160 +#define OP_Explain 161 /* Properties such as "out2" or "jump" that are specified in ** comments following the "case" for each opcode in the vdbe.c @@ -12513,23 +12703,23 @@ typedef struct VdbeOpList VdbeOpList; /* 8 */ 0x00, 0x10, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01,\ /* 16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0x03, 0x03, 0x09,\ /* 24 */ 0x09, 0x09, 0x09, 0x26, 0x26, 0x09, 0x09, 0x09,\ -/* 32 */ 0x09, 0x01, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ +/* 32 */ 0x09, 0x09, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ /* 40 */ 0x0b, 0x0b, 0x01, 0x26, 0x26, 0x26, 0x26, 0x26,\ /* 48 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x01, 0x12, 0x01,\ -/* 56 */ 0x01, 0x01, 0x01, 0x01, 0x23, 0x0b, 0x01, 0x01,\ -/* 64 */ 0x03, 0x03, 0x03, 0x01, 0x01, 0x01, 0x02, 0x02,\ -/* 72 */ 0x08, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10,\ -/* 80 */ 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00,\ -/* 88 */ 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00,\ -/* 96 */ 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,\ -/* 104 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\ -/* 112 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ -/* 120 */ 0x00, 0x10, 0x00, 0x04, 0x04, 0x00, 0x00, 0x10,\ -/* 128 */ 0x10, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00,\ -/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04,\ -/* 144 */ 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ -/* 152 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ -/* 160 */ 0x00,} +/* 56 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x23, 0x0b, 0x01,\ +/* 64 */ 0x01, 0x03, 0x03, 0x03, 0x01, 0x01, 0x01, 0x02,\ +/* 72 */ 0x02, 0x08, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00,\ +/* 80 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ +/* 88 */ 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00,\ +/* 96 */ 0x00, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00,\ +/* 104 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ +/* 112 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ +/* 120 */ 0x00, 0x00, 0x10, 0x00, 0x04, 0x04, 0x00, 0x00,\ +/* 128 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00,\ +/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00,\ +/* 144 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ +/* 152 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\ +/* 160 */ 0x00, 0x00,} /* The sqlite3P2Values() routine is able to run faster if it knows ** the value of the largest JUMP opcode. The smaller the maximum @@ -12537,7 +12727,7 @@ typedef struct VdbeOpList VdbeOpList; ** generated this include file strives to group all JUMP opcodes ** together near the beginning of the list. */ -#define SQLITE_MX_JUMP_OPCODE 69 /* Maximum JUMP opcode */ +#define SQLITE_MX_JUMP_OPCODE 70 /* Maximum JUMP opcode */ /************** End of opcodes.h *********************************************/ /************** Continuing where we left off in vdbe.h ***********************/ @@ -12684,7 +12874,7 @@ SQLITE_PRIVATE void sqlite3VdbeScanStatus(Vdbe*, int, int, int, LogEst, const ch # define sqlite3VdbeScanStatus(a,b,c,d,e) #endif -#endif +#endif /* SQLITE_VDBE_H */ /************** End of vdbe.h ************************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ @@ -12706,8 +12896,8 @@ SQLITE_PRIVATE void sqlite3VdbeScanStatus(Vdbe*, int, int, int, LogEst, const ch ** at a time and provides a journal for rollback. */ -#ifndef _PAGER_H_ -#define _PAGER_H_ +#ifndef SQLITE_PAGER_H +#define SQLITE_PAGER_H /* ** Default maximum size for persistent journal files. A negative @@ -12895,7 +13085,7 @@ SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager*); SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager*); SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager*); SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *, int, int, int *); -SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *); +SQLITE_PRIVATE void sqlite3PagerClearCache(Pager*); SQLITE_PRIVATE int sqlite3SectorSize(sqlite3_file *); /* Functions used to truncate the database file. */ @@ -12922,7 +13112,7 @@ SQLITE_PRIVATE void sqlite3PagerRefdump(Pager*); # define enable_simulated_io_errors() #endif -#endif /* _PAGER_H_ */ +#endif /* SQLITE_PAGER_H */ /************** End of pager.h ***********************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ @@ -13160,8 +13350,8 @@ SQLITE_PRIVATE int sqlite3PCachePercentDirty(PCache*); ** This file contains pre-processor directives related to operating system ** detection and/or setup. */ -#ifndef _OS_SETUP_H_ -#define _OS_SETUP_H_ +#ifndef SQLITE_OS_SETUP_H +#define SQLITE_OS_SETUP_H /* ** Figure out if we are dealing with Unix, Windows, or some other operating @@ -13201,7 +13391,7 @@ SQLITE_PRIVATE int sqlite3PCachePercentDirty(PCache*); # endif #endif -#endif /* _OS_SETUP_H_ */ +#endif /* SQLITE_OS_SETUP_H */ /************** End of os_setup.h ********************************************/ /************** Continuing where we left off in os.h *************************/ @@ -13658,6 +13848,15 @@ SQLITE_PRIVATE void sqlite3CryptFunc(sqlite3_context*,int,sqlite3_value**); const char*); #endif +#ifndef SQLITE_OMIT_DEPRECATED +/* This is an extra SQLITE_TRACE macro that indicates "legacy" tracing +** in the style of sqlite3_trace() +*/ +#define SQLITE_TRACE_LEGACY 0x80 +#else +#define SQLITE_TRACE_LEGACY 0 +#endif /* SQLITE_OMIT_DEPRECATED */ + /* ** Each database connection is an instance of the following structure. @@ -13687,6 +13886,7 @@ struct sqlite3 { u8 suppressErr; /* Do not issue error messages if true */ u8 vtabOnConflict; /* Value to return for s3_vtab_on_conflict() */ u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */ + u8 mTrace; /* zero or more SQLITE_TRACE flags */ int nextPagesize; /* Pagesize after VACUUM if >0 */ u32 magic; /* Magic number for detect library misuse */ int nChange; /* Value returned by sqlite3_changes() */ @@ -13707,7 +13907,7 @@ struct sqlite3 { int nVDestroy; /* Number of active OP_VDestroy operations */ int nExtension; /* Number of loaded extensions */ void **aExtension; /* Array of shared library handles */ - void (*xTrace)(void*,const char*); /* Trace function */ + int (*xTrace)(u32,void*,void*,void*); /* Trace function */ void *pTraceArg; /* Argument to the trace function */ void (*xProfile)(void*,const char*,u64); /* Profiling function */ void *pProfileArg; /* Argument to profile function */ @@ -14902,7 +15102,7 @@ struct SrcList { int regReturn; /* Register holding return address of addrFillSub */ int regResult; /* Registers holding results of a co-routine */ struct { - u8 jointype; /* Type of join between this able and the previous */ + u8 jointype; /* Type of join between this table and the previous */ unsigned notIndexed :1; /* True if there is a NOT INDEXED clause */ unsigned isIndexedBy :1; /* True if there is an INDEXED BY clause */ unsigned isTabFunc :1; /* True if table-valued-function syntax */ @@ -14948,19 +15148,20 @@ struct SrcList { #define WHERE_ORDERBY_MIN 0x0001 /* ORDER BY processing for min() func */ #define WHERE_ORDERBY_MAX 0x0002 /* ORDER BY processing for max() func */ #define WHERE_ONEPASS_DESIRED 0x0004 /* Want to do one-pass UPDATE/DELETE */ -#define WHERE_DUPLICATES_OK 0x0008 /* Ok to return a row more than once */ -#define WHERE_OMIT_OPEN_CLOSE 0x0010 /* Table cursors are already open */ -#define WHERE_FORCE_TABLE 0x0020 /* Do not use an index-only search */ -#define WHERE_ONETABLE_ONLY 0x0040 /* Only code the 1st table in pTabList */ -#define WHERE_NO_AUTOINDEX 0x0080 /* Disallow automatic indexes */ -#define WHERE_GROUPBY 0x0100 /* pOrderBy is really a GROUP BY */ -#define WHERE_DISTINCTBY 0x0200 /* pOrderby is really a DISTINCT clause */ -#define WHERE_WANT_DISTINCT 0x0400 /* All output needs to be distinct */ -#define WHERE_SORTBYGROUP 0x0800 /* Support sqlite3WhereIsSorted() */ -#define WHERE_REOPEN_IDX 0x1000 /* Try to use OP_ReopenIdx */ -#define WHERE_ONEPASS_MULTIROW 0x2000 /* ONEPASS is ok with multiple rows */ -#define WHERE_USE_LIMIT 0x4000 /* There is a constant LIMIT clause */ -#define WHERE_SEEK_TABLE 0x8000 /* Do not defer seeks on main table */ +#define WHERE_ONEPASS_MULTIROW 0x0008 /* ONEPASS is ok with multiple rows */ +#define WHERE_DUPLICATES_OK 0x0010 /* Ok to return a row more than once */ +#define WHERE_OR_SUBCLAUSE 0x0020 /* Processing a sub-WHERE as part of + ** the OR optimization */ +#define WHERE_GROUPBY 0x0040 /* pOrderBy is really a GROUP BY */ +#define WHERE_DISTINCTBY 0x0080 /* pOrderby is really a DISTINCT clause */ +#define WHERE_WANT_DISTINCT 0x0100 /* All output needs to be distinct */ +#define WHERE_SORTBYGROUP 0x0200 /* Support sqlite3WhereIsSorted() */ +#define WHERE_SEEK_TABLE 0x0400 /* Do not defer seeks on main table */ +#define WHERE_ORDERBY_LIMIT 0x0800 /* ORDERBY+LIMIT on the inner loop */ + /* 0x1000 not currently used */ + /* 0x2000 not currently used */ +#define WHERE_USE_LIMIT 0x4000 /* Use the LIMIT in cost estimates */ + /* 0x8000 not currently used */ /* Allowed return values from sqlite3WhereIsDistinct() */ @@ -15663,6 +15864,7 @@ struct Walker { struct SrcCount *pSrcCount; /* Counting column references */ struct CCurHint *pCCurHint; /* Used by codeCursorHint() */ int *aiCol; /* array of column indexes */ + struct IdxCover *pIdxCover; /* Check for index coverage */ } u; }; @@ -15846,11 +16048,15 @@ SQLITE_PRIVATE int sqlite3HeapNearlyFull(void); # define sqlite3StackFree(D,P) sqlite3DbFree(D,P) #endif -#ifdef SQLITE_ENABLE_MEMSYS3 -SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void); -#endif +/* Do not allow both MEMSYS5 and MEMSYS3 to be defined together. If they +** are, disable MEMSYS3 +*/ #ifdef SQLITE_ENABLE_MEMSYS5 SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys5(void); +#undef SQLITE_ENABLE_MEMSYS3 +#endif +#ifdef SQLITE_ENABLE_MEMSYS3 +SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void); #endif @@ -16033,8 +16239,8 @@ SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse*, SrcList*); SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3*, IdList*); SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3*, SrcList*); SQLITE_PRIVATE Index *sqlite3AllocateIndexObject(sqlite3*,i16,int,char**); -SQLITE_PRIVATE Index *sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*, - Expr*, int, int); +SQLITE_PRIVATE void sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*, + Expr*, int, int, u8); SQLITE_PRIVATE void sqlite3DropIndex(Parse*, SrcList*, int); SQLITE_PRIVATE int sqlite3Select(Parse*, Select*, SelectDest*); SQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*, @@ -16053,6 +16259,7 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*); SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo*); SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo*); SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo*); +SQLITE_PRIVATE int sqlite3WhereOrderedInnerLoop(WhereInfo*); SQLITE_PRIVATE int sqlite3WhereIsSorted(WhereInfo*); SQLITE_PRIVATE int sqlite3WhereContinueLabel(WhereInfo*); SQLITE_PRIVATE int sqlite3WhereBreakLabel(WhereInfo*); @@ -16086,8 +16293,10 @@ SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse*, Expr*, int, int); SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse*, Expr*, int, int); SQLITE_PRIVATE void sqlite3ExprIfFalseDup(Parse*, Expr*, int, int); SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3*,const char*, const char*); -SQLITE_PRIVATE Table *sqlite3LocateTable(Parse*,int isView,const char*, const char*); -SQLITE_PRIVATE Table *sqlite3LocateTableItem(Parse*,int isView,struct SrcList_item *); +#define LOCATE_VIEW 0x01 +#define LOCATE_NOERR 0x02 +SQLITE_PRIVATE Table *sqlite3LocateTable(Parse*,u32 flags,const char*, const char*); +SQLITE_PRIVATE Table *sqlite3LocateTableItem(Parse*,u32 flags,struct SrcList_item *); SQLITE_PRIVATE Index *sqlite3FindIndex(sqlite3*,const char*, const char*); SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*); SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*); @@ -16099,6 +16308,7 @@ SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList*, ExprList*, int); SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Expr*, Expr*, int); SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*); SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*); +SQLITE_PRIVATE int sqlite3ExprCoveredByIndex(Expr*, int iCur, Index *pIdx); SQLITE_PRIVATE int sqlite3FunctionUsesThisSrc(Expr*, SrcList*); SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse*); #ifndef SQLITE_OMIT_BUILTIN_TEST @@ -16650,7 +16860,7 @@ SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread*, void**); SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3*); #endif -#endif /* _SQLITEINT_H_ */ +#endif /* SQLITEINT_H */ /************** End of sqliteInt.h *******************************************/ /************** Begin file global.c ******************************************/ @@ -16985,6 +17195,15 @@ static const char * const azCompileOpt[] = { #if SQLITE_CHECK_PAGES "CHECK_PAGES", #endif +#if defined(__clang__) && defined(__clang_major__) + "COMPILER=clang-" CTIMEOPT_VAL(__clang_major__) "." + CTIMEOPT_VAL(__clang_minor__) "." + CTIMEOPT_VAL(__clang_patchlevel__), +#elif defined(_MSC_VER) + "COMPILER=msvc-" CTIMEOPT_VAL(_MSC_VER), +#elif defined(__GNUC__) && defined(__VERSION__) + "COMPILER=gcc-" __VERSION__, +#endif #if SQLITE_COVERAGE_TEST "COVERAGE_TEST", #endif @@ -17004,7 +17223,7 @@ static const char * const azCompileOpt[] = { "DISABLE_LFS", #endif #if SQLITE_ENABLE_8_3_NAMES - "ENABLE_8_3_NAMES", + "ENABLE_8_3_NAMES=" CTIMEOPT_VAL(SQLITE_ENABLE_8_3_NAMES), #endif #if SQLITE_ENABLE_API_ARMOR "ENABLE_API_ARMOR", @@ -17418,8 +17637,8 @@ SQLITE_API const char *SQLITE_STDCALL sqlite3_compileoption_get(int N){ ** 6000 lines long) it was split up into several smaller files and ** this header information was factored out. */ -#ifndef _VDBEINT_H_ -#define _VDBEINT_H_ +#ifndef SQLITE_VDBEINT_H +#define SQLITE_VDBEINT_H /* ** The maximum number of times that a statement will try to reparse @@ -17961,7 +18180,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *); #define ExpandBlob(P) SQLITE_OK #endif -#endif /* !defined(_VDBEINT_H_) */ +#endif /* !defined(SQLITE_VDBEINT_H) */ /************** End of vdbeInt.h *********************************************/ /************** Continuing where we left off in status.c *********************/ @@ -18108,7 +18327,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_status64( return SQLITE_OK; } SQLITE_API int SQLITE_STDCALL sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){ - sqlite3_int64 iCur, iHwtr; + sqlite3_int64 iCur = 0, iHwtr = 0; int rc; #ifdef SQLITE_ENABLE_API_ARMOR if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT; @@ -18169,6 +18388,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_status( ** by all pagers associated with the given database connection. The ** highwater mark is meaningless and is returned as zero. */ + case SQLITE_DBSTATUS_CACHE_USED_SHARED: case SQLITE_DBSTATUS_CACHE_USED: { int totalUsed = 0; int i; @@ -18177,7 +18397,11 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_status( Btree *pBt = db->aDb[i].pBt; if( pBt ){ Pager *pPager = sqlite3BtreePager(pBt); - totalUsed += sqlite3PagerMemUsed(pPager); + int nByte = sqlite3PagerMemUsed(pPager); + if( op==SQLITE_DBSTATUS_CACHE_USED_SHARED ){ + nByte = nByte / sqlite3BtreeConnectionCount(pBt); + } + totalUsed += nByte; } } sqlite3BtreeLeaveAll(db); @@ -19411,7 +19635,6 @@ static void currentTimeFunc( ){ time_t t; char *zFormat = (char *)sqlite3_user_data(context); - sqlite3 *db; sqlite3_int64 iT; struct tm *pTm; struct tm sNow; @@ -19480,9 +19703,7 @@ SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void){ ** This file contains OS interface code that is common to all ** architectures. */ -#define _SQLITE_OS_C_ 1 /* #include "sqliteInt.h" */ -#undef _SQLITE_OS_C_ /* ** If we compile with the SQLITE_TEST macro set, then the following block @@ -22995,8 +23216,8 @@ SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){ ** This file contains inline asm code for retrieving "high-performance" ** counters for x86 class CPUs. */ -#ifndef _HWTIME_H_ -#define _HWTIME_H_ +#ifndef SQLITE_HWTIME_H +#define SQLITE_HWTIME_H /* ** The following routine only works on pentium-class (or newer) processors. @@ -23064,7 +23285,7 @@ SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } #endif -#endif /* !defined(_HWTIME_H_) */ +#endif /* !defined(SQLITE_HWTIME_H) */ /************** End of hwtime.h **********************************************/ /************** Continuing where we left off in os_common.h ******************/ @@ -23154,8 +23375,8 @@ SQLITE_API extern int sqlite3_open_file_count; ** ** This file contains code that is specific to Windows. */ -#ifndef _OS_WIN_H_ -#define _OS_WIN_H_ +#ifndef SQLITE_OS_WIN_H +#define SQLITE_OS_WIN_H /* ** Include the primary Windows SDK header file. @@ -23227,7 +23448,7 @@ SQLITE_API extern int sqlite3_open_file_count; # define SQLITE_OS_WIN_THREADS 0 #endif -#endif /* _OS_WIN_H_ */ +#endif /* SQLITE_OS_WIN_H */ /************** End of os_win.h **********************************************/ /************** Continuing where we left off in mutex_w32.c ******************/ @@ -25978,6 +26199,12 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m break; } #endif + case TK_MATCH: { + sqlite3TreeViewLine(pView, "MATCH {%d:%d}%s", + pExpr->iTable, pExpr->iColumn, zFlgs); + sqlite3TreeViewExpr(pView, pExpr->pRight, 0); + break; + } default: { sqlite3TreeViewLine(pView, "op=%d", pExpr->op); break; @@ -28761,8 +28988,8 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ /* 29 */ "NoConflict" OpHelp("key=r[P3@P4]"), /* 30 */ "NotFound" OpHelp("key=r[P3@P4]"), /* 31 */ "Found" OpHelp("key=r[P3@P4]"), - /* 32 */ "NotExists" OpHelp("intkey=r[P3]"), - /* 33 */ "Last" OpHelp(""), + /* 32 */ "SeekRowid" OpHelp("intkey=r[P3]"), + /* 33 */ "NotExists" OpHelp("intkey=r[P3]"), /* 34 */ "IsNull" OpHelp("if r[P1]==NULL goto P2"), /* 35 */ "NotNull" OpHelp("if r[P1]!=NULL goto P2"), /* 36 */ "Ne" OpHelp("if r[P1]!=r[P3] goto P2"), @@ -28771,7 +28998,7 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ /* 39 */ "Le" OpHelp("if r[P1]<=r[P3] goto P2"), /* 40 */ "Lt" OpHelp("if r[P1]=r[P3] goto P2"), - /* 42 */ "SorterSort" OpHelp(""), + /* 42 */ "Last" OpHelp(""), /* 43 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"), /* 44 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"), /* 45 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<0 then r[P1]-=P3, goto P2"), - /* 65 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]-=P3, goto P2"), - /* 66 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"), - /* 67 */ "IncrVacuum" OpHelp(""), - /* 68 */ "VNext" OpHelp(""), - /* 69 */ "Init" OpHelp("Start at P2"), - /* 70 */ "Return" OpHelp(""), - /* 71 */ "EndCoroutine" OpHelp(""), - /* 72 */ "HaltIfNull" OpHelp("if r[P3]=null halt"), - /* 73 */ "Halt" OpHelp(""), - /* 74 */ "Integer" OpHelp("r[P2]=P1"), - /* 75 */ "Int64" OpHelp("r[P2]=P4"), - /* 76 */ "String" OpHelp("r[P2]='P4' (len=P1)"), - /* 77 */ "Null" OpHelp("r[P2..P3]=NULL"), - /* 78 */ "SoftNull" OpHelp("r[P1]=NULL"), - /* 79 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), - /* 80 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), - /* 81 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), - /* 82 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), - /* 83 */ "SCopy" OpHelp("r[P2]=r[P1]"), - /* 84 */ "IntCopy" OpHelp("r[P2]=r[P1]"), - /* 85 */ "ResultRow" OpHelp("output=r[P1@P2]"), - /* 86 */ "CollSeq" OpHelp(""), - /* 87 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"), - /* 88 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"), - /* 89 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), - /* 90 */ "RealAffinity" OpHelp(""), - /* 91 */ "Cast" OpHelp("affinity(r[P1])"), - /* 92 */ "Permutation" OpHelp(""), - /* 93 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), - /* 94 */ "Column" OpHelp("r[P3]=PX"), - /* 95 */ "Affinity" OpHelp("affinity(r[P1@P2])"), - /* 96 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), + /* 55 */ "Sort" OpHelp(""), + /* 56 */ "Rewind" OpHelp(""), + /* 57 */ "IdxLE" OpHelp("key=r[P3@P4]"), + /* 58 */ "IdxGT" OpHelp("key=r[P3@P4]"), + /* 59 */ "IdxLT" OpHelp("key=r[P3@P4]"), + /* 60 */ "IdxGE" OpHelp("key=r[P3@P4]"), + /* 61 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"), + /* 62 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"), + /* 63 */ "Program" OpHelp(""), + /* 64 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"), + /* 65 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"), + /* 66 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]-=P3, goto P2"), + /* 67 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"), + /* 68 */ "IncrVacuum" OpHelp(""), + /* 69 */ "VNext" OpHelp(""), + /* 70 */ "Init" OpHelp("Start at P2"), + /* 71 */ "Return" OpHelp(""), + /* 72 */ "EndCoroutine" OpHelp(""), + /* 73 */ "HaltIfNull" OpHelp("if r[P3]=null halt"), + /* 74 */ "Halt" OpHelp(""), + /* 75 */ "Integer" OpHelp("r[P2]=P1"), + /* 76 */ "Int64" OpHelp("r[P2]=P4"), + /* 77 */ "String" OpHelp("r[P2]='P4' (len=P1)"), + /* 78 */ "Null" OpHelp("r[P2..P3]=NULL"), + /* 79 */ "SoftNull" OpHelp("r[P1]=NULL"), + /* 80 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), + /* 81 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), + /* 82 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), + /* 83 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), + /* 84 */ "SCopy" OpHelp("r[P2]=r[P1]"), + /* 85 */ "IntCopy" OpHelp("r[P2]=r[P1]"), + /* 86 */ "ResultRow" OpHelp("output=r[P1@P2]"), + /* 87 */ "CollSeq" OpHelp(""), + /* 88 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"), + /* 89 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"), + /* 90 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), + /* 91 */ "RealAffinity" OpHelp(""), + /* 92 */ "Cast" OpHelp("affinity(r[P1])"), + /* 93 */ "Permutation" OpHelp(""), + /* 94 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), + /* 95 */ "Column" OpHelp("r[P3]=PX"), + /* 96 */ "Affinity" OpHelp("affinity(r[P1@P2])"), /* 97 */ "String8" OpHelp("r[P2]='P4'"), - /* 98 */ "Count" OpHelp("r[P2]=count()"), - /* 99 */ "ReadCookie" OpHelp(""), - /* 100 */ "SetCookie" OpHelp(""), - /* 101 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), - /* 102 */ "OpenRead" OpHelp("root=P2 iDb=P3"), - /* 103 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), - /* 104 */ "OpenAutoindex" OpHelp("nColumn=P2"), - /* 105 */ "OpenEphemeral" OpHelp("nColumn=P2"), - /* 106 */ "SorterOpen" OpHelp(""), - /* 107 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"), - /* 108 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"), - /* 109 */ "Close" OpHelp(""), - /* 110 */ "ColumnsUsed" OpHelp(""), - /* 111 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), - /* 112 */ "NewRowid" OpHelp("r[P2]=rowid"), - /* 113 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), - /* 114 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"), - /* 115 */ "Delete" OpHelp(""), - /* 116 */ "ResetCount" OpHelp(""), - /* 117 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), - /* 118 */ "SorterData" OpHelp("r[P2]=data"), - /* 119 */ "RowKey" OpHelp("r[P2]=key"), - /* 120 */ "RowData" OpHelp("r[P2]=data"), - /* 121 */ "Rowid" OpHelp("r[P2]=rowid"), - /* 122 */ "NullRow" OpHelp(""), - /* 123 */ "SorterInsert" OpHelp(""), - /* 124 */ "IdxInsert" OpHelp("key=r[P2]"), - /* 125 */ "IdxDelete" OpHelp("key=r[P2@P3]"), - /* 126 */ "Seek" OpHelp("Move P3 to P1.rowid"), - /* 127 */ "IdxRowid" OpHelp("r[P2]=rowid"), - /* 128 */ "Destroy" OpHelp(""), - /* 129 */ "Clear" OpHelp(""), - /* 130 */ "ResetSorter" OpHelp(""), - /* 131 */ "CreateIndex" OpHelp("r[P2]=root iDb=P1"), - /* 132 */ "CreateTable" OpHelp("r[P2]=root iDb=P1"), + /* 98 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), + /* 99 */ "Count" OpHelp("r[P2]=count()"), + /* 100 */ "ReadCookie" OpHelp(""), + /* 101 */ "SetCookie" OpHelp(""), + /* 102 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), + /* 103 */ "OpenRead" OpHelp("root=P2 iDb=P3"), + /* 104 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), + /* 105 */ "OpenAutoindex" OpHelp("nColumn=P2"), + /* 106 */ "OpenEphemeral" OpHelp("nColumn=P2"), + /* 107 */ "SorterOpen" OpHelp(""), + /* 108 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"), + /* 109 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"), + /* 110 */ "Close" OpHelp(""), + /* 111 */ "ColumnsUsed" OpHelp(""), + /* 112 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), + /* 113 */ "NewRowid" OpHelp("r[P2]=rowid"), + /* 114 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), + /* 115 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"), + /* 116 */ "Delete" OpHelp(""), + /* 117 */ "ResetCount" OpHelp(""), + /* 118 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), + /* 119 */ "SorterData" OpHelp("r[P2]=data"), + /* 120 */ "RowKey" OpHelp("r[P2]=key"), + /* 121 */ "RowData" OpHelp("r[P2]=data"), + /* 122 */ "Rowid" OpHelp("r[P2]=rowid"), + /* 123 */ "NullRow" OpHelp(""), + /* 124 */ "SorterInsert" OpHelp(""), + /* 125 */ "IdxInsert" OpHelp("key=r[P2]"), + /* 126 */ "IdxDelete" OpHelp("key=r[P2@P3]"), + /* 127 */ "Seek" OpHelp("Move P3 to P1.rowid"), + /* 128 */ "IdxRowid" OpHelp("r[P2]=rowid"), + /* 129 */ "Destroy" OpHelp(""), + /* 130 */ "Clear" OpHelp(""), + /* 131 */ "ResetSorter" OpHelp(""), + /* 132 */ "CreateIndex" OpHelp("r[P2]=root iDb=P1"), /* 133 */ "Real" OpHelp("r[P2]=P4"), - /* 134 */ "ParseSchema" OpHelp(""), - /* 135 */ "LoadAnalysis" OpHelp(""), - /* 136 */ "DropTable" OpHelp(""), - /* 137 */ "DropIndex" OpHelp(""), - /* 138 */ "DropTrigger" OpHelp(""), - /* 139 */ "IntegrityCk" OpHelp(""), - /* 140 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), - /* 141 */ "Param" OpHelp(""), - /* 142 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), - /* 143 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), - /* 144 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), - /* 145 */ "AggStep0" OpHelp("accum=r[P3] step(r[P2@P5])"), - /* 146 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), - /* 147 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), - /* 148 */ "Expire" OpHelp(""), - /* 149 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), - /* 150 */ "VBegin" OpHelp(""), - /* 151 */ "VCreate" OpHelp(""), - /* 152 */ "VDestroy" OpHelp(""), - /* 153 */ "VOpen" OpHelp(""), - /* 154 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), - /* 155 */ "VRename" OpHelp(""), - /* 156 */ "Pagecount" OpHelp(""), - /* 157 */ "MaxPgcnt" OpHelp(""), - /* 158 */ "CursorHint" OpHelp(""), - /* 159 */ "Noop" OpHelp(""), - /* 160 */ "Explain" OpHelp(""), + /* 134 */ "CreateTable" OpHelp("r[P2]=root iDb=P1"), + /* 135 */ "ParseSchema" OpHelp(""), + /* 136 */ "LoadAnalysis" OpHelp(""), + /* 137 */ "DropTable" OpHelp(""), + /* 138 */ "DropIndex" OpHelp(""), + /* 139 */ "DropTrigger" OpHelp(""), + /* 140 */ "IntegrityCk" OpHelp(""), + /* 141 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), + /* 142 */ "Param" OpHelp(""), + /* 143 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), + /* 144 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), + /* 145 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), + /* 146 */ "AggStep0" OpHelp("accum=r[P3] step(r[P2@P5])"), + /* 147 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), + /* 148 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), + /* 149 */ "Expire" OpHelp(""), + /* 150 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), + /* 151 */ "VBegin" OpHelp(""), + /* 152 */ "VCreate" OpHelp(""), + /* 153 */ "VDestroy" OpHelp(""), + /* 154 */ "VOpen" OpHelp(""), + /* 155 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), + /* 156 */ "VRename" OpHelp(""), + /* 157 */ "Pagecount" OpHelp(""), + /* 158 */ "MaxPgcnt" OpHelp(""), + /* 159 */ "CursorHint" OpHelp(""), + /* 160 */ "Noop" OpHelp(""), + /* 161 */ "Explain" OpHelp(""), }; return azName[i]; } @@ -29239,8 +29467,8 @@ static pid_t randomnessPid = 0; ** This file contains inline asm code for retrieving "high-performance" ** counters for x86 class CPUs. */ -#ifndef _HWTIME_H_ -#define _HWTIME_H_ +#ifndef SQLITE_HWTIME_H +#define SQLITE_HWTIME_H /* ** The following routine only works on pentium-class (or newer) processors. @@ -29308,7 +29536,7 @@ SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } #endif -#endif /* !defined(_HWTIME_H_) */ +#endif /* !defined(SQLITE_HWTIME_H) */ /************** End of hwtime.h **********************************************/ /************** Continuing where we left off in os_common.h ******************/ @@ -36768,8 +36996,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_os_end(void){ ** This file contains inline asm code for retrieving "high-performance" ** counters for x86 class CPUs. */ -#ifndef _HWTIME_H_ -#define _HWTIME_H_ +#ifndef SQLITE_HWTIME_H +#define SQLITE_HWTIME_H /* ** The following routine only works on pentium-class (or newer) processors. @@ -36837,7 +37065,7 @@ SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } #endif -#endif /* !defined(_HWTIME_H_) */ +#endif /* !defined(SQLITE_HWTIME_H) */ /************** End of hwtime.h **********************************************/ /************** Continuing where we left off in os_common.h ******************/ @@ -37178,6 +37406,17 @@ struct winFile { #endif }; +/* +** The winVfsAppData structure is used for the pAppData member for all of the +** Win32 VFS variants. +*/ +typedef struct winVfsAppData winVfsAppData; +struct winVfsAppData { + const sqlite3_io_methods *pMethod; /* The file I/O methods to use. */ + void *pAppData; /* The extra pAppData, if any. */ + BOOL bNoLock; /* Non-zero if locking is disabled. */ +}; + /* ** Allowed values for winFile.ctrlFlags */ @@ -39499,7 +39738,12 @@ static int winClose(sqlite3_file *id){ }while( rc==0 && ++cnt < MX_CLOSE_ATTEMPT && (sqlite3_win32_sleep(100), 1) ); #if SQLITE_OS_WINCE #define WINCE_DELETION_ATTEMPTS 3 - winceDestroyLock(pFile); + { + winVfsAppData *pAppData = (winVfsAppData*)pFile->pVfs->pAppData; + if( pAppData==NULL || !pAppData->bNoLock ){ + winceDestroyLock(pFile); + } + } if( pFile->zDeleteOnClose ){ int cnt = 0; while( @@ -40231,6 +40475,44 @@ static int winUnlock(sqlite3_file *id, int locktype){ return rc; } +/****************************************************************************** +****************************** No-op Locking ********************************** +** +** Of the various locking implementations available, this is by far the +** simplest: locking is ignored. No attempt is made to lock the database +** file for reading or writing. +** +** This locking mode is appropriate for use on read-only databases +** (ex: databases that are burned into CD-ROM, for example.) It can +** also be used if the application employs some external mechanism to +** prevent simultaneous access of the same database by two or more +** database connections. But there is a serious risk of database +** corruption if this locking mode is used in situations where multiple +** database connections are accessing the same database file at the same +** time and one or more of those connections are writing. +*/ + +static int winNolockLock(sqlite3_file *id, int locktype){ + UNUSED_PARAMETER(id); + UNUSED_PARAMETER(locktype); + return SQLITE_OK; +} + +static int winNolockCheckReservedLock(sqlite3_file *id, int *pResOut){ + UNUSED_PARAMETER(id); + UNUSED_PARAMETER(pResOut); + return SQLITE_OK; +} + +static int winNolockUnlock(sqlite3_file *id, int locktype){ + UNUSED_PARAMETER(id); + UNUSED_PARAMETER(locktype); + return SQLITE_OK; +} + +/******************* End of the no-op lock implementation ********************* +******************************************************************************/ + /* ** If *pArg is initially negative then this is a query. Set *pArg to ** 1 or 0 depending on whether or not bit mask of pFile->ctrlFlags is set. @@ -40509,12 +40791,12 @@ struct winShm { /* ** Apply advisory locks for all n bytes beginning at ofst. */ -#define _SHM_UNLCK 1 -#define _SHM_RDLCK 2 -#define _SHM_WRLCK 3 +#define WINSHM_UNLCK 1 +#define WINSHM_RDLCK 2 +#define WINSHM_WRLCK 3 static int winShmSystemLock( winShmNode *pFile, /* Apply locks to this open shared-memory segment */ - int lockType, /* _SHM_UNLCK, _SHM_RDLCK, or _SHM_WRLCK */ + int lockType, /* WINSHM_UNLCK, WINSHM_RDLCK, or WINSHM_WRLCK */ int ofst, /* Offset to first byte to be locked/unlocked */ int nByte /* Number of bytes to lock or unlock */ ){ @@ -40527,12 +40809,12 @@ static int winShmSystemLock( pFile->hFile.h, lockType, ofst, nByte)); /* Release/Acquire the system-level lock */ - if( lockType==_SHM_UNLCK ){ + if( lockType==WINSHM_UNLCK ){ rc = winUnlockFile(&pFile->hFile.h, ofst, 0, nByte, 0); }else{ /* Initialize the locking parameters */ DWORD dwFlags = LOCKFILE_FAIL_IMMEDIATELY; - if( lockType == _SHM_WRLCK ) dwFlags |= LOCKFILE_EXCLUSIVE_LOCK; + if( lockType == WINSHM_WRLCK ) dwFlags |= LOCKFILE_EXCLUSIVE_LOCK; rc = winLockFile(&pFile->hFile.h, dwFlags, ofst, 0, nByte, 0); } @@ -40544,7 +40826,7 @@ static int winShmSystemLock( } OSTRACE(("SHM-LOCK file=%p, func=%s, errno=%lu, rc=%s\n", - pFile->hFile.h, (lockType == _SHM_UNLCK) ? "winUnlockFile" : + pFile->hFile.h, (lockType == WINSHM_UNLCK) ? "winUnlockFile" : "winLockFile", pFile->lastErrno, sqlite3ErrName(rc))); return rc; @@ -40672,7 +40954,7 @@ static int winOpenSharedMemory(winFile *pDbFd){ /* Check to see if another process is holding the dead-man switch. ** If not, truncate the file to zero length. */ - if( winShmSystemLock(pShmNode, _SHM_WRLCK, WIN_SHM_DMS, 1)==SQLITE_OK ){ + if( winShmSystemLock(pShmNode, WINSHM_WRLCK, WIN_SHM_DMS, 1)==SQLITE_OK ){ rc = winTruncate((sqlite3_file *)&pShmNode->hFile, 0); if( rc!=SQLITE_OK ){ rc = winLogError(SQLITE_IOERR_SHMOPEN, osGetLastError(), @@ -40680,8 +40962,8 @@ static int winOpenSharedMemory(winFile *pDbFd){ } } if( rc==SQLITE_OK ){ - winShmSystemLock(pShmNode, _SHM_UNLCK, WIN_SHM_DMS, 1); - rc = winShmSystemLock(pShmNode, _SHM_RDLCK, WIN_SHM_DMS, 1); + winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1); + rc = winShmSystemLock(pShmNode, WINSHM_RDLCK, WIN_SHM_DMS, 1); } if( rc ) goto shm_open_err; } @@ -40710,7 +40992,7 @@ static int winOpenSharedMemory(winFile *pDbFd){ /* Jump here on any error */ shm_open_err: - winShmSystemLock(pShmNode, _SHM_UNLCK, WIN_SHM_DMS, 1); + winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1); winShmPurge(pDbFd->pVfs, 0); /* This call frees pShmNode if required */ sqlite3_free(p); sqlite3_free(pNew); @@ -40799,7 +41081,7 @@ static int winShmLock( /* Unlock the system-level locks */ if( (mask & allMask)==0 ){ - rc = winShmSystemLock(pShmNode, _SHM_UNLCK, ofst+WIN_SHM_BASE, n); + rc = winShmSystemLock(pShmNode, WINSHM_UNLCK, ofst+WIN_SHM_BASE, n); }else{ rc = SQLITE_OK; } @@ -40827,7 +41109,7 @@ static int winShmLock( /* Get shared locks at the system level, if necessary */ if( rc==SQLITE_OK ){ if( (allShared & mask)==0 ){ - rc = winShmSystemLock(pShmNode, _SHM_RDLCK, ofst+WIN_SHM_BASE, n); + rc = winShmSystemLock(pShmNode, WINSHM_RDLCK, ofst+WIN_SHM_BASE, n); }else{ rc = SQLITE_OK; } @@ -40852,7 +41134,7 @@ static int winShmLock( ** also mark the local connection as being locked. */ if( rc==SQLITE_OK ){ - rc = winShmSystemLock(pShmNode, _SHM_WRLCK, ofst+WIN_SHM_BASE, n); + rc = winShmSystemLock(pShmNode, WINSHM_WRLCK, ofst+WIN_SHM_BASE, n); if( rc==SQLITE_OK ){ assert( (p->sharedMask & mask)==0 ); p->exclMask |= mask; @@ -41295,6 +41577,44 @@ static const sqlite3_io_methods winIoMethod = { winUnfetch /* xUnfetch */ }; +/* +** This vector defines all the methods that can operate on an +** sqlite3_file for win32 without performing any locking. +*/ +static const sqlite3_io_methods winIoNolockMethod = { + 3, /* iVersion */ + winClose, /* xClose */ + winRead, /* xRead */ + winWrite, /* xWrite */ + winTruncate, /* xTruncate */ + winSync, /* xSync */ + winFileSize, /* xFileSize */ + winNolockLock, /* xLock */ + winNolockUnlock, /* xUnlock */ + winNolockCheckReservedLock, /* xCheckReservedLock */ + winFileControl, /* xFileControl */ + winSectorSize, /* xSectorSize */ + winDeviceCharacteristics, /* xDeviceCharacteristics */ + winShmMap, /* xShmMap */ + winShmLock, /* xShmLock */ + winShmBarrier, /* xShmBarrier */ + winShmUnmap, /* xShmUnmap */ + winFetch, /* xFetch */ + winUnfetch /* xUnfetch */ +}; + +static winVfsAppData winAppData = { + &winIoMethod, /* pMethod */ + 0, /* pAppData */ + 0 /* bNoLock */ +}; + +static winVfsAppData winNolockAppData = { + &winIoNolockMethod, /* pMethod */ + 0, /* pAppData */ + 1 /* bNoLock */ +}; + /**************************************************************************** **************************** sqlite3_vfs methods **************************** ** @@ -41627,7 +41947,7 @@ static int winIsDir(const void *zConverted){ ** Open a file. */ static int winOpen( - sqlite3_vfs *pVfs, /* Used to get maximum path name length */ + sqlite3_vfs *pVfs, /* Used to get maximum path length and AppData */ const char *zName, /* Name of the file (UTF-8) */ sqlite3_file *id, /* Write the SQLite file handle here */ int flags, /* Open mode flags */ @@ -41642,6 +41962,7 @@ static int winOpen( #if SQLITE_OS_WINCE int isTemp = 0; #endif + winVfsAppData *pAppData; winFile *pFile = (winFile*)id; void *zConverted; /* Filename in OS encoding */ const char *zUtf8Name = zName; /* Filename in UTF-8 encoding */ @@ -41863,15 +42184,20 @@ static int winOpen( "rc=%s\n", h, zUtf8Name, dwDesiredAccess, pOutFlags, pOutFlags ? *pOutFlags : 0, (h==INVALID_HANDLE_VALUE) ? "failed" : "ok")); + pAppData = (winVfsAppData*)pVfs->pAppData; + #if SQLITE_OS_WINCE - if( isReadWrite && eType==SQLITE_OPEN_MAIN_DB - && (rc = winceCreateLock(zName, pFile))!=SQLITE_OK - ){ - osCloseHandle(h); - sqlite3_free(zConverted); - sqlite3_free(zTmpname); - OSTRACE(("OPEN-CE-LOCK name=%s, rc=%s\n", zName, sqlite3ErrName(rc))); - return rc; + { + if( isReadWrite && eType==SQLITE_OPEN_MAIN_DB + && ((pAppData==NULL) || !pAppData->bNoLock) + && (rc = winceCreateLock(zName, pFile))!=SQLITE_OK + ){ + osCloseHandle(h); + sqlite3_free(zConverted); + sqlite3_free(zTmpname); + OSTRACE(("OPEN-CE-LOCK name=%s, rc=%s\n", zName, sqlite3ErrName(rc))); + return rc; + } } if( isTemp ){ pFile->zDeleteOnClose = zConverted; @@ -41882,7 +42208,7 @@ static int winOpen( } sqlite3_free(zTmpname); - pFile->pMethod = &winIoMethod; + pFile->pMethod = pAppData ? pAppData->pMethod : &winIoMethod; pFile->pVfs = pVfs; pFile->h = h; if( isReadonly ){ @@ -42157,6 +42483,18 @@ static int winFullPathname( int nFull, /* Size of output buffer in bytes */ char *zFull /* Output buffer */ ){ +#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(__CYGWIN__) + DWORD nByte; + void *zConverted; + char *zOut; +#endif + + /* If this path name begins with "/X:", where "X" is any alphabetic + ** character, discard the initial "/" from the pathname. + */ + if( zRelative[0]=='/' && winIsDriveLetterAndColon(zRelative+1) ){ + zRelative++; + } #if defined(__CYGWIN__) SimulateIOError( return SQLITE_ERROR ); @@ -42235,17 +42573,6 @@ static int winFullPathname( #endif #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(__CYGWIN__) - DWORD nByte; - void *zConverted; - char *zOut; - - /* If this path name begins with "/X:", where "X" is any alphabetic - ** character, discard the initial "/" from the pathname. - */ - if( zRelative[0]=='/' && winIsDriveLetterAndColon(zRelative+1) ){ - zRelative++; - } - /* It's odd to simulate an io-error here, but really this is just ** using the io-error infrastructure to test that SQLite handles this ** function failing. This function could fail if, for example, the @@ -42604,53 +42931,103 @@ static int winGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ */ SQLITE_API int SQLITE_STDCALL sqlite3_os_init(void){ static sqlite3_vfs winVfs = { - 3, /* iVersion */ - sizeof(winFile), /* szOsFile */ + 3, /* iVersion */ + sizeof(winFile), /* szOsFile */ SQLITE_WIN32_MAX_PATH_BYTES, /* mxPathname */ - 0, /* pNext */ - "win32", /* zName */ - 0, /* pAppData */ - winOpen, /* xOpen */ - winDelete, /* xDelete */ - winAccess, /* xAccess */ - winFullPathname, /* xFullPathname */ - winDlOpen, /* xDlOpen */ - winDlError, /* xDlError */ - winDlSym, /* xDlSym */ - winDlClose, /* xDlClose */ - winRandomness, /* xRandomness */ - winSleep, /* xSleep */ - winCurrentTime, /* xCurrentTime */ - winGetLastError, /* xGetLastError */ - winCurrentTimeInt64, /* xCurrentTimeInt64 */ - winSetSystemCall, /* xSetSystemCall */ - winGetSystemCall, /* xGetSystemCall */ - winNextSystemCall, /* xNextSystemCall */ + 0, /* pNext */ + "win32", /* zName */ + &winAppData, /* pAppData */ + winOpen, /* xOpen */ + winDelete, /* xDelete */ + winAccess, /* xAccess */ + winFullPathname, /* xFullPathname */ + winDlOpen, /* xDlOpen */ + winDlError, /* xDlError */ + winDlSym, /* xDlSym */ + winDlClose, /* xDlClose */ + winRandomness, /* xRandomness */ + winSleep, /* xSleep */ + winCurrentTime, /* xCurrentTime */ + winGetLastError, /* xGetLastError */ + winCurrentTimeInt64, /* xCurrentTimeInt64 */ + winSetSystemCall, /* xSetSystemCall */ + winGetSystemCall, /* xGetSystemCall */ + winNextSystemCall, /* xNextSystemCall */ }; #if defined(SQLITE_WIN32_HAS_WIDE) static sqlite3_vfs winLongPathVfs = { - 3, /* iVersion */ - sizeof(winFile), /* szOsFile */ + 3, /* iVersion */ + sizeof(winFile), /* szOsFile */ SQLITE_WINNT_MAX_PATH_BYTES, /* mxPathname */ - 0, /* pNext */ - "win32-longpath", /* zName */ - 0, /* pAppData */ - winOpen, /* xOpen */ - winDelete, /* xDelete */ - winAccess, /* xAccess */ - winFullPathname, /* xFullPathname */ - winDlOpen, /* xDlOpen */ - winDlError, /* xDlError */ - winDlSym, /* xDlSym */ - winDlClose, /* xDlClose */ - winRandomness, /* xRandomness */ - winSleep, /* xSleep */ - winCurrentTime, /* xCurrentTime */ - winGetLastError, /* xGetLastError */ - winCurrentTimeInt64, /* xCurrentTimeInt64 */ - winSetSystemCall, /* xSetSystemCall */ - winGetSystemCall, /* xGetSystemCall */ - winNextSystemCall, /* xNextSystemCall */ + 0, /* pNext */ + "win32-longpath", /* zName */ + &winAppData, /* pAppData */ + winOpen, /* xOpen */ + winDelete, /* xDelete */ + winAccess, /* xAccess */ + winFullPathname, /* xFullPathname */ + winDlOpen, /* xDlOpen */ + winDlError, /* xDlError */ + winDlSym, /* xDlSym */ + winDlClose, /* xDlClose */ + winRandomness, /* xRandomness */ + winSleep, /* xSleep */ + winCurrentTime, /* xCurrentTime */ + winGetLastError, /* xGetLastError */ + winCurrentTimeInt64, /* xCurrentTimeInt64 */ + winSetSystemCall, /* xSetSystemCall */ + winGetSystemCall, /* xGetSystemCall */ + winNextSystemCall, /* xNextSystemCall */ + }; +#endif + static sqlite3_vfs winNolockVfs = { + 3, /* iVersion */ + sizeof(winFile), /* szOsFile */ + SQLITE_WIN32_MAX_PATH_BYTES, /* mxPathname */ + 0, /* pNext */ + "win32-none", /* zName */ + &winNolockAppData, /* pAppData */ + winOpen, /* xOpen */ + winDelete, /* xDelete */ + winAccess, /* xAccess */ + winFullPathname, /* xFullPathname */ + winDlOpen, /* xDlOpen */ + winDlError, /* xDlError */ + winDlSym, /* xDlSym */ + winDlClose, /* xDlClose */ + winRandomness, /* xRandomness */ + winSleep, /* xSleep */ + winCurrentTime, /* xCurrentTime */ + winGetLastError, /* xGetLastError */ + winCurrentTimeInt64, /* xCurrentTimeInt64 */ + winSetSystemCall, /* xSetSystemCall */ + winGetSystemCall, /* xGetSystemCall */ + winNextSystemCall, /* xNextSystemCall */ + }; +#if defined(SQLITE_WIN32_HAS_WIDE) + static sqlite3_vfs winLongPathNolockVfs = { + 3, /* iVersion */ + sizeof(winFile), /* szOsFile */ + SQLITE_WINNT_MAX_PATH_BYTES, /* mxPathname */ + 0, /* pNext */ + "win32-longpath-none", /* zName */ + &winNolockAppData, /* pAppData */ + winOpen, /* xOpen */ + winDelete, /* xDelete */ + winAccess, /* xAccess */ + winFullPathname, /* xFullPathname */ + winDlOpen, /* xDlOpen */ + winDlError, /* xDlError */ + winDlSym, /* xDlSym */ + winDlClose, /* xDlClose */ + winRandomness, /* xRandomness */ + winSleep, /* xSleep */ + winCurrentTime, /* xCurrentTime */ + winGetLastError, /* xGetLastError */ + winCurrentTimeInt64, /* xCurrentTimeInt64 */ + winSetSystemCall, /* xSetSystemCall */ + winGetSystemCall, /* xGetSystemCall */ + winNextSystemCall, /* xNextSystemCall */ }; #endif @@ -42674,6 +43051,12 @@ SQLITE_API int SQLITE_STDCALL sqlite3_os_init(void){ sqlite3_vfs_register(&winLongPathVfs, 0); #endif + sqlite3_vfs_register(&winNolockVfs, 0); + +#if defined(SQLITE_WIN32_HAS_WIDE) + sqlite3_vfs_register(&winLongPathNolockVfs, 0); +#endif + return SQLITE_OK; } @@ -43794,29 +44177,31 @@ SQLITE_PRIVATE void sqlite3PcacheClear(PCache *pCache){ /* ** Merge two lists of pages connected by pDirty and in pgno order. -** Do not both fixing the pDirtyPrev pointers. +** Do not bother fixing the pDirtyPrev pointers. */ static PgHdr *pcacheMergeDirtyList(PgHdr *pA, PgHdr *pB){ PgHdr result, *pTail; pTail = &result; - while( pA && pB ){ + assert( pA!=0 && pB!=0 ); + for(;;){ if( pA->pgnopgno ){ pTail->pDirty = pA; pTail = pA; pA = pA->pDirty; + if( pA==0 ){ + pTail->pDirty = pB; + break; + } }else{ pTail->pDirty = pB; pTail = pB; pB = pB->pDirty; + if( pB==0 ){ + pTail->pDirty = pA; + break; + } } } - if( pA ){ - pTail->pDirty = pA; - }else if( pB ){ - pTail->pDirty = pB; - }else{ - pTail->pDirty = 0; - } return result.pDirty; } @@ -43857,7 +44242,8 @@ static PgHdr *pcacheSortDirtyList(PgHdr *pIn){ } p = a[0]; for(i=1; inPage is correct */ - unsigned int h; + TESTONLY( int nPage = 0; ) /* To assert pCache->nPage is correct */ + unsigned int h, iStop; assert( sqlite3_mutex_held(pCache->pGroup->mutex) ); - for(h=0; hnHash; h++){ - PgHdr1 **pp = &pCache->apHash[h]; + assert( pCache->iMaxKey >= iLimit ); + assert( pCache->nHash > 0 ); + if( pCache->iMaxKey - iLimit < pCache->nHash ){ + /* If we are just shaving the last few pages off the end of the + ** cache, then there is no point in scanning the entire hash table. + ** Only scan those hash slots that might contain pages that need to + ** be removed. */ + h = iLimit % pCache->nHash; + iStop = pCache->iMaxKey % pCache->nHash; + TESTONLY( nPage = -10; ) /* Disable the pCache->nPage validity check */ + }else{ + /* This is the general case where many pages are being removed. + ** It is necessary to scan the entire hash table */ + h = pCache->nHash/2; + iStop = h - 1; + } + for(;;){ + PgHdr1 **pp; PgHdr1 *pPage; + assert( hnHash ); + pp = &pCache->apHash[h]; while( (pPage = *pp)!=0 ){ if( pPage->iKey>=iLimit ){ pCache->nPage--; @@ -44626,11 +45030,13 @@ static void pcache1TruncateUnsafe( pcache1FreePage(pPage); }else{ pp = &pPage->pNext; - TESTONLY( nPage++; ) + TESTONLY( if( nPage>=0 ) nPage++; ) } } + if( h==iStop ) break; + h = (h+1) % pCache->nHash; } - assert( pCache->nPage==nPage ); + assert( nPage<0 || pCache->nPage==(unsigned)nPage ); } /******************************************************************************/ @@ -45107,7 +45513,7 @@ static void pcache1Destroy(sqlite3_pcache *p){ PGroup *pGroup = pCache->pGroup; assert( pCache->bPurgeable || (pCache->nMax==0 && pCache->nMin==0) ); pcache1EnterMutex(pGroup); - pcache1TruncateUnsafe(pCache, 0); + if( pCache->nPage ) pcache1TruncateUnsafe(pCache, 0); assert( pGroup->nMaxPage >= pCache->nMax ); pGroup->nMaxPage -= pCache->nMax; assert( pGroup->nMinPage >= pCache->nMin ); @@ -45462,28 +45868,26 @@ static struct RowSetEntry *rowSetEntryMerge( struct RowSetEntry *pTail; pTail = &head; - while( pA && pB ){ + assert( pA!=0 && pB!=0 ); + for(;;){ assert( pA->pRight==0 || pA->v<=pA->pRight->v ); assert( pB->pRight==0 || pB->v<=pB->pRight->v ); - if( pA->vv ){ - pTail->pRight = pA; + if( pA->v<=pB->v ){ + if( pA->vv ) pTail = pTail->pRight = pA; pA = pA->pRight; - pTail = pTail->pRight; - }else if( pB->vv ){ - pTail->pRight = pB; - pB = pB->pRight; - pTail = pTail->pRight; + if( pA==0 ){ + pTail->pRight = pB; + break; + } }else{ - pA = pA->pRight; + pTail = pTail->pRight = pB; + pB = pB->pRight; + if( pB==0 ){ + pTail->pRight = pA; + break; + } } } - if( pA ){ - assert( pA->pRight==0 || pA->v<=pA->pRight->v ); - pTail->pRight = pA; - }else{ - assert( pB==0 || pB->pRight==0 || pB->v<=pB->pRight->v ); - pTail->pRight = pB; - } return head.pRight; } @@ -45506,9 +45910,10 @@ static struct RowSetEntry *rowSetEntrySort(struct RowSetEntry *pIn){ aBucket[i] = pIn; pIn = pNext; } - pIn = 0; - for(i=0; ipadToSectorBoundary ){ int sectorSize = sqlite3SectorSize(pWal->pWalFd); w.iSyncPoint = ((iOffset+sectorSize-1)/sectorSize)*sectorSize; + bSync = (w.iSyncPoint==iOffset); + testcase( bSync ); while( iOffsetpBt->mutex); } + +/* Verify that the cursor and the BtShared agree about what is the current +** database connetion. This is important in shared-cache mode. If the database +** connection pointers get out-of-sync, it is possible for routines like +** btreeInitPage() to reference an stale connection pointer that references a +** a connection that has already closed. This routine is used inside assert() +** statements only and for the purpose of double-checking that the btree code +** does keep the database connection pointers up-to-date. +*/ static int cursorOwnsBtShared(BtCursor *p){ assert( cursorHoldsMutex(p) ); return (p->pBtree->db==p->pBt->db); @@ -58335,21 +58754,19 @@ static void btreeReleaseAllCursorPages(BtCursor *pCur){ ** the key. */ static int saveCursorKey(BtCursor *pCur){ - int rc; + int rc = SQLITE_OK; assert( CURSOR_VALID==pCur->eState ); assert( 0==pCur->pKey ); assert( cursorHoldsMutex(pCur) ); - rc = sqlite3BtreeKeySize(pCur, &pCur->nKey); - assert( rc==SQLITE_OK ); /* KeySize() cannot fail */ - - /* If this is an intKey table, then the above call to BtreeKeySize() - ** stores the integer key in pCur->nKey. In this case this value is - ** all that is required. Otherwise, if pCur is not open on an intKey - ** table, then malloc space for and store the pCur->nKey bytes of key - ** data. */ - if( 0==pCur->curIntKey ){ - void *pKey = sqlite3Malloc( pCur->nKey ); + if( pCur->curIntKey ){ + /* Only the rowid is required for a table btree */ + pCur->nKey = sqlite3BtreeIntegerKey(pCur); + }else{ + /* For an index btree, save the complete key content */ + void *pKey; + pCur->nKey = sqlite3BtreePayloadSize(pCur); + pKey = sqlite3Malloc( pCur->nKey ); if( pKey ){ rc = sqlite3BtreeKey(pCur, 0, (int)pCur->nKey, pKey); if( rc==SQLITE_OK ){ @@ -60056,9 +60473,9 @@ SQLITE_PRIVATE int sqlite3BtreeOpen( #if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO) /* Add the new BtShared object to the linked list sharable BtShareds. */ + pBt->nRef = 1; if( p->sharable ){ MUTEX_LOGIC( sqlite3_mutex *mutexShared; ) - pBt->nRef = 1; MUTEX_LOGIC( mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);) if( SQLITE_THREADSAFE && sqlite3GlobalConfig.bCoreMutex ){ pBt->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_FAST); @@ -60129,6 +60546,7 @@ btree_open_out: assert( sqlite3_mutex_held(mutexOpen) ); sqlite3_mutex_leave(mutexOpen); } + assert( rc!=SQLITE_OK || sqlite3BtreeConnectionCount(*ppBtree)>0 ); return rc; } @@ -61988,46 +62406,33 @@ SQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor *pCur){ #endif /* NDEBUG */ /* -** Set *pSize to the size of the buffer needed to hold the value of -** the key for the current entry. If the cursor is not pointing -** to a valid entry, *pSize is set to 0. -** -** For a table with the INTKEY flag set, this routine returns the key -** itself, not the number of bytes in the key. -** -** The caller must position the cursor prior to invoking this routine. -** -** This routine cannot fail. It always returns SQLITE_OK. +** Return the value of the integer key or "rowid" for a table btree. +** This routine is only valid for a cursor that is pointing into a +** ordinary table btree. If the cursor points to an index btree or +** is invalid, the result of this routine is undefined. */ -SQLITE_PRIVATE int sqlite3BtreeKeySize(BtCursor *pCur, i64 *pSize){ +SQLITE_PRIVATE i64 sqlite3BtreeIntegerKey(BtCursor *pCur){ assert( cursorHoldsMutex(pCur) ); assert( pCur->eState==CURSOR_VALID ); + assert( pCur->curIntKey ); getCellInfo(pCur); - *pSize = pCur->info.nKey; - return SQLITE_OK; + return pCur->info.nKey; } /* -** Set *pSize to the number of bytes of data in the entry the -** cursor currently points to. +** Return the number of bytes of payload for the entry that pCur is +** currently pointing to. For table btrees, this will be the amount +** of data. For index btrees, this will be the size of the key. ** ** The caller must guarantee that the cursor is pointing to a non-NULL ** valid entry. In other words, the calling procedure must guarantee ** that the cursor has Cursor.eState==CURSOR_VALID. -** -** Failure is not possible. This function always returns SQLITE_OK. -** It might just as well be a procedure (returning void) but we continue -** to return an integer result code for historical reasons. */ -SQLITE_PRIVATE int sqlite3BtreeDataSize(BtCursor *pCur, u32 *pSize){ - assert( cursorOwnsBtShared(pCur) ); +SQLITE_PRIVATE u32 sqlite3BtreePayloadSize(BtCursor *pCur){ + assert( cursorHoldsMutex(pCur) ); assert( pCur->eState==CURSOR_VALID ); - assert( pCur->iPage>=0 ); - assert( pCur->iPageapPage[pCur->iPage]->intKeyLeaf==1 ); getCellInfo(pCur); - *pSize = pCur->info.nPayload; - return SQLITE_OK; + return pCur->info.nPayload; } /* @@ -62469,10 +62874,7 @@ static const void *fetchPayload( ** These routines is used to get quick access to key and data ** in the common case where no overflow pages are used. */ -SQLITE_PRIVATE const void *sqlite3BtreeKeyFetch(BtCursor *pCur, u32 *pAmt){ - return fetchPayload(pCur, pAmt); -} -SQLITE_PRIVATE const void *sqlite3BtreeDataFetch(BtCursor *pCur, u32 *pAmt){ +SQLITE_PRIVATE const void *sqlite3BtreePayloadFetch(BtCursor *pCur, u32 *pAmt){ return fetchPayload(pCur, pAmt); } @@ -62805,11 +63207,12 @@ SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked( assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); assert( pRes ); assert( (pIdxKey==0)==(pCur->pKeyInfo==0) ); + assert( pCur->eState!=CURSOR_VALID || (pIdxKey==0)==(pCur->curIntKey!=0) ); /* If the cursor is already positioned at the point we are trying ** to move to, then just return without doing any work */ - if( pCur->eState==CURSOR_VALID && (pCur->curFlags & BTCF_ValidNKey)!=0 - && pCur->curIntKey + if( pIdxKey==0 + && pCur->eState==CURSOR_VALID && (pCur->curFlags & BTCF_ValidNKey)!=0 ){ if( pCur->info.nKey==intKey ){ *pRes = 0; @@ -63798,9 +64201,7 @@ static int clearCell( static int fillInCell( MemPage *pPage, /* The page that contains the cell */ unsigned char *pCell, /* Complete text of the cell */ - const void *pKey, i64 nKey, /* The key */ - const void *pData,int nData, /* The data */ - int nZero, /* Extra zero bytes to append to pData */ + const BtreePayload *pX, /* Payload with which to construct the cell */ int *pnSize /* Write cell size here */ ){ int nPayload; @@ -63824,26 +64225,23 @@ static int fillInCell( /* Fill in the header. */ nHeader = pPage->childPtrSize; - nPayload = nData + nZero; - if( pPage->intKeyLeaf ){ - nHeader += putVarint32(&pCell[nHeader], nPayload); - }else{ - assert( nData==0 ); - assert( nZero==0 ); - } - nHeader += putVarint(&pCell[nHeader], *(u64*)&nKey); - - /* Fill in the payload size */ if( pPage->intKey ){ - pSrc = pData; - nSrc = nData; - nData = 0; - }else{ - assert( nKey<=0x7fffffff && pKey!=0 ); - nPayload = (int)nKey; - pSrc = pKey; - nSrc = (int)nKey; + nPayload = pX->nData + pX->nZero; + pSrc = pX->pData; + nSrc = pX->nData; + assert( pPage->intKeyLeaf ); /* fillInCell() only called for leaves */ + nHeader += putVarint32(&pCell[nHeader], nPayload); + nHeader += putVarint(&pCell[nHeader], *(u64*)&pX->nKey); + }else{ + assert( pX->nData==0 ); + assert( pX->nZero==0 ); + assert( pX->nKey<=0x7fffffff && pX->pKey!=0 ); + nSrc = nPayload = (int)pX->nKey; + pSrc = pX->pKey; + nHeader += putVarint32(&pCell[nHeader], nPayload); } + + /* Fill in the payload */ if( nPayload<=pPage->maxLocal ){ n = nHeader + nPayload; testcase( n==3 ); @@ -63881,7 +64279,7 @@ static int fillInCell( CellInfo info; pPage->xParseCell(pPage, pCell, &info); assert( nHeader==(int)(info.pPayload - pCell) ); - assert( info.nKey==nKey ); + assert( info.nKey==pX->nKey ); assert( *pnSize == info.nSize ); assert( spaceLeft == info.nLocal ); } @@ -63966,10 +64364,6 @@ static int fillInCell( pSrc += n; nSrc -= n; spaceLeft -= n; - if( nSrc==0 ){ - nSrc = nData; - pSrc = pData; - } } releasePage(pToRelease); return SQLITE_OK; @@ -64036,6 +64430,8 @@ static void dropCell(MemPage *pPage, int idx, int sz, int *pRC){ ** in pTemp or the original pCell) and also record its index. ** Allocating a new entry in pPage->aCell[] implies that ** pPage->nOverflow is incremented. +** +** *pRC must be SQLITE_OK when this routine is called. */ static void insertCell( MemPage *pPage, /* Page into which we are copying */ @@ -64051,8 +64447,7 @@ static void insertCell( u8 *data; /* The content of the whole page */ u8 *pIns; /* The point in pPage->aCellIdx[] where no cell inserted */ - if( *pRC ) return; - + assert( *pRC==SQLITE_OK ); assert( i>=0 && i<=pPage->nCell+pPage->nOverflow ); assert( MX_CELL(pPage->pBt)<=10921 ); assert( pPage->nCell<=MX_CELL(pPage->pBt) || CORRUPT_DB ); @@ -64126,7 +64521,7 @@ static void insertCell( /* ** A CellArray object contains a cache of pointers and sizes for a -** consecutive sequence of cells that might be held multiple pages. +** consecutive sequence of cells that might be held on multiple pages. */ typedef struct CellArray CellArray; struct CellArray { @@ -64558,8 +64953,10 @@ static int balance_quick(MemPage *pParent, MemPage *pPage, u8 *pSpace){ while( ((*(pOut++) = *(pCell++))&0x80) && pCellnCell, pSpace, (int)(pOut-pSpace), - 0, pPage->pgno, &rc); + if( rc==SQLITE_OK ){ + insertCell(pParent, pParent->nCell, pSpace, (int)(pOut-pSpace), + 0, pPage->pgno, &rc); + } /* Set the right-child pointer of pParent to point to the new page. */ put4byte(&pParent->aData[pParent->hdrOffset+8], pgnoNew); @@ -65079,7 +65476,7 @@ static int balance_nonroot( assert( r szLeft-(b.szCell[r]+2)) ){ + && (bBulk || szRight+b.szCell[d]+2 > szLeft-(b.szCell[r]+(i==k-1?0:2)))){ break; } szRight += b.szCell[d] + 2; @@ -65651,13 +66048,19 @@ static int balance(BtCursor *pCur){ /* -** Insert a new record into the BTree. The key is given by (pKey,nKey) -** and the data is given by (pData,nData). The cursor is used only to -** define what table the record should be inserted into. The cursor -** is left pointing at a random location. +** Insert a new record into the BTree. The content of the new record +** is described by the pX object. The pCur cursor is used only to +** define what table the record should be inserted into, and is left +** pointing at a random location. ** -** For an INTKEY table, only the nKey value of the key is used. pKey is -** ignored. For a ZERODATA table, the pData and nData are both ignored. +** For a table btree (used for rowid tables), only the pX.nKey value of +** the key is used. The pX.pKey value must be NULL. The pX.nKey is the +** rowid or INTEGER PRIMARY KEY of the row. The pX.nData,pData,nZero fields +** hold the content of the row. +** +** For an index btree (used for indexes and WITHOUT ROWID tables), the +** key is an arbitrary byte sequence stored in pX.pKey,nKey. The +** pX.pData,nData,nZero fields must be zero. ** ** If the seekResult parameter is non-zero, then a successful call to ** MovetoUnpacked() to seek cursor pCur to (pKey, nKey) has already @@ -65674,9 +66077,7 @@ static int balance(BtCursor *pCur){ */ SQLITE_PRIVATE int sqlite3BtreeInsert( BtCursor *pCur, /* Insert data into the table of this cursor */ - const void *pKey, i64 nKey, /* The key of the new record */ - const void *pData, int nData, /* The data of the new record */ - int nZero, /* Number of extra 0 bytes to append to data */ + const BtreePayload *pX, /* Content of the row to be inserted */ int appendBias, /* True if this is likely an append */ int seekResult /* Result of prior MovetoUnpacked() call */ ){ @@ -65706,7 +66107,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( ** keys with no associated data. If the cursor was opened expecting an ** intkey table, the caller should be inserting integer keys with a ** blob of associated data. */ - assert( (pKey==0)==(pCur->pKeyInfo==0) ); + assert( (pX->pKey==0)==(pCur->pKeyInfo==0) ); /* Save the positions of any other cursors open on this table. ** @@ -65725,38 +66126,38 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( } if( pCur->pKeyInfo==0 ){ - assert( pKey==0 ); + assert( pX->pKey==0 ); /* If this is an insert into a table b-tree, invalidate any incrblob ** cursors open on the row being replaced */ - invalidateIncrblobCursors(p, nKey, 0); + invalidateIncrblobCursors(p, pX->nKey, 0); /* If the cursor is currently on the last row and we are appending a ** new row onto the end, set the "loc" to avoid an unnecessary ** btreeMoveto() call */ - if( (pCur->curFlags&BTCF_ValidNKey)!=0 && nKey>0 - && pCur->info.nKey==nKey-1 ){ + if( (pCur->curFlags&BTCF_ValidNKey)!=0 && pX->nKey>0 + && pCur->info.nKey==pX->nKey-1 ){ loc = -1; }else if( loc==0 ){ - rc = sqlite3BtreeMovetoUnpacked(pCur, 0, nKey, appendBias, &loc); + rc = sqlite3BtreeMovetoUnpacked(pCur, 0, pX->nKey, appendBias, &loc); if( rc ) return rc; } }else if( loc==0 ){ - rc = btreeMoveto(pCur, pKey, nKey, appendBias, &loc); + rc = btreeMoveto(pCur, pX->pKey, pX->nKey, appendBias, &loc); if( rc ) return rc; } assert( pCur->eState==CURSOR_VALID || (pCur->eState==CURSOR_INVALID && loc) ); pPage = pCur->apPage[pCur->iPage]; - assert( pPage->intKey || nKey>=0 ); + assert( pPage->intKey || pX->nKey>=0 ); assert( pPage->leaf || !pPage->intKey ); TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n", - pCur->pgnoRoot, nKey, nData, pPage->pgno, + pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno, loc==0 ? "overwrite" : "new entry")); assert( pPage->isInit ); newCell = pBt->pTmpSpace; assert( newCell!=0 ); - rc = fillInCell(pPage, newCell, pKey, nKey, pData, nData, nZero, &szNew); + rc = fillInCell(pPage, newCell, pX, &szNew); if( rc ) goto end_insert; assert( szNew==pPage->xCellSize(pPage, newCell) ); assert( szNew <= MX_CELL_SIZE(pBt) ); @@ -65782,6 +66183,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( assert( pPage->leaf ); } insertCell(pPage, idx, newCell, szNew, 0, 0, &rc); + assert( pPage->nOverflow==0 || rc==SQLITE_OK ); assert( rc!=SQLITE_OK || pPage->nCell>0 || pPage->nOverflow>0 ); /* If no error has occurred and pPage has an overflow cell, call balance() @@ -65805,7 +66207,8 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( ** row without seeking the cursor. This can be a big performance boost. */ pCur->info.nSize = 0; - if( rc==SQLITE_OK && pPage->nOverflow ){ + if( pPage->nOverflow ){ + assert( rc==SQLITE_OK ); pCur->curFlags &= ~(BTCF_ValidNKey); rc = balance(pCur); @@ -65941,7 +66344,9 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ pTmp = pBt->pTmpSpace; assert( pTmp!=0 ); rc = sqlite3PagerWrite(pLeaf->pDbPage); - insertCell(pPage, iCellIdx, pCell-4, nCell+4, pTmp, n, &rc); + if( rc==SQLITE_OK ){ + insertCell(pPage, iCellIdx, pCell-4, nCell+4, pTmp, n, &rc); + } dropCell(pLeaf, pLeaf->nCell-1, nCell, &rc); if( rc ) return rc; } @@ -67430,6 +67835,16 @@ SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void){ return ROUND8(sizeof(MemPage)); SQLITE_PRIVATE int sqlite3BtreeSharable(Btree *p){ return p->sharable; } + +/* +** Return the number of connections to the BtShared object accessed by +** the Btree handle passed as the only argument. For private caches +** this is always 1. For shared caches it may be 1 or greater. +*/ +SQLITE_PRIVATE int sqlite3BtreeConnectionCount(Btree *p){ + testcase( p->sharable ); + return p->pBt->nRef; +} #endif /************** End of btree.c ***********************************************/ @@ -68213,10 +68628,10 @@ SQLITE_PRIVATE int sqlite3BtreeCopyFile(Btree *pTo, Btree *pFrom){ ** sqlite3_backup_step(), we can guarantee that the copy finishes ** within a single call (unless an error occurs). The assert() statement ** checks this assumption - (p->rc) should be set to either SQLITE_DONE - ** or an error code. - */ + ** or an error code. */ sqlite3_backup_step(&b, 0x7FFFFFFF); assert( b.rc!=SQLITE_OK ); + rc = sqlite3_backup_finish(&b); if( rc==SQLITE_OK ){ pTo->pBt->btsFlags &= ~BTS_PAGESIZE_FIXED; @@ -69227,11 +69642,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemFromBtree( /* Note: the calls to BtreeKeyFetch() and DataFetch() below assert() ** that both the BtShared and database handle mutexes are held. */ assert( (pMem->flags & MEM_RowSet)==0 ); - if( key ){ - zData = (char *)sqlite3BtreeKeyFetch(pCur, &available); - }else{ - zData = (char *)sqlite3BtreeDataFetch(pCur, &available); - } + zData = (char *)sqlite3BtreePayloadFetch(pCur, &available); assert( zData!=0 ); if( offset+amt<=available ){ @@ -70011,14 +70422,6 @@ SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, int isPrepa p->isPrepareV2 = (u8)isPrepareV2; } -/* -** Return the SQL associated with a prepared statement -*/ -SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt){ - Vdbe *p = (Vdbe *)pStmt; - return p ? p->zSql : 0; -} - /* ** Swap all content between two VDBE structures. */ @@ -70738,7 +71141,7 @@ SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe *p, int addr){ ** the FuncDef is not ephermal, then do nothing. */ static void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef){ - if( ALWAYS(pDef) && (pDef->funcFlags & SQLITE_FUNC_EPHEM)!=0 ){ + if( (pDef->funcFlags & SQLITE_FUNC_EPHEM)!=0 ){ sqlite3DbFree(db, pDef); } } @@ -70748,12 +71151,20 @@ static void vdbeFreeOpArray(sqlite3 *, Op *, int); /* ** Delete a P4 value if necessary. */ +static SQLITE_NOINLINE void freeP4Mem(sqlite3 *db, Mem *p){ + if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc); + sqlite3DbFree(db, p); +} +static SQLITE_NOINLINE void freeP4FuncCtx(sqlite3 *db, sqlite3_context *p){ + freeEphemeralFunction(db, p->pFunc); + sqlite3DbFree(db, p); +} static void freeP4(sqlite3 *db, int p4type, void *p4){ assert( db ); switch( p4type ){ case P4_FUNCCTX: { - freeEphemeralFunction(db, ((sqlite3_context*)p4)->pFunc); - /* Fall through into the next case */ + freeP4FuncCtx(db, (sqlite3_context*)p4); + break; } case P4_REAL: case P4_INT64: @@ -70784,9 +71195,7 @@ static void freeP4(sqlite3 *db, int p4type, void *p4){ if( db->pnBytesFreed==0 ){ sqlite3ValueFree((sqlite3_value*)p4); }else{ - Mem *p = (Mem*)p4; - if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc); - sqlite3DbFree(db, p); + freeP4Mem(db, (Mem*)p4); } break; } @@ -74256,8 +74665,7 @@ SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){ ** this code can safely assume that nCellKey is 32-bits */ assert( sqlite3BtreeCursorIsValid(pCur) ); - VVA_ONLY(rc =) sqlite3BtreeKeySize(pCur, &nCellKey); - assert( rc==SQLITE_OK ); /* pCur is always valid so KeySize cannot fail */ + nCellKey = sqlite3BtreePayloadSize(pCur); assert( (nCellKey & SQLITE_MAX_U32)==(u64)nCellKey ); /* Read in the complete content of the index entry */ @@ -74334,8 +74742,7 @@ SQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare( assert( pC->eCurType==CURTYPE_BTREE ); pCur = pC->uc.pCursor; assert( sqlite3BtreeCursorIsValid(pCur) ); - VVA_ONLY(rc =) sqlite3BtreeKeySize(pCur, &nCellKey); - assert( rc==SQLITE_OK ); /* pCur is always valid so KeySize cannot fail */ + nCellKey = sqlite3BtreePayloadSize(pCur); /* nCellKey will always be between 0 and 0xffffffff because of the way ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */ if( nCellKey<=0 || nCellKey>0x7fffffff ){ @@ -74597,12 +75004,19 @@ static int vdbeSafetyNotNull(Vdbe *p){ */ static SQLITE_NOINLINE void invokeProfileCallback(sqlite3 *db, Vdbe *p){ sqlite3_int64 iNow; + sqlite3_int64 iElapse; assert( p->startTime>0 ); - assert( db->xProfile!=0 ); + assert( db->xProfile!=0 || (db->mTrace & SQLITE_TRACE_PROFILE)!=0 ); assert( db->init.busy==0 ); assert( p->zSql!=0 ); sqlite3OsCurrentTimeInt64(db->pVfs, &iNow); - db->xProfile(db->pProfileArg, p->zSql, (iNow - p->startTime)*1000000); + iElapse = (iNow - p->startTime)*1000000; + if( db->xProfile ){ + db->xProfile(db->pProfileArg, p->zSql, iElapse); + } + if( db->mTrace & SQLITE_TRACE_PROFILE ){ + db->xTrace(SQLITE_TRACE_PROFILE, db->pTraceArg, p, (void*)&iElapse); + } p->startTime = 0; } /* @@ -75106,7 +75520,8 @@ static int sqlite3Step(Vdbe *p){ ); #ifndef SQLITE_OMIT_TRACE - if( db->xProfile && !db->init.busy && p->zSql ){ + if( (db->xProfile || (db->mTrace & SQLITE_TRACE_PROFILE)!=0) + && !db->init.busy && p->zSql ){ sqlite3OsCurrentTimeInt64(db->pVfs, &p->startTime); }else{ assert( p->startTime==0 ); @@ -76141,6 +76556,39 @@ SQLITE_API int SQLITE_STDCALL sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, i return (int)v; } +/* +** Return the SQL associated with a prepared statement +*/ +SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt){ + Vdbe *p = (Vdbe *)pStmt; + return p ? p->zSql : 0; +} + +/* +** Return the SQL associated with a prepared statement with +** bound parameters expanded. Space to hold the returned string is +** obtained from sqlite3_malloc(). The caller is responsible for +** freeing the returned string by passing it to sqlite3_free(). +** +** The SQLITE_TRACE_SIZE_LIMIT puts an upper bound on the size of +** expanded bound parameters. +*/ +SQLITE_API char *SQLITE_STDCALL sqlite3_expanded_sql(sqlite3_stmt *pStmt){ +#ifdef SQLITE_OMIT_TRACE + return 0; +#else + char *z = 0; + const char *zSql = sqlite3_sql(pStmt); + if( zSql ){ + Vdbe *p = (Vdbe *)pStmt; + sqlite3_mutex_enter(p->db->mutex); + z = sqlite3VdbeExpandSql(p, zSql); + sqlite3_mutex_leave(p->db->mutex); + } + return z; +#endif +} + #ifdef SQLITE_ENABLE_PREUPDATE_HOOK /* ** Allocate and populate an UnpackedRecord structure based on the serialized @@ -76187,8 +76635,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlit u32 nRec; u8 *aRec; - rc = sqlite3BtreeDataSize(p->pCsr->uc.pCursor, &nRec); - if( rc!=SQLITE_OK ) goto preupdate_old_out; + nRec = sqlite3BtreePayloadSize(p->pCsr->uc.pCursor); aRec = sqlite3DbMallocRaw(db, nRec); if( !aRec ) goto preupdate_old_out; rc = sqlite3BtreeData(p->pCsr->uc.pCursor, 0, nRec, aRec); @@ -76476,10 +76923,13 @@ SQLITE_PRIVATE char *sqlite3VdbeExpandSql( int i; /* Loop counter */ Mem *pVar; /* Value of a host parameter */ StrAccum out; /* Accumulate the output here */ +#ifndef SQLITE_OMIT_UTF16 + Mem utf8; /* Used to convert UTF16 parameters into UTF8 for display */ +#endif char zBase[100]; /* Initial working space */ db = p->db; - sqlite3StrAccumInit(&out, db, zBase, sizeof(zBase), + sqlite3StrAccumInit(&out, 0, zBase, sizeof(zBase), db->aLimit[SQLITE_LIMIT_LENGTH]); if( db->nVdbeExec>1 ){ while( *zRawSql ){ @@ -76530,12 +76980,14 @@ SQLITE_PRIVATE char *sqlite3VdbeExpandSql( int nOut; /* Number of bytes of the string text to include in output */ #ifndef SQLITE_OMIT_UTF16 u8 enc = ENC(db); - Mem utf8; if( enc!=SQLITE_UTF8 ){ memset(&utf8, 0, sizeof(utf8)); utf8.db = db; sqlite3VdbeMemSetStr(&utf8, pVar->z, pVar->n, enc, SQLITE_STATIC); - sqlite3VdbeChangeEncoding(&utf8, SQLITE_UTF8); + if( SQLITE_NOMEM==sqlite3VdbeChangeEncoding(&utf8, SQLITE_UTF8) ){ + out.accError = STRACCUM_NOMEM; + out.nAlloc = 0; + } pVar = &utf8; } #endif @@ -76577,6 +77029,7 @@ SQLITE_PRIVATE char *sqlite3VdbeExpandSql( } } } + if( out.accError ) sqlite3StrAccumReset(&out); return sqlite3StrAccumFinish(&out); } @@ -77109,8 +77562,8 @@ static void registerTrace(int iReg, Mem *p){ ** This file contains inline asm code for retrieving "high-performance" ** counters for x86 class CPUs. */ -#ifndef _HWTIME_H_ -#define _HWTIME_H_ +#ifndef SQLITE_HWTIME_H +#define SQLITE_HWTIME_H /* ** The following routine only works on pentium-class (or newer) processors. @@ -77178,7 +77631,7 @@ SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } #endif -#endif /* !defined(_HWTIME_H_) */ +#endif /* !defined(SQLITE_HWTIME_H) */ /************** End of hwtime.h **********************************************/ /************** Continuing where we left off in vdbe.c ***********************/ @@ -78058,6 +78511,10 @@ case OP_ResultRow: { } if( db->mallocFailed ) goto no_mem; + if( db->mTrace & SQLITE_TRACE_ROW ){ + db->xTrace(SQLITE_TRACE_ROW, db->pTraceArg, p, 0); + } + /* Return SQLITE_ROW */ p->pc = (int)(pOp - aOp) + 1; @@ -78691,6 +79148,7 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */ if( (flags1 | flags3)&MEM_Str ){ if( (flags1 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){ applyNumericAffinity(pIn1,0); + flags3 = pIn3->flags; } if( (flags3 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){ applyNumericAffinity(pIn3,0); @@ -78703,6 +79161,7 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */ sqlite3VdbeMemStringify(pIn1, encoding, 1); testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) ); flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask); + flags3 = pIn3->flags; } if( (flags3 & MEM_Str)==0 && (flags3 & (MEM_Int|MEM_Real))!=0 ){ testcase( pIn3->flags & MEM_Int ); @@ -79055,7 +79514,6 @@ case OP_NotNull: { /* same as TK_NOTNULL, jump, in1 */ ** skipped for length() and all content loading can be skipped for typeof(). */ case OP_Column: { - i64 payloadSize64; /* Number of bytes in the record */ int p2; /* column number to retrieve */ VdbeCursor *pC; /* The VDBE cursor */ BtCursor *pCrsr; /* The BTree cursor */ @@ -79078,6 +79536,7 @@ case OP_Column: { /* If the cursor cache is stale, bring it up-to-date */ rc = sqlite3VdbeCursorMoveto(&pC, &p2); + if( rc ) goto abort_due_to_error; assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) ); pDest = &aMem[pOp->p3]; @@ -79091,8 +79550,7 @@ case OP_Column: { assert( pC->eCurType!=CURTYPE_SORTER ); pCrsr = pC->uc.pCursor; - if( rc ) goto abort_due_to_error; - if( pC->cacheStatus!=p->cacheCtr ){ + if( pC->cacheStatus!=p->cacheCtr ){ /*OPTIMIZATION-IF-FALSE*/ if( pC->nullRow ){ if( pC->eCurType==CURTYPE_PSEUDO ){ assert( pC->uc.pseudoTableReg>0 ); @@ -79108,22 +79566,9 @@ case OP_Column: { }else{ assert( pC->eCurType==CURTYPE_BTREE ); assert( pCrsr ); - if( pC->isTable==0 ){ - assert( sqlite3BtreeCursorIsValid(pCrsr) ); - VVA_ONLY(rc =) sqlite3BtreeKeySize(pCrsr, &payloadSize64); - assert( rc==SQLITE_OK ); /* True because of CursorMoveto() call above */ - /* sqlite3BtreeParseCellPtr() uses getVarint32() to extract the - ** payload size, so it is impossible for payloadSize64 to be - ** larger than 32 bits. */ - assert( (payloadSize64 & SQLITE_MAX_U32)==(u64)payloadSize64 ); - pC->aRow = sqlite3BtreeKeyFetch(pCrsr, &avail); - pC->payloadSize = (u32)payloadSize64; - }else{ - assert( sqlite3BtreeCursorIsValid(pCrsr) ); - VVA_ONLY(rc =) sqlite3BtreeDataSize(pCrsr, &pC->payloadSize); - assert( rc==SQLITE_OK ); /* DataSize() cannot fail */ - pC->aRow = sqlite3BtreeDataFetch(pCrsr, &avail); - } + assert( sqlite3BtreeCursorIsValid(pCrsr) ); + pC->payloadSize = sqlite3BtreePayloadSize(pCrsr); + pC->aRow = sqlite3BtreePayloadFetch(pCrsr, &avail); assert( avail<=65536 ); /* Maximum page size is 64KiB */ if( pC->payloadSize <= (u32)avail ){ pC->szRow = pC->payloadSize; @@ -79139,7 +79584,7 @@ case OP_Column: { aOffset[0] = offset; - if( availaRow does not have to hold the entire row, but it does at least ** need to cover the header of the record. If pC->aRow does not contain ** the complete header, then set it to zero, forcing the header to be @@ -79160,14 +79605,15 @@ case OP_Column: { rc = SQLITE_CORRUPT_BKPT; goto abort_due_to_error; } + }else if( offset>0 ){ /*OPTIMIZATION-IF-TRUE*/ + /* The following goto is an optimization. It can be omitted and + ** everything will still work. But OP_Column is measurably faster + ** by skipping the subsequent conditional, which is always true. + */ + zData = pC->aRow; + assert( pC->nHdrParsed<=p2 ); /* Conditional skipped */ + goto op_column_read_header; } - - /* The following goto is an optimization. It can be omitted and - ** everything will still work. But OP_Column is measurably faster - ** by skipping the subsequent conditional, which is always true. - */ - assert( pC->nHdrParsed<=p2 ); /* Conditional skipped */ - goto op_column_read_header; } /* Make sure at least the first p2+1 entries of the header have been @@ -79177,7 +79623,6 @@ case OP_Column: { /* If there is more header available for parsing in the record, try ** to extract additional fields up through the p2+1-th field */ - op_column_read_header: if( pC->iHdrOffsetaRow==0 ){ @@ -79190,11 +79635,11 @@ case OP_Column: { } /* Fill in pC->aType[i] and aOffset[i] values through the p2-th field. */ + op_column_read_header: i = pC->nHdrParsed; offset64 = aOffset[i]; zHdr = zData + pC->iHdrOffset; zEndHdr = zData + aOffset[0]; - assert( i<=p2 && zHdraType[i++] = t; aOffset[i] = (u32)(offset64 & 0xffffffff); }while( i<=p2 && zHdrnHdrParsed = i; - pC->iHdrOffset = (u32)(zHdr - zData); - + /* The record is corrupt if any of the following are true: ** (1) the bytes of the header extend past the declared header size ** (2) the entire header was used but not all data was used @@ -79221,8 +79664,10 @@ case OP_Column: { rc = SQLITE_CORRUPT_BKPT; goto abort_due_to_error; } - if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem); + pC->nHdrParsed = i; + pC->iHdrOffset = (u32)(zHdr - zData); + if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem); }else{ t = 0; } @@ -79250,9 +79695,10 @@ case OP_Column: { assert( p2nHdrParsed ); assert( rc==SQLITE_OK ); assert( sqlite3VdbeCheckMemInvariants(pDest) ); - if( VdbeMemDynamic(pDest) ) sqlite3VdbeMemSetNull(pDest); + if( VdbeMemDynamic(pDest) ){ + sqlite3VdbeMemSetNull(pDest); + } assert( t==pC->aType[p2] ); - pDest->enc = encoding; if( pC->szRow>=aOffset[p2+1] ){ /* This is the common case where the desired content fits on the original ** page - where the content is not on an overflow page */ @@ -79266,6 +79712,7 @@ case OP_Column: { */ static const u16 aFlag[] = { MEM_Blob, MEM_Str|MEM_Term }; pDest->n = len = (t-12)/2; + pDest->enc = encoding; if( pDest->szMalloc < len+2 ){ pDest->flags = MEM_Null; if( sqlite3VdbeMemGrow(pDest, len+2, 0) ) goto no_mem; @@ -79278,6 +79725,7 @@ case OP_Column: { pDest->flags = aFlag[t&1]; } }else{ + pDest->enc = encoding; /* This branch happens only when content is on overflow pages */ if( ((pOp->p5 & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG))!=0 && ((t>=12 && (t&1)==0) || (pOp->p5 & OPFLAG_TYPEOFARG)!=0)) @@ -80695,6 +81143,30 @@ case OP_Found: { /* jump, in3 */ break; } +/* Opcode: SeekRowid P1 P2 P3 * * +** Synopsis: intkey=r[P3] +** +** P1 is the index of a cursor open on an SQL table btree (with integer +** keys). If register P3 does not contain an integer or if P1 does not +** contain a record with rowid P3 then jump immediately to P2. +** Or, if P2 is 0, raise an SQLITE_CORRUPT error. If P1 does contain +** a record with rowid P3 then +** leave the cursor pointing at that record and fall through to the next +** instruction. +** +** The OP_NotExists opcode performs the same operation, but with OP_NotExists +** the P3 register must be guaranteed to contain an integer value. With this +** opcode, register P3 might not contain an integer. +** +** The OP_NotFound opcode performs the same operation on index btrees +** (with arbitrary multi-value keys). +** +** This opcode leaves the cursor in a state where it cannot be advanced +** in either direction. In other words, the Next and Prev opcodes will +** not work following this opcode. +** +** See also: Found, NotFound, NoConflict, SeekRowid +*/ /* Opcode: NotExists P1 P2 P3 * * ** Synopsis: intkey=r[P3] ** @@ -80705,6 +81177,10 @@ case OP_Found: { /* jump, in3 */ ** leave the cursor pointing at that record and fall through to the next ** instruction. ** +** The OP_SeekRowid opcode performs the same operation but also allows the +** P3 register to contain a non-integer value, in which case the jump is +** always taken. This opcode requires that P3 always contain an integer. +** ** The OP_NotFound opcode performs the same operation on index btrees ** (with arbitrary multi-value keys). ** @@ -80712,14 +81188,21 @@ case OP_Found: { /* jump, in3 */ ** in either direction. In other words, the Next and Prev opcodes will ** not work following this opcode. ** -** See also: Found, NotFound, NoConflict +** See also: Found, NotFound, NoConflict, SeekRowid */ -case OP_NotExists: { /* jump, in3 */ +case OP_SeekRowid: { /* jump, in3 */ VdbeCursor *pC; BtCursor *pCrsr; int res; u64 iKey; + pIn3 = &aMem[pOp->p3]; + if( (pIn3->flags & MEM_Int)==0 ){ + applyAffinity(pIn3, SQLITE_AFF_NUMERIC, encoding); + if( (pIn3->flags & MEM_Int)==0 ) goto jump_to_p2; + } + /* Fall through into OP_NotExists */ +case OP_NotExists: /* jump, in3 */ pIn3 = &aMem[pOp->p3]; assert( pIn3->flags & MEM_Int ); assert( pOp->p1>=0 && pOp->p1nCursor ); @@ -80838,8 +81321,7 @@ case OP_NewRowid: { /* out2 */ v = 1; /* IMP: R-61914-48074 */ }else{ assert( sqlite3BtreeCursorIsValid(pC->uc.pCursor) ); - rc = sqlite3BtreeKeySize(pC->uc.pCursor, &v); - assert( rc==SQLITE_OK ); /* Cannot fail following BtreeLast() */ + v = sqlite3BtreeIntegerKey(pC->uc.pCursor); if( v>=MAX_ROWID ){ pC->useRandomRowid = 1; }else{ @@ -80922,10 +81404,12 @@ case OP_NewRowid: { /* out2 */ ** sqlite3_last_insert_rowid() function (otherwise it is unmodified). ** ** If the OPFLAG_USESEEKRESULT flag of P5 is set and if the result of -** the last seek operation (OP_NotExists) was a success, then this +** the last seek operation (OP_NotExists or OP_SeekRowid) was a success, +** then this ** operation will not attempt to find the appropriate row before doing ** the insert but will instead overwrite the row that the cursor is -** currently pointing to. Presumably, the prior OP_NotExists opcode +** currently pointing to. Presumably, the prior OP_NotExists or +** OP_SeekRowid opcode ** has already positioned the cursor correctly. This is an optimization ** that boosts performance by avoiding redundant seeks. ** @@ -80957,13 +81441,12 @@ case OP_Insert: case OP_InsertInt: { Mem *pData; /* MEM cell holding data for the record to be inserted */ Mem *pKey; /* MEM cell holding key for the record */ - i64 iKey; /* The integer ROWID or key for the record to be inserted */ VdbeCursor *pC; /* Cursor to table into which insert is written */ - int nZero; /* Number of zero-bytes to append */ int seekResult; /* Result of prior seek or 0 if no USESEEKRESULT flag */ const char *zDb; /* database name - used by the update hook */ Table *pTab; /* Table structure - used by update and pre-update hooks */ int op; /* Opcode for update hook: SQLITE_UPDATE or SQLITE_INSERT */ + BtreePayload x; /* Payload to be inserted */ op = 0; pData = &aMem[pOp->p2]; @@ -80982,10 +81465,10 @@ case OP_InsertInt: { assert( pKey->flags & MEM_Int ); assert( memIsValid(pKey) ); REGISTER_TRACE(pOp->p3, pKey); - iKey = pKey->u.i; + x.nKey = pKey->u.i; }else{ assert( pOp->opcode==OP_InsertInt ); - iKey = pOp->p3; + x.nKey = pOp->p3; } if( pOp->p4type==P4_TABLE && HAS_UPDATE_HOOK(db) ){ @@ -81006,26 +81489,28 @@ case OP_InsertInt: { && pOp->p4type==P4_TABLE && !(pOp->p5 & OPFLAG_ISUPDATE) ){ - sqlite3VdbePreUpdateHook(p, pC, SQLITE_INSERT, zDb, pTab, iKey, pOp->p2); + sqlite3VdbePreUpdateHook(p, pC, SQLITE_INSERT, zDb, pTab, x.nKey, pOp->p2); } #endif if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++; - if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = lastRowid = iKey; + if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = lastRowid = x.nKey; if( pData->flags & MEM_Null ){ - pData->z = 0; - pData->n = 0; + x.pData = 0; + x.nData = 0; }else{ assert( pData->flags & (MEM_Blob|MEM_Str) ); + x.pData = pData->z; + x.nData = pData->n; } seekResult = ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0); if( pData->flags & MEM_Zero ){ - nZero = pData->u.nZero; + x.nZero = pData->u.nZero; }else{ - nZero = 0; + x.nZero = 0; } - rc = sqlite3BtreeInsert(pC->uc.pCursor, 0, iKey, - pData->z, pData->n, nZero, + x.pKey = 0; + rc = sqlite3BtreeInsert(pC->uc.pCursor, &x, (pOp->p5 & OPFLAG_APPEND)!=0, seekResult ); pC->deferredMoveto = 0; @@ -81034,7 +81519,7 @@ case OP_InsertInt: { /* Invoke the update-hook if required. */ if( rc ) goto abort_due_to_error; if( db->xUpdateCallback && op ){ - db->xUpdateCallback(db->pUpdateArg, op, zDb, pTab->zName, iKey); + db->xUpdateCallback(db->pUpdateArg, op, zDb, pTab->zName, x.nKey); } break; } @@ -81093,8 +81578,7 @@ case OP_Delete: { /* If p5 is zero, the seek operation that positioned the cursor prior to ** OP_Delete will have also set the pC->movetoTarget field to the rowid of ** the row that is being deleted */ - i64 iKey = 0; - sqlite3BtreeKeySize(pC->uc.pCursor, &iKey); + i64 iKey = sqlite3BtreeIntegerKey(pC->uc.pCursor); assert( pC->movetoTarget==iKey ); } #endif @@ -81110,7 +81594,7 @@ case OP_Delete: { zDb = db->aDb[pC->iDb].zName; pTab = pOp->p4.pTab; if( (pOp->p5 & OPFLAG_SAVEPOSITION)!=0 && pC->isTable ){ - sqlite3BtreeKeySize(pC->uc.pCursor, &pC->movetoTarget); + pC->movetoTarget = sqlite3BtreeIntegerKey(pC->uc.pCursor); } }else{ zDb = 0; /* Not needed. Silence a compiler warning. */ @@ -81264,7 +81748,6 @@ case OP_RowData: { VdbeCursor *pC; BtCursor *pCrsr; u32 n; - i64 n64; pOut = &aMem[pOp->p2]; memAboutToChange(p, pOut); @@ -81282,8 +81765,9 @@ case OP_RowData: { pCrsr = pC->uc.pCursor; /* The OP_RowKey and OP_RowData opcodes always follow OP_NotExists or - ** OP_Rewind/Op_Next with no intervening instructions that might invalidate - ** the cursor. If this where not the case, on of the following assert()s + ** OP_SeekRowid or OP_Rewind/Op_Next with no intervening instructions + ** that might invalidate the cursor. + ** If this where not the case, on of the following assert()s ** would fail. Should this ever change (because of changes in the code ** generator) then the fix would be to insert a call to ** sqlite3VdbeCursorMoveto(). @@ -81295,20 +81779,9 @@ case OP_RowData: { if( rc!=SQLITE_OK ) goto abort_due_to_error; #endif - if( pC->isTable==0 ){ - assert( !pC->isTable ); - VVA_ONLY(rc =) sqlite3BtreeKeySize(pCrsr, &n64); - assert( rc==SQLITE_OK ); /* True because of CursorMoveto() call above */ - if( n64>db->aLimit[SQLITE_LIMIT_LENGTH] ){ - goto too_big; - } - n = (u32)n64; - }else{ - VVA_ONLY(rc =) sqlite3BtreeDataSize(pCrsr, &n); - assert( rc==SQLITE_OK ); /* DataSize() cannot fail */ - if( n>(u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){ - goto too_big; - } + n = sqlite3BtreePayloadSize(pCrsr); + if( n>(u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){ + goto too_big; } testcase( n==0 ); if( sqlite3VdbeMemClearAndResize(pOut, MAX(n,32)) ){ @@ -81373,8 +81846,7 @@ case OP_Rowid: { /* out2 */ pOut->flags = MEM_Null; break; } - rc = sqlite3BtreeKeySize(pC->uc.pCursor, &v); - assert( rc==SQLITE_OK ); /* Always so because of CursorRestore() above */ + v = sqlite3BtreeIntegerKey(pC->uc.pCursor); } pOut->u.i = v; break; @@ -81649,8 +82121,7 @@ next_tail: case OP_SorterInsert: /* in2 */ case OP_IdxInsert: { /* in2 */ VdbeCursor *pC; - int nKey; - const char *zKey; + BtreePayload x; assert( pOp->p1>=0 && pOp->p1nCursor ); pC = p->apCsr[pOp->p1]; @@ -81666,9 +82137,12 @@ case OP_IdxInsert: { /* in2 */ if( pOp->opcode==OP_SorterInsert ){ rc = sqlite3VdbeSorterWrite(pC, pIn2); }else{ - nKey = pIn2->n; - zKey = pIn2->z; - rc = sqlite3BtreeInsert(pC->uc.pCursor, zKey, nKey, "", 0, 0, pOp->p3, + x.nKey = pIn2->n; + x.pKey = pIn2->z; + x.nData = 0; + x.nZero = 0; + x.pData = 0; + rc = sqlite3BtreeInsert(pC->uc.pCursor, &x, pOp->p3, ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0) ); assert( pC->deferredMoveto==0 ); @@ -83436,16 +83910,34 @@ case OP_MaxPgcnt: { /* out2 */ */ case OP_Init: { /* jump */ char *zTrace; - char *z; + + /* If the P4 argument is not NULL, then it must be an SQL comment string. + ** The "--" string is broken up to prevent false-positives with srcck1.c. + ** + ** This assert() provides evidence for: + ** EVIDENCE-OF: R-50676-09860 The callback can compute the same text that + ** would have been returned by the legacy sqlite3_trace() interface by + ** using the X argument when X begins with "--" and invoking + ** sqlite3_expanded_sql(P) otherwise. + */ + assert( pOp->p4.z==0 || strncmp(pOp->p4.z, "-" "- ", 3)==0 ); #ifndef SQLITE_OMIT_TRACE - if( db->xTrace + if( (db->mTrace & (SQLITE_TRACE_STMT|SQLITE_TRACE_LEGACY))!=0 && !p->doingRerun && (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0 ){ - z = sqlite3VdbeExpandSql(p, zTrace); - db->xTrace(db->pTraceArg, z); - sqlite3DbFree(db, z); +#ifndef SQLITE_OMIT_DEPRECATED + if( db->mTrace & SQLITE_TRACE_LEGACY ){ + void (*x)(void*,const char*) = (void(*)(void*,const char*))db->xTrace; + char *z = sqlite3VdbeExpandSql(p, zTrace); + x(db->pTraceArg, z); + sqlite3_free(z); + }else +#endif + { + (void)db->xTrace(SQLITE_TRACE_STMT, db->pTraceArg, p, zTrace); + } } #ifdef SQLITE_USE_FCNTL_TRACE zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql); @@ -84028,7 +84520,7 @@ static int blobReadWrite( ** anyhow. */ sqlite3_int64 iKey; - sqlite3BtreeKeySize(p->pCsr, &iKey); + iKey = sqlite3BtreeIntegerKey(p->pCsr); sqlite3VdbePreUpdateHook( v, v->apCsr[0], SQLITE_DELETE, p->zDb, p->pTab, iKey, -1 ); @@ -85463,19 +85955,18 @@ static int vdbeSortAllocUnpacked(SortSubtask *pTask){ /* ** Merge the two sorted lists p1 and p2 into a single list. -** Set *ppOut to the head of the new list. */ -static void vdbeSorterMerge( +static SorterRecord *vdbeSorterMerge( SortSubtask *pTask, /* Calling thread context */ SorterRecord *p1, /* First list to merge */ - SorterRecord *p2, /* Second list to merge */ - SorterRecord **ppOut /* OUT: Head of merged list */ + SorterRecord *p2 /* Second list to merge */ ){ SorterRecord *pFinal = 0; SorterRecord **pp = &pFinal; int bCached = 0; - while( p1 && p2 ){ + assert( p1!=0 && p2!=0 ); + for(;;){ int res; res = pTask->xCompare( pTask, &bCached, SRVAL(p1), p1->nVal, SRVAL(p2), p2->nVal @@ -85485,15 +85976,22 @@ static void vdbeSorterMerge( *pp = p1; pp = &p1->u.pNext; p1 = p1->u.pNext; + if( p1==0 ){ + *pp = p2; + break; + } }else{ *pp = p2; pp = &p2->u.pNext; p2 = p2->u.pNext; bCached = 0; + if( p2==0 ){ + *pp = p1; + break; + } } } - *pp = p1 ? p1 : p2; - *ppOut = pFinal; + return pFinal; } /* @@ -85546,7 +86044,7 @@ static int vdbeSorterSort(SortSubtask *pTask, SorterList *pList){ p->u.pNext = 0; for(i=0; aSlot[i]; i++){ - vdbeSorterMerge(pTask, p, aSlot[i], &p); + p = vdbeSorterMerge(pTask, p, aSlot[i]); aSlot[i] = 0; } aSlot[i] = p; @@ -85555,7 +86053,8 @@ static int vdbeSorterSort(SortSubtask *pTask, SorterList *pList){ p = 0; for(i=0; i<64; i++){ - vdbeSorterMerge(pTask, p, aSlot[i], &p); + if( aSlot[i]==0 ) continue; + p = p ? vdbeSorterMerge(pTask, p, aSlot[i]) : aSlot[i]; } pList->pList = p; @@ -88175,7 +88674,11 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ sqlite3ErrorMsg(pParse, "misuse of aggregate function %.*s()", nId,zId); pNC->nErr++; is_agg = 0; - }else if( no_such_func && pParse->db->init.busy==0 ){ + }else if( no_such_func && pParse->db->init.busy==0 +#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION + && pParse->explain==0 +#endif + ){ sqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId); pNC->nErr++; }else if( wrong_num_args ){ @@ -90775,6 +91278,11 @@ SQLITE_PRIVATE int sqlite3FindInIndex(Parse *pParse, Expr *pX, u32 inFlags, int eType = IN_INDEX_INDEX_ASC + pIdx->aSortOrder[0]; if( prRhsHasNull && !pTab->aCol[iCol].notNull ){ +#ifdef SQLITE_ENABLE_COLUMN_USED_MASK + const i64 sOne = 1; + sqlite3VdbeAddOp4Dup8(v, OP_ColumnsUsed, + iTab, 0, 0, (u8*)&sOne, P4_INT64); +#endif *prRhsHasNull = ++pParse->nMem; sqlite3SetHasNullFlag(v, iTab, *prRhsHasNull); } @@ -90787,7 +91295,7 @@ SQLITE_PRIVATE int sqlite3FindInIndex(Parse *pParse, Expr *pX, u32 inFlags, int /* If no preexisting index is available for the IN clause ** and IN_INDEX_NOOP is an allowed reply ** and the RHS of the IN operator is a list, not a subquery - ** and the RHS is not contant or has two or fewer terms, + ** and the RHS is not constant or has two or fewer terms, ** then it is not worth creating an ephemeral table to evaluate ** the IN operator so return IN_INDEX_NOOP. */ @@ -91179,8 +91687,7 @@ static void sqlite3ExprCodeIN( if( eType==IN_INDEX_ROWID ){ /* In this case, the RHS is the ROWID of table b-tree */ - sqlite3VdbeAddOp2(v, OP_MustBeInt, r1, destIfFalse); VdbeCoverage(v); - sqlite3VdbeAddOp3(v, OP_NotExists, pExpr->iTable, destIfFalse, r1); + sqlite3VdbeAddOp3(v, OP_SeekRowid, pExpr->iTable, destIfFalse, r1); VdbeCoverage(v); }else{ /* In this case, the RHS is an index b-tree. @@ -91493,7 +92000,7 @@ SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable( }else{ int op = IsVirtual(pTab) ? OP_VColumn : OP_Column; int x = iCol; - if( !HasRowid(pTab) ){ + if( !HasRowid(pTab) && !IsVirtual(pTab) ){ x = sqlite3ColumnOfIndex(sqlite3PrimaryKeyIndex(pTab), iCol); } sqlite3VdbeAddOp3(v, op, iTabCur, x, regOut); @@ -91896,6 +92403,11 @@ SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target) assert( !ExprHasProperty(pExpr, EP_IntValue) ); zId = pExpr->u.zToken; pDef = sqlite3FindFunction(db, zId, nFarg, enc, 0); +#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION + if( pDef==0 && pParse->explain ){ + pDef = sqlite3FindFunction(db, "unknown", nFarg, enc, 0); + } +#endif if( pDef==0 || pDef->xFinalize!=0 ){ sqlite3ErrorMsg(pParse, "unknown function: %s()", zId); break; @@ -92918,6 +93430,61 @@ SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Expr *pE1, Expr *pE2, int iTab){ return 0; } +/* +** An instance of the following structure is used by the tree walker +** to determine if an expression can be evaluated by reference to the +** index only, without having to do a search for the corresponding +** table entry. The IdxCover.pIdx field is the index. IdxCover.iCur +** is the cursor for the table. +*/ +struct IdxCover { + Index *pIdx; /* The index to be tested for coverage */ + int iCur; /* Cursor number for the table corresponding to the index */ +}; + +/* +** Check to see if there are references to columns in table +** pWalker->u.pIdxCover->iCur can be satisfied using the index +** pWalker->u.pIdxCover->pIdx. +*/ +static int exprIdxCover(Walker *pWalker, Expr *pExpr){ + if( pExpr->op==TK_COLUMN + && pExpr->iTable==pWalker->u.pIdxCover->iCur + && sqlite3ColumnOfIndex(pWalker->u.pIdxCover->pIdx, pExpr->iColumn)<0 + ){ + pWalker->eCode = 1; + return WRC_Abort; + } + return WRC_Continue; +} + +/* +** Determine if an index pIdx on table with cursor iCur contains will +** the expression pExpr. Return true if the index does cover the +** expression and false if the pExpr expression references table columns +** that are not found in the index pIdx. +** +** An index covering an expression means that the expression can be +** evaluated using only the index and without having to lookup the +** corresponding table entry. +*/ +SQLITE_PRIVATE int sqlite3ExprCoveredByIndex( + Expr *pExpr, /* The index to be tested */ + int iCur, /* The cursor number for the corresponding table */ + Index *pIdx /* The index that might be used for coverage */ +){ + Walker w; + struct IdxCover xcov; + memset(&w, 0, sizeof(w)); + xcov.iCur = iCur; + xcov.pIdx = pIdx; + w.xExprCallback = exprIdxCover; + w.u.pIdxCover = &xcov; + sqlite3WalkExpr(&w, pExpr); + return !w.eCode; +} + + /* ** An instance of the following structure is used by the tree walker ** to count references to table columns in the arguments of an @@ -93872,6 +94439,7 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ Expr *pDflt; /* Default value for the new column */ sqlite3 *db; /* The database connection; */ Vdbe *v = pParse->pVdbe; /* The prepared statement under construction */ + int r1; /* Temporary registers */ db = pParse->db; if( pParse->nErr || db->mallocFailed ) return; @@ -93966,16 +94534,18 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ db->flags = savedDbFlags; } - /* If the default value of the new column is NULL, then the file - ** format to 2. If the default value of the new column is not NULL, - ** the file format be 3. Back when this feature was first added - ** in 2006, we went to the trouble to upgrade the file format to the - ** minimum support values. But 10-years on, we can assume that all - ** extent versions of SQLite support file-format 4, so we always and - ** unconditionally upgrade to 4. + /* Make sure the schema version is at least 3. But do not upgrade + ** from less than 3 to 4, as that will corrupt any preexisting DESC + ** index. */ - sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, - SQLITE_MAX_FILE_FORMAT); + r1 = sqlite3GetTempReg(pParse); + sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, r1, BTREE_FILE_FORMAT); + sqlite3VdbeUsesBtree(v, iDb); + sqlite3VdbeAddOp2(v, OP_AddImm, r1, -2); + sqlite3VdbeAddOp2(v, OP_IfPos, r1, sqlite3VdbeCurrentAddr(v)+2); + VdbeCoverage(v); + sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, 3); + sqlite3ReleaseTempReg(pParse, r1); /* Reload the schema of the modified table. */ reloadTableSchema(pParse, pTab, pTab->zName); @@ -96664,6 +97234,7 @@ SQLITE_PRIVATE int sqlite3AuthReadCol( char *zDb = db->aDb[iDb].zName; /* Name of attached database */ int rc; /* Auth callback return code */ + if( db->init.busy ) return SQLITE_OK; rc = db->xAuth(db->pAuthArg, SQLITE_READ, zTab,zCol,zDb,pParse->zAuthContext #ifdef SQLITE_USER_AUTHENTICATION ,db->auth.zAuthUser @@ -97154,7 +97725,7 @@ SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3 *db, const char *zName, const cha */ SQLITE_PRIVATE Table *sqlite3LocateTable( Parse *pParse, /* context in which to report errors */ - int isView, /* True if looking for a VIEW rather than a TABLE */ + u32 flags, /* LOCATE_VIEW or LOCATE_NOERR */ const char *zName, /* Name of the table we are looking for */ const char *zDbase /* Name of the database. Might be NULL */ ){ @@ -97168,7 +97739,7 @@ SQLITE_PRIVATE Table *sqlite3LocateTable( p = sqlite3FindTable(pParse->db, zName, zDbase); if( p==0 ){ - const char *zMsg = isView ? "no such view" : "no such table"; + const char *zMsg = flags & LOCATE_VIEW ? "no such view" : "no such table"; #ifndef SQLITE_OMIT_VIRTUALTABLE if( sqlite3FindDbName(pParse->db, zDbase)<1 ){ /* If zName is the not the name of a table in the schema created using @@ -97180,12 +97751,14 @@ SQLITE_PRIVATE Table *sqlite3LocateTable( } } #endif - if( zDbase ){ - sqlite3ErrorMsg(pParse, "%s: %s.%s", zMsg, zDbase, zName); - }else{ - sqlite3ErrorMsg(pParse, "%s: %s", zMsg, zName); + if( (flags & LOCATE_NOERR)==0 ){ + if( zDbase ){ + sqlite3ErrorMsg(pParse, "%s: %s.%s", zMsg, zDbase, zName); + }else{ + sqlite3ErrorMsg(pParse, "%s: %s", zMsg, zName); + } + pParse->checkSchema = 1; } - pParse->checkSchema = 1; } return p; @@ -97202,7 +97775,7 @@ SQLITE_PRIVATE Table *sqlite3LocateTable( */ SQLITE_PRIVATE Table *sqlite3LocateTableItem( Parse *pParse, - int isView, + u32 flags, struct SrcList_item *p ){ const char *zDb; @@ -97213,7 +97786,7 @@ SQLITE_PRIVATE Table *sqlite3LocateTableItem( }else{ zDb = p->zDatabase; } - return sqlite3LocateTable(pParse, isView, p->zName, zDb); + return sqlite3LocateTable(pParse, flags, p->zName, zDb); } /* @@ -97421,8 +97994,9 @@ static void SQLITE_NOINLINE deleteTable(sqlite3 *db, Table *pTable){ /* Delete all indices associated with this table. */ for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){ pNext = pIndex->pNext; - assert( pIndex->pSchema==pTable->pSchema ); - if( !db || db->pnBytesFreed==0 ){ + assert( pIndex->pSchema==pTable->pSchema + || (IsVirtual(pTable) && pIndex->idxType!=SQLITE_IDXTYPE_APPDEF) ); + if( (db==0 || db->pnBytesFreed==0) && !IsVirtual(pTable) ){ char *zName = pIndex->zName; TESTONLY ( Index *pOld = ) sqlite3HashInsert( &pIndex->pSchema->idxHash, zName, 0 @@ -98104,7 +98678,7 @@ SQLITE_PRIVATE void sqlite3AddPrimaryKey( Column *pCol = 0; int iCol = -1, i; int nTerm; - if( pTab==0 || IN_DECLARE_VTAB ) goto primary_key_exit; + if( pTab==0 ) goto primary_key_exit; if( pTab->tabFlags & TF_HasPrimaryKey ){ sqlite3ErrorMsg(pParse, "table \"%s\" has more than one primary key", pTab->zName); @@ -98150,12 +98724,8 @@ SQLITE_PRIVATE void sqlite3AddPrimaryKey( "INTEGER PRIMARY KEY"); #endif }else{ - Index *p; - p = sqlite3CreateIndex(pParse, 0, 0, 0, pList, onError, 0, - 0, sortOrder, 0); - if( p ){ - p->idxType = SQLITE_IDXTYPE_PRIMARYKEY; - } + sqlite3CreateIndex(pParse, 0, 0, 0, pList, onError, 0, + 0, sortOrder, 0, SQLITE_IDXTYPE_PRIMARYKEY); pList = 0; } @@ -98472,21 +99042,23 @@ static int hasColumn(const i16 *aiCol, int nCol, int x){ ** are appropriate for a WITHOUT ROWID table instead of a rowid table. ** Changes include: ** -** (1) Convert the OP_CreateTable into an OP_CreateIndex. There is +** (1) Set all columns of the PRIMARY KEY schema object to be NOT NULL. +** (2) Convert the OP_CreateTable into an OP_CreateIndex. There is ** no rowid btree for a WITHOUT ROWID. Instead, the canonical ** data storage is a covering index btree. -** (2) Bypass the creation of the sqlite_master table entry +** (3) Bypass the creation of the sqlite_master table entry ** for the PRIMARY KEY as the primary key index is now ** identified by the sqlite_master table entry of the table itself. -** (3) Set the Index.tnum of the PRIMARY KEY Index object in the +** (4) Set the Index.tnum of the PRIMARY KEY Index object in the ** schema to the rootpage from the main table. -** (4) Set all columns of the PRIMARY KEY schema object to be NOT NULL. ** (5) Add all table columns to the PRIMARY KEY Index object ** so that the PRIMARY KEY is a covering index. The surplus ** columns are part of KeyInfo.nXField and are not used for ** sorting or lookup or uniqueness checks. ** (6) Replace the rowid tail on all automatically generated UNIQUE ** indices with the PRIMARY KEY columns. +** +** For virtual tables, only (1) is performed. */ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ Index *pIdx; @@ -98496,6 +99068,20 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ sqlite3 *db = pParse->db; Vdbe *v = pParse->pVdbe; + /* Mark every PRIMARY KEY column as NOT NULL (except for imposter tables) + */ + if( !db->init.imposterTable ){ + for(i=0; inCol; i++){ + if( (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0 ){ + pTab->aCol[i].notNull = OE_Abort; + } + } + } + + /* The remaining transformations only apply to b-tree tables, not to + ** virtual tables */ + if( IN_DECLARE_VTAB ) return; + /* Convert the OP_CreateTable opcode that would normally create the ** root-page for the table into an OP_CreateIndex opcode. The index ** created will become the PRIMARY KEY index. @@ -98517,9 +99103,10 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ if( pList==0 ) return; pList->a[0].sortOrder = pParse->iPkSortOrder; assert( pParse->pNewTable==pTab ); - pPk = sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0); - if( pPk==0 ) return; - pPk->idxType = SQLITE_IDXTYPE_PRIMARYKEY; + sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0, + SQLITE_IDXTYPE_PRIMARYKEY); + if( db->mallocFailed ) return; + pPk = sqlite3PrimaryKeyIndex(pTab); pTab->iPKey = -1; }else{ pPk = sqlite3PrimaryKeyIndex(pTab); @@ -98547,19 +99134,11 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ } pPk->nKeyCol = j; } - pPk->isCovering = 1; assert( pPk!=0 ); + pPk->isCovering = 1; + if( !db->init.imposterTable ) pPk->uniqNotNull = 1; nPk = pPk->nKeyCol; - /* Make sure every column of the PRIMARY KEY is NOT NULL. (Except, - ** do not enforce this for imposter tables.) */ - if( !db->init.imposterTable ){ - for(i=0; iaCol[pPk->aiColumn[i]].notNull = OE_Abort; - } - pPk->uniqNotNull = 1; - } - /* The root page of the PRIMARY KEY is the table root page */ pPk->tnum = pTab->tnum; @@ -99314,6 +99893,7 @@ SQLITE_PRIVATE void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, assert( pName->nSrc==1 ); if( sqlite3ReadSchema(pParse) ) goto exit_drop_table; if( noErr ) db->suppressErr++; + assert( isView==0 || isView==LOCATE_VIEW ); pTab = sqlite3LocateTableItem(pParse, isView, &pName->a[0]); if( noErr ) db->suppressErr--; @@ -99684,12 +100264,8 @@ SQLITE_PRIVATE Index *sqlite3AllocateIndexObject( ** pList is a list of columns to be indexed. pList will be NULL if this ** is a primary key or unique-constraint on the most recent column added ** to the table currently under construction. -** -** If the index is created successfully, return a pointer to the new Index -** structure. This is used by sqlite3AddPrimaryKey() to mark the index -** as the tables primary key (Index.idxType==SQLITE_IDXTYPE_PRIMARYKEY) */ -SQLITE_PRIVATE Index *sqlite3CreateIndex( +SQLITE_PRIVATE void sqlite3CreateIndex( Parse *pParse, /* All information about this parse */ Token *pName1, /* First part of index name. May be NULL */ Token *pName2, /* Second part of index name. May be NULL */ @@ -99699,9 +100275,9 @@ SQLITE_PRIVATE Index *sqlite3CreateIndex( Token *pStart, /* The CREATE token that begins this statement */ Expr *pPIWhere, /* WHERE clause for partial indices */ int sortOrder, /* Sort order of primary key when pList==NULL */ - int ifNotExist /* Omit error if index already exists */ + int ifNotExist, /* Omit error if index already exists */ + u8 idxType /* The index type */ ){ - Index *pRet = 0; /* Pointer to return */ Table *pTab = 0; /* Table to be indexed */ Index *pIndex = 0; /* The index to be created */ char *zName = 0; /* Name of the index */ @@ -99719,7 +100295,10 @@ SQLITE_PRIVATE Index *sqlite3CreateIndex( char *zExtra = 0; /* Extra space after the Index object */ Index *pPk = 0; /* PRIMARY KEY index for WITHOUT ROWID tables */ - if( db->mallocFailed || IN_DECLARE_VTAB || pParse->nErr>0 ){ + if( db->mallocFailed || pParse->nErr>0 ){ + goto exit_create_index; + } + if( IN_DECLARE_VTAB && idxType!=SQLITE_IDXTYPE_PRIMARYKEY ){ goto exit_create_index; } if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ @@ -99845,6 +100424,13 @@ SQLITE_PRIVATE Index *sqlite3CreateIndex( if( zName==0 ){ goto exit_create_index; } + + /* Automatic index names generated from within sqlite3_declare_vtab() + ** must have names that are distinct from normal automatic index names. + ** The following statement converts "sqlite3_autoindex..." into + ** "sqlite3_butoindex..." in order to make the names distinct. + ** The "vtab_err.test" test demonstrates the need of this statement. */ + if( IN_DECLARE_VTAB ) zName[7]++; } /* Check for authorization to create an index. @@ -99908,7 +100494,7 @@ SQLITE_PRIVATE Index *sqlite3CreateIndex( pIndex->pTable = pTab; pIndex->onError = (u8)onError; pIndex->uniqNotNull = onError!=OE_None; - pIndex->idxType = pName ? SQLITE_IDXTYPE_APPDEF : SQLITE_IDXTYPE_UNIQUE; + pIndex->idxType = idxType; pIndex->pSchema = db->aDb[iDb].pSchema; pIndex->nKeyCol = pList->nExpr; if( pPIWhere ){ @@ -100088,7 +100674,7 @@ SQLITE_PRIVATE Index *sqlite3CreateIndex( pIdx->onError = pIndex->onError; } } - pRet = pIdx; + if( idxType==SQLITE_IDXTYPE_PRIMARYKEY ) pIdx->idxType = idxType; goto exit_create_index; } } @@ -100100,6 +100686,7 @@ SQLITE_PRIVATE Index *sqlite3CreateIndex( assert( pParse->nErr==0 ); if( db->init.busy ){ Index *p; + assert( !IN_DECLARE_VTAB ); assert( sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) ); p = sqlite3HashInsert(&pIndex->pSchema->idxHash, pIndex->zName, pIndex); @@ -100181,7 +100768,7 @@ SQLITE_PRIVATE Index *sqlite3CreateIndex( sqlite3ChangeCookie(pParse, iDb); sqlite3VdbeAddParseSchemaOp(v, iDb, sqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName)); - sqlite3VdbeAddOp1(v, OP_Expire, 0); + sqlite3VdbeAddOp0(v, OP_Expire); } sqlite3VdbeJumpHere(v, pIndex->tnum); @@ -100206,7 +100793,6 @@ SQLITE_PRIVATE Index *sqlite3CreateIndex( pIndex->pNext = pOther->pNext; pOther->pNext = pIndex; } - pRet = pIndex; pIndex = 0; } @@ -100217,7 +100803,6 @@ exit_create_index: sqlite3ExprListDelete(db, pList); sqlite3SrcListDelete(db, pTblName); sqlite3DbFree(db, zName); - return pRet; } /* @@ -100246,10 +100831,11 @@ SQLITE_PRIVATE void sqlite3DefaultRowEst(Index *pIdx){ int i; /* Set the first entry (number of rows in the index) to the estimated - ** number of rows in the table. Or 10, if the estimated number of rows - ** in the table is less than that. */ + ** number of rows in the table, or half the number of rows in the table + ** for a partial index. But do not let the estimate drop below 10. */ a[0] = pIdx->pTable->nRowLogEst; - if( a[0]<33 ) a[0] = 33; assert( 33==sqlite3LogEst(10) ); + if( pIdx->pPartIdxWhere!=0 ) a[0] -= 10; assert( 10==sqlite3LogEst(2) ); + if( a[0]<33 ) a[0] = 33; assert( 33==sqlite3LogEst(10) ); /* Estimate that a[1] is 10, a[2] is 9, a[3] is 8, a[4] is 7, a[5] is ** 6 and each subsequent value (if any) is 5. */ @@ -101131,10 +101717,6 @@ SQLITE_PRIVATE void sqlite3Reindex(Parse *pParse, Token *pName1, Token *pName2){ /* ** Return a KeyInfo structure that is appropriate for the given Index. ** -** The KeyInfo structure for an index is cached in the Index object. -** So there might be multiple references to the returned pointer. The -** caller should not try to modify the KeyInfo object. -** ** The caller should invoke sqlite3KeyInfoUnref() on the returned object ** when it has finished using it. */ @@ -103366,7 +103948,7 @@ static int patternCompare( } c2 = Utf8Read(zString); if( c==c2 ) continue; - if( noCase && c<0x80 && c2<0x80 && sqlite3Tolower(c)==sqlite3Tolower(c2) ){ + if( noCase && sqlite3Tolower(c)==sqlite3Tolower(c2) && c<0x80 && c2<0x80 ){ continue; } if( c==matchOne && zPattern!=zEscaped && c2!=0 ) continue; @@ -103942,6 +104524,26 @@ static void trimFunc( } +#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION +/* +** The "unknown" function is automatically substituted in place of +** any unrecognized function name when doing an EXPLAIN or EXPLAIN QUERY PLAN +** when the SQLITE_ENABLE_UNKNOWN_FUNCTION compile-time option is used. +** When the "sqlite3" command-line shell is built using this functionality, +** that allows an EXPLAIN or EXPLAIN QUERY PLAN for complex queries +** involving application-defined functions to be examined in a generic +** sqlite3 shell. +*/ +static void unknownFunc( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + /* no-op */ +} +#endif /*SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION*/ + + /* IMP: R-25361-16150 This function is omitted from SQLite by default. It ** is only available if the SQLITE_SOUNDEX compile-time option is used ** when SQLite is built. @@ -104412,13 +105014,16 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){ AGGREGATE(group_concat, 2, 0, 0, groupConcatStep, groupConcatFinalize), LIKEFUNC(glob, 2, &globInfo, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE), - #ifdef SQLITE_CASE_SENSITIVE_LIKE +#ifdef SQLITE_CASE_SENSITIVE_LIKE LIKEFUNC(like, 2, &likeInfoAlt, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE), LIKEFUNC(like, 3, &likeInfoAlt, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE), - #else +#else LIKEFUNC(like, 2, &likeInfoNorm, SQLITE_FUNC_LIKE), LIKEFUNC(like, 3, &likeInfoNorm, SQLITE_FUNC_LIKE), - #endif +#endif +#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION + FUNCTION(unknown, -1, 0, 0, unknownFunc ), +#endif FUNCTION(coalesce, 1, 0, 0, 0 ), FUNCTION(coalesce, 0, 0, 0, 0 ), FUNCTION2(coalesce, -1, 0, 0, noopFunc, SQLITE_FUNC_COALESCE), @@ -105825,7 +106430,8 @@ SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *db, Table *pTab){ FKey *pFKey; /* Iterator variable */ FKey *pNext; /* Copy of pFKey->pNextFrom */ - assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) ); + assert( db==0 || IsVirtual(pTab) + || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) ); for(pFKey=pTab->pFKey; pFKey; pFKey=pNext){ /* Remove the FK from the fkeyHash hash table. */ @@ -108235,12 +108841,10 @@ exec_out: ** as extensions by SQLite should #include this file instead of ** sqlite3.h. */ -#ifndef _SQLITE3EXT_H_ -#define _SQLITE3EXT_H_ +#ifndef SQLITE3EXT_H +#define SQLITE3EXT_H /* #include "sqlite3.h" */ -typedef struct sqlite3_api_routines sqlite3_api_routines; - /* ** The following structure holds pointers to all of the SQLite API ** routines. @@ -108501,8 +109105,21 @@ struct sqlite3_api_routines { int (*db_cacheflush)(sqlite3*); /* Version 3.12.0 and later */ int (*system_errno)(sqlite3*); + /* Version 3.14.0 and later */ + int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*); + char *(*expanded_sql)(sqlite3_stmt*); }; +/* +** This is the function signature used for all extension entry points. It +** is also defined in the file "loadext.c". +*/ +typedef int (*sqlite3_loadext_entry)( + sqlite3 *db, /* Handle to the database. */ + char **pzErrMsg, /* Used to set error string on failure. */ + const sqlite3_api_routines *pThunk /* Extension API function pointers. */ +); + /* ** The following macros redefine the API routines so that they are ** redirected through the global sqlite3_api structure. @@ -108746,6 +109363,9 @@ struct sqlite3_api_routines { #define sqlite3_db_cacheflush sqlite3_api->db_cacheflush /* Version 3.12.0 and later */ #define sqlite3_system_errno sqlite3_api->system_errno +/* Version 3.14.0 and later */ +#define sqlite3_trace_v2 sqlite3_api->trace_v2 +#define sqlite3_expanded_sql sqlite3_api->expanded_sql #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) @@ -108763,7 +109383,7 @@ struct sqlite3_api_routines { # define SQLITE_EXTENSION_INIT3 /*no-op*/ #endif -#endif /* _SQLITE3EXT_H_ */ +#endif /* SQLITE3EXT_H */ /************** End of sqlite3ext.h ******************************************/ /************** Continuing where we left off in loadext.c ********************/ @@ -108771,7 +109391,6 @@ struct sqlite3_api_routines { /* #include */ #ifndef SQLITE_OMIT_LOAD_EXTENSION - /* ** Some API routines are omitted when various features are ** excluded from a build of SQLite. Substitute a NULL pointer @@ -108841,7 +109460,7 @@ struct sqlite3_api_routines { # define sqlite3_enable_shared_cache 0 #endif -#ifdef SQLITE_OMIT_TRACE +#if defined(SQLITE_OMIT_TRACE) || defined(SQLITE_OMIT_DEPRECATED) # define sqlite3_profile 0 # define sqlite3_trace 0 #endif @@ -108861,6 +109480,10 @@ struct sqlite3_api_routines { #define sqlite3_blob_reopen 0 #endif +#if defined(SQLITE_OMIT_TRACE) +# define sqlite3_trace_v2 0 +#endif + /* ** The following structure contains pointers to all SQLite API routines. ** A pointer to this structure is passed into extensions when they are @@ -109166,7 +109789,10 @@ static const sqlite3_api_routines sqlite3Apis = { sqlite3_strlike, sqlite3_db_cacheflush, /* Version 3.12.0 and later */ - sqlite3_system_errno + sqlite3_system_errno, + /* Version 3.14.0 and later */ + sqlite3_trace_v2, + sqlite3_expanded_sql }; /* @@ -109189,13 +109815,14 @@ static int sqlite3LoadExtension( ){ sqlite3_vfs *pVfs = db->pVfs; void *handle; - int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*); + sqlite3_loadext_entry xInit; char *zErrmsg = 0; const char *zEntry; char *zAltEntry = 0; void **aHandle; u64 nMsg = 300 + sqlite3Strlen30(zFile); int ii; + int rc; /* Shared library endings to try if zFile cannot be loaded as written */ static const char *azEndings[] = { @@ -109247,8 +109874,7 @@ static int sqlite3LoadExtension( } return SQLITE_ERROR; } - xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*)) - sqlite3OsDlSym(pVfs, handle, zEntry); + xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry); /* If no entry point was specified and the default legacy ** entry point name "sqlite3_extension_init" was not found, then @@ -109280,8 +109906,7 @@ static int sqlite3LoadExtension( } memcpy(zAltEntry+iEntry, "_init", 6); zEntry = zAltEntry; - xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*)) - sqlite3OsDlSym(pVfs, handle, zEntry); + xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry); } if( xInit==0 ){ if( pzErrMsg ){ @@ -109298,7 +109923,9 @@ static int sqlite3LoadExtension( return SQLITE_ERROR; } sqlite3_free(zAltEntry); - if( xInit(db, &zErrmsg, &sqlite3Apis) ){ + rc = xInit(db, &zErrmsg, &sqlite3Apis); + if( rc ){ + if( rc==SQLITE_OK_LOAD_PERMANENTLY ) return SQLITE_OK; if( pzErrMsg ){ *pzErrMsg = sqlite3_mprintf("error during initialization: %s", zErrmsg); } @@ -109409,7 +110036,9 @@ static SQLITE_WSD struct sqlite3AutoExtList { ** Register a statically linked extension that is automatically ** loaded by every new database connection. */ -SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void (*xInit)(void)){ +SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension( + void (*xInit)(void) +){ int rc = SQLITE_OK; #ifndef SQLITE_OMIT_AUTOINIT rc = sqlite3_initialize(); @@ -109454,7 +110083,9 @@ SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void (*xInit)(void)){ ** Return 1 if xInit was found on the list and removed. Return 0 if xInit ** was not on the list. */ -SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void (*xInit)(void)){ +SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension( + void (*xInit)(void) +){ #if SQLITE_THREADSAFE sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); #endif @@ -109503,7 +110134,7 @@ SQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3 *db){ u32 i; int go = 1; int rc; - int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*); + sqlite3_loadext_entry xInit; wsdAutoextInit; if( wsdAutoext.nExt==0 ){ @@ -109520,8 +110151,7 @@ SQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3 *db){ xInit = 0; go = 0; }else{ - xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*)) - wsdAutoext.aExt[i]; + xInit = (sqlite3_loadext_entry)wsdAutoext.aExt[i]; } sqlite3_mutex_leave(mutex); zErrmsg = 0; @@ -111036,7 +111666,7 @@ SQLITE_PRIVATE void sqlite3Pragma( ** compiler (eg. count_changes). So add an opcode to expire all ** compiled SQL statements after modifying a pragma value. */ - sqlite3VdbeAddOp2(v, OP_Expire, 0, 0); + sqlite3VdbeAddOp0(v, OP_Expire); setAllPagerFlags(db); } break; @@ -111058,7 +111688,7 @@ SQLITE_PRIVATE void sqlite3Pragma( */ case PragTyp_TABLE_INFO: if( zRight ){ Table *pTab; - pTab = sqlite3FindTable(db, zRight, zDb); + pTab = sqlite3LocateTable(pParse, LOCATE_NOERR, zRight, zDb); if( pTab ){ static const char *azCol[] = { "cid", "name", "type", "notnull", "dflt_value", "pk" @@ -111340,12 +111970,10 @@ SQLITE_PRIVATE void sqlite3Pragma( sqlite3VdbeAddOp3(v, OP_Column, 0, iKey, regRow); sqlite3ColumnDefault(v, pTab, iKey, regRow); sqlite3VdbeAddOp2(v, OP_IsNull, regRow, addrOk); VdbeCoverage(v); - sqlite3VdbeAddOp2(v, OP_MustBeInt, regRow, - sqlite3VdbeCurrentAddr(v)+3); VdbeCoverage(v); }else{ sqlite3VdbeAddOp2(v, OP_Rowid, 0, regRow); } - sqlite3VdbeAddOp3(v, OP_NotExists, i, 0, regRow); VdbeCoverage(v); + sqlite3VdbeAddOp3(v, OP_SeekRowid, i, 0, regRow); VdbeCoverage(v); sqlite3VdbeGoto(v, addrOk); sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2); }else{ @@ -112916,6 +113544,7 @@ struct SortCtx { int addrSortIndex; /* Address of the OP_SorterOpen or OP_OpenEphemeral */ int labelDone; /* Jump here when done, ex: LIMIT reached */ u8 sortFlags; /* Zero or more SORTFLAG_* bits */ + u8 bOrderedInnerLoop; /* ORDER BY correctly sorts the inner loop */ }; #define SORTFLAG_UseSorter 0x01 /* Use SorterOpen instead of OpenEphemeral */ @@ -113449,9 +114078,30 @@ static void pushOntoSorter( sqlite3VdbeAddOp2(v, op, pSort->iECursor, regRecord); if( iLimit ){ int addr; + int r1 = 0; + /* Fill the sorter until it contains LIMIT+OFFSET entries. (The iLimit + ** register is initialized with value of LIMIT+OFFSET.) After the sorter + ** fills up, delete the least entry in the sorter after each insert. + ** Thus we never hold more than the LIMIT+OFFSET rows in memory at once */ addr = sqlite3VdbeAddOp3(v, OP_IfNotZero, iLimit, 0, 1); VdbeCoverage(v); sqlite3VdbeAddOp1(v, OP_Last, pSort->iECursor); + if( pSort->bOrderedInnerLoop ){ + r1 = ++pParse->nMem; + sqlite3VdbeAddOp3(v, OP_Column, pSort->iECursor, nExpr, r1); + VdbeComment((v, "seq")); + } sqlite3VdbeAddOp1(v, OP_Delete, pSort->iECursor); + if( pSort->bOrderedInnerLoop ){ + /* If the inner loop is driven by an index such that values from + ** the same iteration of the inner loop are in sorted order, then + ** immediately jump to the next iteration of an inner loop if the + ** entry from the current iteration does not fit into the top + ** LIMIT+OFFSET entries of the sorter. */ + int iBrk = sqlite3VdbeCurrentAddr(v) + 2; + sqlite3VdbeAddOp3(v, OP_Eq, regBase+nExpr, iBrk, r1); + sqlite3VdbeChangeP5(v, SQLITE_NULLEQ); + VdbeCoverage(v); + } sqlite3VdbeJumpHere(v, addr); } } @@ -113866,7 +114516,7 @@ static void selectInnerLoop( */ SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3 *db, int N, int X){ int nExtra = (N+X)*(sizeof(CollSeq*)+1); - KeyInfo *p = sqlite3Malloc(sizeof(KeyInfo) + nExtra); + KeyInfo *p = sqlite3DbMallocRaw(db, sizeof(KeyInfo) + nExtra); if( p ){ p->aSortOrder = (u8*)&p->aColl[N+X]; p->nField = (u16)N; @@ -113888,7 +114538,7 @@ SQLITE_PRIVATE void sqlite3KeyInfoUnref(KeyInfo *p){ if( p ){ assert( p->nRef>0 ); p->nRef--; - if( p->nRef==0 ) sqlite3DbFree(0, p); + if( p->nRef==0 ) sqlite3DbFree(p->db, p); } } @@ -118036,6 +118686,7 @@ SQLITE_PRIVATE int sqlite3Select( } if( sSort.pOrderBy ){ sSort.nOBSat = sqlite3WhereIsOrdered(pWInfo); + sSort.bOrderedInnerLoop = sqlite3WhereOrderedInnerLoop(pWInfo); if( sSort.nOBSat==sSort.pOrderBy->nExpr ){ sSort.pOrderBy = 0; } @@ -120805,7 +121456,7 @@ SQLITE_PRIVATE int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db){ int saved_flags; /* Saved value of the db->flags */ int saved_nChange; /* Saved value of db->nChange */ int saved_nTotalChange; /* Saved value of db->nTotalChange */ - void (*saved_xTrace)(void*,const char*); /* Saved db->xTrace */ + u8 saved_mTrace; /* Saved trace settings */ Db *pDb = 0; /* Database to detach at end of vacuum */ int isMemDb; /* True if vacuuming a :memory: database */ int nRes; /* Bytes of reserved space at the end of each page */ @@ -120826,10 +121477,10 @@ SQLITE_PRIVATE int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db){ saved_flags = db->flags; saved_nChange = db->nChange; saved_nTotalChange = db->nTotalChange; - saved_xTrace = db->xTrace; + saved_mTrace = db->mTrace; db->flags |= SQLITE_WriteSchema | SQLITE_IgnoreChecks | SQLITE_PreferBuiltin; db->flags &= ~(SQLITE_ForeignKeys | SQLITE_ReverseOrder); - db->xTrace = 0; + db->mTrace = 0; pMain = db->aDb[0].pBt; isMemDb = sqlite3PagerIsMemdb(sqlite3BtreePager(pMain)); @@ -120881,6 +121532,8 @@ SQLITE_PRIVATE int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db){ } #endif + sqlite3BtreeSetCacheSize(pTemp, db->aDb[0].pSchema->cache_size); + sqlite3BtreeSetSpillSize(pTemp, sqlite3BtreeSetSpillSize(pMain,0)); rc = execSql(db, pzErrMsg, "PRAGMA vacuum_db.synchronous=OFF"); if( rc!=SQLITE_OK ) goto end_of_vacuum; @@ -121029,7 +121682,7 @@ end_of_vacuum: db->flags = saved_flags; db->nChange = saved_nChange; db->nTotalChange = saved_nTotalChange; - db->xTrace = saved_xTrace; + db->mTrace = saved_mTrace; sqlite3BtreeSetPageSize(pMain, -1, -1, 1); /* Currently there is an SQL level transaction open on the vacuum @@ -121478,7 +122131,7 @@ SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){ v = sqlite3GetVdbe(pParse); sqlite3ChangeCookie(pParse, iDb); - sqlite3VdbeAddOp2(v, OP_Expire, 0, 0); + sqlite3VdbeAddOp0(v, OP_Expire); zWhere = sqlite3MPrintf(db, "name='%q' AND type='table'", pTab->zName); sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere); @@ -121814,10 +122467,24 @@ SQLITE_API int SQLITE_STDCALL sqlite3_declare_vtab(sqlite3 *db, const char *zCre && (pParse->pNewTable->tabFlags & TF_Virtual)==0 ){ if( !pTab->aCol ){ - pTab->aCol = pParse->pNewTable->aCol; - pTab->nCol = pParse->pNewTable->nCol; - pParse->pNewTable->nCol = 0; - pParse->pNewTable->aCol = 0; + Table *pNew = pParse->pNewTable; + Index *pIdx; + pTab->aCol = pNew->aCol; + pTab->nCol = pNew->nCol; + pTab->tabFlags |= pNew->tabFlags & (TF_WithoutRowid|TF_NoVisibleRowid); + pNew->nCol = 0; + pNew->aCol = 0; + assert( pTab->pIndex==0 ); + if( !HasRowid(pNew) && pCtx->pVTable->pMod->pModule->xUpdate!=0 ){ + rc = SQLITE_ERROR; + } + pIdx = pNew->pIndex; + if( pIdx ){ + assert( pIdx->pNext==0 ); + pTab->pIndex = pIdx; + pNew->pIndex = 0; + pIdx->pTable = pTab; + } } pCtx->bDeclared = 1; }else{ @@ -121853,7 +122520,7 @@ SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab Table *pTab; pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zName); - if( ALWAYS(pTab!=0 && pTab->pVTable!=0) ){ + if( pTab!=0 && ALWAYS(pTab->pVTable!=0) ){ VTable *p; int (*xDestroy)(sqlite3_vtab *); for(p=pTab->pVTable; p; p=p->pNext){ @@ -121993,7 +122660,10 @@ SQLITE_PRIVATE int sqlite3VtabBegin(sqlite3 *db, VTable *pVTab){ if( rc==SQLITE_OK ){ int iSvpt = db->nStatement + db->nSavepoint; addToVTrans(db, pVTab); - if( iSvpt ) rc = sqlite3VtabSavepoint(db, SAVEPOINT_BEGIN, iSvpt-1); + if( iSvpt && pModule->xSavepoint ){ + pVTab->iSavepoint = iSvpt; + rc = pModule->xSavepoint(pVTab->pVtab, iSvpt-1); + } } } } @@ -122147,7 +122817,7 @@ SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse *pParse, Table *pTab){ } /* -** Check to see if virtual tale module pMod can be have an eponymous +** Check to see if virtual table module pMod can be have an eponymous ** virtual table instance. If it can, create one if one does not already ** exist. Return non-zero if the eponymous virtual table instance exists ** when this routine returns, and return zero if it does not exist. @@ -122164,17 +122834,18 @@ SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse *pParse, Module *pMod){ const sqlite3_module *pModule = pMod->pModule; Table *pTab; char *zErr = 0; - int nName; int rc; sqlite3 *db = pParse->db; if( pMod->pEpoTab ) return 1; if( pModule->xCreate!=0 && pModule->xCreate!=pModule->xConnect ) return 0; - nName = sqlite3Strlen30(pMod->zName) + 1; - pTab = sqlite3DbMallocZero(db, sizeof(Table) + nName); + pTab = sqlite3DbMallocZero(db, sizeof(Table)); if( pTab==0 ) return 0; + pTab->zName = sqlite3DbStrDup(db, pMod->zName); + if( pTab->zName==0 ){ + sqlite3DbFree(db, pTab); + return 0; + } pMod->pEpoTab = pTab; - pTab->zName = (char*)&pTab[1]; - memcpy(pTab->zName, pMod->zName, nName); pTab->nRef = 1; pTab->pSchema = db->aDb[0].pSchema; pTab->tabFlags |= TF_Virtual; @@ -122200,9 +122871,11 @@ SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse *pParse, Module *pMod){ SQLITE_PRIVATE void sqlite3VtabEponymousTableClear(sqlite3 *db, Module *pMod){ Table *pTab = pMod->pEpoTab; if( pTab!=0 ){ - sqlite3DeleteColumnNames(db, pTab); - sqlite3VtabClear(db, pTab); - sqlite3DbFree(db, pTab); + /* Mark the table as Ephemeral prior to deleting it, so that the + ** sqlite3DeleteTable() routine will know that it is not stored in + ** the schema. */ + pTab->tabFlags |= TF_Ephemeral; + sqlite3DeleteTable(db, pTab); pMod->pEpoTab = 0; } } @@ -122709,8 +123382,9 @@ struct WhereInfo { u8 sorted; /* True if really sorted (not just grouped) */ u8 eOnePass; /* ONEPASS_OFF, or _SINGLE, or _MULTI */ u8 untestedTerms; /* Not all WHERE terms resolved by outer loop */ - u8 eDistinct; /* One of the WHERE_DISTINCT_* values below */ + u8 eDistinct; /* One of the WHERE_DISTINCT_* values */ u8 nLevel; /* Number of nested loop */ + u8 bOrderedInnerLoop; /* True if only the inner-most loop is ordered */ int iTop; /* The very beginning of the WHERE loop */ int iContinue; /* Jump here to continue with next record */ int iBreak; /* Jump here to break out of the loop */ @@ -122727,6 +123401,9 @@ struct WhereInfo { ** where.c: */ SQLITE_PRIVATE Bitmask sqlite3WhereGetMask(WhereMaskSet*,int); +#ifdef WHERETRACE_ENABLED +SQLITE_PRIVATE void sqlite3WhereClausePrint(WhereClause *pWC); +#endif SQLITE_PRIVATE WhereTerm *sqlite3WhereFindTerm( WhereClause *pWC, /* The WHERE clause to be searched */ int iCur, /* Cursor number of LHS */ @@ -122943,7 +123620,7 @@ SQLITE_PRIVATE int sqlite3WhereExplainOneScan( pLoop = pLevel->pWLoop; flags = pLoop->wsFlags; - if( (flags&WHERE_MULTI_OR) || (wctrlFlags&WHERE_ONETABLE_ONLY) ) return 0; + if( (flags&WHERE_MULTI_OR) || (wctrlFlags&WHERE_OR_SUBCLAUSE) ) return 0; isSearch = (flags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0 || ((flags&WHERE_VIRTUALTABLE)==0 && (pLoop->u.btree.nEq>0)) @@ -123386,7 +124063,7 @@ static int codeAllEqualityTerms( ** expression: "x>='ABC' AND x<'abd'". But this requires that the range ** scan loop run twice, once for strings and a second time for BLOBs. ** The OP_String opcodes on the second pass convert the upper and lower -** bound string contants to blobs. This routine makes the necessary changes +** bound string constants to blobs. This routine makes the necessary changes ** to the OP_String opcodes for that to happen. ** ** Except, of course, if SQLITE_LIKE_DOESNT_MATCH_BLOBS is defined, then @@ -123443,6 +124120,38 @@ static int codeCursorHintCheckExpr(Walker *pWalker, Expr *pExpr){ return WRC_Continue; } +/* +** Test whether or not expression pExpr, which was part of a WHERE clause, +** should be included in the cursor-hint for a table that is on the rhs +** of a LEFT JOIN. Set Walker.eCode to non-zero before returning if the +** expression is not suitable. +** +** An expression is unsuitable if it might evaluate to non NULL even if +** a TK_COLUMN node that does affect the value of the expression is set +** to NULL. For example: +** +** col IS NULL +** col IS NOT NULL +** coalesce(col, 1) +** CASE WHEN col THEN 0 ELSE 1 END +*/ +static int codeCursorHintIsOrFunction(Walker *pWalker, Expr *pExpr){ + if( pExpr->op==TK_IS + || pExpr->op==TK_ISNULL || pExpr->op==TK_ISNOT + || pExpr->op==TK_NOTNULL || pExpr->op==TK_CASE + ){ + pWalker->eCode = 1; + }else if( pExpr->op==TK_FUNCTION ){ + int d1; + char d2[3]; + if( 0==sqlite3IsLikeFunction(pWalker->pParse->db, pExpr, &d1, d2) ){ + pWalker->eCode = 1; + } + } + + return WRC_Continue; +} + /* ** This function is called on every node of an expression tree used as an @@ -123495,6 +124204,7 @@ static int codeCursorHintFixExpr(Walker *pWalker, Expr *pExpr){ ** Insert an OP_CursorHint instruction if it is appropriate to do so. */ static void codeCursorHint( + struct SrcList_item *pTabItem, /* FROM clause item */ WhereInfo *pWInfo, /* The where clause */ WhereLevel *pLevel, /* Which loop to provide hints for */ WhereTerm *pEndRange /* Hint this end-of-scan boundary term if not NULL */ @@ -123525,7 +124235,42 @@ static void codeCursorHint( pTerm = &pWC->a[i]; if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; if( pTerm->prereqAll & pLevel->notReady ) continue; - if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) continue; + + /* Any terms specified as part of the ON(...) clause for any LEFT + ** JOIN for which the current table is not the rhs are omitted + ** from the cursor-hint. + ** + ** If this table is the rhs of a LEFT JOIN, "IS" or "IS NULL" terms + ** that were specified as part of the WHERE clause must be excluded. + ** This is to address the following: + ** + ** SELECT ... t1 LEFT JOIN t2 ON (t1.a=t2.b) WHERE t2.c IS NULL; + ** + ** Say there is a single row in t2 that matches (t1.a=t2.b), but its + ** t2.c values is not NULL. If the (t2.c IS NULL) constraint is + ** pushed down to the cursor, this row is filtered out, causing + ** SQLite to synthesize a row of NULL values. Which does match the + ** WHERE clause, and so the query returns a row. Which is incorrect. + ** + ** For the same reason, WHERE terms such as: + ** + ** WHERE 1 = (t2.c IS NULL) + ** + ** are also excluded. See codeCursorHintIsOrFunction() for details. + */ + if( pTabItem->fg.jointype & JT_LEFT ){ + Expr *pExpr = pTerm->pExpr; + if( !ExprHasProperty(pExpr, EP_FromJoin) + || pExpr->iRightJoinTable!=pTabItem->iCursor + ){ + sWalker.eCode = 0; + sWalker.xExprCallback = codeCursorHintIsOrFunction; + sqlite3WalkExpr(&sWalker, pTerm->pExpr); + if( sWalker.eCode ) continue; + } + }else{ + if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) continue; + } /* All terms in pWLoop->aLTerm[] except pEndRange are used to initialize ** the cursor. These terms are not needed as hints for a pure range @@ -123559,7 +124304,7 @@ static void codeCursorHint( } } #else -# define codeCursorHint(A,B,C) /* No-op */ +# define codeCursorHint(A,B,C,D) /* No-op */ #endif /* SQLITE_ENABLE_CURSOR_HINTS */ /* @@ -123593,7 +124338,7 @@ static void codeDeferredSeek( assert( pIdx->aiColumn[pIdx->nColumn-1]==-1 ); sqlite3VdbeAddOp3(v, OP_Seek, iIdxCur, 0, iCur); - if( (pWInfo->wctrlFlags & WHERE_FORCE_TABLE) + if( (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE) && DbMaskAllZero(sqlite3ParseToplevel(pParse)->writeMask) ){ int i; @@ -123648,7 +124393,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( pLevel->notReady = notReady & ~sqlite3WhereGetMask(&pWInfo->sMaskSet, iCur); bRev = (pWInfo->revMask>>iLevel)&1; omitTable = (pLoop->wsFlags & WHERE_IDX_ONLY)!=0 - && (pWInfo->wctrlFlags & WHERE_FORCE_TABLE)==0; + && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0; VdbeModuleComment((v, "Begin WHERE-loop%d: %s",iLevel,pTabItem->pTab->zName)); /* Create labels for the "break" and "continue" instructions @@ -123788,8 +124533,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg); if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg); addrNxt = pLevel->addrNxt; - sqlite3VdbeAddOp2(v, OP_MustBeInt, iRowidReg, addrNxt); VdbeCoverage(v); - sqlite3VdbeAddOp3(v, OP_NotExists, iCur, addrNxt, iRowidReg); + sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg); VdbeCoverage(v); sqlite3ExprCacheAffinityChange(pParse, iRowidReg, 1); sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg); @@ -123816,7 +124560,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( pStart = pEnd; pEnd = pTerm; } - codeCursorHint(pWInfo, pLevel, pEnd); + codeCursorHint(pTabItem, pWInfo, pLevel, pEnd); if( pStart ){ Expr *pX; /* The expression that defines the start bound */ int r1, rTemp; /* Registers for holding the start boundary */ @@ -124030,7 +124774,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( ** and store the values of those terms in an array of registers ** starting at regBase. */ - codeCursorHint(pWInfo, pLevel, pRangeEnd); + codeCursorHint(pTabItem, pWInfo, pLevel, pRangeEnd); regBase = codeAllEqualityTerms(pParse,pLevel,bRev,nExtraReg,&zStartAff); assert( zStartAff==0 || sqlite3Strlen30(zStartAff)>=nEq ); if( zStartAff ) cEndAff = zStartAff[nEq]; @@ -124069,6 +124813,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( } nConstraint++; testcase( pRangeStart->wtFlags & TERM_VIRTUAL ); + bSeekPastNull = 0; }else if( bSeekPastNull ){ sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq); nConstraint++; @@ -124334,11 +125079,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( ** eliminating duplicates from other WHERE clauses, the action for each ** sub-WHERE clause is to to invoke the main loop body as a subroutine. */ - wctrlFlags = WHERE_OMIT_OPEN_CLOSE - | WHERE_FORCE_TABLE - | WHERE_ONETABLE_ONLY - | WHERE_NO_AUTOINDEX - | (pWInfo->wctrlFlags & WHERE_SEEK_TABLE); + wctrlFlags = WHERE_OR_SUBCLAUSE | (pWInfo->wctrlFlags & WHERE_SEEK_TABLE); for(ii=0; iinTerm; ii++){ WhereTerm *pOrTerm = &pOrWc->a[ii]; if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){ @@ -124446,7 +125187,6 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( ){ assert( pSubWInfo->a[0].iIdxCur==iCovCur ); pCov = pSubLoop->u.btree.pIndex; - wctrlFlags |= WHERE_REOPEN_IDX; }else{ pCov = 0; } @@ -124483,7 +125223,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( ** a pseudo-cursor. No need to Rewind or Next such cursors. */ pLevel->op = OP_Noop; }else{ - codeCursorHint(pWInfo, pLevel, 0); + codeCursorHint(pTabItem, pWInfo, pLevel, 0); pLevel->op = aStep[bRev]; pLevel->p1 = iCur; pLevel->p2 = 1 + sqlite3VdbeAddOp2(v, aStart[bRev], iCur, addrBrk); @@ -124508,7 +125248,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; if( (pTerm->prereqAll & pLevel->notReady)!=0 ){ testcase( pWInfo->untestedTerms==0 - && (pWInfo->wctrlFlags & WHERE_ONETABLE_ONLY)!=0 ); + && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)!=0 ); pWInfo->untestedTerms = 1; continue; } @@ -125170,7 +125910,9 @@ static void exprAnalyzeOrTerm( if( !db->mallocFailed ){ for(j=0, pAndTerm=pAndWC->a; jnTerm; j++, pAndTerm++){ assert( pAndTerm->pExpr ); - if( allowedOp(pAndTerm->pExpr->op) ){ + if( allowedOp(pAndTerm->pExpr->op) + || pAndTerm->eOperator==WO_MATCH + ){ b |= sqlite3WhereGetMask(&pWInfo->sMaskSet, pAndTerm->leftCursor); } } @@ -125385,12 +126127,10 @@ static int termIsEquivalence(Parse *pParse, Expr *pExpr){ pColl = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pRight); if( pColl==0 || sqlite3StrICmp(pColl->zName, "BINARY")==0 ) return 1; pColl = sqlite3ExprCollSeq(pParse, pExpr->pLeft); - /* Since pLeft and pRight are both a column references, their collating - ** sequence should always be defined. */ - zColl1 = ALWAYS(pColl) ? pColl->zName : 0; + zColl1 = pColl ? pColl->zName : 0; pColl = sqlite3ExprCollSeq(pParse, pExpr->pRight); - zColl2 = ALWAYS(pColl) ? pColl->zName : 0; - return sqlite3StrICmp(zColl1, zColl2)==0; + zColl2 = pColl ? pColl->zName : 0; + return sqlite3_stricmp(zColl1, zColl2)==0; } /* @@ -125724,7 +126464,7 @@ static void exprAnalyze( ** virtual tables. The native query optimizer does not attempt ** to do anything with MATCH functions. */ - if( isMatchOfColumn(pExpr, &eOp2) ){ + if( pWC->op==TK_AND && isMatchOfColumn(pExpr, &eOp2) ){ int idxNew; Expr *pRight, *pLeft; WhereTerm *pNewTerm; @@ -126017,6 +126757,18 @@ SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo *pWInfo){ return pWInfo->nOBSat; } +/* +** Return TRUE if the innermost loop of the WHERE clause implementation +** returns rows in ORDER BY order for complete run of the inner loop. +** +** Across multiple iterations of outer loops, the output rows need not be +** sorted. As long as rows are sorted for just the innermost loop, this +** routine can return TRUE. +*/ +SQLITE_PRIVATE int sqlite3WhereOrderedInnerLoop(WhereInfo *pWInfo){ + return pWInfo->bOrderedInnerLoop; +} + /* ** Return the VDBE address or label to jump to in order to continue ** immediately with the next row of a WHERE clause. @@ -127602,19 +128354,41 @@ static void whereTermPrint(WhereTerm *pTerm, int iTerm){ sqlite3DebugPrintf("TERM-%-3d NULL\n", iTerm); }else{ char zType[4]; + char zLeft[50]; memcpy(zType, "...", 4); if( pTerm->wtFlags & TERM_VIRTUAL ) zType[0] = 'V'; if( pTerm->eOperator & WO_EQUIV ) zType[1] = 'E'; if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) zType[2] = 'L'; + if( pTerm->eOperator & WO_SINGLE ){ + sqlite3_snprintf(sizeof(zLeft),zLeft,"left={%d:%d}", + pTerm->leftCursor, pTerm->u.leftColumn); + }else if( (pTerm->eOperator & WO_OR)!=0 && pTerm->u.pOrInfo!=0 ){ + sqlite3_snprintf(sizeof(zLeft),zLeft,"indexable=0x%lld", + pTerm->u.pOrInfo->indexable); + }else{ + sqlite3_snprintf(sizeof(zLeft),zLeft,"left=%d", pTerm->leftCursor); + } sqlite3DebugPrintf( - "TERM-%-3d %p %s cursor=%-3d prob=%-3d op=0x%03x wtFlags=0x%04x\n", - iTerm, pTerm, zType, pTerm->leftCursor, pTerm->truthProb, + "TERM-%-3d %p %s %-12s prob=%-3d op=0x%03x wtFlags=0x%04x\n", + iTerm, pTerm, zType, zLeft, pTerm->truthProb, pTerm->eOperator, pTerm->wtFlags); sqlite3TreeViewExpr(0, pTerm->pExpr, 0); } } #endif +#ifdef WHERETRACE_ENABLED +/* +** Show the complete content of a WhereClause +*/ +SQLITE_PRIVATE void sqlite3WhereClausePrint(WhereClause *pWC){ + int i; + for(i=0; inTerm; i++){ + whereTermPrint(&pWC->a[i], i); + } +} +#endif + #ifdef WHERETRACE_ENABLED /* ** Print a WhereLoop object for debugging purposes @@ -128601,7 +129375,7 @@ static int whereLoopAddBtree( #ifndef SQLITE_OMIT_AUTOMATIC_INDEX /* Automatic indexes */ if( !pBuilder->pOrSet /* Not part of an OR optimization */ - && (pWInfo->wctrlFlags & WHERE_NO_AUTOINDEX)==0 + && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0 && (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0 && pSrc->pIBIndex==0 /* Has no INDEXED BY clause */ && !pSrc->fg.notIndexed /* Has no NOT INDEXED clause */ @@ -128633,6 +129407,7 @@ static int whereLoopAddBtree( pNew->rSetup += 24; } ApplyCostMultiplier(pNew->rSetup, pTab->costMult); + if( pNew->rSetup<0 ) pNew->rSetup = 0; /* TUNING: Each index lookup yields 20 rows in the table. This ** is more than the usual guess of 10 rows, since we have no way ** of knowing how selective the index will ultimately be. It would @@ -128693,6 +129468,7 @@ static int whereLoopAddBtree( /* Full scan via index */ if( b || !HasRowid(pTab) + || pProbe->pPartIdxWhere!=0 || ( m==0 && pProbe->bUnordered==0 && (pProbe->szIdxRowszTabRow) @@ -128705,11 +129481,34 @@ static int whereLoopAddBtree( /* The cost of visiting the index rows is N*K, where K is ** between 1.1 and 3.0, depending on the relative sizes of the - ** index and table rows. If this is a non-covering index scan, - ** also add the cost of visiting table rows (N*3.0). */ + ** index and table rows. */ pNew->rRun = rSize + 1 + (15*pProbe->szIdxRow)/pTab->szTabRow; if( m!=0 ){ - pNew->rRun = sqlite3LogEstAdd(pNew->rRun, rSize+16); + /* If this is a non-covering index scan, add in the cost of + ** doing table lookups. The cost will be 3x the number of + ** lookups. Take into account WHERE clause terms that can be + ** satisfied using just the index, and that do not require a + ** table lookup. */ + LogEst nLookup = rSize + 16; /* Base cost: N*3 */ + int ii; + int iCur = pSrc->iCursor; + WhereClause *pWC2 = &pWInfo->sWC; + for(ii=0; iinTerm; ii++){ + WhereTerm *pTerm = &pWC2->a[ii]; + if( !sqlite3ExprCoveredByIndex(pTerm->pExpr, iCur, pProbe) ){ + break; + } + /* pTerm can be evaluated using just the index. So reduce + ** the expected number of table lookups accordingly */ + if( pTerm->truthProb<=0 ){ + nLookup += pTerm->truthProb; + }else{ + nLookup--; + if( pTerm->eOperator & (WO_EQ|WO_IS) ) nLookup -= 19; + } + } + + pNew->rRun = sqlite3LogEstAdd(pNew->rRun, nLookup); } ApplyCostMultiplier(pNew->rRun, pTab->costMult); whereLoopOutputAdjust(pWC, pNew, rSize); @@ -129078,9 +129877,7 @@ static int whereLoopAddOr( WHERETRACE(0x200, ("OR-term %d of %p has %d subterms:\n", (int)(pOrTerm-pOrWC->a), pTerm, sSubBuild.pWC->nTerm)); if( sqlite3WhereTrace & 0x400 ){ - for(i=0; inTerm; i++){ - whereTermPrint(&sSubBuild.pWC->a[i], i); - } + sqlite3WhereClausePrint(sSubBuild.pWC); } #endif #ifndef SQLITE_OMIT_VIRTUALTABLE @@ -129173,6 +129970,7 @@ static int whereLoopAddAll(WhereLoopBuilder *pBuilder){ mPrereq = mPrior; } priorJointype = pItem->fg.jointype; +#ifndef SQLITE_OMIT_VIRTUALTABLE if( IsVirtual(pItem->pTab) ){ struct SrcList_item *p; for(p=&pItem[1]; paLoop[] */ WhereLoop *pLast, /* Add this WhereLoop to the end of pPath->aLoop[] */ Bitmask *pRevMask /* OUT: Mask of WhereLoops to run in reverse order */ @@ -129227,6 +130027,7 @@ static i8 wherePathSatisfiesOrderBy( u8 isOrderDistinct; /* All prior WhereLoops are order-distinct */ u8 distinctColumns; /* True if the loop has UNIQUE NOT NULL columns */ u8 isMatch; /* iColumn matches a term of the ORDER BY clause */ + u16 eqOpMask; /* Allowed equality operators */ u16 nKeyCol; /* Number of key columns in pIndex */ u16 nColumn; /* Total number of ordered columns in the index */ u16 nOrderBy; /* Number terms in the ORDER BY clause */ @@ -129277,9 +130078,16 @@ static i8 wherePathSatisfiesOrderBy( obDone = MASKBIT(nOrderBy)-1; orderDistinctMask = 0; ready = 0; + eqOpMask = WO_EQ | WO_IS | WO_ISNULL; + if( wctrlFlags & WHERE_ORDERBY_LIMIT ) eqOpMask |= WO_IN; for(iLoop=0; isOrderDistinct && obSat0 ) ready |= pLoop->maskSelf; - pLoop = iLoopaLoop[iLoop] : pLast; + if( iLoopaLoop[iLoop]; + if( wctrlFlags & WHERE_ORDERBY_LIMIT ) continue; + }else{ + pLoop = pLast; + } if( pLoop->wsFlags & WHERE_VIRTUALTABLE ){ if( pLoop->u.vtab.isOrdered ) obSat = obDone; break; @@ -129297,7 +130105,7 @@ static i8 wherePathSatisfiesOrderBy( if( pOBExpr->op!=TK_COLUMN ) continue; if( pOBExpr->iTable!=iCur ) continue; pTerm = sqlite3WhereFindTerm(&pWInfo->sWC, iCur, pOBExpr->iColumn, - ~ready, WO_EQ|WO_ISNULL|WO_IS, 0); + ~ready, eqOpMask, 0); if( pTerm==0 ) continue; if( (pTerm->eOperator&(WO_EQ|WO_IS))!=0 && pOBExpr->iColumn>=0 ){ const char *z1, *z2; @@ -129337,10 +130145,12 @@ static i8 wherePathSatisfiesOrderBy( for(j=0; ju.btree.nEq && pLoop->nSkip==0 - && ((i = pLoop->aLTerm[j]->eOperator) & (WO_EQ|WO_ISNULL|WO_IS))!=0 + && ((i = pLoop->aLTerm[j]->eOperator) & eqOpMask)!=0 ){ if( i & WO_ISNULL ){ testcase( isOrderDistinct ); @@ -129864,8 +130674,19 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ } }else{ pWInfo->nOBSat = pFrom->isOrdered; - if( pWInfo->nOBSat<0 ) pWInfo->nOBSat = 0; pWInfo->revMask = pFrom->revLoop; + if( pWInfo->nOBSat<=0 ){ + pWInfo->nOBSat = 0; + if( nLoop>0 && (pFrom->aLoop[nLoop-1]->wsFlags & WHERE_ONEROW)==0 ){ + Bitmask m = 0; + int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pOrderBy, pFrom, + WHERE_ORDERBY_LIMIT, nLoop-1, pFrom->aLoop[nLoop-1], &m); + if( rc==pWInfo->pOrderBy->nExpr ){ + pWInfo->bOrderedInnerLoop = 1; + pWInfo->revMask = m; + } + } + } } if( (pWInfo->wctrlFlags & WHERE_SORTBYGROUP) && pWInfo->nOBSat==pWInfo->pOrderBy->nExpr && nLoop>0 @@ -129913,7 +130734,7 @@ static int whereShortCut(WhereLoopBuilder *pBuilder){ Index *pIdx; pWInfo = pBuilder->pWInfo; - if( pWInfo->wctrlFlags & WHERE_FORCE_TABLE ) return 0; + if( pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE ) return 0; assert( pWInfo->pTabList->nSrc>=1 ); pItem = pWInfo->pTabList->a; pTab = pItem->pTab; @@ -130060,7 +130881,7 @@ static int whereShortCut(WhereLoopBuilder *pBuilder){ ** is called from an UPDATE or DELETE statement, then pOrderBy is NULL. ** ** The iIdxCur parameter is the cursor number of an index. If -** WHERE_ONETABLE_ONLY is set, iIdxCur is the cursor number of an index +** WHERE_OR_SUBCLAUSE is set, iIdxCur is the cursor number of an index ** to use for OR clause processing. The WHERE clause should use this ** specific cursor. If WHERE_ONEPASS_DESIRED is set, then iIdxCur is ** the first cursor in an array of cursors for all indices. iIdxCur should @@ -130074,7 +130895,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( ExprList *pOrderBy, /* An ORDER BY (or GROUP BY) clause, or NULL */ ExprList *pDistinctSet, /* Try not to output two rows that duplicate these */ u16 wctrlFlags, /* The WHERE_* flags defined in sqliteInt.h */ - int iAuxArg /* If WHERE_ONETABLE_ONLY is set, index cursor number + int iAuxArg /* If WHERE_OR_SUBCLAUSE is set, index cursor number ** If WHERE_USE_LIMIT, then the limit amount */ ){ int nByteWInfo; /* Num. bytes allocated for WhereInfo struct */ @@ -130093,11 +130914,11 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( assert( (wctrlFlags & WHERE_ONEPASS_MULTIROW)==0 || ( (wctrlFlags & WHERE_ONEPASS_DESIRED)!=0 - && (wctrlFlags & WHERE_OMIT_OPEN_CLOSE)==0 + && (wctrlFlags & WHERE_OR_SUBCLAUSE)==0 )); - /* Only one of WHERE_ONETABLE_ONLY or WHERE_USE_LIMIT */ - assert( (wctrlFlags & WHERE_ONETABLE_ONLY)==0 + /* Only one of WHERE_OR_SUBCLAUSE or WHERE_USE_LIMIT */ + assert( (wctrlFlags & WHERE_OR_SUBCLAUSE)==0 || (wctrlFlags & WHERE_USE_LIMIT)==0 ); /* Variable initialization */ @@ -130125,11 +130946,11 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( } /* This function normally generates a nested loop for all tables in - ** pTabList. But if the WHERE_ONETABLE_ONLY flag is set, then we should + ** pTabList. But if the WHERE_OR_SUBCLAUSE flag is set, then we should ** only generate code for the first table in pTabList and assume that ** any cursors associated with subsequent tables are uninitialized. */ - nTabList = (wctrlFlags & WHERE_ONETABLE_ONLY) ? 1 : pTabList->nSrc; + nTabList = (wctrlFlags & WHERE_OR_SUBCLAUSE) ? 1 : pTabList->nSrc; /* Allocate and initialize the WhereInfo structure that will become the ** return value. A single allocation is used to store the WhereInfo @@ -130205,7 +131026,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( ** Note that bitmasks are created for all pTabList->nSrc tables in ** pTabList, not just the first nTabList tables. nTabList is normally ** equal to pTabList->nSrc but might be shortened to 1 if the - ** WHERE_ONETABLE_ONLY flag is set. + ** WHERE_OR_SUBCLAUSE flag is set. */ for(ii=0; iinSrc; ii++){ createMask(pMaskSet, pTabList->a[ii].iCursor); @@ -130243,10 +131064,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( sqlite3DebugPrintf(")\n"); } if( sqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */ - int i; - for(i=0; inTerm; i++){ - whereTermPrint(&sWLB.pWC->a[i], i); - } + sqlite3WhereClausePrint(sWLB.pWC); } #endif @@ -130388,7 +131206,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( }else #endif if( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 - && (wctrlFlags & WHERE_OMIT_OPEN_CLOSE)==0 ){ + && (wctrlFlags & WHERE_OR_SUBCLAUSE)==0 ){ int op = OP_OpenRead; if( pWInfo->eOnePass!=ONEPASS_OFF ){ op = OP_OpenWrite; @@ -130427,7 +131245,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( /* iAuxArg is always set if to a positive value if ONEPASS is possible */ assert( iAuxArg!=0 || (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 ); if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIx) - && (wctrlFlags & WHERE_ONETABLE_ONLY)!=0 + && (wctrlFlags & WHERE_OR_SUBCLAUSE)!=0 ){ /* This is one term of an OR-optimization using the PRIMARY KEY of a ** WITHOUT ROWID table. No need for a separate index */ @@ -130443,9 +131261,9 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( } op = OP_OpenWrite; pWInfo->aiCurOnePass[1] = iIndexCur; - }else if( iAuxArg && (wctrlFlags & WHERE_ONETABLE_ONLY)!=0 ){ + }else if( iAuxArg && (wctrlFlags & WHERE_OR_SUBCLAUSE)!=0 ){ iIndexCur = iAuxArg; - if( wctrlFlags & WHERE_REOPEN_IDX ) op = OP_ReopenIdx; + op = OP_ReopenIdx; }else{ iIndexCur = pParse->nTab++; } @@ -130507,7 +131325,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( pLevel->addrBody = sqlite3VdbeCurrentAddr(v); notReady = sqlite3WhereCodeOneLoopStart(pWInfo, ii, notReady); pWInfo->iContinue = pLevel->addrCont; - if( (wsFlags&WHERE_MULTI_OR)==0 && (wctrlFlags&WHERE_ONETABLE_ONLY)==0 ){ + if( (wsFlags&WHERE_MULTI_OR)==0 && (wctrlFlags&WHERE_OR_SUBCLAUSE)==0 ){ sqlite3WhereAddScanStatus(v, pTabList, pLevel, addrExplain); } } @@ -130630,12 +131448,12 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ /* Close all of the cursors that were opened by sqlite3WhereBegin. ** Except, do not close cursors that will be reused by the OR optimization - ** (WHERE_OMIT_OPEN_CLOSE). And do not close the OP_OpenWrite cursors + ** (WHERE_OR_SUBCLAUSE). And do not close the OP_OpenWrite cursors ** created for the ONEPASS optimization. */ if( (pTab->tabFlags & TF_Ephemeral)==0 && pTab->pSelect==0 - && (pWInfo->wctrlFlags & WHERE_OMIT_OPEN_CLOSE)==0 + && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0 ){ int ws = pLoop->wsFlags; if( pWInfo->eOnePass==ONEPASS_OFF && (ws & WHERE_IDX_ONLY)==0 ){ @@ -130982,26 +131800,26 @@ static void disableLookaside(Parse *pParse){ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned char -#define YYNOCODE 251 +#define YYNOCODE 252 #define YYACTIONTYPE unsigned short int #define YYWILDCARD 96 #define sqlite3ParserTOKENTYPE Token typedef union { int yyinit; sqlite3ParserTOKENTYPE yy0; - struct LimitVal yy64; - Expr* yy122; - Select* yy159; - IdList* yy180; - struct {int value; int mask;} yy207; - struct LikeOp yy318; - TriggerStep* yy327; - With* yy331; - ExprSpan yy342; - SrcList* yy347; - int yy392; - struct TrigEvent yy410; - ExprList* yy442; + Expr* yy72; + TriggerStep* yy145; + ExprList* yy148; + SrcList* yy185; + ExprSpan yy190; + int yy194; + Select* yy243; + IdList* yy254; + With* yy285; + struct TrigEvent yy332; + struct LimitVal yy354; + struct LikeOp yy392; + struct {int value; int mask;} yy497; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -131011,16 +131829,16 @@ typedef union { #define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse #define sqlite3ParserARG_STORE yypParser->pParse = pParse #define YYFALLBACK 1 -#define YYNSTATE 440 -#define YYNRULE 326 -#define YY_MAX_SHIFT 439 -#define YY_MIN_SHIFTREDUCE 649 -#define YY_MAX_SHIFTREDUCE 974 -#define YY_MIN_REDUCE 975 -#define YY_MAX_REDUCE 1300 -#define YY_ERROR_ACTION 1301 -#define YY_ACCEPT_ACTION 1302 -#define YY_NO_ACTION 1303 +#define YYNSTATE 443 +#define YYNRULE 328 +#define YY_MAX_SHIFT 442 +#define YY_MIN_SHIFTREDUCE 653 +#define YY_MAX_SHIFTREDUCE 980 +#define YY_MIN_REDUCE 981 +#define YY_MAX_REDUCE 1308 +#define YY_ERROR_ACTION 1309 +#define YY_ACCEPT_ACTION 1310 +#define YY_NO_ACTION 1311 /************* End control #defines *******************************************/ /* Define the yytestcase() macro to be a no-op if is not already defined @@ -131088,159 +131906,159 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (1501) +#define YY_ACTTAB_COUNT (1507) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 315, 810, 339, 804, 5, 194, 194, 798, 92, 93, - /* 10 */ 83, 819, 819, 831, 834, 823, 823, 90, 90, 91, - /* 20 */ 91, 91, 91, 290, 89, 89, 89, 89, 88, 88, - /* 30 */ 87, 87, 87, 86, 339, 315, 952, 952, 803, 803, - /* 40 */ 803, 922, 342, 92, 93, 83, 819, 819, 831, 834, - /* 50 */ 823, 823, 90, 90, 91, 91, 91, 91, 123, 89, - /* 60 */ 89, 89, 89, 88, 88, 87, 87, 87, 86, 339, - /* 70 */ 88, 88, 87, 87, 87, 86, 339, 772, 952, 952, - /* 80 */ 315, 87, 87, 87, 86, 339, 773, 68, 92, 93, - /* 90 */ 83, 819, 819, 831, 834, 823, 823, 90, 90, 91, - /* 100 */ 91, 91, 91, 434, 89, 89, 89, 89, 88, 88, - /* 110 */ 87, 87, 87, 86, 339, 1302, 146, 921, 2, 315, - /* 120 */ 427, 24, 679, 953, 48, 86, 339, 92, 93, 83, - /* 130 */ 819, 819, 831, 834, 823, 823, 90, 90, 91, 91, - /* 140 */ 91, 91, 94, 89, 89, 89, 89, 88, 88, 87, - /* 150 */ 87, 87, 86, 339, 933, 933, 315, 259, 412, 398, - /* 160 */ 396, 57, 733, 733, 92, 93, 83, 819, 819, 831, - /* 170 */ 834, 823, 823, 90, 90, 91, 91, 91, 91, 56, - /* 180 */ 89, 89, 89, 89, 88, 88, 87, 87, 87, 86, - /* 190 */ 339, 315, 1245, 922, 342, 268, 934, 935, 241, 92, - /* 200 */ 93, 83, 819, 819, 831, 834, 823, 823, 90, 90, - /* 210 */ 91, 91, 91, 91, 291, 89, 89, 89, 89, 88, - /* 220 */ 88, 87, 87, 87, 86, 339, 315, 913, 1295, 682, - /* 230 */ 687, 1295, 233, 397, 92, 93, 83, 819, 819, 831, - /* 240 */ 834, 823, 823, 90, 90, 91, 91, 91, 91, 326, - /* 250 */ 89, 89, 89, 89, 88, 88, 87, 87, 87, 86, - /* 260 */ 339, 315, 85, 82, 168, 680, 431, 938, 939, 92, - /* 270 */ 93, 83, 819, 819, 831, 834, 823, 823, 90, 90, - /* 280 */ 91, 91, 91, 91, 291, 89, 89, 89, 89, 88, - /* 290 */ 88, 87, 87, 87, 86, 339, 315, 319, 913, 1296, - /* 300 */ 797, 911, 1296, 681, 92, 93, 83, 819, 819, 831, - /* 310 */ 834, 823, 823, 90, 90, 91, 91, 91, 91, 335, - /* 320 */ 89, 89, 89, 89, 88, 88, 87, 87, 87, 86, - /* 330 */ 339, 315, 876, 876, 373, 85, 82, 168, 944, 92, - /* 340 */ 93, 83, 819, 819, 831, 834, 823, 823, 90, 90, - /* 350 */ 91, 91, 91, 91, 896, 89, 89, 89, 89, 88, - /* 360 */ 88, 87, 87, 87, 86, 339, 315, 370, 307, 973, - /* 370 */ 367, 1, 911, 433, 92, 93, 83, 819, 819, 831, - /* 380 */ 834, 823, 823, 90, 90, 91, 91, 91, 91, 189, - /* 390 */ 89, 89, 89, 89, 88, 88, 87, 87, 87, 86, - /* 400 */ 339, 315, 720, 948, 933, 933, 149, 718, 948, 92, - /* 410 */ 93, 83, 819, 819, 831, 834, 823, 823, 90, 90, - /* 420 */ 91, 91, 91, 91, 434, 89, 89, 89, 89, 88, - /* 430 */ 88, 87, 87, 87, 86, 339, 338, 938, 939, 947, - /* 440 */ 694, 940, 974, 315, 953, 48, 934, 935, 715, 689, - /* 450 */ 71, 92, 93, 83, 819, 819, 831, 834, 823, 823, - /* 460 */ 90, 90, 91, 91, 91, 91, 320, 89, 89, 89, - /* 470 */ 89, 88, 88, 87, 87, 87, 86, 339, 315, 412, - /* 480 */ 403, 820, 820, 832, 835, 74, 92, 81, 83, 819, - /* 490 */ 819, 831, 834, 823, 823, 90, 90, 91, 91, 91, - /* 500 */ 91, 698, 89, 89, 89, 89, 88, 88, 87, 87, - /* 510 */ 87, 86, 339, 315, 259, 654, 655, 656, 393, 111, - /* 520 */ 331, 153, 93, 83, 819, 819, 831, 834, 823, 823, - /* 530 */ 90, 90, 91, 91, 91, 91, 434, 89, 89, 89, - /* 540 */ 89, 88, 88, 87, 87, 87, 86, 339, 315, 188, - /* 550 */ 187, 186, 824, 937, 328, 219, 953, 48, 83, 819, - /* 560 */ 819, 831, 834, 823, 823, 90, 90, 91, 91, 91, - /* 570 */ 91, 956, 89, 89, 89, 89, 88, 88, 87, 87, - /* 580 */ 87, 86, 339, 79, 429, 738, 3, 1174, 955, 348, - /* 590 */ 737, 332, 792, 933, 933, 937, 79, 429, 730, 3, - /* 600 */ 203, 160, 278, 391, 273, 390, 190, 892, 434, 400, - /* 610 */ 741, 76, 77, 271, 287, 253, 353, 242, 78, 340, - /* 620 */ 340, 85, 82, 168, 76, 77, 233, 397, 953, 48, - /* 630 */ 432, 78, 340, 340, 277, 934, 935, 185, 439, 651, - /* 640 */ 388, 385, 384, 432, 234, 276, 107, 418, 349, 337, - /* 650 */ 336, 383, 893, 728, 215, 949, 123, 971, 308, 810, - /* 660 */ 418, 436, 435, 412, 394, 798, 400, 873, 894, 123, - /* 670 */ 721, 872, 810, 889, 436, 435, 215, 949, 798, 351, - /* 680 */ 722, 697, 380, 434, 771, 371, 22, 434, 400, 79, - /* 690 */ 429, 232, 3, 189, 413, 870, 803, 803, 803, 805, - /* 700 */ 18, 54, 148, 953, 48, 956, 113, 953, 9, 803, - /* 710 */ 803, 803, 805, 18, 310, 123, 748, 76, 77, 742, - /* 720 */ 123, 325, 955, 866, 78, 340, 340, 113, 350, 359, - /* 730 */ 85, 82, 168, 343, 960, 960, 432, 770, 412, 414, - /* 740 */ 407, 23, 1240, 1240, 79, 429, 357, 3, 166, 91, - /* 750 */ 91, 91, 91, 418, 89, 89, 89, 89, 88, 88, - /* 760 */ 87, 87, 87, 86, 339, 810, 434, 436, 435, 792, - /* 770 */ 320, 798, 76, 77, 789, 271, 123, 434, 360, 78, - /* 780 */ 340, 340, 864, 85, 82, 168, 953, 9, 395, 743, - /* 790 */ 360, 432, 253, 358, 252, 933, 933, 953, 30, 889, - /* 800 */ 327, 216, 803, 803, 803, 805, 18, 113, 418, 89, - /* 810 */ 89, 89, 89, 88, 88, 87, 87, 87, 86, 339, - /* 820 */ 810, 113, 436, 435, 792, 185, 798, 288, 388, 385, - /* 830 */ 384, 123, 113, 920, 2, 796, 696, 934, 935, 383, - /* 840 */ 69, 429, 434, 3, 218, 110, 738, 253, 358, 252, - /* 850 */ 434, 737, 933, 933, 892, 359, 222, 803, 803, 803, - /* 860 */ 805, 18, 953, 47, 933, 933, 933, 933, 76, 77, - /* 870 */ 953, 9, 366, 904, 217, 78, 340, 340, 677, 305, - /* 880 */ 304, 303, 206, 301, 224, 259, 664, 432, 337, 336, - /* 890 */ 434, 228, 247, 144, 934, 935, 933, 933, 667, 893, - /* 900 */ 324, 1259, 96, 434, 418, 796, 934, 935, 934, 935, - /* 910 */ 953, 48, 401, 148, 289, 894, 810, 417, 436, 435, - /* 920 */ 677, 759, 798, 953, 9, 314, 220, 162, 161, 170, - /* 930 */ 402, 239, 953, 8, 194, 683, 683, 410, 934, 935, - /* 940 */ 238, 959, 933, 933, 225, 408, 945, 365, 957, 212, - /* 950 */ 958, 172, 757, 803, 803, 803, 805, 18, 173, 365, - /* 960 */ 176, 123, 171, 113, 244, 952, 246, 434, 356, 796, - /* 970 */ 372, 365, 236, 960, 960, 810, 290, 804, 191, 165, - /* 980 */ 852, 798, 259, 316, 934, 935, 237, 953, 34, 404, - /* 990 */ 91, 91, 91, 91, 84, 89, 89, 89, 89, 88, - /* 1000 */ 88, 87, 87, 87, 86, 339, 701, 952, 434, 240, - /* 1010 */ 347, 758, 803, 803, 803, 434, 245, 1179, 434, 389, - /* 1020 */ 434, 376, 434, 895, 167, 434, 405, 702, 953, 35, - /* 1030 */ 673, 321, 221, 434, 333, 953, 11, 434, 953, 26, - /* 1040 */ 953, 36, 953, 37, 251, 953, 38, 434, 259, 434, - /* 1050 */ 757, 434, 329, 953, 27, 434, 223, 953, 28, 434, - /* 1060 */ 690, 434, 67, 434, 65, 434, 862, 953, 39, 953, - /* 1070 */ 40, 953, 41, 423, 434, 953, 10, 434, 772, 953, - /* 1080 */ 42, 953, 98, 953, 43, 953, 44, 773, 434, 346, - /* 1090 */ 434, 75, 434, 73, 953, 31, 434, 953, 45, 434, - /* 1100 */ 259, 434, 690, 434, 757, 434, 887, 434, 953, 46, - /* 1110 */ 953, 32, 953, 115, 434, 266, 953, 116, 951, 953, - /* 1120 */ 117, 953, 52, 953, 33, 953, 99, 953, 49, 726, - /* 1130 */ 434, 909, 434, 19, 953, 100, 434, 344, 434, 113, - /* 1140 */ 434, 258, 692, 434, 259, 434, 670, 434, 20, 434, - /* 1150 */ 953, 101, 953, 97, 434, 259, 953, 114, 953, 112, - /* 1160 */ 953, 105, 113, 953, 104, 953, 102, 953, 103, 953, - /* 1170 */ 51, 434, 148, 434, 953, 53, 167, 434, 259, 113, - /* 1180 */ 300, 307, 912, 363, 311, 860, 248, 261, 209, 264, - /* 1190 */ 416, 953, 50, 953, 25, 420, 727, 953, 29, 430, - /* 1200 */ 321, 424, 757, 428, 322, 124, 1269, 214, 165, 710, - /* 1210 */ 859, 908, 806, 794, 309, 158, 193, 361, 254, 723, - /* 1220 */ 364, 67, 381, 269, 735, 199, 67, 70, 113, 700, - /* 1230 */ 699, 707, 708, 884, 113, 766, 113, 855, 193, 883, - /* 1240 */ 199, 869, 869, 675, 868, 868, 109, 368, 255, 260, - /* 1250 */ 263, 280, 859, 265, 806, 974, 267, 711, 695, 272, - /* 1260 */ 764, 282, 795, 284, 150, 744, 755, 415, 292, 293, - /* 1270 */ 802, 678, 672, 661, 660, 662, 927, 6, 306, 386, - /* 1280 */ 352, 786, 243, 250, 886, 362, 163, 286, 419, 298, - /* 1290 */ 930, 159, 968, 196, 126, 903, 901, 965, 55, 58, - /* 1300 */ 323, 275, 857, 136, 147, 694, 856, 121, 65, 354, - /* 1310 */ 355, 379, 175, 61, 151, 369, 180, 871, 375, 129, - /* 1320 */ 257, 756, 210, 181, 145, 131, 132, 377, 262, 663, - /* 1330 */ 133, 134, 139, 783, 791, 182, 392, 183, 312, 330, - /* 1340 */ 714, 888, 713, 851, 692, 195, 712, 406, 686, 705, - /* 1350 */ 313, 685, 64, 839, 274, 72, 684, 334, 942, 95, - /* 1360 */ 752, 279, 281, 704, 753, 751, 422, 283, 411, 750, - /* 1370 */ 426, 66, 204, 409, 21, 285, 928, 669, 437, 205, - /* 1380 */ 207, 208, 438, 658, 657, 652, 118, 108, 119, 226, - /* 1390 */ 650, 341, 157, 235, 169, 345, 106, 734, 790, 296, - /* 1400 */ 294, 295, 120, 297, 867, 865, 127, 128, 130, 724, - /* 1410 */ 229, 174, 249, 882, 137, 230, 138, 135, 885, 231, - /* 1420 */ 59, 60, 177, 881, 7, 178, 12, 179, 256, 874, - /* 1430 */ 140, 193, 962, 374, 141, 152, 666, 378, 276, 184, - /* 1440 */ 270, 122, 142, 382, 387, 62, 13, 14, 703, 63, - /* 1450 */ 125, 317, 318, 227, 809, 808, 837, 732, 15, 164, - /* 1460 */ 736, 4, 765, 211, 399, 213, 192, 143, 760, 70, - /* 1470 */ 67, 16, 17, 838, 836, 891, 841, 890, 198, 197, - /* 1480 */ 917, 154, 421, 923, 918, 155, 200, 977, 425, 840, - /* 1490 */ 156, 201, 807, 676, 80, 302, 299, 977, 202, 1261, - /* 1500 */ 1260, + /* 0 */ 317, 814, 341, 808, 5, 195, 195, 802, 93, 94, + /* 10 */ 84, 823, 823, 835, 838, 827, 827, 91, 91, 92, + /* 20 */ 92, 92, 92, 293, 90, 90, 90, 90, 89, 89, + /* 30 */ 88, 88, 88, 87, 341, 317, 958, 958, 807, 807, + /* 40 */ 807, 928, 344, 93, 94, 84, 823, 823, 835, 838, + /* 50 */ 827, 827, 91, 91, 92, 92, 92, 92, 328, 90, + /* 60 */ 90, 90, 90, 89, 89, 88, 88, 88, 87, 341, + /* 70 */ 89, 89, 88, 88, 88, 87, 341, 776, 958, 958, + /* 80 */ 317, 88, 88, 88, 87, 341, 777, 69, 93, 94, + /* 90 */ 84, 823, 823, 835, 838, 827, 827, 91, 91, 92, + /* 100 */ 92, 92, 92, 437, 90, 90, 90, 90, 89, 89, + /* 110 */ 88, 88, 88, 87, 341, 1310, 147, 147, 2, 317, + /* 120 */ 76, 25, 74, 49, 49, 87, 341, 93, 94, 84, + /* 130 */ 823, 823, 835, 838, 827, 827, 91, 91, 92, 92, + /* 140 */ 92, 92, 95, 90, 90, 90, 90, 89, 89, 88, + /* 150 */ 88, 88, 87, 341, 939, 939, 317, 260, 415, 400, + /* 160 */ 398, 58, 737, 737, 93, 94, 84, 823, 823, 835, + /* 170 */ 838, 827, 827, 91, 91, 92, 92, 92, 92, 57, + /* 180 */ 90, 90, 90, 90, 89, 89, 88, 88, 88, 87, + /* 190 */ 341, 317, 1253, 928, 344, 269, 940, 941, 242, 93, + /* 200 */ 94, 84, 823, 823, 835, 838, 827, 827, 91, 91, + /* 210 */ 92, 92, 92, 92, 293, 90, 90, 90, 90, 89, + /* 220 */ 89, 88, 88, 88, 87, 341, 317, 919, 1303, 793, + /* 230 */ 691, 1303, 724, 724, 93, 94, 84, 823, 823, 835, + /* 240 */ 838, 827, 827, 91, 91, 92, 92, 92, 92, 337, + /* 250 */ 90, 90, 90, 90, 89, 89, 88, 88, 88, 87, + /* 260 */ 341, 317, 114, 919, 1304, 684, 395, 1304, 124, 93, + /* 270 */ 94, 84, 823, 823, 835, 838, 827, 827, 91, 91, + /* 280 */ 92, 92, 92, 92, 683, 90, 90, 90, 90, 89, + /* 290 */ 89, 88, 88, 88, 87, 341, 317, 86, 83, 169, + /* 300 */ 801, 917, 234, 399, 93, 94, 84, 823, 823, 835, + /* 310 */ 838, 827, 827, 91, 91, 92, 92, 92, 92, 686, + /* 320 */ 90, 90, 90, 90, 89, 89, 88, 88, 88, 87, + /* 330 */ 341, 317, 436, 742, 86, 83, 169, 917, 741, 93, + /* 340 */ 94, 84, 823, 823, 835, 838, 827, 827, 91, 91, + /* 350 */ 92, 92, 92, 92, 902, 90, 90, 90, 90, 89, + /* 360 */ 89, 88, 88, 88, 87, 341, 317, 321, 434, 434, + /* 370 */ 434, 1, 722, 722, 93, 94, 84, 823, 823, 835, + /* 380 */ 838, 827, 827, 91, 91, 92, 92, 92, 92, 190, + /* 390 */ 90, 90, 90, 90, 89, 89, 88, 88, 88, 87, + /* 400 */ 341, 317, 685, 292, 939, 939, 150, 977, 310, 93, + /* 410 */ 94, 84, 823, 823, 835, 838, 827, 827, 91, 91, + /* 420 */ 92, 92, 92, 92, 437, 90, 90, 90, 90, 89, + /* 430 */ 89, 88, 88, 88, 87, 341, 926, 2, 372, 719, + /* 440 */ 698, 369, 950, 317, 49, 49, 940, 941, 719, 177, + /* 450 */ 72, 93, 94, 84, 823, 823, 835, 838, 827, 827, + /* 460 */ 91, 91, 92, 92, 92, 92, 322, 90, 90, 90, + /* 470 */ 90, 89, 89, 88, 88, 88, 87, 341, 317, 415, + /* 480 */ 405, 824, 824, 836, 839, 75, 93, 82, 84, 823, + /* 490 */ 823, 835, 838, 827, 827, 91, 91, 92, 92, 92, + /* 500 */ 92, 430, 90, 90, 90, 90, 89, 89, 88, 88, + /* 510 */ 88, 87, 341, 317, 340, 340, 340, 658, 659, 660, + /* 520 */ 333, 288, 94, 84, 823, 823, 835, 838, 827, 827, + /* 530 */ 91, 91, 92, 92, 92, 92, 437, 90, 90, 90, + /* 540 */ 90, 89, 89, 88, 88, 88, 87, 341, 317, 882, + /* 550 */ 882, 375, 828, 66, 330, 409, 49, 49, 84, 823, + /* 560 */ 823, 835, 838, 827, 827, 91, 91, 92, 92, 92, + /* 570 */ 92, 351, 90, 90, 90, 90, 89, 89, 88, 88, + /* 580 */ 88, 87, 341, 80, 432, 742, 3, 1180, 351, 350, + /* 590 */ 741, 334, 796, 939, 939, 761, 80, 432, 278, 3, + /* 600 */ 204, 161, 279, 393, 274, 392, 191, 362, 437, 277, + /* 610 */ 745, 77, 78, 272, 800, 254, 355, 243, 79, 342, + /* 620 */ 342, 86, 83, 169, 77, 78, 234, 399, 49, 49, + /* 630 */ 435, 79, 342, 342, 437, 940, 941, 186, 442, 655, + /* 640 */ 390, 387, 386, 435, 235, 213, 108, 421, 761, 351, + /* 650 */ 437, 385, 167, 732, 10, 10, 124, 124, 671, 814, + /* 660 */ 421, 439, 438, 415, 414, 802, 362, 168, 327, 124, + /* 670 */ 49, 49, 814, 219, 439, 438, 800, 186, 802, 326, + /* 680 */ 390, 387, 386, 437, 1248, 1248, 23, 939, 939, 80, + /* 690 */ 432, 385, 3, 761, 416, 876, 807, 807, 807, 809, + /* 700 */ 19, 290, 149, 49, 49, 415, 396, 260, 910, 807, + /* 710 */ 807, 807, 809, 19, 312, 237, 145, 77, 78, 746, + /* 720 */ 168, 702, 437, 149, 79, 342, 342, 114, 358, 940, + /* 730 */ 941, 302, 223, 397, 345, 313, 435, 260, 415, 417, + /* 740 */ 858, 374, 31, 31, 80, 432, 761, 3, 348, 92, + /* 750 */ 92, 92, 92, 421, 90, 90, 90, 90, 89, 89, + /* 760 */ 88, 88, 88, 87, 341, 814, 114, 439, 438, 796, + /* 770 */ 367, 802, 77, 78, 701, 796, 124, 1187, 220, 79, + /* 780 */ 342, 342, 124, 747, 734, 939, 939, 775, 404, 939, + /* 790 */ 939, 435, 254, 360, 253, 402, 895, 346, 254, 360, + /* 800 */ 253, 774, 807, 807, 807, 809, 19, 800, 421, 90, + /* 810 */ 90, 90, 90, 89, 89, 88, 88, 88, 87, 341, + /* 820 */ 814, 114, 439, 438, 939, 939, 802, 940, 941, 114, + /* 830 */ 437, 940, 941, 86, 83, 169, 192, 166, 309, 979, + /* 840 */ 70, 432, 700, 3, 382, 870, 238, 86, 83, 169, + /* 850 */ 10, 10, 361, 406, 763, 190, 222, 807, 807, 807, + /* 860 */ 809, 19, 870, 872, 329, 24, 940, 941, 77, 78, + /* 870 */ 359, 437, 335, 260, 218, 79, 342, 342, 437, 307, + /* 880 */ 306, 305, 207, 303, 339, 338, 668, 435, 339, 338, + /* 890 */ 407, 10, 10, 762, 216, 216, 939, 939, 49, 49, + /* 900 */ 437, 260, 97, 241, 421, 225, 402, 189, 188, 187, + /* 910 */ 309, 918, 980, 149, 221, 898, 814, 868, 439, 438, + /* 920 */ 10, 10, 802, 870, 915, 316, 898, 163, 162, 171, + /* 930 */ 249, 240, 322, 410, 412, 687, 687, 272, 940, 941, + /* 940 */ 239, 965, 901, 437, 226, 403, 226, 437, 963, 367, + /* 950 */ 964, 173, 248, 807, 807, 807, 809, 19, 174, 367, + /* 960 */ 899, 124, 172, 48, 48, 9, 9, 35, 35, 966, + /* 970 */ 966, 899, 363, 966, 966, 814, 900, 808, 725, 939, + /* 980 */ 939, 802, 895, 318, 980, 324, 125, 900, 726, 420, + /* 990 */ 92, 92, 92, 92, 85, 90, 90, 90, 90, 89, + /* 1000 */ 89, 88, 88, 88, 87, 341, 216, 216, 437, 946, + /* 1010 */ 349, 292, 807, 807, 807, 114, 291, 693, 402, 705, + /* 1020 */ 890, 940, 941, 437, 245, 889, 247, 437, 36, 36, + /* 1030 */ 437, 353, 391, 437, 260, 252, 260, 437, 361, 437, + /* 1040 */ 706, 437, 370, 12, 12, 224, 437, 27, 27, 437, + /* 1050 */ 37, 37, 437, 38, 38, 752, 368, 39, 39, 28, + /* 1060 */ 28, 29, 29, 215, 166, 331, 40, 40, 437, 41, + /* 1070 */ 41, 437, 42, 42, 437, 866, 246, 731, 437, 879, + /* 1080 */ 437, 256, 437, 878, 437, 267, 437, 261, 11, 11, + /* 1090 */ 437, 43, 43, 437, 99, 99, 437, 373, 44, 44, + /* 1100 */ 45, 45, 32, 32, 46, 46, 47, 47, 437, 426, + /* 1110 */ 33, 33, 776, 116, 116, 437, 117, 117, 437, 124, + /* 1120 */ 437, 777, 437, 260, 437, 957, 437, 352, 118, 118, + /* 1130 */ 437, 195, 437, 111, 437, 53, 53, 264, 34, 34, + /* 1140 */ 100, 100, 50, 50, 101, 101, 102, 102, 437, 260, + /* 1150 */ 98, 98, 115, 115, 113, 113, 437, 262, 437, 265, + /* 1160 */ 437, 943, 958, 437, 727, 437, 681, 437, 106, 106, + /* 1170 */ 68, 437, 893, 730, 437, 365, 105, 105, 103, 103, + /* 1180 */ 104, 104, 217, 52, 52, 54, 54, 51, 51, 694, + /* 1190 */ 259, 26, 26, 266, 30, 30, 677, 323, 433, 323, + /* 1200 */ 674, 423, 427, 943, 958, 114, 114, 431, 681, 865, + /* 1210 */ 1277, 233, 366, 714, 112, 20, 154, 704, 703, 810, + /* 1220 */ 914, 55, 159, 311, 798, 255, 383, 194, 68, 200, + /* 1230 */ 21, 694, 268, 114, 114, 114, 270, 711, 712, 68, + /* 1240 */ 114, 739, 770, 715, 71, 194, 861, 875, 875, 200, + /* 1250 */ 696, 865, 874, 874, 679, 699, 273, 110, 229, 419, + /* 1260 */ 768, 810, 799, 378, 748, 759, 418, 210, 294, 281, + /* 1270 */ 295, 806, 283, 682, 676, 665, 664, 666, 933, 151, + /* 1280 */ 285, 7, 1267, 308, 251, 790, 354, 244, 892, 364, + /* 1290 */ 287, 422, 300, 164, 160, 936, 974, 127, 197, 137, + /* 1300 */ 909, 907, 971, 388, 276, 863, 862, 56, 698, 325, + /* 1310 */ 148, 59, 122, 66, 356, 381, 357, 176, 152, 62, + /* 1320 */ 371, 130, 877, 181, 377, 760, 211, 182, 132, 133, + /* 1330 */ 134, 135, 258, 146, 140, 795, 787, 263, 183, 379, + /* 1340 */ 667, 394, 184, 332, 894, 314, 718, 717, 857, 716, + /* 1350 */ 696, 315, 709, 690, 65, 196, 6, 408, 289, 708, + /* 1360 */ 275, 689, 688, 948, 756, 757, 280, 282, 425, 755, + /* 1370 */ 284, 336, 73, 67, 754, 429, 411, 96, 286, 413, + /* 1380 */ 205, 934, 673, 22, 209, 440, 119, 120, 109, 206, + /* 1390 */ 208, 441, 662, 661, 656, 843, 654, 343, 158, 236, + /* 1400 */ 170, 347, 107, 227, 121, 738, 873, 298, 296, 297, + /* 1410 */ 299, 871, 794, 128, 129, 728, 230, 131, 175, 250, + /* 1420 */ 888, 136, 138, 231, 232, 139, 60, 61, 891, 178, + /* 1430 */ 179, 887, 8, 13, 180, 257, 880, 968, 194, 141, + /* 1440 */ 142, 376, 153, 670, 380, 185, 143, 277, 63, 384, + /* 1450 */ 14, 707, 271, 15, 389, 64, 319, 320, 126, 228, + /* 1460 */ 813, 812, 841, 736, 123, 16, 401, 740, 4, 769, + /* 1470 */ 165, 212, 214, 193, 144, 764, 71, 68, 17, 18, + /* 1480 */ 856, 842, 840, 897, 845, 896, 199, 198, 923, 155, + /* 1490 */ 424, 929, 924, 156, 201, 202, 428, 844, 157, 203, + /* 1500 */ 811, 680, 81, 1269, 1268, 301, 304, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 19, 95, 53, 97, 22, 24, 24, 101, 27, 28, @@ -131248,14 +132066,14 @@ static const YYCODETYPE yy_lookahead[] = { /* 20 */ 39, 40, 41, 152, 43, 44, 45, 46, 47, 48, /* 30 */ 49, 50, 51, 52, 53, 19, 55, 55, 132, 133, /* 40 */ 134, 1, 2, 27, 28, 29, 30, 31, 32, 33, - /* 50 */ 34, 35, 36, 37, 38, 39, 40, 41, 92, 43, + /* 50 */ 34, 35, 36, 37, 38, 39, 40, 41, 187, 43, /* 60 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, /* 70 */ 47, 48, 49, 50, 51, 52, 53, 61, 97, 97, /* 80 */ 19, 49, 50, 51, 52, 53, 70, 26, 27, 28, /* 90 */ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, /* 100 */ 39, 40, 41, 152, 43, 44, 45, 46, 47, 48, /* 110 */ 49, 50, 51, 52, 53, 144, 145, 146, 147, 19, - /* 120 */ 249, 22, 172, 172, 173, 52, 53, 27, 28, 29, + /* 120 */ 137, 22, 139, 172, 173, 52, 53, 27, 28, 29, /* 130 */ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, /* 140 */ 40, 41, 81, 43, 44, 45, 46, 47, 48, 49, /* 150 */ 50, 51, 52, 53, 55, 56, 19, 152, 207, 208, @@ -131265,269 +132083,271 @@ static const YYCODETYPE yy_lookahead[] = { /* 190 */ 53, 19, 0, 1, 2, 23, 97, 98, 193, 27, /* 200 */ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, /* 210 */ 38, 39, 40, 41, 152, 43, 44, 45, 46, 47, - /* 220 */ 48, 49, 50, 51, 52, 53, 19, 22, 23, 172, - /* 230 */ 23, 26, 119, 120, 27, 28, 29, 30, 31, 32, + /* 220 */ 48, 49, 50, 51, 52, 53, 19, 22, 23, 163, + /* 230 */ 23, 26, 190, 191, 27, 28, 29, 30, 31, 32, /* 240 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 187, /* 250 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - /* 260 */ 53, 19, 221, 222, 223, 23, 168, 169, 170, 27, + /* 260 */ 53, 19, 196, 22, 23, 23, 49, 26, 92, 27, /* 270 */ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - /* 280 */ 38, 39, 40, 41, 152, 43, 44, 45, 46, 47, - /* 290 */ 48, 49, 50, 51, 52, 53, 19, 157, 22, 23, - /* 300 */ 23, 96, 26, 172, 27, 28, 29, 30, 31, 32, - /* 310 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 187, + /* 280 */ 38, 39, 40, 41, 172, 43, 44, 45, 46, 47, + /* 290 */ 48, 49, 50, 51, 52, 53, 19, 221, 222, 223, + /* 300 */ 23, 96, 119, 120, 27, 28, 29, 30, 31, 32, + /* 310 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 172, /* 320 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - /* 330 */ 53, 19, 108, 109, 110, 221, 222, 223, 185, 27, + /* 330 */ 53, 19, 152, 116, 221, 222, 223, 96, 121, 27, /* 340 */ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - /* 350 */ 38, 39, 40, 41, 240, 43, 44, 45, 46, 47, - /* 360 */ 48, 49, 50, 51, 52, 53, 19, 227, 22, 23, - /* 370 */ 230, 22, 96, 152, 27, 28, 29, 30, 31, 32, + /* 350 */ 38, 39, 40, 41, 241, 43, 44, 45, 46, 47, + /* 360 */ 48, 49, 50, 51, 52, 53, 19, 157, 168, 169, + /* 370 */ 170, 22, 190, 191, 27, 28, 29, 30, 31, 32, /* 380 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 30, /* 390 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - /* 400 */ 53, 19, 190, 191, 55, 56, 24, 190, 191, 27, + /* 400 */ 53, 19, 172, 152, 55, 56, 24, 247, 248, 27, /* 410 */ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, /* 420 */ 38, 39, 40, 41, 152, 43, 44, 45, 46, 47, - /* 430 */ 48, 49, 50, 51, 52, 53, 168, 169, 170, 179, - /* 440 */ 180, 171, 96, 19, 172, 173, 97, 98, 188, 179, + /* 430 */ 48, 49, 50, 51, 52, 53, 146, 147, 228, 179, + /* 440 */ 180, 231, 185, 19, 172, 173, 97, 98, 188, 26, /* 450 */ 138, 27, 28, 29, 30, 31, 32, 33, 34, 35, /* 460 */ 36, 37, 38, 39, 40, 41, 107, 43, 44, 45, /* 470 */ 46, 47, 48, 49, 50, 51, 52, 53, 19, 207, /* 480 */ 208, 30, 31, 32, 33, 138, 27, 28, 29, 30, /* 490 */ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - /* 500 */ 41, 181, 43, 44, 45, 46, 47, 48, 49, 50, - /* 510 */ 51, 52, 53, 19, 152, 7, 8, 9, 49, 22, - /* 520 */ 19, 24, 28, 29, 30, 31, 32, 33, 34, 35, + /* 500 */ 41, 250, 43, 44, 45, 46, 47, 48, 49, 50, + /* 510 */ 51, 52, 53, 19, 168, 169, 170, 7, 8, 9, + /* 520 */ 19, 152, 28, 29, 30, 31, 32, 33, 34, 35, /* 530 */ 36, 37, 38, 39, 40, 41, 152, 43, 44, 45, /* 540 */ 46, 47, 48, 49, 50, 51, 52, 53, 19, 108, - /* 550 */ 109, 110, 101, 55, 53, 193, 172, 173, 29, 30, + /* 550 */ 109, 110, 101, 130, 53, 152, 172, 173, 29, 30, /* 560 */ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, /* 570 */ 41, 152, 43, 44, 45, 46, 47, 48, 49, 50, /* 580 */ 51, 52, 53, 19, 20, 116, 22, 23, 169, 170, - /* 590 */ 121, 207, 85, 55, 56, 97, 19, 20, 195, 22, - /* 600 */ 99, 100, 101, 102, 103, 104, 105, 12, 152, 206, + /* 590 */ 121, 207, 85, 55, 56, 26, 19, 20, 101, 22, + /* 600 */ 99, 100, 101, 102, 103, 104, 105, 152, 152, 112, /* 610 */ 210, 47, 48, 112, 152, 108, 109, 110, 54, 55, /* 620 */ 56, 221, 222, 223, 47, 48, 119, 120, 172, 173, - /* 630 */ 66, 54, 55, 56, 101, 97, 98, 99, 148, 149, - /* 640 */ 102, 103, 104, 66, 154, 112, 156, 83, 229, 47, - /* 650 */ 48, 113, 57, 163, 194, 195, 92, 246, 247, 95, - /* 660 */ 83, 97, 98, 207, 208, 101, 206, 59, 73, 92, - /* 670 */ 75, 63, 95, 163, 97, 98, 194, 195, 101, 219, - /* 680 */ 85, 181, 19, 152, 175, 77, 196, 152, 206, 19, - /* 690 */ 20, 199, 22, 30, 163, 11, 132, 133, 134, 135, - /* 700 */ 136, 209, 152, 172, 173, 152, 196, 172, 173, 132, - /* 710 */ 133, 134, 135, 136, 164, 92, 213, 47, 48, 49, - /* 720 */ 92, 186, 169, 170, 54, 55, 56, 196, 100, 219, - /* 730 */ 221, 222, 223, 243, 132, 133, 66, 175, 207, 208, - /* 740 */ 152, 231, 119, 120, 19, 20, 236, 22, 152, 38, + /* 630 */ 66, 54, 55, 56, 152, 97, 98, 99, 148, 149, + /* 640 */ 102, 103, 104, 66, 154, 23, 156, 83, 26, 230, + /* 650 */ 152, 113, 152, 163, 172, 173, 92, 92, 21, 95, + /* 660 */ 83, 97, 98, 207, 208, 101, 152, 98, 186, 92, + /* 670 */ 172, 173, 95, 218, 97, 98, 152, 99, 101, 217, + /* 680 */ 102, 103, 104, 152, 119, 120, 196, 55, 56, 19, + /* 690 */ 20, 113, 22, 124, 163, 11, 132, 133, 134, 135, + /* 700 */ 136, 152, 152, 172, 173, 207, 208, 152, 152, 132, + /* 710 */ 133, 134, 135, 136, 164, 152, 84, 47, 48, 49, + /* 720 */ 98, 181, 152, 152, 54, 55, 56, 196, 91, 97, + /* 730 */ 98, 160, 218, 163, 244, 164, 66, 152, 207, 208, + /* 740 */ 103, 217, 172, 173, 19, 20, 124, 22, 193, 38, /* 750 */ 39, 40, 41, 83, 43, 44, 45, 46, 47, 48, - /* 760 */ 49, 50, 51, 52, 53, 95, 152, 97, 98, 85, - /* 770 */ 107, 101, 47, 48, 163, 112, 92, 152, 152, 54, - /* 780 */ 55, 56, 229, 221, 222, 223, 172, 173, 163, 49, - /* 790 */ 152, 66, 108, 109, 110, 55, 56, 172, 173, 163, - /* 800 */ 186, 22, 132, 133, 134, 135, 136, 196, 83, 43, + /* 760 */ 49, 50, 51, 52, 53, 95, 196, 97, 98, 85, + /* 770 */ 152, 101, 47, 48, 181, 85, 92, 140, 193, 54, + /* 780 */ 55, 56, 92, 49, 195, 55, 56, 175, 163, 55, + /* 790 */ 56, 66, 108, 109, 110, 206, 163, 242, 108, 109, + /* 800 */ 110, 175, 132, 133, 134, 135, 136, 152, 83, 43, /* 810 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - /* 820 */ 95, 196, 97, 98, 85, 99, 101, 152, 102, 103, - /* 830 */ 104, 92, 196, 146, 147, 152, 181, 97, 98, 113, - /* 840 */ 19, 20, 152, 22, 218, 22, 116, 108, 109, 110, - /* 850 */ 152, 121, 55, 56, 12, 219, 218, 132, 133, 134, - /* 860 */ 135, 136, 172, 173, 55, 56, 55, 56, 47, 48, - /* 870 */ 172, 173, 236, 152, 5, 54, 55, 56, 55, 10, - /* 880 */ 11, 12, 13, 14, 186, 152, 17, 66, 47, 48, - /* 890 */ 152, 210, 16, 84, 97, 98, 55, 56, 21, 57, - /* 900 */ 217, 122, 22, 152, 83, 152, 97, 98, 97, 98, - /* 910 */ 172, 173, 152, 152, 224, 73, 95, 75, 97, 98, - /* 920 */ 97, 124, 101, 172, 173, 164, 193, 47, 48, 60, - /* 930 */ 163, 62, 172, 173, 24, 55, 56, 186, 97, 98, - /* 940 */ 71, 100, 55, 56, 183, 207, 185, 152, 107, 23, - /* 950 */ 109, 82, 26, 132, 133, 134, 135, 136, 89, 152, - /* 960 */ 26, 92, 93, 196, 88, 55, 90, 152, 91, 152, - /* 970 */ 217, 152, 152, 132, 133, 95, 152, 97, 211, 212, - /* 980 */ 103, 101, 152, 114, 97, 98, 152, 172, 173, 19, + /* 820 */ 95, 196, 97, 98, 55, 56, 101, 97, 98, 196, + /* 830 */ 152, 97, 98, 221, 222, 223, 211, 212, 22, 23, + /* 840 */ 19, 20, 181, 22, 19, 152, 152, 221, 222, 223, + /* 850 */ 172, 173, 219, 19, 124, 30, 238, 132, 133, 134, + /* 860 */ 135, 136, 169, 170, 186, 232, 97, 98, 47, 48, + /* 870 */ 237, 152, 217, 152, 5, 54, 55, 56, 152, 10, + /* 880 */ 11, 12, 13, 14, 47, 48, 17, 66, 47, 48, + /* 890 */ 56, 172, 173, 124, 194, 195, 55, 56, 172, 173, + /* 900 */ 152, 152, 22, 152, 83, 186, 206, 108, 109, 110, + /* 910 */ 22, 23, 96, 152, 193, 12, 95, 152, 97, 98, + /* 920 */ 172, 173, 101, 230, 152, 164, 12, 47, 48, 60, + /* 930 */ 152, 62, 107, 207, 186, 55, 56, 112, 97, 98, + /* 940 */ 71, 100, 193, 152, 183, 152, 185, 152, 107, 152, + /* 950 */ 109, 82, 16, 132, 133, 134, 135, 136, 89, 152, + /* 960 */ 57, 92, 93, 172, 173, 172, 173, 172, 173, 132, + /* 970 */ 133, 57, 152, 132, 133, 95, 73, 97, 75, 55, + /* 980 */ 56, 101, 163, 114, 96, 245, 246, 73, 85, 75, /* 990 */ 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - /* 1000 */ 48, 49, 50, 51, 52, 53, 65, 97, 152, 152, - /* 1010 */ 141, 124, 132, 133, 134, 152, 140, 140, 152, 78, - /* 1020 */ 152, 233, 152, 193, 98, 152, 56, 86, 172, 173, - /* 1030 */ 166, 167, 237, 152, 217, 172, 173, 152, 172, 173, - /* 1040 */ 172, 173, 172, 173, 237, 172, 173, 152, 152, 152, - /* 1050 */ 124, 152, 111, 172, 173, 152, 237, 172, 173, 152, - /* 1060 */ 55, 152, 26, 152, 130, 152, 152, 172, 173, 172, - /* 1070 */ 173, 172, 173, 249, 152, 172, 173, 152, 61, 172, - /* 1080 */ 173, 172, 173, 172, 173, 172, 173, 70, 152, 193, - /* 1090 */ 152, 137, 152, 139, 172, 173, 152, 172, 173, 152, - /* 1100 */ 152, 152, 97, 152, 26, 152, 163, 152, 172, 173, - /* 1110 */ 172, 173, 172, 173, 152, 16, 172, 173, 26, 172, - /* 1120 */ 173, 172, 173, 172, 173, 172, 173, 172, 173, 163, - /* 1130 */ 152, 152, 152, 22, 172, 173, 152, 241, 152, 196, - /* 1140 */ 152, 193, 106, 152, 152, 152, 163, 152, 37, 152, - /* 1150 */ 172, 173, 172, 173, 152, 152, 172, 173, 172, 173, - /* 1160 */ 172, 173, 196, 172, 173, 172, 173, 172, 173, 172, - /* 1170 */ 173, 152, 152, 152, 172, 173, 98, 152, 152, 196, - /* 1180 */ 160, 22, 23, 19, 164, 193, 152, 88, 232, 90, - /* 1190 */ 191, 172, 173, 172, 173, 163, 193, 172, 173, 166, - /* 1200 */ 167, 163, 124, 163, 244, 245, 23, 211, 212, 26, - /* 1210 */ 55, 23, 55, 23, 26, 123, 26, 152, 23, 193, - /* 1220 */ 56, 26, 23, 23, 23, 26, 26, 26, 196, 100, - /* 1230 */ 101, 7, 8, 152, 196, 23, 196, 23, 26, 152, - /* 1240 */ 26, 132, 133, 23, 132, 133, 26, 152, 152, 152, - /* 1250 */ 152, 210, 97, 152, 97, 96, 152, 152, 152, 152, - /* 1260 */ 152, 210, 152, 210, 197, 152, 152, 152, 152, 152, - /* 1270 */ 152, 152, 152, 152, 152, 152, 152, 198, 150, 176, - /* 1280 */ 214, 201, 214, 238, 201, 238, 184, 214, 226, 200, - /* 1290 */ 155, 198, 67, 122, 242, 159, 159, 69, 239, 239, - /* 1300 */ 159, 175, 175, 22, 220, 180, 175, 27, 130, 18, - /* 1310 */ 159, 18, 158, 137, 220, 159, 158, 235, 74, 189, - /* 1320 */ 234, 159, 159, 158, 22, 192, 192, 177, 159, 159, - /* 1330 */ 192, 192, 189, 201, 189, 158, 107, 158, 177, 76, - /* 1340 */ 174, 201, 174, 201, 106, 159, 174, 125, 174, 182, - /* 1350 */ 177, 176, 107, 159, 174, 137, 174, 53, 174, 129, - /* 1360 */ 216, 215, 215, 182, 216, 216, 177, 215, 126, 216, - /* 1370 */ 177, 128, 25, 127, 26, 215, 13, 162, 161, 153, - /* 1380 */ 153, 6, 151, 151, 151, 151, 165, 178, 165, 178, - /* 1390 */ 4, 3, 22, 142, 15, 94, 16, 205, 120, 202, - /* 1400 */ 204, 203, 165, 201, 23, 23, 131, 111, 123, 20, - /* 1410 */ 225, 125, 16, 1, 131, 228, 111, 123, 56, 228, - /* 1420 */ 37, 37, 64, 1, 5, 122, 22, 107, 140, 80, - /* 1430 */ 80, 26, 87, 72, 107, 24, 20, 19, 112, 105, - /* 1440 */ 23, 68, 22, 79, 79, 22, 22, 22, 58, 22, - /* 1450 */ 245, 248, 248, 79, 23, 23, 23, 116, 22, 122, - /* 1460 */ 23, 22, 56, 23, 26, 23, 64, 22, 124, 26, - /* 1470 */ 26, 64, 64, 23, 23, 23, 11, 23, 22, 26, - /* 1480 */ 23, 22, 24, 1, 23, 22, 26, 250, 24, 23, - /* 1490 */ 22, 122, 23, 23, 22, 15, 23, 250, 122, 122, - /* 1500 */ 122, + /* 1000 */ 48, 49, 50, 51, 52, 53, 194, 195, 152, 171, + /* 1010 */ 141, 152, 132, 133, 134, 196, 225, 179, 206, 65, + /* 1020 */ 152, 97, 98, 152, 88, 152, 90, 152, 172, 173, + /* 1030 */ 152, 219, 78, 152, 152, 238, 152, 152, 219, 152, + /* 1040 */ 86, 152, 152, 172, 173, 238, 152, 172, 173, 152, + /* 1050 */ 172, 173, 152, 172, 173, 213, 237, 172, 173, 172, + /* 1060 */ 173, 172, 173, 211, 212, 111, 172, 173, 152, 172, + /* 1070 */ 173, 152, 172, 173, 152, 193, 140, 193, 152, 59, + /* 1080 */ 152, 152, 152, 63, 152, 16, 152, 152, 172, 173, + /* 1090 */ 152, 172, 173, 152, 172, 173, 152, 77, 172, 173, + /* 1100 */ 172, 173, 172, 173, 172, 173, 172, 173, 152, 250, + /* 1110 */ 172, 173, 61, 172, 173, 152, 172, 173, 152, 92, + /* 1120 */ 152, 70, 152, 152, 152, 26, 152, 100, 172, 173, + /* 1130 */ 152, 24, 152, 22, 152, 172, 173, 152, 172, 173, + /* 1140 */ 172, 173, 172, 173, 172, 173, 172, 173, 152, 152, + /* 1150 */ 172, 173, 172, 173, 172, 173, 152, 88, 152, 90, + /* 1160 */ 152, 55, 55, 152, 193, 152, 55, 152, 172, 173, + /* 1170 */ 26, 152, 163, 163, 152, 19, 172, 173, 172, 173, + /* 1180 */ 172, 173, 22, 172, 173, 172, 173, 172, 173, 55, + /* 1190 */ 193, 172, 173, 152, 172, 173, 166, 167, 166, 167, + /* 1200 */ 163, 163, 163, 97, 97, 196, 196, 163, 97, 55, + /* 1210 */ 23, 199, 56, 26, 22, 22, 24, 100, 101, 55, + /* 1220 */ 23, 209, 123, 26, 23, 23, 23, 26, 26, 26, + /* 1230 */ 37, 97, 152, 196, 196, 196, 23, 7, 8, 26, + /* 1240 */ 196, 23, 23, 152, 26, 26, 23, 132, 133, 26, + /* 1250 */ 106, 97, 132, 133, 23, 152, 152, 26, 210, 191, + /* 1260 */ 152, 97, 152, 234, 152, 152, 152, 233, 152, 210, + /* 1270 */ 152, 152, 210, 152, 152, 152, 152, 152, 152, 197, + /* 1280 */ 210, 198, 122, 150, 239, 201, 214, 214, 201, 239, + /* 1290 */ 214, 227, 200, 184, 198, 155, 67, 243, 122, 22, + /* 1300 */ 159, 159, 69, 176, 175, 175, 175, 240, 180, 159, + /* 1310 */ 220, 240, 27, 130, 18, 18, 159, 158, 220, 137, + /* 1320 */ 159, 189, 236, 158, 74, 159, 159, 158, 192, 192, + /* 1330 */ 192, 192, 235, 22, 189, 189, 201, 159, 158, 177, + /* 1340 */ 159, 107, 158, 76, 201, 177, 174, 174, 201, 174, + /* 1350 */ 106, 177, 182, 174, 107, 159, 22, 125, 159, 182, + /* 1360 */ 174, 176, 174, 174, 216, 216, 215, 215, 177, 216, + /* 1370 */ 215, 53, 137, 128, 216, 177, 127, 129, 215, 126, + /* 1380 */ 25, 13, 162, 26, 6, 161, 165, 165, 178, 153, + /* 1390 */ 153, 151, 151, 151, 151, 224, 4, 3, 22, 142, + /* 1400 */ 15, 94, 16, 178, 165, 205, 23, 202, 204, 203, + /* 1410 */ 201, 23, 120, 131, 111, 20, 226, 123, 125, 16, + /* 1420 */ 1, 123, 131, 229, 229, 111, 37, 37, 56, 64, + /* 1430 */ 122, 1, 5, 22, 107, 140, 80, 87, 26, 80, + /* 1440 */ 107, 72, 24, 20, 19, 105, 22, 112, 22, 79, + /* 1450 */ 22, 58, 23, 22, 79, 22, 249, 249, 246, 79, + /* 1460 */ 23, 23, 23, 116, 68, 22, 26, 23, 22, 56, + /* 1470 */ 122, 23, 23, 64, 22, 124, 26, 26, 64, 64, + /* 1480 */ 23, 23, 23, 23, 11, 23, 22, 26, 23, 22, + /* 1490 */ 24, 1, 23, 22, 26, 122, 24, 23, 22, 122, + /* 1500 */ 23, 23, 22, 122, 122, 23, 15, }; #define YY_SHIFT_USE_DFLT (-95) -#define YY_SHIFT_COUNT (439) +#define YY_SHIFT_COUNT (442) #define YY_SHIFT_MIN (-94) -#define YY_SHIFT_MAX (1482) +#define YY_SHIFT_MAX (1491) static const short yy_shift_ofst[] = { - /* 0 */ 40, 564, 869, 577, 725, 725, 725, 739, -19, 16, - /* 10 */ 16, 100, 725, 725, 725, 725, 725, 725, 725, 841, - /* 20 */ 841, 538, 507, 684, 623, 61, 137, 172, 207, 242, - /* 30 */ 277, 312, 347, 382, 424, 424, 424, 424, 424, 424, - /* 40 */ 424, 424, 424, 424, 424, 424, 424, 424, 424, 459, - /* 50 */ 424, 494, 529, 529, 670, 725, 725, 725, 725, 725, + /* 0 */ 40, 564, 869, 577, 725, 725, 725, 725, 690, -19, + /* 10 */ 16, 16, 100, 725, 725, 725, 725, 725, 725, 725, + /* 20 */ 841, 841, 538, 507, 684, 565, 61, 137, 172, 207, + /* 30 */ 242, 277, 312, 347, 382, 424, 424, 424, 424, 424, + /* 40 */ 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, + /* 50 */ 459, 424, 494, 529, 529, 670, 725, 725, 725, 725, /* 60 */ 725, 725, 725, 725, 725, 725, 725, 725, 725, 725, /* 70 */ 725, 725, 725, 725, 725, 725, 725, 725, 725, 725, - /* 80 */ 725, 725, 725, 821, 725, 725, 725, 725, 725, 725, - /* 90 */ 725, 725, 725, 725, 725, 725, 725, 952, 711, 711, - /* 100 */ 711, 711, 711, 766, 23, 32, 811, 877, 663, 602, - /* 110 */ 602, 811, 73, 113, -51, -95, -95, -95, 501, 501, - /* 120 */ 501, 595, 595, 809, 205, 276, 811, 811, 811, 811, - /* 130 */ 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, - /* 140 */ 811, 811, 811, 811, 811, 811, 192, 628, 498, 498, - /* 150 */ 113, -34, -34, -34, -34, -34, -34, -95, -95, -95, - /* 160 */ 880, -94, -94, 726, 740, 99, 797, 887, 349, 811, - /* 170 */ 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, - /* 180 */ 811, 811, 811, 811, 811, 811, 941, 941, 941, 811, - /* 190 */ 811, 926, 811, 811, 811, -18, 811, 811, 842, 811, - /* 200 */ 811, 811, 811, 811, 811, 811, 811, 811, 811, 224, - /* 210 */ 608, 910, 910, 910, 1078, 45, 469, 508, 934, 970, - /* 220 */ 970, 1164, 934, 1164, 1036, 1183, 359, 1017, 970, 954, - /* 230 */ 1017, 1017, 1092, 730, 497, 1225, 1171, 1171, 1228, 1228, - /* 240 */ 1171, 1281, 1280, 1178, 1291, 1291, 1291, 1291, 1171, 1293, - /* 250 */ 1178, 1281, 1280, 1280, 1178, 1171, 1293, 1176, 1244, 1171, - /* 260 */ 1171, 1293, 1302, 1171, 1293, 1171, 1293, 1302, 1229, 1229, - /* 270 */ 1229, 1263, 1302, 1229, 1238, 1229, 1263, 1229, 1229, 1222, - /* 280 */ 1245, 1222, 1245, 1222, 1245, 1222, 1245, 1171, 1171, 1218, - /* 290 */ 1302, 1304, 1304, 1302, 1230, 1242, 1243, 1246, 1178, 1347, - /* 300 */ 1348, 1363, 1363, 1375, 1375, 1375, 1375, -95, -95, -95, - /* 310 */ -95, -95, -95, -95, -95, 451, 876, 346, 1159, 1099, - /* 320 */ 441, 823, 1188, 1111, 1190, 1195, 1199, 1200, 1005, 1129, - /* 330 */ 1224, 533, 1201, 1212, 1155, 1214, 1109, 1112, 1220, 1157, - /* 340 */ 779, 1386, 1388, 1370, 1251, 1379, 1301, 1380, 1381, 1382, - /* 350 */ 1278, 1275, 1296, 1285, 1389, 1286, 1396, 1412, 1294, 1283, - /* 360 */ 1383, 1384, 1305, 1362, 1358, 1303, 1422, 1419, 1404, 1320, - /* 370 */ 1288, 1349, 1405, 1350, 1345, 1361, 1327, 1411, 1416, 1418, - /* 380 */ 1326, 1334, 1420, 1364, 1423, 1424, 1417, 1425, 1365, 1390, - /* 390 */ 1427, 1374, 1373, 1431, 1432, 1433, 1341, 1436, 1437, 1439, - /* 400 */ 1438, 1337, 1440, 1442, 1406, 1402, 1445, 1344, 1443, 1407, - /* 410 */ 1444, 1408, 1443, 1450, 1451, 1452, 1453, 1454, 1456, 1465, - /* 420 */ 1457, 1459, 1458, 1460, 1461, 1463, 1464, 1460, 1466, 1468, - /* 430 */ 1469, 1470, 1472, 1369, 1376, 1377, 1378, 1473, 1480, 1482, + /* 80 */ 725, 725, 725, 725, 821, 725, 725, 725, 725, 725, + /* 90 */ 725, 725, 725, 725, 725, 725, 725, 725, 952, 711, + /* 100 */ 711, 711, 711, 711, 766, 23, 32, 924, 637, 825, + /* 110 */ 837, 837, 924, 73, 183, -51, -95, -95, -95, 501, + /* 120 */ 501, 501, 903, 903, 632, 205, 241, 924, 924, 924, + /* 130 */ 924, 924, 924, 924, 924, 924, 924, 924, 924, 924, + /* 140 */ 924, 924, 924, 924, 924, 924, 924, 192, 1027, 1106, + /* 150 */ 1106, 183, 176, 176, 176, 176, 176, 176, -95, -95, + /* 160 */ -95, 880, -94, -94, 578, 734, 99, 730, 769, 349, + /* 170 */ 924, 924, 924, 924, 924, 924, 924, 924, 924, 924, + /* 180 */ 924, 924, 924, 924, 924, 924, 924, 954, 954, 954, + /* 190 */ 924, 924, 622, 924, 924, 924, -18, 924, 924, 914, + /* 200 */ 924, 924, 924, 924, 924, 924, 924, 924, 924, 924, + /* 210 */ 441, 1020, 1107, 1107, 1107, 569, 45, 217, 510, 423, + /* 220 */ 834, 834, 1156, 423, 1156, 1144, 1187, 359, 1051, 834, + /* 230 */ -17, 1051, 1051, 1099, 469, 1192, 1229, 1176, 1176, 1233, + /* 240 */ 1233, 1176, 1277, 1285, 1183, 1296, 1296, 1296, 1296, 1176, + /* 250 */ 1297, 1183, 1277, 1285, 1285, 1183, 1176, 1297, 1182, 1250, + /* 260 */ 1176, 1176, 1297, 1311, 1176, 1297, 1176, 1297, 1311, 1234, + /* 270 */ 1234, 1234, 1267, 1311, 1234, 1244, 1234, 1267, 1234, 1234, + /* 280 */ 1232, 1247, 1232, 1247, 1232, 1247, 1232, 1247, 1176, 1334, + /* 290 */ 1176, 1235, 1311, 1318, 1318, 1311, 1248, 1253, 1245, 1249, + /* 300 */ 1183, 1355, 1357, 1368, 1368, 1378, 1378, 1378, 1378, -95, + /* 310 */ -95, -95, -95, -95, -95, -95, -95, 451, 936, 816, + /* 320 */ 888, 1069, 799, 1111, 1197, 1193, 1201, 1202, 1203, 1213, + /* 330 */ 1134, 1117, 1230, 497, 1218, 1219, 1154, 1223, 1115, 1120, + /* 340 */ 1231, 1164, 1160, 1392, 1394, 1376, 1257, 1385, 1307, 1386, + /* 350 */ 1383, 1388, 1292, 1282, 1303, 1294, 1395, 1293, 1403, 1419, + /* 360 */ 1298, 1291, 1389, 1390, 1314, 1372, 1365, 1308, 1430, 1427, + /* 370 */ 1411, 1327, 1295, 1356, 1412, 1359, 1350, 1369, 1333, 1418, + /* 380 */ 1423, 1425, 1335, 1340, 1424, 1370, 1426, 1428, 1429, 1431, + /* 390 */ 1375, 1393, 1433, 1380, 1396, 1437, 1438, 1439, 1347, 1443, + /* 400 */ 1444, 1446, 1440, 1348, 1448, 1449, 1413, 1409, 1452, 1351, + /* 410 */ 1450, 1414, 1451, 1415, 1457, 1450, 1458, 1459, 1460, 1461, + /* 420 */ 1462, 1464, 1473, 1465, 1467, 1466, 1468, 1469, 1471, 1472, + /* 430 */ 1468, 1474, 1476, 1477, 1478, 1480, 1373, 1377, 1381, 1382, + /* 440 */ 1482, 1491, 1490, }; #define YY_REDUCE_USE_DFLT (-130) -#define YY_REDUCE_COUNT (314) +#define YY_REDUCE_COUNT (316) #define YY_REDUCE_MIN (-129) -#define YY_REDUCE_MAX (1237) +#define YY_REDUCE_MAX (1243) static const short yy_reduce_ofst[] = { - /* 0 */ -29, 531, 490, 625, -49, 272, 456, 510, 400, 509, - /* 10 */ 562, 114, 535, 614, 698, 384, 738, 751, 690, 419, - /* 20 */ 553, 761, 460, 636, 767, 41, 41, 41, 41, 41, - /* 30 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, - /* 40 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, - /* 50 */ 41, 41, 41, 41, 760, 815, 856, 863, 866, 868, - /* 60 */ 870, 873, 881, 885, 895, 897, 899, 903, 907, 909, - /* 70 */ 911, 913, 922, 925, 936, 938, 940, 944, 947, 949, - /* 80 */ 951, 953, 955, 962, 978, 980, 984, 986, 988, 991, - /* 90 */ 993, 995, 997, 1002, 1019, 1021, 1025, 41, 41, 41, - /* 100 */ 41, 41, 41, 41, 41, 41, 896, 140, 260, 98, - /* 110 */ 268, 1020, 41, 482, 41, 41, 41, 41, 270, 270, - /* 120 */ 270, 212, 217, -129, 411, 411, 550, 5, 626, 362, - /* 130 */ 733, 830, 992, 1003, 1026, 795, 683, 807, 638, 819, - /* 140 */ 753, 948, 62, 817, 824, 132, 687, 611, 864, 1033, - /* 150 */ 403, 943, 966, 983, 1032, 1038, 1040, 960, 996, 492, - /* 160 */ -50, 57, 131, 153, 221, 462, 588, 596, 675, 721, - /* 170 */ 820, 834, 857, 914, 979, 1034, 1065, 1081, 1087, 1095, - /* 180 */ 1096, 1097, 1098, 1101, 1104, 1105, 320, 500, 655, 1106, - /* 190 */ 1107, 503, 1108, 1110, 1113, 681, 1114, 1115, 999, 1116, - /* 200 */ 1117, 1118, 221, 1119, 1120, 1121, 1122, 1123, 1124, 788, - /* 210 */ 956, 1041, 1051, 1053, 503, 1067, 1079, 1128, 1080, 1066, - /* 220 */ 1068, 1045, 1083, 1047, 1103, 1102, 1125, 1126, 1073, 1062, - /* 230 */ 1127, 1131, 1089, 1093, 1135, 1052, 1136, 1137, 1059, 1060, - /* 240 */ 1141, 1084, 1130, 1132, 1133, 1134, 1138, 1139, 1151, 1154, - /* 250 */ 1140, 1094, 1143, 1145, 1142, 1156, 1158, 1082, 1086, 1162, - /* 260 */ 1163, 1165, 1150, 1169, 1177, 1170, 1179, 1161, 1166, 1168, - /* 270 */ 1172, 1167, 1173, 1174, 1175, 1180, 1181, 1182, 1184, 1144, - /* 280 */ 1146, 1148, 1147, 1149, 1152, 1153, 1160, 1186, 1194, 1185, - /* 290 */ 1189, 1187, 1191, 1193, 1192, 1196, 1198, 1197, 1202, 1215, - /* 300 */ 1217, 1226, 1227, 1231, 1232, 1233, 1234, 1203, 1204, 1205, - /* 310 */ 1221, 1223, 1209, 1211, 1237, + /* 0 */ -29, 531, 490, 570, -49, 272, 456, 498, 633, 400, + /* 10 */ 612, 626, 113, 482, 678, 719, 384, 726, 748, 791, + /* 20 */ 419, 693, 761, 812, 819, 625, 76, 76, 76, 76, + /* 30 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + /* 40 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + /* 50 */ 76, 76, 76, 76, 76, 793, 795, 856, 871, 875, + /* 60 */ 878, 881, 885, 887, 889, 894, 897, 900, 916, 919, + /* 70 */ 922, 926, 928, 930, 932, 934, 938, 941, 944, 956, + /* 80 */ 963, 966, 968, 970, 972, 974, 978, 980, 982, 996, + /* 90 */ 1004, 1006, 1008, 1011, 1013, 1015, 1019, 1022, 76, 76, + /* 100 */ 76, 76, 76, 76, 76, 76, 76, 555, 210, 260, + /* 110 */ 200, 346, 571, 76, 700, 76, 76, 76, 76, 838, + /* 120 */ 838, 838, 42, 182, 251, 160, 160, 550, 5, 455, + /* 130 */ 585, 721, 749, 882, 884, 971, 618, 462, 797, 514, + /* 140 */ 807, 524, 997, -129, 655, 859, 62, 290, 66, 1030, + /* 150 */ 1032, 589, 1009, 1010, 1037, 1038, 1039, 1044, 740, 852, + /* 160 */ 1012, 112, 147, 230, 257, 180, 369, 403, 500, 549, + /* 170 */ 556, 563, 694, 751, 765, 772, 778, 820, 868, 873, + /* 180 */ 890, 929, 935, 985, 1041, 1080, 1091, 540, 593, 661, + /* 190 */ 1103, 1104, 842, 1108, 1110, 1112, 1048, 1113, 1114, 1068, + /* 200 */ 1116, 1118, 1119, 180, 1121, 1122, 1123, 1124, 1125, 1126, + /* 210 */ 1029, 1034, 1059, 1062, 1070, 842, 1082, 1083, 1133, 1084, + /* 220 */ 1072, 1073, 1045, 1087, 1050, 1127, 1109, 1128, 1129, 1076, + /* 230 */ 1064, 1130, 1131, 1092, 1096, 1140, 1054, 1141, 1142, 1067, + /* 240 */ 1071, 1150, 1090, 1132, 1135, 1136, 1137, 1138, 1139, 1157, + /* 250 */ 1159, 1143, 1098, 1145, 1146, 1147, 1161, 1165, 1086, 1097, + /* 260 */ 1166, 1167, 1169, 1162, 1178, 1180, 1181, 1184, 1168, 1172, + /* 270 */ 1173, 1175, 1170, 1174, 1179, 1185, 1186, 1177, 1188, 1189, + /* 280 */ 1148, 1151, 1149, 1152, 1153, 1155, 1158, 1163, 1196, 1171, + /* 290 */ 1199, 1190, 1191, 1194, 1195, 1198, 1200, 1204, 1206, 1205, + /* 300 */ 1209, 1220, 1224, 1236, 1237, 1240, 1241, 1242, 1243, 1207, + /* 310 */ 1208, 1212, 1221, 1222, 1210, 1225, 1239, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1250, 1240, 1240, 1240, 1174, 1174, 1174, 1240, 1071, 1100, - /* 10 */ 1100, 1224, 1301, 1301, 1301, 1301, 1301, 1301, 1173, 1301, - /* 20 */ 1301, 1301, 1301, 1240, 1075, 1106, 1301, 1301, 1301, 1301, - /* 30 */ 1301, 1301, 1301, 1301, 1223, 1225, 1114, 1113, 1206, 1087, - /* 40 */ 1111, 1104, 1108, 1175, 1169, 1170, 1168, 1172, 1176, 1301, - /* 50 */ 1107, 1138, 1153, 1137, 1301, 1301, 1301, 1301, 1301, 1301, - /* 60 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, - /* 70 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, - /* 80 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, - /* 90 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1147, 1152, 1159, - /* 100 */ 1151, 1148, 1140, 1139, 1141, 1142, 1301, 994, 1042, 1301, - /* 110 */ 1301, 1301, 1143, 1301, 1144, 1156, 1155, 1154, 1231, 1258, - /* 120 */ 1257, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, - /* 130 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, - /* 140 */ 1301, 1301, 1301, 1301, 1301, 1301, 1250, 1240, 1000, 1000, - /* 150 */ 1301, 1240, 1240, 1240, 1240, 1240, 1240, 1236, 1075, 1066, - /* 160 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, - /* 170 */ 1228, 1226, 1301, 1187, 1301, 1301, 1301, 1301, 1301, 1301, - /* 180 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, - /* 190 */ 1301, 1301, 1301, 1301, 1301, 1071, 1301, 1301, 1301, 1301, - /* 200 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1252, 1301, - /* 210 */ 1201, 1071, 1071, 1071, 1073, 1055, 1065, 979, 1110, 1089, - /* 220 */ 1089, 1290, 1110, 1290, 1017, 1272, 1014, 1100, 1089, 1171, - /* 230 */ 1100, 1100, 1072, 1065, 1301, 1293, 1080, 1080, 1292, 1292, - /* 240 */ 1080, 1119, 1045, 1110, 1051, 1051, 1051, 1051, 1080, 991, - /* 250 */ 1110, 1119, 1045, 1045, 1110, 1080, 991, 1205, 1287, 1080, - /* 260 */ 1080, 991, 1180, 1080, 991, 1080, 991, 1180, 1043, 1043, - /* 270 */ 1043, 1032, 1180, 1043, 1017, 1043, 1032, 1043, 1043, 1093, - /* 280 */ 1088, 1093, 1088, 1093, 1088, 1093, 1088, 1080, 1080, 1301, - /* 290 */ 1180, 1184, 1184, 1180, 1105, 1094, 1103, 1101, 1110, 997, - /* 300 */ 1035, 1255, 1255, 1251, 1251, 1251, 1251, 1298, 1298, 1236, - /* 310 */ 1267, 1267, 1019, 1019, 1267, 1301, 1301, 1301, 1301, 1301, - /* 320 */ 1301, 1262, 1301, 1189, 1301, 1301, 1301, 1301, 1301, 1301, - /* 330 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, - /* 340 */ 1125, 1301, 975, 1233, 1301, 1301, 1232, 1301, 1301, 1301, - /* 350 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, - /* 360 */ 1301, 1301, 1301, 1301, 1301, 1289, 1301, 1301, 1301, 1301, - /* 370 */ 1301, 1301, 1204, 1203, 1301, 1301, 1301, 1301, 1301, 1301, - /* 380 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, - /* 390 */ 1301, 1301, 1301, 1301, 1301, 1301, 1057, 1301, 1301, 1301, - /* 400 */ 1276, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1102, 1301, - /* 410 */ 1095, 1301, 1280, 1301, 1301, 1301, 1301, 1301, 1301, 1301, - /* 420 */ 1301, 1301, 1301, 1242, 1301, 1301, 1301, 1241, 1301, 1301, - /* 430 */ 1301, 1301, 1301, 1127, 1301, 1126, 1130, 1301, 985, 1301, + /* 0 */ 1258, 1248, 1248, 1248, 1180, 1180, 1180, 1180, 1248, 1077, + /* 10 */ 1106, 1106, 1232, 1309, 1309, 1309, 1309, 1309, 1309, 1179, + /* 20 */ 1309, 1309, 1309, 1309, 1248, 1081, 1112, 1309, 1309, 1309, + /* 30 */ 1309, 1309, 1309, 1309, 1309, 1231, 1233, 1120, 1119, 1214, + /* 40 */ 1093, 1117, 1110, 1114, 1181, 1175, 1176, 1174, 1178, 1182, + /* 50 */ 1309, 1113, 1144, 1159, 1143, 1309, 1309, 1309, 1309, 1309, + /* 60 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, + /* 70 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, + /* 80 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, + /* 90 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1153, 1158, + /* 100 */ 1165, 1157, 1154, 1146, 1145, 1147, 1148, 1309, 1000, 1048, + /* 110 */ 1309, 1309, 1309, 1149, 1309, 1150, 1162, 1161, 1160, 1239, + /* 120 */ 1266, 1265, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, + /* 130 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, + /* 140 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1258, 1248, 1006, + /* 150 */ 1006, 1309, 1248, 1248, 1248, 1248, 1248, 1248, 1244, 1081, + /* 160 */ 1072, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, + /* 170 */ 1309, 1236, 1234, 1309, 1195, 1309, 1309, 1309, 1309, 1309, + /* 180 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, + /* 190 */ 1309, 1309, 1309, 1309, 1309, 1309, 1077, 1309, 1309, 1309, + /* 200 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1260, + /* 210 */ 1309, 1209, 1077, 1077, 1077, 1079, 1061, 1071, 985, 1116, + /* 220 */ 1095, 1095, 1298, 1116, 1298, 1023, 1280, 1020, 1106, 1095, + /* 230 */ 1177, 1106, 1106, 1078, 1071, 1309, 1301, 1086, 1086, 1300, + /* 240 */ 1300, 1086, 1125, 1051, 1116, 1057, 1057, 1057, 1057, 1086, + /* 250 */ 997, 1116, 1125, 1051, 1051, 1116, 1086, 997, 1213, 1295, + /* 260 */ 1086, 1086, 997, 1188, 1086, 997, 1086, 997, 1188, 1049, + /* 270 */ 1049, 1049, 1038, 1188, 1049, 1023, 1049, 1038, 1049, 1049, + /* 280 */ 1099, 1094, 1099, 1094, 1099, 1094, 1099, 1094, 1086, 1183, + /* 290 */ 1086, 1309, 1188, 1192, 1192, 1188, 1111, 1100, 1109, 1107, + /* 300 */ 1116, 1003, 1041, 1263, 1263, 1259, 1259, 1259, 1259, 1306, + /* 310 */ 1306, 1244, 1275, 1275, 1025, 1025, 1275, 1309, 1309, 1309, + /* 320 */ 1309, 1309, 1309, 1270, 1309, 1197, 1309, 1309, 1309, 1309, + /* 330 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, + /* 340 */ 1309, 1309, 1131, 1309, 981, 1241, 1309, 1309, 1240, 1309, + /* 350 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, + /* 360 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1297, 1309, 1309, + /* 370 */ 1309, 1309, 1309, 1309, 1212, 1211, 1309, 1309, 1309, 1309, + /* 380 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, + /* 390 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1063, 1309, + /* 400 */ 1309, 1309, 1284, 1309, 1309, 1309, 1309, 1309, 1309, 1309, + /* 410 */ 1108, 1309, 1101, 1309, 1309, 1288, 1309, 1309, 1309, 1309, + /* 420 */ 1309, 1309, 1309, 1309, 1309, 1309, 1250, 1309, 1309, 1309, + /* 430 */ 1249, 1309, 1309, 1309, 1309, 1309, 1133, 1309, 1132, 1136, + /* 440 */ 1309, 991, 1309, }; /********** End of lemon-generated parsing tables *****************************/ @@ -131674,9 +132494,9 @@ typedef struct yyStackEntry yyStackEntry; /* The state of the parser is completely contained in an instance of ** the following structure */ struct yyParser { - int yyidx; /* Index of top element in stack */ + yyStackEntry *yytos; /* Pointer to top element of the stack */ #ifdef YYTRACKMAXSTACKDEPTH - int yyidxMax; /* Maximum value of yyidx */ + int yyhwm; /* High-water mark of the stack */ #endif #ifndef YYNOERRORRECOVERY int yyerrcnt; /* Shifts left before out of the error */ @@ -131685,6 +132505,7 @@ struct yyParser { #if YYSTACKDEPTH<=0 int yystksz; /* Current side of the stack */ yyStackEntry *yystack; /* The parser's stack */ + yyStackEntry yystk0; /* First stack entry */ #else yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ #endif @@ -131783,13 +132604,13 @@ static const char *const yyTokenName[] = { "stl_prefix", "joinop", "indexed_opt", "on_opt", "using_opt", "idlist", "setlist", "insert_cmd", "idlist_opt", "likeop", "between_op", "in_op", - "case_operand", "case_exprlist", "case_else", "uniqueflag", - "collate", "nmnum", "trigger_decl", "trigger_cmd_list", - "trigger_time", "trigger_event", "foreach_clause", "when_clause", - "trigger_cmd", "trnm", "tridxby", "database_kw_opt", - "key_opt", "add_column_fullname", "kwcolumn_opt", "create_vtab", - "vtabarglist", "vtabarg", "vtabargtoken", "lp", - "anylist", "wqlist", + "paren_exprlist", "case_operand", "case_exprlist", "case_else", + "uniqueflag", "collate", "nmnum", "trigger_decl", + "trigger_cmd_list", "trigger_time", "trigger_event", "foreach_clause", + "when_clause", "trigger_cmd", "trnm", "tridxby", + "database_kw_opt", "key_opt", "add_column_fullname", "kwcolumn_opt", + "create_vtab", "vtabarglist", "vtabarg", "vtabargtoken", + "lp", "anylist", "wqlist", }; #endif /* NDEBUG */ @@ -131987,7 +132808,7 @@ static const char *const yyRuleName[] = { /* 187 */ "expr ::= expr in_op LP exprlist RP", /* 188 */ "expr ::= LP select RP", /* 189 */ "expr ::= expr in_op LP select RP", - /* 190 */ "expr ::= expr in_op nm dbnm", + /* 190 */ "expr ::= expr in_op nm dbnm paren_exprlist", /* 191 */ "expr ::= EXISTS LP select RP", /* 192 */ "expr ::= CASE case_operand case_exprlist case_else END", /* 193 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", @@ -131999,154 +132820,166 @@ static const char *const yyRuleName[] = { /* 199 */ "exprlist ::=", /* 200 */ "nexprlist ::= nexprlist COMMA expr", /* 201 */ "nexprlist ::= expr", - /* 202 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", - /* 203 */ "uniqueflag ::= UNIQUE", - /* 204 */ "uniqueflag ::=", - /* 205 */ "eidlist_opt ::=", - /* 206 */ "eidlist_opt ::= LP eidlist RP", - /* 207 */ "eidlist ::= eidlist COMMA nm collate sortorder", - /* 208 */ "eidlist ::= nm collate sortorder", - /* 209 */ "collate ::=", - /* 210 */ "collate ::= COLLATE ID|STRING", - /* 211 */ "cmd ::= DROP INDEX ifexists fullname", - /* 212 */ "cmd ::= VACUUM", - /* 213 */ "cmd ::= VACUUM nm", - /* 214 */ "cmd ::= PRAGMA nm dbnm", - /* 215 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", - /* 216 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", - /* 217 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", - /* 218 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", - /* 219 */ "plus_num ::= PLUS INTEGER|FLOAT", - /* 220 */ "minus_num ::= MINUS INTEGER|FLOAT", - /* 221 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", - /* 222 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", - /* 223 */ "trigger_time ::= BEFORE", - /* 224 */ "trigger_time ::= AFTER", - /* 225 */ "trigger_time ::= INSTEAD OF", - /* 226 */ "trigger_time ::=", - /* 227 */ "trigger_event ::= DELETE|INSERT", - /* 228 */ "trigger_event ::= UPDATE", - /* 229 */ "trigger_event ::= UPDATE OF idlist", - /* 230 */ "when_clause ::=", - /* 231 */ "when_clause ::= WHEN expr", - /* 232 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", - /* 233 */ "trigger_cmd_list ::= trigger_cmd SEMI", - /* 234 */ "trnm ::= nm DOT nm", - /* 235 */ "tridxby ::= INDEXED BY nm", - /* 236 */ "tridxby ::= NOT INDEXED", - /* 237 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt", - /* 238 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select", - /* 239 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt", - /* 240 */ "trigger_cmd ::= select", - /* 241 */ "expr ::= RAISE LP IGNORE RP", - /* 242 */ "expr ::= RAISE LP raisetype COMMA nm RP", - /* 243 */ "raisetype ::= ROLLBACK", - /* 244 */ "raisetype ::= ABORT", - /* 245 */ "raisetype ::= FAIL", - /* 246 */ "cmd ::= DROP TRIGGER ifexists fullname", - /* 247 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", - /* 248 */ "cmd ::= DETACH database_kw_opt expr", - /* 249 */ "key_opt ::=", - /* 250 */ "key_opt ::= KEY expr", - /* 251 */ "cmd ::= REINDEX", - /* 252 */ "cmd ::= REINDEX nm dbnm", - /* 253 */ "cmd ::= ANALYZE", - /* 254 */ "cmd ::= ANALYZE nm dbnm", - /* 255 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", - /* 256 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", - /* 257 */ "add_column_fullname ::= fullname", - /* 258 */ "cmd ::= create_vtab", - /* 259 */ "cmd ::= create_vtab LP vtabarglist RP", - /* 260 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", - /* 261 */ "vtabarg ::=", - /* 262 */ "vtabargtoken ::= ANY", - /* 263 */ "vtabargtoken ::= lp anylist RP", - /* 264 */ "lp ::= LP", - /* 265 */ "with ::=", - /* 266 */ "with ::= WITH wqlist", - /* 267 */ "with ::= WITH RECURSIVE wqlist", - /* 268 */ "wqlist ::= nm eidlist_opt AS LP select RP", - /* 269 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", - /* 270 */ "input ::= cmdlist", - /* 271 */ "cmdlist ::= cmdlist ecmd", - /* 272 */ "cmdlist ::= ecmd", - /* 273 */ "ecmd ::= SEMI", - /* 274 */ "ecmd ::= explain cmdx SEMI", - /* 275 */ "explain ::=", - /* 276 */ "trans_opt ::=", - /* 277 */ "trans_opt ::= TRANSACTION", - /* 278 */ "trans_opt ::= TRANSACTION nm", - /* 279 */ "savepoint_opt ::= SAVEPOINT", - /* 280 */ "savepoint_opt ::=", - /* 281 */ "cmd ::= create_table create_table_args", - /* 282 */ "columnlist ::= columnlist COMMA columnname carglist", - /* 283 */ "columnlist ::= columnname carglist", - /* 284 */ "nm ::= ID|INDEXED", - /* 285 */ "nm ::= STRING", - /* 286 */ "nm ::= JOIN_KW", - /* 287 */ "typetoken ::= typename", - /* 288 */ "typename ::= ID|STRING", - /* 289 */ "signed ::= plus_num", - /* 290 */ "signed ::= minus_num", - /* 291 */ "carglist ::= carglist ccons", - /* 292 */ "carglist ::=", - /* 293 */ "ccons ::= NULL onconf", - /* 294 */ "conslist_opt ::= COMMA conslist", - /* 295 */ "conslist ::= conslist tconscomma tcons", - /* 296 */ "conslist ::= tcons", - /* 297 */ "tconscomma ::=", - /* 298 */ "defer_subclause_opt ::= defer_subclause", - /* 299 */ "resolvetype ::= raisetype", - /* 300 */ "selectnowith ::= oneselect", - /* 301 */ "oneselect ::= values", - /* 302 */ "sclp ::= selcollist COMMA", - /* 303 */ "as ::= ID|STRING", - /* 304 */ "expr ::= term", - /* 305 */ "exprlist ::= nexprlist", - /* 306 */ "nmnum ::= plus_num", - /* 307 */ "nmnum ::= nm", - /* 308 */ "nmnum ::= ON", - /* 309 */ "nmnum ::= DELETE", - /* 310 */ "nmnum ::= DEFAULT", - /* 311 */ "plus_num ::= INTEGER|FLOAT", - /* 312 */ "foreach_clause ::=", - /* 313 */ "foreach_clause ::= FOR EACH ROW", - /* 314 */ "trnm ::= nm", - /* 315 */ "tridxby ::=", - /* 316 */ "database_kw_opt ::= DATABASE", - /* 317 */ "database_kw_opt ::=", - /* 318 */ "kwcolumn_opt ::=", - /* 319 */ "kwcolumn_opt ::= COLUMNKW", - /* 320 */ "vtabarglist ::= vtabarg", - /* 321 */ "vtabarglist ::= vtabarglist COMMA vtabarg", - /* 322 */ "vtabarg ::= vtabarg vtabargtoken", - /* 323 */ "anylist ::=", - /* 324 */ "anylist ::= anylist LP anylist RP", - /* 325 */ "anylist ::= anylist ANY", + /* 202 */ "paren_exprlist ::=", + /* 203 */ "paren_exprlist ::= LP exprlist RP", + /* 204 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", + /* 205 */ "uniqueflag ::= UNIQUE", + /* 206 */ "uniqueflag ::=", + /* 207 */ "eidlist_opt ::=", + /* 208 */ "eidlist_opt ::= LP eidlist RP", + /* 209 */ "eidlist ::= eidlist COMMA nm collate sortorder", + /* 210 */ "eidlist ::= nm collate sortorder", + /* 211 */ "collate ::=", + /* 212 */ "collate ::= COLLATE ID|STRING", + /* 213 */ "cmd ::= DROP INDEX ifexists fullname", + /* 214 */ "cmd ::= VACUUM", + /* 215 */ "cmd ::= VACUUM nm", + /* 216 */ "cmd ::= PRAGMA nm dbnm", + /* 217 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", + /* 218 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", + /* 219 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", + /* 220 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", + /* 221 */ "plus_num ::= PLUS INTEGER|FLOAT", + /* 222 */ "minus_num ::= MINUS INTEGER|FLOAT", + /* 223 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", + /* 224 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", + /* 225 */ "trigger_time ::= BEFORE", + /* 226 */ "trigger_time ::= AFTER", + /* 227 */ "trigger_time ::= INSTEAD OF", + /* 228 */ "trigger_time ::=", + /* 229 */ "trigger_event ::= DELETE|INSERT", + /* 230 */ "trigger_event ::= UPDATE", + /* 231 */ "trigger_event ::= UPDATE OF idlist", + /* 232 */ "when_clause ::=", + /* 233 */ "when_clause ::= WHEN expr", + /* 234 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", + /* 235 */ "trigger_cmd_list ::= trigger_cmd SEMI", + /* 236 */ "trnm ::= nm DOT nm", + /* 237 */ "tridxby ::= INDEXED BY nm", + /* 238 */ "tridxby ::= NOT INDEXED", + /* 239 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt", + /* 240 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select", + /* 241 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt", + /* 242 */ "trigger_cmd ::= select", + /* 243 */ "expr ::= RAISE LP IGNORE RP", + /* 244 */ "expr ::= RAISE LP raisetype COMMA nm RP", + /* 245 */ "raisetype ::= ROLLBACK", + /* 246 */ "raisetype ::= ABORT", + /* 247 */ "raisetype ::= FAIL", + /* 248 */ "cmd ::= DROP TRIGGER ifexists fullname", + /* 249 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", + /* 250 */ "cmd ::= DETACH database_kw_opt expr", + /* 251 */ "key_opt ::=", + /* 252 */ "key_opt ::= KEY expr", + /* 253 */ "cmd ::= REINDEX", + /* 254 */ "cmd ::= REINDEX nm dbnm", + /* 255 */ "cmd ::= ANALYZE", + /* 256 */ "cmd ::= ANALYZE nm dbnm", + /* 257 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", + /* 258 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", + /* 259 */ "add_column_fullname ::= fullname", + /* 260 */ "cmd ::= create_vtab", + /* 261 */ "cmd ::= create_vtab LP vtabarglist RP", + /* 262 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", + /* 263 */ "vtabarg ::=", + /* 264 */ "vtabargtoken ::= ANY", + /* 265 */ "vtabargtoken ::= lp anylist RP", + /* 266 */ "lp ::= LP", + /* 267 */ "with ::=", + /* 268 */ "with ::= WITH wqlist", + /* 269 */ "with ::= WITH RECURSIVE wqlist", + /* 270 */ "wqlist ::= nm eidlist_opt AS LP select RP", + /* 271 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", + /* 272 */ "input ::= cmdlist", + /* 273 */ "cmdlist ::= cmdlist ecmd", + /* 274 */ "cmdlist ::= ecmd", + /* 275 */ "ecmd ::= SEMI", + /* 276 */ "ecmd ::= explain cmdx SEMI", + /* 277 */ "explain ::=", + /* 278 */ "trans_opt ::=", + /* 279 */ "trans_opt ::= TRANSACTION", + /* 280 */ "trans_opt ::= TRANSACTION nm", + /* 281 */ "savepoint_opt ::= SAVEPOINT", + /* 282 */ "savepoint_opt ::=", + /* 283 */ "cmd ::= create_table create_table_args", + /* 284 */ "columnlist ::= columnlist COMMA columnname carglist", + /* 285 */ "columnlist ::= columnname carglist", + /* 286 */ "nm ::= ID|INDEXED", + /* 287 */ "nm ::= STRING", + /* 288 */ "nm ::= JOIN_KW", + /* 289 */ "typetoken ::= typename", + /* 290 */ "typename ::= ID|STRING", + /* 291 */ "signed ::= plus_num", + /* 292 */ "signed ::= minus_num", + /* 293 */ "carglist ::= carglist ccons", + /* 294 */ "carglist ::=", + /* 295 */ "ccons ::= NULL onconf", + /* 296 */ "conslist_opt ::= COMMA conslist", + /* 297 */ "conslist ::= conslist tconscomma tcons", + /* 298 */ "conslist ::= tcons", + /* 299 */ "tconscomma ::=", + /* 300 */ "defer_subclause_opt ::= defer_subclause", + /* 301 */ "resolvetype ::= raisetype", + /* 302 */ "selectnowith ::= oneselect", + /* 303 */ "oneselect ::= values", + /* 304 */ "sclp ::= selcollist COMMA", + /* 305 */ "as ::= ID|STRING", + /* 306 */ "expr ::= term", + /* 307 */ "exprlist ::= nexprlist", + /* 308 */ "nmnum ::= plus_num", + /* 309 */ "nmnum ::= nm", + /* 310 */ "nmnum ::= ON", + /* 311 */ "nmnum ::= DELETE", + /* 312 */ "nmnum ::= DEFAULT", + /* 313 */ "plus_num ::= INTEGER|FLOAT", + /* 314 */ "foreach_clause ::=", + /* 315 */ "foreach_clause ::= FOR EACH ROW", + /* 316 */ "trnm ::= nm", + /* 317 */ "tridxby ::=", + /* 318 */ "database_kw_opt ::= DATABASE", + /* 319 */ "database_kw_opt ::=", + /* 320 */ "kwcolumn_opt ::=", + /* 321 */ "kwcolumn_opt ::= COLUMNKW", + /* 322 */ "vtabarglist ::= vtabarg", + /* 323 */ "vtabarglist ::= vtabarglist COMMA vtabarg", + /* 324 */ "vtabarg ::= vtabarg vtabargtoken", + /* 325 */ "anylist ::=", + /* 326 */ "anylist ::= anylist LP anylist RP", + /* 327 */ "anylist ::= anylist ANY", }; #endif /* NDEBUG */ #if YYSTACKDEPTH<=0 /* -** Try to increase the size of the parser stack. +** Try to increase the size of the parser stack. Return the number +** of errors. Return 0 on success. */ -static void yyGrowStack(yyParser *p){ +static int yyGrowStack(yyParser *p){ int newSize; + int idx; yyStackEntry *pNew; newSize = p->yystksz*2 + 100; - pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); + idx = p->yytos ? (int)(p->yytos - p->yystack) : 0; + if( p->yystack==&p->yystk0 ){ + pNew = malloc(newSize*sizeof(pNew[0])); + if( pNew ) pNew[0] = p->yystk0; + }else{ + pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); + } if( pNew ){ p->yystack = pNew; - p->yystksz = newSize; + p->yytos = &p->yystack[idx]; #ifndef NDEBUG if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack grows to %d entries!\n", - yyTracePrompt, p->yystksz); + fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", + yyTracePrompt, p->yystksz, newSize); } #endif + p->yystksz = newSize; } + return pNew==0; } #endif @@ -132175,15 +133008,24 @@ SQLITE_PRIVATE void *sqlite3ParserAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){ yyParser *pParser; pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); if( pParser ){ - pParser->yyidx = -1; #ifdef YYTRACKMAXSTACKDEPTH - pParser->yyidxMax = 0; + pParser->yyhwm = 0; #endif #if YYSTACKDEPTH<=0 + pParser->yytos = NULL; pParser->yystack = NULL; pParser->yystksz = 0; - yyGrowStack(pParser); + if( yyGrowStack(pParser) ){ + pParser->yystack = &pParser->yystk0; + pParser->yystksz = 1; + } #endif +#ifndef YYNOERRORRECOVERY + pParser->yyerrcnt = -1; +#endif + pParser->yytos = pParser->yystack; + pParser->yystack[0].stateno = 0; + pParser->yystack[0].major = 0; } return pParser; } @@ -132218,13 +133060,13 @@ static void yy_destructor( case 195: /* oneselect */ case 206: /* values */ { -sqlite3SelectDelete(pParse->db, (yypminor->yy159)); +sqlite3SelectDelete(pParse->db, (yypminor->yy243)); } break; case 172: /* term */ case 173: /* expr */ { -sqlite3ExprDelete(pParse->db, (yypminor->yy342).pExpr); +sqlite3ExprDelete(pParse->db, (yypminor->yy190).pExpr); } break; case 177: /* eidlist_opt */ @@ -132237,9 +133079,10 @@ sqlite3ExprDelete(pParse->db, (yypminor->yy342).pExpr); case 208: /* exprlist */ case 209: /* sclp */ case 218: /* setlist */ - case 225: /* case_exprlist */ + case 224: /* paren_exprlist */ + case 226: /* case_exprlist */ { -sqlite3ExprListDelete(pParse->db, (yypminor->yy442)); +sqlite3ExprListDelete(pParse->db, (yypminor->yy148)); } break; case 193: /* fullname */ @@ -132247,42 +133090,42 @@ sqlite3ExprListDelete(pParse->db, (yypminor->yy442)); case 211: /* seltablist */ case 212: /* stl_prefix */ { -sqlite3SrcListDelete(pParse->db, (yypminor->yy347)); +sqlite3SrcListDelete(pParse->db, (yypminor->yy185)); } break; case 196: /* with */ - case 249: /* wqlist */ + case 250: /* wqlist */ { -sqlite3WithDelete(pParse->db, (yypminor->yy331)); +sqlite3WithDelete(pParse->db, (yypminor->yy285)); } break; case 201: /* where_opt */ case 203: /* having_opt */ case 215: /* on_opt */ - case 224: /* case_operand */ - case 226: /* case_else */ - case 235: /* when_clause */ - case 240: /* key_opt */ + case 225: /* case_operand */ + case 227: /* case_else */ + case 236: /* when_clause */ + case 241: /* key_opt */ { -sqlite3ExprDelete(pParse->db, (yypminor->yy122)); +sqlite3ExprDelete(pParse->db, (yypminor->yy72)); } break; case 216: /* using_opt */ case 217: /* idlist */ case 220: /* idlist_opt */ { -sqlite3IdListDelete(pParse->db, (yypminor->yy180)); +sqlite3IdListDelete(pParse->db, (yypminor->yy254)); } break; - case 231: /* trigger_cmd_list */ - case 236: /* trigger_cmd */ + case 232: /* trigger_cmd_list */ + case 237: /* trigger_cmd */ { -sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy327)); +sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy145)); } break; - case 233: /* trigger_event */ + case 234: /* trigger_event */ { -sqlite3IdListDelete(pParse->db, (yypminor->yy410).b); +sqlite3IdListDelete(pParse->db, (yypminor->yy332).b); } break; /********* End destructor definitions *****************************************/ @@ -132298,8 +133141,9 @@ sqlite3IdListDelete(pParse->db, (yypminor->yy410).b); */ static void yy_pop_parser_stack(yyParser *pParser){ yyStackEntry *yytos; - assert( pParser->yyidx>=0 ); - yytos = &pParser->yystack[pParser->yyidx--]; + assert( pParser->yytos!=0 ); + assert( pParser->yytos > pParser->yystack ); + yytos = pParser->yytos--; #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sPopping %s\n", @@ -132326,9 +133170,9 @@ SQLITE_PRIVATE void sqlite3ParserFree( #ifndef YYPARSEFREENEVERNULL if( pParser==0 ) return; #endif - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); + while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser); #if YYSTACKDEPTH<=0 - free(pParser->yystack); + if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack); #endif (*freeProc)((void*)pParser); } @@ -132339,7 +133183,7 @@ SQLITE_PRIVATE void sqlite3ParserFree( #ifdef YYTRACKMAXSTACKDEPTH SQLITE_PRIVATE int sqlite3ParserStackPeak(void *p){ yyParser *pParser = (yyParser*)p; - return pParser->yyidxMax; + return pParser->yyhwm; } #endif @@ -132352,7 +133196,7 @@ static unsigned int yy_find_shift_action( YYCODETYPE iLookAhead /* The look-ahead token */ ){ int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; + int stateno = pParser->yytos->stateno; if( stateno>=YY_MIN_REDUCE ) return stateno; assert( stateno <= YY_SHIFT_COUNT ); @@ -132445,13 +133289,13 @@ static int yy_find_reduce_action( */ static void yyStackOverflow(yyParser *yypParser){ sqlite3ParserARG_FETCH; - yypParser->yyidx--; + yypParser->yytos--; #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ @@ -132469,11 +133313,11 @@ static void yyTraceShift(yyParser *yypParser, int yyNewState){ if( yyTraceFILE ){ if( yyNewStateyystack[yypParser->yyidx].major], + yyTracePrompt,yyTokenName[yypParser->yytos->major], yyNewState); }else{ fprintf(yyTraceFILE,"%sShift '%s'\n", - yyTracePrompt,yyTokenName[yypParser->yystack[yypParser->yyidx].major]); + yyTracePrompt,yyTokenName[yypParser->yytos->major]); } } } @@ -132491,27 +133335,30 @@ static void yy_shift( sqlite3ParserTOKENTYPE yyMinor /* The minor token to shift in */ ){ yyStackEntry *yytos; - yypParser->yyidx++; + yypParser->yytos++; #ifdef YYTRACKMAXSTACKDEPTH - if( yypParser->yyidx>yypParser->yyidxMax ){ - yypParser->yyidxMax = yypParser->yyidx; + if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) ); } #endif #if YYSTACKDEPTH>0 - if( yypParser->yyidx>=YYSTACKDEPTH ){ + if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH] ){ yyStackOverflow(yypParser); return; } #else - if( yypParser->yyidx>=yypParser->yystksz ){ - yyGrowStack(yypParser); - if( yypParser->yyidx>=yypParser->yystksz ){ + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){ + if( yyGrowStack(yypParser) ){ yyStackOverflow(yypParser); return; } } #endif - yytos = &yypParser->yystack[yypParser->yyidx]; + if( yyNewState > YY_MAX_SHIFT ){ + yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; + } + yytos = yypParser->yytos; yytos->stateno = (YYACTIONTYPE)yyNewState; yytos->major = (YYCODETYPE)yyMajor; yytos->minor.yy0 = yyMinor; @@ -132715,27 +133562,29 @@ static const struct { { 173, 5 }, { 173, 3 }, { 173, 5 }, - { 173, 4 }, + { 173, 5 }, { 173, 4 }, { 173, 5 }, - { 225, 5 }, - { 225, 4 }, - { 226, 2 }, - { 226, 0 }, - { 224, 1 }, - { 224, 0 }, + { 226, 5 }, + { 226, 4 }, + { 227, 2 }, + { 227, 0 }, + { 225, 1 }, + { 225, 0 }, { 208, 0 }, { 207, 3 }, { 207, 1 }, + { 224, 0 }, + { 224, 3 }, { 149, 12 }, - { 227, 1 }, - { 227, 0 }, + { 228, 1 }, + { 228, 0 }, { 177, 0 }, { 177, 3 }, { 187, 5 }, { 187, 3 }, - { 228, 0 }, - { 228, 2 }, + { 229, 0 }, + { 229, 2 }, { 149, 4 }, { 149, 1 }, { 149, 2 }, @@ -132747,25 +133596,25 @@ static const struct { { 169, 2 }, { 170, 2 }, { 149, 5 }, - { 230, 11 }, - { 232, 1 }, - { 232, 1 }, + { 231, 11 }, + { 233, 1 }, + { 233, 1 }, + { 233, 2 }, + { 233, 0 }, + { 234, 1 }, + { 234, 1 }, + { 234, 3 }, + { 236, 0 }, + { 236, 2 }, + { 232, 3 }, { 232, 2 }, - { 232, 0 }, - { 233, 1 }, - { 233, 1 }, - { 233, 3 }, - { 235, 0 }, - { 235, 2 }, - { 231, 3 }, - { 231, 2 }, - { 237, 3 }, { 238, 3 }, - { 238, 2 }, - { 236, 7 }, - { 236, 5 }, - { 236, 5 }, - { 236, 1 }, + { 239, 3 }, + { 239, 2 }, + { 237, 7 }, + { 237, 5 }, + { 237, 5 }, + { 237, 1 }, { 173, 4 }, { 173, 6 }, { 191, 1 }, @@ -132774,27 +133623,27 @@ static const struct { { 149, 4 }, { 149, 6 }, { 149, 3 }, - { 240, 0 }, - { 240, 2 }, + { 241, 0 }, + { 241, 2 }, { 149, 1 }, { 149, 3 }, { 149, 1 }, { 149, 3 }, { 149, 6 }, { 149, 7 }, - { 241, 1 }, + { 242, 1 }, { 149, 1 }, { 149, 4 }, - { 243, 8 }, - { 245, 0 }, - { 246, 1 }, - { 246, 3 }, + { 244, 8 }, + { 246, 0 }, { 247, 1 }, + { 247, 3 }, + { 248, 1 }, { 196, 0 }, { 196, 2 }, { 196, 3 }, - { 249, 6 }, - { 249, 8 }, + { 250, 6 }, + { 250, 8 }, { 144, 1 }, { 145, 2 }, { 145, 1 }, @@ -132831,26 +133680,26 @@ static const struct { { 210, 1 }, { 173, 1 }, { 208, 1 }, - { 229, 1 }, - { 229, 1 }, - { 229, 1 }, - { 229, 1 }, - { 229, 1 }, + { 230, 1 }, + { 230, 1 }, + { 230, 1 }, + { 230, 1 }, + { 230, 1 }, { 169, 1 }, - { 234, 0 }, - { 234, 3 }, - { 237, 1 }, - { 238, 0 }, - { 239, 1 }, + { 235, 0 }, + { 235, 3 }, + { 238, 1 }, { 239, 0 }, - { 242, 0 }, - { 242, 1 }, - { 244, 1 }, - { 244, 3 }, - { 245, 2 }, - { 248, 0 }, - { 248, 4 }, - { 248, 2 }, + { 240, 1 }, + { 240, 0 }, + { 243, 0 }, + { 243, 1 }, + { 245, 1 }, + { 245, 3 }, + { 246, 2 }, + { 249, 0 }, + { 249, 4 }, + { 249, 2 }, }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -132868,7 +133717,7 @@ static void yy_reduce( yyStackEntry *yymsp; /* The top of the parser's stack */ int yysize; /* Amount to pop the stack */ sqlite3ParserARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; + yymsp = yypParser->yytos; #ifndef NDEBUG if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ yysize = yyRuleInfo[yyruleno].nrhs; @@ -132882,22 +133731,23 @@ static void yy_reduce( ** enough on the stack to push the LHS value */ if( yyRuleInfo[yyruleno].nrhs==0 ){ #ifdef YYTRACKMAXSTACKDEPTH - if( yypParser->yyidx>yypParser->yyidxMax ){ - yypParser->yyidxMax = yypParser->yyidx; + if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); } #endif #if YYSTACKDEPTH>0 - if( yypParser->yyidx>=YYSTACKDEPTH-1 ){ + if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH-1] ){ yyStackOverflow(yypParser); return; } #else - if( yypParser->yyidx>=yypParser->yystksz-1 ){ - yyGrowStack(yypParser); - if( yypParser->yyidx>=yypParser->yystksz-1 ){ + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ + if( yyGrowStack(yypParser) ){ yyStackOverflow(yypParser); return; } + yymsp = yypParser->yytos; } #endif } @@ -132923,15 +133773,15 @@ static void yy_reduce( { sqlite3FinishCoding(pParse); } break; case 3: /* cmd ::= BEGIN transtype trans_opt */ -{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy392);} +{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy194);} break; case 4: /* transtype ::= */ -{yymsp[1].minor.yy392 = TK_DEFERRED;} +{yymsp[1].minor.yy194 = TK_DEFERRED;} break; case 5: /* transtype ::= DEFERRED */ case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6); case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7); -{yymsp[0].minor.yy392 = yymsp[0].major; /*A-overwrites-X*/} +{yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-X*/} break; case 8: /* cmd ::= COMMIT trans_opt */ case 9: /* cmd ::= END trans_opt */ yytestcase(yyruleno==9); @@ -132957,7 +133807,7 @@ static void yy_reduce( break; case 14: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ { - sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy392,0,0,yymsp[-2].minor.yy392); + sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy194,0,0,yymsp[-2].minor.yy194); } break; case 15: /* createkw ::= CREATE */ @@ -132971,33 +133821,33 @@ static void yy_reduce( case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67); case 76: /* ifexists ::= */ yytestcase(yyruleno==76); case 90: /* distinct ::= */ yytestcase(yyruleno==90); - case 209: /* collate ::= */ yytestcase(yyruleno==209); -{yymsp[1].minor.yy392 = 0;} + case 211: /* collate ::= */ yytestcase(yyruleno==211); +{yymsp[1].minor.yy194 = 0;} break; case 17: /* ifnotexists ::= IF NOT EXISTS */ -{yymsp[-2].minor.yy392 = 1;} +{yymsp[-2].minor.yy194 = 1;} break; case 18: /* temp ::= TEMP */ case 43: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==43); -{yymsp[0].minor.yy392 = 1;} +{yymsp[0].minor.yy194 = 1;} break; case 20: /* create_table_args ::= LP columnlist conslist_opt RP table_options */ { - sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy392,0); + sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy194,0); } break; case 21: /* create_table_args ::= AS select */ { - sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy159); - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy159); + sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy243); + sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy243); } break; case 23: /* table_options ::= WITHOUT nm */ { if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){ - yymsp[-1].minor.yy392 = TF_WithoutRowid | TF_NoVisibleRowid; + yymsp[-1].minor.yy194 = TF_WithoutRowid | TF_NoVisibleRowid; }else{ - yymsp[-1].minor.yy392 = 0; + yymsp[-1].minor.yy194 = 0; sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); } } @@ -133029,17 +133879,17 @@ static void yy_reduce( break; case 30: /* ccons ::= DEFAULT term */ case 32: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==32); -{sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy342);} +{sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy190);} break; case 31: /* ccons ::= DEFAULT LP expr RP */ -{sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy342);} +{sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy190);} break; case 33: /* ccons ::= DEFAULT MINUS term */ { ExprSpan v; - v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy342.pExpr, 0, 0); + v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy190.pExpr, 0, 0); v.zStart = yymsp[-1].minor.yy0.z; - v.zEnd = yymsp[0].minor.yy342.zEnd; + v.zEnd = yymsp[0].minor.yy190.zEnd; sqlite3AddDefaultValue(pParse,&v); } break; @@ -133051,147 +133901,149 @@ static void yy_reduce( } break; case 35: /* ccons ::= NOT NULL onconf */ -{sqlite3AddNotNull(pParse, yymsp[0].minor.yy392);} +{sqlite3AddNotNull(pParse, yymsp[0].minor.yy194);} break; case 36: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ -{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy392,yymsp[0].minor.yy392,yymsp[-2].minor.yy392);} +{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy194,yymsp[0].minor.yy194,yymsp[-2].minor.yy194);} break; case 37: /* ccons ::= UNIQUE onconf */ -{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy392,0,0,0,0);} +{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy194,0,0,0,0, + SQLITE_IDXTYPE_UNIQUE);} break; case 38: /* ccons ::= CHECK LP expr RP */ -{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy342.pExpr);} +{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy190.pExpr);} break; case 39: /* ccons ::= REFERENCES nm eidlist_opt refargs */ -{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy442,yymsp[0].minor.yy392);} +{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy148,yymsp[0].minor.yy194);} break; case 40: /* ccons ::= defer_subclause */ -{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy392);} +{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy194);} break; case 41: /* ccons ::= COLLATE ID|STRING */ {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);} break; case 44: /* refargs ::= */ -{ yymsp[1].minor.yy392 = OE_None*0x0101; /* EV: R-19803-45884 */} +{ yymsp[1].minor.yy194 = OE_None*0x0101; /* EV: R-19803-45884 */} break; case 45: /* refargs ::= refargs refarg */ -{ yymsp[-1].minor.yy392 = (yymsp[-1].minor.yy392 & ~yymsp[0].minor.yy207.mask) | yymsp[0].minor.yy207.value; } +{ yymsp[-1].minor.yy194 = (yymsp[-1].minor.yy194 & ~yymsp[0].minor.yy497.mask) | yymsp[0].minor.yy497.value; } break; case 46: /* refarg ::= MATCH nm */ -{ yymsp[-1].minor.yy207.value = 0; yymsp[-1].minor.yy207.mask = 0x000000; } +{ yymsp[-1].minor.yy497.value = 0; yymsp[-1].minor.yy497.mask = 0x000000; } break; case 47: /* refarg ::= ON INSERT refact */ -{ yymsp[-2].minor.yy207.value = 0; yymsp[-2].minor.yy207.mask = 0x000000; } +{ yymsp[-2].minor.yy497.value = 0; yymsp[-2].minor.yy497.mask = 0x000000; } break; case 48: /* refarg ::= ON DELETE refact */ -{ yymsp[-2].minor.yy207.value = yymsp[0].minor.yy392; yymsp[-2].minor.yy207.mask = 0x0000ff; } +{ yymsp[-2].minor.yy497.value = yymsp[0].minor.yy194; yymsp[-2].minor.yy497.mask = 0x0000ff; } break; case 49: /* refarg ::= ON UPDATE refact */ -{ yymsp[-2].minor.yy207.value = yymsp[0].minor.yy392<<8; yymsp[-2].minor.yy207.mask = 0x00ff00; } +{ yymsp[-2].minor.yy497.value = yymsp[0].minor.yy194<<8; yymsp[-2].minor.yy497.mask = 0x00ff00; } break; case 50: /* refact ::= SET NULL */ -{ yymsp[-1].minor.yy392 = OE_SetNull; /* EV: R-33326-45252 */} +{ yymsp[-1].minor.yy194 = OE_SetNull; /* EV: R-33326-45252 */} break; case 51: /* refact ::= SET DEFAULT */ -{ yymsp[-1].minor.yy392 = OE_SetDflt; /* EV: R-33326-45252 */} +{ yymsp[-1].minor.yy194 = OE_SetDflt; /* EV: R-33326-45252 */} break; case 52: /* refact ::= CASCADE */ -{ yymsp[0].minor.yy392 = OE_Cascade; /* EV: R-33326-45252 */} +{ yymsp[0].minor.yy194 = OE_Cascade; /* EV: R-33326-45252 */} break; case 53: /* refact ::= RESTRICT */ -{ yymsp[0].minor.yy392 = OE_Restrict; /* EV: R-33326-45252 */} +{ yymsp[0].minor.yy194 = OE_Restrict; /* EV: R-33326-45252 */} break; case 54: /* refact ::= NO ACTION */ -{ yymsp[-1].minor.yy392 = OE_None; /* EV: R-33326-45252 */} +{ yymsp[-1].minor.yy194 = OE_None; /* EV: R-33326-45252 */} break; case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ -{yymsp[-2].minor.yy392 = 0;} +{yymsp[-2].minor.yy194 = 0;} break; case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71); case 142: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==142); -{yymsp[-1].minor.yy392 = yymsp[0].minor.yy392;} +{yymsp[-1].minor.yy194 = yymsp[0].minor.yy194;} break; case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75); case 183: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==183); case 186: /* in_op ::= NOT IN */ yytestcase(yyruleno==186); - case 210: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==210); -{yymsp[-1].minor.yy392 = 1;} + case 212: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==212); +{yymsp[-1].minor.yy194 = 1;} break; case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ -{yymsp[-1].minor.yy392 = 0;} +{yymsp[-1].minor.yy194 = 0;} break; case 61: /* tconscomma ::= COMMA */ {pParse->constraintName.n = 0;} break; case 63: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ -{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy442,yymsp[0].minor.yy392,yymsp[-2].minor.yy392,0);} +{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy148,yymsp[0].minor.yy194,yymsp[-2].minor.yy194,0);} break; case 64: /* tcons ::= UNIQUE LP sortlist RP onconf */ -{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy442,yymsp[0].minor.yy392,0,0,0,0);} +{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy148,yymsp[0].minor.yy194,0,0,0,0, + SQLITE_IDXTYPE_UNIQUE);} break; case 65: /* tcons ::= CHECK LP expr RP onconf */ -{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy342.pExpr);} +{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy190.pExpr);} break; case 66: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ { - sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy442, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy442, yymsp[-1].minor.yy392); - sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy392); + sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy148, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy148, yymsp[-1].minor.yy194); + sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy194); } break; case 68: /* onconf ::= */ case 70: /* orconf ::= */ yytestcase(yyruleno==70); -{yymsp[1].minor.yy392 = OE_Default;} +{yymsp[1].minor.yy194 = OE_Default;} break; case 69: /* onconf ::= ON CONFLICT resolvetype */ -{yymsp[-2].minor.yy392 = yymsp[0].minor.yy392;} +{yymsp[-2].minor.yy194 = yymsp[0].minor.yy194;} break; case 72: /* resolvetype ::= IGNORE */ -{yymsp[0].minor.yy392 = OE_Ignore;} +{yymsp[0].minor.yy194 = OE_Ignore;} break; case 73: /* resolvetype ::= REPLACE */ case 143: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==143); -{yymsp[0].minor.yy392 = OE_Replace;} +{yymsp[0].minor.yy194 = OE_Replace;} break; case 74: /* cmd ::= DROP TABLE ifexists fullname */ { - sqlite3DropTable(pParse, yymsp[0].minor.yy347, 0, yymsp[-1].minor.yy392); + sqlite3DropTable(pParse, yymsp[0].minor.yy185, 0, yymsp[-1].minor.yy194); } break; case 77: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ { - sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy442, yymsp[0].minor.yy159, yymsp[-7].minor.yy392, yymsp[-5].minor.yy392); + sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy148, yymsp[0].minor.yy243, yymsp[-7].minor.yy194, yymsp[-5].minor.yy194); } break; case 78: /* cmd ::= DROP VIEW ifexists fullname */ { - sqlite3DropTable(pParse, yymsp[0].minor.yy347, 1, yymsp[-1].minor.yy392); + sqlite3DropTable(pParse, yymsp[0].minor.yy185, 1, yymsp[-1].minor.yy194); } break; case 79: /* cmd ::= select */ { SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0}; - sqlite3Select(pParse, yymsp[0].minor.yy159, &dest); - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy159); + sqlite3Select(pParse, yymsp[0].minor.yy243, &dest); + sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy243); } break; case 80: /* select ::= with selectnowith */ { - Select *p = yymsp[0].minor.yy159; + Select *p = yymsp[0].minor.yy243; if( p ){ - p->pWith = yymsp[-1].minor.yy331; + p->pWith = yymsp[-1].minor.yy285; parserDoubleLinkSelect(pParse, p); }else{ - sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy331); + sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy285); } - yymsp[-1].minor.yy159 = p; /*A-overwrites-W*/ + yymsp[-1].minor.yy243 = p; /*A-overwrites-W*/ } break; case 81: /* selectnowith ::= selectnowith multiselect_op oneselect */ { - Select *pRhs = yymsp[0].minor.yy159; - Select *pLhs = yymsp[-2].minor.yy159; + Select *pRhs = yymsp[0].minor.yy243; + Select *pLhs = yymsp[-2].minor.yy243; if( pRhs && pRhs->pPrior ){ SrcList *pFrom; Token x; @@ -133201,30 +134053,30 @@ static void yy_reduce( pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0,0); } if( pRhs ){ - pRhs->op = (u8)yymsp[-1].minor.yy392; + pRhs->op = (u8)yymsp[-1].minor.yy194; pRhs->pPrior = pLhs; if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue; pRhs->selFlags &= ~SF_MultiValue; - if( yymsp[-1].minor.yy392!=TK_ALL ) pParse->hasCompound = 1; + if( yymsp[-1].minor.yy194!=TK_ALL ) pParse->hasCompound = 1; }else{ sqlite3SelectDelete(pParse->db, pLhs); } - yymsp[-2].minor.yy159 = pRhs; + yymsp[-2].minor.yy243 = pRhs; } break; case 82: /* multiselect_op ::= UNION */ case 84: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==84); -{yymsp[0].minor.yy392 = yymsp[0].major; /*A-overwrites-OP*/} +{yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-OP*/} break; case 83: /* multiselect_op ::= UNION ALL */ -{yymsp[-1].minor.yy392 = TK_ALL;} +{yymsp[-1].minor.yy194 = TK_ALL;} break; case 85: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ { #if SELECTTRACE_ENABLED Token s = yymsp[-8].minor.yy0; /*A-overwrites-S*/ #endif - yymsp[-8].minor.yy159 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy442,yymsp[-5].minor.yy347,yymsp[-4].minor.yy122,yymsp[-3].minor.yy442,yymsp[-2].minor.yy122,yymsp[-1].minor.yy442,yymsp[-7].minor.yy392,yymsp[0].minor.yy64.pLimit,yymsp[0].minor.yy64.pOffset); + yymsp[-8].minor.yy243 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy148,yymsp[-5].minor.yy185,yymsp[-4].minor.yy72,yymsp[-3].minor.yy148,yymsp[-2].minor.yy72,yymsp[-1].minor.yy148,yymsp[-7].minor.yy194,yymsp[0].minor.yy354.pLimit,yymsp[0].minor.yy354.pOffset); #if SELECTTRACE_ENABLED /* Populate the Select.zSelName[] string that is used to help with ** query planner debugging, to differentiate between multiple Select @@ -133235,17 +134087,17 @@ static void yy_reduce( ** comment to be the zSelName value. Otherwise, the label is #N where ** is an integer that is incremented with each SELECT statement seen. */ - if( yymsp[-8].minor.yy159!=0 ){ + if( yymsp[-8].minor.yy243!=0 ){ const char *z = s.z+6; int i; - sqlite3_snprintf(sizeof(yymsp[-8].minor.yy159->zSelName), yymsp[-8].minor.yy159->zSelName, "#%d", + sqlite3_snprintf(sizeof(yymsp[-8].minor.yy243->zSelName), yymsp[-8].minor.yy243->zSelName, "#%d", ++pParse->nSelect); while( z[0]==' ' ) z++; if( z[0]=='/' && z[1]=='*' ){ z += 2; while( z[0]==' ' ) z++; for(i=0; sqlite3Isalnum(z[i]); i++){} - sqlite3_snprintf(sizeof(yymsp[-8].minor.yy159->zSelName), yymsp[-8].minor.yy159->zSelName, "%.*s", i, z); + sqlite3_snprintf(sizeof(yymsp[-8].minor.yy243->zSelName), yymsp[-8].minor.yy243->zSelName, "%.*s", i, z); } } #endif /* SELECTRACE_ENABLED */ @@ -133253,47 +134105,48 @@ static void yy_reduce( break; case 86: /* values ::= VALUES LP nexprlist RP */ { - yymsp[-3].minor.yy159 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy442,0,0,0,0,0,SF_Values,0,0); + yymsp[-3].minor.yy243 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy148,0,0,0,0,0,SF_Values,0,0); } break; case 87: /* values ::= values COMMA LP exprlist RP */ { - Select *pRight, *pLeft = yymsp[-4].minor.yy159; - pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy442,0,0,0,0,0,SF_Values|SF_MultiValue,0,0); + Select *pRight, *pLeft = yymsp[-4].minor.yy243; + pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy148,0,0,0,0,0,SF_Values|SF_MultiValue,0,0); if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue; if( pRight ){ pRight->op = TK_ALL; pRight->pPrior = pLeft; - yymsp[-4].minor.yy159 = pRight; + yymsp[-4].minor.yy243 = pRight; }else{ - yymsp[-4].minor.yy159 = pLeft; + yymsp[-4].minor.yy243 = pLeft; } } break; case 88: /* distinct ::= DISTINCT */ -{yymsp[0].minor.yy392 = SF_Distinct;} +{yymsp[0].minor.yy194 = SF_Distinct;} break; case 89: /* distinct ::= ALL */ -{yymsp[0].minor.yy392 = SF_All;} +{yymsp[0].minor.yy194 = SF_All;} break; case 91: /* sclp ::= */ case 119: /* orderby_opt ::= */ yytestcase(yyruleno==119); case 126: /* groupby_opt ::= */ yytestcase(yyruleno==126); case 199: /* exprlist ::= */ yytestcase(yyruleno==199); - case 205: /* eidlist_opt ::= */ yytestcase(yyruleno==205); -{yymsp[1].minor.yy442 = 0;} + case 202: /* paren_exprlist ::= */ yytestcase(yyruleno==202); + case 207: /* eidlist_opt ::= */ yytestcase(yyruleno==207); +{yymsp[1].minor.yy148 = 0;} break; case 92: /* selcollist ::= sclp expr as */ { - yymsp[-2].minor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy442, yymsp[-1].minor.yy342.pExpr); - if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-2].minor.yy442, &yymsp[0].minor.yy0, 1); - sqlite3ExprListSetSpan(pParse,yymsp[-2].minor.yy442,&yymsp[-1].minor.yy342); + yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy148, yymsp[-1].minor.yy190.pExpr); + if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-2].minor.yy148, &yymsp[0].minor.yy0, 1); + sqlite3ExprListSetSpan(pParse,yymsp[-2].minor.yy148,&yymsp[-1].minor.yy190); } break; case 93: /* selcollist ::= sclp STAR */ { Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0); - yymsp[-1].minor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy442, p); + yymsp[-1].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy148, p); } break; case 94: /* selcollist ::= sclp nm DOT STAR */ @@ -133301,70 +134154,70 @@ static void yy_reduce( Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0, &yymsp[0].minor.yy0); Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0); - yymsp[-3].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442, pDot); + yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, pDot); } break; case 95: /* as ::= AS nm */ case 106: /* dbnm ::= DOT nm */ yytestcase(yyruleno==106); - case 219: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==219); - case 220: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==220); + case 221: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==221); + case 222: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==222); {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;} break; case 97: /* from ::= */ -{yymsp[1].minor.yy347 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy347));} +{yymsp[1].minor.yy185 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy185));} break; case 98: /* from ::= FROM seltablist */ { - yymsp[-1].minor.yy347 = yymsp[0].minor.yy347; - sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy347); + yymsp[-1].minor.yy185 = yymsp[0].minor.yy185; + sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy185); } break; case 99: /* stl_prefix ::= seltablist joinop */ { - if( ALWAYS(yymsp[-1].minor.yy347 && yymsp[-1].minor.yy347->nSrc>0) ) yymsp[-1].minor.yy347->a[yymsp[-1].minor.yy347->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy392; + if( ALWAYS(yymsp[-1].minor.yy185 && yymsp[-1].minor.yy185->nSrc>0) ) yymsp[-1].minor.yy185->a[yymsp[-1].minor.yy185->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy194; } break; case 100: /* stl_prefix ::= */ -{yymsp[1].minor.yy347 = 0;} +{yymsp[1].minor.yy185 = 0;} break; case 101: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ { - yymsp[-6].minor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy122,yymsp[0].minor.yy180); - sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy347, &yymsp[-2].minor.yy0); + yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254); + sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy185, &yymsp[-2].minor.yy0); } break; case 102: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ { - yymsp[-8].minor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy347,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy122,yymsp[0].minor.yy180); - sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy347, yymsp[-4].minor.yy442); + yymsp[-8].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy185,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254); + sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy185, yymsp[-4].minor.yy148); } break; case 103: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */ { - yymsp[-6].minor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy159,yymsp[-1].minor.yy122,yymsp[0].minor.yy180); + yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy243,yymsp[-1].minor.yy72,yymsp[0].minor.yy254); } break; case 104: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ { - if( yymsp[-6].minor.yy347==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy122==0 && yymsp[0].minor.yy180==0 ){ - yymsp[-6].minor.yy347 = yymsp[-4].minor.yy347; - }else if( yymsp[-4].minor.yy347->nSrc==1 ){ - yymsp[-6].minor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy122,yymsp[0].minor.yy180); - if( yymsp[-6].minor.yy347 ){ - struct SrcList_item *pNew = &yymsp[-6].minor.yy347->a[yymsp[-6].minor.yy347->nSrc-1]; - struct SrcList_item *pOld = yymsp[-4].minor.yy347->a; + if( yymsp[-6].minor.yy185==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy72==0 && yymsp[0].minor.yy254==0 ){ + yymsp[-6].minor.yy185 = yymsp[-4].minor.yy185; + }else if( yymsp[-4].minor.yy185->nSrc==1 ){ + yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254); + if( yymsp[-6].minor.yy185 ){ + struct SrcList_item *pNew = &yymsp[-6].minor.yy185->a[yymsp[-6].minor.yy185->nSrc-1]; + struct SrcList_item *pOld = yymsp[-4].minor.yy185->a; pNew->zName = pOld->zName; pNew->zDatabase = pOld->zDatabase; pNew->pSelect = pOld->pSelect; pOld->zName = pOld->zDatabase = 0; pOld->pSelect = 0; } - sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy347); + sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy185); }else{ Select *pSubquery; - sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy347); - pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy347,0,0,0,0,SF_NestedFrom,0,0); - yymsp[-6].minor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy122,yymsp[0].minor.yy180); + sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy185); + pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy185,0,0,0,0,SF_NestedFrom,0,0); + yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy72,yymsp[0].minor.yy254); } } break; @@ -133373,32 +134226,32 @@ static void yy_reduce( {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;} break; case 107: /* fullname ::= nm dbnm */ -{yymsp[-1].minor.yy347 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} +{yymsp[-1].minor.yy185 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} break; case 108: /* joinop ::= COMMA|JOIN */ -{ yymsp[0].minor.yy392 = JT_INNER; } +{ yymsp[0].minor.yy194 = JT_INNER; } break; case 109: /* joinop ::= JOIN_KW JOIN */ -{yymsp[-1].minor.yy392 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} +{yymsp[-1].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} break; case 110: /* joinop ::= JOIN_KW nm JOIN */ -{yymsp[-2].minor.yy392 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} +{yymsp[-2].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} break; case 111: /* joinop ::= JOIN_KW nm nm JOIN */ -{yymsp[-3].minor.yy392 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} +{yymsp[-3].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} break; case 112: /* on_opt ::= ON expr */ case 129: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==129); case 136: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==136); case 195: /* case_else ::= ELSE expr */ yytestcase(yyruleno==195); -{yymsp[-1].minor.yy122 = yymsp[0].minor.yy342.pExpr;} +{yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr;} break; case 113: /* on_opt ::= */ case 128: /* having_opt ::= */ yytestcase(yyruleno==128); case 135: /* where_opt ::= */ yytestcase(yyruleno==135); case 196: /* case_else ::= */ yytestcase(yyruleno==196); case 198: /* case_operand ::= */ yytestcase(yyruleno==198); -{yymsp[1].minor.yy122 = 0;} +{yymsp[1].minor.yy72 = 0;} break; case 115: /* indexed_opt ::= INDEXED BY nm */ {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;} @@ -133407,116 +134260,116 @@ static void yy_reduce( {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;} break; case 117: /* using_opt ::= USING LP idlist RP */ -{yymsp[-3].minor.yy180 = yymsp[-1].minor.yy180;} +{yymsp[-3].minor.yy254 = yymsp[-1].minor.yy254;} break; case 118: /* using_opt ::= */ case 144: /* idlist_opt ::= */ yytestcase(yyruleno==144); -{yymsp[1].minor.yy180 = 0;} +{yymsp[1].minor.yy254 = 0;} break; case 120: /* orderby_opt ::= ORDER BY sortlist */ case 127: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==127); -{yymsp[-2].minor.yy442 = yymsp[0].minor.yy442;} +{yymsp[-2].minor.yy148 = yymsp[0].minor.yy148;} break; case 121: /* sortlist ::= sortlist COMMA expr sortorder */ { - yymsp[-3].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442,yymsp[-1].minor.yy342.pExpr); - sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy442,yymsp[0].minor.yy392); + yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148,yymsp[-1].minor.yy190.pExpr); + sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy148,yymsp[0].minor.yy194); } break; case 122: /* sortlist ::= expr sortorder */ { - yymsp[-1].minor.yy442 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy342.pExpr); /*A-overwrites-Y*/ - sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy442,yymsp[0].minor.yy392); + yymsp[-1].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy190.pExpr); /*A-overwrites-Y*/ + sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy148,yymsp[0].minor.yy194); } break; case 123: /* sortorder ::= ASC */ -{yymsp[0].minor.yy392 = SQLITE_SO_ASC;} +{yymsp[0].minor.yy194 = SQLITE_SO_ASC;} break; case 124: /* sortorder ::= DESC */ -{yymsp[0].minor.yy392 = SQLITE_SO_DESC;} +{yymsp[0].minor.yy194 = SQLITE_SO_DESC;} break; case 125: /* sortorder ::= */ -{yymsp[1].minor.yy392 = SQLITE_SO_UNDEFINED;} +{yymsp[1].minor.yy194 = SQLITE_SO_UNDEFINED;} break; case 130: /* limit_opt ::= */ -{yymsp[1].minor.yy64.pLimit = 0; yymsp[1].minor.yy64.pOffset = 0;} +{yymsp[1].minor.yy354.pLimit = 0; yymsp[1].minor.yy354.pOffset = 0;} break; case 131: /* limit_opt ::= LIMIT expr */ -{yymsp[-1].minor.yy64.pLimit = yymsp[0].minor.yy342.pExpr; yymsp[-1].minor.yy64.pOffset = 0;} +{yymsp[-1].minor.yy354.pLimit = yymsp[0].minor.yy190.pExpr; yymsp[-1].minor.yy354.pOffset = 0;} break; case 132: /* limit_opt ::= LIMIT expr OFFSET expr */ -{yymsp[-3].minor.yy64.pLimit = yymsp[-2].minor.yy342.pExpr; yymsp[-3].minor.yy64.pOffset = yymsp[0].minor.yy342.pExpr;} +{yymsp[-3].minor.yy354.pLimit = yymsp[-2].minor.yy190.pExpr; yymsp[-3].minor.yy354.pOffset = yymsp[0].minor.yy190.pExpr;} break; case 133: /* limit_opt ::= LIMIT expr COMMA expr */ -{yymsp[-3].minor.yy64.pOffset = yymsp[-2].minor.yy342.pExpr; yymsp[-3].minor.yy64.pLimit = yymsp[0].minor.yy342.pExpr;} +{yymsp[-3].minor.yy354.pOffset = yymsp[-2].minor.yy190.pExpr; yymsp[-3].minor.yy354.pLimit = yymsp[0].minor.yy190.pExpr;} break; case 134: /* cmd ::= with DELETE FROM fullname indexed_opt where_opt */ { - sqlite3WithPush(pParse, yymsp[-5].minor.yy331, 1); - sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy347, &yymsp[-1].minor.yy0); - sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy347,yymsp[0].minor.yy122); + sqlite3WithPush(pParse, yymsp[-5].minor.yy285, 1); + sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy185, &yymsp[-1].minor.yy0); + sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy185,yymsp[0].minor.yy72); } break; case 137: /* cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt */ { - sqlite3WithPush(pParse, yymsp[-7].minor.yy331, 1); - sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy347, &yymsp[-3].minor.yy0); - sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy442,"set list"); - sqlite3Update(pParse,yymsp[-4].minor.yy347,yymsp[-1].minor.yy442,yymsp[0].minor.yy122,yymsp[-5].minor.yy392); + sqlite3WithPush(pParse, yymsp[-7].minor.yy285, 1); + sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy185, &yymsp[-3].minor.yy0); + sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy148,"set list"); + sqlite3Update(pParse,yymsp[-4].minor.yy185,yymsp[-1].minor.yy148,yymsp[0].minor.yy72,yymsp[-5].minor.yy194); } break; case 138: /* setlist ::= setlist COMMA nm EQ expr */ { - yymsp[-4].minor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy442, yymsp[0].minor.yy342.pExpr); - sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy442, &yymsp[-2].minor.yy0, 1); + yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr); + sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, 1); } break; case 139: /* setlist ::= nm EQ expr */ { - yylhsminor.yy442 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy342.pExpr); - sqlite3ExprListSetName(pParse, yylhsminor.yy442, &yymsp[-2].minor.yy0, 1); + yylhsminor.yy148 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy190.pExpr); + sqlite3ExprListSetName(pParse, yylhsminor.yy148, &yymsp[-2].minor.yy0, 1); } - yymsp[-2].minor.yy442 = yylhsminor.yy442; + yymsp[-2].minor.yy148 = yylhsminor.yy148; break; case 140: /* cmd ::= with insert_cmd INTO fullname idlist_opt select */ { - sqlite3WithPush(pParse, yymsp[-5].minor.yy331, 1); - sqlite3Insert(pParse, yymsp[-2].minor.yy347, yymsp[0].minor.yy159, yymsp[-1].minor.yy180, yymsp[-4].minor.yy392); + sqlite3WithPush(pParse, yymsp[-5].minor.yy285, 1); + sqlite3Insert(pParse, yymsp[-2].minor.yy185, yymsp[0].minor.yy243, yymsp[-1].minor.yy254, yymsp[-4].minor.yy194); } break; case 141: /* cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */ { - sqlite3WithPush(pParse, yymsp[-6].minor.yy331, 1); - sqlite3Insert(pParse, yymsp[-3].minor.yy347, 0, yymsp[-2].minor.yy180, yymsp[-5].minor.yy392); + sqlite3WithPush(pParse, yymsp[-6].minor.yy285, 1); + sqlite3Insert(pParse, yymsp[-3].minor.yy185, 0, yymsp[-2].minor.yy254, yymsp[-5].minor.yy194); } break; case 145: /* idlist_opt ::= LP idlist RP */ -{yymsp[-2].minor.yy180 = yymsp[-1].minor.yy180;} +{yymsp[-2].minor.yy254 = yymsp[-1].minor.yy254;} break; case 146: /* idlist ::= idlist COMMA nm */ -{yymsp[-2].minor.yy180 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy180,&yymsp[0].minor.yy0);} +{yymsp[-2].minor.yy254 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);} break; case 147: /* idlist ::= nm */ -{yymsp[0].minor.yy180 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} +{yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} break; case 148: /* expr ::= LP expr RP */ -{spanSet(&yymsp[-2].minor.yy342,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ yymsp[-2].minor.yy342.pExpr = yymsp[-1].minor.yy342.pExpr;} +{spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ yymsp[-2].minor.yy190.pExpr = yymsp[-1].minor.yy190.pExpr;} break; case 149: /* term ::= NULL */ case 154: /* term ::= INTEGER|FLOAT|BLOB */ yytestcase(yyruleno==154); case 155: /* term ::= STRING */ yytestcase(yyruleno==155); -{spanExpr(&yymsp[0].minor.yy342,pParse,yymsp[0].major,yymsp[0].minor.yy0);/*A-overwrites-X*/} +{spanExpr(&yymsp[0].minor.yy190,pParse,yymsp[0].major,yymsp[0].minor.yy0);/*A-overwrites-X*/} break; case 150: /* expr ::= ID|INDEXED */ case 151: /* expr ::= JOIN_KW */ yytestcase(yyruleno==151); -{spanExpr(&yymsp[0].minor.yy342,pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} +{spanExpr(&yymsp[0].minor.yy190,pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} break; case 152: /* expr ::= nm DOT nm */ { Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0); - spanSet(&yymsp[-2].minor.yy342,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ - yymsp[-2].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0); + spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ + yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0); } break; case 153: /* expr ::= nm DOT nm DOT nm */ @@ -133525,70 +134378,70 @@ static void yy_reduce( Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0); Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0); - spanSet(&yymsp[-4].minor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ - yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0); + spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ + yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0); } break; case 156: /* expr ::= VARIABLE */ { if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){ - spanExpr(&yymsp[0].minor.yy342, pParse, TK_VARIABLE, yymsp[0].minor.yy0); - sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy342.pExpr); + spanExpr(&yymsp[0].minor.yy190, pParse, TK_VARIABLE, yymsp[0].minor.yy0); + sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy190.pExpr); }else{ /* When doing a nested parse, one can include terms in an expression ** that look like this: #1 #2 ... These terms refer to registers ** in the virtual machine. #N is the N-th register. */ Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/ assert( t.n>=2 ); - spanSet(&yymsp[0].minor.yy342, &t, &t); + spanSet(&yymsp[0].minor.yy190, &t, &t); if( pParse->nested==0 ){ sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t); - yymsp[0].minor.yy342.pExpr = 0; + yymsp[0].minor.yy190.pExpr = 0; }else{ - yymsp[0].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &t); - if( yymsp[0].minor.yy342.pExpr ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy342.pExpr->iTable); + yymsp[0].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &t); + if( yymsp[0].minor.yy190.pExpr ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy190.pExpr->iTable); } } } break; case 157: /* expr ::= expr COLLATE ID|STRING */ { - yymsp[-2].minor.yy342.pExpr = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy342.pExpr, &yymsp[0].minor.yy0, 1); - yymsp[-2].minor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; + yymsp[-2].minor.yy190.pExpr = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy190.pExpr, &yymsp[0].minor.yy0, 1); + yymsp[-2].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; } break; case 158: /* expr ::= CAST LP expr AS typetoken RP */ { - spanSet(&yymsp[-5].minor.yy342,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ - yymsp[-5].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy342.pExpr, 0, &yymsp[-1].minor.yy0); + spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ + yymsp[-5].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy190.pExpr, 0, &yymsp[-1].minor.yy0); } break; case 159: /* expr ::= ID|INDEXED LP distinct exprlist RP */ { - if( yymsp[-1].minor.yy442 && yymsp[-1].minor.yy442->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){ + if( yymsp[-1].minor.yy148 && yymsp[-1].minor.yy148->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){ sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0); } - yylhsminor.yy342.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy442, &yymsp[-4].minor.yy0); - spanSet(&yylhsminor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); - if( yymsp[-2].minor.yy392==SF_Distinct && yylhsminor.yy342.pExpr ){ - yylhsminor.yy342.pExpr->flags |= EP_Distinct; + yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy148, &yymsp[-4].minor.yy0); + spanSet(&yylhsminor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); + if( yymsp[-2].minor.yy194==SF_Distinct && yylhsminor.yy190.pExpr ){ + yylhsminor.yy190.pExpr->flags |= EP_Distinct; } } - yymsp[-4].minor.yy342 = yylhsminor.yy342; + yymsp[-4].minor.yy190 = yylhsminor.yy190; break; case 160: /* expr ::= ID|INDEXED LP STAR RP */ { - yylhsminor.yy342.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0); - spanSet(&yylhsminor.yy342,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); + yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0); + spanSet(&yylhsminor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); } - yymsp[-3].minor.yy342 = yylhsminor.yy342; + yymsp[-3].minor.yy190 = yylhsminor.yy190; break; case 161: /* term ::= CTIME_KW */ { - yylhsminor.yy342.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0); - spanSet(&yylhsminor.yy342, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0); + yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0); + spanSet(&yylhsminor.yy190, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy342 = yylhsminor.yy342; + yymsp[0].minor.yy190 = yylhsminor.yy190; break; case 162: /* expr ::= expr AND expr */ case 163: /* expr ::= expr OR expr */ yytestcase(yyruleno==163); @@ -133598,86 +134451,86 @@ static void yy_reduce( case 167: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==167); case 168: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==168); case 169: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==169); -{spanBinaryExpr(pParse,yymsp[-1].major,&yymsp[-2].minor.yy342,&yymsp[0].minor.yy342);} +{spanBinaryExpr(pParse,yymsp[-1].major,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);} break; case 170: /* likeop ::= LIKE_KW|MATCH */ -{yymsp[0].minor.yy318.eOperator = yymsp[0].minor.yy0; yymsp[0].minor.yy318.bNot = 0;/*A-overwrites-X*/} +{yymsp[0].minor.yy392.eOperator = yymsp[0].minor.yy0; yymsp[0].minor.yy392.bNot = 0;/*A-overwrites-X*/} break; case 171: /* likeop ::= NOT LIKE_KW|MATCH */ -{yymsp[-1].minor.yy318.eOperator = yymsp[0].minor.yy0; yymsp[-1].minor.yy318.bNot = 1;} +{yymsp[-1].minor.yy392.eOperator = yymsp[0].minor.yy0; yymsp[-1].minor.yy392.bNot = 1;} break; case 172: /* expr ::= expr likeop expr */ { ExprList *pList; - pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy342.pExpr); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy342.pExpr); - yymsp[-2].minor.yy342.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy318.eOperator); - exprNot(pParse, yymsp[-1].minor.yy318.bNot, &yymsp[-2].minor.yy342); - yymsp[-2].minor.yy342.zEnd = yymsp[0].minor.yy342.zEnd; - if( yymsp[-2].minor.yy342.pExpr ) yymsp[-2].minor.yy342.pExpr->flags |= EP_InfixFunc; + pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy190.pExpr); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy190.pExpr); + yymsp[-2].minor.yy190.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy392.eOperator); + exprNot(pParse, yymsp[-1].minor.yy392.bNot, &yymsp[-2].minor.yy190); + yymsp[-2].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd; + if( yymsp[-2].minor.yy190.pExpr ) yymsp[-2].minor.yy190.pExpr->flags |= EP_InfixFunc; } break; case 173: /* expr ::= expr likeop expr ESCAPE expr */ { ExprList *pList; - pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy342.pExpr); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy342.pExpr); - yymsp[-4].minor.yy342.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy318.eOperator); - exprNot(pParse, yymsp[-3].minor.yy318.bNot, &yymsp[-4].minor.yy342); - yymsp[-4].minor.yy342.zEnd = yymsp[0].minor.yy342.zEnd; - if( yymsp[-4].minor.yy342.pExpr ) yymsp[-4].minor.yy342.pExpr->flags |= EP_InfixFunc; + pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy190.pExpr); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr); + yymsp[-4].minor.yy190.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy392.eOperator); + exprNot(pParse, yymsp[-3].minor.yy392.bNot, &yymsp[-4].minor.yy190); + yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd; + if( yymsp[-4].minor.yy190.pExpr ) yymsp[-4].minor.yy190.pExpr->flags |= EP_InfixFunc; } break; case 174: /* expr ::= expr ISNULL|NOTNULL */ -{spanUnaryPostfix(pParse,yymsp[0].major,&yymsp[-1].minor.yy342,&yymsp[0].minor.yy0);} +{spanUnaryPostfix(pParse,yymsp[0].major,&yymsp[-1].minor.yy190,&yymsp[0].minor.yy0);} break; case 175: /* expr ::= expr NOT NULL */ -{spanUnaryPostfix(pParse,TK_NOTNULL,&yymsp[-2].minor.yy342,&yymsp[0].minor.yy0);} +{spanUnaryPostfix(pParse,TK_NOTNULL,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy0);} break; case 176: /* expr ::= expr IS expr */ { - spanBinaryExpr(pParse,TK_IS,&yymsp[-2].minor.yy342,&yymsp[0].minor.yy342); - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy342.pExpr, yymsp[-2].minor.yy342.pExpr, TK_ISNULL); + spanBinaryExpr(pParse,TK_IS,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190); + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-2].minor.yy190.pExpr, TK_ISNULL); } break; case 177: /* expr ::= expr IS NOT expr */ { - spanBinaryExpr(pParse,TK_ISNOT,&yymsp[-3].minor.yy342,&yymsp[0].minor.yy342); - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy342.pExpr, yymsp[-3].minor.yy342.pExpr, TK_NOTNULL); + spanBinaryExpr(pParse,TK_ISNOT,&yymsp[-3].minor.yy190,&yymsp[0].minor.yy190); + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-3].minor.yy190.pExpr, TK_NOTNULL); } break; case 178: /* expr ::= NOT expr */ case 179: /* expr ::= BITNOT expr */ yytestcase(yyruleno==179); -{spanUnaryPrefix(&yymsp[-1].minor.yy342,pParse,yymsp[-1].major,&yymsp[0].minor.yy342,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} +{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,yymsp[-1].major,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} break; case 180: /* expr ::= MINUS expr */ -{spanUnaryPrefix(&yymsp[-1].minor.yy342,pParse,TK_UMINUS,&yymsp[0].minor.yy342,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} +{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UMINUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} break; case 181: /* expr ::= PLUS expr */ -{spanUnaryPrefix(&yymsp[-1].minor.yy342,pParse,TK_UPLUS,&yymsp[0].minor.yy342,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} +{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UPLUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} break; case 182: /* between_op ::= BETWEEN */ case 185: /* in_op ::= IN */ yytestcase(yyruleno==185); -{yymsp[0].minor.yy392 = 0;} +{yymsp[0].minor.yy194 = 0;} break; case 184: /* expr ::= expr between_op expr AND expr */ { - ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy342.pExpr); - yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy342.pExpr, 0, 0); - if( yymsp[-4].minor.yy342.pExpr ){ - yymsp[-4].minor.yy342.pExpr->x.pList = pList; + ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr); + yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy190.pExpr, 0, 0); + if( yymsp[-4].minor.yy190.pExpr ){ + yymsp[-4].minor.yy190.pExpr->x.pList = pList; }else{ sqlite3ExprListDelete(pParse->db, pList); } - exprNot(pParse, yymsp[-3].minor.yy392, &yymsp[-4].minor.yy342); - yymsp[-4].minor.yy342.zEnd = yymsp[0].minor.yy342.zEnd; + exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190); + yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd; } break; case 187: /* expr ::= expr in_op LP exprlist RP */ { - if( yymsp[-1].minor.yy442==0 ){ + if( yymsp[-1].minor.yy148==0 ){ /* Expressions of the form ** ** expr1 IN () @@ -133686,9 +134539,9 @@ static void yy_reduce( ** simplify to constants 0 (false) and 1 (true), respectively, ** regardless of the value of expr1. */ - sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy342.pExpr); - yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &sqlite3IntTokens[yymsp[-3].minor.yy392]); - }else if( yymsp[-1].minor.yy442->nExpr==1 ){ + sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy190.pExpr); + yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &sqlite3IntTokens[yymsp[-3].minor.yy194]); + }else if( yymsp[-1].minor.yy148->nExpr==1 ){ /* Expressions of the form: ** ** expr1 IN (?1) @@ -133705,200 +134558,202 @@ static void yy_reduce( ** affinity or the collating sequence to use for comparison. Otherwise, ** the semantics would be subtly different from IN or NOT IN. */ - Expr *pRHS = yymsp[-1].minor.yy442->a[0].pExpr; - yymsp[-1].minor.yy442->a[0].pExpr = 0; - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy442); + Expr *pRHS = yymsp[-1].minor.yy148->a[0].pExpr; + yymsp[-1].minor.yy148->a[0].pExpr = 0; + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy148); /* pRHS cannot be NULL because a malloc error would have been detected ** before now and control would have never reached this point */ if( ALWAYS(pRHS) ){ pRHS->flags &= ~EP_Collate; pRHS->flags |= EP_Generic; } - yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, yymsp[-3].minor.yy392 ? TK_NE : TK_EQ, yymsp[-4].minor.yy342.pExpr, pRHS, 0); + yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, yymsp[-3].minor.yy194 ? TK_NE : TK_EQ, yymsp[-4].minor.yy190.pExpr, pRHS, 0); }else{ - yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy342.pExpr, 0, 0); - if( yymsp[-4].minor.yy342.pExpr ){ - yymsp[-4].minor.yy342.pExpr->x.pList = yymsp[-1].minor.yy442; - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy342.pExpr); + yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0, 0); + if( yymsp[-4].minor.yy190.pExpr ){ + yymsp[-4].minor.yy190.pExpr->x.pList = yymsp[-1].minor.yy148; + sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy190.pExpr); }else{ - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy442); + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy148); } - exprNot(pParse, yymsp[-3].minor.yy392, &yymsp[-4].minor.yy342); + exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190); } - yymsp[-4].minor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; + yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; } break; case 188: /* expr ::= LP select RP */ { - spanSet(&yymsp[-2].minor.yy342,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ - yymsp[-2].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0); - sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy342.pExpr, yymsp[-1].minor.yy159); + spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ + yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0); + sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy190.pExpr, yymsp[-1].minor.yy243); } break; case 189: /* expr ::= expr in_op LP select RP */ { - yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy342.pExpr, 0, 0); - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy342.pExpr, yymsp[-1].minor.yy159); - exprNot(pParse, yymsp[-3].minor.yy392, &yymsp[-4].minor.yy342); - yymsp[-4].minor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; + yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0, 0); + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, yymsp[-1].minor.yy243); + exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190); + yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; } break; - case 190: /* expr ::= expr in_op nm dbnm */ + case 190: /* expr ::= expr in_op nm dbnm paren_exprlist */ { - SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0); + SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0); - yymsp[-3].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-3].minor.yy342.pExpr, 0, 0); - sqlite3PExprAddSelect(pParse, yymsp[-3].minor.yy342.pExpr, pSelect); - exprNot(pParse, yymsp[-2].minor.yy392, &yymsp[-3].minor.yy342); - yymsp[-3].minor.yy342.zEnd = yymsp[0].minor.yy0.z ? &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] : &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]; + if( yymsp[0].minor.yy148 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy148); + yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0, 0); + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, pSelect); + exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190); + yymsp[-4].minor.yy190.zEnd = yymsp[-1].minor.yy0.z ? &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n] : &yymsp[-2].minor.yy0.z[yymsp[-2].minor.yy0.n]; } break; case 191: /* expr ::= EXISTS LP select RP */ { Expr *p; - spanSet(&yymsp[-3].minor.yy342,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ - p = yymsp[-3].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0); - sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy159); + spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ + p = yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0); + sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy243); } break; case 192: /* expr ::= CASE case_operand case_exprlist case_else END */ { - spanSet(&yymsp[-4].minor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-C*/ - yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy122, 0, 0); - if( yymsp[-4].minor.yy342.pExpr ){ - yymsp[-4].minor.yy342.pExpr->x.pList = yymsp[-1].minor.yy122 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy442,yymsp[-1].minor.yy122) : yymsp[-2].minor.yy442; - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy342.pExpr); + spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-C*/ + yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy72, 0, 0); + if( yymsp[-4].minor.yy190.pExpr ){ + yymsp[-4].minor.yy190.pExpr->x.pList = yymsp[-1].minor.yy72 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[-1].minor.yy72) : yymsp[-2].minor.yy148; + sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy190.pExpr); }else{ - sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy442); - sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy122); + sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy148); + sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy72); } } break; case 193: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ { - yymsp[-4].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, yymsp[-2].minor.yy342.pExpr); - yymsp[-4].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, yymsp[0].minor.yy342.pExpr); + yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[-2].minor.yy190.pExpr); + yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr); } break; case 194: /* case_exprlist ::= WHEN expr THEN expr */ { - yymsp[-3].minor.yy442 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr); - yymsp[-3].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442, yymsp[0].minor.yy342.pExpr); + yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr); + yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, yymsp[0].minor.yy190.pExpr); } break; case 197: /* case_operand ::= expr */ -{yymsp[0].minor.yy122 = yymsp[0].minor.yy342.pExpr; /*A-overwrites-X*/} +{yymsp[0].minor.yy72 = yymsp[0].minor.yy190.pExpr; /*A-overwrites-X*/} break; case 200: /* nexprlist ::= nexprlist COMMA expr */ -{yymsp[-2].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy442,yymsp[0].minor.yy342.pExpr);} +{yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[0].minor.yy190.pExpr);} break; case 201: /* nexprlist ::= expr */ -{yymsp[0].minor.yy442 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy342.pExpr); /*A-overwrites-Y*/} +{yymsp[0].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy190.pExpr); /*A-overwrites-Y*/} break; - case 202: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ + case 203: /* paren_exprlist ::= LP exprlist RP */ + case 208: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==208); +{yymsp[-2].minor.yy148 = yymsp[-1].minor.yy148;} + break; + case 204: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ { sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, - sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy442, yymsp[-10].minor.yy392, - &yymsp[-11].minor.yy0, yymsp[0].minor.yy122, SQLITE_SO_ASC, yymsp[-8].minor.yy392); + sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy148, yymsp[-10].minor.yy194, + &yymsp[-11].minor.yy0, yymsp[0].minor.yy72, SQLITE_SO_ASC, yymsp[-8].minor.yy194, SQLITE_IDXTYPE_APPDEF); } break; - case 203: /* uniqueflag ::= UNIQUE */ - case 244: /* raisetype ::= ABORT */ yytestcase(yyruleno==244); -{yymsp[0].minor.yy392 = OE_Abort;} + case 205: /* uniqueflag ::= UNIQUE */ + case 246: /* raisetype ::= ABORT */ yytestcase(yyruleno==246); +{yymsp[0].minor.yy194 = OE_Abort;} break; - case 204: /* uniqueflag ::= */ -{yymsp[1].minor.yy392 = OE_None;} + case 206: /* uniqueflag ::= */ +{yymsp[1].minor.yy194 = OE_None;} break; - case 206: /* eidlist_opt ::= LP eidlist RP */ -{yymsp[-2].minor.yy442 = yymsp[-1].minor.yy442;} - break; - case 207: /* eidlist ::= eidlist COMMA nm collate sortorder */ + case 209: /* eidlist ::= eidlist COMMA nm collate sortorder */ { - yymsp[-4].minor.yy442 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy442, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); + yymsp[-4].minor.yy148 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194); } break; - case 208: /* eidlist ::= nm collate sortorder */ + case 210: /* eidlist ::= nm collate sortorder */ { - yymsp[-2].minor.yy442 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); /*A-overwrites-Y*/ + yymsp[-2].minor.yy148 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194); /*A-overwrites-Y*/ } break; - case 211: /* cmd ::= DROP INDEX ifexists fullname */ -{sqlite3DropIndex(pParse, yymsp[0].minor.yy347, yymsp[-1].minor.yy392);} + case 213: /* cmd ::= DROP INDEX ifexists fullname */ +{sqlite3DropIndex(pParse, yymsp[0].minor.yy185, yymsp[-1].minor.yy194);} break; - case 212: /* cmd ::= VACUUM */ - case 213: /* cmd ::= VACUUM nm */ yytestcase(yyruleno==213); + case 214: /* cmd ::= VACUUM */ + case 215: /* cmd ::= VACUUM nm */ yytestcase(yyruleno==215); {sqlite3Vacuum(pParse);} break; - case 214: /* cmd ::= PRAGMA nm dbnm */ + case 216: /* cmd ::= PRAGMA nm dbnm */ {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} break; - case 215: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ + case 217: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);} break; - case 216: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ + case 218: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);} break; - case 217: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ + case 219: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);} break; - case 218: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ + case 220: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);} break; - case 221: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ + case 223: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ { Token all; all.z = yymsp[-3].minor.yy0.z; all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n; - sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy327, &all); + sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy145, &all); } break; - case 222: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ + case 224: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ { - sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy392, yymsp[-4].minor.yy410.a, yymsp[-4].minor.yy410.b, yymsp[-2].minor.yy347, yymsp[0].minor.yy122, yymsp[-10].minor.yy392, yymsp[-8].minor.yy392); + sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy194, yymsp[-4].minor.yy332.a, yymsp[-4].minor.yy332.b, yymsp[-2].minor.yy185, yymsp[0].minor.yy72, yymsp[-10].minor.yy194, yymsp[-8].minor.yy194); yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/ } break; - case 223: /* trigger_time ::= BEFORE */ -{ yymsp[0].minor.yy392 = TK_BEFORE; } + case 225: /* trigger_time ::= BEFORE */ +{ yymsp[0].minor.yy194 = TK_BEFORE; } break; - case 224: /* trigger_time ::= AFTER */ -{ yymsp[0].minor.yy392 = TK_AFTER; } + case 226: /* trigger_time ::= AFTER */ +{ yymsp[0].minor.yy194 = TK_AFTER; } break; - case 225: /* trigger_time ::= INSTEAD OF */ -{ yymsp[-1].minor.yy392 = TK_INSTEAD;} + case 227: /* trigger_time ::= INSTEAD OF */ +{ yymsp[-1].minor.yy194 = TK_INSTEAD;} break; - case 226: /* trigger_time ::= */ -{ yymsp[1].minor.yy392 = TK_BEFORE; } + case 228: /* trigger_time ::= */ +{ yymsp[1].minor.yy194 = TK_BEFORE; } break; - case 227: /* trigger_event ::= DELETE|INSERT */ - case 228: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==228); -{yymsp[0].minor.yy410.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy410.b = 0;} + case 229: /* trigger_event ::= DELETE|INSERT */ + case 230: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==230); +{yymsp[0].minor.yy332.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy332.b = 0;} break; - case 229: /* trigger_event ::= UPDATE OF idlist */ -{yymsp[-2].minor.yy410.a = TK_UPDATE; yymsp[-2].minor.yy410.b = yymsp[0].minor.yy180;} + case 231: /* trigger_event ::= UPDATE OF idlist */ +{yymsp[-2].minor.yy332.a = TK_UPDATE; yymsp[-2].minor.yy332.b = yymsp[0].minor.yy254;} break; - case 230: /* when_clause ::= */ - case 249: /* key_opt ::= */ yytestcase(yyruleno==249); -{ yymsp[1].minor.yy122 = 0; } + case 232: /* when_clause ::= */ + case 251: /* key_opt ::= */ yytestcase(yyruleno==251); +{ yymsp[1].minor.yy72 = 0; } break; - case 231: /* when_clause ::= WHEN expr */ - case 250: /* key_opt ::= KEY expr */ yytestcase(yyruleno==250); -{ yymsp[-1].minor.yy122 = yymsp[0].minor.yy342.pExpr; } + case 233: /* when_clause ::= WHEN expr */ + case 252: /* key_opt ::= KEY expr */ yytestcase(yyruleno==252); +{ yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr; } break; - case 232: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ + case 234: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ { - assert( yymsp[-2].minor.yy327!=0 ); - yymsp[-2].minor.yy327->pLast->pNext = yymsp[-1].minor.yy327; - yymsp[-2].minor.yy327->pLast = yymsp[-1].minor.yy327; + assert( yymsp[-2].minor.yy145!=0 ); + yymsp[-2].minor.yy145->pLast->pNext = yymsp[-1].minor.yy145; + yymsp[-2].minor.yy145->pLast = yymsp[-1].minor.yy145; } break; - case 233: /* trigger_cmd_list ::= trigger_cmd SEMI */ + case 235: /* trigger_cmd_list ::= trigger_cmd SEMI */ { - assert( yymsp[-1].minor.yy327!=0 ); - yymsp[-1].minor.yy327->pLast = yymsp[-1].minor.yy327; + assert( yymsp[-1].minor.yy145!=0 ); + yymsp[-1].minor.yy145->pLast = yymsp[-1].minor.yy145; } break; - case 234: /* trnm ::= nm DOT nm */ + case 236: /* trnm ::= nm DOT nm */ { yymsp[-2].minor.yy0 = yymsp[0].minor.yy0; sqlite3ErrorMsg(pParse, @@ -133906,195 +134761,195 @@ static void yy_reduce( "statements within triggers"); } break; - case 235: /* tridxby ::= INDEXED BY nm */ + case 237: /* tridxby ::= INDEXED BY nm */ { sqlite3ErrorMsg(pParse, "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " "within triggers"); } break; - case 236: /* tridxby ::= NOT INDEXED */ + case 238: /* tridxby ::= NOT INDEXED */ { sqlite3ErrorMsg(pParse, "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " "within triggers"); } break; - case 237: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */ -{yymsp[-6].minor.yy327 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy442, yymsp[0].minor.yy122, yymsp[-5].minor.yy392);} + case 239: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */ +{yymsp[-6].minor.yy145 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy148, yymsp[0].minor.yy72, yymsp[-5].minor.yy194);} break; - case 238: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */ -{yymsp[-4].minor.yy327 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy180, yymsp[0].minor.yy159, yymsp[-4].minor.yy392);/*A-overwrites-R*/} + case 240: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */ +{yymsp[-4].minor.yy145 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy254, yymsp[0].minor.yy243, yymsp[-4].minor.yy194);/*A-overwrites-R*/} break; - case 239: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */ -{yymsp[-4].minor.yy327 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy122);} + case 241: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */ +{yymsp[-4].minor.yy145 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy72);} break; - case 240: /* trigger_cmd ::= select */ -{yymsp[0].minor.yy327 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy159); /*A-overwrites-X*/} + case 242: /* trigger_cmd ::= select */ +{yymsp[0].minor.yy145 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy243); /*A-overwrites-X*/} break; - case 241: /* expr ::= RAISE LP IGNORE RP */ + case 243: /* expr ::= RAISE LP IGNORE RP */ { - spanSet(&yymsp[-3].minor.yy342,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ - yymsp[-3].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0); - if( yymsp[-3].minor.yy342.pExpr ){ - yymsp[-3].minor.yy342.pExpr->affinity = OE_Ignore; + spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ + yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0); + if( yymsp[-3].minor.yy190.pExpr ){ + yymsp[-3].minor.yy190.pExpr->affinity = OE_Ignore; } } break; - case 242: /* expr ::= RAISE LP raisetype COMMA nm RP */ + case 244: /* expr ::= RAISE LP raisetype COMMA nm RP */ { - spanSet(&yymsp[-5].minor.yy342,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ - yymsp[-5].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0); - if( yymsp[-5].minor.yy342.pExpr ) { - yymsp[-5].minor.yy342.pExpr->affinity = (char)yymsp[-3].minor.yy392; + spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ + yymsp[-5].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0); + if( yymsp[-5].minor.yy190.pExpr ) { + yymsp[-5].minor.yy190.pExpr->affinity = (char)yymsp[-3].minor.yy194; } } break; - case 243: /* raisetype ::= ROLLBACK */ -{yymsp[0].minor.yy392 = OE_Rollback;} + case 245: /* raisetype ::= ROLLBACK */ +{yymsp[0].minor.yy194 = OE_Rollback;} break; - case 245: /* raisetype ::= FAIL */ -{yymsp[0].minor.yy392 = OE_Fail;} + case 247: /* raisetype ::= FAIL */ +{yymsp[0].minor.yy194 = OE_Fail;} break; - case 246: /* cmd ::= DROP TRIGGER ifexists fullname */ + case 248: /* cmd ::= DROP TRIGGER ifexists fullname */ { - sqlite3DropTrigger(pParse,yymsp[0].minor.yy347,yymsp[-1].minor.yy392); + sqlite3DropTrigger(pParse,yymsp[0].minor.yy185,yymsp[-1].minor.yy194); } break; - case 247: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ + case 249: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ { - sqlite3Attach(pParse, yymsp[-3].minor.yy342.pExpr, yymsp[-1].minor.yy342.pExpr, yymsp[0].minor.yy122); + sqlite3Attach(pParse, yymsp[-3].minor.yy190.pExpr, yymsp[-1].minor.yy190.pExpr, yymsp[0].minor.yy72); } break; - case 248: /* cmd ::= DETACH database_kw_opt expr */ + case 250: /* cmd ::= DETACH database_kw_opt expr */ { - sqlite3Detach(pParse, yymsp[0].minor.yy342.pExpr); + sqlite3Detach(pParse, yymsp[0].minor.yy190.pExpr); } break; - case 251: /* cmd ::= REINDEX */ + case 253: /* cmd ::= REINDEX */ {sqlite3Reindex(pParse, 0, 0);} break; - case 252: /* cmd ::= REINDEX nm dbnm */ + case 254: /* cmd ::= REINDEX nm dbnm */ {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} break; - case 253: /* cmd ::= ANALYZE */ + case 255: /* cmd ::= ANALYZE */ {sqlite3Analyze(pParse, 0, 0);} break; - case 254: /* cmd ::= ANALYZE nm dbnm */ + case 256: /* cmd ::= ANALYZE nm dbnm */ {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} break; - case 255: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ + case 257: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ { - sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy347,&yymsp[0].minor.yy0); + sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy185,&yymsp[0].minor.yy0); } break; - case 256: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ + case 258: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ { yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n; sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0); } break; - case 257: /* add_column_fullname ::= fullname */ + case 259: /* add_column_fullname ::= fullname */ { disableLookaside(pParse); - sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy347); + sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy185); } break; - case 258: /* cmd ::= create_vtab */ + case 260: /* cmd ::= create_vtab */ {sqlite3VtabFinishParse(pParse,0);} break; - case 259: /* cmd ::= create_vtab LP vtabarglist RP */ + case 261: /* cmd ::= create_vtab LP vtabarglist RP */ {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} break; - case 260: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ + case 262: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ { - sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy392); + sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy194); } break; - case 261: /* vtabarg ::= */ + case 263: /* vtabarg ::= */ {sqlite3VtabArgInit(pParse);} break; - case 262: /* vtabargtoken ::= ANY */ - case 263: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==263); - case 264: /* lp ::= LP */ yytestcase(yyruleno==264); + case 264: /* vtabargtoken ::= ANY */ + case 265: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==265); + case 266: /* lp ::= LP */ yytestcase(yyruleno==266); {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} break; - case 265: /* with ::= */ -{yymsp[1].minor.yy331 = 0;} + case 267: /* with ::= */ +{yymsp[1].minor.yy285 = 0;} break; - case 266: /* with ::= WITH wqlist */ -{ yymsp[-1].minor.yy331 = yymsp[0].minor.yy331; } + case 268: /* with ::= WITH wqlist */ +{ yymsp[-1].minor.yy285 = yymsp[0].minor.yy285; } break; - case 267: /* with ::= WITH RECURSIVE wqlist */ -{ yymsp[-2].minor.yy331 = yymsp[0].minor.yy331; } + case 269: /* with ::= WITH RECURSIVE wqlist */ +{ yymsp[-2].minor.yy285 = yymsp[0].minor.yy285; } break; - case 268: /* wqlist ::= nm eidlist_opt AS LP select RP */ + case 270: /* wqlist ::= nm eidlist_opt AS LP select RP */ { - yymsp[-5].minor.yy331 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy442, yymsp[-1].minor.yy159); /*A-overwrites-X*/ + yymsp[-5].minor.yy285 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); /*A-overwrites-X*/ } break; - case 269: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ + case 271: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ { - yymsp[-7].minor.yy331 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy331, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy442, yymsp[-1].minor.yy159); + yymsp[-7].minor.yy285 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy285, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); } break; default: - /* (270) input ::= cmdlist */ yytestcase(yyruleno==270); - /* (271) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==271); - /* (272) cmdlist ::= ecmd */ yytestcase(yyruleno==272); - /* (273) ecmd ::= SEMI */ yytestcase(yyruleno==273); - /* (274) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==274); - /* (275) explain ::= */ yytestcase(yyruleno==275); - /* (276) trans_opt ::= */ yytestcase(yyruleno==276); - /* (277) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==277); - /* (278) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==278); - /* (279) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==279); - /* (280) savepoint_opt ::= */ yytestcase(yyruleno==280); - /* (281) cmd ::= create_table create_table_args */ yytestcase(yyruleno==281); - /* (282) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==282); - /* (283) columnlist ::= columnname carglist */ yytestcase(yyruleno==283); - /* (284) nm ::= ID|INDEXED */ yytestcase(yyruleno==284); - /* (285) nm ::= STRING */ yytestcase(yyruleno==285); - /* (286) nm ::= JOIN_KW */ yytestcase(yyruleno==286); - /* (287) typetoken ::= typename */ yytestcase(yyruleno==287); - /* (288) typename ::= ID|STRING */ yytestcase(yyruleno==288); - /* (289) signed ::= plus_num */ yytestcase(yyruleno==289); - /* (290) signed ::= minus_num */ yytestcase(yyruleno==290); - /* (291) carglist ::= carglist ccons */ yytestcase(yyruleno==291); - /* (292) carglist ::= */ yytestcase(yyruleno==292); - /* (293) ccons ::= NULL onconf */ yytestcase(yyruleno==293); - /* (294) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==294); - /* (295) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==295); - /* (296) conslist ::= tcons */ yytestcase(yyruleno==296); - /* (297) tconscomma ::= */ yytestcase(yyruleno==297); - /* (298) defer_subclause_opt ::= defer_subclause */ yytestcase(yyruleno==298); - /* (299) resolvetype ::= raisetype */ yytestcase(yyruleno==299); - /* (300) selectnowith ::= oneselect */ yytestcase(yyruleno==300); - /* (301) oneselect ::= values */ yytestcase(yyruleno==301); - /* (302) sclp ::= selcollist COMMA */ yytestcase(yyruleno==302); - /* (303) as ::= ID|STRING */ yytestcase(yyruleno==303); - /* (304) expr ::= term */ yytestcase(yyruleno==304); - /* (305) exprlist ::= nexprlist */ yytestcase(yyruleno==305); - /* (306) nmnum ::= plus_num */ yytestcase(yyruleno==306); - /* (307) nmnum ::= nm */ yytestcase(yyruleno==307); - /* (308) nmnum ::= ON */ yytestcase(yyruleno==308); - /* (309) nmnum ::= DELETE */ yytestcase(yyruleno==309); - /* (310) nmnum ::= DEFAULT */ yytestcase(yyruleno==310); - /* (311) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==311); - /* (312) foreach_clause ::= */ yytestcase(yyruleno==312); - /* (313) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==313); - /* (314) trnm ::= nm */ yytestcase(yyruleno==314); - /* (315) tridxby ::= */ yytestcase(yyruleno==315); - /* (316) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==316); - /* (317) database_kw_opt ::= */ yytestcase(yyruleno==317); - /* (318) kwcolumn_opt ::= */ yytestcase(yyruleno==318); - /* (319) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==319); - /* (320) vtabarglist ::= vtabarg */ yytestcase(yyruleno==320); - /* (321) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==321); - /* (322) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==322); - /* (323) anylist ::= */ yytestcase(yyruleno==323); - /* (324) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==324); - /* (325) anylist ::= anylist ANY */ yytestcase(yyruleno==325); + /* (272) input ::= cmdlist */ yytestcase(yyruleno==272); + /* (273) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==273); + /* (274) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=274); + /* (275) ecmd ::= SEMI */ yytestcase(yyruleno==275); + /* (276) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==276); + /* (277) explain ::= */ yytestcase(yyruleno==277); + /* (278) trans_opt ::= */ yytestcase(yyruleno==278); + /* (279) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==279); + /* (280) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==280); + /* (281) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==281); + /* (282) savepoint_opt ::= */ yytestcase(yyruleno==282); + /* (283) cmd ::= create_table create_table_args */ yytestcase(yyruleno==283); + /* (284) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==284); + /* (285) columnlist ::= columnname carglist */ yytestcase(yyruleno==285); + /* (286) nm ::= ID|INDEXED */ yytestcase(yyruleno==286); + /* (287) nm ::= STRING */ yytestcase(yyruleno==287); + /* (288) nm ::= JOIN_KW */ yytestcase(yyruleno==288); + /* (289) typetoken ::= typename */ yytestcase(yyruleno==289); + /* (290) typename ::= ID|STRING */ yytestcase(yyruleno==290); + /* (291) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=291); + /* (292) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=292); + /* (293) carglist ::= carglist ccons */ yytestcase(yyruleno==293); + /* (294) carglist ::= */ yytestcase(yyruleno==294); + /* (295) ccons ::= NULL onconf */ yytestcase(yyruleno==295); + /* (296) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==296); + /* (297) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==297); + /* (298) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=298); + /* (299) tconscomma ::= */ yytestcase(yyruleno==299); + /* (300) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=300); + /* (301) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=301); + /* (302) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=302); + /* (303) oneselect ::= values */ yytestcase(yyruleno==303); + /* (304) sclp ::= selcollist COMMA */ yytestcase(yyruleno==304); + /* (305) as ::= ID|STRING */ yytestcase(yyruleno==305); + /* (306) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=306); + /* (307) exprlist ::= nexprlist */ yytestcase(yyruleno==307); + /* (308) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=308); + /* (309) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=309); + /* (310) nmnum ::= ON */ yytestcase(yyruleno==310); + /* (311) nmnum ::= DELETE */ yytestcase(yyruleno==311); + /* (312) nmnum ::= DEFAULT */ yytestcase(yyruleno==312); + /* (313) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==313); + /* (314) foreach_clause ::= */ yytestcase(yyruleno==314); + /* (315) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==315); + /* (316) trnm ::= nm */ yytestcase(yyruleno==316); + /* (317) tridxby ::= */ yytestcase(yyruleno==317); + /* (318) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==318); + /* (319) database_kw_opt ::= */ yytestcase(yyruleno==319); + /* (320) kwcolumn_opt ::= */ yytestcase(yyruleno==320); + /* (321) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==321); + /* (322) vtabarglist ::= vtabarg */ yytestcase(yyruleno==322); + /* (323) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==323); + /* (324) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==324); + /* (325) anylist ::= */ yytestcase(yyruleno==325); + /* (326) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==326); + /* (327) anylist ::= anylist ANY */ yytestcase(yyruleno==327); break; /********** End reduce actions ************************************************/ }; @@ -134103,15 +134958,17 @@ static void yy_reduce( yysize = yyRuleInfo[yyruleno].nrhs; yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto); if( yyact <= YY_MAX_SHIFTREDUCE ){ - if( yyact>YY_MAX_SHIFT ) yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; - yypParser->yyidx -= yysize - 1; + if( yyact>YY_MAX_SHIFT ){ + yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; + } yymsp -= yysize-1; + yypParser->yytos = yymsp; yymsp->stateno = (YYACTIONTYPE)yyact; yymsp->major = (YYCODETYPE)yygoto; yyTraceShift(yypParser, yyact); }else{ assert( yyact == YY_ACCEPT_ACTION ); - yypParser->yyidx -= yysize; + yypParser->yytos -= yysize; yy_accept(yypParser); } } @@ -134129,7 +134986,7 @@ static void yy_parse_failed( fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); /* Here code is inserted which will be executed whenever the ** parser fails */ /************ Begin %parse_failure code ***************************************/ @@ -134169,7 +135026,10 @@ static void yy_accept( fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); } #endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + assert( yypParser->yytos==yypParser->yystack ); /* Here code is inserted which will be executed whenever the ** parser accepts */ /*********** Begin %parse_accept code *****************************************/ @@ -134212,28 +135072,8 @@ SQLITE_PRIVATE void sqlite3Parser( #endif yyParser *yypParser; /* The parser */ - /* (re)initialize the parser, if necessary */ yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ -#if YYSTACKDEPTH<=0 - if( yypParser->yystksz <=0 ){ - yyStackOverflow(yypParser); - return; - } -#endif - yypParser->yyidx = 0; -#ifndef YYNOERRORRECOVERY - yypParser->yyerrcnt = -1; -#endif - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInitialize. Empty stack. State 0\n", - yyTracePrompt); - } -#endif - } + assert( yypParser->yytos!=0 ); #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) yyendofinput = (yymajor==0); #endif @@ -134248,7 +135088,6 @@ SQLITE_PRIVATE void sqlite3Parser( do{ yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); if( yyact <= YY_MAX_SHIFTREDUCE ){ - if( yyact > YY_MAX_SHIFT ) yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; yy_shift(yypParser,yyact,yymajor,yyminor); #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt--; @@ -134290,7 +135129,7 @@ SQLITE_PRIVATE void sqlite3Parser( if( yypParser->yyerrcnt<0 ){ yy_syntax_error(yypParser,yymajor,yyminor); } - yymx = yypParser->yystack[yypParser->yyidx].major; + yymx = yypParser->yytos->major; if( yymx==YYERRORSYMBOL || yyerrorhit ){ #ifndef NDEBUG if( yyTraceFILE ){ @@ -134301,18 +135140,20 @@ SQLITE_PRIVATE void sqlite3Parser( yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); yymajor = YYNOCODE; }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_reduce_action( - yypParser->yystack[yypParser->yyidx].stateno, + while( yypParser->yytos >= &yypParser->yystack + && yymx != YYERRORSYMBOL + && (yyact = yy_find_reduce_action( + yypParser->yytos->stateno, YYERRORSYMBOL)) >= YY_MIN_REDUCE ){ yy_pop_parser_stack(yypParser); } - if( yypParser->yyidx < 0 || yymajor==0 ){ + if( yypParser->yytos < yypParser->yystack || yymajor==0 ){ yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); yy_parse_failed(yypParser); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif yymajor = YYNOCODE; }else if( yymx!=YYERRORSYMBOL ){ yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor); @@ -134349,18 +135190,23 @@ SQLITE_PRIVATE void sqlite3Parser( yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); if( yyendofinput ){ yy_parse_failed(yypParser); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif } yymajor = YYNOCODE; #endif } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); + }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack ); #ifndef NDEBUG if( yyTraceFILE ){ - int i; + yyStackEntry *i; + char cDiv = '['; fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE,"%c%s", i==1 ? '[' : ' ', - yyTokenName[yypParser->yystack[i].major]); + for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){ + fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]); + cDiv = ' '; + } fprintf(yyTraceFILE,"]\n"); } #endif @@ -136682,6 +137528,9 @@ static int sqlite3Close(sqlite3 *db, int forceZombie){ return SQLITE_MISUSE_BKPT; } sqlite3_mutex_enter(db->mutex); + if( db->mTrace & SQLITE_TRACE_CLOSE ){ + db->xTrace(SQLITE_TRACE_CLOSE, db->pTraceArg, db, 0); + } /* Force xDisconnect calls on all virtual tables */ disconnectAllVtab(db); @@ -137450,7 +138299,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_overload_function( ** trace is a pointer to a function that is invoked at the start of each ** SQL statement. */ -SQLITE_API void *SQLITE_STDCALL sqlite3_trace(sqlite3 *db, void (*xTrace)(void*,const char*), void *pArg){ +#ifndef SQLITE_OMIT_DEPRECATED +SQLITE_API void *SQLITE_STDCALL sqlite3_trace(sqlite3 *db, void(*xTrace)(void*,const char*), void *pArg){ void *pOld; #ifdef SQLITE_ENABLE_API_ARMOR @@ -137461,11 +138311,36 @@ SQLITE_API void *SQLITE_STDCALL sqlite3_trace(sqlite3 *db, void (*xTrace)(void*, #endif sqlite3_mutex_enter(db->mutex); pOld = db->pTraceArg; - db->xTrace = xTrace; + db->mTrace = xTrace ? SQLITE_TRACE_LEGACY : 0; + db->xTrace = (int(*)(u32,void*,void*,void*))xTrace; db->pTraceArg = pArg; sqlite3_mutex_leave(db->mutex); return pOld; } +#endif /* SQLITE_OMIT_DEPRECATED */ + +/* Register a trace callback using the version-2 interface. +*/ +SQLITE_API int SQLITE_STDCALL sqlite3_trace_v2( + sqlite3 *db, /* Trace this connection */ + unsigned mTrace, /* Mask of events to be traced */ + int(*xTrace)(unsigned,void*,void*,void*), /* Callback to invoke */ + void *pArg /* Context */ +){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( !sqlite3SafetyCheckOk(db) ){ + return SQLITE_MISUSE_BKPT; + } +#endif + sqlite3_mutex_enter(db->mutex); + db->mTrace = mTrace; + db->xTrace = xTrace; + db->pTraceArg = pArg; + sqlite3_mutex_leave(db->mutex); + return SQLITE_OK; +} + +#ifndef SQLITE_OMIT_DEPRECATED /* ** Register a profile function. The pArg from the previously registered ** profile function is returned. @@ -137494,6 +138369,7 @@ SQLITE_API void *SQLITE_STDCALL sqlite3_profile( sqlite3_mutex_leave(db->mutex); return pOld; } +#endif /* SQLITE_OMIT_DEPRECATED */ #endif /* SQLITE_OMIT_TRACE */ /* @@ -149944,7 +150820,11 @@ SQLITE_PRIVATE int sqlite3Fts3InitTokenizer( #ifdef SQLITE_TEST -#include +#if defined(INCLUDE_SQLITE_TCL_H) +# include "sqlite_tcl.h" +#else +# include "tcl.h" +#endif /* #include */ /* @@ -161883,6 +162763,53 @@ static RtreeValue rtreeValueUp(sqlite3_value *v){ } #endif /* !defined(SQLITE_RTREE_INT_ONLY) */ +/* +** A constraint has failed while inserting a row into an rtree table. +** Assuming no OOM error occurs, this function sets the error message +** (at pRtree->base.zErrMsg) to an appropriate value and returns +** SQLITE_CONSTRAINT. +** +** Parameter iCol is the index of the leftmost column involved in the +** constraint failure. If it is 0, then the constraint that failed is +** the unique constraint on the id column. Otherwise, it is the rtree +** (c1<=c2) constraint on columns iCol and iCol+1 that has failed. +** +** If an OOM occurs, SQLITE_NOMEM is returned instead of SQLITE_CONSTRAINT. +*/ +static int rtreeConstraintError(Rtree *pRtree, int iCol){ + sqlite3_stmt *pStmt = 0; + char *zSql; + int rc; + + assert( iCol==0 || iCol%2 ); + zSql = sqlite3_mprintf("SELECT * FROM %Q.%Q", pRtree->zDb, pRtree->zName); + if( zSql ){ + rc = sqlite3_prepare_v2(pRtree->db, zSql, -1, &pStmt, 0); + }else{ + rc = SQLITE_NOMEM; + } + sqlite3_free(zSql); + + if( rc==SQLITE_OK ){ + if( iCol==0 ){ + const char *zCol = sqlite3_column_name(pStmt, 0); + pRtree->base.zErrMsg = sqlite3_mprintf( + "UNIQUE constraint failed: %s.%s", pRtree->zName, zCol + ); + }else{ + const char *zCol1 = sqlite3_column_name(pStmt, iCol); + const char *zCol2 = sqlite3_column_name(pStmt, iCol+1); + pRtree->base.zErrMsg = sqlite3_mprintf( + "rtree constraint failed: %s.(%s<=%s)", pRtree->zName, zCol1, zCol2 + ); + } + } + + sqlite3_finalize(pStmt); + return (rc==SQLITE_OK ? SQLITE_CONSTRAINT : rc); +} + + /* ** The xUpdate method for rtree module virtual tables. @@ -161933,7 +162860,7 @@ static int rtreeUpdate( cell.aCoord[ii].f = rtreeValueDown(azData[ii+3]); cell.aCoord[ii+1].f = rtreeValueUp(azData[ii+4]); if( cell.aCoord[ii].f>cell.aCoord[ii+1].f ){ - rc = SQLITE_CONSTRAINT; + rc = rtreeConstraintError(pRtree, ii+1); goto constraint; } } @@ -161944,7 +162871,7 @@ static int rtreeUpdate( cell.aCoord[ii].i = sqlite3_value_int(azData[ii+3]); cell.aCoord[ii+1].i = sqlite3_value_int(azData[ii+4]); if( cell.aCoord[ii].i>cell.aCoord[ii+1].i ){ - rc = SQLITE_CONSTRAINT; + rc = rtreeConstraintError(pRtree, ii+1); goto constraint; } } @@ -161965,7 +162892,7 @@ static int rtreeUpdate( if( sqlite3_vtab_on_conflict(pRtree->db)==SQLITE_REPLACE ){ rc = rtreeDeleteRowid(pRtree, cell.iRowid); }else{ - rc = SQLITE_CONSTRAINT; + rc = rtreeConstraintError(pRtree, 0); goto constraint; } } @@ -162048,6 +162975,11 @@ static int rtreeQueryStat1(sqlite3 *db, Rtree *pRtree){ int rc; i64 nRow = 0; + if( sqlite3_table_column_metadata(db,pRtree->zDb,"sqlite_stat1", + 0,0,0,0,0,0)==SQLITE_ERROR ){ + pRtree->nRowEst = RTREE_DEFAULT_ROWEST; + return SQLITE_OK; + } zSql = sqlite3_mprintf(zFmt, pRtree->zDb, pRtree->zName); if( zSql==0 ){ rc = SQLITE_NOMEM; @@ -163979,6 +164911,44 @@ SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3rbu_progress(sqlite3rbu *pRbu); */ SQLITE_API void SQLITE_STDCALL sqlite3rbu_bp_progress(sqlite3rbu *pRbu, int *pnOne, int *pnTwo); +/* +** Obtain an indication as to the current stage of an RBU update or vacuum. +** This function always returns one of the SQLITE_RBU_STATE_XXX constants +** defined in this file. Return values should be interpreted as follows: +** +** SQLITE_RBU_STATE_OAL: +** RBU is currently building a *-oal file. The next call to sqlite3rbu_step() +** may either add further data to the *-oal file, or compute data that will +** be added by a subsequent call. +** +** SQLITE_RBU_STATE_MOVE: +** RBU has finished building the *-oal file. The next call to sqlite3rbu_step() +** will move the *-oal file to the equivalent *-wal path. If the current +** operation is an RBU update, then the updated version of the database +** file will become visible to ordinary SQLite clients following the next +** call to sqlite3rbu_step(). +** +** SQLITE_RBU_STATE_CHECKPOINT: +** RBU is currently performing an incremental checkpoint. The next call to +** sqlite3rbu_step() will copy a page of data from the *-wal file into +** the target database file. +** +** SQLITE_RBU_STATE_DONE: +** The RBU operation has finished. Any subsequent calls to sqlite3rbu_step() +** will immediately return SQLITE_DONE. +** +** SQLITE_RBU_STATE_ERROR: +** An error has occurred. Any subsequent calls to sqlite3rbu_step() will +** immediately return the SQLite error code associated with the error. +*/ +#define SQLITE_RBU_STATE_OAL 1 +#define SQLITE_RBU_STATE_MOVE 2 +#define SQLITE_RBU_STATE_CHECKPOINT 3 +#define SQLITE_RBU_STATE_DONE 4 +#define SQLITE_RBU_STATE_ERROR 5 + +SQLITE_API int SQLITE_STDCALL sqlite3rbu_state(sqlite3rbu *pRbu); + /* ** Create an RBU VFS named zName that accesses the underlying file-system ** via existing VFS zParent. Or, if the zParent parameter is passed NULL, @@ -164874,12 +165844,14 @@ static int rbuObjIterFirst(sqlite3rbu *p, RbuObjIter *pIter){ int rc; memset(pIter, 0, sizeof(RbuObjIter)); - rc = prepareAndCollectError(p->dbRbu, &pIter->pTblIter, &p->zErrmsg, + rc = prepareFreeAndCollectError(p->dbRbu, &pIter->pTblIter, &p->zErrmsg, + sqlite3_mprintf( "SELECT rbu_target_name(name, type='view') AS target, name " "FROM sqlite_master " "WHERE type IN ('table', 'view') AND target IS NOT NULL " + " %s " "ORDER BY name" - ); + , rbuIsVacuum(p) ? "AND rootpage!=0 AND rootpage IS NOT NULL" : "")); if( rc==SQLITE_OK ){ rc = prepareAndCollectError(p->dbMain, &pIter->pIdxIter, &p->zErrmsg, @@ -166458,9 +167430,9 @@ static void rbuFileSuffix3(const char *zBase, char *z){ #endif { int i, sz; - sz = sqlite3Strlen30(z); + sz = (int)strlen(z)&0xffffff; for(i=sz-1; i>0 && z[i]!='/' && z[i]!='.'; i--){} - if( z[i]=='.' && ALWAYS(sz>i+4) ) memmove(&z[i+1], &z[sz-3], 4); + if( z[i]=='.' && sz>i+4 ) memmove(&z[i+1], &z[sz-3], 4); } #endif } @@ -167506,30 +168478,7 @@ static sqlite3rbu *openRbuHandle( if( p->rc==SQLITE_OK ){ if( p->eStage==RBU_STAGE_OAL ){ sqlite3 *db = p->dbMain; - - if( pState->eStage==0 && rbuIsVacuum(p) ){ - rbuCopyPragma(p, "page_size"); - rbuCopyPragma(p, "auto_vacuum"); - } - - /* Open transactions both databases. The *-oal file is opened or - ** created at this point. */ - if( p->rc==SQLITE_OK ){ - p->rc = sqlite3_exec(db, "BEGIN IMMEDIATE", 0, 0, &p->zErrmsg); - } - if( p->rc==SQLITE_OK ){ - p->rc = sqlite3_exec(p->dbRbu, "BEGIN", 0, 0, &p->zErrmsg); - } - - /* Check if the main database is a zipvfs db. If it is, set the upper - ** level pager to use "journal_mode=off". This prevents it from - ** generating a large journal using a temp file. */ - if( p->rc==SQLITE_OK ){ - int frc = sqlite3_file_control(db, "main", SQLITE_FCNTL_ZIPVFS, 0); - if( frc==SQLITE_OK ){ - p->rc = sqlite3_exec(db, "PRAGMA journal_mode=off",0,0,&p->zErrmsg); - } - } + p->rc = sqlite3_exec(p->dbRbu, "BEGIN", 0, 0, &p->zErrmsg); /* Point the object iterator at the first object */ if( p->rc==SQLITE_OK ){ @@ -167540,12 +168489,34 @@ static sqlite3rbu *openRbuHandle( ** update finished. */ if( p->rc==SQLITE_OK && p->objiter.zTbl==0 ){ p->rc = SQLITE_DONE; - } + p->eStage = RBU_STAGE_DONE; + }else{ + if( p->rc==SQLITE_OK && pState->eStage==0 && rbuIsVacuum(p) ){ + rbuCopyPragma(p, "page_size"); + rbuCopyPragma(p, "auto_vacuum"); + } - if( p->rc==SQLITE_OK ){ - rbuSetupOal(p, pState); - } + /* Open transactions both databases. The *-oal file is opened or + ** created at this point. */ + if( p->rc==SQLITE_OK ){ + p->rc = sqlite3_exec(db, "BEGIN IMMEDIATE", 0, 0, &p->zErrmsg); + } + /* Check if the main database is a zipvfs db. If it is, set the upper + ** level pager to use "journal_mode=off". This prevents it from + ** generating a large journal using a temp file. */ + if( p->rc==SQLITE_OK ){ + int frc = sqlite3_file_control(db, "main", SQLITE_FCNTL_ZIPVFS, 0); + if( frc==SQLITE_OK ){ + p->rc = sqlite3_exec( + db, "PRAGMA journal_mode=off",0,0,&p->zErrmsg); + } + } + + if( p->rc==SQLITE_OK ){ + rbuSetupOal(p, pState); + } + } }else if( p->eStage==RBU_STAGE_MOVE ){ /* no-op */ }else if( p->eStage==RBU_STAGE_CKPT ){ @@ -167712,9 +168683,39 @@ SQLITE_API void SQLITE_STDCALL sqlite3rbu_bp_progress(sqlite3rbu *p, int *pnOne, } } +/* +** Return the current state of the RBU vacuum or update operation. +*/ +SQLITE_API int SQLITE_STDCALL sqlite3rbu_state(sqlite3rbu *p){ + int aRes[] = { + 0, SQLITE_RBU_STATE_OAL, SQLITE_RBU_STATE_MOVE, + 0, SQLITE_RBU_STATE_CHECKPOINT, SQLITE_RBU_STATE_DONE + }; + + assert( RBU_STAGE_OAL==1 ); + assert( RBU_STAGE_MOVE==2 ); + assert( RBU_STAGE_CKPT==4 ); + assert( RBU_STAGE_DONE==5 ); + assert( aRes[RBU_STAGE_OAL]==SQLITE_RBU_STATE_OAL ); + assert( aRes[RBU_STAGE_MOVE]==SQLITE_RBU_STATE_MOVE ); + assert( aRes[RBU_STAGE_CKPT]==SQLITE_RBU_STATE_CHECKPOINT ); + assert( aRes[RBU_STAGE_DONE]==SQLITE_RBU_STATE_DONE ); + + if( p->rc!=SQLITE_OK && p->rc!=SQLITE_DONE ){ + return SQLITE_RBU_STATE_ERROR; + }else{ + assert( p->rc!=SQLITE_DONE || p->eStage==RBU_STAGE_DONE ); + assert( p->eStage==RBU_STAGE_OAL + || p->eStage==RBU_STAGE_MOVE + || p->eStage==RBU_STAGE_CKPT + || p->eStage==RBU_STAGE_DONE + ); + return aRes[p->eStage]; + } +} + SQLITE_API int SQLITE_STDCALL sqlite3rbu_savestate(sqlite3rbu *p){ int rc = p->rc; - if( rc==SQLITE_DONE ) return SQLITE_OK; assert( p->eStage>=RBU_STAGE_OAL && p->eStage<=RBU_STAGE_DONE ); @@ -168696,10 +169697,10 @@ SQLITE_API int SQLITE_STDCALL sqlite3rbu_create_vfs(const char *zName, const cha */ #define VTAB_SCHEMA \ "CREATE TABLE xx( " \ - " name STRING, /* Name of table or index */" \ - " path INTEGER, /* Path to page from root */" \ + " name TEXT, /* Name of table or index */" \ + " path TEXT, /* Path to page from root */" \ " pageno INTEGER, /* Page number */" \ - " pagetype STRING, /* 'internal', 'leaf' or 'overflow' */" \ + " pagetype TEXT, /* 'internal', 'leaf' or 'overflow' */" \ " ncell INTEGER, /* Cells on page (0 for overflow) */" \ " payload INTEGER, /* Bytes of payload on this page */" \ " unused INTEGER, /* Bytes of unused space on this page */" \ @@ -175198,6 +176199,26 @@ static void jsonTest1Func( ** Scalar SQL function implementations ****************************************************************************/ +/* +** Implementation of the json_QUOTE(VALUE) function. Return a JSON value +** corresponding to the SQL value input. Mostly this means putting +** double-quotes around strings and returning the unquoted string "null" +** when given a NULL input. +*/ +static void jsonQuoteFunc( + sqlite3_context *ctx, + int argc, + sqlite3_value **argv +){ + JsonString jx; + UNUSED_PARAM(argc); + + jsonInit(&jx, ctx); + jsonAppendValue(&jx, argv[0]); + jsonResult(&jx); + sqlite3_result_subtype(ctx, JSON_SUBTYPE); +} + /* ** Implementation of the json_array(VALUE,...) function. Return a JSON ** array that contains all values given in arguments. Or if any argument @@ -176111,6 +177132,7 @@ SQLITE_PRIVATE int sqlite3Json1Init(sqlite3 *db){ { "json_extract", -1, 0, jsonExtractFunc }, { "json_insert", -1, 0, jsonSetFunc }, { "json_object", -1, 0, jsonObjectFunc }, + { "json_quote", 1, 0, jsonQuoteFunc }, { "json_remove", -1, 0, jsonRemoveFunc }, { "json_replace", -1, 0, jsonReplaceFunc }, { "json_set", -1, 1, jsonSetFunc }, @@ -176511,7 +177533,7 @@ struct Fts5ExtensionApi { ** behaviour. The structure methods are expected to function as follows: ** ** xCreate: -** This function is used to allocate and inititalize a tokenizer instance. +** This function is used to allocate and initialize a tokenizer instance. ** A tokenizer instance is required to actually tokenize text. ** ** The first argument passed to this function is a copy of the (void*) @@ -176771,7 +177793,6 @@ struct fts5_api { #endif /* _FTS5_H */ - /* ** 2014 May 31 ** @@ -177460,7 +178481,6 @@ static int sqlite3Fts5ExprPopulatePoslists( Fts5Config*, Fts5Expr*, Fts5PoslistPopulator*, int, const char*, int ); static void sqlite3Fts5ExprCheckPoslists(Fts5Expr*, i64); -static void sqlite3Fts5ExprClearEof(Fts5Expr*); static int sqlite3Fts5ExprClonePhrase(Fts5Expr*, int, Fts5Expr**); @@ -177876,9 +178896,9 @@ typedef struct fts5yyStackEntry fts5yyStackEntry; /* The state of the parser is completely contained in an instance of ** the following structure */ struct fts5yyParser { - int fts5yyidx; /* Index of top element in stack */ + fts5yyStackEntry *fts5yytos; /* Pointer to top element of the stack */ #ifdef fts5YYTRACKMAXSTACKDEPTH - int fts5yyidxMax; /* Maximum value of fts5yyidx */ + int fts5yyhwm; /* High-water mark of the stack */ #endif #ifndef fts5YYNOERRORRECOVERY int fts5yyerrcnt; /* Shifts left before out of the error */ @@ -177887,6 +178907,7 @@ struct fts5yyParser { #if fts5YYSTACKDEPTH<=0 int fts5yystksz; /* Current side of the stack */ fts5yyStackEntry *fts5yystack; /* The parser's stack */ + fts5yyStackEntry fts5yystk0; /* First stack entry */ #else fts5yyStackEntry fts5yystack[fts5YYSTACKDEPTH]; /* The parser's stack */ #endif @@ -177973,24 +178994,34 @@ static const char *const fts5yyRuleName[] = { #if fts5YYSTACKDEPTH<=0 /* -** Try to increase the size of the parser stack. +** Try to increase the size of the parser stack. Return the number +** of errors. Return 0 on success. */ -static void fts5yyGrowStack(fts5yyParser *p){ +static int fts5yyGrowStack(fts5yyParser *p){ int newSize; + int idx; fts5yyStackEntry *pNew; newSize = p->fts5yystksz*2 + 100; - pNew = realloc(p->fts5yystack, newSize*sizeof(pNew[0])); + idx = p->fts5yytos ? (int)(p->fts5yytos - p->fts5yystack) : 0; + if( p->fts5yystack==&p->fts5yystk0 ){ + pNew = malloc(newSize*sizeof(pNew[0])); + if( pNew ) pNew[0] = p->fts5yystk0; + }else{ + pNew = realloc(p->fts5yystack, newSize*sizeof(pNew[0])); + } if( pNew ){ p->fts5yystack = pNew; - p->fts5yystksz = newSize; + p->fts5yytos = &p->fts5yystack[idx]; #ifndef NDEBUG if( fts5yyTraceFILE ){ - fprintf(fts5yyTraceFILE,"%sStack grows to %d entries!\n", - fts5yyTracePrompt, p->fts5yystksz); + fprintf(fts5yyTraceFILE,"%sStack grows from %d to %d entries.\n", + fts5yyTracePrompt, p->fts5yystksz, newSize); } #endif + p->fts5yystksz = newSize; } + return pNew==0; } #endif @@ -178019,15 +179050,24 @@ static void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(fts5YYMALLOCARGTYPE)){ fts5yyParser *pParser; pParser = (fts5yyParser*)(*mallocProc)( (fts5YYMALLOCARGTYPE)sizeof(fts5yyParser) ); if( pParser ){ - pParser->fts5yyidx = -1; #ifdef fts5YYTRACKMAXSTACKDEPTH - pParser->fts5yyidxMax = 0; + pParser->fts5yyhwm = 0; #endif #if fts5YYSTACKDEPTH<=0 + pParser->fts5yytos = NULL; pParser->fts5yystack = NULL; pParser->fts5yystksz = 0; - fts5yyGrowStack(pParser); + if( fts5yyGrowStack(pParser) ){ + pParser->fts5yystack = &pParser->fts5yystk0; + pParser->fts5yystksz = 1; + } #endif +#ifndef fts5YYNOERRORRECOVERY + pParser->fts5yyerrcnt = -1; +#endif + pParser->fts5yytos = pParser->fts5yystack; + pParser->fts5yystack[0].stateno = 0; + pParser->fts5yystack[0].major = 0; } return pParser; } @@ -178099,8 +179139,9 @@ static void fts5yy_destructor( */ static void fts5yy_pop_parser_stack(fts5yyParser *pParser){ fts5yyStackEntry *fts5yytos; - assert( pParser->fts5yyidx>=0 ); - fts5yytos = &pParser->fts5yystack[pParser->fts5yyidx--]; + assert( pParser->fts5yytos!=0 ); + assert( pParser->fts5yytos > pParser->fts5yystack ); + fts5yytos = pParser->fts5yytos--; #ifndef NDEBUG if( fts5yyTraceFILE ){ fprintf(fts5yyTraceFILE,"%sPopping %s\n", @@ -178127,9 +179168,9 @@ static void sqlite3Fts5ParserFree( #ifndef fts5YYPARSEFREENEVERNULL if( pParser==0 ) return; #endif - while( pParser->fts5yyidx>=0 ) fts5yy_pop_parser_stack(pParser); + while( pParser->fts5yytos>pParser->fts5yystack ) fts5yy_pop_parser_stack(pParser); #if fts5YYSTACKDEPTH<=0 - free(pParser->fts5yystack); + if( pParser->fts5yystack!=&pParser->fts5yystk0 ) free(pParser->fts5yystack); #endif (*freeProc)((void*)pParser); } @@ -178140,7 +179181,7 @@ static void sqlite3Fts5ParserFree( #ifdef fts5YYTRACKMAXSTACKDEPTH static int sqlite3Fts5ParserStackPeak(void *p){ fts5yyParser *pParser = (fts5yyParser*)p; - return pParser->fts5yyidxMax; + return pParser->fts5yyhwm; } #endif @@ -178153,7 +179194,7 @@ static unsigned int fts5yy_find_shift_action( fts5YYCODETYPE iLookAhead /* The look-ahead token */ ){ int i; - int stateno = pParser->fts5yystack[pParser->fts5yyidx].stateno; + int stateno = pParser->fts5yytos->stateno; if( stateno>=fts5YY_MIN_REDUCE ) return stateno; assert( stateno <= fts5YY_SHIFT_COUNT ); @@ -178246,13 +179287,13 @@ static int fts5yy_find_reduce_action( */ static void fts5yyStackOverflow(fts5yyParser *fts5yypParser){ sqlite3Fts5ParserARG_FETCH; - fts5yypParser->fts5yyidx--; + fts5yypParser->fts5yytos--; #ifndef NDEBUG if( fts5yyTraceFILE ){ fprintf(fts5yyTraceFILE,"%sStack Overflow!\n",fts5yyTracePrompt); } #endif - while( fts5yypParser->fts5yyidx>=0 ) fts5yy_pop_parser_stack(fts5yypParser); + while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser); /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ @@ -178270,11 +179311,11 @@ static void fts5yyTraceShift(fts5yyParser *fts5yypParser, int fts5yyNewState){ if( fts5yyTraceFILE ){ if( fts5yyNewStatefts5yystack[fts5yypParser->fts5yyidx].major], + fts5yyTracePrompt,fts5yyTokenName[fts5yypParser->fts5yytos->major], fts5yyNewState); }else{ fprintf(fts5yyTraceFILE,"%sShift '%s'\n", - fts5yyTracePrompt,fts5yyTokenName[fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx].major]); + fts5yyTracePrompt,fts5yyTokenName[fts5yypParser->fts5yytos->major]); } } } @@ -178292,27 +179333,30 @@ static void fts5yy_shift( sqlite3Fts5ParserFTS5TOKENTYPE fts5yyMinor /* The minor token to shift in */ ){ fts5yyStackEntry *fts5yytos; - fts5yypParser->fts5yyidx++; + fts5yypParser->fts5yytos++; #ifdef fts5YYTRACKMAXSTACKDEPTH - if( fts5yypParser->fts5yyidx>fts5yypParser->fts5yyidxMax ){ - fts5yypParser->fts5yyidxMax = fts5yypParser->fts5yyidx; + if( (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)>fts5yypParser->fts5yyhwm ){ + fts5yypParser->fts5yyhwm++; + assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack) ); } #endif #if fts5YYSTACKDEPTH>0 - if( fts5yypParser->fts5yyidx>=fts5YYSTACKDEPTH ){ + if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5YYSTACKDEPTH] ){ fts5yyStackOverflow(fts5yypParser); return; } #else - if( fts5yypParser->fts5yyidx>=fts5yypParser->fts5yystksz ){ - fts5yyGrowStack(fts5yypParser); - if( fts5yypParser->fts5yyidx>=fts5yypParser->fts5yystksz ){ + if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz] ){ + if( fts5yyGrowStack(fts5yypParser) ){ fts5yyStackOverflow(fts5yypParser); return; } } #endif - fts5yytos = &fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx]; + if( fts5yyNewState > fts5YY_MAX_SHIFT ){ + fts5yyNewState += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; + } + fts5yytos = fts5yypParser->fts5yytos; fts5yytos->stateno = (fts5YYACTIONTYPE)fts5yyNewState; fts5yytos->major = (fts5YYCODETYPE)fts5yyMajor; fts5yytos->minor.fts5yy0 = fts5yyMinor; @@ -178367,7 +179411,7 @@ static void fts5yy_reduce( fts5yyStackEntry *fts5yymsp; /* The top of the parser's stack */ int fts5yysize; /* Amount to pop the stack */ sqlite3Fts5ParserARG_FETCH; - fts5yymsp = &fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx]; + fts5yymsp = fts5yypParser->fts5yytos; #ifndef NDEBUG if( fts5yyTraceFILE && fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) ){ fts5yysize = fts5yyRuleInfo[fts5yyruleno].nrhs; @@ -178381,22 +179425,23 @@ static void fts5yy_reduce( ** enough on the stack to push the LHS value */ if( fts5yyRuleInfo[fts5yyruleno].nrhs==0 ){ #ifdef fts5YYTRACKMAXSTACKDEPTH - if( fts5yypParser->fts5yyidx>fts5yypParser->fts5yyidxMax ){ - fts5yypParser->fts5yyidxMax = fts5yypParser->fts5yyidx; + if( (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)>fts5yypParser->fts5yyhwm ){ + fts5yypParser->fts5yyhwm++; + assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)); } #endif #if fts5YYSTACKDEPTH>0 - if( fts5yypParser->fts5yyidx>=fts5YYSTACKDEPTH-1 ){ + if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5YYSTACKDEPTH-1] ){ fts5yyStackOverflow(fts5yypParser); return; } #else - if( fts5yypParser->fts5yyidx>=fts5yypParser->fts5yystksz-1 ){ - fts5yyGrowStack(fts5yypParser); - if( fts5yypParser->fts5yyidx>=fts5yypParser->fts5yystksz-1 ){ + if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz-1] ){ + if( fts5yyGrowStack(fts5yypParser) ){ fts5yyStackOverflow(fts5yypParser); return; } + fts5yymsp = fts5yypParser->fts5yytos; } #endif } @@ -178537,15 +179582,17 @@ static void fts5yy_reduce( fts5yysize = fts5yyRuleInfo[fts5yyruleno].nrhs; fts5yyact = fts5yy_find_reduce_action(fts5yymsp[-fts5yysize].stateno,(fts5YYCODETYPE)fts5yygoto); if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){ - if( fts5yyact>fts5YY_MAX_SHIFT ) fts5yyact += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; - fts5yypParser->fts5yyidx -= fts5yysize - 1; + if( fts5yyact>fts5YY_MAX_SHIFT ){ + fts5yyact += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; + } fts5yymsp -= fts5yysize-1; + fts5yypParser->fts5yytos = fts5yymsp; fts5yymsp->stateno = (fts5YYACTIONTYPE)fts5yyact; fts5yymsp->major = (fts5YYCODETYPE)fts5yygoto; fts5yyTraceShift(fts5yypParser, fts5yyact); }else{ assert( fts5yyact == fts5YY_ACCEPT_ACTION ); - fts5yypParser->fts5yyidx -= fts5yysize; + fts5yypParser->fts5yytos -= fts5yysize; fts5yy_accept(fts5yypParser); } } @@ -178563,7 +179610,7 @@ static void fts5yy_parse_failed( fprintf(fts5yyTraceFILE,"%sFail!\n",fts5yyTracePrompt); } #endif - while( fts5yypParser->fts5yyidx>=0 ) fts5yy_pop_parser_stack(fts5yypParser); + while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser); /* Here code is inserted which will be executed whenever the ** parser fails */ /************ Begin %parse_failure code ***************************************/ @@ -178604,7 +179651,10 @@ static void fts5yy_accept( fprintf(fts5yyTraceFILE,"%sAccept!\n",fts5yyTracePrompt); } #endif - while( fts5yypParser->fts5yyidx>=0 ) fts5yy_pop_parser_stack(fts5yypParser); +#ifndef fts5YYNOERRORRECOVERY + fts5yypParser->fts5yyerrcnt = -1; +#endif + assert( fts5yypParser->fts5yytos==fts5yypParser->fts5yystack ); /* Here code is inserted which will be executed whenever the ** parser accepts */ /*********** Begin %parse_accept code *****************************************/ @@ -178647,28 +179697,8 @@ static void sqlite3Fts5Parser( #endif fts5yyParser *fts5yypParser; /* The parser */ - /* (re)initialize the parser, if necessary */ fts5yypParser = (fts5yyParser*)fts5yyp; - if( fts5yypParser->fts5yyidx<0 ){ -#if fts5YYSTACKDEPTH<=0 - if( fts5yypParser->fts5yystksz <=0 ){ - fts5yyStackOverflow(fts5yypParser); - return; - } -#endif - fts5yypParser->fts5yyidx = 0; -#ifndef fts5YYNOERRORRECOVERY - fts5yypParser->fts5yyerrcnt = -1; -#endif - fts5yypParser->fts5yystack[0].stateno = 0; - fts5yypParser->fts5yystack[0].major = 0; -#ifndef NDEBUG - if( fts5yyTraceFILE ){ - fprintf(fts5yyTraceFILE,"%sInitialize. Empty stack. State 0\n", - fts5yyTracePrompt); - } -#endif - } + assert( fts5yypParser->fts5yytos!=0 ); #if !defined(fts5YYERRORSYMBOL) && !defined(fts5YYNOERRORRECOVERY) fts5yyendofinput = (fts5yymajor==0); #endif @@ -178683,7 +179713,6 @@ static void sqlite3Fts5Parser( do{ fts5yyact = fts5yy_find_shift_action(fts5yypParser,(fts5YYCODETYPE)fts5yymajor); if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){ - if( fts5yyact > fts5YY_MAX_SHIFT ) fts5yyact += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; fts5yy_shift(fts5yypParser,fts5yyact,fts5yymajor,fts5yyminor); #ifndef fts5YYNOERRORRECOVERY fts5yypParser->fts5yyerrcnt--; @@ -178725,7 +179754,7 @@ static void sqlite3Fts5Parser( if( fts5yypParser->fts5yyerrcnt<0 ){ fts5yy_syntax_error(fts5yypParser,fts5yymajor,fts5yyminor); } - fts5yymx = fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx].major; + fts5yymx = fts5yypParser->fts5yytos->major; if( fts5yymx==fts5YYERRORSYMBOL || fts5yyerrorhit ){ #ifndef NDEBUG if( fts5yyTraceFILE ){ @@ -178736,18 +179765,20 @@ static void sqlite3Fts5Parser( fts5yy_destructor(fts5yypParser, (fts5YYCODETYPE)fts5yymajor, &fts5yyminorunion); fts5yymajor = fts5YYNOCODE; }else{ - while( - fts5yypParser->fts5yyidx >= 0 && - fts5yymx != fts5YYERRORSYMBOL && - (fts5yyact = fts5yy_find_reduce_action( - fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx].stateno, + while( fts5yypParser->fts5yytos >= &fts5yypParser->fts5yystack + && fts5yymx != fts5YYERRORSYMBOL + && (fts5yyact = fts5yy_find_reduce_action( + fts5yypParser->fts5yytos->stateno, fts5YYERRORSYMBOL)) >= fts5YY_MIN_REDUCE ){ fts5yy_pop_parser_stack(fts5yypParser); } - if( fts5yypParser->fts5yyidx < 0 || fts5yymajor==0 ){ + if( fts5yypParser->fts5yytos < fts5yypParser->fts5yystack || fts5yymajor==0 ){ fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion); fts5yy_parse_failed(fts5yypParser); +#ifndef fts5YYNOERRORRECOVERY + fts5yypParser->fts5yyerrcnt = -1; +#endif fts5yymajor = fts5YYNOCODE; }else if( fts5yymx!=fts5YYERRORSYMBOL ){ fts5yy_shift(fts5yypParser,fts5yyact,fts5YYERRORSYMBOL,fts5yyminor); @@ -178784,18 +179815,23 @@ static void sqlite3Fts5Parser( fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion); if( fts5yyendofinput ){ fts5yy_parse_failed(fts5yypParser); +#ifndef fts5YYNOERRORRECOVERY + fts5yypParser->fts5yyerrcnt = -1; +#endif } fts5yymajor = fts5YYNOCODE; #endif } - }while( fts5yymajor!=fts5YYNOCODE && fts5yypParser->fts5yyidx>=0 ); + }while( fts5yymajor!=fts5YYNOCODE && fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ); #ifndef NDEBUG if( fts5yyTraceFILE ){ - int i; + fts5yyStackEntry *i; + char cDiv = '['; fprintf(fts5yyTraceFILE,"%sReturn. Stack=",fts5yyTracePrompt); - for(i=1; i<=fts5yypParser->fts5yyidx; i++) - fprintf(fts5yyTraceFILE,"%c%s", i==1 ? '[' : ' ', - fts5yyTokenName[fts5yypParser->fts5yystack[i].major]); + for(i=&fts5yypParser->fts5yystack[1]; i<=fts5yypParser->fts5yytos; i++){ + fprintf(fts5yyTraceFILE,"%c%s", cDiv, fts5yyTokenName[i->major]); + cDiv = ' '; + } fprintf(fts5yyTraceFILE,"]\n"); } #endif @@ -183339,17 +184375,6 @@ static void sqlite3Fts5ExprCheckPoslists(Fts5Expr *pExpr, i64 iRowid){ fts5ExprCheckPoslists(pExpr->pRoot, iRowid); } -static void fts5ExprClearEof(Fts5ExprNode *pNode){ - int i; - for(i=0; inChild; i++){ - fts5ExprClearEof(pNode->apChild[i]); - } - pNode->bEof = 0; -} -static void sqlite3Fts5ExprClearEof(Fts5Expr *pExpr){ - fts5ExprClearEof(pExpr->pRoot); -} - /* ** This function is only called for detail=columns tables. */ @@ -191567,7 +192592,6 @@ static int fts5FilterMethod( pCsr->ePlan = FTS5_PLAN_SOURCE; pCsr->pExpr = pTab->pSortCsr->pExpr; rc = fts5CursorFirst(pTab, pCsr, bDesc); - sqlite3Fts5ExprClearEof(pCsr->pExpr); }else if( pMatch ){ const char *zExpr = (const char*)sqlite3_value_text(apVal[0]); if( zExpr==0 ) zExpr = ""; @@ -192996,7 +194020,7 @@ static void fts5SourceIdFunc( ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); - sqlite3_result_text(pCtx, "fts5: 2016-05-18 10:57:30 fc49f556e48970561d7ab6a2f24fdd7d9eb81ff2", -1, SQLITE_TRANSIENT); + sqlite3_result_text(pCtx, "fts5: 2016-08-11 18:53:32 a12d8059770df4bca59e321c266410344242bf7b", -1, SQLITE_TRANSIENT); } static int fts5Init(sqlite3 *db){ @@ -193361,7 +194385,11 @@ static int sqlite3Fts5CreateTable( char *zErr = 0; rc = fts5ExecPrintf(pConfig->db, &zErr, "CREATE TABLE %Q.'%q_%q'(%s)%s", - pConfig->zDb, pConfig->zName, zPost, zDefn, bWithout?" WITHOUT ROWID":"" + pConfig->zDb, pConfig->zName, zPost, zDefn, +#ifndef SQLITE_FTS5_NO_WITHOUT_ROWID + bWithout?" WITHOUT ROWID": +#endif + "" ); if( zErr ){ *pzErr = sqlite3_mprintf( diff --git a/Data/SQLite/src/sqlite3.h b/Data/SQLite/src/sqlite3.h index 313b5ec3c..3b6b07cf8 100644 --- a/Data/SQLite/src/sqlite3.h +++ b/Data/SQLite/src/sqlite3.h @@ -30,8 +30,8 @@ ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. */ -#ifndef _SQLITE3_H_ -#define _SQLITE3_H_ +#ifndef SQLITE3_H +#define SQLITE3_H #include /* Needed for the definition of va_list */ /* @@ -54,8 +54,17 @@ extern "C" { #ifndef SQLITE_CDECL # define SQLITE_CDECL #endif +#ifndef SQLITE_APICALL +# define SQLITE_APICALL +#endif #ifndef SQLITE_STDCALL -# define SQLITE_STDCALL +# define SQLITE_STDCALL SQLITE_APICALL +#endif +#ifndef SQLITE_CALLBACK +# define SQLITE_CALLBACK +#endif +#ifndef SQLITE_SYSAPI +# define SQLITE_SYSAPI #endif /* @@ -111,9 +120,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.13.0" -#define SQLITE_VERSION_NUMBER 3013000 -#define SQLITE_SOURCE_ID "2016-05-18 10:57:30 fc49f556e48970561d7ab6a2f24fdd7d9eb81ff2" +#define SQLITE_VERSION "3.14.1" +#define SQLITE_VERSION_NUMBER 3014001 +#define SQLITE_SOURCE_ID "2016-08-11 18:53:32 a12d8059770df4bca59e321c266410344242bf7b" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -506,6 +515,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_exec( #define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8)) #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8)) #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8)) +#define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8)) /* ** CAPI3REF: Flags For File Open Operations @@ -1035,6 +1045,16 @@ struct sqlite3_io_methods { */ typedef struct sqlite3_mutex sqlite3_mutex; +/* +** CAPI3REF: Loadable Extension Thunk +** +** A pointer to the opaque sqlite3_api_routines structure is passed as +** the third parameter to entry points of [loadable extensions]. This +** structure must be typedefed in order to work around compiler warnings +** on some platforms. +*/ +typedef struct sqlite3_api_routines sqlite3_api_routines; + /* ** CAPI3REF: OS Interface Object ** @@ -1939,7 +1959,7 @@ struct sqlite3_mem_methods { ** C-API [sqlite3_load_extension()] and the SQL function [load_extension()]. ** There should be two additional arguments. ** When the first argument to this interface is 1, then only the C-API is -** enabled and the SQL function remains disabled. If the first argment to +** enabled and the SQL function remains disabled. If the first argument to ** this interface is 0, then both the C-API and the SQL function are disabled. ** If the first argument is -1, then no changes are made to state of either the ** C-API or the SQL function. @@ -2232,7 +2252,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_complete16(const void *sql); ** A busy handler must not close the database connection ** or [prepared statement] that invoked the busy handler. */ -SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*); +SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*); /* ** CAPI3REF: Set A Busy Timeout @@ -2754,6 +2774,9 @@ SQLITE_API int SQLITE_STDCALL sqlite3_set_authorizer( ** CAPI3REF: Tracing And Profiling Functions ** METHOD: sqlite3 ** +** These routines are deprecated. Use the [sqlite3_trace_v2()] interface +** instead of the routines described here. +** ** These routines register callback functions that can be used for ** tracing and profiling the execution of SQL statements. ** @@ -2779,10 +2802,104 @@ SQLITE_API int SQLITE_STDCALL sqlite3_set_authorizer( ** sqlite3_profile() function is considered experimental and is ** subject to change in future versions of SQLite. */ -SQLITE_API void *SQLITE_STDCALL sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); -SQLITE_API SQLITE_EXPERIMENTAL void *SQLITE_STDCALL sqlite3_profile(sqlite3*, +SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_trace(sqlite3*, + void(*xTrace)(void*,const char*), void*); +SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_profile(sqlite3*, void(*xProfile)(void*,const char*,sqlite3_uint64), void*); +/* +** CAPI3REF: SQL Trace Event Codes +** KEYWORDS: SQLITE_TRACE +** +** These constants identify classes of events that can be monitored +** using the [sqlite3_trace_v2()] tracing logic. The third argument +** to [sqlite3_trace_v2()] is an OR-ed combination of one or more of +** the following constants. ^The first argument to the trace callback +** is one of the following constants. +** +** New tracing constants may be added in future releases. +** +** ^A trace callback has four arguments: xCallback(T,C,P,X). +** ^The T argument is one of the integer type codes above. +** ^The C argument is a copy of the context pointer passed in as the +** fourth argument to [sqlite3_trace_v2()]. +** The P and X arguments are pointers whose meanings depend on T. +** +**
    +** [[SQLITE_TRACE_STMT]]
    SQLITE_TRACE_STMT
    +**
    ^An SQLITE_TRACE_STMT callback is invoked when a prepared statement +** first begins running and possibly at other times during the +** execution of the prepared statement, such as at the start of each +** trigger subprogram. ^The P argument is a pointer to the +** [prepared statement]. ^The X argument is a pointer to a string which +** is the unexpanded SQL text of the prepared statement or an SQL comment +** that indicates the invocation of a trigger. ^The callback can compute +** the same text that would have been returned by the legacy [sqlite3_trace()] +** interface by using the X argument when X begins with "--" and invoking +** [sqlite3_expanded_sql(P)] otherwise. +** +** [[SQLITE_TRACE_PROFILE]]
    SQLITE_TRACE_PROFILE
    +**
    ^An SQLITE_TRACE_PROFILE callback provides approximately the same +** information as is provided by the [sqlite3_profile()] callback. +** ^The P argument is a pointer to the [prepared statement] and the +** X argument points to a 64-bit integer which is the estimated of +** the number of nanosecond that the prepared statement took to run. +** ^The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes. +** +** [[SQLITE_TRACE_ROW]]
    SQLITE_TRACE_ROW
    +**
    ^An SQLITE_TRACE_ROW callback is invoked whenever a prepared +** statement generates a single row of result. +** ^The P argument is a pointer to the [prepared statement] and the +** X argument is unused. +** +** [[SQLITE_TRACE_CLOSE]]
    SQLITE_TRACE_CLOSE
    +**
    ^An SQLITE_TRACE_CLOSE callback is invoked when a database +** connection closes. +** ^The P argument is a pointer to the [database connection] object +** and the X argument is unused. +**
    +*/ +#define SQLITE_TRACE_STMT 0x01 +#define SQLITE_TRACE_PROFILE 0x02 +#define SQLITE_TRACE_ROW 0x04 +#define SQLITE_TRACE_CLOSE 0x08 + +/* +** CAPI3REF: SQL Trace Hook +** METHOD: sqlite3 +** +** ^The sqlite3_trace_v2(D,M,X,P) interface registers a trace callback +** function X against [database connection] D, using property mask M +** and context pointer P. ^If the X callback is +** NULL or if the M mask is zero, then tracing is disabled. The +** M argument should be the bitwise OR-ed combination of +** zero or more [SQLITE_TRACE] constants. +** +** ^Each call to either sqlite3_trace() or sqlite3_trace_v2() overrides +** (cancels) any prior calls to sqlite3_trace() or sqlite3_trace_v2(). +** +** ^The X callback is invoked whenever any of the events identified by +** mask M occur. ^The integer return value from the callback is currently +** ignored, though this may change in future releases. Callback +** implementations should return zero to ensure future compatibility. +** +** ^A trace callback is invoked with four arguments: callback(T,C,P,X). +** ^The T argument is one of the [SQLITE_TRACE] +** constants to indicate why the callback was invoked. +** ^The C argument is a copy of the context pointer. +** The P and X arguments are pointers whose meanings depend on T. +** +** The sqlite3_trace_v2() interface is intended to replace the legacy +** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which +** are deprecated. +*/ +SQLITE_API int SQLITE_STDCALL sqlite3_trace_v2( + sqlite3*, + unsigned uMask, + int(*xCallback)(unsigned,void*,void*,void*), + void *pCtx +); + /* ** CAPI3REF: Query Progress Callbacks ** METHOD: sqlite3 @@ -3401,11 +3518,35 @@ SQLITE_API int SQLITE_STDCALL sqlite3_prepare16_v2( ** CAPI3REF: Retrieving Statement SQL ** METHOD: sqlite3_stmt ** -** ^This interface can be used to retrieve a saved copy of the original -** SQL text used to create a [prepared statement] if that statement was -** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. +** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8 +** SQL text used to create [prepared statement] P if P was +** created by either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. +** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8 +** string containing the SQL text of prepared statement P with +** [bound parameters] expanded. +** +** ^(For example, if a prepared statement is created using the SQL +** text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345 +** and parameter :xyz is unbound, then sqlite3_sql() will return +** the original string, "SELECT $abc,:xyz" but sqlite3_expanded_sql() +** will return "SELECT 2345,NULL".)^ +** +** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory +** is available to hold the result, or if the result would exceed the +** the maximum string length determined by the [SQLITE_LIMIT_LENGTH]. +** +** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of +** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time +** option causes sqlite3_expanded_sql() to always return NULL. +** +** ^The string returned by sqlite3_sql(P) is managed by SQLite and is +** automatically freed when the prepared statement is finalized. +** ^The string returned by sqlite3_expanded_sql(P), on the other hand, +** is obtained from [sqlite3_malloc()] and must be free by the application +** by passing it to [sqlite3_free()]. */ SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt); +SQLITE_API char *SQLITE_STDCALL sqlite3_expanded_sql(sqlite3_stmt *pStmt); /* ** CAPI3REF: Determine If An SQL Statement Writes The Database @@ -4563,12 +4704,13 @@ SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_context_db_handle(sqlite3_context*); ** SQLite will invoke the destructor function X with parameter P exactly ** once, when the metadata is discarded. ** SQLite is free to discard the metadata at any time, including:
      -**
    • when the corresponding function parameter changes, or -**
    • when [sqlite3_reset()] or [sqlite3_finalize()] is called for the -** SQL statement, or -**
    • when sqlite3_set_auxdata() is invoked again on the same parameter, or -**
    • during the original sqlite3_set_auxdata() call when a memory -** allocation error occurs.
    )^ +**
  • ^(when the corresponding function parameter changes)^, or +**
  • ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the +** SQL statement)^, or +**
  • ^(when sqlite3_set_auxdata() is invoked again on the same +** parameter)^, or +**
  • ^(during the original sqlite3_set_auxdata() call when a memory +** allocation error occurs.)^ ** ** Note the last bullet in particular. The destructor X in ** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the @@ -5395,7 +5537,7 @@ SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_soft_heap_limit(int N); ** column exists. ^The sqlite3_table_column_metadata() interface returns ** SQLITE_ERROR and if the specified column does not exist. ** ^If the column-name parameter to sqlite3_table_column_metadata() is a -** NULL pointer, then this routine simply checks for the existance of the +** NULL pointer, then this routine simply checks for the existence of the ** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it ** does not. ** @@ -5529,8 +5671,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_load_extension( ** ** ^This interface enables or disables both the C-API ** [sqlite3_load_extension()] and the SQL function [load_extension()]. -** Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..) -** to enable or disable only the C-API. +** ^(Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..) +** to enable or disable only the C-API.)^ ** ** Security warning: It is recommended that extension loading ** be disabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method @@ -5550,7 +5692,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_enable_load_extension(sqlite3 *db, int ono ** ** ^(Even though the function prototype shows that xEntryPoint() takes ** no arguments and returns void, SQLite invokes xEntryPoint() with three -** arguments and expects and integer result as if the signature of the +** arguments and expects an integer result as if the signature of the ** entry point where as follows: ** **
    @@ -5576,7 +5718,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_enable_load_extension(sqlite3 *db, int ono
     ** See also: [sqlite3_reset_auto_extension()]
     ** and [sqlite3_cancel_auto_extension()]
     */
    -SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void (*xEntryPoint)(void));
    +SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void(*xEntryPoint)(void));
     
     /*
     ** CAPI3REF: Cancel Automatic Extension Loading
    @@ -5588,7 +5730,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void (*xEntryPoint)(void));
     ** unregistered and it returns 0 if X was not on the list of initialization
     ** routines.
     */
    -SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void (*xEntryPoint)(void));
    +SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
     
     /*
     ** CAPI3REF: Reset Automatic Extension Loading
    @@ -6764,6 +6906,18 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_status(sqlite3*, int op, int *pCur, int
     ** memory used by all pager caches associated with the database connection.)^
     ** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
     **
    +** [[SQLITE_DBSTATUS_CACHE_USED_SHARED]] 
    +** ^(
    SQLITE_DBSTATUS_CACHE_USED_SHARED
    +**
    This parameter is similar to DBSTATUS_CACHE_USED, except that if a +** pager cache is shared between two or more connections the bytes of heap +** memory used by that pager cache is divided evenly between the attached +** connections.)^ In other words, if none of the pager caches associated +** with the database connection are shared, this request returns the same +** value as DBSTATUS_CACHE_USED. Or, if one or more or the pager caches are +** shared, the value returned by this call will be smaller than that returned +** by DBSTATUS_CACHE_USED. ^The highwater mark associated with +** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0. +** ** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(
    SQLITE_DBSTATUS_SCHEMA_USED
    **
    This parameter returns the approximate number of bytes of heap ** memory used to store the schema for all databases associated @@ -6821,7 +6975,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_status(sqlite3*, int op, int *pCur, int #define SQLITE_DBSTATUS_CACHE_MISS 8 #define SQLITE_DBSTATUS_CACHE_WRITE 9 #define SQLITE_DBSTATUS_DEFERRED_FKS 10 -#define SQLITE_DBSTATUS_MAX 10 /* Largest defined DBSTATUS */ +#define SQLITE_DBSTATUS_CACHE_USED_SHARED 11 +#define SQLITE_DBSTATUS_MAX 11 /* Largest defined DBSTATUS */ /* @@ -7977,7 +8132,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3*); ** ^The second parameter to the preupdate callback is a pointer to ** the [database connection] that registered the preupdate hook. ** ^The third parameter to the preupdate callback is one of the constants -** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to indentify the +** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to identify the ** kind of update operation that is about to occur. ** ^(The fourth parameter to the preupdate callback is the name of the ** database within the database connection that is being modified. This @@ -8204,7 +8359,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_cmp( #ifdef __cplusplus } /* End of the 'extern "C"' block */ #endif -#endif /* _SQLITE3_H_ */ +#endif /* SQLITE3_H */ /******** Begin file sqlite3rtree.h *********/ /* @@ -9924,7 +10079,7 @@ struct Fts5ExtensionApi { ** behaviour. The structure methods are expected to function as follows: ** ** xCreate: -** This function is used to allocate and inititalize a tokenizer instance. +** This function is used to allocate and initialize a tokenizer instance. ** A tokenizer instance is required to actually tokenize text. ** ** The first argument passed to this function is a copy of the (void*) @@ -10184,5 +10339,4 @@ struct fts5_api { #endif /* _FTS5_H */ - /******** End of fts5.h *********/ From 8af7ee75903d6adb940029cb74e9b63145854aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Sat, 27 Aug 2016 10:54:35 +0200 Subject: [PATCH 08/31] fixed GH #1355: [JSON::Object] After copy-ctor, JSON::Object::_keys still points to keys in map of copied object --- JSON/include/Poco/JSON/Object.h | 13 +++++++++++++ JSON/src/Object.cpp | 11 ++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/JSON/include/Poco/JSON/Object.h b/JSON/include/Poco/JSON/Object.h index 5f21be4c5..ac3c4e455 100644 --- a/JSON/include/Poco/JSON/Object.h +++ b/JSON/include/Poco/JSON/Object.h @@ -303,6 +303,19 @@ inline std::size_t Object::size() const inline void Object::remove(const std::string& key) { _values.erase(key); + if (_preserveInsOrder) + { + KeyPtrList::iterator it = _keys.begin(); + KeyPtrList::iterator end = _keys.end(); + for (; it != end; ++it) + { + if (key == **it) + { + _keys.erase(it); + break; + } + } + } } diff --git a/JSON/src/Object.cpp b/JSON/src/Object.cpp index 1718b8773..d23f52fc6 100644 --- a/JSON/src/Object.cpp +++ b/JSON/src/Object.cpp @@ -32,10 +32,19 @@ Object::Object(bool preserveInsertionOrder): _preserveInsOrder(preserveInsertion Object::Object(const Object& copy) : _values(copy._values), - _keys(copy._keys), _preserveInsOrder(copy._preserveInsOrder), _pStruct(0) { + if (_preserveInsOrder) + { + // need to update pointers in _keys to point to copied _values + for (KeyPtrList::const_iterator it = copy._keys.begin(); it != copy._keys.end(); ++it) + { + ValueMap::const_iterator itv = _values.find(**it); + poco_assert (itv != _values.end()); + _keys.push_back(&itv->first); + } + } } From 3ca4514f15331ba30feb08b0d46bc52487dafe33 Mon Sep 17 00:00:00 2001 From: zosrothko Date: Tue, 30 Aug 2016 05:26:24 +0200 Subject: [PATCH 09/31] Add missing Redis component in omit lists --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 28992185d..17f1da0cf 100755 --- a/configure +++ b/configure @@ -147,8 +147,8 @@ odbcinclude="" unbundled="" static="" shared="" -omitMinimal="Crypto NetSSL_OpenSSL Zip Data Data/SQLite Data/ODBC Data/MySQL MongoDB PDF CppParser PageCompiler" -omitTypical="Data/ODBC Data/MySQL MongoDB PDF CppParser" +omitMinimal="Crypto NetSSL_OpenSSL Zip Data Data/SQLite Data/ODBC Data/MySQL MongoDB Redis PDF CppParser PageCompiler" +omitTypical="Data/ODBC Data/MySQL MongoDB Redis PDF CppParser" omit=$omitTypical # parse arguments while [ $# -ge 1 ]; do From ec6b72a200a9a98767731fcb44714fd9149fb8ac Mon Sep 17 00:00:00 2001 From: zosrothko Date: Tue, 30 Aug 2016 05:30:33 +0200 Subject: [PATCH 10/31] Update Cygwin config Add Data/PostgreSQL to OMIT instead of setting it Restore SYSFLAGS to _XOPEN_SOURCE=500 --- build/config/Cygwin | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/config/Cygwin b/build/config/Cygwin index 4b80180b4..3beb1fa63 100644 --- a/build/config/Cygwin +++ b/build/config/Cygwin @@ -12,7 +12,7 @@ # LINKMODE ?= SHARED -OMIT = Data/PostgreSQL +OMIT += Data/PostgreSQL # # Define Tools @@ -73,7 +73,7 @@ RELEASEOPT_LINK = # # System Specific Flags # -SYSFLAGS = -D__BSD_VISIBLE=1 -D__MISC_VISIBLE=1 +SYSFLAGS = -D_XOPEN_SOURCE=500 # # System Specific Libraries From d194e570dcd6b87fe4e712104815f1763e466a0f Mon Sep 17 00:00:00 2001 From: zosrothko Date: Tue, 30 Aug 2016 17:12:05 +0200 Subject: [PATCH 11/31] Add typedef ulong needed by MySQL/my_global.h Add typedef ulong needed by MySQL/my_global.h but invisible on Cygwin with defined constant XOPEN_SOURCE=500 --- Data/MySQL/testsuite/src/SQLExecutor.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Data/MySQL/testsuite/src/SQLExecutor.cpp b/Data/MySQL/testsuite/src/SQLExecutor.cpp index 9a16229a3..f76edf250 100644 --- a/Data/MySQL/testsuite/src/SQLExecutor.cpp +++ b/Data/MySQL/testsuite/src/SQLExecutor.cpp @@ -35,6 +35,12 @@ #define HAVE_STRUCT_TIMESPEC #endif +#if (POCO_OS == POCO_OS_CYGWIN) +typedef unsigned short ushort; /* System V compatibility */ +typedef unsigned int uint; /* System V compatibility */ +typedef unsigned long ulong; /* System V compatibility */ +#endif + #include #include From 07fc2e0e3ea5686fccb5f3ee1abfbea53fddc9d5 Mon Sep 17 00:00:00 2001 From: Guenter Obiltschnig Date: Wed, 31 Aug 2016 11:00:47 +0200 Subject: [PATCH 12/31] provide a default client context even if no Application instance is available --- NetSSL_Win/src/SSLManager.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/NetSSL_Win/src/SSLManager.cpp b/NetSSL_Win/src/SSLManager.cpp index ef08481a3..7e71be549 100644 --- a/NetSSL_Win/src/SSLManager.cpp +++ b/NetSSL_Win/src/SSLManager.cpp @@ -1,7 +1,7 @@ // // SSLManager.cpp // -// $Id$ +// $Id: //poco/1.7/NetSSL_Win/src/SSLManager.cpp#2 $ // // Library: NetSSL_Win // Package: SSLCore @@ -18,6 +18,7 @@ #include "Poco/Net/Context.h" #include "Poco/Net/Utility.h" #include "Poco/Net/PrivateKeyPassphraseHandler.h" +#include "Poco/Net/RejectCertificateHandler.h" #include "Poco/SingletonHolder.h" #include "Poco/Delegate.h" #include "Poco/Util/Application.h" @@ -120,7 +121,17 @@ Context::Ptr SSLManager::defaultClientContext() Poco::FastMutex::ScopedLock lock(_mutex); if (!_ptrDefaultClientContext) - initDefaultContext(false); + { + try + { + initDefaultContext(false); + } + catch (Poco::IllegalStateException&) + { + _ptrClientCertificateHandler = new RejectCertificateHandler(false); + _ptrDefaultClientContext = new Context(Context::CLIENT_USE, ""); + } + } return _ptrDefaultClientContext; } From cb25a7f4a99eff44ae27d0528c2b1729e3ab0f75 Mon Sep 17 00:00:00 2001 From: Dan Hosseinzadeh Date: Wed, 31 Aug 2016 15:38:37 -0400 Subject: [PATCH 13/31] Assume BLOB for unknown sqltypes rather than throwing an exception - Affects only the SQLite implementation issue-1375 Signed-off-by: Dan Hosseinzadeh --- Data/SQLite/src/Utility.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Data/SQLite/src/Utility.cpp b/Data/SQLite/src/Utility.cpp index 4b835af86..000ac101c 100644 --- a/Data/SQLite/src/Utility.cpp +++ b/Data/SQLite/src/Utility.cpp @@ -147,9 +147,12 @@ MetaColumn::ColumnDataType Utility::getColumnType(sqlite3_stmt* pStmt, std::size sqliteType = sqliteType.substr(0, sqliteType.find_first_of(" (")); TypeMap::const_iterator it = _types.find(Poco::trimInPlace(sqliteType)); - if (_types.end() == it) throw Poco::NotFoundException(); - - return it->second; + if (_types.end() == it) { + return MetaColumn::FDT_BLOB; + } + else { + return it->second; + } } From 60ecf597c4a30d6fcca4eb2562527a9902b536c5 Mon Sep 17 00:00:00 2001 From: Dan Hosseinzadeh Date: Thu, 1 Sep 2016 00:46:53 -0400 Subject: [PATCH 14/31] Add API to allow SQLite types to be added at runtime - new types can be added via Poco::Data::SQLite::Utility::addColumnType() issue-1375 --- .../SQLite/include/Poco/Data/SQLite/Utility.h | 11 ++++++++++ Data/SQLite/src/Utility.cpp | 20 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/Data/SQLite/include/Poco/Data/SQLite/Utility.h b/Data/SQLite/include/Poco/Data/SQLite/Utility.h index fb9e2e47d..9c1c867b1 100644 --- a/Data/SQLite/include/Poco/Data/SQLite/Utility.h +++ b/Data/SQLite/include/Poco/Data/SQLite/Utility.h @@ -56,6 +56,15 @@ public: static const int OPERATION_DELETE; static const int OPERATION_UPDATE; + static void addColumnType(std::string sqliteType, MetaColumn::ColumnDataType pocoType); + /// Adds or replaces the mapping for SQLite column type \p sqliteType + /// to a Poco type \p pocoType + /// + /// \p sqliteType is a case-insensitive desription of the column type with + /// any value \p pocoType value but MetaColumn::FDT_UNKNOWN. A + /// Poco::Data::NotSupportedException is thrown if \p pocoType is invalid. + + static sqlite3* dbHandle(const Session& session); /// Returns native DB handle. @@ -190,6 +199,8 @@ private: Utility(const Utility&); Utility& operator = (const Utility&); + static void initializeDefaultTypes(); + static void* eventHookRegister(sqlite3* pDB, UpdateCallbackType callbackFn, void* pParam); static void* eventHookRegister(sqlite3* pDB, CommitCallbackType callbackFn, void* pParam); static void* eventHookRegister(sqlite3* pDB, RollbackCallbackType callbackFn, void* pParam); diff --git a/Data/SQLite/src/Utility.cpp b/Data/SQLite/src/Utility.cpp index 000ac101c..04761636d 100644 --- a/Data/SQLite/src/Utility.cpp +++ b/Data/SQLite/src/Utility.cpp @@ -62,6 +62,11 @@ Poco::Mutex Utility::_mutex; Utility::Utility() +{ + initializeDefaultTypes(); +} + +void Utility::initializeDefaultTypes() { if (_types.empty()) { @@ -125,6 +130,21 @@ Utility::Utility() } +void Utility::addColumnType(std::string sqliteType, MetaColumn::ColumnDataType pocoType) +{ + // Check for errors in the mapping + if (MetaColumn::FDT_UNKNOWN == pocoType) + throw Poco::Data::NotSupportedException("Cannot map to unknown poco type."); + + // Initialize default types + initializeDefaultTypes(); + + // Add type to internal map + Poco::toUpperInPlace(sqliteType); + _types[sqliteType] = pocoType; +} + + std::string Utility::lastError(sqlite3* pDB) { return std::string(sqlite3_errmsg(pDB)); From fd9ca0a9b693237b249447414fe32f618c36469d Mon Sep 17 00:00:00 2001 From: Guenter Obiltschnig Date: Thu, 1 Sep 2016 11:51:16 +0200 Subject: [PATCH 15/31] style fixes --- Data/SQLite/include/Poco/Data/SQLite/Utility.h | 11 +++++------ Data/SQLite/src/Utility.cpp | 7 +++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Data/SQLite/include/Poco/Data/SQLite/Utility.h b/Data/SQLite/include/Poco/Data/SQLite/Utility.h index 9c1c867b1..06f204886 100644 --- a/Data/SQLite/include/Poco/Data/SQLite/Utility.h +++ b/Data/SQLite/include/Poco/Data/SQLite/Utility.h @@ -57,13 +57,12 @@ public: static const int OPERATION_UPDATE; static void addColumnType(std::string sqliteType, MetaColumn::ColumnDataType pocoType); - /// Adds or replaces the mapping for SQLite column type \p sqliteType - /// to a Poco type \p pocoType + /// Adds or replaces the mapping for SQLite column type sqliteType + /// to a Poco type pocoType. /// - /// \p sqliteType is a case-insensitive desription of the column type with - /// any value \p pocoType value but MetaColumn::FDT_UNKNOWN. A - /// Poco::Data::NotSupportedException is thrown if \p pocoType is invalid. - + /// sqliteType is a case-insensitive desription of the column type with + /// any value pocoType value but MetaColumn::FDT_UNKNOWN. + /// A Poco::Data::NotSupportedException is thrown if pocoType is invalid. static sqlite3* dbHandle(const Session& session); /// Returns native DB handle. diff --git a/Data/SQLite/src/Utility.cpp b/Data/SQLite/src/Utility.cpp index 04761636d..e4cc1da41 100644 --- a/Data/SQLite/src/Utility.cpp +++ b/Data/SQLite/src/Utility.cpp @@ -66,6 +66,7 @@ Utility::Utility() initializeDefaultTypes(); } + void Utility::initializeDefaultTypes() { if (_types.empty()) @@ -167,12 +168,10 @@ MetaColumn::ColumnDataType Utility::getColumnType(sqlite3_stmt* pStmt, std::size sqliteType = sqliteType.substr(0, sqliteType.find_first_of(" (")); TypeMap::const_iterator it = _types.find(Poco::trimInPlace(sqliteType)); - if (_types.end() == it) { + if (_types.end() == it) return MetaColumn::FDT_BLOB; - } - else { + else return it->second; - } } From 64781d15f11b525579cb6f5cd21610ff1f4a6949 Mon Sep 17 00:00:00 2001 From: Guenter Obiltschnig Date: Sun, 4 Sep 2016 14:30:26 +0200 Subject: [PATCH 16/31] style and documentation fixes --- Redis/include/Poco/Redis/Array.h | 90 ++-- Redis/include/Poco/Redis/AsyncReader.h | 23 +- Redis/include/Poco/Redis/Client.h | 72 +-- Redis/include/Poco/Redis/Command.h | 163 ++++--- Redis/include/Poco/Redis/Error.h | 38 +- Redis/include/Poco/Redis/Exception.h | 12 +- .../Poco/Redis/PoolableConnectionFactory.h | 21 +- Redis/include/Poco/Redis/Redis.h | 4 +- Redis/include/Poco/Redis/RedisEventArgs.h | 32 +- Redis/include/Poco/Redis/RedisStream.h | 23 +- Redis/include/Poco/Redis/Type.h | 85 ++-- Redis/src/Array.cpp | 14 +- Redis/src/AsyncReader.cpp | 13 +- Redis/src/Client.cpp | 47 +- Redis/src/Command.cpp | 76 ++- Redis/src/Error.cpp | 12 +- Redis/src/Exception.cpp | 8 +- Redis/src/RedisEventArgs.cpp | 13 +- Redis/src/RedisStream.cpp | 33 +- Redis/src/Type.cpp | 37 +- Redis/testsuite/src/Driver.cpp | 2 +- Redis/testsuite/src/RedisTest.cpp | 449 ++++++++++-------- Redis/testsuite/src/RedisTest.h | 3 +- Redis/testsuite/src/RedisTestSuite.cpp | 2 +- Redis/testsuite/src/RedisTestSuite.h | 2 +- Redis/testsuite/src/WinCEDriver.cpp | 2 +- Redis/testsuite/src/WinDriver.cpp | 2 +- 27 files changed, 791 insertions(+), 487 deletions(-) diff --git a/Redis/include/Poco/Redis/Array.h b/Redis/include/Poco/Redis/Array.h index f42dd4b6b..f7c0496d9 100644 --- a/Redis/include/Poco/Redis/Array.h +++ b/Redis/include/Poco/Redis/Array.h @@ -9,69 +9,74 @@ // // Definition of the Array class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // + #ifndef Redis_Array_INCLUDED #define Redis_Array_INCLUDED -#include -#include #include "Poco/Redis/Redis.h" #include "Poco/Redis/Type.h" #include "Poco/Redis/Exception.h" +#include +#include + namespace Poco { namespace Redis { + class Redis_API Array /// Represents a Redis Array. An Array can contain Integers, Strings, - /// Bulk Strings, Errors and other arrays. It can also contain a Null + /// Bulk Strings, Errors and other Arrays. It can also contain a Null /// value. { public: - typedef std::vector::const_iterator const_iterator; Array(); - /// Default constructor. As long as there are no elements added, + /// Creates an Array. As long as there are no elements added, /// the array will contain a Null value. Array(const Array& copy); - /// Copy constructor. + /// Creates an Array by copying another one. virtual ~Array(); - /// Destructor. + /// Destroys the Array. template Array& operator<<(const T& arg) /// Adds the argument to the array. + /// /// Note: a std::string will be added as a BulkString because this /// is commonly used for representing strings in Redis. If you - /// really need a simple string, use addSimpleString. + /// really need a simple string, use addSimpleString(). { return add(arg); } Array& operator<<(const char* s); - /// Special implementation for const char* + /// Special implementation for const char*. + /// /// Note: the specialization creates a BulkString. If you need - /// a simple string, call addSimpleString. + /// a simple string, call addSimpleString(). Array& operator<<(const std::vector& strings); - /// Special implementation for a vector with strings + /// Special implementation for a vector with strings. /// All strings will be added as a BulkString. Array& add(); - /// Adds an Null BulkString + /// Adds an Null BulkString. template Array& add(const T& arg) /// Adds an element to the array. + /// /// Note: the specialization for std::string will add a BulkString! /// If you really need a simple string, call addSimpleString. { @@ -80,38 +85,41 @@ public: } Array& add(const char* s); - /// Special implementation for const char* + /// Special implementation for const char*. + /// /// Note: the specialization creates a BulkString. If you need /// a simple string, call addSimpleString. Array& add(const std::vector& strings); - /// Special implementation for a vector with strings + /// Special implementation for a vector with strings. /// All strings will be added as a BulkString. Array& addRedisType(RedisType::Ptr value); /// Adds a Redis element. Array& addSimpleString(const std::string& value); - /// Adds a simple string (can't contain newline characters!) + /// Adds a simple string (can't contain newline characters!). const_iterator begin() const; - /// Returns an iterator to the start of the array. Note: - /// this can throw a NullValueException when this is a Null array. + /// Returns an iterator to the start of the array. + /// + /// Note: this can throw a NullValueException when this is a Null array. void clear(); /// Removes all elements from the array. const_iterator end() const; - /// Returns an iterator to the end of the array. Note: - /// this can throw a NullValueException when this is a Null array. + /// Returns an iterator to the end of the array. + /// + /// Note: this can throw a NullValueException when this is a Null array. template T get(size_t pos) const /// Returns the element on the given position and tries to convert - /// to the template type. A BadCastException will be thrown when the - /// the conversion fails. An InvalidArgumentException will be thrown + /// to the template type. A Poco::BadCastException will be thrown when the + /// the conversion fails. An Poco::InvalidArgumentException will be thrown /// when the index is out of range. When the array is a Null array - /// a NullValueException is thrown. + /// a Poco::NullValueException is thrown. { if ( _elements.isNull() ) throw NullValueException(); @@ -127,8 +135,8 @@ public: } int getType(size_t pos) const; - /// Returns the type of the element. This can throw a NullValueException - /// when this array is a Null array. An InvalidArgumentException will + /// Returns the type of the element. This can throw a Poco::NullValueException + /// when this array is a Null array. An Poco::InvalidArgumentException will /// be thrown when the index is out of range. bool isNull() const; @@ -143,34 +151,43 @@ public: /// Redis Protocol specification. size_t size() const; - /// Returns the size of the array. Note: - /// this can throw a NullValueException when this is a Null array. + /// Returns the size of the array. + /// + /// Note: this can throw a NullValueException when this is a Null array. private: - - Nullable > _elements; - void checkNull(); /// Checks for null array and sets a new vector if true. + + Nullable > _elements; }; + +// +// inlines +// + + inline Array& Array::operator<<(const char* s) { BulkString value(s); return add(value); } + inline Array& Array::operator<<(const std::vector& strings) { return add(strings); } + inline Array& Array::add() { BulkString value; return add(value); } + template<> inline Array& Array::add(const std::string& arg) { @@ -178,12 +195,14 @@ inline Array& Array::add(const std::string& arg) return add(value); } + inline Array& Array::add(const char* s) { BulkString value(s); return add(value); } + inline Array& Array::add(const std::vector& strings) { for(std::vector::const_iterator it = strings.begin(); it != strings.end(); ++it) @@ -193,22 +212,26 @@ inline Array& Array::add(const std::vector& strings) return *this; } + inline Array& Array::addSimpleString(const std::string& value) { return addRedisType(new Type(value)); } + inline Array::const_iterator Array::begin() const { return _elements.value().begin(); } + inline void Array::checkNull() { std::vector v; if ( _elements.isNull() ) _elements.assign(v); } + inline void Array::clear() { if ( !_elements.isNull() ) @@ -217,16 +240,19 @@ inline void Array::clear() } } + inline Array::const_iterator Array::end() const { return _elements.value().end(); } + inline bool Array::isNull() const { return _elements.isNull(); } + inline void Array::makeNull() { if ( !_elements.isNull() ) _elements.value().clear(); @@ -234,6 +260,7 @@ inline void Array::makeNull() _elements.clear(); } + inline size_t Array::size() const { return _elements.value().size(); @@ -291,6 +318,7 @@ struct RedisTypeTraits }; -}} +} } // namespace Poco::Redis + #endif // Redis_Array_INCLUDED diff --git a/Redis/include/Poco/Redis/AsyncReader.h b/Redis/include/Poco/Redis/AsyncReader.h index 2a7e3a996..d6ca8ba04 100644 --- a/Redis/include/Poco/Redis/AsyncReader.h +++ b/Redis/include/Poco/Redis/AsyncReader.h @@ -9,7 +9,7 @@ // // Definition of the AsyncReader class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 @@ -25,6 +25,7 @@ #include "Poco/Redis/RedisEventArgs.h" #include "Poco/Activity.h" + namespace Poco { namespace Redis { @@ -37,17 +38,17 @@ class Redis_API AsyncReader /// reading all replies. { public: - BasicEvent redisResponse; - /// Event that is called when a message is received + /// Event that is fired when a message is received. + BasicEvent redisException; - /// Event that is called when an error occurred. + /// Event that is fired when an error occurred. AsyncReader(Client& client); - /// Constructor. + /// Creates the AsyncReader using the given Client. virtual ~AsyncReader(); - /// Destructor + /// Destroys the AsyncReader. bool isStopped(); /// Returns true if the activity is not running, false when it is. @@ -59,11 +60,9 @@ public: /// Stops the read activity. protected: - void runActivity(); private: - AsyncReader(const AsyncReader&); AsyncReader& operator = (const AsyncReader&); @@ -72,16 +71,23 @@ private: }; +// +// inlines +// + + inline bool AsyncReader::isStopped() { return _activity.isStopped(); } + inline void AsyncReader::start() { _activity.start(); } + inline void AsyncReader::stop() { _activity.stop(); @@ -90,4 +96,5 @@ inline void AsyncReader::stop() } } // namespace Poco::Redis + #endif //Redis_AsyncReader_INCLUDED diff --git a/Redis/include/Poco/Redis/Client.h b/Redis/include/Poco/Redis/Client.h index eba4b10f1..c9e1eab98 100644 --- a/Redis/include/Poco/Redis/Client.h +++ b/Redis/include/Poco/Redis/Client.h @@ -9,7 +9,7 @@ // // Definition of the Client class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 @@ -19,13 +19,14 @@ #ifndef Redis_Client_INCLUDED #define Redis_Client_INCLUDED -#include "Poco/Net/SocketAddress.h" -#include "Poco/Timespan.h" #include "Poco/Redis/Redis.h" #include "Poco/Redis/Array.h" #include "Poco/Redis/Error.h" #include "Poco/Redis/RedisStream.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Timespan.h" + namespace Poco { namespace Redis { @@ -41,43 +42,42 @@ class Redis_API Client /// implemented as a typedef for Poco::Nullable. This is /// because a bulk string can represent a Null value. /// - /// BulkString bs = client.execute(...); - /// if ( bs.isNull() ) - /// { - /// // We have a Null value - /// } - /// else - /// { - /// // We have a string value - /// } + /// BulkString bs = client.execute(...); + /// if ( bs.isNull() ) + /// { + /// // We have a Null value + /// } + /// else + /// { + /// // We have a string value + /// } /// /// To create Redis commands, the factory methods of the Command class can /// be used or the Array class can be used directly. /// - /// Command llen = Command::llen("list"); + /// Command llen = Command::llen("list"); /// - /// is the same as + /// is the same as: /// - /// Array command; - /// command.add("LLEN").add("list"); + /// Array command; + /// command.add("LLEN").add("list"); /// - /// or + /// or: /// - /// Array command; - /// command << "LLEN" << "list"; + /// Array command; + /// command << "LLEN" << "list"; /// - /// or even + /// or even: /// - /// Command command("LLEN"); - /// command << "list"; + /// Command command("LLEN"); + /// command << "list"; { public: - typedef SharedPtr Ptr; Client(); - /// Default constructor. Use this when you want to - /// connect later on. + /// Creates an unconnected Client. + /// Use this when you want to connect later on. Client(const std::string& hostAndPort); /// Constructor which connects to the given Redis host/port. @@ -90,7 +90,7 @@ public: /// Constructor which connects to the given Redis host/port. virtual ~Client(); - /// Destructor. + /// Destroys the Client. Net::SocketAddress address() const; /// Returns the address of the Redis connection. @@ -125,9 +125,9 @@ public: /// /// A specialization exists for type void, which doesn't read /// the reply. If the server sends a reply, it is your - /// responsibility to read it ... (Use this for pipelining) + /// responsibility to read it. Use this for pipelining. /// - /// A BadCastException will be thrown when the reply couldn't be + /// A Poco::BadCastException will be thrown when the reply couldn't be /// converted. Supported types are Int64, std::string, BulkString, /// Array and void. When the reply is an Error, it will throw /// a RedisException. @@ -179,13 +179,9 @@ public: /// Sets a receive timeout. private: - Client(const Client&); Client& operator = (const Client&); - Net::SocketAddress _address; - Net::StreamSocket _socket; - void connect(); /// Connects to the Redis server @@ -198,28 +194,38 @@ private: /// call readReply as many times as you called writeCommand, even when /// an error occurred on a command. + Net::SocketAddress _address; + Net::StreamSocket _socket; RedisInputStream* _input; RedisOutputStream* _output; }; +// +// inlines +// + + inline Net::SocketAddress Client::address() const { return _address; } + template<> inline void Client::execute(const Array& command) { writeCommand(command, false); } + inline void Client::flush() { poco_assert(_output); _output->flush(); } + inline void Client::setReceiveTimeout(const Timespan& timeout) { _socket.setReceiveTimeout(timeout); @@ -229,4 +235,4 @@ inline void Client::setReceiveTimeout(const Timespan& timeout) } } // namespace Poco::Redis -#endif //Redis_Client_INCLUDED +#endif // Redis_Client_INCLUDED diff --git a/Redis/include/Poco/Redis/Command.h b/Redis/include/Poco/Redis/Command.h index 2c67b871d..69e057063 100644 --- a/Redis/include/Poco/Redis/Command.h +++ b/Redis/include/Poco/Redis/Command.h @@ -9,248 +9,255 @@ // // Definition of the Command class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // + #ifndef Redis_Command_INCLUDED #define Redis_Command_INCLUDED + #include "Poco/Redis/Redis.h" #include "Poco/Redis/Array.h" - #include #include + namespace Poco { namespace Redis { -class Redis_API Command : public Array + +class Redis_API Command: public Array /// Helper class for creating commands. This class contains /// factory methods for commonly used Redis commands. + /// /// There are two ways of building commands: - /// 1. Use this class and the factory methods - /// 2. Use the Array or Command class and build the command using the add - /// method or << operator. + /// + /// 1. Use this class and the factory methods + /// 2. Use the Array or Command class and build the command using the add + /// method or << operator. + /// /// For example: /// - /// Command cmd = Command::set("mykey", "Hello"); + /// Command cmd = Command::set("mykey", "Hello"); /// /// is the same as: /// - /// Array cmd; - /// cmd << "SET" << "mykey" << "Hello"; + /// Array cmd; + /// cmd << "SET" << "mykey" << "Hello"; /// { public: - typedef std::vector StringVec; Command(const std::string& command); - /// Constructor + /// Creates a command. Command(const Command& copy); - /// Copy constructor + /// Creates a command by copying another one. virtual ~Command(); - /// Destructor + /// Destroys the command. static Command append(const std::string& key, const std::string& value); - /// Returns an APPEND command + /// Creates and returns an APPEND command. static Command blpop(const StringVec& lists, Int64 timeout = 0); - /// Returns a BLPOP command + /// Creates and returns a BLPOP command. static Command brpop(const StringVec& lists, Int64 timeout = 0); - /// Returns a BRPOP command + /// Creates and returns a BRPOP command. static Command brpoplpush(const std::string& sourceList, const std::string& destinationList, Int64 timeout = 0); - /// Returns a BRPOPLPUSH command + /// Creates and returns a BRPOPLPUSH command. static Command decr(const std::string& key, Int64 by = 0); - /// Returns an DECR or DECRBY command. Calls DECR when by is omitted or zero. + /// Creates and returns an DECR or DECRBY command. Calls DECR when by is omitted or zero. static Command del(const std::string& key); - /// Returns an DEL command + /// Creates and returns an DEL command. static Command del(const StringVec& keys); - /// Returns an DEL command + /// Creates and returns an DEL command. static Command get(const std::string& key); - /// Returns an GET command + /// Creates and returns an GET command. static Command hdel(const std::string& hash, const std::string& field); - /// Returns an HDEL command + /// Creates and returns an HDEL command. static Command hdel(const std::string& hash, const StringVec& fields); - /// Returns an HDEL command + /// Creates and returns an HDEL command. static Command hexists(const std::string& hash, const std::string& field); - /// Returns an HEXISTS command + /// Creates and returns an HEXISTS command. static Command hget(const std::string& hash, const std::string& field); - /// Returns an HGET command + /// Creates and returns an HGET command. static Command hgetall(const std::string& hash); - /// Returns an HGETALL command + /// Creates and returns an HGETALL command. static Command hincrby(const std::string& hash, const std::string& field, Int64 by = 1); - /// Returns an HINCRBY command + /// Creates and returns an HINCRBY command. static Command hkeys(const std::string& hash); - /// Returns an HKEYS command + /// Creates and returns an HKEYS command. static Command hlen(const std::string& hash); - /// Returns an HLEN command + /// Creates and returns an HLEN command. static Command hmget(const std::string& hash, const StringVec& fields); - /// Returns an HMGET command + /// Creates and returns an HMGET command. static Command hmset(const std::string& hash, std::map& fields); - /// Returns a HMSET command + /// Creates and returns a HMSET command. static Command hset(const std::string& hash, const std::string& field, const std::string& value, bool create = true); - /// Returns an HSET or HSETNX (when create is false) command + /// Creates and returns an HSET or HSETNX (when create is false) command. static Command hset(const std::string& hash, const std::string& field, Int64 value, bool create = true); - /// Returns an HSET or HSETNX (when create is false) command + /// Creates and returns an HSET or HSETNX (when create is false) command. static Command hstrlen(const std::string& hash, const std::string& field); - /// Returns an HSTRLEN command (Available for Redis 3.2) + /// Creates and returns an HSTRLEN command (Available for Redis 3.2). static Command hvals(const std::string& hash); - /// Returns an HVALS command + /// Creates and returns an HVALS command. static Command incr(const std::string& key, Int64 by = 0); - /// Returns an INCR or INCRBY command. Calls INCR when by is omitted or zero. + /// Creates and returns an INCR or INCRBY command. Calls INCR when by is omitted or zero. static Command lindex(const std::string& list, Int64 index = 0); - /// Returns a LINDEX command + /// Creates and returns a LINDEX command. static Command linsert(const std::string& list, bool before, const std::string& reference, const std::string& value); - /// Returns a LINSERT command + /// Creates and returns a LINSERT command. static Command llen(const std::string& list); - /// Returns a LLEN command + /// Creates and returns a LLEN command. static Command lpop(const std::string& list); - /// Returns a LPOP command + /// Creates and returns a LPOP command. static Command lpush(const std::string& list, const std::string& value, bool create = true); - /// Returns a LPUSH or LPUSHX (when create is false) command + /// Creates and returns a LPUSH or LPUSHX (when create is false) command. static Command lpush(const std::string& list, const StringVec& value, bool create = true); - /// Returns a LPUSH or LPUSHX (when create is false) command + /// Creates and returns a LPUSH or LPUSHX (when create is false) command. static Command lrange(const std::string& list, Int64 start = 0, Int64 stop = -1); - /// Returns a LRANGE command. When start and stop is omitted an LRANGE + /// Creates and returns a LRANGE command. When start and stop is omitted an LRANGE /// command will returned that returns all items of the list. static Command lrem(const std::string& list, Int64 count, const std::string& value); - /// Returns a LREM command + /// Creates and returns a LREM command. static Command lset(const std::string& list, Int64 index, const std::string& value); - /// Returns a LSET command + /// Creates and returns a LSET command. static Command ltrim(const std::string& list, Int64 start = 0, Int64 stop = -1); - /// Returns a LTRIM command + /// Creates and returns a LTRIM command. static Command mget(const StringVec& keys); - /// Returns a MGET command + /// Creates and returns a MGET command. static Command mset(const std::map& keyvalues, bool create = true); - /// Returns a MSET or MSETNX (when create is false) command + /// Creates and returns a MSET or MSETNX (when create is false) command. static Command sadd(const std::string& set, const std::string& value); - /// Returns a SADD command + /// Creates and returns a SADD command. static Command sadd(const std::string& set, const StringVec& values); - /// Returns a SADD command + /// Creates and returns a SADD command. static Command scard(const std::string& set); - /// Returns a SCARD command + /// Creates and returns a SCARD command. static Command sdiff(const std::string& set1, const std::string& set2); - /// Returns a SDIFF command + /// Creates and returns a SDIFF command.Creates and returns static Command sdiff(const std::string& set, const StringVec& sets); - /// Returns a SDIFF command + /// Creates and returns a SDIFF command. static Command sdiffstore(const std::string& set, const std::string& set1, const std::string& set2); - /// Returns a SDIFFSTORE command + /// Creates and returns a SDIFFSTORE command. static Command sdiffstore(const std::string& set, const StringVec& sets); - /// Returns a SDIFFSTORE command + /// Creates and returns a SDIFFSTORE command. static Command set(const std::string& key, const std::string& value, bool overwrite = true, const Poco::Timespan& expireTime = 0, bool create = true); - /// Returns a SET command to set the key with a value + /// Creates and returns a SET command to set the key with a value. static Command set(const std::string& key, Int64 value, bool overwrite = true, const Poco::Timespan& expireTime = 0, bool create = true); - /// Returns a SET command to set the key with a value + /// Creates and returns a SET command to set the key with a value. static Command sinter(const std::string& set1, const std::string& set2); - /// Returns a SINTER command + /// Creates and returns a SINTER command. static Command sinter(const std::string& set, const StringVec& sets); - /// Returns a SINTER command + /// Creates and returns a SINTER command. static Command sinterstore(const std::string& set, const std::string& set1, const std::string& set2); - /// Returns a SINTERSTORE command + /// Creates and returns a SINTERSTORE command. static Command sinterstore(const std::string& set, const StringVec& sets); - /// Returns a SINTERSTORE command + /// Creates and returns a SINTERSTORE command. static Command sismember(const std::string& set, const std::string& member); - /// Returns a SISMEMBER command + /// Creates and returns a SISMEMBER command. static Command smembers(const std::string& set); - /// Returns a SMEMBERS command + /// Creates and returns a SMEMBERS command. static Command smove(const std::string& source, const std::string& destination, const std::string& member); - /// Returns a SMOVE command + /// Creates and returns a SMOVE command. static Command spop(const std::string& set, Int64 count = 0); - /// Returns a SPOP command + /// Creates and returns a SPOP command. static Command srandmember(const std::string& set, Int64 count = 0); - /// Returns a SRANDMEMBER command + /// Creates and returns a SRANDMEMBER command. static Command srem(const std::string& set, const std::string& member); - /// Returns a SREM command + /// Creates and returns a SREM command. static Command srem(const std::string& set, const StringVec& members); - /// Returns a SREM command + /// Creates and returns a SREM command. static Command sunion(const std::string& set1, const std::string& set2); - /// Returns a SUNION command + /// Creates and returns a SUNION command. static Command sunion(const std::string& set, const StringVec& sets); - /// Returns a SUNION command + /// Creates and returns a SUNION command. static Command sunionstore(const std::string& set, const std::string& set1, const std::string& set2); - /// Returns a SUNIONSTORE command + /// Creates and returns a SUNIONSTORE command. static Command sunionstore(const std::string& set, const StringVec& sets); - /// Returns a SUNIONSTORE command + /// Creates and returns a SUNIONSTORE command. static Command rename(const std::string& key, const std::string& newName, bool overwrite = true); - /// Returns a RENAME or RENAMENX when overwrite is false + /// Creates and returns a RENAME or RENAMENX when overwrite is false. static Command rpop(const std::string& list); - /// Returns a RPOP command + /// Creates and returns a RPOP command. static Command rpoplpush(const std::string& sourceList, const std::string& destinationList); - /// Returns a RPOPLPUSH command + /// Creates and returns a RPOPLPUSH command. static Command rpush(const std::string& list, const std::string& value, bool create = true); - /// Returns a RPUSH or RPUSHX (when create is false) command + /// Creates and returns a RPUSH or RPUSHX (when create is false) command. static Command rpush(const std::string& list, const StringVec& value, bool create = true); - /// Returns a RPUSH or RPUSHX (when create is false) command + /// Creates and returns a RPUSH or RPUSHX (when create is false) command. }; -}} // namespace Poco::Redis + +} } // namespace Poco::Redis + #endif // Redis_Command_INCLUDED diff --git a/Redis/include/Poco/Redis/Error.h b/Redis/include/Poco/Redis/Error.h index fd1edc7ce..92cc53387 100644 --- a/Redis/include/Poco/Redis/Error.h +++ b/Redis/include/Poco/Redis/Error.h @@ -9,55 +9,65 @@ // // Definition of the Error class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // + #ifndef Redis_Error_INCLUDED #define Redis_Error_INCLUDED + #include "Poco/Redis/Type.h" + namespace Poco { namespace Redis { + class Redis_API Error - /// Represent a Redis error + /// Represent a Redis error. { public: - Error(); - /// Constructor + /// Creates an empty Error. Error(const std::string& message); - /// Constructor + /// Creates an Error with the given message. virtual ~Error(); - /// Destructor + /// Destroys the Error. - std::string getMessage() const; - /// Returns the error message + const std::string& getMessage() const; + /// Returns the error message. void setMessage(const std::string& message); - /// Sets the error message + /// Sets the error message. private: - std::string _message; }; -inline std::string Error::getMessage() const + +// +// inlines +// + + +inline const std::string& Error::getMessage() const { return _message; } + inline void Error::setMessage(const std::string& message) { _message = message; } + template<> struct RedisTypeTraits { @@ -76,6 +86,8 @@ struct RedisTypeTraits } }; -}} // Namespace Poco::Redis -#endif // Redis_Error_INCLUDED \ No newline at end of file +} } // namespace Poco::Redis + + +#endif // Redis_Error_INCLUDED diff --git a/Redis/include/Poco/Redis/Exception.h b/Redis/include/Poco/Redis/Exception.h index d45d85348..1ed6b4f7b 100644 --- a/Redis/include/Poco/Redis/Exception.h +++ b/Redis/include/Poco/Redis/Exception.h @@ -9,24 +9,30 @@ // // Definition of the Exception class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // + #ifndef Redis_Exception_INCLUDED #define Redis_Exception_INCLUDED + #include "Poco/Redis/Redis.h" -#include #include "Poco/Exception.h" +#include + namespace Poco { namespace Redis { + POCO_DECLARE_EXCEPTION(Redis_API, RedisException, Exception) -}} + +} } // namespace Poco::Redis + #endif // Redis_Exception_INCLUDED diff --git a/Redis/include/Poco/Redis/PoolableConnectionFactory.h b/Redis/include/Poco/Redis/PoolableConnectionFactory.h index edc9d46af..a2dfd0441 100644 --- a/Redis/include/Poco/Redis/PoolableConnectionFactory.h +++ b/Redis/include/Poco/Redis/PoolableConnectionFactory.h @@ -9,7 +9,7 @@ // // Definition of the PoolableConnectionFactory class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 @@ -22,6 +22,7 @@ #include "Poco/Redis/Client.h" #include "Poco/ObjectPool.h" +#include "Poco/Version.h" namespace Poco { @@ -33,13 +34,13 @@ class PoolableObjectFactory /// are created with the given address. { public: - PoolableObjectFactory(Net::SocketAddress& address) - : _address(address) + PoolableObjectFactory(Net::SocketAddress& address): + _address(address) { } - PoolableObjectFactory(const std::string& address) - : _address(address) + PoolableObjectFactory(const std::string& address): + _address(address) { } @@ -79,7 +80,11 @@ class PooledConnection public: PooledConnection(ObjectPool& pool, long timeoutMilliseconds = 0) : _pool(pool) { +#if POCO_VERSION >= 0x01080000 _client = _pool.borrowObject(timeoutMilliseconds); +#else + _client = _pool.borrowObject(); +#endif } virtual ~PooledConnection() @@ -94,7 +99,7 @@ public: } } - operator Client::Ptr () + operator Client::Ptr() { return _client; } @@ -105,7 +110,7 @@ private: }; -} // namespace Redis -} // namespace Poco +} } // namespace Poco::Redis + #endif // Redis_PoolableConnectionFactory_INCLUDED diff --git a/Redis/include/Poco/Redis/Redis.h b/Redis/include/Poco/Redis/Redis.h index a25cd1598..04c64fe48 100644 --- a/Redis/include/Poco/Redis/Redis.h +++ b/Redis/include/Poco/Redis/Redis.h @@ -11,7 +11,7 @@ // This file must be the first file included by every other Redis // header file. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 @@ -33,8 +33,6 @@ // Redis_API functions as being imported from a DLL, wheras this DLL sees symbols // defined with this macro as being exported. // - - #if defined(_WIN32) && defined(POCO_DLL) #if defined(Redis_EXPORTS) #define Redis_API __declspec(dllexport) diff --git a/Redis/include/Poco/Redis/RedisEventArgs.h b/Redis/include/Poco/Redis/RedisEventArgs.h index eca6c9877..689f3298e 100644 --- a/Redis/include/Poco/Redis/RedisEventArgs.h +++ b/Redis/include/Poco/Redis/RedisEventArgs.h @@ -9,47 +9,53 @@ // // Definition of the RedisEventArgs class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // + #ifndef Redis_RedisEventArgs_INCLUDED #define Redis_RedisEventArgs_INCLUDED + #include "Poco/Redis/Type.h" + namespace Poco { namespace Redis { + class Redis_API RedisEventArgs + /// Event arguments for AsyncReader events. { public: RedisEventArgs(RedisType::Ptr message); - /// Constructor + /// Creates the RedisEventArgs from the given message. RedisEventArgs(Exception* e); - /// Constructor + /// Creates the RedisEventArgs from the given Redis Exception. ~RedisEventArgs(); - /// Destructor + /// Destroys the RedisEventArgs. RedisType::Ptr message() const; /// Returns the message retrieved from the Redis server. /// This can be a NULL pointer when this event is about an exception. const Exception* exception() const; - /// Returns the exception if any, otherwise it returns null pointer + /// Returns the exception if any, otherwise it returns null pointer. void stop(); /// When called, the AsyncReader will stop. + /// /// Note: The AsyncReader will always stop when this is an exception /// event. Use this for example for pub/sub when there are no - /// subcribers anymore ... + /// subcribers anymore. bool isStopped() const; - /// Returns true when the AsyncReader will stop + /// Returns true when the AsyncReader will stop. private: RedisType::Ptr _message; @@ -59,27 +65,37 @@ private: bool _stop; }; + +// +// inlines +// + + inline RedisType::Ptr RedisEventArgs::message() const { return _message; } + inline const Exception* RedisEventArgs::exception() const { return _exception; } + inline bool RedisEventArgs::isStopped() const { return _stop; } + inline void RedisEventArgs::stop() { _stop = true; } -}} // namespace Poco::Redis +} } // namespace Poco::Redis + #endif // Redis_RedisEventArgs_INCLUDED diff --git a/Redis/include/Poco/Redis/RedisStream.h b/Redis/include/Poco/Redis/RedisStream.h index 353620a3e..bb1989476 100644 --- a/Redis/include/Poco/Redis/RedisStream.h +++ b/Redis/include/Poco/Redis/RedisStream.h @@ -9,27 +9,30 @@ // // Definition of the RedisStream class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // + #ifndef Redis_RedisStream_INCLUDED #define Redis_RedisStream_INCLUDED + #include "Poco/Redis/Redis.h" #include "Poco/BufferedStreamBuf.h" #include "Poco/Net/StreamSocket.h" - #include #include + namespace Poco { namespace Redis { -class RedisStreamBuf : public BufferedStreamBuf - /// BufferedStreamBuf for Redis + +class RedisStreamBuf: public BufferedStreamBuf + /// BufferedStreamBuf for Redis. { public: RedisStreamBuf(Net::StreamSocket& redis); @@ -43,11 +46,9 @@ public: protected: int readFromDevice(char* buffer, std::streamsize length); - int writeToDevice(const char* buffer, std::streamsize length); private: - enum { STREAM_BUFFER_SIZE = 1024 @@ -56,6 +57,7 @@ private: Net::StreamSocket& _redis; }; + class RedisIOS: public virtual std::ios { public: @@ -103,11 +105,12 @@ public: /// Destroys the RedisInputStream. std::string getline(); - /// Redis uses /r/n as delimiter. This getline version removes - /// the /r from the result. + /// Redis uses \r\n as delimiter. This getline version removes + /// the \r from the result. }; -}} // Poco::Redis +} } // namespace Poco::Redis -#endif // Redis_RedisStream_INCLUDED \ No newline at end of file + +#endif // Redis_RedisStream_INCLUDED diff --git a/Redis/include/Poco/Redis/Type.h b/Redis/include/Poco/Redis/Type.h index b926c89a3..83608090b 100644 --- a/Redis/include/Poco/Redis/Type.h +++ b/Redis/include/Poco/Redis/Type.h @@ -9,24 +9,26 @@ // // Definition of the Type class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2016, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // + #ifndef Redis_Type_INCLUDED #define Redis_Type_INCLUDED + #include "Poco/LineEndingConverter.h" #include "Poco/NumberFormatter.h" #include "Poco/NumberParser.h" #include "Poco/SharedPtr.h" #include "Poco/Nullable.h" - #include "Poco/Redis/Redis.h" #include "Poco/Redis/RedisStream.h" + namespace Poco { namespace Redis { @@ -36,22 +38,22 @@ class Redis_API RedisType /// element with different types in Array. { public: - - enum Types { - REDIS_INTEGER, // Redis Integer - REDIS_SIMPLE_STRING, // Redis Simple String - REDIS_BULK_STRING, // Redis Bulkstring - REDIS_ARRAY, // Redis Array - REDIS_ERROR // Redis Error + enum Types + { + REDIS_INTEGER, /// Redis Integer + REDIS_SIMPLE_STRING, /// Redis Simple String + REDIS_BULK_STRING, /// Redis Bulkstring + REDIS_ARRAY, /// Redis Array + REDIS_ERROR /// Redis Error }; typedef SharedPtr Ptr; RedisType(); - /// Constructor + /// Creates the RedisType. virtual ~RedisType(); - /// Destructor + /// Destroys the RedisType. bool isArray() const; /// Returns true when the value is a Redis array. @@ -63,7 +65,7 @@ public: /// Returns true when the value is a Redis error. bool isInteger() const; - /// Returns true when the value is a Redis integer (64 bit integer) + /// Returns true when the value is a Redis integer (64 bit integer). bool isSimpleString() const; /// Returns true when the value is a simple string. @@ -78,42 +80,51 @@ public: /// Converts the value to a RESP (REdis Serialization Protocol) string. static RedisType::Ptr createRedisType(char marker); - /// Create a Redis type based on the marker : - /// + : a simple string (std::string) - /// - : an error (Error) - /// $ : a bulk string (BulkString) - /// * : an array (Array) - /// : : a signed 64 bit integer (Int64) - -private: - + /// Create a Redis type based on the marker: + /// + /// - '+': a simple string (std::string) + /// - '-': an error (Error) + /// - '$': a bulk string (BulkString) + /// - '*': an array (Array) + /// - ':': a signed 64 bit integer (Int64) }; + +// +// inlines +// + + inline bool RedisType::isArray() const { return type() == REDIS_ARRAY; } + inline bool RedisType::isBulkString() const { return type() == REDIS_BULK_STRING; } + inline bool RedisType::isError() const { return type() == REDIS_ERROR; } + inline bool RedisType::isInteger() const { return type() == REDIS_INTEGER; } + inline bool RedisType::isSimpleString() const { return type() == REDIS_SIMPLE_STRING; } + template struct RedisTypeTraits { @@ -123,7 +134,10 @@ struct RedisTypeTraits template<> struct RedisTypeTraits { - enum { TypeId = RedisType::REDIS_INTEGER }; + enum + { + TypeId = RedisType::REDIS_INTEGER + }; static const char marker = ':'; @@ -137,14 +151,16 @@ struct RedisTypeTraits std::string number = input.getline(); value = NumberParser::parse64(number); } - }; template<> struct RedisTypeTraits { - enum { TypeId = RedisType::REDIS_SIMPLE_STRING }; + enum + { + TypeId = RedisType::REDIS_SIMPLE_STRING + }; static const char marker = '+'; @@ -168,7 +184,10 @@ typedef Nullable BulkString; template<> struct RedisTypeTraits { - enum { TypeId = RedisType::REDIS_BULK_STRING }; + enum + { + TypeId = RedisType::REDIS_BULK_STRING + }; static const char marker = '$'; @@ -210,29 +229,28 @@ struct RedisTypeTraits template -class Type : public RedisType +class Type: public RedisType /// Template class for all Redis types. This class will use /// RedisTypeTraits structure for calling the type specific code. { public: - Type() - /// Constructor + /// Creates the Type. { } Type(const T& t) : _value(t) - /// Constructor + /// Creates the Type from another one. { } Type(const Type& copy) : _value(copy._value) - /// Copy Constructor + /// Creates the Type by copying another one. { } virtual ~Type() - /// Destructor + /// Destroys the Type. { } @@ -267,10 +285,11 @@ public: } private: - T _value; }; -}} // Namespace Poco/Redis + +} } // namespace Poco/Redis + #endif // Redis_Type_INCLUDED diff --git a/Redis/src/Array.cpp b/Redis/src/Array.cpp index 961ba3059..5d93ac679 100644 --- a/Redis/src/Array.cpp +++ b/Redis/src/Array.cpp @@ -9,14 +9,16 @@ // // Implementation of the Array class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // + #include "Poco/Redis/Array.h" + namespace Poco { namespace Redis { @@ -26,7 +28,8 @@ Array::Array() } -Array::Array(const Array& copy) : _elements(copy._elements) +Array::Array(const Array& copy): + _elements(copy._elements) { } @@ -48,9 +51,9 @@ Array& Array::addRedisType(RedisType::Ptr value) int Array::getType(size_t pos) const { - if ( _elements.isNull() ) throw NullValueException(); + if (_elements.isNull()) throw NullValueException(); - if ( pos >= _elements.value().size() ) throw InvalidArgumentException(); + if (pos >= _elements.value().size()) throw InvalidArgumentException(); RedisType::Ptr element = _elements.value().at(pos); return element->type(); @@ -62,4 +65,5 @@ std::string Array::toString() const return RedisTypeTraits::toString(*this); } -} } + +} } // namespace Poco::Redis diff --git a/Redis/src/AsyncReader.cpp b/Redis/src/AsyncReader.cpp index 41a3ebcba..9030a7ac5 100644 --- a/Redis/src/AsyncReader.cpp +++ b/Redis/src/AsyncReader.cpp @@ -9,19 +9,22 @@ // // Implementation of the AsyncReader class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // + #include "Poco/Redis/AsyncReader.h" + namespace Poco { namespace Redis { -AsyncReader::AsyncReader(Client& client) : _client(client), +AsyncReader::AsyncReader(Client& client): + _client(client), _activity(this, &AsyncReader::runActivity) { } @@ -35,7 +38,7 @@ AsyncReader::~AsyncReader() void AsyncReader::runActivity() { - while(!_activity.isStopped()) + while (!_activity.isStopped()) { try { @@ -46,7 +49,7 @@ void AsyncReader::runActivity() if ( args.isStopped() ) stop(); } - catch(Exception& e) + catch (Exception& e) { RedisEventArgs args(&e); redisException.notify(this, args); @@ -57,4 +60,4 @@ void AsyncReader::runActivity() } -} } // Poco::Redis +} } // namespace Poco::Redis diff --git a/Redis/src/Client.cpp b/Redis/src/Client.cpp index e38b164f3..a53a97b28 100644 --- a/Redis/src/Client.cpp +++ b/Redis/src/Client.cpp @@ -9,37 +9,55 @@ // // Implementation of the Client class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // + #include "Poco/Redis/Client.h" #include "Poco/Redis/Exception.h" + namespace Poco { namespace Redis { -Client::Client() : _address(), _socket(), _input(0), _output(0) +Client::Client(): + _address(), + _socket(), + _input(0), + _output(0) { } -Client::Client(const std::string& hostAndPort) : _address(hostAndPort), _socket(), _input(0), _output(0) +Client::Client(const std::string& hostAndPort): + _address(hostAndPort), + _socket(), + _input(0), + _output(0) { connect(); } -Client::Client(const std::string& host, int port) : _address(host, port), _socket(), _input(0), _output(0) +Client::Client(const std::string& host, int port): + _address(host, port), + _socket(), + _input(0), + _output(0) { connect(); } -Client::Client(const Net::SocketAddress& addrs) : _address(addrs), _socket(), _input(0), _output(0) +Client::Client(const Net::SocketAddress& addrs): + _address(addrs), + _socket(), + _input(0), + _output(0) { connect(); } @@ -62,6 +80,7 @@ void Client::connect() _output = new RedisOutputStream(_socket); } + void Client::connect(const std::string& hostAndPort) { _address = Net::SocketAddress(hostAndPort); @@ -82,6 +101,7 @@ void Client::connect(const Net::SocketAddress& addrs) connect(); } + void Client::connect(const Timespan& timeout) { poco_assert(! _input); @@ -92,6 +112,7 @@ void Client::connect(const Timespan& timeout) _output = new RedisOutputStream(_socket); } + void Client::connect(const std::string& hostAndPort, const Timespan& timeout) { _address = Net::SocketAddress(hostAndPort); @@ -112,6 +133,7 @@ void Client::connect(const Net::SocketAddress& addrs, const Timespan& timeout) connect(timeout); } + void Client::disconnect() { delete _input; @@ -123,6 +145,7 @@ void Client::disconnect() _socket.close(); } + void Client::writeCommand(const Array& command, bool doFlush) { poco_assert(_output); @@ -130,16 +153,17 @@ void Client::writeCommand(const Array& command, bool doFlush) std::string commandStr = command.toString(); _output->write(commandStr.c_str(), commandStr.length()); - if ( doFlush ) _output->flush(); + if (doFlush) _output->flush(); } + RedisType::Ptr Client::readReply() { poco_assert(_input); int c = _input->get(); RedisType::Ptr result = RedisType::createRedisType(c); - if ( result.isNull() ) + if (result.isNull()) { throw RedisException("Invalid Redis type returned"); } @@ -149,23 +173,25 @@ RedisType::Ptr Client::readReply() return result; } + RedisType::Ptr Client::sendCommand(const Array& command) { writeCommand(command, true); return readReply(); } + Array Client::sendCommands(const std::vector& commands) { Array results; - for(std::vector::const_iterator it = commands.begin(); it != commands.end(); ++it) + for (std::vector::const_iterator it = commands.begin(); it != commands.end(); ++it) { writeCommand(*it, false); } _output->flush(); - for(int i = 0; i < commands.size(); ++i) + for (int i = 0; i < commands.size(); ++i) { results.addRedisType(readReply()); } @@ -173,4 +199,5 @@ Array Client::sendCommands(const std::vector& commands) return results; } -} } // Poco::Redis + +} } // namespace Poco::Redis diff --git a/Redis/src/Command.cpp b/Redis/src/Command.cpp index 0705b3c48..656c0d475 100644 --- a/Redis/src/Command.cpp +++ b/Redis/src/Command.cpp @@ -9,31 +9,37 @@ // // Implementation of the Command class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // + #include "Poco/Redis/Command.h" #include "Poco/NumberFormatter.h" + namespace Poco { namespace Redis { -Command::Command(const std::string& command) : Array() + +Command::Command(const std::string& command): Array() { add(command); } -Command::Command(const Command& copy) : Array(copy) + +Command::Command(const Command& copy): Array(copy) { } + Command::~Command() { } + Command Command::append(const std::string& key, const std::string& value) { Command cmd("APPEND"); @@ -43,6 +49,7 @@ Command Command::append(const std::string& key, const std::string& value) return cmd; } + Command Command::blpop(const StringVec& lists, Int64 timeout) { Command cmd("BLPOP"); @@ -52,6 +59,7 @@ Command Command::blpop(const StringVec& lists, Int64 timeout) return cmd; } + Command Command::brpop(const StringVec& lists, Int64 timeout) { Command cmd("BRPOP"); @@ -61,6 +69,7 @@ Command Command::brpop(const StringVec& lists, Int64 timeout) return cmd; } + Command Command::brpoplpush(const std::string& sourceList, const std::string& destinationList, Int64 timeout) { Command cmd("BRPOPLPUSH"); @@ -70,6 +79,7 @@ Command Command::brpoplpush(const std::string& sourceList, const std::string& de return cmd; } + Command Command::decr(const std::string& key, Int64 by) { Command cmd(by == 0 ? "DECR" : "DECRBY"); @@ -80,6 +90,7 @@ Command Command::decr(const std::string& key, Int64 by) return cmd; } + Command Command::del(const std::string& key) { Command cmd("DEL"); @@ -89,6 +100,7 @@ Command Command::del(const std::string& key) return cmd; } + Command Command::del(const StringVec& keys) { Command cmd("DEL"); @@ -98,6 +110,7 @@ Command Command::del(const StringVec& keys) return cmd; } + Command Command::get(const std::string& key) { Command cmd("GET"); @@ -107,6 +120,7 @@ Command Command::get(const std::string& key) return cmd; } + Command Command::hdel(const std::string& hash, const std::string& field) { Command cmd("HDEL"); @@ -116,6 +130,7 @@ Command Command::hdel(const std::string& hash, const std::string& field) return cmd; } + Command Command::hdel(const std::string& hash, const StringVec& fields) { Command cmd("HDEL"); @@ -125,6 +140,7 @@ Command Command::hdel(const std::string& hash, const StringVec& fields) return cmd; } + Command Command::hexists(const std::string& hash, const std::string& field) { Command cmd("HEXISTS"); @@ -134,6 +150,7 @@ Command Command::hexists(const std::string& hash, const std::string& field) return cmd; } + Command Command::hget(const std::string& hash, const std::string& field) { Command cmd("HGET"); @@ -143,6 +160,7 @@ Command Command::hget(const std::string& hash, const std::string& field) return cmd; } + Command Command::hgetall(const std::string& hash) { Command cmd("HGETALL"); @@ -152,6 +170,7 @@ Command Command::hgetall(const std::string& hash) return cmd; } + Command Command::hincrby(const std::string& hash, const std::string& field, Int64 by) { Command cmd("HINCRBY"); @@ -161,6 +180,7 @@ Command Command::hincrby(const std::string& hash, const std::string& field, Int6 return cmd; } + Command Command::hkeys(const std::string& hash) { Command cmd("HKEYS"); @@ -170,6 +190,7 @@ Command Command::hkeys(const std::string& hash) return cmd; } + Command Command::hlen(const std::string& hash) { Command cmd("HLEN"); @@ -179,6 +200,7 @@ Command Command::hlen(const std::string& hash) return cmd; } + Command Command::hmget(const std::string& hash, const StringVec& fields) { Command cmd("HMGET"); @@ -188,6 +210,7 @@ Command Command::hmget(const std::string& hash, const StringVec& fields) return cmd; } + Command Command::hmset(const std::string& hash, std::map& fields) { Command cmd("HMSET"); @@ -201,6 +224,7 @@ Command Command::hmset(const std::string& hash, std::map& keyvalues, bool create) { Command cmd(create ? "MSET" : "MSETNX"); @@ -353,6 +393,7 @@ Command Command::mset(const std::map& keyvalues, bool return cmd; } + Command Command::sadd(const std::string& set, const std::string& value) { Command cmd("SADD"); @@ -362,6 +403,7 @@ Command Command::sadd(const std::string& set, const std::string& value) return cmd; } + Command Command::sadd(const std::string& set, const StringVec& values) { Command cmd("SADD"); @@ -371,6 +413,7 @@ Command Command::sadd(const std::string& set, const StringVec& values) return cmd; } + Command Command::scard(const std::string& set) { Command cmd("SCARD"); @@ -380,6 +423,7 @@ Command Command::scard(const std::string& set) return cmd; } + Command Command::sdiff(const std::string& set1, const std::string& set2) { Command cmd("SDIFF"); @@ -389,6 +433,7 @@ Command Command::sdiff(const std::string& set1, const std::string& set2) return cmd; } + Command Command::sdiff(const std::string& set, const StringVec& sets) { Command cmd("SDIFF"); @@ -398,6 +443,7 @@ Command Command::sdiff(const std::string& set, const StringVec& sets) return cmd; } + Command Command::sdiffstore(const std::string& set, const std::string& set1, const std::string& set2) { Command cmd("SDIFFSTORE"); @@ -407,6 +453,7 @@ Command Command::sdiffstore(const std::string& set, const std::string& set1, con return cmd; } + Command Command::sdiffstore(const std::string& set, const StringVec& sets) { Command cmd("SDIFFSTORE"); @@ -416,6 +463,7 @@ Command Command::sdiffstore(const std::string& set, const StringVec& sets) return cmd; } + Command Command::set(const std::string& key, const std::string& value, bool overwrite, const Poco::Timespan& expireTime, bool create) { Command cmd("SET"); @@ -428,11 +476,13 @@ Command Command::set(const std::string& key, const std::string& value, bool over return cmd; } + Command Command::set(const std::string& key, Int64 value, bool overwrite, const Poco::Timespan& expireTime, bool create) { return set(key, NumberFormatter::format(value), overwrite, expireTime, create); } + Command Command::sinter(const std::string& set1, const std::string& set2) { Command cmd("SINTER"); @@ -442,6 +492,7 @@ Command Command::sinter(const std::string& set1, const std::string& set2) return cmd; } + Command Command::sinter(const std::string& set, const StringVec& sets) { Command cmd("SINTER"); @@ -451,6 +502,7 @@ Command Command::sinter(const std::string& set, const StringVec& sets) return cmd; } + Command Command::sinterstore(const std::string& set, const std::string& set1, const std::string& set2) { Command cmd("SINTERSTORE"); @@ -460,6 +512,7 @@ Command Command::sinterstore(const std::string& set, const std::string& set1, co return cmd; } + Command Command::sinterstore(const std::string& set, const StringVec& sets) { Command cmd("SINTERSTORE"); @@ -469,6 +522,7 @@ Command Command::sinterstore(const std::string& set, const StringVec& sets) return cmd; } + Command Command::sismember(const std::string& set, const std::string& member) { Command cmd("SISMEMBER"); @@ -478,6 +532,7 @@ Command Command::sismember(const std::string& set, const std::string& member) return cmd; } + Command Command::smembers(const std::string& set) { Command cmd("SMEMBERS"); @@ -487,6 +542,7 @@ Command Command::smembers(const std::string& set) return cmd; } + Command Command::smove(const std::string& source, const std::string& destination, const std::string& member) { Command cmd("SMOVE"); @@ -496,6 +552,7 @@ Command Command::smove(const std::string& source, const std::string& destination return cmd; } + Command Command::spop(const std::string& set, Int64 count) { Command cmd("SPOP"); @@ -506,6 +563,7 @@ Command Command::spop(const std::string& set, Int64 count) return cmd; } + Command Command::srandmember(const std::string& set, Int64 count) { Command cmd("SRANDMEMBER"); @@ -516,6 +574,7 @@ Command Command::srandmember(const std::string& set, Int64 count) return cmd; } + Command Command::srem(const std::string& set1, const std::string& member) { Command cmd("SREM"); @@ -525,6 +584,7 @@ Command Command::srem(const std::string& set1, const std::string& member) return cmd; } + Command Command::srem(const std::string& set, const StringVec& members) { Command cmd("SREM"); @@ -534,6 +594,7 @@ Command Command::srem(const std::string& set, const StringVec& members) return cmd; } + Command Command::sunion(const std::string& set1, const std::string& set2) { Command cmd("SUNION"); @@ -543,6 +604,7 @@ Command Command::sunion(const std::string& set1, const std::string& set2) return cmd; } + Command Command::sunion(const std::string& set, const StringVec& sets) { Command cmd("SUNION"); @@ -552,6 +614,7 @@ Command Command::sunion(const std::string& set, const StringVec& sets) return cmd; } + Command Command::sunionstore(const std::string& set, const std::string& set1, const std::string& set2) { Command cmd("SUNIONSTORE"); @@ -561,6 +624,7 @@ Command Command::sunionstore(const std::string& set, const std::string& set1, co return cmd; } + Command Command::sunionstore(const std::string& set, const StringVec& sets) { Command cmd("SUNIONSTORE"); @@ -570,6 +634,7 @@ Command Command::sunionstore(const std::string& set, const StringVec& sets) return cmd; } + Command Command::rename(const std::string& key, const std::string& newName, bool overwrite) { Command cmd(overwrite ? "RENAME" : "RENAMENX"); @@ -589,6 +654,7 @@ Command Command::rpop(const std::string& list) return cmd; } + Command Command::rpoplpush(const std::string& sourceList, const std::string& destinationList) { Command cmd("RPOPLPUSH"); @@ -598,6 +664,7 @@ Command Command::rpoplpush(const std::string& sourceList, const std::string& des return cmd; } + Command Command::rpush(const std::string& list, const std::string& value, bool create) { Command cmd(create ? "RPUSH" : "RPUSHX"); @@ -607,6 +674,7 @@ Command Command::rpush(const std::string& list, const std::string& value, bool c return cmd; } + Command Command::rpush(const std::string& list, const StringVec& values, bool create) { Command cmd(create ? "RPUSH" : "RPUSHX"); @@ -617,4 +685,4 @@ Command Command::rpush(const std::string& list, const StringVec& values, bool cr } -}} // Poco::Redis +} } // namespace Poco::Redis diff --git a/Redis/src/Error.cpp b/Redis/src/Error.cpp index 51c9f7a40..daab8c567 100644 --- a/Redis/src/Error.cpp +++ b/Redis/src/Error.cpp @@ -9,27 +9,33 @@ // // Implementation of the Error class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // + #include "Poco/Redis/Error.h" + namespace Poco { namespace Redis { + Error::Error() { } -Error::Error(const std::string& message) : _message(message) + +Error::Error(const std::string& message): _message(message) { } + Error::~Error() { } -} } \ No newline at end of file + +} } // namespace Poco::Redis diff --git a/Redis/src/Exception.cpp b/Redis/src/Exception.cpp index c27e5743c..75f252b02 100644 --- a/Redis/src/Exception.cpp +++ b/Redis/src/Exception.cpp @@ -9,17 +9,21 @@ // // Implementation of the Exception class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // + #include "Poco/Redis/Exception.h" + namespace Poco { namespace Redis { + POCO_IMPLEMENT_EXCEPTION(RedisException, Exception, "Redis Exception") -}} + +} } // namespace Poco::Redis diff --git a/Redis/src/RedisEventArgs.cpp b/Redis/src/RedisEventArgs.cpp index 1f7979978..e1d4fa5e8 100644 --- a/Redis/src/RedisEventArgs.cpp +++ b/Redis/src/RedisEventArgs.cpp @@ -9,35 +9,40 @@ // // Implementation of the RedisEventArgs class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // + #include "Poco/Redis/RedisEventArgs.h" + namespace Poco { namespace Redis { -RedisEventArgs::RedisEventArgs(RedisType::Ptr pMessage) : + +RedisEventArgs::RedisEventArgs(RedisType::Ptr pMessage): _message(pMessage), _exception(0), _stop(false) { } -RedisEventArgs::RedisEventArgs(Exception* pException) : + +RedisEventArgs::RedisEventArgs(Exception* pException): _message(), _exception(pException ? pException->clone() : 0), _stop(false) { } + RedisEventArgs::~RedisEventArgs() { delete _exception; } -}} // namespace Poco::Redis +} } // namespace Poco::Redis diff --git a/Redis/src/RedisStream.cpp b/Redis/src/RedisStream.cpp index b794bb210..68d317bd1 100644 --- a/Redis/src/RedisStream.cpp +++ b/Redis/src/RedisStream.cpp @@ -9,18 +9,26 @@ // // Implementation of the RedisStream class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // -#include + + #include "Poco/Redis/RedisStream.h" +#include + namespace Poco { namespace Redis { +// +// RedisStreamBuf +// + + RedisStreamBuf::RedisStreamBuf(Net::StreamSocket& redis): BufferedStreamBuf(STREAM_BUFFER_SIZE, std::ios::in | std::ios::out), _redis(redis) @@ -44,6 +52,12 @@ int RedisStreamBuf::writeToDevice(const char* buffer, std::streamsize length) return _redis.sendBytes(buffer, length); } + +// +// RedisIOS +// + + RedisIOS::RedisIOS(Net::StreamSocket& redis): _buf(redis) { @@ -74,6 +88,12 @@ void RedisIOS::close() _buf.sync(); } + +// +// RedisOutputStream +// + + RedisOutputStream::RedisOutputStream(Net::StreamSocket& redis): RedisIOS(redis), std::ostream(&_buf) @@ -85,6 +105,7 @@ RedisOutputStream::~RedisOutputStream() { } + RedisInputStream::RedisInputStream(Net::StreamSocket& redis): RedisIOS(redis), std::istream(&_buf) @@ -92,10 +113,16 @@ RedisInputStream::RedisInputStream(Net::StreamSocket& redis): } +// +// RedisInputStream +// + + RedisInputStream::~RedisInputStream() { } + std::string RedisInputStream::getline() { std::string line; @@ -105,4 +132,4 @@ std::string RedisInputStream::getline() } -}} \ No newline at end of file +} } // namespace Poco::Redis diff --git a/Redis/src/Type.cpp b/Redis/src/Type.cpp index 68ce05a90..382428d09 100644 --- a/Redis/src/Type.cpp +++ b/Redis/src/Type.cpp @@ -9,16 +9,18 @@ // // Implementation of the Type class. // -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // + #include "Poco/Redis/Type.h" #include "Poco/Redis/Error.h" #include "Poco/Redis/Array.h" + namespace Poco { namespace Redis { @@ -27,6 +29,7 @@ RedisType::RedisType() { } + RedisType::~RedisType() { } @@ -38,24 +41,24 @@ RedisType::Ptr RedisType::createRedisType(char marker) switch(marker) { - case RedisTypeTraits::marker : - result = new Type(); - break; - case RedisTypeTraits::marker : - result = new Type(); - break; - case RedisTypeTraits::marker : - result = new Type(); - break; - case RedisTypeTraits::marker : - result = new Type(); - break; - case RedisTypeTraits::marker : - result = new Type(); - break; + case RedisTypeTraits::marker : + result = new Type(); + break; + case RedisTypeTraits::marker : + result = new Type(); + break; + case RedisTypeTraits::marker : + result = new Type(); + break; + case RedisTypeTraits::marker : + result = new Type(); + break; + case RedisTypeTraits::marker : + result = new Type(); + break; } return result; } -}} \ No newline at end of file +} } // namespace Poco::Redis diff --git a/Redis/testsuite/src/Driver.cpp b/Redis/testsuite/src/Driver.cpp index fa0c9001d..0ef1639b5 100644 --- a/Redis/testsuite/src/Driver.cpp +++ b/Redis/testsuite/src/Driver.cpp @@ -5,7 +5,7 @@ // // Console-based test driver for Poco MongoDB. // -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 diff --git a/Redis/testsuite/src/RedisTest.cpp b/Redis/testsuite/src/RedisTest.cpp index 284f7fd36..dc428ad7c 100644 --- a/Redis/testsuite/src/RedisTest.cpp +++ b/Redis/testsuite/src/RedisTest.cpp @@ -3,24 +3,24 @@ // // $Id$ // -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // -#include + #include "Poco/Exception.h" #include "Poco/Delegate.h" #include "Poco/Thread.h" - #include "RedisTest.h" #include "Poco/Redis/AsyncReader.h" #include "Poco/Redis/Command.h" #include "Poco/Redis/PoolableConnectionFactory.h" - #include "Poco/CppUnit/TestCaller.h" #include "Poco/CppUnit/TestSuite.h" +#include + using namespace Poco::Redis; @@ -64,7 +64,6 @@ RedisTest::~RedisTest() void RedisTest::setUp() { - } @@ -89,11 +88,11 @@ void RedisTest::testAPPEND() std::string result = _redis.execute(setCommand); assert(result.compare("OK") == 0); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::BadCastException& e) + catch (Poco::BadCastException& e) { fail(e.message()); } @@ -104,11 +103,11 @@ void RedisTest::testAPPEND() Poco::Int64 result = _redis.execute(appendCommand); assert(result == 11); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::BadCastException& e) + catch (Poco::BadCastException& e) { fail(e.message()); } @@ -119,16 +118,17 @@ void RedisTest::testAPPEND() BulkString result = _redis.execute(getCommand); assert(result.value().compare("Hello World") == 0); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::BadCastException& e) + catch (Poco::BadCastException& e) { fail(e.message()); } } + void RedisTest::testBLPOP() { if (!_connected) @@ -146,11 +146,11 @@ void RedisTest::testBLPOP() { _redis.execute(delCommand); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::BadCastException& e) + catch (Poco::BadCastException& e) { fail(e.message()); } @@ -166,7 +166,7 @@ void RedisTest::testBLPOP() Poco::Int64 result = _redis.execute(rpush); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -179,12 +179,13 @@ void RedisTest::testBLPOP() assert(result.get(0).value().compare("list1") == 0); assert(result.get(1).value().compare("a") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testBRPOP() { if (!_connected) @@ -202,11 +203,11 @@ void RedisTest::testBRPOP() { _redis.execute(delCommand); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::BadCastException& e) + catch (Poco::BadCastException& e) { fail(e.message()); } @@ -222,7 +223,7 @@ void RedisTest::testBRPOP() Poco::Int64 result = _redis.execute(rpush); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -235,12 +236,13 @@ void RedisTest::testBRPOP() assert(result.get(0).value().compare("list1") == 0); assert(result.get(1).value().compare("c") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testDECR() { if (!_connected) @@ -255,7 +257,7 @@ void RedisTest::testDECR() std::string result = _redis.execute(set); assert(result.compare("OK") == 0); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } @@ -266,7 +268,7 @@ void RedisTest::testDECR() Poco::Int64 result = _redis.execute(decr); assert(result == 9); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } @@ -277,7 +279,7 @@ void RedisTest::testDECR() std::string result = _redis.execute(set); assert(result.compare("OK") == 0); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } @@ -287,13 +289,14 @@ void RedisTest::testDECR() Poco::Int64 result = _redis.execute(decr); fail("This must fail"); } - catch(RedisException& e) + catch (RedisException& e) { // ERR value is not an integer or out of range } } + void RedisTest::testECHO() { if (!_connected) @@ -312,12 +315,13 @@ void RedisTest::testECHO() assert(!result.isNull()); assert(result.value().compare("Hello World") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testError() { if (!_connected) @@ -334,12 +338,13 @@ void RedisTest::testError() BulkString result = _redis.execute(command); fail("Invalid command must throw RedisException"); } - catch(RedisException &e) + catch (RedisException& e) { // Must fail } } + void RedisTest::testEVAL() { if (!_connected) @@ -368,13 +373,14 @@ void RedisTest::testEVAL() BulkString s = a.get(1); assert(s.value().compare("Hello World!") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testHDEL() { if (!_connected) @@ -391,7 +397,7 @@ void RedisTest::testHDEL() Poco::Int64 value = _redis.execute(hset); assert(value == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -402,7 +408,7 @@ void RedisTest::testHDEL() Poco::Int64 result = _redis.execute(hdel); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -413,12 +419,13 @@ void RedisTest::testHDEL() Poco::Int64 result = _redis.execute(hdel); assert(result == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testHEXISTS() { if (!_connected) @@ -435,7 +442,7 @@ void RedisTest::testHEXISTS() Poco::Int64 value = _redis.execute(hset); assert(value == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -446,7 +453,7 @@ void RedisTest::testHEXISTS() Poco::Int64 result = _redis.execute(hexists); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -457,12 +464,13 @@ void RedisTest::testHEXISTS() Poco::Int64 result = _redis.execute(hexists); assert(result == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testHGETALL() { if (!_connected) @@ -479,7 +487,7 @@ void RedisTest::testHGETALL() Poco::Int64 value = _redis.execute(hset); assert(value == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -490,7 +498,7 @@ void RedisTest::testHGETALL() Poco::Int64 value = _redis.execute(hset); assert(value == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -501,12 +509,13 @@ void RedisTest::testHGETALL() Array result = _redis.execute(hgetall); assert(result.size() == 4); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testHINCRBY() { if (!_connected) @@ -523,7 +532,7 @@ void RedisTest::testHINCRBY() Poco::Int64 value = _redis.execute(hset); assert(value == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -534,7 +543,7 @@ void RedisTest::testHINCRBY() Poco::Int64 n = _redis.execute(hincrby); assert(n == 6); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -545,7 +554,7 @@ void RedisTest::testHINCRBY() Poco::Int64 n = _redis.execute(hincrby); assert(n == 5); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -556,12 +565,13 @@ void RedisTest::testHINCRBY() Poco::Int64 n = _redis.execute(hincrby); assert(n == -5); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testHKEYS() { if (!_connected) @@ -578,7 +588,7 @@ void RedisTest::testHKEYS() Poco::Int64 value = _redis.execute(hset); assert(value == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -589,7 +599,7 @@ void RedisTest::testHKEYS() Poco::Int64 value = _redis.execute(hset); assert(value == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -600,7 +610,7 @@ void RedisTest::testHKEYS() Poco::Int64 value = _redis.execute(hlen); assert(value == 2); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -613,12 +623,13 @@ void RedisTest::testHKEYS() assert(result.get(0).value().compare("field1") == 0); assert(result.get(1).value().compare("field2") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testHMGET() { if (!_connected) @@ -635,7 +646,7 @@ void RedisTest::testHMGET() Poco::Int64 value = _redis.execute(hset); assert(value == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -646,7 +657,7 @@ void RedisTest::testHMGET() Poco::Int64 value = _redis.execute(hset); assert(value == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -665,12 +676,13 @@ void RedisTest::testHMGET() assert(result.get(1).value().compare("World") == 0); assert(result.get(2).isNull()); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testHSET() { if (!_connected) @@ -687,7 +699,7 @@ void RedisTest::testHSET() Poco::Int64 value = _redis.execute(hset); assert(value == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -698,12 +710,13 @@ void RedisTest::testHSET() BulkString s = _redis.execute(hget); assert(s.value().compare("Hello") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testHMSET() { if (!_connected) @@ -724,7 +737,7 @@ void RedisTest::testHMSET() std::string result = _redis.execute(hmset); assert(result.compare("OK") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -735,7 +748,7 @@ void RedisTest::testHMSET() BulkString s = _redis.execute(hget); assert(s.value().compare("Hello") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -746,13 +759,14 @@ void RedisTest::testHMSET() BulkString s = _redis.execute(hget); assert(s.value().compare("World") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testHSTRLEN() { if (!_connected) @@ -774,7 +788,7 @@ void RedisTest::testHSTRLEN() std::string result = _redis.execute(hmset); assert(result.compare("OK") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -785,7 +799,7 @@ void RedisTest::testHSTRLEN() Poco::Int64 len = _redis.execute(hstrlen); assert(len == 10); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -796,7 +810,7 @@ void RedisTest::testHSTRLEN() Poco::Int64 len = _redis.execute(hstrlen); assert(len == 2); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -807,12 +821,13 @@ void RedisTest::testHSTRLEN() Poco::Int64 len = _redis.execute(hstrlen); assert(len == 4); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testHVALS() { if (!_connected) @@ -833,7 +848,7 @@ void RedisTest::testHVALS() std::string result = _redis.execute(hmset); assert(result.compare("OK") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -846,12 +861,13 @@ void RedisTest::testHVALS() assert(result.get(0).value().compare("Hello") == 0); assert(result.get(1).value().compare("World") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testINCR() { if (!_connected) @@ -867,7 +883,7 @@ void RedisTest::testINCR() std::string result = _redis.execute(command); assert(result.compare("OK") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -878,12 +894,13 @@ void RedisTest::testINCR() Poco::Int64 value = _redis.execute(command); assert(value == 11); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testINCRBY() { if (!_connected) @@ -899,7 +916,7 @@ void RedisTest::testINCRBY() std::string result = _redis.execute(command); assert(result.compare("OK") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -910,12 +927,13 @@ void RedisTest::testINCRBY() Poco::Int64 value = _redis.execute(command); assert(value == 15); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testPING() { if (!_connected) @@ -933,7 +951,7 @@ void RedisTest::testPING() std::string result = _redis.execute(command); assert(result.compare("PONG") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -946,13 +964,14 @@ void RedisTest::testPING() assert(!result.isNull()); assert(result.value().compare("Hello") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testLPOP() { if (!_connected) @@ -978,7 +997,7 @@ void RedisTest::testLPOP() result = _redis.execute(rpush); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -989,7 +1008,7 @@ void RedisTest::testLPOP() BulkString result = _redis.execute(lpop); assert(result.value().compare("one") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1003,17 +1022,18 @@ void RedisTest::testLPOP() assert(result.get(0).value().compare("two") == 0); assert(result.get(1).value().compare("three") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::NullValueException &e) + catch (Poco::NullValueException& e) { fail(e.message()); } } + void RedisTest::testLSET() { if (!_connected) @@ -1039,7 +1059,7 @@ void RedisTest::testLSET() result = _redis.execute(rpush); assert(result == 3); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } @@ -1049,7 +1069,7 @@ void RedisTest::testLSET() { std::string result = _redis.execute(lset); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } @@ -1059,7 +1079,7 @@ void RedisTest::testLSET() { std::string result = _redis.execute(lset); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } @@ -1074,16 +1094,18 @@ void RedisTest::testLSET() assert(result.get(1).value().compare("five") == 0); assert(result.get(2).value().compare("three") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::NullValueException &e) + catch (Poco::NullValueException& e) { fail(e.message()); } } + + void RedisTest::testLINDEX() { if (!_connected) @@ -1105,7 +1127,7 @@ void RedisTest::testLINDEX() result = _redis.execute(lpush); assert(result == 2); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1116,12 +1138,13 @@ void RedisTest::testLINDEX() BulkString result = _redis.execute(lindex); assert(result.value().compare("Hello") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testLINSERT() { if (!_connected) @@ -1155,20 +1178,21 @@ void RedisTest::testLINSERT() assert(range.get(1).value().compare("There") == 0); assert(range.get(2).value().compare("World") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::BadCastException &e) + catch (Poco::BadCastException& e) { fail(e.message()); } - catch(Poco::NullValueException &e) + catch (Poco::NullValueException& e) { fail(e.message()); } } + void RedisTest::testLREM() { if (!_connected) @@ -1191,7 +1215,7 @@ void RedisTest::testLREM() Poco::Int64 result = _redis.execute(rpush); assert(result == 4); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1202,11 +1226,11 @@ void RedisTest::testLREM() Poco::Int64 n = _redis.execute(lrem); assert(n == 2); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::BadCastException& e) + catch (Poco::BadCastException& e) { fail(e.message()); } @@ -1220,16 +1244,17 @@ void RedisTest::testLREM() assert(result.get(0).value().compare("hello") == 0); assert(result.get(1).value().compare("foo") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::NullValueException &e) + catch (Poco::NullValueException& e) { fail(e.message()); } } + void RedisTest::testLTRIM() { if (!_connected) @@ -1255,7 +1280,7 @@ void RedisTest::testLTRIM() result = _redis.execute(rpush); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1266,7 +1291,7 @@ void RedisTest::testLTRIM() std::string result = _redis.execute(ltrim); assert(result.compare("OK") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1280,17 +1305,18 @@ void RedisTest::testLTRIM() assert(result.get(0).value().compare("two") == 0); assert(result.get(1).value().compare("three") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::NullValueException &e) + catch (Poco::NullValueException& e) { fail(e.message()); } } + void RedisTest::testMSET() { if (!_connected) @@ -1308,7 +1334,7 @@ void RedisTest::testMSET() std::string result = _redis.execute(command); assert(result.compare("OK") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1332,16 +1358,17 @@ void RedisTest::testMSET() value = result.get(2); assert(value.isNull()); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::BadCastException& e) + catch (Poco::BadCastException& e) { fail(e.message()); } } + void RedisTest::testMSETWithMap() { if (!_connected) @@ -1362,7 +1389,7 @@ void RedisTest::testMSETWithMap() std::string result = _redis.execute(mset); assert(result.compare("OK") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1387,16 +1414,17 @@ void RedisTest::testMSETWithMap() value = result.get(2); assert(value.isNull()); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::BadCastException& e) + catch (Poco::BadCastException& e) { fail(e.message()); } } + void RedisTest::testMULTI() { if (!_connected) @@ -1416,11 +1444,11 @@ void RedisTest::testMULTI() std::string result = _redis.execute(command); assert(result.compare("OK") == 0); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::BadCastException& e) + catch (Poco::BadCastException& e) { fail(e.message()); } @@ -1433,11 +1461,11 @@ void RedisTest::testMULTI() std::string result = _redis.execute(command); assert(result.compare("QUEUED") == 0); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::BadCastException& e) + catch (Poco::BadCastException& e) { fail(e.message()); } @@ -1450,11 +1478,11 @@ void RedisTest::testMULTI() std::string result = _redis.execute(command); assert(result.compare("QUEUED") == 0); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::BadCastException& e) + catch (Poco::BadCastException& e) { fail(e.message()); } @@ -1471,16 +1499,17 @@ void RedisTest::testMULTI() v = result.get(1); assert(v == 1); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::BadCastException& e) + catch (Poco::BadCastException& e) { fail(e.message()); } } + void RedisTest::testPipeliningWithSendCommands() { if (!_connected) @@ -1502,20 +1531,21 @@ void RedisTest::testPipeliningWithSendCommands() assert(result.size() == 2); // The 2 results must be simple PONG strings - for(size_t i = 0; i < 2; ++i) + for (size_t i = 0; i < 2; ++i) { try { std::string pong = result.get(i); assert(pong.compare("PONG") == 0); } - catch(...) + catch (...) { fail("An exception occurred"); } } } + void RedisTest::testPipeliningWithWriteCommand() { if (!_connected) @@ -1532,7 +1562,7 @@ void RedisTest::testPipeliningWithWriteCommand() _redis.flush(); // We expect 2 results with simple "PONG" strings - for(int i = 0; i < 2; ++i) + for (int i = 0; i < 2; ++i) { std::string pong; try @@ -1540,33 +1570,33 @@ void RedisTest::testPipeliningWithWriteCommand() _redis.readReply(pong); assert(pong.compare("PONG") == 0); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } } } + class RedisSubscriber { public: - void onMessage(const void* pSender, RedisEventArgs& args) { - if ( ! args.message().isNull() ) + if (!args.message().isNull()) { Type* arrayType = dynamic_cast*>(args.message().get()); - if ( arrayType != NULL ) + if (arrayType != NULL) { Array& array = arrayType->value(); - if ( array.size() == 3 ) + if (array.size() == 3) { BulkString type = array.get(0); - if ( type.value().compare("unsubscribe") == 0 ) + if (type.value().compare("unsubscribe") == 0) { Poco::Int64 n = array.get(2); // When 0, no subscribers anymore, so stop reading ... - if ( n == 0 ) args.stop(); + if (n == 0) args.stop(); } } else @@ -1589,9 +1619,9 @@ public: // No need to call stop, AsyncReader stops automatically when an // exception is received. } - }; + void RedisTest::testPubSub() { if (!_connected) @@ -1623,6 +1653,7 @@ void RedisTest::testPubSub() _redis.flush(); } + void RedisTest::testSADD() { if (!_connected) @@ -1639,7 +1670,7 @@ void RedisTest::testSADD() Poco::Int64 result = _redis.execute(sadd); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1650,7 +1681,7 @@ void RedisTest::testSADD() Poco::Int64 result = _redis.execute(sadd); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1661,12 +1692,13 @@ void RedisTest::testSADD() Poco::Int64 result = _redis.execute(sadd); assert(result == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testSCARD() { if (!_connected) @@ -1683,7 +1715,7 @@ void RedisTest::testSCARD() Poco::Int64 result = _redis.execute(sadd); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1694,7 +1726,7 @@ void RedisTest::testSCARD() Poco::Int64 result = _redis.execute(sadd); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1705,12 +1737,13 @@ void RedisTest::testSCARD() Poco::Int64 result = _redis.execute(scard); assert(result == 2); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testSDIFF() { if (!_connected) @@ -1732,7 +1765,7 @@ void RedisTest::testSDIFF() Poco::Int64 result = _redis.execute(sadd); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1747,7 +1780,7 @@ void RedisTest::testSDIFF() Poco::Int64 result = _redis.execute(sadd); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1758,12 +1791,13 @@ void RedisTest::testSDIFF() Array result = _redis.execute(sdiff); assert(result.size() == 2); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testSDIFFSTORE() { if (!_connected) @@ -1786,7 +1820,7 @@ void RedisTest::testSDIFFSTORE() Poco::Int64 result = _redis.execute(sadd); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1801,7 +1835,7 @@ void RedisTest::testSDIFFSTORE() Poco::Int64 result = _redis.execute(sadd); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1812,7 +1846,7 @@ void RedisTest::testSDIFFSTORE() Poco::Int64 result = _redis.execute(sdiffstore); assert(result == 2); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1823,12 +1857,13 @@ void RedisTest::testSDIFFSTORE() Array result = _redis.execute(smembers); assert(result.size() == 2); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testSET() { if (!_connected) @@ -1846,7 +1881,7 @@ void RedisTest::testSET() std::string result = _redis.execute(command); assert(result.compare("OK") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1859,7 +1894,7 @@ void RedisTest::testSET() BulkString result = _redis.execute(command); assert(result.isNull()); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1887,7 +1922,7 @@ void RedisTest::testSINTER() Poco::Int64 result = _redis.execute(sadd); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1902,7 +1937,7 @@ void RedisTest::testSINTER() Poco::Int64 result = _redis.execute(sadd); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1914,12 +1949,13 @@ void RedisTest::testSINTER() assert(result.size() == 1); assert(result.get(0).value().compare("c") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testSINTERSTORE() { if (!_connected) @@ -1942,7 +1978,7 @@ void RedisTest::testSINTERSTORE() Poco::Int64 result = _redis.execute(sadd); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1957,7 +1993,7 @@ void RedisTest::testSINTERSTORE() Poco::Int64 result = _redis.execute(sadd); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1968,7 +2004,7 @@ void RedisTest::testSINTERSTORE() Poco::Int64 result = _redis.execute(sinterstore); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -1980,12 +2016,13 @@ void RedisTest::testSINTERSTORE() assert(result.size() == 1); assert(result.get(0).value().compare("c") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testSISMEMBER() { if (!_connected) @@ -2002,7 +2039,7 @@ void RedisTest::testSISMEMBER() Poco::Int64 result = _redis.execute(sadd); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2013,7 +2050,7 @@ void RedisTest::testSISMEMBER() Poco::Int64 result = _redis.execute(sismember); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2024,12 +2061,13 @@ void RedisTest::testSISMEMBER() Poco::Int64 result = _redis.execute(sismember); assert(result == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testSMEMBERS() { if (!_connected) @@ -2046,7 +2084,7 @@ void RedisTest::testSMEMBERS() Poco::Int64 result = _redis.execute(sadd); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2057,7 +2095,7 @@ void RedisTest::testSMEMBERS() Poco::Int64 result = _redis.execute(sadd); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2068,12 +2106,13 @@ void RedisTest::testSMEMBERS() Array result = _redis.execute(smembers); assert(result.size() == 2); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testSMOVE() { if (!_connected) @@ -2091,7 +2130,7 @@ void RedisTest::testSMOVE() Poco::Int64 result = _redis.execute(sadd); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2102,7 +2141,7 @@ void RedisTest::testSMOVE() Poco::Int64 result = _redis.execute(sadd); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2113,7 +2152,7 @@ void RedisTest::testSMOVE() Poco::Int64 result = _redis.execute(sadd); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2124,7 +2163,7 @@ void RedisTest::testSMOVE() Poco::Int64 result = _redis.execute(smove); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2136,7 +2175,7 @@ void RedisTest::testSMOVE() assert(result.size() == 1); assert(result.get(0).value().compare("one") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2147,12 +2186,13 @@ void RedisTest::testSMOVE() Array result = _redis.execute(smembers); assert(result.size() == 2); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testSPOP() { if (!_connected) @@ -2169,7 +2209,7 @@ void RedisTest::testSPOP() Poco::Int64 result = _redis.execute(sadd); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2180,7 +2220,7 @@ void RedisTest::testSPOP() Poco::Int64 result = _redis.execute(sadd); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2191,7 +2231,7 @@ void RedisTest::testSPOP() Poco::Int64 result = _redis.execute(sadd); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2202,7 +2242,7 @@ void RedisTest::testSPOP() BulkString result = _redis.execute(spop); assert(!result.isNull()); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2213,7 +2253,7 @@ void RedisTest::testSPOP() Array result = _redis.execute(smembers); assert(result.size() == 2); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2224,7 +2264,7 @@ void RedisTest::testSPOP() Poco::Int64 result = _redis.execute(sadd); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2235,7 +2275,7 @@ void RedisTest::testSPOP() Poco::Int64 result = _redis.execute(sadd); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2247,13 +2287,14 @@ void RedisTest::testSPOP() Array result = _redis.execute(spop); assert(result.size() == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } */ } + void RedisTest::testSRANDMEMBER() { if (!_connected) @@ -2275,7 +2316,7 @@ void RedisTest::testSRANDMEMBER() Poco::Int64 result = _redis.execute(sadd); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2286,7 +2327,7 @@ void RedisTest::testSRANDMEMBER() BulkString result = _redis.execute(srandmember); assert(!result.isNull()); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2297,7 +2338,7 @@ void RedisTest::testSRANDMEMBER() Array result = _redis.execute(srandmember); assert(result.size() == 2); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2308,12 +2349,13 @@ void RedisTest::testSRANDMEMBER() Array result = _redis.execute(srandmember); assert(result.size() == 5); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testSTRLEN() { if (!_connected) @@ -2331,7 +2373,7 @@ void RedisTest::testSTRLEN() std::string result = _redis.execute(command); assert(result.compare("OK") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2346,12 +2388,13 @@ void RedisTest::testSTRLEN() assert(result == 11); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testSREM() { if (!_connected) @@ -2368,7 +2411,7 @@ void RedisTest::testSREM() Poco::Int64 result = _redis.execute(sadd); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2378,7 +2421,7 @@ void RedisTest::testSREM() Poco::Int64 result = _redis.execute(sadd); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2388,7 +2431,7 @@ void RedisTest::testSREM() Poco::Int64 result = _redis.execute(sadd); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2399,7 +2442,7 @@ void RedisTest::testSREM() Poco::Int64 result = _redis.execute(srem); assert(result == 1); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2410,7 +2453,7 @@ void RedisTest::testSREM() Poco::Int64 result = _redis.execute(srem); assert(result == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2421,12 +2464,13 @@ void RedisTest::testSREM() Array result = _redis.execute(smembers); assert(result.size() == 2); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testSUNION() { if (!_connected) @@ -2448,7 +2492,7 @@ void RedisTest::testSUNION() Poco::Int64 result = _redis.execute(sadd); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2463,7 +2507,7 @@ void RedisTest::testSUNION() Poco::Int64 result = _redis.execute(sadd); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2474,12 +2518,13 @@ void RedisTest::testSUNION() Array result = _redis.execute(sunion); assert(result.size() == 5); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testSUNIONSTORE() { if (!_connected) @@ -2502,7 +2547,7 @@ void RedisTest::testSUNIONSTORE() Poco::Int64 result = _redis.execute(sadd); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2517,7 +2562,7 @@ void RedisTest::testSUNIONSTORE() Poco::Int64 result = _redis.execute(sadd); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2528,7 +2573,7 @@ void RedisTest::testSUNIONSTORE() Poco::Int64 result = _redis.execute(sunionstore); assert(result == 5); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2539,12 +2584,13 @@ void RedisTest::testSUNIONSTORE() Array result = _redis.execute(smembers); assert(result.size() == 5); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testRENAME() { if (!_connected) @@ -2559,7 +2605,7 @@ void RedisTest::testRENAME() std::string result = _redis.execute(set); assert(result.compare("OK") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2570,7 +2616,7 @@ void RedisTest::testRENAME() std::string result = _redis.execute(rename); assert(result.compare("OK") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2581,12 +2627,13 @@ void RedisTest::testRENAME() BulkString result = _redis.execute(get); assert(result.value().compare("Hello") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testRENAMENX() { if (!_connected) @@ -2601,7 +2648,7 @@ void RedisTest::testRENAMENX() std::string result = _redis.execute(set); assert(result.compare("OK") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2612,7 +2659,7 @@ void RedisTest::testRENAMENX() std::string result = _redis.execute(set); assert(result.compare("OK") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2623,7 +2670,7 @@ void RedisTest::testRENAMENX() Poco::Int64 result = _redis.execute(rename); assert(result == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2634,12 +2681,13 @@ void RedisTest::testRENAMENX() BulkString result = _redis.execute(get); assert(result.value().compare("World") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } } + void RedisTest::testRPOP() { if (!_connected) @@ -2665,7 +2713,7 @@ void RedisTest::testRPOP() result = _redis.execute(rpush); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2676,7 +2724,7 @@ void RedisTest::testRPOP() BulkString result = _redis.execute(rpop); assert(result.value().compare("three") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2690,17 +2738,18 @@ void RedisTest::testRPOP() assert(result.get(0).value().compare("one") == 0); assert(result.get(1).value().compare("two") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::NullValueException &e) + catch (Poco::NullValueException& e) { fail(e.message()); } } + void RedisTest::testRPOPLPUSH() { if (!_connected) @@ -2718,11 +2767,11 @@ void RedisTest::testRPOPLPUSH() { _redis.execute(delCommand); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::BadCastException& e) + catch (Poco::BadCastException& e) { fail(e.message()); } @@ -2741,7 +2790,7 @@ void RedisTest::testRPOPLPUSH() result = _redis.execute(rpush); assert(result == 3); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2752,7 +2801,7 @@ void RedisTest::testRPOPLPUSH() BulkString result = _redis.execute(rpoplpush); assert(result.value().compare("three") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2766,11 +2815,11 @@ void RedisTest::testRPOPLPUSH() assert(result.get(0).value().compare("one") == 0); assert(result.get(1).value().compare("two") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::NullValueException &e) + catch (Poco::NullValueException& e) { fail(e.message()); } @@ -2783,16 +2832,17 @@ void RedisTest::testRPOPLPUSH() assert(result.size() == 1); assert(result.get(0).value().compare("three") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::NullValueException &e) + catch (Poco::NullValueException& e) { fail(e.message()); } } + void RedisTest::testRPUSH() { if (!_connected) @@ -2814,7 +2864,7 @@ void RedisTest::testRPUSH() result = _redis.execute(rpush); assert(result == 2); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } @@ -2825,11 +2875,11 @@ void RedisTest::testRPUSH() Poco::Int64 n = _redis.execute(llen); assert(n == 2); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::BadCastException& e) + catch (Poco::BadCastException& e) { fail(e.message()); } @@ -2843,16 +2893,17 @@ void RedisTest::testRPUSH() assert(result.get(0).value().compare("World") == 0); assert(result.get(1).value().compare("Hello") == 0); } - catch(RedisException &e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::NullValueException &e) + catch (Poco::NullValueException& e) { fail(e.message()); } } + void RedisTest::testPool() { Poco::Net::SocketAddress sa(_host, _port); @@ -2875,6 +2926,7 @@ void RedisTest::testPool() assert(keyValue.value().compare("Hello") == 0); } + void RedisTest::delKey(const std::string& key) { Command delCommand = Command::del(key); @@ -2882,11 +2934,11 @@ void RedisTest::delKey(const std::string& key) { _redis.execute(delCommand); } - catch(RedisException& e) + catch (RedisException& e) { fail(e.message()); } - catch(Poco::BadCastException& e) + catch (Poco::BadCastException& e) { fail(e.message()); } @@ -2951,7 +3003,6 @@ CppUnit::Test* RedisTest::suite() CppUnit_addTest(pSuite, RedisTest, testRPOP); CppUnit_addTest(pSuite, RedisTest, testRPOPLPUSH); CppUnit_addTest(pSuite, RedisTest, testRPUSH); - CppUnit_addTest(pSuite, RedisTest, testPool); return pSuite; diff --git a/Redis/testsuite/src/RedisTest.h b/Redis/testsuite/src/RedisTest.h index 9fb9bb9a2..b1c1bc75d 100644 --- a/Redis/testsuite/src/RedisTest.h +++ b/Redis/testsuite/src/RedisTest.h @@ -5,7 +5,7 @@ // // Definition of the RedisTest class. // -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 @@ -18,7 +18,6 @@ #include "Poco/Redis/Redis.h" #include "Poco/Redis/Client.h" - #include "Poco/CppUnit/TestCase.h" diff --git a/Redis/testsuite/src/RedisTestSuite.cpp b/Redis/testsuite/src/RedisTestSuite.cpp index f2e806a73..f3fea9c3f 100644 --- a/Redis/testsuite/src/RedisTestSuite.cpp +++ b/Redis/testsuite/src/RedisTestSuite.cpp @@ -3,7 +3,7 @@ // // $Id$ // -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 diff --git a/Redis/testsuite/src/RedisTestSuite.h b/Redis/testsuite/src/RedisTestSuite.h index d8919cd8d..2c957fa1d 100644 --- a/Redis/testsuite/src/RedisTestSuite.h +++ b/Redis/testsuite/src/RedisTestSuite.h @@ -5,7 +5,7 @@ // // Definition of the RedisTestSuite class. // -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 diff --git a/Redis/testsuite/src/WinCEDriver.cpp b/Redis/testsuite/src/WinCEDriver.cpp index 7f98d56fa..4243f706a 100644 --- a/Redis/testsuite/src/WinCEDriver.cpp +++ b/Redis/testsuite/src/WinCEDriver.cpp @@ -5,7 +5,7 @@ // // Console-based test driver for Windows CE. // -// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 diff --git a/Redis/testsuite/src/WinDriver.cpp b/Redis/testsuite/src/WinDriver.cpp index f1d37cd3a..7b3adb48b 100644 --- a/Redis/testsuite/src/WinDriver.cpp +++ b/Redis/testsuite/src/WinDriver.cpp @@ -5,7 +5,7 @@ // // Windows test driver for Poco MongoDB. // -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 From 5c0272cce389f11c6c5e91e53abd8b1ad9da67fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Mon, 5 Sep 2016 08:21:54 +0200 Subject: [PATCH 17/31] Revert "GH #1050 XML-tests: fix gcc -Wshadow warnings" --- XML/testsuite/src/AttributesImplTest.cpp | 2 +- XML/testsuite/src/ChildNodesTest.cpp | 2 +- XML/testsuite/src/DocumentTest.cpp | 2 +- XML/testsuite/src/DocumentTypeTest.cpp | 2 +- XML/testsuite/src/ElementTest.cpp | 2 +- XML/testsuite/src/EventTest.cpp | 2 +- XML/testsuite/src/NamePoolTest.cpp | 8 ++++---- XML/testsuite/src/NameTest.cpp | 22 +++++++++++----------- XML/testsuite/src/NamespaceSupportTest.cpp | 2 +- XML/testsuite/src/NodeAppenderTest.cpp | 2 +- XML/testsuite/src/NodeIteratorTest.cpp | 2 +- XML/testsuite/src/NodeTest.cpp | 2 +- XML/testsuite/src/ParserWriterTest.cpp | 2 +- XML/testsuite/src/SAXParserTest.cpp | 2 +- XML/testsuite/src/TextTest.cpp | 2 +- XML/testsuite/src/TreeWalkerTest.cpp | 2 +- XML/testsuite/src/XMLStreamParserTest.cpp | 4 ++-- XML/testsuite/src/XMLWriterTest.cpp | 2 +- 18 files changed, 32 insertions(+), 32 deletions(-) diff --git a/XML/testsuite/src/AttributesImplTest.cpp b/XML/testsuite/src/AttributesImplTest.cpp index 0e748b45c..3becee606 100644 --- a/XML/testsuite/src/AttributesImplTest.cpp +++ b/XML/testsuite/src/AttributesImplTest.cpp @@ -19,7 +19,7 @@ using Poco::XML::AttributesImpl; -AttributesImplTest::AttributesImplTest(const std::string& rName): CppUnit::TestCase(rName) +AttributesImplTest::AttributesImplTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/XML/testsuite/src/ChildNodesTest.cpp b/XML/testsuite/src/ChildNodesTest.cpp index c0c3e73a7..cbf301a12 100644 --- a/XML/testsuite/src/ChildNodesTest.cpp +++ b/XML/testsuite/src/ChildNodesTest.cpp @@ -26,7 +26,7 @@ using Poco::XML::Node; using Poco::XML::AutoPtr; -ChildNodesTest::ChildNodesTest(const std::string& rName): CppUnit::TestCase(rName) +ChildNodesTest::ChildNodesTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/XML/testsuite/src/DocumentTest.cpp b/XML/testsuite/src/DocumentTest.cpp index b34c351e8..7cf529098 100644 --- a/XML/testsuite/src/DocumentTest.cpp +++ b/XML/testsuite/src/DocumentTest.cpp @@ -31,7 +31,7 @@ using Poco::XML::XMLString; using Poco::XML::DOMException; -DocumentTest::DocumentTest(const std::string& rName): CppUnit::TestCase(rName) +DocumentTest::DocumentTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/XML/testsuite/src/DocumentTypeTest.cpp b/XML/testsuite/src/DocumentTypeTest.cpp index 28458046c..0cb830bea 100644 --- a/XML/testsuite/src/DocumentTypeTest.cpp +++ b/XML/testsuite/src/DocumentTypeTest.cpp @@ -31,7 +31,7 @@ using Poco::XML::NamedNodeMap; using Poco::XML::AutoPtr; -DocumentTypeTest::DocumentTypeTest(const std::string& rName): CppUnit::TestCase(rName) +DocumentTypeTest::DocumentTypeTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/XML/testsuite/src/ElementTest.cpp b/XML/testsuite/src/ElementTest.cpp index 3b923168a..f62aa1c62 100644 --- a/XML/testsuite/src/ElementTest.cpp +++ b/XML/testsuite/src/ElementTest.cpp @@ -33,7 +33,7 @@ using Poco::XML::AutoPtr; using Poco::XML::XMLString; -ElementTest::ElementTest(const std::string& rName): CppUnit::TestCase(rName) +ElementTest::ElementTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/XML/testsuite/src/EventTest.cpp b/XML/testsuite/src/EventTest.cpp index 1128b1dc5..2b654c579 100644 --- a/XML/testsuite/src/EventTest.cpp +++ b/XML/testsuite/src/EventTest.cpp @@ -133,7 +133,7 @@ private: XMLString TestEventListener::_log; -EventTest::EventTest(const std::string& rName): CppUnit::TestCase(rName) +EventTest::EventTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/XML/testsuite/src/NamePoolTest.cpp b/XML/testsuite/src/NamePoolTest.cpp index 776794ee7..2ef21927e 100644 --- a/XML/testsuite/src/NamePoolTest.cpp +++ b/XML/testsuite/src/NamePoolTest.cpp @@ -23,7 +23,7 @@ using Poco::XML::Name; using Poco::XML::AutoPtr; -NamePoolTest::NamePoolTest(const std::string& rName): CppUnit::TestCase(rName) +NamePoolTest::NamePoolTest(const std::string& name): CppUnit::TestCase(name) { } @@ -37,16 +37,16 @@ void NamePoolTest::testNamePool() { AutoPtr pool = new NamePool; const Name* pName = 0; - Name xmlName("pre:local", "http://www.appinf.com"); + Name name("pre:local", "http://www.appinf.com"); - pName = &pool->insert(xmlName); + pName = &pool->insert(name); const Name* pName2 = &pool->insert("pre:local", "http://www.appinf.com", "local"); assert (pName == pName2); pName2 = &pool->insert("pre:local2", "http://www.appinf.com", "local2"); assert (pName2 != pName); - pName2 = &pool->insert(xmlName); + pName2 = &pool->insert(name); assert (pName2 == pName); pName2 = &pool->insert(*pName); diff --git a/XML/testsuite/src/NameTest.cpp b/XML/testsuite/src/NameTest.cpp index dac17ca50..e611fbcb0 100644 --- a/XML/testsuite/src/NameTest.cpp +++ b/XML/testsuite/src/NameTest.cpp @@ -19,7 +19,7 @@ using Poco::XML::Name; -NameTest::NameTest(const std::string& rName): CppUnit::TestCase(rName) +NameTest::NameTest(const std::string& name): CppUnit::TestCase(name) { } @@ -81,18 +81,18 @@ void NameTest::testPrefix() void NameTest::testName() { std::string qname = "name"; - Name xmlName(qname); - assert (xmlName.qname() == "name"); - assert (xmlName.prefix().empty()); - assert (xmlName.namespaceURI().empty()); - assert (xmlName.localName().empty()); + Name name(qname); + assert (name.qname() == "name"); + assert (name.prefix().empty()); + assert (name.namespaceURI().empty()); + assert (name.localName().empty()); qname.clear(); - xmlName.assign(qname, "http://www.appinf.com/", "local"); - assert (xmlName.qname().empty()); - assert (xmlName.prefix().empty()); - assert (xmlName.namespaceURI() == "http://www.appinf.com/"); - assert (xmlName.localName() == "local"); + name.assign(qname, "http://www.appinf.com/", "local"); + assert (name.qname().empty()); + assert (name.prefix().empty()); + assert (name.namespaceURI() == "http://www.appinf.com/"); + assert (name.localName() == "local"); Name name2("pre:local", "http://www.appinf.com/"); assert (name2.qname() == "pre:local"); diff --git a/XML/testsuite/src/NamespaceSupportTest.cpp b/XML/testsuite/src/NamespaceSupportTest.cpp index 0ffd7c31e..7111448b4 100644 --- a/XML/testsuite/src/NamespaceSupportTest.cpp +++ b/XML/testsuite/src/NamespaceSupportTest.cpp @@ -19,7 +19,7 @@ using Poco::XML::NamespaceSupport; -NamespaceSupportTest::NamespaceSupportTest(const std::string& rName): CppUnit::TestCase(rName) +NamespaceSupportTest::NamespaceSupportTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/XML/testsuite/src/NodeAppenderTest.cpp b/XML/testsuite/src/NodeAppenderTest.cpp index 64464cbeb..fce137d57 100644 --- a/XML/testsuite/src/NodeAppenderTest.cpp +++ b/XML/testsuite/src/NodeAppenderTest.cpp @@ -28,7 +28,7 @@ using Poco::XML::AutoPtr; using Poco::XML::XMLString; -NodeAppenderTest::NodeAppenderTest(const std::string& rName): CppUnit::TestCase(rName) +NodeAppenderTest::NodeAppenderTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/XML/testsuite/src/NodeIteratorTest.cpp b/XML/testsuite/src/NodeIteratorTest.cpp index 89145a72a..8584fa174 100644 --- a/XML/testsuite/src/NodeIteratorTest.cpp +++ b/XML/testsuite/src/NodeIteratorTest.cpp @@ -46,7 +46,7 @@ namespace } -NodeIteratorTest::NodeIteratorTest(const std::string& rName): CppUnit::TestCase(rName) +NodeIteratorTest::NodeIteratorTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/XML/testsuite/src/NodeTest.cpp b/XML/testsuite/src/NodeTest.cpp index d131e003d..0a774fba7 100644 --- a/XML/testsuite/src/NodeTest.cpp +++ b/XML/testsuite/src/NodeTest.cpp @@ -26,7 +26,7 @@ using Poco::XML::Node; using Poco::XML::AutoPtr; -NodeTest::NodeTest(const std::string& rName): CppUnit::TestCase(rName) +NodeTest::NodeTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/XML/testsuite/src/ParserWriterTest.cpp b/XML/testsuite/src/ParserWriterTest.cpp index 9c64615b7..c2702a890 100644 --- a/XML/testsuite/src/ParserWriterTest.cpp +++ b/XML/testsuite/src/ParserWriterTest.cpp @@ -32,7 +32,7 @@ using Poco::XML::AutoPtr; using Poco::XML::InputSource; -ParserWriterTest::ParserWriterTest(const std::string& rName): CppUnit::TestCase(rName) +ParserWriterTest::ParserWriterTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/XML/testsuite/src/SAXParserTest.cpp b/XML/testsuite/src/SAXParserTest.cpp index cd4a4cfa7..24a3063ed 100644 --- a/XML/testsuite/src/SAXParserTest.cpp +++ b/XML/testsuite/src/SAXParserTest.cpp @@ -64,7 +64,7 @@ public: }; -SAXParserTest::SAXParserTest(const std::string& rName): CppUnit::TestCase(rName) +SAXParserTest::SAXParserTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/XML/testsuite/src/TextTest.cpp b/XML/testsuite/src/TextTest.cpp index 90e17c01c..713032eef 100644 --- a/XML/testsuite/src/TextTest.cpp +++ b/XML/testsuite/src/TextTest.cpp @@ -28,7 +28,7 @@ using Poco::XML::AutoPtr; using Poco::XML::XMLString; -TextTest::TextTest(const std::string& rName): CppUnit::TestCase(rName) +TextTest::TextTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/XML/testsuite/src/TreeWalkerTest.cpp b/XML/testsuite/src/TreeWalkerTest.cpp index f5a696c7b..d7dbe28e5 100644 --- a/XML/testsuite/src/TreeWalkerTest.cpp +++ b/XML/testsuite/src/TreeWalkerTest.cpp @@ -57,7 +57,7 @@ namespace } -TreeWalkerTest::TreeWalkerTest(const std::string& rName): CppUnit::TestCase(rName) +TreeWalkerTest::TreeWalkerTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/XML/testsuite/src/XMLStreamParserTest.cpp b/XML/testsuite/src/XMLStreamParserTest.cpp index c3120f3ea..058687573 100644 --- a/XML/testsuite/src/XMLStreamParserTest.cpp +++ b/XML/testsuite/src/XMLStreamParserTest.cpp @@ -23,8 +23,8 @@ using namespace Poco::XML; -XMLStreamParserTest::XMLStreamParserTest(const std::string& rName): - CppUnit::TestCase(rName) +XMLStreamParserTest::XMLStreamParserTest(const std::string& name): + CppUnit::TestCase(name) { } diff --git a/XML/testsuite/src/XMLWriterTest.cpp b/XML/testsuite/src/XMLWriterTest.cpp index 6fe08b608..1a4c79078 100644 --- a/XML/testsuite/src/XMLWriterTest.cpp +++ b/XML/testsuite/src/XMLWriterTest.cpp @@ -23,7 +23,7 @@ using Poco::XML::XMLWriter; using Poco::XML::AttributesImpl; -XMLWriterTest::XMLWriterTest(const std::string& rName): CppUnit::TestCase(rName) +XMLWriterTest::XMLWriterTest(const std::string& name): CppUnit::TestCase(name) { } From d4382fae626040d5257a959ade0df6eea99abaee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Mon, 5 Sep 2016 08:23:50 +0200 Subject: [PATCH 18/31] Revert "GH #1050 PageCompiler: fix gcc -Wshadow warnings" --- Data/src/RecordSet.cpp | 4 +- PageCompiler/File2Page/src/File2Page.cpp | 32 +++++++-------- PageCompiler/src/ApacheCodeWriter.cpp | 4 +- PageCompiler/src/CodeWriter.cpp | 6 +-- PageCompiler/src/OSPCodeWriter.cpp | 4 +- PageCompiler/src/PageCompiler.cpp | 52 ++++++++++++------------ 6 files changed, 51 insertions(+), 51 deletions(-) diff --git a/Data/src/RecordSet.cpp b/Data/src/RecordSet.cpp index e3788706d..b630a3153 100644 --- a/Data/src/RecordSet.cpp +++ b/Data/src/RecordSet.cpp @@ -103,8 +103,8 @@ void RecordSet::reset(const Statement& stmt) _totalRowCount = UNKNOWN_TOTAL_ROW_COUNT; RowMap::iterator it = _rowMap.begin(); - RowMap::iterator itEnd = _rowMap.end(); - for (; it != itEnd; ++it) delete it->second; + RowMap::iterator end = _rowMap.end(); + for (; it != end; ++it) delete it->second; _rowMap.clear(); Statement::operator = (stmt); diff --git a/PageCompiler/File2Page/src/File2Page.cpp b/PageCompiler/File2Page/src/File2Page.cpp index 2a682382a..9fd5036ff 100644 --- a/PageCompiler/File2Page/src/File2Page.cpp +++ b/PageCompiler/File2Page/src/File2Page.cpp @@ -63,52 +63,52 @@ protected: // add your own reinitialization code here } - void defineOptions(OptionSet& rOptions) + void defineOptions(OptionSet& options) { - Application::defineOptions(rOptions); + Application::defineOptions(options); - rOptions.addOption( + options.addOption( Option("help", "h", "Display help information on command line arguments.") .required(false) .repeatable(false) .callback(OptionCallback(this, &File2PageApp::handleHelp))); - rOptions.addOption( + options.addOption( Option("contentType", "t", "Specify a content type.") .required(false) .repeatable(false) .argument("MIME-Type") .callback(OptionCallback(this, &File2PageApp::handleContentType))); - rOptions.addOption( + options.addOption( Option("contentLanguage", "l", "Specify a content language.") .required(false) .repeatable(false) .argument("language") .callback(OptionCallback(this, &File2PageApp::handleContentLang))); - rOptions.addOption( + options.addOption( Option("class", "c", "Specify the handler class name.") .required(false) .repeatable(false) .argument("class-name") .callback(OptionCallback(this, &File2PageApp::handleClassName))); - rOptions.addOption( + options.addOption( Option("namespace", "n", "Specify the handler class namespace name.") .required(false) .repeatable(false) .argument("namespace-name") .callback(OptionCallback(this, &File2PageApp::handleNamespace))); - rOptions.addOption( + options.addOption( Option("output", "o", "Specify the output file name.") .required(false) .repeatable(false) .argument("path") .callback(OptionCallback(this, &File2PageApp::handleOutput))); - rOptions.addOption( + options.addOption( Option("path", "p", "Specify the server path of the file.") .required(false) .repeatable(false) @@ -116,39 +116,39 @@ protected: .callback(OptionCallback(this, &File2PageApp::handlePath))); } - void handleHelp(const std::string& rName, const std::string& value) + void handleHelp(const std::string& name, const std::string& value) { _helpRequested = true; displayHelp(); stopOptionsProcessing(); } - void handleContentType(const std::string& rName, const std::string& value) + void handleContentType(const std::string& name, const std::string& value) { _contentType = value; } - void handleContentLang(const std::string& rName, const std::string& value) + void handleContentLang(const std::string& name, const std::string& value) { _contentLang = value; } - void handleClassName(const std::string& rName, const std::string& value) + void handleClassName(const std::string& name, const std::string& value) { _clazz = value; } - void handleNamespace(const std::string& rName, const std::string& value) + void handleNamespace(const std::string& name, const std::string& value) { _namespace = value; } - void handleOutput(const std::string& rName, const std::string& value) + void handleOutput(const std::string& name, const std::string& value) { _output = value; } - void handlePath(const std::string& rName, const std::string& value) + void handlePath(const std::string& name, const std::string& value) { _path = value; } diff --git a/PageCompiler/src/ApacheCodeWriter.cpp b/PageCompiler/src/ApacheCodeWriter.cpp index dfc6099a1..7536f5854 100644 --- a/PageCompiler/src/ApacheCodeWriter.cpp +++ b/PageCompiler/src/ApacheCodeWriter.cpp @@ -14,8 +14,8 @@ #include "Page.h" -ApacheCodeWriter::ApacheCodeWriter(const Page& rPage, const std::string& rClazz): - CodeWriter(rPage, rClazz) +ApacheCodeWriter::ApacheCodeWriter(const Page& page, const std::string& clazz): + CodeWriter(page, clazz) { } diff --git a/PageCompiler/src/CodeWriter.cpp b/PageCompiler/src/CodeWriter.cpp index 8cbf8bd7f..442f38d84 100644 --- a/PageCompiler/src/CodeWriter.cpp +++ b/PageCompiler/src/CodeWriter.cpp @@ -21,9 +21,9 @@ using Poco::Path; using Poco::StringTokenizer; -CodeWriter::CodeWriter(const Page& rPage, const std::string& rClazz): - _page(rPage), - _class(rClazz) +CodeWriter::CodeWriter(const Page& page, const std::string& clazz): + _page(page), + _class(clazz) { } diff --git a/PageCompiler/src/OSPCodeWriter.cpp b/PageCompiler/src/OSPCodeWriter.cpp index d40643606..ee085821d 100644 --- a/PageCompiler/src/OSPCodeWriter.cpp +++ b/PageCompiler/src/OSPCodeWriter.cpp @@ -15,8 +15,8 @@ #include "Poco/NumberParser.h" -OSPCodeWriter::OSPCodeWriter(const Page& rPage, const std::string& rClazz): - CodeWriter(rPage, rClazz) +OSPCodeWriter::OSPCodeWriter(const Page& page, const std::string& clazz): + CodeWriter(page, clazz) { } diff --git a/PageCompiler/src/PageCompiler.cpp b/PageCompiler/src/PageCompiler.cpp index a3ac328dd..da59a6e67 100644 --- a/PageCompiler/src/PageCompiler.cpp +++ b/PageCompiler/src/PageCompiler.cpp @@ -71,17 +71,17 @@ protected: Application::initialize(self); } - void defineOptions(OptionSet& rOptions) + void defineOptions(OptionSet& options) { - Application::defineOptions(rOptions); + Application::defineOptions(options); - rOptions.addOption( + options.addOption( Option("help", "h", "Display help information on command line arguments.") .required(false) .repeatable(false) .callback(OptionCallback(this, &CompilerApp::handleHelp))); - rOptions.addOption( + options.addOption( Option("define", "D", "Define a configuration property. A configuration property " "defined with this option can be referenced in the input " @@ -91,109 +91,109 @@ protected: .argument("=") .callback(OptionCallback(this, &CompilerApp::handleDefine))); - rOptions.addOption( + options.addOption( Option("config-file", "f", "Load configuration data from the given file.") .required(false) .repeatable(true) .argument("") .callback(OptionCallback(this, &CompilerApp::handleConfig))); - rOptions.addOption( + options.addOption( Option("output-dir", "o", "Write output files to directory .") .required(false) .repeatable(false) .argument("") .callback(OptionCallback(this, &CompilerApp::handleOutputDir))); - rOptions.addOption( + options.addOption( Option("header-output-dir", "H", "Write header file to directory .") .required(false) .repeatable(false) .argument("") .callback(OptionCallback(this, &CompilerApp::handleHeaderOutputDir))); - rOptions.addOption( + options.addOption( Option("header-prefix", "P", "Prepend the given to the header file name in the generated #include directive.") .required(false) .repeatable(false) .argument("") .callback(OptionCallback(this, &CompilerApp::handleHeaderPrefix))); - rOptions.addOption( + options.addOption( Option("base-file-name", "b", "Use instead of the class name for the output file name.") .required(false) .repeatable(false) .argument("") .callback(OptionCallback(this, &CompilerApp::handleBase))); - rOptions.addOption( + options.addOption( Option("osp", "O", "Add factory class definition and implementation for use with the Open Service Platform.") .required(false) .repeatable(false) .callback(OptionCallback(this, &CompilerApp::handleOSP))); - rOptions.addOption( + options.addOption( Option("apache", "A", "Add factory class definition and implementation, and shared library manifest for use with ApacheConnector.") .required(false) .repeatable(false) .callback(OptionCallback(this, &CompilerApp::handleApache))); - rOptions.addOption( + options.addOption( Option("noline", "N", "Do not include #line directives in generated code.") .required(false) .repeatable(false) .callback(OptionCallback(this, &CompilerApp::handleNoLine))); } - void handleHelp(const std::string& rName, const std::string& value) + void handleHelp(const std::string& name, const std::string& value) { _helpRequested = true; stopOptionsProcessing(); } - void handleDefine(const std::string& rName, const std::string& value) + void handleDefine(const std::string& name, const std::string& value) { defineProperty(value); } - void handleConfig(const std::string& rName, const std::string& value) + void handleConfig(const std::string& name, const std::string& value) { loadConfiguration(value); } - void handleOutputDir(const std::string& rName, const std::string& value) + void handleOutputDir(const std::string& name, const std::string& value) { _outputDir = value; } - void handleHeaderOutputDir(const std::string& rName, const std::string& value) + void handleHeaderOutputDir(const std::string& name, const std::string& value) { _headerOutputDir = value; } - void handleHeaderPrefix(const std::string& rName, const std::string& value) + void handleHeaderPrefix(const std::string& name, const std::string& value) { _headerPrefix = value; if (!_headerPrefix.empty() && _headerPrefix[_headerPrefix.size() - 1] != '/') _headerPrefix += '/'; } - void handleBase(const std::string& rName, const std::string& value) + void handleBase(const std::string& name, const std::string& value) { _base = value; } - void handleOSP(const std::string& rName, const std::string& value) + void handleOSP(const std::string& name, const std::string& value) { _generateOSPCode = true; } - void handleApache(const std::string& rName, const std::string& value) + void handleApache(const std::string& name, const std::string& value) { _generateApacheCode = true; } - void handleNoLine(const std::string& rName, const std::string& value) + void handleNoLine(const std::string& name, const std::string& value) { _emitLineDirectives = false; } @@ -223,16 +223,16 @@ protected: void defineProperty(const std::string& def) { - std::string configName; + std::string name; std::string value; std::string::size_type pos = def.find('='); if (pos != std::string::npos) { - configName.assign(def, 0, pos); + name.assign(def, 0, pos); value.assign(def, pos + 1, def.length() - pos); } - else configName = def; - config().setString(configName, value); + else name = def; + config().setString(name, value); } int main(const std::vector& args) From 34bbbe256daa6b383e6664f8a09b82f3315cad66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Mon, 5 Sep 2016 08:25:44 +0200 Subject: [PATCH 19/31] Revert "GH #1050 Net tests: fix gcc -Wshadow warnings" --- Net/include/Poco/Net/ParallelSocketAcceptor.h | 30 +++++++++---------- Net/include/Poco/Net/SocketAcceptor.h | 24 +++++++-------- Net/include/Poco/Net/SocketConnector.h | 8 ++--- Net/testsuite/src/DNSTest.cpp | 4 +-- Net/testsuite/src/DatagramSocketTest.cpp | 2 +- Net/testsuite/src/DialogSocketTest.cpp | 2 +- Net/testsuite/src/FTPClientSessionTest.cpp | 2 +- Net/testsuite/src/FTPStreamFactoryTest.cpp | 2 +- Net/testsuite/src/HTMLFormTest.cpp | 2 +- Net/testsuite/src/HTTPClientSessionTest.cpp | 2 +- Net/testsuite/src/HTTPCookieTest.cpp | 2 +- Net/testsuite/src/HTTPCredentialsTest.cpp | 2 +- Net/testsuite/src/HTTPRequestTest.cpp | 2 +- Net/testsuite/src/HTTPResponseTest.cpp | 2 +- Net/testsuite/src/HTTPServerTest.cpp | 2 +- Net/testsuite/src/HTTPStreamFactoryTest.cpp | 2 +- Net/testsuite/src/ICMPClientTest.cpp | 4 +-- Net/testsuite/src/ICMPSocketTest.cpp | 2 +- Net/testsuite/src/IPAddressTest.cpp | 2 +- Net/testsuite/src/MailMessageTest.cpp | 8 ++--- Net/testsuite/src/MailStreamTest.cpp | 2 +- Net/testsuite/src/MediaTypeTest.cpp | 2 +- Net/testsuite/src/MessageHeaderTest.cpp | 2 +- Net/testsuite/src/MulticastSocketTest.cpp | 2 +- Net/testsuite/src/MultipartReaderTest.cpp | 2 +- Net/testsuite/src/MultipartWriterTest.cpp | 2 +- Net/testsuite/src/NTPClientTest.cpp | 4 +-- Net/testsuite/src/NameValueCollectionTest.cpp | 2 +- Net/testsuite/src/NetworkInterfaceTest.cpp | 2 +- Net/testsuite/src/OAuth10CredentialsTest.cpp | 2 +- Net/testsuite/src/OAuth20CredentialsTest.cpp | 2 +- Net/testsuite/src/POP3ClientSessionTest.cpp | 2 +- Net/testsuite/src/QuotedPrintableTest.cpp | 2 +- Net/testsuite/src/RawSocketTest.cpp | 2 +- Net/testsuite/src/SMTPClientSessionTest.cpp | 2 +- Net/testsuite/src/SocketAddressTest.cpp | 4 +-- Net/testsuite/src/SocketReactorTest.cpp | 14 ++++----- Net/testsuite/src/SocketStreamTest.cpp | 2 +- Net/testsuite/src/SocketTest.cpp | 2 +- Net/testsuite/src/SyslogTest.cpp | 2 +- Net/testsuite/src/TCPServerTest.cpp | 2 +- Net/testsuite/src/WebSocketTest.cpp | 2 +- 42 files changed, 83 insertions(+), 83 deletions(-) diff --git a/Net/include/Poco/Net/ParallelSocketAcceptor.h b/Net/include/Poco/Net/ParallelSocketAcceptor.h index 4bf1a6a08..71533cc76 100644 --- a/Net/include/Poco/Net/ParallelSocketAcceptor.h +++ b/Net/include/Poco/Net/ParallelSocketAcceptor.h @@ -57,9 +57,9 @@ class ParallelSocketAcceptor public: typedef Poco::Net::ParallelSocketReactor ParallelReactor; - explicit ParallelSocketAcceptor(ServerSocket& rSocket, + explicit ParallelSocketAcceptor(ServerSocket& socket, unsigned threads = Poco::Environment::processorCount()): - _socket(rSocket), + _socket(socket), _pReactor(0), _threads(threads), _next(0) @@ -69,11 +69,11 @@ public: init(); } - ParallelSocketAcceptor(ServerSocket& rSocket, - SocketReactor& rReactor, + ParallelSocketAcceptor(ServerSocket& socket, + SocketReactor& reactor, unsigned threads = Poco::Environment::processorCount()): - _socket(rSocket), - _pReactor(&rReactor), + _socket(socket), + _pReactor(&reactor), _threads(threads), _next(0) /// Creates a ParallelSocketAcceptor using the given ServerSocket, sets the @@ -104,19 +104,19 @@ public: } } - void setReactor(SocketReactor& rReactor) + void setReactor(SocketReactor& reactor) /// Sets the reactor for this acceptor. { - _pReactor = &rReactor; + _pReactor = &reactor; if (!_pReactor->hasEventHandler(_socket, Poco::Observer(*this, &ParallelSocketAcceptor::onAccept))) { - registerAcceptor(rReactor); + registerAcceptor(reactor); } } - virtual void registerAcceptor(SocketReactor& rReactor) + virtual void registerAcceptor(SocketReactor& reactor) /// Registers the ParallelSocketAcceptor with a SocketReactor. /// /// A subclass can override this function to e.g. @@ -128,7 +128,7 @@ public: if (_pReactor) throw Poco::InvalidAccessException("Acceptor already registered."); - _pReactor = &rReactor; + _pReactor = &reactor; _pReactor->addEventHandler(_socket, Poco::Observer(*this, &ParallelSocketAcceptor::onAccept)); @@ -161,15 +161,15 @@ public: } protected: - virtual ServiceHandler* createServiceHandler(StreamSocket& rSocket) + virtual ServiceHandler* createServiceHandler(StreamSocket& socket) /// Create and initialize a new ServiceHandler instance. /// /// Subclasses can override this method. { - std::size_t nextReactor = _next++; + std::size_t next = _next++; if (_next == _reactors.size()) _next = 0; - _reactors[nextReactor]->wakeUp(); - return new ServiceHandler(rSocket, *_reactors[nextReactor]); + _reactors[next]->wakeUp(); + return new ServiceHandler(socket, *_reactors[next]); } SocketReactor* reactor() diff --git a/Net/include/Poco/Net/SocketAcceptor.h b/Net/include/Poco/Net/SocketAcceptor.h index f811980f3..ff2bfa79d 100644 --- a/Net/include/Poco/Net/SocketAcceptor.h +++ b/Net/include/Poco/Net/SocketAcceptor.h @@ -69,16 +69,16 @@ class SocketAcceptor /// if special steps are necessary to create a ServiceHandler object. { public: - explicit SocketAcceptor(ServerSocket& rSocket): - _socket(rSocket), + explicit SocketAcceptor(ServerSocket& socket): + _socket(socket), _pReactor(0) /// Creates a SocketAcceptor, using the given ServerSocket. { } - SocketAcceptor(ServerSocket& rSocket, SocketReactor& rReactor): - _socket(rSocket), - _pReactor(&rReactor) + SocketAcceptor(ServerSocket& socket, SocketReactor& reactor): + _socket(socket), + _pReactor(&reactor) /// Creates a SocketAcceptor, using the given ServerSocket. /// The SocketAcceptor registers itself with the given SocketReactor. { @@ -103,18 +103,18 @@ public: } } - void setReactor(SocketReactor& rReactor) + void setReactor(SocketReactor& reactor) /// Sets the reactor for this acceptor. { - _pReactor = &rReactor; + _pReactor = &reactor; if (!_pReactor->hasEventHandler(_socket, Poco::Observer(*this, &SocketAcceptor::onAccept))) { - registerAcceptor(rReactor); + registerAcceptor(reactor); } } - virtual void registerAcceptor(SocketReactor& rReactor) + virtual void registerAcceptor(SocketReactor& reactor) /// Registers the SocketAcceptor with a SocketReactor. /// /// A subclass can override this function to e.g. @@ -128,7 +128,7 @@ public: if (_pReactor) throw Poco::InvalidAccessException("Acceptor already registered."); - _pReactor = &rReactor; + _pReactor = &reactor; _pReactor->addEventHandler(_socket, Poco::Observer(*this, &SocketAcceptor::onAccept)); } @@ -158,12 +158,12 @@ public: } protected: - virtual ServiceHandler* createServiceHandler(StreamSocket& rSocket) + virtual ServiceHandler* createServiceHandler(StreamSocket& socket) /// Create and initialize a new ServiceHandler instance. /// /// Subclasses can override this method. { - return new ServiceHandler(rSocket, *_pReactor); + return new ServiceHandler(socket, *_pReactor); } SocketReactor* reactor() diff --git a/Net/include/Poco/Net/SocketConnector.h b/Net/include/Poco/Net/SocketConnector.h index 2f84da82e..86e261cf8 100644 --- a/Net/include/Poco/Net/SocketConnector.h +++ b/Net/include/Poco/Net/SocketConnector.h @@ -80,13 +80,13 @@ public: _socket.connectNB(address); } - SocketConnector(SocketAddress& address, SocketReactor& rReactor): + SocketConnector(SocketAddress& address, SocketReactor& reactor): _pReactor(0) /// Creates an acceptor, using the given ServerSocket. /// The SocketConnector registers itself with the given SocketReactor. { _socket.connectNB(address); - registerConnector(rReactor); + registerConnector(reactor); } virtual ~SocketConnector() @@ -102,7 +102,7 @@ public: } } - virtual void registerConnector(SocketReactor& rReactor) + virtual void registerConnector(SocketReactor& reactor) /// Registers the SocketConnector with a SocketReactor. /// /// A subclass can override this and, for example, also register @@ -110,7 +110,7 @@ public: /// /// The overriding method must call the baseclass implementation first. { - _pReactor = &rReactor; + _pReactor = &reactor; _pReactor->addEventHandler(_socket, Poco::Observer(*this, &SocketConnector::onReadable)); _pReactor->addEventHandler(_socket, Poco::Observer(*this, &SocketConnector::onWritable)); _pReactor->addEventHandler(_socket, Poco::Observer(*this, &SocketConnector::onError)); diff --git a/Net/testsuite/src/DNSTest.cpp b/Net/testsuite/src/DNSTest.cpp index cc53b6399..559cad4e0 100644 --- a/Net/testsuite/src/DNSTest.cpp +++ b/Net/testsuite/src/DNSTest.cpp @@ -27,7 +27,7 @@ using Poco::Net::ServiceNotFoundException; using Poco::Net::NoAddressFoundException; -DNSTest::DNSTest(const std::string& rName): CppUnit::TestCase(rName) +DNSTest::DNSTest(const std::string& name): CppUnit::TestCase(name) { } @@ -52,7 +52,7 @@ void DNSTest::testHostByName() try { - HostEntry he2 = DNS::hostByName("nohost.appinf.com"); + HostEntry he1 = DNS::hostByName("nohost.appinf.com"); fail("host not found - must throw"); } catch (HostNotFoundException&) diff --git a/Net/testsuite/src/DatagramSocketTest.cpp b/Net/testsuite/src/DatagramSocketTest.cpp index 0e66afebb..b5d7a54d5 100644 --- a/Net/testsuite/src/DatagramSocketTest.cpp +++ b/Net/testsuite/src/DatagramSocketTest.cpp @@ -36,7 +36,7 @@ using Poco::InvalidArgumentException; using Poco::IOException; -DatagramSocketTest::DatagramSocketTest(const std::string& rName): CppUnit::TestCase(rName) +DatagramSocketTest::DatagramSocketTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/DialogSocketTest.cpp b/Net/testsuite/src/DialogSocketTest.cpp index f8a8e2de8..f9c895d12 100644 --- a/Net/testsuite/src/DialogSocketTest.cpp +++ b/Net/testsuite/src/DialogSocketTest.cpp @@ -23,7 +23,7 @@ using Poco::Net::DialogSocket; using Poco::Net::SocketAddress; -DialogSocketTest::DialogSocketTest(const std::string& rName): CppUnit::TestCase(rName) +DialogSocketTest::DialogSocketTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/FTPClientSessionTest.cpp b/Net/testsuite/src/FTPClientSessionTest.cpp index 14c33f5cb..062104265 100644 --- a/Net/testsuite/src/FTPClientSessionTest.cpp +++ b/Net/testsuite/src/FTPClientSessionTest.cpp @@ -63,7 +63,7 @@ namespace }; -FTPClientSessionTest::FTPClientSessionTest(const std::string& rName): CppUnit::TestCase(rName) +FTPClientSessionTest::FTPClientSessionTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/FTPStreamFactoryTest.cpp b/Net/testsuite/src/FTPStreamFactoryTest.cpp index e3b564967..1a7e78d94 100644 --- a/Net/testsuite/src/FTPStreamFactoryTest.cpp +++ b/Net/testsuite/src/FTPStreamFactoryTest.cpp @@ -46,7 +46,7 @@ namespace } -FTPStreamFactoryTest::FTPStreamFactoryTest(const std::string& rName): CppUnit::TestCase(rName) +FTPStreamFactoryTest::FTPStreamFactoryTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/HTMLFormTest.cpp b/Net/testsuite/src/HTMLFormTest.cpp index 04bce115e..6966d50ad 100644 --- a/Net/testsuite/src/HTMLFormTest.cpp +++ b/Net/testsuite/src/HTMLFormTest.cpp @@ -75,7 +75,7 @@ namespace } -HTMLFormTest::HTMLFormTest(const std::string& rName): CppUnit::TestCase(rName) +HTMLFormTest::HTMLFormTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/HTTPClientSessionTest.cpp b/Net/testsuite/src/HTTPClientSessionTest.cpp index 423c6f430..87a31d697 100644 --- a/Net/testsuite/src/HTTPClientSessionTest.cpp +++ b/Net/testsuite/src/HTTPClientSessionTest.cpp @@ -30,7 +30,7 @@ using Poco::Net::HTTPMessage; using Poco::StreamCopier; -HTTPClientSessionTest::HTTPClientSessionTest(const std::string& rName): CppUnit::TestCase(rName) +HTTPClientSessionTest::HTTPClientSessionTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/HTTPCookieTest.cpp b/Net/testsuite/src/HTTPCookieTest.cpp index bdaf0570e..ff290349d 100644 --- a/Net/testsuite/src/HTTPCookieTest.cpp +++ b/Net/testsuite/src/HTTPCookieTest.cpp @@ -35,7 +35,7 @@ using Poco::Net::NameValueCollection; using Poco::Net::HTTPCookie; -HTTPCookieTest::HTTPCookieTest(const std::string& rName): CppUnit::TestCase(rName) +HTTPCookieTest::HTTPCookieTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/HTTPCredentialsTest.cpp b/Net/testsuite/src/HTTPCredentialsTest.cpp index 63461642d..9741bd7b9 100644 --- a/Net/testsuite/src/HTTPCredentialsTest.cpp +++ b/Net/testsuite/src/HTTPCredentialsTest.cpp @@ -32,7 +32,7 @@ using Poco::Net::HTTPCredentials; using Poco::Net::NotAuthenticatedException; -HTTPCredentialsTest::HTTPCredentialsTest(const std::string& rName): CppUnit::TestCase(rName) +HTTPCredentialsTest::HTTPCredentialsTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/HTTPRequestTest.cpp b/Net/testsuite/src/HTTPRequestTest.cpp index ff79f1ae9..ff72cad0d 100644 --- a/Net/testsuite/src/HTTPRequestTest.cpp +++ b/Net/testsuite/src/HTTPRequestTest.cpp @@ -24,7 +24,7 @@ using Poco::Net::MessageException; using Poco::Net::NameValueCollection; -HTTPRequestTest::HTTPRequestTest(const std::string& rName): CppUnit::TestCase(rName) +HTTPRequestTest::HTTPRequestTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/HTTPResponseTest.cpp b/Net/testsuite/src/HTTPResponseTest.cpp index 6bf992429..49b865e1c 100644 --- a/Net/testsuite/src/HTTPResponseTest.cpp +++ b/Net/testsuite/src/HTTPResponseTest.cpp @@ -25,7 +25,7 @@ using Poco::Net::HTTPCookie; using Poco::Net::MessageException; -HTTPResponseTest::HTTPResponseTest(const std::string& rName): CppUnit::TestCase(rName) +HTTPResponseTest::HTTPResponseTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/HTTPServerTest.cpp b/Net/testsuite/src/HTTPServerTest.cpp index 251e1a713..7dc31b554 100644 --- a/Net/testsuite/src/HTTPServerTest.cpp +++ b/Net/testsuite/src/HTTPServerTest.cpp @@ -128,7 +128,7 @@ namespace } -HTTPServerTest::HTTPServerTest(const std::string& rName): CppUnit::TestCase(rName) +HTTPServerTest::HTTPServerTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/HTTPStreamFactoryTest.cpp b/Net/testsuite/src/HTTPStreamFactoryTest.cpp index ac6277487..9c513e87f 100644 --- a/Net/testsuite/src/HTTPStreamFactoryTest.cpp +++ b/Net/testsuite/src/HTTPStreamFactoryTest.cpp @@ -30,7 +30,7 @@ using Poco::URI; using Poco::StreamCopier; -HTTPStreamFactoryTest::HTTPStreamFactoryTest(const std::string& rName): CppUnit::TestCase(rName) +HTTPStreamFactoryTest::HTTPStreamFactoryTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/ICMPClientTest.cpp b/Net/testsuite/src/ICMPClientTest.cpp index 5771459c3..1ac1923a8 100644 --- a/Net/testsuite/src/ICMPClientTest.cpp +++ b/Net/testsuite/src/ICMPClientTest.cpp @@ -34,8 +34,8 @@ using Poco::Delegate; using Poco::AutoPtr; -ICMPClientTest::ICMPClientTest(const std::string& rName): - CppUnit::TestCase(rName), +ICMPClientTest::ICMPClientTest(const std::string& name): + CppUnit::TestCase(name), _icmpClient(IPAddress::IPv4) { } diff --git a/Net/testsuite/src/ICMPSocketTest.cpp b/Net/testsuite/src/ICMPSocketTest.cpp index a6374ecfc..8906f3951 100644 --- a/Net/testsuite/src/ICMPSocketTest.cpp +++ b/Net/testsuite/src/ICMPSocketTest.cpp @@ -31,7 +31,7 @@ using Poco::TimeoutException; using Poco::Net::ICMPException; -ICMPSocketTest::ICMPSocketTest(const std::string& rName): CppUnit::TestCase(rName) +ICMPSocketTest::ICMPSocketTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/IPAddressTest.cpp b/Net/testsuite/src/IPAddressTest.cpp index b702fea47..e80db2dd0 100644 --- a/Net/testsuite/src/IPAddressTest.cpp +++ b/Net/testsuite/src/IPAddressTest.cpp @@ -21,7 +21,7 @@ using Poco::Net::IPAddress; using Poco::Net::InvalidAddressException; -IPAddressTest::IPAddressTest(const std::string& rName): CppUnit::TestCase(rName) +IPAddressTest::IPAddressTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/MailMessageTest.cpp b/Net/testsuite/src/MailMessageTest.cpp index bfc016b19..bf2c95585 100644 --- a/Net/testsuite/src/MailMessageTest.cpp +++ b/Net/testsuite/src/MailMessageTest.cpp @@ -53,14 +53,14 @@ namespace { _disp.push_back(header["Content-Disposition"]); _type.push_back(header["Content-Type"]); - std::string dataString; + std::string data; int ch = stream.get(); while (ch > 0) { - dataString += (char) ch; + data += (char) ch; ch = stream.get(); } - _data.push_back(dataString); + _data.push_back(data); } const std::vector& data() const @@ -86,7 +86,7 @@ namespace } -MailMessageTest::MailMessageTest(const std::string& rName): CppUnit::TestCase(rName) +MailMessageTest::MailMessageTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/MailStreamTest.cpp b/Net/testsuite/src/MailStreamTest.cpp index ebd9837a6..30565db9c 100644 --- a/Net/testsuite/src/MailStreamTest.cpp +++ b/Net/testsuite/src/MailStreamTest.cpp @@ -23,7 +23,7 @@ using Poco::Net::MailOutputStream; using Poco::StreamCopier; -MailStreamTest::MailStreamTest(const std::string& rName): CppUnit::TestCase(rName) +MailStreamTest::MailStreamTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/MediaTypeTest.cpp b/Net/testsuite/src/MediaTypeTest.cpp index 8bdc5fe94..6a2e717b3 100644 --- a/Net/testsuite/src/MediaTypeTest.cpp +++ b/Net/testsuite/src/MediaTypeTest.cpp @@ -19,7 +19,7 @@ using Poco::Net::MediaType; -MediaTypeTest::MediaTypeTest(const std::string& rName): CppUnit::TestCase(rName) +MediaTypeTest::MediaTypeTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/MessageHeaderTest.cpp b/Net/testsuite/src/MessageHeaderTest.cpp index ddbb70b31..a32fc3da4 100644 --- a/Net/testsuite/src/MessageHeaderTest.cpp +++ b/Net/testsuite/src/MessageHeaderTest.cpp @@ -23,7 +23,7 @@ using Poco::Net::NameValueCollection; using Poco::Net::MessageException; -MessageHeaderTest::MessageHeaderTest(const std::string& rName): CppUnit::TestCase(rName) +MessageHeaderTest::MessageHeaderTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/MulticastSocketTest.cpp b/Net/testsuite/src/MulticastSocketTest.cpp index a36bd3fb3..1bac859af 100644 --- a/Net/testsuite/src/MulticastSocketTest.cpp +++ b/Net/testsuite/src/MulticastSocketTest.cpp @@ -37,7 +37,7 @@ using Poco::InvalidArgumentException; using Poco::IOException; -MulticastSocketTest::MulticastSocketTest(const std::string& rName): CppUnit::TestCase(rName) +MulticastSocketTest::MulticastSocketTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/MultipartReaderTest.cpp b/Net/testsuite/src/MultipartReaderTest.cpp index a6cddc1ca..d34a0e42c 100644 --- a/Net/testsuite/src/MultipartReaderTest.cpp +++ b/Net/testsuite/src/MultipartReaderTest.cpp @@ -24,7 +24,7 @@ using Poco::Net::MessageHeader; using Poco::Net::MultipartException; -MultipartReaderTest::MultipartReaderTest(const std::string& rName): CppUnit::TestCase(rName) +MultipartReaderTest::MultipartReaderTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/MultipartWriterTest.cpp b/Net/testsuite/src/MultipartWriterTest.cpp index ff741f716..62da0d066 100644 --- a/Net/testsuite/src/MultipartWriterTest.cpp +++ b/Net/testsuite/src/MultipartWriterTest.cpp @@ -22,7 +22,7 @@ using Poco::Net::MultipartWriter; using Poco::Net::MessageHeader; -MultipartWriterTest::MultipartWriterTest(const std::string& rName): CppUnit::TestCase(rName) +MultipartWriterTest::MultipartWriterTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/NTPClientTest.cpp b/Net/testsuite/src/NTPClientTest.cpp index 0d689b169..64aa40724 100644 --- a/Net/testsuite/src/NTPClientTest.cpp +++ b/Net/testsuite/src/NTPClientTest.cpp @@ -34,8 +34,8 @@ using Poco::Delegate; using Poco::AutoPtr; -NTPClientTest::NTPClientTest(const std::string& rName): - CppUnit::TestCase(rName), +NTPClientTest::NTPClientTest(const std::string& name): + CppUnit::TestCase(name), _ntpClient(IPAddress::IPv4) { } diff --git a/Net/testsuite/src/NameValueCollectionTest.cpp b/Net/testsuite/src/NameValueCollectionTest.cpp index d85bb1c57..d800673b4 100644 --- a/Net/testsuite/src/NameValueCollectionTest.cpp +++ b/Net/testsuite/src/NameValueCollectionTest.cpp @@ -21,7 +21,7 @@ using Poco::Net::NameValueCollection; using Poco::NotFoundException; -NameValueCollectionTest::NameValueCollectionTest(const std::string& rName): CppUnit::TestCase(rName) +NameValueCollectionTest::NameValueCollectionTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/NetworkInterfaceTest.cpp b/Net/testsuite/src/NetworkInterfaceTest.cpp index f7079df2b..7f828f565 100644 --- a/Net/testsuite/src/NetworkInterfaceTest.cpp +++ b/Net/testsuite/src/NetworkInterfaceTest.cpp @@ -29,7 +29,7 @@ using Poco::Net::IPAddress; using Poco::NotFoundException; -NetworkInterfaceTest::NetworkInterfaceTest(const std::string& rName): CppUnit::TestCase(rName) +NetworkInterfaceTest::NetworkInterfaceTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/OAuth10CredentialsTest.cpp b/Net/testsuite/src/OAuth10CredentialsTest.cpp index e6e7429f7..ad546419e 100644 --- a/Net/testsuite/src/OAuth10CredentialsTest.cpp +++ b/Net/testsuite/src/OAuth10CredentialsTest.cpp @@ -29,7 +29,7 @@ using Poco::Net::HTMLForm; using Poco::URI; -OAuth10CredentialsTest::OAuth10CredentialsTest(const std::string& rName): CppUnit::TestCase(rName) +OAuth10CredentialsTest::OAuth10CredentialsTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/OAuth20CredentialsTest.cpp b/Net/testsuite/src/OAuth20CredentialsTest.cpp index c5509151a..8f0594720 100644 --- a/Net/testsuite/src/OAuth20CredentialsTest.cpp +++ b/Net/testsuite/src/OAuth20CredentialsTest.cpp @@ -23,7 +23,7 @@ using Poco::Net::OAuth20Credentials; using Poco::Net::NotAuthenticatedException; -OAuth20CredentialsTest::OAuth20CredentialsTest(const std::string& rName): CppUnit::TestCase(rName) +OAuth20CredentialsTest::OAuth20CredentialsTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/POP3ClientSessionTest.cpp b/Net/testsuite/src/POP3ClientSessionTest.cpp index 1ffb05909..b9b0b23a3 100644 --- a/Net/testsuite/src/POP3ClientSessionTest.cpp +++ b/Net/testsuite/src/POP3ClientSessionTest.cpp @@ -25,7 +25,7 @@ using Poco::Net::MailMessage; using Poco::Net::POP3Exception; -POP3ClientSessionTest::POP3ClientSessionTest(const std::string& rName): CppUnit::TestCase(rName) +POP3ClientSessionTest::POP3ClientSessionTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/QuotedPrintableTest.cpp b/Net/testsuite/src/QuotedPrintableTest.cpp index 1f9e7684c..d2b371fd6 100644 --- a/Net/testsuite/src/QuotedPrintableTest.cpp +++ b/Net/testsuite/src/QuotedPrintableTest.cpp @@ -22,7 +22,7 @@ using Poco::Net::QuotedPrintableEncoder; using Poco::Net::QuotedPrintableDecoder; -QuotedPrintableTest::QuotedPrintableTest(const std::string& rName): CppUnit::TestCase(rName) +QuotedPrintableTest::QuotedPrintableTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/RawSocketTest.cpp b/Net/testsuite/src/RawSocketTest.cpp index f035795e6..b043066af 100644 --- a/Net/testsuite/src/RawSocketTest.cpp +++ b/Net/testsuite/src/RawSocketTest.cpp @@ -33,7 +33,7 @@ using Poco::InvalidArgumentException; using Poco::IOException; -RawSocketTest::RawSocketTest(const std::string& rName): CppUnit::TestCase(rName) +RawSocketTest::RawSocketTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/SMTPClientSessionTest.cpp b/Net/testsuite/src/SMTPClientSessionTest.cpp index b26139d03..a36f75e91 100644 --- a/Net/testsuite/src/SMTPClientSessionTest.cpp +++ b/Net/testsuite/src/SMTPClientSessionTest.cpp @@ -26,7 +26,7 @@ using Poco::Net::MailRecipient; using Poco::Net::SMTPException; -SMTPClientSessionTest::SMTPClientSessionTest(const std::string& rName): CppUnit::TestCase(rName) +SMTPClientSessionTest::SMTPClientSessionTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/SocketAddressTest.cpp b/Net/testsuite/src/SocketAddressTest.cpp index 8d9981fff..fabf0b251 100644 --- a/Net/testsuite/src/SocketAddressTest.cpp +++ b/Net/testsuite/src/SocketAddressTest.cpp @@ -26,7 +26,7 @@ using Poco::Net::NoAddressFoundException; using Poco::InvalidArgumentException; -SocketAddressTest::SocketAddressTest(const std::string& rName): CppUnit::TestCase(rName) +SocketAddressTest::SocketAddressTest(const std::string& name): CppUnit::TestCase(name) { } @@ -61,7 +61,7 @@ void SocketAddressTest::testSocketAddress() try { - SocketAddress sa4("192.168.1.100", "f00bar"); + SocketAddress sa3("192.168.1.100", "f00bar"); fail("bad service name - must throw"); } catch (ServiceNotFoundException&) diff --git a/Net/testsuite/src/SocketReactorTest.cpp b/Net/testsuite/src/SocketReactorTest.cpp index 12fa9d6f1..938d900b1 100644 --- a/Net/testsuite/src/SocketReactorTest.cpp +++ b/Net/testsuite/src/SocketReactorTest.cpp @@ -136,8 +136,8 @@ namespace checkWritableObserverCount(1); _reactor.removeEventHandler(_socket, Observer(*this, &ClientServiceHandler::onWritable)); checkWritableObserverCount(0); - std::string dataString(1024, 'x'); - _socket.sendBytes(dataString.data(), (int) dataString.length()); + std::string data(1024, 'x'); + _socket.sendBytes(data.data(), (int) data.length()); _socket.shutdownSend(); } @@ -253,13 +253,13 @@ namespace class FailConnector: public SocketConnector { public: - FailConnector(SocketAddress& address, SocketReactor& rReactor): - SocketConnector(address, rReactor), + FailConnector(SocketAddress& address, SocketReactor& reactor): + SocketConnector(address, reactor), _failed(false), _shutdown(false) { - rReactor.addEventHandler(socket(), Observer(*this, &FailConnector::onTimeout)); - rReactor.addEventHandler(socket(), Observer(*this, &FailConnector::onShutdown)); + reactor.addEventHandler(socket(), Observer(*this, &FailConnector::onTimeout)); + reactor.addEventHandler(socket(), Observer(*this, &FailConnector::onShutdown)); } void onShutdown(ShutdownNotification* pNf) @@ -298,7 +298,7 @@ namespace } -SocketReactorTest::SocketReactorTest(const std::string& rName): CppUnit::TestCase(rName) +SocketReactorTest::SocketReactorTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/SocketStreamTest.cpp b/Net/testsuite/src/SocketStreamTest.cpp index cf6239c1d..8c9d15338 100644 --- a/Net/testsuite/src/SocketStreamTest.cpp +++ b/Net/testsuite/src/SocketStreamTest.cpp @@ -35,7 +35,7 @@ using Poco::TimeoutException; using Poco::InvalidArgumentException; -SocketStreamTest::SocketStreamTest(const std::string& rName): CppUnit::TestCase(rName) +SocketStreamTest::SocketStreamTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/SocketTest.cpp b/Net/testsuite/src/SocketTest.cpp index ae53249d6..c0030e9c2 100644 --- a/Net/testsuite/src/SocketTest.cpp +++ b/Net/testsuite/src/SocketTest.cpp @@ -41,7 +41,7 @@ using Poco::FIFOBuffer; using Poco::delegate; -SocketTest::SocketTest(const std::string& rName): CppUnit::TestCase(rName) +SocketTest::SocketTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/SyslogTest.cpp b/Net/testsuite/src/SyslogTest.cpp index 797ed94db..51e7b05d7 100644 --- a/Net/testsuite/src/SyslogTest.cpp +++ b/Net/testsuite/src/SyslogTest.cpp @@ -112,7 +112,7 @@ void CachingChannel::getMessages(std::vector& msg, int offset, in } -SyslogTest::SyslogTest(const std::string& rName): CppUnit::TestCase(rName) +SyslogTest::SyslogTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/TCPServerTest.cpp b/Net/testsuite/src/TCPServerTest.cpp index ab282adaf..9f11d461e 100644 --- a/Net/testsuite/src/TCPServerTest.cpp +++ b/Net/testsuite/src/TCPServerTest.cpp @@ -65,7 +65,7 @@ namespace } -TCPServerTest::TCPServerTest(const std::string& rName): CppUnit::TestCase(rName) +TCPServerTest::TCPServerTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Net/testsuite/src/WebSocketTest.cpp b/Net/testsuite/src/WebSocketTest.cpp index a6debe8de..72f6dcaf3 100644 --- a/Net/testsuite/src/WebSocketTest.cpp +++ b/Net/testsuite/src/WebSocketTest.cpp @@ -101,7 +101,7 @@ namespace } -WebSocketTest::WebSocketTest(const std::string& rName): CppUnit::TestCase(rName) +WebSocketTest::WebSocketTest(const std::string& name): CppUnit::TestCase(name) { } From 1683dd18aeef0a40f9a37d5f08e4a3d9b554a866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Mon, 5 Sep 2016 08:27:13 +0200 Subject: [PATCH 20/31] Revert "GH #1050 Util tests: fix gcc -Wshadow warnings" --- Foundation/src/Token.cpp | 6 +- JSON/testsuite/src/JSONTest.cpp | 2 +- .../src/AbstractConfigurationTest.cpp | 2 +- .../testsuite/src/ConfigurationMapperTest.cpp | 2 +- Util/testsuite/src/ConfigurationViewTest.cpp | 2 +- .../src/FilesystemConfigurationTest.cpp | 2 +- Util/testsuite/src/HelpFormatterTest.cpp | 2 +- .../src/IniFileConfigurationTest.cpp | 2 +- Util/testsuite/src/JSONConfigurationTest.cpp | 2 +- .../src/LayeredConfigurationTest.cpp | 2 +- .../testsuite/src/LoggingConfiguratorTest.cpp | 2 +- Util/testsuite/src/MapConfigurationTest.cpp | 2 +- Util/testsuite/src/OptionProcessorTest.cpp | 132 +++++++++--------- Util/testsuite/src/OptionSetTest.cpp | 2 +- Util/testsuite/src/OptionTest.cpp | 2 +- .../src/PropertyFileConfigurationTest.cpp | 2 +- .../testsuite/src/SystemConfigurationTest.cpp | 2 +- Util/testsuite/src/TimerTest.cpp | 2 +- Util/testsuite/src/ValidatorTest.cpp | 2 +- Util/testsuite/src/XMLConfigurationTest.cpp | 2 +- 20 files changed, 87 insertions(+), 87 deletions(-) diff --git a/Foundation/src/Token.cpp b/Foundation/src/Token.cpp index daf486ce1..02390e9b5 100644 --- a/Foundation/src/Token.cpp +++ b/Foundation/src/Token.cpp @@ -22,7 +22,7 @@ namespace Poco { -Token::Token(bool isIgnore) : _ignored(isIgnore) +Token::Token(bool ignore) : _ignored(ignore) { } @@ -94,9 +94,9 @@ char Token::asChar() const } -void Token::ignore(bool isIgnored) +void Token::ignore(bool ignored) { - _ignored = isIgnored; + _ignored = ignored; } bool Token::ignored() const diff --git a/JSON/testsuite/src/JSONTest.cpp b/JSON/testsuite/src/JSONTest.cpp index 8ab796de5..d248bdc1e 100644 --- a/JSON/testsuite/src/JSONTest.cpp +++ b/JSON/testsuite/src/JSONTest.cpp @@ -35,7 +35,7 @@ using Poco::DynamicStruct; using Poco::DateTime; using Poco::DateTimeFormatter; -JSONTest::JSONTest(const std::string& rName): CppUnit::TestCase("JSON") +JSONTest::JSONTest(const std::string& name): CppUnit::TestCase("JSON") { } diff --git a/Util/testsuite/src/AbstractConfigurationTest.cpp b/Util/testsuite/src/AbstractConfigurationTest.cpp index 86366abc9..857e00a2b 100644 --- a/Util/testsuite/src/AbstractConfigurationTest.cpp +++ b/Util/testsuite/src/AbstractConfigurationTest.cpp @@ -32,7 +32,7 @@ using Poco::Int64; using Poco::UInt64; -AbstractConfigurationTest::AbstractConfigurationTest(const std::string& rName): CppUnit::TestCase(rName) +AbstractConfigurationTest::AbstractConfigurationTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Util/testsuite/src/ConfigurationMapperTest.cpp b/Util/testsuite/src/ConfigurationMapperTest.cpp index e80e85c2f..d900ad1ea 100644 --- a/Util/testsuite/src/ConfigurationMapperTest.cpp +++ b/Util/testsuite/src/ConfigurationMapperTest.cpp @@ -26,7 +26,7 @@ using Poco::Util::MapConfiguration; using Poco::AutoPtr; -ConfigurationMapperTest::ConfigurationMapperTest(const std::string& rName): AbstractConfigurationTest(rName) +ConfigurationMapperTest::ConfigurationMapperTest(const std::string& name): AbstractConfigurationTest(name) { } diff --git a/Util/testsuite/src/ConfigurationViewTest.cpp b/Util/testsuite/src/ConfigurationViewTest.cpp index afb49eead..1dc552bd6 100644 --- a/Util/testsuite/src/ConfigurationViewTest.cpp +++ b/Util/testsuite/src/ConfigurationViewTest.cpp @@ -24,7 +24,7 @@ using Poco::Util::MapConfiguration; using Poco::AutoPtr; -ConfigurationViewTest::ConfigurationViewTest(const std::string& rName): AbstractConfigurationTest(rName) +ConfigurationViewTest::ConfigurationViewTest(const std::string& name): AbstractConfigurationTest(name) { } diff --git a/Util/testsuite/src/FilesystemConfigurationTest.cpp b/Util/testsuite/src/FilesystemConfigurationTest.cpp index 546b4c5d6..0d8c13dbd 100644 --- a/Util/testsuite/src/FilesystemConfigurationTest.cpp +++ b/Util/testsuite/src/FilesystemConfigurationTest.cpp @@ -24,7 +24,7 @@ using Poco::Util::AbstractConfiguration; using Poco::AutoPtr; -FilesystemConfigurationTest::FilesystemConfigurationTest(const std::string& rName): AbstractConfigurationTest(rName), +FilesystemConfigurationTest::FilesystemConfigurationTest(const std::string& name): AbstractConfigurationTest(name), _path("TestConfiguration") { } diff --git a/Util/testsuite/src/HelpFormatterTest.cpp b/Util/testsuite/src/HelpFormatterTest.cpp index c54e84ffa..309311452 100644 --- a/Util/testsuite/src/HelpFormatterTest.cpp +++ b/Util/testsuite/src/HelpFormatterTest.cpp @@ -24,7 +24,7 @@ using Poco::Util::OptionSet; using Poco::Util::HelpFormatter; -HelpFormatterTest::HelpFormatterTest(const std::string& rName): CppUnit::TestCase(rName) +HelpFormatterTest::HelpFormatterTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Util/testsuite/src/IniFileConfigurationTest.cpp b/Util/testsuite/src/IniFileConfigurationTest.cpp index b5dc05661..2c077d1a5 100644 --- a/Util/testsuite/src/IniFileConfigurationTest.cpp +++ b/Util/testsuite/src/IniFileConfigurationTest.cpp @@ -27,7 +27,7 @@ using Poco::NotImplementedException; using Poco::NotFoundException; -IniFileConfigurationTest::IniFileConfigurationTest(const std::string& rName): AbstractConfigurationTest(rName) +IniFileConfigurationTest::IniFileConfigurationTest(const std::string& name): AbstractConfigurationTest(name) { } diff --git a/Util/testsuite/src/JSONConfigurationTest.cpp b/Util/testsuite/src/JSONConfigurationTest.cpp index cee326881..91cf14590 100644 --- a/Util/testsuite/src/JSONConfigurationTest.cpp +++ b/Util/testsuite/src/JSONConfigurationTest.cpp @@ -25,7 +25,7 @@ using Poco::NotFoundException; using Poco::JSON::JSONException; -JSONConfigurationTest::JSONConfigurationTest(const std::string& rName) : AbstractConfigurationTest(rName) +JSONConfigurationTest::JSONConfigurationTest(const std::string& name) : AbstractConfigurationTest(name) { } diff --git a/Util/testsuite/src/LayeredConfigurationTest.cpp b/Util/testsuite/src/LayeredConfigurationTest.cpp index e53190725..52a2b2c47 100644 --- a/Util/testsuite/src/LayeredConfigurationTest.cpp +++ b/Util/testsuite/src/LayeredConfigurationTest.cpp @@ -28,7 +28,7 @@ using Poco::NotFoundException; using Poco::RuntimeException; -LayeredConfigurationTest::LayeredConfigurationTest(const std::string& rName): AbstractConfigurationTest(rName) +LayeredConfigurationTest::LayeredConfigurationTest(const std::string& name): AbstractConfigurationTest(name) { } diff --git a/Util/testsuite/src/LoggingConfiguratorTest.cpp b/Util/testsuite/src/LoggingConfiguratorTest.cpp index d79fa0d51..057e1cbf6 100644 --- a/Util/testsuite/src/LoggingConfiguratorTest.cpp +++ b/Util/testsuite/src/LoggingConfiguratorTest.cpp @@ -44,7 +44,7 @@ using Poco::Message; using Poco::AutoPtr; -LoggingConfiguratorTest::LoggingConfiguratorTest(const std::string& rName): CppUnit::TestCase(rName) +LoggingConfiguratorTest::LoggingConfiguratorTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Util/testsuite/src/MapConfigurationTest.cpp b/Util/testsuite/src/MapConfigurationTest.cpp index 6b1d5a78b..85d6bff70 100644 --- a/Util/testsuite/src/MapConfigurationTest.cpp +++ b/Util/testsuite/src/MapConfigurationTest.cpp @@ -22,7 +22,7 @@ using Poco::Util::MapConfiguration; using Poco::AutoPtr; -MapConfigurationTest::MapConfigurationTest(const std::string& rName): AbstractConfigurationTest(rName) +MapConfigurationTest::MapConfigurationTest(const std::string& name): AbstractConfigurationTest(name) { } diff --git a/Util/testsuite/src/OptionProcessorTest.cpp b/Util/testsuite/src/OptionProcessorTest.cpp index 772788128..3b7273817 100644 --- a/Util/testsuite/src/OptionProcessorTest.cpp +++ b/Util/testsuite/src/OptionProcessorTest.cpp @@ -24,7 +24,7 @@ using Poco::Util::OptionSet; using Poco::Util::OptionProcessor; -OptionProcessorTest::OptionProcessorTest(const std::string& rName): CppUnit::TestCase(rName) +OptionProcessorTest::OptionProcessorTest(const std::string& name): CppUnit::TestCase(name) { } @@ -81,58 +81,58 @@ void OptionProcessorTest::testUnix() .repeatable(false)); OptionProcessor p1(set); - std::string optionName; + std::string name; std::string value; - assert (p1.process("-I/usr/include", optionName, value)); - assert (optionName == "include-dir"); + assert (p1.process("-I/usr/include", name, value)); + assert (name == "include-dir"); assert (value == "/usr/include"); - assert (p1.process("--include:/usr/local/include", optionName, value)); - assert (optionName == "include-dir"); + assert (p1.process("--include:/usr/local/include", name, value)); + assert (name == "include-dir"); assert (value == "/usr/local/include"); - assert (p1.process("-I", optionName, value)); - assert (optionName.empty()); + assert (p1.process("-I", name, value)); + assert (name.empty()); assert (value.empty()); - assert (p1.process("/usr/include", optionName, value)); - assert (optionName == "include-dir"); + assert (p1.process("/usr/include", name, value)); + assert (name == "include-dir"); assert (value == "/usr/include"); - assert (p1.process("-I", optionName, value)); - assert (optionName.empty()); + assert (p1.process("-I", name, value)); + assert (name.empty()); assert (value.empty()); - assert (p1.process("-L", optionName, value)); - assert (optionName == "include-dir"); + assert (p1.process("-L", name, value)); + assert (name == "include-dir"); assert (value == "-L"); - assert (p1.process("--lib=/usr/local/lib", optionName, value)); - assert (optionName == "library-dir"); + assert (p1.process("--lib=/usr/local/lib", name, value)); + assert (name == "library-dir"); assert (value == "/usr/local/lib"); - assert (p1.process("-ofile", optionName, value)); - assert (optionName == "output"); + assert (p1.process("-ofile", name, value)); + assert (name == "output"); assert (value == "file"); - assert (!p1.process("src/file.cpp", optionName, value)); - assert (!p1.process("/src/file.cpp", optionName, value)); + assert (!p1.process("src/file.cpp", name, value)); + assert (!p1.process("/src/file.cpp", name, value)); try { - p1.process("--output:file", optionName, value); + p1.process("--output:file", name, value); fail("duplicate - must throw"); } catch (Poco::Util::DuplicateOptionException&) { } - assert (p1.process("-g", optionName, value)); - assert (optionName == "debug"); + assert (p1.process("-g", name, value)); + assert (name == "debug"); assert (value == ""); try { - p1.process("--optimize", optionName, value); + p1.process("--optimize", name, value); fail("incompatible - must throw"); } catch (Poco::Util::IncompatibleOptionsException&) @@ -141,7 +141,7 @@ void OptionProcessorTest::testUnix() try { - p1.process("-x", optionName, value); + p1.process("-x", name, value); fail("unknown option - must throw"); } catch (Poco::Util::UnknownOptionException&) @@ -150,7 +150,7 @@ void OptionProcessorTest::testUnix() try { - p1.process("--in", optionName, value); + p1.process("--in", name, value); fail("ambiguous option - must throw"); } catch (Poco::Util::AmbiguousOptionException&) @@ -207,51 +207,51 @@ void OptionProcessorTest::testDefault() OptionProcessor p1(set); p1.setUnixStyle(false); - std::string optionName; + std::string name; std::string value; - assert (p1.process("/Inc:/usr/include", optionName, value)); - assert (optionName == "include-dir"); + assert (p1.process("/Inc:/usr/include", name, value)); + assert (name == "include-dir"); assert (value == "/usr/include"); - assert (p1.process("/include:/usr/local/include", optionName, value)); - assert (optionName == "include-dir"); + assert (p1.process("/include:/usr/local/include", name, value)); + assert (name == "include-dir"); assert (value == "/usr/local/include"); - assert (p1.process("/Inc", optionName, value)); - assert (optionName.empty()); + assert (p1.process("/Inc", name, value)); + assert (name.empty()); assert (value.empty()); - assert (p1.process("/usr/include", optionName, value)); - assert (optionName == "include-dir"); + assert (p1.process("/usr/include", name, value)); + assert (name == "include-dir"); assert (value == "/usr/include"); - assert (p1.process("/lib=/usr/local/lib", optionName, value)); - assert (optionName == "library-dir"); + assert (p1.process("/lib=/usr/local/lib", name, value)); + assert (name == "library-dir"); assert (value == "/usr/local/lib"); - assert (p1.process("/out:file", optionName, value)); - assert (optionName == "output"); + assert (p1.process("/out:file", name, value)); + assert (name == "output"); assert (value == "file"); - assert (!p1.process("src/file.cpp", optionName, value)); - assert (!p1.process("\\src\\file.cpp", optionName, value)); + assert (!p1.process("src/file.cpp", name, value)); + assert (!p1.process("\\src\\file.cpp", name, value)); try { - p1.process("/output:file", optionName, value); + p1.process("/output:file", name, value); fail("duplicate - must throw"); } catch (Poco::Util::DuplicateOptionException&) { } - assert (p1.process("/debug", optionName, value)); - assert (optionName == "debug"); + assert (p1.process("/debug", name, value)); + assert (name == "debug"); assert (value == ""); try { - p1.process("/OPT", optionName, value); + p1.process("/OPT", name, value); fail("incompatible - must throw"); } catch (Poco::Util::IncompatibleOptionsException&) @@ -260,7 +260,7 @@ void OptionProcessorTest::testDefault() try { - p1.process("/x", optionName, value); + p1.process("/x", name, value); fail("unknown option - must throw"); } catch (Poco::Util::UnknownOptionException&) @@ -269,7 +269,7 @@ void OptionProcessorTest::testDefault() try { - p1.process("/in", optionName, value); + p1.process("/in", name, value); fail("ambiguous option - must throw"); } catch (Poco::Util::AmbiguousOptionException&) @@ -287,7 +287,7 @@ void OptionProcessorTest::testRequired() .repeatable(true)); OptionProcessor p1(set); - std::string optionName; + std::string name; std::string value; try @@ -299,7 +299,7 @@ void OptionProcessorTest::testRequired() { } - assert (p1.process("-o", optionName, value)); + assert (p1.process("-o", name, value)); p1.checkRequired(); } @@ -321,37 +321,37 @@ void OptionProcessorTest::testArgs() .argument("level", false)); OptionProcessor p1(set); - std::string optionName; + std::string name; std::string value; - assert (p1.process("-I/usr/include", optionName, value)); - assert (optionName == "include-dir"); + assert (p1.process("-I/usr/include", name, value)); + assert (name == "include-dir"); assert (value == "/usr/include"); - assert (p1.process("--include:/usr/local/include", optionName, value)); - assert (optionName == "include-dir"); + assert (p1.process("--include:/usr/local/include", name, value)); + assert (name == "include-dir"); assert (value == "/usr/local/include"); - assert (p1.process("-I", optionName, value)); - assert (optionName.empty()); + assert (p1.process("-I", name, value)); + assert (name.empty()); assert (value.empty()); - assert (p1.process("/usr/include", optionName, value)); - assert (optionName == "include-dir"); + assert (p1.process("/usr/include", name, value)); + assert (name == "include-dir"); assert (value == "/usr/include"); - assert (p1.process("-I", optionName, value)); - assert (optionName.empty()); + assert (p1.process("-I", name, value)); + assert (name.empty()); assert (value.empty()); - assert (p1.process("-L", optionName, value)); - assert (optionName == "include-dir"); + assert (p1.process("-L", name, value)); + assert (name == "include-dir"); assert (value == "-L"); - assert (p1.process("-O", optionName, value)); - assert (optionName == "optimize"); + assert (p1.process("-O", name, value)); + assert (name == "optimize"); assert (value.empty()); - assert (p1.process("-O2", optionName, value)); - assert (optionName == "optimize"); + assert (p1.process("-O2", name, value)); + assert (name == "optimize"); assert (value == "2"); } diff --git a/Util/testsuite/src/OptionSetTest.cpp b/Util/testsuite/src/OptionSetTest.cpp index b8fd2c17e..0fc1118ce 100644 --- a/Util/testsuite/src/OptionSetTest.cpp +++ b/Util/testsuite/src/OptionSetTest.cpp @@ -22,7 +22,7 @@ using Poco::Util::OptionSet; using Poco::Util::Option; -OptionSetTest::OptionSetTest(const std::string& rName): CppUnit::TestCase(rName) +OptionSetTest::OptionSetTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Util/testsuite/src/OptionTest.cpp b/Util/testsuite/src/OptionTest.cpp index 404822ce6..c4d1c1b8f 100644 --- a/Util/testsuite/src/OptionTest.cpp +++ b/Util/testsuite/src/OptionTest.cpp @@ -20,7 +20,7 @@ using Poco::Util::Option; -OptionTest::OptionTest(const std::string& rName): CppUnit::TestCase(rName) +OptionTest::OptionTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Util/testsuite/src/PropertyFileConfigurationTest.cpp b/Util/testsuite/src/PropertyFileConfigurationTest.cpp index e4a27d4c1..2df77c48b 100644 --- a/Util/testsuite/src/PropertyFileConfigurationTest.cpp +++ b/Util/testsuite/src/PropertyFileConfigurationTest.cpp @@ -26,7 +26,7 @@ using Poco::AutoPtr; using Poco::NotFoundException; -PropertyFileConfigurationTest::PropertyFileConfigurationTest(const std::string& rName): AbstractConfigurationTest(rName) +PropertyFileConfigurationTest::PropertyFileConfigurationTest(const std::string& name): AbstractConfigurationTest(name) { } diff --git a/Util/testsuite/src/SystemConfigurationTest.cpp b/Util/testsuite/src/SystemConfigurationTest.cpp index f608e13e0..b8bacdd48 100644 --- a/Util/testsuite/src/SystemConfigurationTest.cpp +++ b/Util/testsuite/src/SystemConfigurationTest.cpp @@ -34,7 +34,7 @@ using Poco::InvalidAccessException; using Poco::NotFoundException; -SystemConfigurationTest::SystemConfigurationTest(const std::string& rName): CppUnit::TestCase(rName) +SystemConfigurationTest::SystemConfigurationTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Util/testsuite/src/TimerTest.cpp b/Util/testsuite/src/TimerTest.cpp index 6ddde8341..ce8ea5d1d 100644 --- a/Util/testsuite/src/TimerTest.cpp +++ b/Util/testsuite/src/TimerTest.cpp @@ -24,7 +24,7 @@ using Poco::Timestamp; using Poco::Clock; -TimerTest::TimerTest(const std::string& rName): CppUnit::TestCase(rName) +TimerTest::TimerTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Util/testsuite/src/ValidatorTest.cpp b/Util/testsuite/src/ValidatorTest.cpp index d3eee3ee4..d6cacdc70 100644 --- a/Util/testsuite/src/ValidatorTest.cpp +++ b/Util/testsuite/src/ValidatorTest.cpp @@ -28,7 +28,7 @@ using Poco::Util::InvalidArgumentException; using Poco::AutoPtr; -ValidatorTest::ValidatorTest(const std::string& rName): CppUnit::TestCase(rName) +ValidatorTest::ValidatorTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Util/testsuite/src/XMLConfigurationTest.cpp b/Util/testsuite/src/XMLConfigurationTest.cpp index 6defdd5ac..3fc69006e 100644 --- a/Util/testsuite/src/XMLConfigurationTest.cpp +++ b/Util/testsuite/src/XMLConfigurationTest.cpp @@ -27,7 +27,7 @@ using Poco::NotImplementedException; using Poco::NotFoundException; -XMLConfigurationTest::XMLConfigurationTest(const std::string& rName): AbstractConfigurationTest(rName) +XMLConfigurationTest::XMLConfigurationTest(const std::string& name): AbstractConfigurationTest(name) { } From f7d3737526e18d6ff09dce596715e981cc2d168b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Mon, 5 Sep 2016 08:28:18 +0200 Subject: [PATCH 21/31] Revert "GH #1050 Foundation-tests: fix gcc -Wshadow warnings" --- Foundation/include/Poco/Dynamic/Pair.h | 2 +- Foundation/include/Poco/HashTable.h | 12 +- Foundation/include/Poco/LRUCache.h | 4 +- Foundation/include/Poco/MetaObject.h | 4 +- Foundation/include/Poco/ObjectPool.h | 16 +- .../include/Poco/RecursiveDirectoryIterator.h | 26 +-- .../Poco/RecursiveDirectoryIteratorImpl.h | 4 +- Foundation/include/Poco/SimpleHashTable.h | 8 +- Foundation/include/Poco/ValidArgs.h | 4 +- .../testsuite/src/DynamicFactoryTest.cpp | 2 +- Foundation/testsuite/src/FileChannelTest.cpp | 196 +++++++++--------- Foundation/testsuite/src/NDCTest.cpp | 6 +- .../testsuite/src/NotificationQueueTest.cpp | 2 +- Foundation/testsuite/src/PathTest.cpp | 2 +- .../src/PriorityNotificationQueueTest.cpp | 2 +- Foundation/testsuite/src/ProcessTest.cpp | 42 ++-- .../testsuite/src/SimpleFileChannelTest.cpp | 24 +-- Foundation/testsuite/src/StringTest.cpp | 4 +- Foundation/testsuite/src/TaskManagerTest.cpp | 2 +- .../src/TimedNotificationQueueTest.cpp | 2 +- Foundation/testsuite/src/VarTest.cpp | 4 +- 21 files changed, 184 insertions(+), 184 deletions(-) diff --git a/Foundation/include/Poco/Dynamic/Pair.h b/Foundation/include/Poco/Dynamic/Pair.h index 46c54c028..aab63f993 100644 --- a/Foundation/include/Poco/Dynamic/Pair.h +++ b/Foundation/include/Poco/Dynamic/Pair.h @@ -59,7 +59,7 @@ public: } template - Pair(const K& rFirst, const T& rSecond): _data(std::make_pair(rFirst, rSecond)) + Pair(const K& first, const T& second): _data(std::make_pair(first, second)) /// Creates pair from two values. { } diff --git a/Foundation/include/Poco/HashTable.h b/Foundation/include/Poco/HashTable.h index 224462944..350780b26 100644 --- a/Foundation/include/Poco/HashTable.h +++ b/Foundation/include/Poco/HashTable.h @@ -334,14 +334,14 @@ public: { if (_entries[i]) { - UInt32 entrySize = (UInt32)_entries[i]->size(); - poco_assert_dbg(entrySize != 0); - if (entrySize > maxEntriesPerHash) - maxEntriesPerHash = entrySize; + UInt32 size = (UInt32)_entries[i]->size(); + poco_assert_dbg(size != 0); + if (size > maxEntriesPerHash) + maxEntriesPerHash = size; if (details) - detailedEntriesPerHash.push_back(entrySize); + detailedEntriesPerHash.push_back(size); #ifdef _DEBUG - totalSize += entrySize; + totalSize += size; #endif } else diff --git a/Foundation/include/Poco/LRUCache.h b/Foundation/include/Poco/LRUCache.h index cf70725b5..da8ff6e6a 100644 --- a/Foundation/include/Poco/LRUCache.h +++ b/Foundation/include/Poco/LRUCache.h @@ -37,8 +37,8 @@ class LRUCache: public AbstractCache, TM /// An LRUCache implements Least Recently Used caching. The default size for a cache is 1024 entries. { public: - LRUCache(long cacheSize = 1024): - AbstractCache, TMutex, TEventMutex>(LRUStrategy(cacheSize)) + LRUCache(long size = 1024): + AbstractCache, TMutex, TEventMutex>(LRUStrategy(size)) { } diff --git a/Foundation/include/Poco/MetaObject.h b/Foundation/include/Poco/MetaObject.h index bdb8270ba..1c4b31ec6 100644 --- a/Foundation/include/Poco/MetaObject.h +++ b/Foundation/include/Poco/MetaObject.h @@ -132,7 +132,7 @@ class MetaObject: public AbstractMetaObject /// factory for its class. { public: - MetaObject(const char* pName): AbstractMetaObject(pName) + MetaObject(const char* name): AbstractMetaObject(name) { } @@ -164,7 +164,7 @@ class MetaSingleton: public AbstractMetaObject /// the single instance of its class. { public: - MetaSingleton(const char* pName): AbstractMetaObject(pName) + MetaSingleton(const char* name): AbstractMetaObject(name) { } diff --git a/Foundation/include/Poco/ObjectPool.h b/Foundation/include/Poco/ObjectPool.h index eafcf77c1..7c9729a8c 100644 --- a/Foundation/include/Poco/ObjectPool.h +++ b/Foundation/include/Poco/ObjectPool.h @@ -168,28 +168,28 @@ class ObjectPool /// - If the object is not valid, it is destroyed immediately. { public: - ObjectPool(std::size_t objectCapacity, std::size_t peakObjectCapacity): + ObjectPool(std::size_t capacity, std::size_t peakCapacity): /// Creates a new ObjectPool with the given capacity /// and peak capacity. /// /// The PoolableObjectFactory must have a public default constructor. - _capacity(objectCapacity), - _peakCapacity(peakObjectCapacity), + _capacity(capacity), + _peakCapacity(peakCapacity), _size(0) { - poco_assert (objectCapacity <= peakObjectCapacity); + poco_assert (capacity <= peakCapacity); } - ObjectPool(const F& factory, std::size_t objectCapacity, std::size_t peakObjectCapacity): + ObjectPool(const F& factory, std::size_t capacity, std::size_t peakCapacity): /// Creates a new ObjectPool with the given PoolableObjectFactory, /// capacity and peak capacity. The PoolableObjectFactory must have /// a public copy constructor. _factory(factory), - _capacity(objectCapacity), - _peakCapacity(peakObjectCapacity), + _capacity(capacity), + _peakCapacity(peakCapacity), _size(0) { - poco_assert (objectCapacity <= peakObjectCapacity); + poco_assert (capacity <= peakCapacity); } ~ObjectPool() diff --git a/Foundation/include/Poco/RecursiveDirectoryIterator.h b/Foundation/include/Poco/RecursiveDirectoryIterator.h index 883d4fd13..db8d1f2e9 100644 --- a/Foundation/include/Poco/RecursiveDirectoryIterator.h +++ b/Foundation/include/Poco/RecursiveDirectoryIterator.h @@ -59,7 +59,7 @@ class RecursiveDirectoryIterator /// * SiblingsFirstRecursiveDirectoryIterator. /// /// The depth of traversal can be limited by constructor - /// parameter maxTraversalDepth (which sets the infinite depth by default). + /// parameter maxDepth (which sets the infinite depth by default). { public: typedef RecursiveDirectoryIterator MyType; @@ -75,9 +75,9 @@ public: { } - RecursiveDirectoryIterator(const std::string& rPath, UInt16 maxTraversalDepth = D_INFINITE) + RecursiveDirectoryIterator(const std::string& path, UInt16 maxDepth = D_INFINITE) /// Creates a recursive directory iterator for the given path. - : _pImpl(new ImplType(rPath, maxTraversalDepth)), _path(Path(_pImpl->get())), _file(_path) + : _pImpl(new ImplType(path, maxDepth)), _path(Path(_pImpl->get())), _file(_path) { } @@ -87,22 +87,22 @@ public: { } - RecursiveDirectoryIterator(const DirectoryIterator& iterator, UInt16 maxTraversalDepth = D_INFINITE): + RecursiveDirectoryIterator(const DirectoryIterator& iterator, UInt16 maxDepth = D_INFINITE): /// Creates a recursive directory iterator for the path of /// non-recursive directory iterator. - _pImpl(new ImplType(iterator->path(), maxTraversalDepth)), _path(Path(_pImpl->get())), _file(_path) + _pImpl(new ImplType(iterator->path(), maxDepth)), _path(Path(_pImpl->get())), _file(_path) { } - RecursiveDirectoryIterator(const File& file, UInt16 maxTraversalDepth = D_INFINITE): + RecursiveDirectoryIterator(const File& file, UInt16 maxDepth = D_INFINITE): /// Creates a recursive directory iterator for the given path. - _pImpl(new ImplType(file.path(), maxTraversalDepth)), _path(Path(_pImpl->get())), _file(_path) + _pImpl(new ImplType(file.path(), maxDepth)), _path(Path(_pImpl->get())), _file(_path) { } - RecursiveDirectoryIterator(const Path& rPath, UInt16 maxTraversalDepth = D_INFINITE): + RecursiveDirectoryIterator(const Path& path, UInt16 maxDepth = D_INFINITE): /// Creates a recursive directory iterator for the given path. - _pImpl(new ImplType(rPath.toString(), maxTraversalDepth)), _path(Path(_pImpl->get())), _file(_path) + _pImpl(new ImplType(path.toString(), maxDepth)), _path(Path(_pImpl->get())), _file(_path) { } @@ -163,21 +163,21 @@ public: } - MyType& operator = (const Path& rPath) + MyType& operator = (const Path& path) { if (_pImpl) _pImpl->release(); - _pImpl = new ImplType(rPath.toString()); + _pImpl = new ImplType(path.toString()); _path = Path(_pImpl->get()); _file = _path; return *this; } - MyType& operator = (const std::string& rPath) + MyType& operator = (const std::string& path) { if (_pImpl) _pImpl->release(); - _pImpl = new ImplType(rPath); + _pImpl = new ImplType(path); _path = Path(_pImpl->get()); _file = _path; return *this; diff --git a/Foundation/include/Poco/RecursiveDirectoryIteratorImpl.h b/Foundation/include/Poco/RecursiveDirectoryIteratorImpl.h index 916033c3f..09350f061 100644 --- a/Foundation/include/Poco/RecursiveDirectoryIteratorImpl.h +++ b/Foundation/include/Poco/RecursiveDirectoryIteratorImpl.h @@ -42,8 +42,8 @@ public: D_INFINITE = 0 /// Special value for infinite traverse depth. }; - RecursiveDirectoryIteratorImpl(const std::string& path, UInt16 maxTraversalDepth = D_INFINITE) - : _maxDepth(maxTraversalDepth), _traverseStrategy(std::ptr_fun(depthFun), _maxDepth), _isFinished(false), _rc(1) + RecursiveDirectoryIteratorImpl(const std::string& path, UInt16 maxDepth = D_INFINITE) + : _maxDepth(maxDepth), _traverseStrategy(std::ptr_fun(depthFun), _maxDepth), _isFinished(false), _rc(1) { _itStack.push(DirectoryIterator(path)); _current = _itStack.top()->path(); diff --git a/Foundation/include/Poco/SimpleHashTable.h b/Foundation/include/Poco/SimpleHashTable.h index 483e7d100..7ee008577 100644 --- a/Foundation/include/Poco/SimpleHashTable.h +++ b/Foundation/include/Poco/SimpleHashTable.h @@ -58,7 +58,7 @@ public: typedef std::vector HashTableVector; - SimpleHashTable(UInt32 tableCapacity = 251): _entries(tableCapacity, 0), _size(0), _capacity(tableCapacity) + SimpleHashTable(UInt32 capacity = 251): _entries(capacity, 0), _size(0), _capacity(capacity) /// Creates the SimpleHashTable. { } @@ -366,11 +366,11 @@ public: if (_entries[i]) { maxEntriesPerHash = 1; - UInt32 entrySize = 1; + UInt32 size = 1; if (details) - detailedEntriesPerHash.push_back(entrySize); + detailedEntriesPerHash.push_back(size); #ifdef _DEBUG - totalSize += entrySize; + totalSize += size; #endif } else diff --git a/Foundation/include/Poco/ValidArgs.h b/Foundation/include/Poco/ValidArgs.h index b5975161c..1d195658b 100644 --- a/Foundation/include/Poco/ValidArgs.h +++ b/Foundation/include/Poco/ValidArgs.h @@ -30,8 +30,8 @@ template class ValidArgs { public: - ValidArgs(const TKey& rKey): - _key(rKey), + ValidArgs(const TKey& key): + _key(key), _isValid(true) { } diff --git a/Foundation/testsuite/src/DynamicFactoryTest.cpp b/Foundation/testsuite/src/DynamicFactoryTest.cpp index 812294dc0..132eb3297 100644 --- a/Foundation/testsuite/src/DynamicFactoryTest.cpp +++ b/Foundation/testsuite/src/DynamicFactoryTest.cpp @@ -89,7 +89,7 @@ void DynamicFactoryTest::testDynamicFactory() try { - std::auto_ptr pB(dynamic_cast(dynFactory.createInstance("B"))); + std::auto_ptr b(dynamic_cast(dynFactory.createInstance("B"))); fail("unregistered - must throw"); } catch (Poco::NotFoundException&) diff --git a/Foundation/testsuite/src/FileChannelTest.cpp b/Foundation/testsuite/src/FileChannelTest.cpp index 885747fa5..ce07b4c59 100644 --- a/Foundation/testsuite/src/FileChannelTest.cpp +++ b/Foundation/testsuite/src/FileChannelTest.cpp @@ -60,10 +60,10 @@ FileChannelTest::~FileChannelTest() void FileChannelTest::testRotateBySize() { - std::string fileName = filename(); + std::string name = filename(); try { - AutoPtr pChannel = new FileChannel(fileName); + AutoPtr pChannel = new FileChannel(name); pChannel->setProperty(FileChannel::PROP_ROTATION, "2 K"); pChannel->open(); Message msg("source", "This is a log file entry", Message::PRIO_INFORMATION); @@ -71,28 +71,28 @@ void FileChannelTest::testRotateBySize() { pChannel->log(msg); } - File f(fileName + ".0"); + File f(name + ".0"); assert (f.exists()); - f = fileName + ".1"; + f = name + ".1"; assert (f.exists()); - f = fileName + ".2"; + f = name + ".2"; assert (!f.exists()); } catch (...) { - remove(fileName); + remove(name); throw; } - remove(fileName); + remove(name); } void FileChannelTest::testRotateByAge() { - std::string fileName = filename(); + std::string name = filename(); try { - AutoPtr pChannel = new FileChannel(fileName); + AutoPtr pChannel = new FileChannel(name); pChannel->setProperty(FileChannel::PROP_ROTATION, "2 seconds"); pChannel->open(); Message msg("source", "This is a log file entry", Message::PRIO_INFORMATION); @@ -101,26 +101,26 @@ void FileChannelTest::testRotateByAge() pChannel->log(msg); Thread::sleep(300); } - File f(fileName + ".0"); + File f(name + ".0"); assert (f.exists()); - f = fileName + ".1"; + f = name + ".1"; assert (f.exists()); } catch (...) { - remove(fileName); + remove(name); throw; } - remove(fileName); + remove(name); } void FileChannelTest::testRotateAtTimeDayUTC() { - std::string fileName = filename(); + std::string name = filename(); try { - AutoPtr pChannel = new FileChannel(fileName); + AutoPtr pChannel = new FileChannel(name); pChannel->setProperty(FileChannel::PROP_TIMES, "utc"); pChannel->setProperty(FileChannel::PROP_ROTATION, rotation(DAY_HOUR_MIN)); pChannel->open(); @@ -132,24 +132,24 @@ void FileChannelTest::testRotateAtTimeDayUTC() Thread::sleep(1000); } pChannel->log(msg); - File f(fileName + ".0"); + File f(name + ".0"); assert (f.exists()); } catch (...) { - remove(fileName); + remove(name); throw; } - remove(fileName); + remove(name); } void FileChannelTest::testRotateAtTimeDayLocal() { - std::string fileName = filename(); + std::string name = filename(); try { - AutoPtr pChannel = new FileChannel(fileName); + AutoPtr pChannel = new FileChannel(name); pChannel->setProperty(FileChannel::PROP_TIMES, "local"); pChannel->setProperty(FileChannel::PROP_ROTATION, rotation(DAY_HOUR_MIN)); pChannel->open(); @@ -161,24 +161,24 @@ void FileChannelTest::testRotateAtTimeDayLocal() Thread::sleep(1000); } pChannel->log(msg); - File f(fileName + ".0"); + File f(name + ".0"); assert (f.exists()); } catch (...) { - remove(fileName); + remove(name); throw; } - remove(fileName); + remove(name); } void FileChannelTest::testRotateAtTimeHourUTC() { - std::string fileName = filename(); + std::string name = filename(); try { - AutoPtr pChannel = new FileChannel(fileName); + AutoPtr pChannel = new FileChannel(name); pChannel->setProperty(FileChannel::PROP_TIMES, "utc"); pChannel->setProperty(FileChannel::PROP_ROTATION, rotation(HOUR_MIN)); pChannel->open(); @@ -190,24 +190,24 @@ void FileChannelTest::testRotateAtTimeHourUTC() Thread::sleep(1000); } pChannel->log(msg); - File f(fileName + ".0"); + File f(name + ".0"); assert (f.exists()); } catch (...) { - remove(fileName); + remove(name); throw; } - remove(fileName); + remove(name); } void FileChannelTest::testRotateAtTimeHourLocal() { - std::string fileName = filename(); + std::string name = filename(); try { - AutoPtr pChannel = new FileChannel(fileName); + AutoPtr pChannel = new FileChannel(name); pChannel->setProperty(FileChannel::PROP_TIMES, "local"); pChannel->setProperty(FileChannel::PROP_ROTATION, rotation(HOUR_MIN)); pChannel->open(); @@ -219,24 +219,24 @@ void FileChannelTest::testRotateAtTimeHourLocal() Thread::sleep(1000); } pChannel->log(msg); - File f(fileName + ".0"); + File f(name + ".0"); assert (f.exists()); } catch (...) { - remove(fileName); + remove(name); throw; } - remove(fileName); + remove(name); } void FileChannelTest::testRotateAtTimeMinUTC() { - std::string fileName = filename(); + std::string name = filename(); try { - AutoPtr pChannel = new FileChannel(fileName); + AutoPtr pChannel = new FileChannel(name); pChannel->setProperty(FileChannel::PROP_TIMES, "utc"); pChannel->setProperty(FileChannel::PROP_ROTATION, rotation(MIN)); pChannel->open(); @@ -248,24 +248,24 @@ void FileChannelTest::testRotateAtTimeMinUTC() Thread::sleep(1000); } pChannel->log(msg); - File f(fileName + ".0"); + File f(name + ".0"); assert (f.exists()); } catch (...) { - remove(fileName); + remove(name); throw; } - remove(fileName); + remove(name); } void FileChannelTest::testRotateAtTimeMinLocal() { - std::string fileName = filename(); + std::string name = filename(); try { - AutoPtr pChannel = new FileChannel(fileName); + AutoPtr pChannel = new FileChannel(name); pChannel->setProperty(FileChannel::PROP_TIMES, "local"); pChannel->setProperty(FileChannel::PROP_ROTATION, rotation(MIN)); pChannel->open(); @@ -277,24 +277,24 @@ void FileChannelTest::testRotateAtTimeMinLocal() Thread::sleep(1000); } pChannel->log(msg); - File f(fileName + ".0"); + File f(name + ".0"); assert (f.exists()); } catch (...) { - remove(fileName); + remove(name); throw; } - remove(fileName); + remove(name); } void FileChannelTest::testArchive() { - std::string fileName = filename(); + std::string name = filename(); try { - AutoPtr pChannel = new FileChannel(fileName); + AutoPtr pChannel = new FileChannel(name); pChannel->setProperty(FileChannel::PROP_ROTATION, "2 K"); pChannel->setProperty(FileChannel::PROP_ARCHIVE, "number"); pChannel->open(); @@ -303,24 +303,24 @@ void FileChannelTest::testArchive() { pChannel->log(msg); } - File f(fileName + ".0"); + File f(name + ".0"); assert (f.exists()); } catch (...) { - remove(fileName); + remove(name); throw; } - remove(fileName); + remove(name); } void FileChannelTest::testCompress() { - std::string fileName = filename(); + std::string name = filename(); try { - AutoPtr pChannel = new FileChannel(fileName); + AutoPtr pChannel = new FileChannel(name); pChannel->setProperty(FileChannel::PROP_ROTATION, "1 K"); pChannel->setProperty(FileChannel::PROP_ARCHIVE, "number"); pChannel->setProperty(FileChannel::PROP_COMPRESS, "true"); @@ -331,26 +331,26 @@ void FileChannelTest::testCompress() pChannel->log(msg); } Thread::sleep(3000); // allow time for background compression - File f0(fileName + ".0.gz"); + File f0(name + ".0.gz"); assert (f0.exists()); - File f1(fileName + ".1.gz"); + File f1(name + ".1.gz"); assert (f1.exists()); } catch (...) { - remove(fileName); + remove(name); throw; } - remove(fileName); + remove(name); } void FileChannelTest::purgeAge(const std::string& pa) { - std::string fileName = filename(); + std::string name = filename(); try { - AutoPtr pChannel = new FileChannel(fileName); + AutoPtr pChannel = new FileChannel(name); pChannel->setProperty(FileChannel::PROP_ROTATION, "1 K"); pChannel->setProperty(FileChannel::PROP_ARCHIVE, "number"); pChannel->setProperty(FileChannel::PROP_PURGEAGE, pa); @@ -360,11 +360,11 @@ void FileChannelTest::purgeAge(const std::string& pa) { pChannel->log(msg); } - File f0(fileName + ".0"); + File f0(name + ".0"); assert(f0.exists()); - File f1(fileName + ".1"); + File f1(name + ".1"); assert(f1.exists()); - File f2(fileName + ".2"); + File f2(name + ".2"); assert(f2.exists()); Thread::sleep(5000); @@ -377,20 +377,20 @@ void FileChannelTest::purgeAge(const std::string& pa) } catch (...) { - remove(fileName); + remove(name); throw; } - remove(fileName); + remove(name); } void FileChannelTest::noPurgeAge(const std::string& npa) { - std::string fileName = filename(); + std::string name = filename(); try { - AutoPtr pChannel = new FileChannel(fileName); + AutoPtr pChannel = new FileChannel(name); pChannel->setProperty(FileChannel::PROP_ROTATION, "1 K"); pChannel->setProperty(FileChannel::PROP_ARCHIVE, "number"); pChannel->setProperty(FileChannel::PROP_PURGEAGE, npa); @@ -400,11 +400,11 @@ void FileChannelTest::noPurgeAge(const std::string& npa) { pChannel->log(msg); } - File f0(fileName + ".0"); + File f0(name + ".0"); assert(f0.exists()); - File f1(fileName + ".1"); + File f1(name + ".1"); assert(f1.exists()); - File f2(fileName + ".2"); + File f2(name + ".2"); assert(f2.exists()); Thread::sleep(5000); @@ -417,10 +417,10 @@ void FileChannelTest::noPurgeAge(const std::string& npa) } catch (...) { - remove(fileName); + remove(name); throw; } - remove(fileName); + remove(name); } @@ -442,10 +442,10 @@ void FileChannelTest::testPurgeAge() void FileChannelTest::purgeCount(const std::string& pc) { - std::string fileName = filename(); + std::string name = filename(); try { - AutoPtr pChannel = new FileChannel(fileName); + AutoPtr pChannel = new FileChannel(name); pChannel->setProperty(FileChannel::PROP_ROTATION, "1 K"); pChannel->setProperty(FileChannel::PROP_ARCHIVE, "number"); pChannel->setProperty(FileChannel::PROP_PURGECOUNT, pc); @@ -456,27 +456,27 @@ void FileChannelTest::purgeCount(const std::string& pc) pChannel->log(msg); Thread::sleep(50); } - File f0(fileName + ".0"); + File f0(name + ".0"); assert(f0.exists()); - File f1(fileName + ".1"); + File f1(name + ".1"); assert(f1.exists()); - File f2(fileName + ".2"); + File f2(name + ".2"); assert(!f2.exists()); } catch (...) { - remove(fileName); + remove(name); throw; } - remove(fileName); + remove(name); } void FileChannelTest::noPurgeCount(const std::string& npc) { - std::string fileName = filename(); + std::string name = filename(); try { - AutoPtr pChannel = new FileChannel(fileName); + AutoPtr pChannel = new FileChannel(name); pChannel->setProperty(FileChannel::PROP_ROTATION, "1 K"); pChannel->setProperty(FileChannel::PROP_ARCHIVE, "number"); pChannel->setProperty(FileChannel::PROP_PURGECOUNT, npc); @@ -487,18 +487,18 @@ void FileChannelTest::noPurgeCount(const std::string& npc) pChannel->log(msg); Thread::sleep(50); } - File f0(fileName + ".0"); + File f0(name + ".0"); assert(f0.exists()); - File f1(fileName + ".1"); + File f1(name + ".1"); assert(f1.exists()); - File f2(fileName + ".2"); + File f2(name + ".2"); assert(f2.exists()); } catch (...) { - remove(fileName); + remove(name); throw; } - remove(fileName); + remove(name); } @@ -520,8 +520,8 @@ void FileChannelTest::testPurgeCount() void FileChannelTest::testWrongPurgeOption() { - std::string fileName = filename(); - AutoPtr pChannel = new FileChannel(fileName); + std::string name = filename(); + AutoPtr pChannel = new FileChannel(name); pChannel->setProperty(FileChannel::PROP_PURGEAGE, "5 seconds"); try @@ -542,7 +542,7 @@ void FileChannelTest::testWrongPurgeOption() assert(pChannel->getProperty(FileChannel::PROP_PURGEAGE) == "5 seconds"); } - remove(fileName); + remove(name); } @@ -569,11 +569,11 @@ void FileChannelTest::remove(const std::string& baseName) } ++it; } - for (std::vector::iterator itFiles = files.begin(); itFiles != files.end(); ++itFiles) + for (std::vector::iterator it = files.begin(); it != files.end(); ++it) { try { - File f(*itFiles); + File f(*it); f.remove(); } catch (...) { @@ -584,10 +584,10 @@ void FileChannelTest::remove(const std::string& baseName) std::string FileChannelTest::filename() const { - std::string ret = "log_"; - ret.append(DateTimeFormatter::format(Timestamp(), "%Y%m%d%H%M%S")); - ret.append(".log"); - return ret; + std::string name = "log_"; + name.append(DateTimeFormatter::format(Timestamp(), "%Y%m%d%H%M%S")); + name.append(".log"); + return name; } @@ -595,7 +595,7 @@ template std::string FileChannelTest::rotation(TimeRotation rtype) const { DT now; - std::string ret; + std::string rotation; int day = now.dayOfWeek(); int min = now.minute(); @@ -615,20 +615,20 @@ std::string FileChannelTest::rotation(TimeRotation rtype) const switch (rtype) { case DAY_HOUR_MIN: // day,hh:m, - ret = DateTimeFormat::WEEKDAY_NAMES[day]; - ret += ',' + NumberFormatter::format0(hour, 2) + ':' + NumberFormatter::format0(min, 2); + rotation = DateTimeFormat::WEEKDAY_NAMES[day]; + rotation += ',' + NumberFormatter::format0(hour, 2) + ':' + NumberFormatter::format0(min, 2); break; case HOUR_MIN: // hh:mm - ret = NumberFormatter::format0(hour, 2) + ':' + NumberFormatter::format0(min, 2); + rotation = NumberFormatter::format0(hour, 2) + ':' + NumberFormatter::format0(min, 2); break; case MIN: // mm - ret = ':' + NumberFormatter::format0(min, 2); + rotation = ':' + NumberFormatter::format0(min, 2); break; default: - ret = ""; + rotation = ""; break; } - return ret; + return rotation; } diff --git a/Foundation/testsuite/src/NDCTest.cpp b/Foundation/testsuite/src/NDCTest.cpp index 64a021c4d..aa450a06b 100644 --- a/Foundation/testsuite/src/NDCTest.cpp +++ b/Foundation/testsuite/src/NDCTest.cpp @@ -50,13 +50,13 @@ void NDCTest::testNDC() void NDCTest::testNDCScope() { - Poco::NDCScope item1("item1", __LINE__, __FILE__); + poco_ndc("item1"); assert (NDC::current().depth() == 1); { - Poco::NDCScope item2("item2", __LINE__, __FILE__); + poco_ndc("item2"); assert (NDC::current().depth() == 2); { - Poco::NDCScope item3("item3", __LINE__, __FILE__); + poco_ndc("item3"); assert (NDC::current().depth() == 3); NDC::current().dump(std::cout); } diff --git a/Foundation/testsuite/src/NotificationQueueTest.cpp b/Foundation/testsuite/src/NotificationQueueTest.cpp index 123d42e81..1c2fe5caa 100644 --- a/Foundation/testsuite/src/NotificationQueueTest.cpp +++ b/Foundation/testsuite/src/NotificationQueueTest.cpp @@ -32,7 +32,7 @@ namespace class QTestNotification: public Notification { public: - QTestNotification(const std::string& rData): _data(rData) + QTestNotification(const std::string& data): _data(data) { } ~QTestNotification() diff --git a/Foundation/testsuite/src/PathTest.cpp b/Foundation/testsuite/src/PathTest.cpp index d4d93195f..c2e07f829 100644 --- a/Foundation/testsuite/src/PathTest.cpp +++ b/Foundation/testsuite/src/PathTest.cpp @@ -1451,7 +1451,7 @@ void PathTest::testRobustness() { int len = r.next(1024); std::string s; - for (int j = 0; j < len; ++j) s += r.nextChar(); + for (int i = 0; i < len; ++i) s += r.nextChar(); try { Path p(s, Path::PATH_WINDOWS); diff --git a/Foundation/testsuite/src/PriorityNotificationQueueTest.cpp b/Foundation/testsuite/src/PriorityNotificationQueueTest.cpp index dfb428262..9ad49892a 100644 --- a/Foundation/testsuite/src/PriorityNotificationQueueTest.cpp +++ b/Foundation/testsuite/src/PriorityNotificationQueueTest.cpp @@ -32,7 +32,7 @@ namespace class QTestNotification: public Notification { public: - QTestNotification(const std::string& rData): _data(rData) + QTestNotification(const std::string& data): _data(data) { } ~QTestNotification() diff --git a/Foundation/testsuite/src/ProcessTest.cpp b/Foundation/testsuite/src/ProcessTest.cpp index 833ca3bbb..c6f853ee0 100644 --- a/Foundation/testsuite/src/ProcessTest.cpp +++ b/Foundation/testsuite/src/ProcessTest.cpp @@ -39,18 +39,18 @@ ProcessTest::~ProcessTest() void ProcessTest::testLaunch() { - std::string testName("TestApp"); + std::string name("TestApp"); std::string cmd; #if defined(POCO_OS_FAMILY_UNIX) cmd = "./"; - cmd += testName; + cmd += name; #elif defined(_WIN32_WCE) cmd = "\\"; - cmd += testName; + cmd += name; cmd += ".EXE"; #else - cmd = testName; + cmd = name; #endif std::vector args; @@ -66,14 +66,14 @@ void ProcessTest::testLaunch() void ProcessTest::testLaunchRedirectIn() { #if !defined(_WIN32_WCE) - std::string testName("TestApp"); + std::string name("TestApp"); std::string cmd; #if defined(POCO_OS_FAMILY_UNIX) cmd = "./"; - cmd += testName; + cmd += name; #else - cmd = testName; + cmd = name; #endif std::vector args; @@ -92,14 +92,14 @@ void ProcessTest::testLaunchRedirectIn() void ProcessTest::testLaunchRedirectOut() { #if !defined(_WIN32_WCE) - std::string testName("TestApp"); + std::string name("TestApp"); std::string cmd; #if defined(POCO_OS_FAMILY_UNIX) cmd = "./"; - cmd += testName; + cmd += name; #else - cmd = testName; + cmd = name; #endif std::vector args; @@ -120,14 +120,14 @@ void ProcessTest::testLaunchRedirectOut() void ProcessTest::testLaunchEnv() { #if !defined(_WIN32_WCE) - std::string testName("TestApp"); + std::string name("TestApp"); std::string cmd; #if defined(POCO_OS_FAMILY_UNIX) cmd = "./"; - cmd += testName; + cmd += name; #else - cmd = testName; + cmd = name; #endif std::vector args; @@ -203,14 +203,14 @@ void ProcessTest::testLaunchArgs() void ProcessTest::testIsRunning() { #if !defined(_WIN32_WCE) - std::string testName("TestApp"); + std::string name("TestApp"); std::string cmd; #if defined(POCO_OS_FAMILY_UNIX) cmd = "./"; - cmd += testName; + cmd += name; #else - cmd = testName; + cmd = name; #endif std::vector args; @@ -233,14 +233,14 @@ void ProcessTest::testIsRunning() void ProcessTest::testIsRunningAllowsForTermination() { #if !defined(_WIN32_WCE) - std::string testName("TestApp"); + std::string name("TestApp"); std::string cmd; #if defined(POCO_OS_FAMILY_UNIX) cmd = "./"; - cmd += testName; + cmd += name; #else - cmd = testName; + cmd = name; #endif std::vector args; @@ -254,11 +254,11 @@ void ProcessTest::testIsRunningAllowsForTermination() void ProcessTest::testSignalExitCode() { #if defined(POCO_OS_FAMILY_UNIX) - std::string testName("TestApp"); + std::string name("TestApp"); std::string cmd; cmd = "./"; - cmd += testName; + cmd += name; std::vector args; args.push_back("-raise-int"); diff --git a/Foundation/testsuite/src/SimpleFileChannelTest.cpp b/Foundation/testsuite/src/SimpleFileChannelTest.cpp index a143db33f..248a10680 100644 --- a/Foundation/testsuite/src/SimpleFileChannelTest.cpp +++ b/Foundation/testsuite/src/SimpleFileChannelTest.cpp @@ -45,10 +45,10 @@ SimpleFileChannelTest::~SimpleFileChannelTest() void SimpleFileChannelTest::testRotate() { - std::string fileName = filename(); + std::string name = filename(); try { - AutoPtr pChannel = new SimpleFileChannel(fileName); + AutoPtr pChannel = new SimpleFileChannel(name); pChannel->setProperty(SimpleFileChannel::PROP_ROTATION, "2 K"); pChannel->open(); Message msg("source", "This is a log file entry", Message::PRIO_INFORMATION); @@ -56,18 +56,18 @@ void SimpleFileChannelTest::testRotate() { pChannel->log(msg); } - File f(fileName); + File f(name); assert (f.exists()); - f = fileName + ".0"; + f = name + ".0"; assert (f.exists()); assert (f.getSize() >= 2048); } catch (...) { - remove(fileName); + remove(name); throw; } - remove(fileName); + remove(name); } @@ -94,11 +94,11 @@ void SimpleFileChannelTest::remove(const std::string& baseName) } ++it; } - for (std::vector::iterator itFiles = files.begin(); itFiles != files.end(); ++itFiles) + for (std::vector::iterator it = files.begin(); it != files.end(); ++it) { try { - File f(*itFiles); + File f(*it); f.remove(); } catch (...) @@ -110,10 +110,10 @@ void SimpleFileChannelTest::remove(const std::string& baseName) std::string SimpleFileChannelTest::filename() const { - std::string ret = "log_"; - ret.append(DateTimeFormatter::format(Timestamp(), "%Y%m%d%H%M%S")); - ret.append(".log"); - return ret; + std::string name = "log_"; + name.append(DateTimeFormatter::format(Timestamp(), "%Y%m%d%H%M%S")); + name.append(".log"); + return name; } diff --git a/Foundation/testsuite/src/StringTest.cpp b/Foundation/testsuite/src/StringTest.cpp index e26f4fca9..3ba96c6ad 100644 --- a/Foundation/testsuite/src/StringTest.cpp +++ b/Foundation/testsuite/src/StringTest.cpp @@ -82,8 +82,8 @@ void StringTest::testTrimLeft() std::string s = "abc"; assert (trimLeft(s) == "abc"); } - std::string s2 = " abc "; - assert (trimLeft(s2) == "abc "); + std::string s = " abc "; + assert (trimLeft(s) == "abc "); { std::string s = " ab c "; assert (trimLeft(s) == "ab c "); diff --git a/Foundation/testsuite/src/TaskManagerTest.cpp b/Foundation/testsuite/src/TaskManagerTest.cpp index 8dabfc04e..d71cf4f9d 100644 --- a/Foundation/testsuite/src/TaskManagerTest.cpp +++ b/Foundation/testsuite/src/TaskManagerTest.cpp @@ -209,7 +209,7 @@ namespace class CustomTaskObserver { public: - CustomTaskObserver(const C& rCustom): _custom(rCustom) + CustomTaskObserver(const C& custom): _custom(custom) { } diff --git a/Foundation/testsuite/src/TimedNotificationQueueTest.cpp b/Foundation/testsuite/src/TimedNotificationQueueTest.cpp index 02ecd2d07..c2b08950b 100644 --- a/Foundation/testsuite/src/TimedNotificationQueueTest.cpp +++ b/Foundation/testsuite/src/TimedNotificationQueueTest.cpp @@ -28,7 +28,7 @@ namespace class QTestNotification: public Notification { public: - QTestNotification(const std::string& rData): _data(rData) + QTestNotification(const std::string& data): _data(data) { } ~QTestNotification() diff --git a/Foundation/testsuite/src/VarTest.cpp b/Foundation/testsuite/src/VarTest.cpp index 0bd9016f3..f473990e0 100644 --- a/Foundation/testsuite/src/VarTest.cpp +++ b/Foundation/testsuite/src/VarTest.cpp @@ -2511,13 +2511,13 @@ void VarTest::testEmpty() try { - int j = da; + int i = da; fail ("must fail"); } catch (InvalidAccessException&) { } try { - int j = da.extract(); + int i = da.extract(); fail ("must fail"); } catch (InvalidAccessException&) { } } From 289b05c8b30f159a5cfff8127ff25d8eebdf81bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Mon, 5 Sep 2016 08:29:59 +0200 Subject: [PATCH 22/31] Revert "GH #1050 Zip: fix gcc -Wshadow warnings" --- CppUnit/include/Poco/CppUnit/CppUnitException.h | 6 +++--- CppUnit/include/Poco/CppUnit/TestCaller.h | 6 +++--- CppUnit/include/Poco/CppUnit/TestCase.h | 2 +- CppUnit/include/Poco/CppUnit/TestFailure.h | 2 +- Zip/src/Compress.cpp | 8 ++++---- Zip/src/ZipLocalFileHeader.cpp | 10 +++++----- Zip/testsuite/src/CompressTest.cpp | 2 +- Zip/testsuite/src/PartialStreamTest.cpp | 2 +- Zip/testsuite/src/ZipTest.cpp | 2 +- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/CppUnit/include/Poco/CppUnit/CppUnitException.h b/CppUnit/include/Poco/CppUnit/CppUnitException.h index 46fc44bbd..670290c58 100644 --- a/CppUnit/include/Poco/CppUnit/CppUnitException.h +++ b/CppUnit/include/Poco/CppUnit/CppUnitException.h @@ -68,17 +68,17 @@ inline CppUnitException::CppUnitException(const CppUnitException& other): except } -inline CppUnitException::CppUnitException (const std::string& message, long line, const std::string& rFileName): _message(message), _lineNumber(line), _data1lineNumber(CPPUNIT_UNKNOWNLINENUMBER), _data2lineNumber(CPPUNIT_UNKNOWNLINENUMBER), _fileName(rFileName) +inline CppUnitException::CppUnitException (const std::string& message, long lineNumber, const std::string& fileName): _message(message), _lineNumber(lineNumber), _data1lineNumber(CPPUNIT_UNKNOWNLINENUMBER), _data2lineNumber(CPPUNIT_UNKNOWNLINENUMBER), _fileName(fileName) { } -inline CppUnitException::CppUnitException (const std::string& message, long line, long data1lineNumber, const std::string& rFileName): _message(message), _lineNumber(line), _data1lineNumber(data1lineNumber), _data2lineNumber(CPPUNIT_UNKNOWNLINENUMBER), _fileName(rFileName) +inline CppUnitException::CppUnitException (const std::string& message, long lineNumber, long data1lineNumber, const std::string& fileName): _message(message), _lineNumber(lineNumber), _data1lineNumber(data1lineNumber), _data2lineNumber(CPPUNIT_UNKNOWNLINENUMBER), _fileName(fileName) { } -inline CppUnitException::CppUnitException (const std::string& message, long line, long data1lineNumber, long data2lineNumber, const std::string& rFileName): _message(message), _lineNumber(line), _data1lineNumber(data1lineNumber), _data2lineNumber(data2lineNumber), _fileName(rFileName) +inline CppUnitException::CppUnitException (const std::string& message, long lineNumber, long data1lineNumber, long data2lineNumber, const std::string& fileName): _message(message), _lineNumber(lineNumber), _data1lineNumber(data1lineNumber), _data2lineNumber(data2lineNumber), _fileName(fileName) { } diff --git a/CppUnit/include/Poco/CppUnit/TestCaller.h b/CppUnit/include/Poco/CppUnit/TestCaller.h index cfafaa2ce..d859bb7ce 100644 --- a/CppUnit/include/Poco/CppUnit/TestCaller.h +++ b/CppUnit/include/Poco/CppUnit/TestCaller.h @@ -56,10 +56,10 @@ class TestCaller: public TestCase typedef void (Fixture::*TestMethod)(); public: - TestCaller(const std::string& rName, TestMethod test): - TestCase(rName), + TestCaller(const std::string& name, TestMethod test): + TestCase(name), _test(test), - _fixture(new Fixture(rName)) + _fixture(new Fixture(name)) { } diff --git a/CppUnit/include/Poco/CppUnit/TestCase.h b/CppUnit/include/Poco/CppUnit/TestCase.h index b1ede419f..cbe648a57 100644 --- a/CppUnit/include/Poco/CppUnit/TestCase.h +++ b/CppUnit/include/Poco/CppUnit/TestCase.h @@ -173,7 +173,7 @@ protected: // Constructs a test case -inline TestCase::TestCase(const std::string& rName): _name (rName) +inline TestCase::TestCase(const std::string& name): _name (name) { } diff --git a/CppUnit/include/Poco/CppUnit/TestFailure.h b/CppUnit/include/Poco/CppUnit/TestFailure.h index eb391a6bb..830dec1c8 100644 --- a/CppUnit/include/Poco/CppUnit/TestFailure.h +++ b/CppUnit/include/Poco/CppUnit/TestFailure.h @@ -52,7 +52,7 @@ protected: // Constructs a TestFailure with the given test and exception. -inline TestFailure::TestFailure(Test* pFailedTest, CppUnitException* pThrownException): _failedTest(pFailedTest), _thrownException(pThrownException) +inline TestFailure::TestFailure(Test* failedTest, CppUnitException* thrownException): _failedTest(failedTest), _thrownException(thrownException) { } diff --git a/Zip/src/Compress.cpp b/Zip/src/Compress.cpp index ed558d771..b335a3074 100644 --- a/Zip/src/Compress.cpp +++ b/Zip/src/Compress.cpp @@ -155,8 +155,8 @@ void Compress::addFileRaw(std::istream& in, const ZipLocalFileHeader& h, const P if(hdr.hasExtraField()) // Update sizes in header extension. hdr.setZip64Data(); _out.seekp(hdr.getStartPos(), std::ios_base::beg); - std::string headerString = hdr.createHeader(); - _out.write(headerString.c_str(), static_cast(headerString.size())); + std::string header = hdr.createHeader(); + _out.write(header.c_str(), static_cast(header.size())); _out.seekp(0, std::ios_base::end); } @@ -273,8 +273,8 @@ void Compress::addRecursive(const Poco::Path& entry, ZipCommon::CompressionMetho { Poco::Path realFile(entry, *it); Poco::Path renamedFile(aName, *it); - Poco::File file(realFile); - if (file.isDirectory()) + Poco::File aFile(realFile); + if (aFile.isDirectory()) { realFile.makeDirectory(); renamedFile.makeDirectory(); diff --git a/Zip/src/ZipLocalFileHeader.cpp b/Zip/src/ZipLocalFileHeader.cpp index fde3b1f24..a2a7eb7ba 100644 --- a/Zip/src/ZipLocalFileHeader.cpp +++ b/Zip/src/ZipLocalFileHeader.cpp @@ -31,7 +31,7 @@ const char ZipLocalFileHeader::HEADER[ZipCommon::HEADER_SIZE] = {'\x50', '\x4b', ZipLocalFileHeader::ZipLocalFileHeader(const Poco::Path& fileName, - const Poco::DateTime& lastModified, + const Poco::DateTime& lastModifiedAt, ZipCommon::CompressionMethod cm, ZipCommon::CompressionLevel cl, bool forceZip64): @@ -51,7 +51,7 @@ ZipLocalFileHeader::ZipLocalFileHeader(const Poco::Path& fileName, setHostSystem(ZipCommon::HS_FAT); setEncryption(false); setExtraFieldSize(0); - setLastModifiedAt(lastModified); + setLastModifiedAt(lastModifiedAt); init(fileName, cm, cl); } @@ -186,12 +186,12 @@ bool ZipLocalFileHeader::searchCRCAndSizesAfterData() const } -void ZipLocalFileHeader::setFileName(const std::string& fileName, bool directory) +void ZipLocalFileHeader::setFileName(const std::string& fileName, bool isDirectory) { poco_assert (!fileName.empty()); Poco::Path aPath(fileName); - if (directory) + if (isDirectory) { aPath.makeDirectory(); setCRC(0); @@ -207,7 +207,7 @@ void ZipLocalFileHeader::setFileName(const std::string& fileName, bool directory _fileName = aPath.toString(Poco::Path::PATH_UNIX); if (_fileName[0] == '/') _fileName = _fileName.substr(1); - if (directory) + if (isDirectory) { poco_assert_dbg (_fileName[_fileName.size()-1] == '/'); } diff --git a/Zip/testsuite/src/CompressTest.cpp b/Zip/testsuite/src/CompressTest.cpp index 664c1cf3b..d14a4a959 100644 --- a/Zip/testsuite/src/CompressTest.cpp +++ b/Zip/testsuite/src/CompressTest.cpp @@ -28,7 +28,7 @@ using namespace Poco::Zip; -CompressTest::CompressTest(const std::string& rName): CppUnit::TestCase(rName) +CompressTest::CompressTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Zip/testsuite/src/PartialStreamTest.cpp b/Zip/testsuite/src/PartialStreamTest.cpp index 336ab12cb..619472306 100644 --- a/Zip/testsuite/src/PartialStreamTest.cpp +++ b/Zip/testsuite/src/PartialStreamTest.cpp @@ -20,7 +20,7 @@ using namespace Poco::Zip; -PartialStreamTest::PartialStreamTest(const std::string& rName): CppUnit::TestCase(rName) +PartialStreamTest::PartialStreamTest(const std::string& name): CppUnit::TestCase(name) { } diff --git a/Zip/testsuite/src/ZipTest.cpp b/Zip/testsuite/src/ZipTest.cpp index e697290bb..5ef109286 100644 --- a/Zip/testsuite/src/ZipTest.cpp +++ b/Zip/testsuite/src/ZipTest.cpp @@ -35,7 +35,7 @@ using namespace Poco::Zip; -ZipTest::ZipTest(const std::string& rName): CppUnit::TestCase(rName) +ZipTest::ZipTest(const std::string& name): CppUnit::TestCase(name) { } From 81b140e0a9058bc6c6f19a543e2d1691b71e71e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Mon, 5 Sep 2016 08:31:43 +0200 Subject: [PATCH 23/31] Revert "GH #1050 NetSSL_OpenSSL: fix gcc -Wshadow warnings" --- Foundation/include/Poco/Optional.h | 12 +++++----- Net/src/MailMessage.cpp | 8 +++---- NetSSL_OpenSSL/src/Context.cpp | 24 +++++++++---------- NetSSL_OpenSSL/src/HTTPSClientSession.cpp | 12 +++++----- .../src/SecureSMTPClientSession.cpp | 4 ++-- NetSSL_OpenSSL/src/SecureServerSocket.cpp | 16 ++++++------- NetSSL_OpenSSL/src/SecureServerSocketImpl.cpp | 14 +++++------ NetSSL_OpenSSL/src/SecureStreamSocket.cpp | 24 +++++++++---------- NetSSL_OpenSSL/src/SecureStreamSocketImpl.cpp | 18 +++++++------- NetSSL_OpenSSL/src/X509Certificate.cpp | 6 ++--- XML/src/XMLWriter.cpp | 10 ++++---- 11 files changed, 74 insertions(+), 74 deletions(-) diff --git a/Foundation/include/Poco/Optional.h b/Foundation/include/Poco/Optional.h index d942b5580..48cc62e30 100644 --- a/Foundation/include/Poco/Optional.h +++ b/Foundation/include/Poco/Optional.h @@ -62,9 +62,9 @@ public: { } - Optional(const C& rValue): + Optional(const C& value): /// Creates a Optional with the given value. - _value(rValue), + _value(value), _isSpecified(true) { } @@ -81,10 +81,10 @@ public: { } - Optional& assign(const C& rValue) + Optional& assign(const C& value) /// Assigns a value to the Optional. { - _value = rValue; + _value = value; _isSpecified = true; return *this; } @@ -97,9 +97,9 @@ public: return *this; } - Optional& operator = (const C& rValue) + Optional& operator = (const C& value) { - return assign(rValue); + return assign(value); } Optional& operator = (const Optional& other) diff --git a/Net/src/MailMessage.cpp b/Net/src/MailMessage.cpp index f3edefa66..69a6d88c1 100644 --- a/Net/src/MailMessage.cpp +++ b/Net/src/MailMessage.cpp @@ -214,9 +214,9 @@ void MailMessage::addRecipient(const MailRecipient& recipient) } -void MailMessage::setRecipients(const Recipients& rRecipients) +void MailMessage::setRecipients(const Recipients& recipients) { - _recipients.assign(rRecipients.begin(), rRecipients.end()); + _recipients.assign(recipients.begin(), recipients.end()); } @@ -326,12 +326,12 @@ void MailMessage::addAttachment(const std::string& name, PartSource* pSource, Co } -void MailMessage::read(std::istream& istr, PartHandler& rHandler) +void MailMessage::read(std::istream& istr, PartHandler& handler) { readHeader(istr); if (isMultipart()) { - readMultipart(istr, rHandler); + readMultipart(istr, handler); } else { diff --git a/NetSSL_OpenSSL/src/Context.cpp b/NetSSL_OpenSSL/src/Context.cpp index 086ad3248..aa5e314ab 100644 --- a/NetSSL_OpenSSL/src/Context.cpp +++ b/NetSSL_OpenSSL/src/Context.cpp @@ -41,8 +41,8 @@ Context::Params::Params(): } -Context::Context(Usage contextUsage, const Params& params): - _usage(contextUsage), +Context::Context(Usage usage, const Params& params): + _usage(usage), _mode(params.verificationMode), _pSSLContext(0), _extendedCertificateVerification(true) @@ -52,16 +52,16 @@ Context::Context(Usage contextUsage, const Params& params): Context::Context( - Usage contextUsage, + Usage usage, const std::string& privateKeyFile, const std::string& certificateFile, const std::string& caLocation, - VerificationMode mode, + VerificationMode verificationMode, int verificationDepth, bool loadDefaultCAs, const std::string& cipherList): - _usage(contextUsage), - _mode(mode), + _usage(usage), + _mode(verificationMode), _pSSLContext(0), _extendedCertificateVerification(true) { @@ -69,7 +69,7 @@ Context::Context( params.privateKeyFile = privateKeyFile; params.certificateFile = certificateFile; params.caLocation = caLocation; - params.verificationMode = mode; + params.verificationMode = verificationMode; params.verificationDepth = verificationDepth; params.loadDefaultCAs = loadDefaultCAs; params.cipherList = cipherList; @@ -78,20 +78,20 @@ Context::Context( Context::Context( - Usage contextUsage, + Usage usage, const std::string& caLocation, - VerificationMode mode, + VerificationMode verificationMode, int verificationDepth, bool loadDefaultCAs, const std::string& cipherList): - _usage(contextUsage), - _mode(mode), + _usage(usage), + _mode(verificationMode), _pSSLContext(0), _extendedCertificateVerification(true) { Params params; params.caLocation = caLocation; - params.verificationMode = mode; + params.verificationMode = verificationMode; params.verificationDepth = verificationDepth; params.loadDefaultCAs = loadDefaultCAs; params.cipherList = cipherList; diff --git a/NetSSL_OpenSSL/src/HTTPSClientSession.cpp b/NetSSL_OpenSSL/src/HTTPSClientSession.cpp index c632c501a..567e256bf 100644 --- a/NetSSL_OpenSSL/src/HTTPSClientSession.cpp +++ b/NetSSL_OpenSSL/src/HTTPSClientSession.cpp @@ -41,17 +41,17 @@ HTTPSClientSession::HTTPSClientSession(): } -HTTPSClientSession::HTTPSClientSession(const SecureStreamSocket& rSocket): - HTTPClientSession(rSocket), - _pContext(rSocket.context()) +HTTPSClientSession::HTTPSClientSession(const SecureStreamSocket& socket): + HTTPClientSession(socket), + _pContext(socket.context()) { setPort(HTTPS_PORT); } -HTTPSClientSession::HTTPSClientSession(const SecureStreamSocket& rSocket, Session::Ptr pSession): - HTTPClientSession(rSocket), - _pContext(rSocket.context()), +HTTPSClientSession::HTTPSClientSession(const SecureStreamSocket& socket, Session::Ptr pSession): + HTTPClientSession(socket), + _pContext(socket.context()), _pSession(pSession) { setPort(HTTPS_PORT); diff --git a/NetSSL_OpenSSL/src/SecureSMTPClientSession.cpp b/NetSSL_OpenSSL/src/SecureSMTPClientSession.cpp index bee2cbee8..b441e8184 100644 --- a/NetSSL_OpenSSL/src/SecureSMTPClientSession.cpp +++ b/NetSSL_OpenSSL/src/SecureSMTPClientSession.cpp @@ -24,8 +24,8 @@ namespace Poco { namespace Net { -SecureSMTPClientSession::SecureSMTPClientSession(const StreamSocket& rSocket): - SMTPClientSession(rSocket) +SecureSMTPClientSession::SecureSMTPClientSession(const StreamSocket& socket): + SMTPClientSession(socket) { } diff --git a/NetSSL_OpenSSL/src/SecureServerSocket.cpp b/NetSSL_OpenSSL/src/SecureServerSocket.cpp index 07f192a3f..6308ccc09 100644 --- a/NetSSL_OpenSSL/src/SecureServerSocket.cpp +++ b/NetSSL_OpenSSL/src/SecureServerSocket.cpp @@ -48,18 +48,18 @@ SecureServerSocket::SecureServerSocket(const Socket& socket): } -SecureServerSocket::SecureServerSocket(const SocketAddress& rAddress, int backlog): +SecureServerSocket::SecureServerSocket(const SocketAddress& address, int backlog): ServerSocket(new SecureServerSocketImpl(SSLManager::instance().defaultServerContext()), true) { - impl()->bind(rAddress, true); + impl()->bind(address, true); impl()->listen(backlog); } -SecureServerSocket::SecureServerSocket(const SocketAddress& rAddress, int backlog, Context::Ptr pContext): +SecureServerSocket::SecureServerSocket(const SocketAddress& address, int backlog, Context::Ptr pContext): ServerSocket(new SecureServerSocketImpl(pContext), true) { - impl()->bind(rAddress, true); + impl()->bind(address, true); impl()->listen(backlog); } @@ -68,8 +68,8 @@ SecureServerSocket::SecureServerSocket(Poco::UInt16 port, int backlog): ServerSocket(new SecureServerSocketImpl(SSLManager::instance().defaultServerContext()), true) { IPAddress wildcardAddr; - SocketAddress socketAddress(wildcardAddr, port); - impl()->bind(socketAddress, true); + SocketAddress address(wildcardAddr, port); + impl()->bind(address, true); impl()->listen(backlog); } @@ -77,8 +77,8 @@ SecureServerSocket::SecureServerSocket(Poco::UInt16 port, int backlog, Context:: ServerSocket(new SecureServerSocketImpl(pContext), true) { IPAddress wildcardAddr; - SocketAddress socketAddress(wildcardAddr, port); - impl()->bind(socketAddress, true); + SocketAddress address(wildcardAddr, port); + impl()->bind(address, true); impl()->listen(backlog); } diff --git a/NetSSL_OpenSSL/src/SecureServerSocketImpl.cpp b/NetSSL_OpenSSL/src/SecureServerSocketImpl.cpp index ac4e323bd..dc8c5b898 100644 --- a/NetSSL_OpenSSL/src/SecureServerSocketImpl.cpp +++ b/NetSSL_OpenSSL/src/SecureServerSocketImpl.cpp @@ -46,27 +46,27 @@ SocketImpl* SecureServerSocketImpl::acceptConnection(SocketAddress& clientAddr) } -void SecureServerSocketImpl::connect(const SocketAddress& rAddress) +void SecureServerSocketImpl::connect(const SocketAddress& address) { throw Poco::InvalidAccessException("Cannot connect() a SecureServerSocket"); } -void SecureServerSocketImpl::connect(const SocketAddress& rAddress, const Poco::Timespan& timeout) +void SecureServerSocketImpl::connect(const SocketAddress& address, const Poco::Timespan& timeout) { throw Poco::InvalidAccessException("Cannot connect() a SecureServerSocket"); } -void SecureServerSocketImpl::connectNB(const SocketAddress& rAddress) +void SecureServerSocketImpl::connectNB(const SocketAddress& address) { throw Poco::InvalidAccessException("Cannot connect() a SecureServerSocket"); } -void SecureServerSocketImpl::bind(const SocketAddress& rAddress, bool reuseAddress) +void SecureServerSocketImpl::bind(const SocketAddress& address, bool reuseAddress) { - _impl.bind(rAddress, reuseAddress); + _impl.bind(address, reuseAddress); reset(_impl.sockfd()); } @@ -97,13 +97,13 @@ int SecureServerSocketImpl::receiveBytes(void* buffer, int length, int flags) } -int SecureServerSocketImpl::sendTo(const void* buffer, int length, const SocketAddress& rAddress, int flags) +int SecureServerSocketImpl::sendTo(const void* buffer, int length, const SocketAddress& address, int flags) { throw Poco::InvalidAccessException("Cannot sendTo() on a SecureServerSocket"); } -int SecureServerSocketImpl::receiveFrom(void* buffer, int length, SocketAddress& rAddress, int flags) +int SecureServerSocketImpl::receiveFrom(void* buffer, int length, SocketAddress& address, int flags) { throw Poco::InvalidAccessException("Cannot receiveFrom() on a SecureServerSocket"); } diff --git a/NetSSL_OpenSSL/src/SecureStreamSocket.cpp b/NetSSL_OpenSSL/src/SecureStreamSocket.cpp index 4e6d5b26c..635a8a331 100644 --- a/NetSSL_OpenSSL/src/SecureStreamSocket.cpp +++ b/NetSSL_OpenSSL/src/SecureStreamSocket.cpp @@ -47,50 +47,50 @@ SecureStreamSocket::SecureStreamSocket(Context::Ptr pContext, Session::Ptr pSess } -SecureStreamSocket::SecureStreamSocket(const SocketAddress& rAddress): +SecureStreamSocket::SecureStreamSocket(const SocketAddress& address): StreamSocket(new SecureStreamSocketImpl(SSLManager::instance().defaultClientContext())) { - connect(rAddress); + connect(address); } -SecureStreamSocket::SecureStreamSocket(const SocketAddress& rAddress, const std::string& hostName): +SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, const std::string& hostName): StreamSocket(new SecureStreamSocketImpl(SSLManager::instance().defaultClientContext())) { static_cast(impl())->setPeerHostName(hostName); - connect(rAddress); + connect(address); } -SecureStreamSocket::SecureStreamSocket(const SocketAddress& rAddress, Context::Ptr pContext): +SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, Context::Ptr pContext): StreamSocket(new SecureStreamSocketImpl(pContext)) { - connect(rAddress); + connect(address); } -SecureStreamSocket::SecureStreamSocket(const SocketAddress& rAddress, Context::Ptr pContext, Session::Ptr pSession): +SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, Context::Ptr pContext, Session::Ptr pSession): StreamSocket(new SecureStreamSocketImpl(pContext)) { useSession(pSession); - connect(rAddress); + connect(address); } -SecureStreamSocket::SecureStreamSocket(const SocketAddress& rAddress, const std::string& hostName, Context::Ptr pContext): +SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, const std::string& hostName, Context::Ptr pContext): StreamSocket(new SecureStreamSocketImpl(pContext)) { static_cast(impl())->setPeerHostName(hostName); - connect(rAddress); + connect(address); } -SecureStreamSocket::SecureStreamSocket(const SocketAddress& rAddress, const std::string& hostName, Context::Ptr pContext, Session::Ptr pSession): +SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, const std::string& hostName, Context::Ptr pContext, Session::Ptr pSession): StreamSocket(new SecureStreamSocketImpl(pContext)) { static_cast(impl())->setPeerHostName(hostName); useSession(pSession); - connect(rAddress); + connect(address); } diff --git a/NetSSL_OpenSSL/src/SecureStreamSocketImpl.cpp b/NetSSL_OpenSSL/src/SecureStreamSocketImpl.cpp index 2201e4b35..efb2fd2f4 100644 --- a/NetSSL_OpenSSL/src/SecureStreamSocketImpl.cpp +++ b/NetSSL_OpenSSL/src/SecureStreamSocketImpl.cpp @@ -64,23 +64,23 @@ void SecureStreamSocketImpl::acceptSSL() } -void SecureStreamSocketImpl::connect(const SocketAddress& rAddress) +void SecureStreamSocketImpl::connect(const SocketAddress& address) { - _impl.connect(rAddress, !_lazyHandshake); + _impl.connect(address, !_lazyHandshake); reset(_impl.sockfd()); } -void SecureStreamSocketImpl::connect(const SocketAddress& rAddress, const Poco::Timespan& timeout) +void SecureStreamSocketImpl::connect(const SocketAddress& address, const Poco::Timespan& timeout) { - _impl.connect(rAddress, timeout, !_lazyHandshake); + _impl.connect(address, timeout, !_lazyHandshake); reset(_impl.sockfd()); } -void SecureStreamSocketImpl::connectNB(const SocketAddress& rAddress) +void SecureStreamSocketImpl::connectNB(const SocketAddress& address) { - _impl.connectNB(rAddress); + _impl.connectNB(address); reset(_impl.sockfd()); } @@ -91,7 +91,7 @@ void SecureStreamSocketImpl::connectSSL() } -void SecureStreamSocketImpl::bind(const SocketAddress& rAddress, bool reuseAddress) +void SecureStreamSocketImpl::bind(const SocketAddress& address, bool reuseAddress) { throw Poco::InvalidAccessException("Cannot bind() a SecureStreamSocketImpl"); } @@ -129,13 +129,13 @@ int SecureStreamSocketImpl::receiveBytes(void* buffer, int length, int flags) } -int SecureStreamSocketImpl::sendTo(const void* buffer, int length, const SocketAddress& rAddress, int flags) +int SecureStreamSocketImpl::sendTo(const void* buffer, int length, const SocketAddress& address, int flags) { throw Poco::InvalidAccessException("Cannot sendTo() on a SecureStreamSocketImpl"); } -int SecureStreamSocketImpl::receiveFrom(void* buffer, int length, SocketAddress& rAddress, int flags) +int SecureStreamSocketImpl::receiveFrom(void* buffer, int length, SocketAddress& address, int flags) { throw Poco::InvalidAccessException("Cannot receiveFrom() on a SecureStreamSocketImpl"); } diff --git a/NetSSL_OpenSSL/src/X509Certificate.cpp b/NetSSL_OpenSSL/src/X509Certificate.cpp index 5a79ca9bd..a0463b2a6 100644 --- a/NetSSL_OpenSSL/src/X509Certificate.cpp +++ b/NetSSL_OpenSSL/src/X509Certificate.cpp @@ -111,11 +111,11 @@ bool X509Certificate::verify(const Poco::Crypto::X509Certificate& certificate, c // compare by IP const HostEntry& heData = DNS::resolve(*it); const HostEntry::AddressList& addr = heData.addresses(); - HostEntry::AddressList::const_iterator itAddr = addr.begin(); + HostEntry::AddressList::const_iterator it = addr.begin(); HostEntry::AddressList::const_iterator itEnd = addr.end(); - for (; itAddr != itEnd && !ok; ++itAddr) + for (; it != itEnd && !ok; ++it) { - ok = (*itAddr == ip); + ok = (*it == ip); } } else diff --git a/XML/src/XMLWriter.cpp b/XML/src/XMLWriter.cpp index e2a5685e3..98f4c7c1f 100644 --- a/XML/src/XMLWriter.cpp +++ b/XML/src/XMLWriter.cpp @@ -712,14 +712,14 @@ void XMLWriter::declareNamespaces(const XMLString& namespaceURI, const XMLString bool defaultNameSpaceUsed = false; XMLString defaultNamespaceURI = _namespaces.getURI(XMLString()); XMLString local; - XMLString prefixString; + XMLString prefix; XMLString elementNamespaceURI = namespaceURI; - Name::split(qname, prefixString, local); + Name::split(qname, prefix, local); if (elementNamespaceURI.empty()) - elementNamespaceURI = _namespaces.getURI(prefixString); + elementNamespaceURI = _namespaces.getURI(prefix); if (!elementNamespaceURI.empty()) { - usedNamespaces[prefixString].insert(elementNamespaceURI); + usedNamespaces[prefix].insert(elementNamespaceURI); if (!defaultNamespaceURI.empty() && elementNamespaceURI == defaultNamespaceURI) defaultNameSpaceUsed = true; } @@ -733,7 +733,7 @@ void XMLWriter::declareNamespaces(const XMLString& namespaceURI, const XMLString XMLString attributeLocal; Name::split(attributeQName, attributePrefix, attributeLocal); if (attributeNamespaceURI.empty()) - attributeNamespaceURI = _namespaces.getURI(prefixString); + attributeNamespaceURI = _namespaces.getURI(prefix); if (!attributeNamespaceURI.empty()) { usedNamespaces[attributePrefix].insert(attributeNamespaceURI); From 810f39c1d14d7aa17bb035b64280f851a4b09901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Mon, 5 Sep 2016 08:34:34 +0200 Subject: [PATCH 24/31] Revert "GH #1050 Crypto: fix gcc -Wshadow warnings" --- Crypto/src/CipherKey.cpp | 14 +++++++------- Crypto/src/CipherKeyImpl.cpp | 34 +++++++++++++++++----------------- Crypto/src/RSAKeyImpl.cpp | 12 ++++++------ 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Crypto/src/CipherKey.cpp b/Crypto/src/CipherKey.cpp index 43af25827..82a099776 100644 --- a/Crypto/src/CipherKey.cpp +++ b/Crypto/src/CipherKey.cpp @@ -21,21 +21,21 @@ namespace Poco { namespace Crypto { -CipherKey::CipherKey(const std::string& rName, const std::string& passphrase, const std::string& salt, int iterationCount, - const std::string & rDigest): - _pImpl(new CipherKeyImpl(rName, passphrase, salt, iterationCount, rDigest)) +CipherKey::CipherKey(const std::string& name, const std::string& passphrase, const std::string& salt, int iterationCount, + const std::string &digest): + _pImpl(new CipherKeyImpl(name, passphrase, salt, iterationCount, digest)) { } -CipherKey::CipherKey(const std::string& rName, const ByteVec& key, const ByteVec& iv): - _pImpl(new CipherKeyImpl(rName, key, iv)) +CipherKey::CipherKey(const std::string& name, const ByteVec& key, const ByteVec& iv): + _pImpl(new CipherKeyImpl(name, key, iv)) { } -CipherKey::CipherKey(const std::string& rName): - _pImpl(new CipherKeyImpl(rName)) +CipherKey::CipherKey(const std::string& name): + _pImpl(new CipherKeyImpl(name)) { } diff --git a/Crypto/src/CipherKeyImpl.cpp b/Crypto/src/CipherKeyImpl.cpp index cac2df8c6..7f496aa07 100644 --- a/Crypto/src/CipherKeyImpl.cpp +++ b/Crypto/src/CipherKeyImpl.cpp @@ -27,28 +27,28 @@ namespace Poco { namespace Crypto { -CipherKeyImpl::CipherKeyImpl(const std::string& rName, +CipherKeyImpl::CipherKeyImpl(const std::string& name, const std::string& passphrase, const std::string& salt, int iterationCount, - const std::string& rDigest): + const std::string& digest): _pCipher(0), _pDigest(0), - _name(rName), + _name(name), _key(), _iv() { // dummy access to Cipherfactory so that the EVP lib is initilaized CipherFactory::defaultFactory(); - _pCipher = EVP_get_cipherbyname(rName.c_str()); + _pCipher = EVP_get_cipherbyname(name.c_str()); if (!_pCipher) - throw Poco::NotFoundException("Cipher " + rName + " was not found"); + throw Poco::NotFoundException("Cipher " + name + " was not found"); - _pDigest = EVP_get_digestbyname(rDigest.c_str()); + _pDigest = EVP_get_digestbyname(digest.c_str()); if (!_pDigest) - throw Poco::NotFoundException("Digest " + rName + " was not found"); + throw Poco::NotFoundException("Digest " + name + " was not found"); _key = ByteVec(keySize()); @@ -57,35 +57,35 @@ CipherKeyImpl::CipherKeyImpl(const std::string& rName, } -CipherKeyImpl::CipherKeyImpl(const std::string& rName, +CipherKeyImpl::CipherKeyImpl(const std::string& name, const ByteVec& key, const ByteVec& iv): _pCipher(0), - _name(rName), + _name(name), _key(key), _iv(iv) { // dummy access to Cipherfactory so that the EVP lib is initilaized CipherFactory::defaultFactory(); - _pCipher = EVP_get_cipherbyname(rName.c_str()); + _pCipher = EVP_get_cipherbyname(name.c_str()); if (!_pCipher) - throw Poco::NotFoundException("Cipher " + rName + " was not found"); + throw Poco::NotFoundException("Cipher " + name + " was not found"); } -CipherKeyImpl::CipherKeyImpl(const std::string& rName): +CipherKeyImpl::CipherKeyImpl(const std::string& name): _pCipher(0), - _name(rName), + _name(name), _key(), _iv() { // dummy access to Cipherfactory so that the EVP lib is initilaized CipherFactory::defaultFactory(); - _pCipher = EVP_get_cipherbyname(rName.c_str()); + _pCipher = EVP_get_cipherbyname(name.c_str()); if (!_pCipher) - throw Poco::NotFoundException("Cipher " + rName + " was not found"); + throw Poco::NotFoundException("Cipher " + name + " was not found"); _key = ByteVec(keySize()); _iv = ByteVec(ivSize()); generateKey(); @@ -165,7 +165,7 @@ void CipherKeyImpl::generateKey( } // Now create the key and IV, using the digest set in the constructor. - int cipherKeySize = EVP_BytesToKey( + int keySize = EVP_BytesToKey( _pCipher, _pDigest, (salt.empty() ? 0 : saltBytes), @@ -176,7 +176,7 @@ void CipherKeyImpl::generateKey( ivBytes); // Copy the buffers to our member byte vectors. - _key.assign(keyBytes, keyBytes + cipherKeySize); + _key.assign(keyBytes, keyBytes + keySize); if (ivSize() == 0) _iv.clear(); diff --git a/Crypto/src/RSAKeyImpl.cpp b/Crypto/src/RSAKeyImpl.cpp index 8c917497c..8333453ce 100644 --- a/Crypto/src/RSAKeyImpl.cpp +++ b/Crypto/src/RSAKeyImpl.cpp @@ -87,10 +87,10 @@ RSAKeyImpl::RSAKeyImpl( RSA* pubKey = PEM_read_bio_RSAPublicKey(bio, &_pRSA, 0, 0); if (!pubKey) { - int ret = BIO_reset(bio); + int rc = BIO_reset(bio); // BIO_reset() normally returns 1 for success and 0 or -1 for failure. // File BIOs are an exception, they return 0 for success and -1 for failure. - if (ret != 0) throw Poco::FileException("Failed to load public key", publicKeyFile); + if (rc != 0) throw Poco::FileException("Failed to load public key", publicKeyFile); pubKey = PEM_read_bio_RSA_PUBKEY(bio, &_pRSA, 0, 0); } BIO_free(bio); @@ -287,8 +287,8 @@ void RSAKeyImpl::save(std::ostream* pPublicKeyStream, std::ostream* pPrivateKeyS throw Poco::WriteFileException("Failed to write public key to stream"); } char* pData; - long keySize = BIO_get_mem_data(bio, &pData); - pPublicKeyStream->write(pData, static_cast(keySize)); + long size = BIO_get_mem_data(bio, &pData); + pPublicKeyStream->write(pData, static_cast(size)); BIO_free(bio); } @@ -309,8 +309,8 @@ void RSAKeyImpl::save(std::ostream* pPublicKeyStream, std::ostream* pPrivateKeyS throw Poco::FileException("Failed to write private key to stream"); } char* pData; - long keySize = BIO_get_mem_data(bio, &pData); - pPrivateKeyStream->write(pData, static_cast(keySize)); + long size = BIO_get_mem_data(bio, &pData); + pPrivateKeyStream->write(pData, static_cast(size)); BIO_free(bio); } } From 749137426426bbcad75b1e6549e0bee5bc773a97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Mon, 5 Sep 2016 08:35:17 +0200 Subject: [PATCH 25/31] Revert "GH #1050 Net: fix gcc -Wshadow warnings" --- Foundation/include/Poco/ListMap.h | 16 +- Net/include/Poco/Net/IPAddress.h | 6 +- Net/include/Poco/Net/NTPEventArgs.h | 4 +- Net/src/AbstractHTTPRequestHandler.cpp | 10 +- Net/src/DatagramSocket.cpp | 20 +- Net/src/DatagramSocketImpl.cpp | 2 +- Net/src/DialogSocket.cpp | 4 +- Net/src/FilePartSource.cpp | 10 +- Net/src/HTMLForm.cpp | 10 +- Net/src/HTTPAuthenticationParams.cpp | 10 +- Net/src/HTTPClientSession.cpp | 4 +- Net/src/HTTPRequest.cpp | 10 +- Net/src/HTTPServer.cpp | 8 +- Net/src/HTTPServerConnection.cpp | 4 +- Net/src/HTTPServerRequestImpl.cpp | 6 +- Net/src/HTTPServerSession.cpp | 6 +- Net/src/HTTPSession.cpp | 12 +- Net/src/HTTPSessionFactory.cpp | 6 +- Net/src/ICMPEventArgs.cpp | 22 +- Net/src/ICMPSocket.cpp | 18 +- Net/src/ICMPSocketImpl.cpp | 8 +- Net/src/IPAddress.cpp | 88 +++---- Net/src/IPAddressImpl.cpp | 170 ++++++------ Net/src/MulticastSocket.cpp | 2 +- Net/src/MultipartReader.cpp | 4 +- Net/src/MultipartWriter.cpp | 4 +- Net/src/NTPPacket.cpp | 12 +- Net/src/NetworkInterface.cpp | 342 ++++++++++++------------- Net/src/PartSource.cpp | 4 +- Net/src/PartStore.cpp | 8 +- Net/src/RawSocket.cpp | 22 +- Net/src/RawSocketImpl.cpp | 4 +- Net/src/RemoteSyslogListener.cpp | 10 +- Net/src/SMTPClientSession.cpp | 16 +- Net/src/ServerSocket.cpp | 24 +- Net/src/SocketAddress.cpp | 30 +-- Net/src/SocketAddressImpl.cpp | 36 +-- Net/src/SocketImpl.cpp | 80 +++--- Net/src/SocketNotification.cpp | 4 +- Net/src/SocketStream.cpp | 16 +- Net/src/StreamSocket.cpp | 16 +- Net/src/StreamSocketImpl.cpp | 2 +- Net/src/StringPartSource.cpp | 10 +- Net/src/TCPServer.cpp | 12 +- Net/src/TCPServerConnection.cpp | 4 +- Net/src/TCPServerDispatcher.cpp | 4 +- Net/src/WebSocketImpl.cpp | 18 +- 47 files changed, 569 insertions(+), 569 deletions(-) diff --git a/Foundation/include/Poco/ListMap.h b/Foundation/include/Poco/ListMap.h index 932e6f6b0..f4efa1ab3 100644 --- a/Foundation/include/Poco/ListMap.h +++ b/Foundation/include/Poco/ListMap.h @@ -109,12 +109,12 @@ public: /// not found. { typename Container::const_iterator it = _list.begin(); - typename Container::const_iterator itEnd = _list.end(); - for(; it != itEnd; ++it) + typename Container::const_iterator end = _list.end(); + for(; it != end; ++it) { if (isEqual(it->first, key)) return it; } - return itEnd; + return end; } Iterator find(const KeyType& key) @@ -124,12 +124,12 @@ public: /// not found. { typename Container::iterator it = _list.begin(); - typename Container::iterator itEnd = _list.end(); - for(; it != itEnd; ++it) + typename Container::iterator end = _list.end(); + for(; it != end; ++it) { if (isEqual(it->first, key)) return it; } - return itEnd; + return end; } Iterator insert(const ValueType& val) @@ -203,8 +203,8 @@ public: else { ValueType value(key, Mapped()); - Iterator itInsert = insert(value); - return itInsert->second; + Iterator it = insert(value); + return it->second; } } diff --git a/Net/include/Poco/Net/IPAddress.h b/Net/include/Poco/Net/IPAddress.h index 4dc15751d..a8ae5e672 100644 --- a/Net/include/Poco/Net/IPAddress.h +++ b/Net/include/Poco/Net/IPAddress.h @@ -489,12 +489,12 @@ inline void IPAddress::newIPv6(const void* hostAddr) } -inline void IPAddress::newIPv6(const void* hostAddr, Poco::UInt32 scopeIdentifier) +inline void IPAddress::newIPv6(const void* hostAddr, Poco::UInt32 scope) { #ifdef POCO_HAVE_ALIGNMENT - new (storage()) Poco::Net::Impl::IPv6AddressImpl(hostAddr, scopeIdentifier); + new (storage()) Poco::Net::Impl::IPv6AddressImpl(hostAddr, scope); #else - _pImpl = new Poco::Net::Impl::IPv6AddressImpl(hostAddr, scopeIdentifier); + _pImpl = new Poco::Net::Impl::IPv6AddressImpl(hostAddr, scope); #endif } diff --git a/Net/include/Poco/Net/NTPEventArgs.h b/Net/include/Poco/Net/NTPEventArgs.h index 3e0320577..6c2c5cba8 100644 --- a/Net/include/Poco/Net/NTPEventArgs.h +++ b/Net/include/Poco/Net/NTPEventArgs.h @@ -74,9 +74,9 @@ inline const NTPPacket &NTPEventArgs::packet() } -inline void NTPEventArgs::setPacket(NTPPacket &rPacket) +inline void NTPEventArgs::setPacket(NTPPacket &packet) { - _packet = rPacket; + _packet = packet; } diff --git a/Net/src/AbstractHTTPRequestHandler.cpp b/Net/src/AbstractHTTPRequestHandler.cpp index fa5411723..378374411 100644 --- a/Net/src/AbstractHTTPRequestHandler.cpp +++ b/Net/src/AbstractHTTPRequestHandler.cpp @@ -43,10 +43,10 @@ AbstractHTTPRequestHandler::~AbstractHTTPRequestHandler() } -void AbstractHTTPRequestHandler::handleRequest(HTTPServerRequest& rRequest, HTTPServerResponse& rResponse) +void AbstractHTTPRequestHandler::handleRequest(HTTPServerRequest& request, HTTPServerResponse& response) { - _pRequest = &rRequest; - _pResponse = &rResponse; + _pRequest = &request; + _pResponse = &response; if (authenticate()) { try @@ -55,14 +55,14 @@ void AbstractHTTPRequestHandler::handleRequest(HTTPServerRequest& rRequest, HTTP } catch (Poco::Exception& exc) { - if (!rResponse.sent()) + if (!response.sent()) { sendErrorResponse(HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, exc.displayText()); } } catch (std::exception& exc) { - if (!rResponse.sent()) + if (!response.sent()) { sendErrorResponse(HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, exc.what()); } diff --git a/Net/src/DatagramSocket.cpp b/Net/src/DatagramSocket.cpp index c050f5b47..ce5d6b7ee 100644 --- a/Net/src/DatagramSocket.cpp +++ b/Net/src/DatagramSocket.cpp @@ -36,9 +36,9 @@ DatagramSocket::DatagramSocket(SocketAddress::Family family): Socket(new Datagra } -DatagramSocket::DatagramSocket(const SocketAddress& rAddress, bool reuseAddress): Socket(new DatagramSocketImpl(rAddress.family())) +DatagramSocket::DatagramSocket(const SocketAddress& address, bool reuseAddress): Socket(new DatagramSocketImpl(address.family())) { - bind(rAddress, reuseAddress); + bind(address, reuseAddress); } @@ -71,15 +71,15 @@ DatagramSocket& DatagramSocket::operator = (const Socket& socket) } -void DatagramSocket::connect(const SocketAddress& rAddress) +void DatagramSocket::connect(const SocketAddress& address) { - impl()->connect(rAddress); + impl()->connect(address); } -void DatagramSocket::bind(const SocketAddress& rAddress, bool reuseAddress) +void DatagramSocket::bind(const SocketAddress& address, bool reuseAddress) { - impl()->bind(rAddress, reuseAddress); + impl()->bind(address, reuseAddress); } @@ -95,15 +95,15 @@ int DatagramSocket::receiveBytes(void* buffer, int length, int flags) } -int DatagramSocket::sendTo(const void* buffer, int length, const SocketAddress& rAddress, int flags) +int DatagramSocket::sendTo(const void* buffer, int length, const SocketAddress& address, int flags) { - return impl()->sendTo(buffer, length, rAddress, flags); + return impl()->sendTo(buffer, length, address, flags); } -int DatagramSocket::receiveFrom(void* buffer, int length, SocketAddress& rAddress, int flags) +int DatagramSocket::receiveFrom(void* buffer, int length, SocketAddress& address, int flags) { - return impl()->receiveFrom(buffer, length, rAddress, flags); + return impl()->receiveFrom(buffer, length, address, flags); } diff --git a/Net/src/DatagramSocketImpl.cpp b/Net/src/DatagramSocketImpl.cpp index 66cd10a65..e6d92ffc9 100644 --- a/Net/src/DatagramSocketImpl.cpp +++ b/Net/src/DatagramSocketImpl.cpp @@ -46,7 +46,7 @@ DatagramSocketImpl::DatagramSocketImpl(SocketAddress::Family family) } -DatagramSocketImpl::DatagramSocketImpl(poco_socket_t socketfd): SocketImpl(socketfd) +DatagramSocketImpl::DatagramSocketImpl(poco_socket_t sockfd): SocketImpl(sockfd) { } diff --git a/Net/src/DialogSocket.cpp b/Net/src/DialogSocket.cpp index 7fd4b6427..6f60777d3 100644 --- a/Net/src/DialogSocket.cpp +++ b/Net/src/DialogSocket.cpp @@ -32,8 +32,8 @@ DialogSocket::DialogSocket(): } -DialogSocket::DialogSocket(const SocketAddress& rAddress): - StreamSocket(rAddress), +DialogSocket::DialogSocket(const SocketAddress& address): + StreamSocket(address), _pBuffer(0), _pNext(0), _pEnd(0) diff --git a/Net/src/FilePartSource.cpp b/Net/src/FilePartSource.cpp index cf2cdb76f..fda00e8f0 100644 --- a/Net/src/FilePartSource.cpp +++ b/Net/src/FilePartSource.cpp @@ -38,8 +38,8 @@ FilePartSource::FilePartSource(const std::string& path): } -FilePartSource::FilePartSource(const std::string& path, const std::string& rMediaType): - PartSource(rMediaType), +FilePartSource::FilePartSource(const std::string& path, const std::string& mediaType): + PartSource(mediaType), _path(path), _istr(path) { @@ -50,10 +50,10 @@ FilePartSource::FilePartSource(const std::string& path, const std::string& rMedi } -FilePartSource::FilePartSource(const std::string& path, const std::string& rFilename, const std::string& rMediaType): - PartSource(rMediaType), +FilePartSource::FilePartSource(const std::string& path, const std::string& filename, const std::string& mediaType): + PartSource(mediaType), _path(path), - _filename(rFilename), + _filename(filename), _istr(path) { Path p(path); diff --git a/Net/src/HTMLForm.cpp b/Net/src/HTMLForm.cpp index 532a83864..f6f136f96 100644 --- a/Net/src/HTMLForm.cpp +++ b/Net/src/HTMLForm.cpp @@ -261,7 +261,7 @@ std::streamsize HTMLForm::calculateContentLength() } -void HTMLForm::write(std::ostream& ostr, const std::string& rBoundary) +void HTMLForm::write(std::ostream& ostr, const std::string& boundary) { if (_encoding == ENCODING_URL) { @@ -269,7 +269,7 @@ void HTMLForm::write(std::ostream& ostr, const std::string& rBoundary) } else { - _boundary = rBoundary; + _boundary = boundary; writeMultipart(ostr); } } @@ -359,12 +359,12 @@ void HTMLForm::readMultipart(std::istream& istr, PartHandler& handler) { std::string name = params["name"]; std::string value; - std::istream& rIstr = reader.stream(); - int ch = rIstr.get(); + std::istream& istr = reader.stream(); + int ch = istr.get(); while (ch != eof) { value += (char) ch; - ch = rIstr.get(); + ch = istr.get(); } add(name, value); } diff --git a/Net/src/HTTPAuthenticationParams.cpp b/Net/src/HTTPAuthenticationParams.cpp index bb89fee68..29ed198a0 100644 --- a/Net/src/HTTPAuthenticationParams.cpp +++ b/Net/src/HTTPAuthenticationParams.cpp @@ -137,15 +137,15 @@ void HTTPAuthenticationParams::fromResponse(const HTTPResponse& response, const bool found = false; while (!found && it != response.end() && icompare(it->first, header) == 0) { - const std::string& rHeader = it->second; - if (icompare(rHeader, 0, 6, "Basic ") == 0) + const std::string& header = it->second; + if (icompare(header, 0, 6, "Basic ") == 0) { - parse(rHeader.begin() + 6, rHeader.end()); + parse(header.begin() + 6, header.end()); found = true; } - else if (icompare(rHeader, 0, 7, "Digest ") == 0) + else if (icompare(header, 0, 7, "Digest ") == 0) { - parse(rHeader.begin() + 7, rHeader.end()); + parse(header.begin() + 7, header.end()); found = true; } ++it; diff --git a/Net/src/HTTPClientSession.cpp b/Net/src/HTTPClientSession.cpp index 23aaa3c1e..7b297c5dc 100644 --- a/Net/src/HTTPClientSession.cpp +++ b/Net/src/HTTPClientSession.cpp @@ -52,8 +52,8 @@ HTTPClientSession::HTTPClientSession(): } -HTTPClientSession::HTTPClientSession(const StreamSocket& rSocket): - HTTPSession(rSocket), +HTTPClientSession::HTTPClientSession(const StreamSocket& socket): + HTTPSession(socket), _port(HTTPSession::HTTP_PORT), _proxyConfig(_globalProxyConfig), _keepAliveTimeout(DEFAULT_KEEP_ALIVE_TIMEOUT, 0), diff --git a/Net/src/HTTPRequest.cpp b/Net/src/HTTPRequest.cpp index 15440f812..f1e63ab73 100644 --- a/Net/src/HTTPRequest.cpp +++ b/Net/src/HTTPRequest.cpp @@ -241,11 +241,11 @@ void HTTPRequest::getCredentials(const std::string& header, std::string& scheme, { const std::string& auth = get(header); std::string::const_iterator it = auth.begin(); - std::string::const_iterator itEnd = auth.end(); - while (it != itEnd && Poco::Ascii::isSpace(*it)) ++it; - while (it != itEnd && !Poco::Ascii::isSpace(*it)) scheme += *it++; - while (it != itEnd && Poco::Ascii::isSpace(*it)) ++it; - while (it != itEnd) authInfo += *it++; + std::string::const_iterator end = auth.end(); + while (it != end && Poco::Ascii::isSpace(*it)) ++it; + while (it != end && !Poco::Ascii::isSpace(*it)) scheme += *it++; + while (it != end && Poco::Ascii::isSpace(*it)) ++it; + while (it != end) authInfo += *it++; } else throw NotAuthenticatedException(); } diff --git a/Net/src/HTTPServer.cpp b/Net/src/HTTPServer.cpp index 9a90ef2d5..ce2b4ec0b 100644 --- a/Net/src/HTTPServer.cpp +++ b/Net/src/HTTPServer.cpp @@ -29,15 +29,15 @@ HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::UInt16 por } -HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, const ServerSocket& rSocket, HTTPServerParams::Ptr pParams): - TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), rSocket, pParams), +HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, const ServerSocket& socket, HTTPServerParams::Ptr pParams): + TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), socket, pParams), _pFactory(pFactory) { } -HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& rSocket, HTTPServerParams::Ptr pParams): - TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), threadPool, rSocket, pParams), +HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, HTTPServerParams::Ptr pParams): + TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), threadPool, socket, pParams), _pFactory(pFactory) { } diff --git a/Net/src/HTTPServerConnection.cpp b/Net/src/HTTPServerConnection.cpp index aad8a6a7a..4166f26c8 100644 --- a/Net/src/HTTPServerConnection.cpp +++ b/Net/src/HTTPServerConnection.cpp @@ -31,8 +31,8 @@ namespace Poco { namespace Net { -HTTPServerConnection::HTTPServerConnection(const StreamSocket& rSocket, HTTPServerParams::Ptr pParams, HTTPRequestHandlerFactory::Ptr pFactory): - TCPServerConnection(rSocket), +HTTPServerConnection::HTTPServerConnection(const StreamSocket& socket, HTTPServerParams::Ptr pParams, HTTPRequestHandlerFactory::Ptr pFactory): + TCPServerConnection(socket), _pParams(pParams), _pFactory(pFactory), _stopped(false) diff --git a/Net/src/HTTPServerRequestImpl.cpp b/Net/src/HTTPServerRequestImpl.cpp index 5f30f149a..1e5aea2ad 100644 --- a/Net/src/HTTPServerRequestImpl.cpp +++ b/Net/src/HTTPServerRequestImpl.cpp @@ -33,13 +33,13 @@ namespace Poco { namespace Net { -HTTPServerRequestImpl::HTTPServerRequestImpl(HTTPServerResponseImpl& rResponse, HTTPServerSession& session, HTTPServerParams* pParams): - _response(rResponse), +HTTPServerRequestImpl::HTTPServerRequestImpl(HTTPServerResponseImpl& response, HTTPServerSession& session, HTTPServerParams* pParams): + _response(response), _session(session), _pStream(0), _pParams(pParams, true) { - rResponse.attachRequest(this); + response.attachRequest(this); HTTPHeaderInputStream hs(session); read(hs); diff --git a/Net/src/HTTPServerSession.cpp b/Net/src/HTTPServerSession.cpp index 0da5f7ca1..2852fa04e 100644 --- a/Net/src/HTTPServerSession.cpp +++ b/Net/src/HTTPServerSession.cpp @@ -21,14 +21,14 @@ namespace Poco { namespace Net { -HTTPServerSession::HTTPServerSession(const StreamSocket& rSocket, HTTPServerParams::Ptr pParams): - HTTPSession(rSocket, pParams->getKeepAlive()), +HTTPServerSession::HTTPServerSession(const StreamSocket& socket, HTTPServerParams::Ptr pParams): + HTTPSession(socket, pParams->getKeepAlive()), _firstRequest(true), _keepAliveTimeout(pParams->getKeepAliveTimeout()), _maxKeepAliveRequests(pParams->getMaxKeepAliveRequests()) { setTimeout(pParams->getTimeout()); - socket().setReceiveTimeout(pParams->getTimeout()); + this->socket().setReceiveTimeout(pParams->getTimeout()); } diff --git a/Net/src/HTTPSession.cpp b/Net/src/HTTPSession.cpp index ebf52c5a8..030ec7246 100644 --- a/Net/src/HTTPSession.cpp +++ b/Net/src/HTTPSession.cpp @@ -38,8 +38,8 @@ HTTPSession::HTTPSession(): } -HTTPSession::HTTPSession(const StreamSocket& rSocket): - _socket(rSocket), +HTTPSession::HTTPSession(const StreamSocket& socket): + _socket(socket), _pBuffer(0), _pCurrent(0), _pEnd(0), @@ -50,8 +50,8 @@ HTTPSession::HTTPSession(const StreamSocket& rSocket): } -HTTPSession::HTTPSession(const StreamSocket& rSocket, bool keepAlive): - _socket(rSocket), +HTTPSession::HTTPSession(const StreamSocket& socket, bool keepAlive): + _socket(socket), _pBuffer(0), _pCurrent(0), _pEnd(0), @@ -226,9 +226,9 @@ StreamSocket HTTPSession::detachSocket() } -void HTTPSession::attachSocket(const StreamSocket& rSocket) +void HTTPSession::attachSocket(const StreamSocket& socket) { - _socket = rSocket; + _socket = socket; } diff --git a/Net/src/HTTPSessionFactory.cpp b/Net/src/HTTPSessionFactory.cpp index 62ad34c86..0e77f4549 100644 --- a/Net/src/HTTPSessionFactory.cpp +++ b/Net/src/HTTPSessionFactory.cpp @@ -35,9 +35,9 @@ HTTPSessionFactory::HTTPSessionFactory(): } -HTTPSessionFactory::HTTPSessionFactory(const std::string& rProxyHost, Poco::UInt16 port): - _proxyHost(rProxyHost), - _proxyPort(port) +HTTPSessionFactory::HTTPSessionFactory(const std::string& proxyHost, Poco::UInt16 proxyPort): + _proxyHost(proxyHost), + _proxyPort(proxyPort) { } diff --git a/Net/src/ICMPEventArgs.cpp b/Net/src/ICMPEventArgs.cpp index 40b6ade57..fe051f122 100644 --- a/Net/src/ICMPEventArgs.cpp +++ b/Net/src/ICMPEventArgs.cpp @@ -32,13 +32,13 @@ namespace Poco { namespace Net { -ICMPEventArgs::ICMPEventArgs(const SocketAddress& address, int operationRepetitions, int dataSizeInBytes, int operationTtl): +ICMPEventArgs::ICMPEventArgs(const SocketAddress& address, int repetitions, int dataSize, int ttl): _address(address), _sent(0), - _dataSize(dataSizeInBytes), - _ttl(operationTtl), - _rtt(operationRepetitions, 0), - _errors(operationRepetitions) + _dataSize(dataSize), + _ttl(ttl), + _rtt(repetitions, 0), + _errors(repetitions) { } @@ -76,11 +76,11 @@ std::string ICMPEventArgs::hostAddress() const } -void ICMPEventArgs::setRepetitions(int operationRepetitions) +void ICMPEventArgs::setRepetitions(int repetitions) { _rtt.clear(); - _rtt.resize(operationRepetitions, 0); - _errors.assign(operationRepetitions, ""); + _rtt.resize(repetitions, 0); + _errors.assign(repetitions, ""); } @@ -101,13 +101,13 @@ ICMPEventArgs ICMPEventArgs::operator ++ (int) int ICMPEventArgs::received() const { - int ret = 0; + int received = 0; for (int i = 0; i < _rtt.size(); ++i) { - if (_rtt[i]) ++ret; + if (_rtt[i]) ++received; } - return ret; + return received; } diff --git a/Net/src/ICMPSocket.cpp b/Net/src/ICMPSocket.cpp index e69e97b7f..ece9871c3 100644 --- a/Net/src/ICMPSocket.cpp +++ b/Net/src/ICMPSocket.cpp @@ -26,11 +26,11 @@ namespace Poco { namespace Net { -ICMPSocket::ICMPSocket(IPAddress::Family family, int dataSizeInBytes, int ttlValue, int socketTimeout): - Socket(new ICMPSocketImpl(family, dataSizeInBytes, ttlValue, socketTimeout)), - _dataSize(dataSizeInBytes), - _ttl(ttlValue), - _timeout(socketTimeout) +ICMPSocket::ICMPSocket(IPAddress::Family family, int dataSize, int ttl, int timeout): + Socket(new ICMPSocketImpl(family, dataSize, ttl, timeout)), + _dataSize(dataSize), + _ttl(ttl), + _timeout(timeout) { } @@ -66,15 +66,15 @@ ICMPSocket& ICMPSocket::operator = (const Socket& socket) } -int ICMPSocket::sendTo(const SocketAddress& rAddress, int flags) +int ICMPSocket::sendTo(const SocketAddress& address, int flags) { - return impl()->sendTo(0, 0, rAddress, flags); + return impl()->sendTo(0, 0, address, flags); } -int ICMPSocket::receiveFrom(SocketAddress& rAddress, int flags) +int ICMPSocket::receiveFrom(SocketAddress& address, int flags) { - return impl()->receiveFrom(0, 0, rAddress, flags); + return impl()->receiveFrom(0, 0, address, flags); } diff --git a/Net/src/ICMPSocketImpl.cpp b/Net/src/ICMPSocketImpl.cpp index bfd04b71b..2deefbaae 100644 --- a/Net/src/ICMPSocketImpl.cpp +++ b/Net/src/ICMPSocketImpl.cpp @@ -45,14 +45,14 @@ ICMPSocketImpl::~ICMPSocketImpl() } -int ICMPSocketImpl::sendTo(const void*, int, const SocketAddress& rAddress, int flags) +int ICMPSocketImpl::sendTo(const void*, int, const SocketAddress& address, int flags) { - int n = SocketImpl::sendTo(_icmpPacket.packet(), _icmpPacket.packetSize(), rAddress, flags); + int n = SocketImpl::sendTo(_icmpPacket.packet(), _icmpPacket.packetSize(), address, flags); return n; } -int ICMPSocketImpl::receiveFrom(void*, int, SocketAddress& rAddress, int flags) +int ICMPSocketImpl::receiveFrom(void*, int, SocketAddress& address, int flags) { int maxPacketSize = _icmpPacket.maxPacketSize(); unsigned char* buffer = new unsigned char[maxPacketSize]; @@ -68,7 +68,7 @@ int ICMPSocketImpl::receiveFrom(void*, int, SocketAddress& rAddress, int flags) // fake ping responses will cause an endless loop. throw TimeoutException(); } - SocketImpl::receiveFrom(buffer, maxPacketSize, rAddress, flags); + SocketImpl::receiveFrom(buffer, maxPacketSize, address, flags); } while (!_icmpPacket.validReplyID(buffer, maxPacketSize)); } diff --git a/Net/src/IPAddress.cpp b/Net/src/IPAddress.cpp index f2b052362..69dc5ab3f 100644 --- a/Net/src/IPAddress.cpp +++ b/Net/src/IPAddress.cpp @@ -60,39 +60,39 @@ IPAddress::IPAddress() } -IPAddress::IPAddress(const IPAddress& rAddr) +IPAddress::IPAddress(const IPAddress& addr) { - if (rAddr.family() == IPv4) - newIPv4(rAddr.addr()); + if (addr.family() == IPv4) + newIPv4(addr.addr()); #if defined(POCO_HAVE_IPv6) else - newIPv6(rAddr.addr(), rAddr.scope()); + newIPv6(addr.addr(), addr.scope()); #endif } -IPAddress::IPAddress(Family addressFamily) +IPAddress::IPAddress(Family family) { - if (addressFamily == IPv4) + if (family == IPv4) newIPv4(); #if defined(POCO_HAVE_IPv6) - else if (addressFamily == IPv6) + else if (family == IPv6) newIPv6(); #endif else throw Poco::InvalidArgumentException("Invalid or unsupported address family passed to IPAddress()"); } -IPAddress::IPAddress(const std::string& rAddr) +IPAddress::IPAddress(const std::string& addr) { IPv4AddressImpl empty4 = IPv4AddressImpl(); - if (rAddr.empty() || trim(rAddr) == "0.0.0.0") + if (addr.empty() || trim(addr) == "0.0.0.0") { newIPv4(empty4.addr()); return; } - IPv4AddressImpl addr4(IPv4AddressImpl::parse(rAddr)); + IPv4AddressImpl addr4(IPv4AddressImpl::parse(addr)); if (addr4 != empty4) { newIPv4(addr4.addr()); @@ -101,13 +101,13 @@ IPAddress::IPAddress(const std::string& rAddr) #if defined(POCO_HAVE_IPv6) IPv6AddressImpl empty6 = IPv6AddressImpl(); - if (rAddr.empty() || trim(rAddr) == "::") + if (addr.empty() || trim(addr) == "::") { newIPv6(empty6.addr()); return; } - IPv6AddressImpl addr6(IPv6AddressImpl::parse(rAddr)); + IPv6AddressImpl addr6(IPv6AddressImpl::parse(addr)); if (addr6 != IPv6AddressImpl()) { newIPv6(addr6.addr(), addr6.scope()); @@ -115,22 +115,22 @@ IPAddress::IPAddress(const std::string& rAddr) } #endif - throw InvalidAddressException(rAddr); + throw InvalidAddressException(addr); } -IPAddress::IPAddress(const std::string& rAddr, Family addressFamily) +IPAddress::IPAddress(const std::string& addr, Family family) { - if (addressFamily == IPv4) + if (family == IPv4) { - IPv4AddressImpl addr4(IPv4AddressImpl::parse(rAddr)); + IPv4AddressImpl addr4(IPv4AddressImpl::parse(addr)); newIPv4(addr4.addr()); return; } #if defined(POCO_HAVE_IPv6) - else if (addressFamily == IPv6) + else if (family == IPv6) { - IPv6AddressImpl addr6(IPv6AddressImpl::parse(rAddr)); + IPv6AddressImpl addr6(IPv6AddressImpl::parse(addr)); newIPv6(addr6.addr(), addr6.scope()); return; } @@ -139,36 +139,36 @@ IPAddress::IPAddress(const std::string& rAddr, Family addressFamily) } -IPAddress::IPAddress(const void* pAddr, poco_socklen_t addressLength) +IPAddress::IPAddress(const void* addr, poco_socklen_t length) #ifndef POCO_HAVE_ALIGNMENT : _pImpl(0) #endif { - if (addressLength == sizeof(struct in_addr)) - newIPv4(pAddr); + if (length == sizeof(struct in_addr)) + newIPv4(addr); #if defined(POCO_HAVE_IPv6) - else if (addressLength == sizeof(struct in6_addr)) - newIPv6(pAddr); + else if (length == sizeof(struct in6_addr)) + newIPv6(addr); #endif else throw Poco::InvalidArgumentException("Invalid address length passed to IPAddress()"); } -IPAddress::IPAddress(const void* pAddr, poco_socklen_t addressLength, Poco::UInt32 scopeIdentifier) +IPAddress::IPAddress(const void* addr, poco_socklen_t length, Poco::UInt32 scope) { - if (addressLength == sizeof(struct in_addr)) - newIPv4(pAddr); + if (length == sizeof(struct in_addr)) + newIPv4(addr); #if defined(POCO_HAVE_IPv6) - else if (addressLength == sizeof(struct in6_addr)) - newIPv6(pAddr, scopeIdentifier); + else if (length == sizeof(struct in6_addr)) + newIPv6(addr, scope); #endif else throw Poco::InvalidArgumentException("Invalid address length passed to IPAddress()"); } -IPAddress::IPAddress(unsigned prefix, Family addressFamily) +IPAddress::IPAddress(unsigned prefix, Family family) { - if (addressFamily == IPv4) + if (family == IPv4) { if (prefix <= 32) newIPv4(prefix); @@ -176,7 +176,7 @@ IPAddress::IPAddress(unsigned prefix, Family addressFamily) throw Poco::InvalidArgumentException("Invalid prefix length passed to IPAddress()"); } #if defined(POCO_HAVE_IPv6) - else if (addressFamily == IPv6) + else if (family == IPv6) { if (prefix <= 128) newIPv6(prefix); @@ -209,11 +209,11 @@ IPAddress::IPAddress(const SOCKET_ADDRESS& socket_address) IPAddress::IPAddress(const struct sockaddr& sockaddr) { - unsigned short addressFamily = sockaddr.sa_family; - if (addressFamily == AF_INET) + unsigned short family = sockaddr.sa_family; + if (family == AF_INET) newIPv4(&reinterpret_cast(&sockaddr)->sin_addr); #if defined(POCO_HAVE_IPv6) - else if (addressFamily == AF_INET6) + else if (family == AF_INET6) newIPv6(&reinterpret_cast(&sockaddr)->sin6_addr, reinterpret_cast(&sockaddr)->sin6_scope_id); #endif @@ -227,16 +227,16 @@ IPAddress::~IPAddress() } -IPAddress& IPAddress::operator = (const IPAddress& rAddr) +IPAddress& IPAddress::operator = (const IPAddress& addr) { - if (&rAddr != this) + if (&addr != this) { destruct(); - if (rAddr.family() == IPAddress::IPv4) - newIPv4(rAddr.addr()); + if (addr.family() == IPAddress::IPv4) + newIPv4(addr.addr()); #if defined(POCO_HAVE_IPv6) - else if (rAddr.family() == IPAddress::IPv6) - newIPv6(rAddr.addr(), rAddr.scope()); + else if (addr.family() == IPAddress::IPv6) + newIPv6(addr.addr(), addr.scope()); #endif else throw Poco::InvalidArgumentException("Invalid or unsupported address family"); @@ -553,16 +553,16 @@ bool IPAddress::tryParse(const std::string& addr, IPAddress& result) } -void IPAddress::mask(const IPAddress& rMask) +void IPAddress::mask(const IPAddress& mask) { IPAddress null; - pImpl()->mask(rMask.pImpl(), null.pImpl()); + pImpl()->mask(mask.pImpl(), null.pImpl()); } -void IPAddress::mask(const IPAddress& rMask, const IPAddress& set) +void IPAddress::mask(const IPAddress& mask, const IPAddress& set) { - pImpl()->mask(rMask.pImpl(), set.pImpl()); + pImpl()->mask(mask.pImpl(), set.pImpl()); } diff --git a/Net/src/IPAddressImpl.cpp b/Net/src/IPAddressImpl.cpp index 0440f49cd..dd20bd052 100644 --- a/Net/src/IPAddressImpl.cpp +++ b/Net/src/IPAddressImpl.cpp @@ -86,31 +86,31 @@ IPv4AddressImpl::IPv4AddressImpl() } -IPv4AddressImpl::IPv4AddressImpl(const void* pAddr) +IPv4AddressImpl::IPv4AddressImpl(const void* addr) { - std::memcpy(&_addr, pAddr, sizeof(_addr)); + std::memcpy(&_addr, addr, sizeof(_addr)); } IPv4AddressImpl::IPv4AddressImpl(unsigned prefix) { - UInt32 address = (prefix == 32) ? 0xffffffff : ~(0xffffffff >> prefix); - _addr.s_addr = ByteOrder::toNetwork(address); + UInt32 addr = (prefix == 32) ? 0xffffffff : ~(0xffffffff >> prefix); + _addr.s_addr = ByteOrder::toNetwork(addr); } -IPv4AddressImpl::IPv4AddressImpl(const IPv4AddressImpl& rAddr) +IPv4AddressImpl::IPv4AddressImpl(const IPv4AddressImpl& addr) { - std::memcpy(&_addr, &rAddr._addr, sizeof(_addr)); + std::memcpy(&_addr, &addr._addr, sizeof(_addr)); } -IPv4AddressImpl& IPv4AddressImpl::operator = (const IPv4AddressImpl& rAddr) +IPv4AddressImpl& IPv4AddressImpl::operator = (const IPv4AddressImpl& addr) { - if (this == &rAddr) + if (this == &addr) return *this; - std::memcpy(&_addr, &rAddr._addr, sizeof(_addr)); + std::memcpy(&_addr, &addr._addr, sizeof(_addr)); return *this; } @@ -199,10 +199,10 @@ bool IPv4AddressImpl::isLinkLocal() const bool IPv4AddressImpl::isSiteLocal() const { - UInt32 address = ntohl(_addr.s_addr); - return (address & 0xFF000000) == 0x0A000000 || // 10.0.0.0/24 - (address & 0xFFFF0000) == 0xC0A80000 || // 192.68.0.0/16 - (address >= 0xAC100000 && address <= 0xAC1FFFFF); // 172.16.0.0 to 172.31.255.255 + UInt32 addr = ntohl(_addr.s_addr); + return (addr & 0xFF000000) == 0x0A000000 || // 10.0.0.0/24 + (addr & 0xFFFF0000) == 0xC0A80000 || // 192.68.0.0/16 + (addr >= 0xAC100000 && addr <= 0xAC1FFFFF); // 172.16.0.0 to 172.31.255.255 } @@ -250,8 +250,8 @@ bool IPv4AddressImpl::isOrgLocalMC() const bool IPv4AddressImpl::isGlobalMC() const { - UInt32 address = ntohl(_addr.s_addr); - return address >= 0xE0000100 && address <= 0xEE000000; // 224.0.1.0 to 238.255.255.255 + UInt32 addr = ntohl(_addr.s_addr); + return addr >= 0xE0000100 && addr <= 0xEE000000; // 224.0.1.0 to 238.255.255.255 } @@ -299,26 +299,26 @@ IPAddressImpl* IPv4AddressImpl::clone() const } -IPv4AddressImpl IPv4AddressImpl::operator & (const IPv4AddressImpl& rAddr) const +IPv4AddressImpl IPv4AddressImpl::operator & (const IPv4AddressImpl& addr) const { IPv4AddressImpl result(&_addr); - result._addr.s_addr &= rAddr._addr.s_addr; + result._addr.s_addr &= addr._addr.s_addr; return result; } -IPv4AddressImpl IPv4AddressImpl::operator | (const IPv4AddressImpl& rAddr) const +IPv4AddressImpl IPv4AddressImpl::operator | (const IPv4AddressImpl& addr) const { IPv4AddressImpl result(&_addr); - result._addr.s_addr |= rAddr._addr.s_addr; + result._addr.s_addr |= addr._addr.s_addr; return result; } -IPv4AddressImpl IPv4AddressImpl::operator ^ (const IPv4AddressImpl& rAddr) const +IPv4AddressImpl IPv4AddressImpl::operator ^ (const IPv4AddressImpl& addr) const { IPv4AddressImpl result(&_addr); - result._addr.s_addr ^= rAddr._addr.s_addr; + result._addr.s_addr ^= addr._addr.s_addr; return result; } @@ -331,15 +331,15 @@ IPv4AddressImpl result(&_addr); } -bool IPv4AddressImpl::operator == (const IPv4AddressImpl& rAddr) const +bool IPv4AddressImpl::operator == (const IPv4AddressImpl& addr) const { - return 0 == std::memcmp(&rAddr._addr, &_addr, sizeof(_addr)); + return 0 == std::memcmp(&addr._addr, &_addr, sizeof(_addr)); } -bool IPv4AddressImpl::operator != (const IPv4AddressImpl& rAddr) const +bool IPv4AddressImpl::operator != (const IPv4AddressImpl& addr) const { - return !(*this == rAddr); + return !(*this == addr); } @@ -357,31 +357,31 @@ IPv6AddressImpl::IPv6AddressImpl(): _scope(0) } -IPv6AddressImpl::IPv6AddressImpl(const void* pAddr): _scope(0) +IPv6AddressImpl::IPv6AddressImpl(const void* addr): _scope(0) { - std::memcpy(&_addr, pAddr, sizeof(_addr)); + std::memcpy(&_addr, addr, sizeof(_addr)); } -IPv6AddressImpl::IPv6AddressImpl(const void* pAddr, Poco::UInt32 scopeIdentifier): _scope(scopeIdentifier) +IPv6AddressImpl::IPv6AddressImpl(const void* addr, Poco::UInt32 scope): _scope(scope) { - std::memcpy(&_addr, pAddr, sizeof(_addr)); + std::memcpy(&_addr, addr, sizeof(_addr)); } -IPv6AddressImpl::IPv6AddressImpl(const IPv6AddressImpl& rAddr): _scope(rAddr._scope) +IPv6AddressImpl::IPv6AddressImpl(const IPv6AddressImpl& addr): _scope(addr._scope) { - std::memcpy((void*) &_addr, (void*) &rAddr._addr, sizeof(_addr)); + std::memcpy((void*) &_addr, (void*) &addr._addr, sizeof(_addr)); } -IPv6AddressImpl& IPv6AddressImpl::operator = (const IPv6AddressImpl& rAddr) +IPv6AddressImpl& IPv6AddressImpl::operator = (const IPv6AddressImpl& addr) { - if (this == &rAddr) + if (this == &addr) return *this; - _scope = rAddr._scope; - std::memcpy(&_addr, &rAddr._addr, sizeof(_addr)); + _scope = addr._scope; + std::memcpy(&_addr, &addr._addr, sizeof(_addr)); return *this; } @@ -516,16 +516,16 @@ unsigned IPv6AddressImpl::prefixLength() const #if defined(POCO_OS_FAMILY_UNIX) for (int i = 3; i >= 0; --i) { - unsigned address = ntohl(_addr.s6_addr32[i]); - if ((bits = maskBits(address, 32))) return (bitPos - (32 - bits)); + unsigned addr = ntohl(_addr.s6_addr32[i]); + if ((bits = maskBits(addr, 32))) return (bitPos - (32 - bits)); bitPos -= 32; } return 0; #elif defined(POCO_OS_FAMILY_WINDOWS) for (int i = 7; i >= 0; --i) { - unsigned short address = ByteOrder::fromNetwork(_addr.s6_addr16[i]); - if ((bits = maskBits(address, 16))) return (bitPos - (16 - bits)); + unsigned short addr = ByteOrder::fromNetwork(_addr.s6_addr16[i]); + if ((bits = maskBits(addr, 16))) return (bitPos - (16 - bits)); bitPos -= 16; } return 0; @@ -696,77 +696,77 @@ IPAddressImpl* IPv6AddressImpl::clone() const } -IPv6AddressImpl IPv6AddressImpl::operator & (const IPv6AddressImpl& rAddr) const +IPv6AddressImpl IPv6AddressImpl::operator & (const IPv6AddressImpl& addr) const { - if (_scope != rAddr._scope) + if (_scope != addr._scope) throw Poco::InvalidArgumentException("Scope ID of passed IPv6 address does not match with the source one."); IPv6AddressImpl result(*this); #ifdef POCO_OS_FAMILY_WINDOWS - result._addr.s6_addr16[0] &= rAddr._addr.s6_addr16[0]; - result._addr.s6_addr16[1] &= rAddr._addr.s6_addr16[1]; - result._addr.s6_addr16[2] &= rAddr._addr.s6_addr16[2]; - result._addr.s6_addr16[3] &= rAddr._addr.s6_addr16[3]; - result._addr.s6_addr16[4] &= rAddr._addr.s6_addr16[4]; - result._addr.s6_addr16[5] &= rAddr._addr.s6_addr16[5]; - result._addr.s6_addr16[6] &= rAddr._addr.s6_addr16[6]; - result._addr.s6_addr16[7] &= rAddr._addr.s6_addr16[7]; + result._addr.s6_addr16[0] &= addr._addr.s6_addr16[0]; + result._addr.s6_addr16[1] &= addr._addr.s6_addr16[1]; + result._addr.s6_addr16[2] &= addr._addr.s6_addr16[2]; + result._addr.s6_addr16[3] &= addr._addr.s6_addr16[3]; + result._addr.s6_addr16[4] &= addr._addr.s6_addr16[4]; + result._addr.s6_addr16[5] &= addr._addr.s6_addr16[5]; + result._addr.s6_addr16[6] &= addr._addr.s6_addr16[6]; + result._addr.s6_addr16[7] &= addr._addr.s6_addr16[7]; #else - result._addr.s6_addr32[0] &= rAddr._addr.s6_addr32[0]; - result._addr.s6_addr32[1] &= rAddr._addr.s6_addr32[1]; - result._addr.s6_addr32[2] &= rAddr._addr.s6_addr32[2]; - result._addr.s6_addr32[3] &= rAddr._addr.s6_addr32[3]; + result._addr.s6_addr32[0] &= addr._addr.s6_addr32[0]; + result._addr.s6_addr32[1] &= addr._addr.s6_addr32[1]; + result._addr.s6_addr32[2] &= addr._addr.s6_addr32[2]; + result._addr.s6_addr32[3] &= addr._addr.s6_addr32[3]; #endif return result; } -IPv6AddressImpl IPv6AddressImpl::operator | (const IPv6AddressImpl& rAddr) const +IPv6AddressImpl IPv6AddressImpl::operator | (const IPv6AddressImpl& addr) const { - if (_scope != rAddr._scope) + if (_scope != addr._scope) throw Poco::InvalidArgumentException("Scope ID of passed IPv6 address does not match with the source one."); IPv6AddressImpl result(*this); #ifdef POCO_OS_FAMILY_WINDOWS - result._addr.s6_addr16[0] |= rAddr._addr.s6_addr16[0]; - result._addr.s6_addr16[1] |= rAddr._addr.s6_addr16[1]; - result._addr.s6_addr16[2] |= rAddr._addr.s6_addr16[2]; - result._addr.s6_addr16[3] |= rAddr._addr.s6_addr16[3]; - result._addr.s6_addr16[4] |= rAddr._addr.s6_addr16[4]; - result._addr.s6_addr16[5] |= rAddr._addr.s6_addr16[5]; - result._addr.s6_addr16[6] |= rAddr._addr.s6_addr16[6]; - result._addr.s6_addr16[7] |= rAddr._addr.s6_addr16[7]; + result._addr.s6_addr16[0] |= addr._addr.s6_addr16[0]; + result._addr.s6_addr16[1] |= addr._addr.s6_addr16[1]; + result._addr.s6_addr16[2] |= addr._addr.s6_addr16[2]; + result._addr.s6_addr16[3] |= addr._addr.s6_addr16[3]; + result._addr.s6_addr16[4] |= addr._addr.s6_addr16[4]; + result._addr.s6_addr16[5] |= addr._addr.s6_addr16[5]; + result._addr.s6_addr16[6] |= addr._addr.s6_addr16[6]; + result._addr.s6_addr16[7] |= addr._addr.s6_addr16[7]; #else - result._addr.s6_addr32[0] |= rAddr._addr.s6_addr32[0]; - result._addr.s6_addr32[1] |= rAddr._addr.s6_addr32[1]; - result._addr.s6_addr32[2] |= rAddr._addr.s6_addr32[2]; - result._addr.s6_addr32[3] |= rAddr._addr.s6_addr32[3]; + result._addr.s6_addr32[0] |= addr._addr.s6_addr32[0]; + result._addr.s6_addr32[1] |= addr._addr.s6_addr32[1]; + result._addr.s6_addr32[2] |= addr._addr.s6_addr32[2]; + result._addr.s6_addr32[3] |= addr._addr.s6_addr32[3]; #endif return result; } -IPv6AddressImpl IPv6AddressImpl::operator ^ (const IPv6AddressImpl& rAddr) const +IPv6AddressImpl IPv6AddressImpl::operator ^ (const IPv6AddressImpl& addr) const { - if (_scope != rAddr._scope) + if (_scope != addr._scope) throw Poco::InvalidArgumentException("Scope ID of passed IPv6 address does not match with the source one."); IPv6AddressImpl result(*this); #ifdef POCO_OS_FAMILY_WINDOWS - result._addr.s6_addr16[0] ^= rAddr._addr.s6_addr16[0]; - result._addr.s6_addr16[1] ^= rAddr._addr.s6_addr16[1]; - result._addr.s6_addr16[2] ^= rAddr._addr.s6_addr16[2]; - result._addr.s6_addr16[3] ^= rAddr._addr.s6_addr16[3]; - result._addr.s6_addr16[4] ^= rAddr._addr.s6_addr16[4]; - result._addr.s6_addr16[5] ^= rAddr._addr.s6_addr16[5]; - result._addr.s6_addr16[6] ^= rAddr._addr.s6_addr16[6]; - result._addr.s6_addr16[7] ^= rAddr._addr.s6_addr16[7]; + result._addr.s6_addr16[0] ^= addr._addr.s6_addr16[0]; + result._addr.s6_addr16[1] ^= addr._addr.s6_addr16[1]; + result._addr.s6_addr16[2] ^= addr._addr.s6_addr16[2]; + result._addr.s6_addr16[3] ^= addr._addr.s6_addr16[3]; + result._addr.s6_addr16[4] ^= addr._addr.s6_addr16[4]; + result._addr.s6_addr16[5] ^= addr._addr.s6_addr16[5]; + result._addr.s6_addr16[6] ^= addr._addr.s6_addr16[6]; + result._addr.s6_addr16[7] ^= addr._addr.s6_addr16[7]; #else - result._addr.s6_addr32[0] ^= rAddr._addr.s6_addr32[0]; - result._addr.s6_addr32[1] ^= rAddr._addr.s6_addr32[1]; - result._addr.s6_addr32[2] ^= rAddr._addr.s6_addr32[2]; - result._addr.s6_addr32[3] ^= rAddr._addr.s6_addr32[3]; + result._addr.s6_addr32[0] ^= addr._addr.s6_addr32[0]; + result._addr.s6_addr32[1] ^= addr._addr.s6_addr32[1]; + result._addr.s6_addr32[2] ^= addr._addr.s6_addr32[2]; + result._addr.s6_addr32[3] ^= addr._addr.s6_addr32[3]; #endif return result; } @@ -794,15 +794,15 @@ IPv6AddressImpl IPv6AddressImpl::operator ~ () const } -bool IPv6AddressImpl::operator == (const IPv6AddressImpl& rAddr) const +bool IPv6AddressImpl::operator == (const IPv6AddressImpl& addr) const { - return _scope == rAddr._scope && 0 == std::memcmp(&rAddr._addr, &_addr, sizeof(_addr)); + return _scope == addr._scope && 0 == std::memcmp(&addr._addr, &_addr, sizeof(_addr)); } -bool IPv6AddressImpl::operator != (const IPv6AddressImpl& rAddr) const +bool IPv6AddressImpl::operator != (const IPv6AddressImpl& addr) const { - return !(*this == rAddr); + return !(*this == addr); } diff --git a/Net/src/MulticastSocket.cpp b/Net/src/MulticastSocket.cpp index 26a0aabc0..5dcd9a8e8 100644 --- a/Net/src/MulticastSocket.cpp +++ b/Net/src/MulticastSocket.cpp @@ -62,7 +62,7 @@ MulticastSocket::MulticastSocket(SocketAddress::Family family): DatagramSocket(f } -MulticastSocket::MulticastSocket(const SocketAddress& rAddress, bool reuseAddress): DatagramSocket(rAddress, reuseAddress) +MulticastSocket::MulticastSocket(const SocketAddress& address, bool reuseAddress): DatagramSocket(address, reuseAddress) { } diff --git a/Net/src/MultipartReader.cpp b/Net/src/MultipartReader.cpp index be9a2ece2..1ee9a98e5 100644 --- a/Net/src/MultipartReader.cpp +++ b/Net/src/MultipartReader.cpp @@ -182,9 +182,9 @@ MultipartReader::MultipartReader(std::istream& istr): } -MultipartReader::MultipartReader(std::istream& istr, const std::string& rBoundary): +MultipartReader::MultipartReader(std::istream& istr, const std::string& boundary): _istr(istr), - _boundary(rBoundary), + _boundary(boundary), _pMPI(0) { } diff --git a/Net/src/MultipartWriter.cpp b/Net/src/MultipartWriter.cpp index 21c572ce4..0d863d996 100644 --- a/Net/src/MultipartWriter.cpp +++ b/Net/src/MultipartWriter.cpp @@ -36,9 +36,9 @@ MultipartWriter::MultipartWriter(std::ostream& ostr): } -MultipartWriter::MultipartWriter(std::ostream& ostr, const std::string& rBoundary): +MultipartWriter::MultipartWriter(std::ostream& ostr, const std::string& boundary): _ostr(ostr), - _boundary(rBoundary), + _boundary(boundary), _firstPart(true) { if (_boundary.empty()) diff --git a/Net/src/NTPPacket.cpp b/Net/src/NTPPacket.cpp index 9892d7074..d3cde72e3 100644 --- a/Net/src/NTPPacket.cpp +++ b/Net/src/NTPPacket.cpp @@ -73,9 +73,9 @@ NTPPacket::NTPPacket() : } -NTPPacket::NTPPacket(Poco::UInt8 *pPacket) +NTPPacket::NTPPacket(Poco::UInt8 *packet) { - setPacket(pPacket); + setPacket(packet); } @@ -84,9 +84,9 @@ NTPPacket::~NTPPacket() } -void NTPPacket::packet(Poco::UInt8 *pPacket) const +void NTPPacket::packet(Poco::UInt8 *packet) const { - NTPPacketData *p = (NTPPacketData*)pPacket; + NTPPacketData *p = (NTPPacketData*)packet; p->li = _leapIndicator; p->vn = _version; @@ -104,9 +104,9 @@ void NTPPacket::packet(Poco::UInt8 *pPacket) const } -void NTPPacket::setPacket(Poco::UInt8 *pPacket) +void NTPPacket::setPacket(Poco::UInt8 *packet) { - NTPPacketData *p = (NTPPacketData*)pPacket; + NTPPacketData *p = (NTPPacketData*)packet; _leapIndicator = p->li; _version = p->vn; diff --git a/Net/src/NetworkInterface.cpp b/Net/src/NetworkInterface.cpp index 87288d92d..85ae403f2 100644 --- a/Net/src/NetworkInterface.cpp +++ b/Net/src/NetworkInterface.cpp @@ -75,14 +75,14 @@ public: typedef NetworkInterface::Type Type; NetworkInterfaceImpl(unsigned index); - NetworkInterfaceImpl(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, const IPAddress& rAddress, unsigned index, NetworkInterface::MACAddress* pMACAddress = 0); - NetworkInterfaceImpl(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, unsigned index = 0, NetworkInterface::MACAddress* pMACAddress = 0); - NetworkInterfaceImpl(const std::string& rName, - const std::string& rDisplayName, - const std::string& rAdapterName, - const IPAddress& rAddress, + NetworkInterfaceImpl(const std::string& name, const std::string& displayName, const std::string& adapterName, const IPAddress& address, unsigned index, NetworkInterface::MACAddress* pMACAddress = 0); + NetworkInterfaceImpl(const std::string& name, const std::string& displayName, const std::string& adapterName, unsigned index = 0, NetworkInterface::MACAddress* pMACAddress = 0); + NetworkInterfaceImpl(const std::string& name, + const std::string& displayName, + const std::string& adapterName, + const IPAddress& address, const IPAddress& subnetMask, - const IPAddress& rBroadcastAddress, + const IPAddress& broadcastAddress, unsigned index, NetworkInterface::MACAddress* pMACAddress = 0); @@ -91,10 +91,10 @@ public: const std::string& displayName() const; const std::string& adapterName() const; const IPAddress& firstAddress(IPAddress::Family family) const; - void addAddress(const AddressTuple& rAddress); + void addAddress(const AddressTuple& address); const IPAddress& address(unsigned index) const; const NetworkInterface::AddressList& addressList() const; - bool hasAddress(const IPAddress& rAddress) const; + bool hasAddress(const IPAddress& address) const; const IPAddress& subnetMask(unsigned index) const; const IPAddress& broadcastAddress(unsigned index) const; const IPAddress& destAddress(unsigned index) const; @@ -102,9 +102,9 @@ public: bool supportsIPv4() const; bool supportsIPv6() const; - void setName(const std::string& rName); - void setDisplayName(const std::string& rName); - void setAdapterName(const std::string& rName); + void setName(const std::string& name); + void setDisplayName(const std::string& name); + void setAdapterName(const std::string& name); void addAddress(const IPAddress& addr); void setMACAddress(const NetworkInterface::MACAddress& addr); void setMACAddress(const void *addr, std::size_t len); @@ -157,8 +157,8 @@ private: }; -NetworkInterfaceImpl::NetworkInterfaceImpl(unsigned interfaceIndex): - _index(interfaceIndex), +NetworkInterfaceImpl::NetworkInterfaceImpl(unsigned index): + _index(index), _broadcast(false), _loopback(false), _multicast(false), @@ -171,11 +171,11 @@ NetworkInterfaceImpl::NetworkInterfaceImpl(unsigned interfaceIndex): } -NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, const IPAddress& rAddress, unsigned interfaceIndex, NetworkInterface::MACAddress* pMACAddress): - _name(rName), - _displayName(rDisplayName), - _adapterName(rAdapterName), - _index(interfaceIndex), +NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name, const std::string& displayName, const std::string& adapterName, const IPAddress& address, unsigned index, NetworkInterface::MACAddress* pMACAddress): + _name(name), + _displayName(displayName), + _adapterName(adapterName), + _index(index), _broadcast(false), _loopback(false), _multicast(false), @@ -185,17 +185,17 @@ NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& rName, const std:: _mtu(0), _type(NetworkInterface::NI_TYPE_OTHER) { - _addressList.push_back(AddressTuple(rAddress, IPAddress(), IPAddress())); + _addressList.push_back(AddressTuple(address, IPAddress(), IPAddress())); setPhyParams(); if (pMACAddress) setMACAddress(*pMACAddress); } -NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, unsigned interfaceIndex, NetworkInterface::MACAddress* pMACAddress): - _name(rName), - _displayName(rDisplayName), - _adapterName(rAdapterName), - _index(interfaceIndex), +NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name, const std::string& displayName, const std::string& adapterName, unsigned index, NetworkInterface::MACAddress* pMACAddress): + _name(name), + _displayName(displayName), + _adapterName(adapterName), + _index(index), _broadcast(false), _loopback(false), _multicast(false), @@ -210,18 +210,18 @@ NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& rName, const std:: } -NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& rName, - const std::string& rDisplayName, - const std::string& rAdapterName, - const IPAddress& rAddress, - const IPAddress& rSubnetMask, - const IPAddress& rBroadcastAddress, - unsigned interfaceIndex, +NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name, + const std::string& displayName, + const std::string& adapterName, + const IPAddress& address, + const IPAddress& subnetMask, + const IPAddress& broadcastAddress, + unsigned index, NetworkInterface::MACAddress* pMACAddress): - _name(rName), - _displayName(rDisplayName), - _adapterName(rAdapterName), - _index(interfaceIndex), + _name(name), + _displayName(displayName), + _adapterName(adapterName), + _index(index), _broadcast(false), _loopback(false), _multicast(false), @@ -230,7 +230,7 @@ NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& rName, _running(false), _mtu(0) { - _addressList.push_back(AddressTuple(rAddress, rSubnetMask, rBroadcastAddress)); + _addressList.push_back(AddressTuple(address, subnetMask, broadcastAddress)); setPhyParams(); if (pMACAddress) setMACAddress(*pMACAddress); } @@ -324,29 +324,29 @@ const IPAddress& NetworkInterfaceImpl::firstAddress(IPAddress::Family family) co } -inline void NetworkInterfaceImpl::addAddress(const AddressTuple& rAddress) +inline void NetworkInterfaceImpl::addAddress(const AddressTuple& address) { - _addressList.push_back(rAddress); + _addressList.push_back(address); } -bool NetworkInterfaceImpl::hasAddress(const IPAddress& rAddress) const +bool NetworkInterfaceImpl::hasAddress(const IPAddress& address) const { NetworkInterface::ConstAddressIterator it = _addressList.begin(); NetworkInterface::ConstAddressIterator end = _addressList.end(); for (; it != end; ++it) { - if (it->get() == rAddress) + if (it->get() == address) return true; } return false; } -inline const IPAddress& NetworkInterfaceImpl::address(unsigned interfaceIndex) const +inline const IPAddress& NetworkInterfaceImpl::address(unsigned index) const { - if (interfaceIndex < _addressList.size()) return _addressList[interfaceIndex].get(); - else throw NotFoundException(Poco::format("No address with index %u.", interfaceIndex)); + if (index < _addressList.size()) return _addressList[index].get(); + else throw NotFoundException(Poco::format("No address with index %u.", index)); } @@ -356,32 +356,32 @@ inline const NetworkInterface::AddressList& NetworkInterfaceImpl::addressList() } -const IPAddress& NetworkInterfaceImpl::subnetMask(unsigned interfaceIndex) const +const IPAddress& NetworkInterfaceImpl::subnetMask(unsigned index) const { - if (interfaceIndex < _addressList.size()) - return _addressList[interfaceIndex].get(); + if (index < _addressList.size()) + return _addressList[index].get(); - throw NotFoundException(Poco::format("No subnet mask with index %u.", interfaceIndex)); + throw NotFoundException(Poco::format("No subnet mask with index %u.", index)); } -const IPAddress& NetworkInterfaceImpl::broadcastAddress(unsigned interfaceIndex) const +const IPAddress& NetworkInterfaceImpl::broadcastAddress(unsigned index) const { - if (interfaceIndex < _addressList.size()) - return _addressList[interfaceIndex].get(); + if (index < _addressList.size()) + return _addressList[index].get(); - throw NotFoundException(Poco::format("No subnet mask with index %u.", interfaceIndex)); + throw NotFoundException(Poco::format("No subnet mask with index %u.", index)); } -const IPAddress& NetworkInterfaceImpl::destAddress(unsigned interfaceIndex) const +const IPAddress& NetworkInterfaceImpl::destAddress(unsigned index) const { if (!pointToPoint()) throw InvalidAccessException("Only PPP addresses have destination address."); - else if (interfaceIndex < _addressList.size()) - return _addressList[interfaceIndex].get(); + else if (index < _addressList.size()) + return _addressList[index].get(); - throw NotFoundException(Poco::format("No address with index %u.", interfaceIndex)); + throw NotFoundException(Poco::format("No address with index %u.", index)); } @@ -491,45 +491,45 @@ void NetworkInterfaceImpl::setFlags(short flags) #endif -inline void NetworkInterfaceImpl::setUp(bool isUp) +inline void NetworkInterfaceImpl::setUp(bool up) { - _up = isUp; + _up = up; } -inline void NetworkInterfaceImpl::setMTU(unsigned interfaceMTU) +inline void NetworkInterfaceImpl::setMTU(unsigned mtu) { - _mtu = interfaceMTU; + _mtu = mtu; } -inline void NetworkInterfaceImpl::setType(Type interfaceType) +inline void NetworkInterfaceImpl::setType(Type type) { - _type = interfaceType; + _type = type; } -inline void NetworkInterfaceImpl::setIndex(unsigned interfaceIndex) +inline void NetworkInterfaceImpl::setIndex(unsigned index) { - _index = interfaceIndex; + _index = index; } -inline void NetworkInterfaceImpl::setName(const std::string& rName) +inline void NetworkInterfaceImpl::setName(const std::string& name) { - _name = rName; + _name = name; } -inline void NetworkInterfaceImpl::setDisplayName(const std::string& rName) +inline void NetworkInterfaceImpl::setDisplayName(const std::string& name) { - _displayName = rName; + _displayName = name; } -inline void NetworkInterfaceImpl::setAdapterName(const std::string& rName) +inline void NetworkInterfaceImpl::setAdapterName(const std::string& name) { - _adapterName = rName; + _adapterName = name; } @@ -560,8 +560,8 @@ inline void NetworkInterfaceImpl::setMACAddress(const void *addr, std::size_t le FastMutex NetworkInterface::_mutex; -NetworkInterface::NetworkInterface(unsigned interfaceIndex): - _pImpl(new NetworkInterfaceImpl(interfaceIndex)) +NetworkInterface::NetworkInterface(unsigned index): + _pImpl(new NetworkInterfaceImpl(index)) { } @@ -573,44 +573,44 @@ NetworkInterface::NetworkInterface(const NetworkInterface& interfc): } -NetworkInterface::NetworkInterface(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, const IPAddress& rAddress, unsigned interfaceIndex, MACAddress* pMACAddress): - _pImpl(new NetworkInterfaceImpl(rName, rDisplayName, rAdapterName, rAddress, interfaceIndex, pMACAddress)) +NetworkInterface::NetworkInterface(const std::string& name, const std::string& displayName, const std::string& adapterName, const IPAddress& address, unsigned index, MACAddress* pMACAddress): + _pImpl(new NetworkInterfaceImpl(name, displayName, adapterName, address, index, pMACAddress)) { } -NetworkInterface::NetworkInterface(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, unsigned interfaceIndex, MACAddress* pMACAddress): - _pImpl(new NetworkInterfaceImpl(rName, rDisplayName, rAdapterName, interfaceIndex, pMACAddress)) +NetworkInterface::NetworkInterface(const std::string& name, const std::string& displayName, const std::string& adapterName, unsigned index, MACAddress* pMACAddress): + _pImpl(new NetworkInterfaceImpl(name, displayName, adapterName, index, pMACAddress)) { } -NetworkInterface::NetworkInterface(const std::string& rName, const IPAddress& rAddress, unsigned interfaceIndex, MACAddress* pMACAddress): - _pImpl(new NetworkInterfaceImpl(rName, rName, rName, rAddress, interfaceIndex, pMACAddress)) +NetworkInterface::NetworkInterface(const std::string& name, const IPAddress& address, unsigned index, MACAddress* pMACAddress): + _pImpl(new NetworkInterfaceImpl(name, name, name, address, index, pMACAddress)) { } -NetworkInterface::NetworkInterface(const std::string& rName, - const std::string& rDisplayName, - const std::string& rAdapterName, - const IPAddress& rAddress, - const IPAddress& rSubnetMask, - const IPAddress& rBroadcastAddress, - unsigned interfaceIndex, +NetworkInterface::NetworkInterface(const std::string& name, + const std::string& displayName, + const std::string& adapterName, + const IPAddress& address, + const IPAddress& subnetMask, + const IPAddress& broadcastAddress, + unsigned index, MACAddress* pMACAddress): - _pImpl(new NetworkInterfaceImpl(rName, rDisplayName, rAdapterName, rAddress, rSubnetMask, rBroadcastAddress, interfaceIndex, pMACAddress)) + _pImpl(new NetworkInterfaceImpl(name, displayName, adapterName, address, subnetMask, broadcastAddress, index, pMACAddress)) { } -NetworkInterface::NetworkInterface(const std::string& rName, - const IPAddress& rAddress, - const IPAddress& rSubnetMask, - const IPAddress& rBroadcastAddress, - unsigned interfaceIndex, +NetworkInterface::NetworkInterface(const std::string& name, + const IPAddress& address, + const IPAddress& subnetMask, + const IPAddress& broadcastAddress, + unsigned index, MACAddress* pMACAddress): - _pImpl(new NetworkInterfaceImpl(rName, rName, rName, rAddress, rSubnetMask, rBroadcastAddress, interfaceIndex, pMACAddress)) + _pImpl(new NetworkInterfaceImpl(name, name, name, address, subnetMask, broadcastAddress, index, pMACAddress)) { } @@ -679,21 +679,21 @@ void NetworkInterface::firstAddress(IPAddress& addr, IPAddress::Family family) c } -void NetworkInterface::addAddress(const IPAddress& rAddress) +void NetworkInterface::addAddress(const IPAddress& address) { - _pImpl->addAddress(AddressTuple(rAddress, IPAddress(), IPAddress())); + _pImpl->addAddress(AddressTuple(address, IPAddress(), IPAddress())); } -void NetworkInterface::addAddress(const IPAddress& rAddress, const IPAddress& rSubnetMask, const IPAddress& rBroadcastAddress) +void NetworkInterface::addAddress(const IPAddress& address, const IPAddress& subnetMask, const IPAddress& broadcastAddress) { - _pImpl->addAddress(AddressTuple(rAddress, rSubnetMask, rBroadcastAddress)); + _pImpl->addAddress(AddressTuple(address, subnetMask, broadcastAddress)); } -const IPAddress& NetworkInterface::address(unsigned interfaceIndex) const +const IPAddress& NetworkInterface::address(unsigned index) const { - return _pImpl->address(interfaceIndex); + return _pImpl->address(index); } @@ -703,15 +703,15 @@ const NetworkInterface::AddressList& NetworkInterface::addressList() const } -const IPAddress& NetworkInterface::subnetMask(unsigned interfaceIndex) const +const IPAddress& NetworkInterface::subnetMask(unsigned index) const { - return _pImpl->subnetMask(interfaceIndex); + return _pImpl->subnetMask(index); } -const IPAddress& NetworkInterface::broadcastAddress(unsigned interfaceIndex) const +const IPAddress& NetworkInterface::broadcastAddress(unsigned index) const { - return _pImpl->broadcastAddress(interfaceIndex); + return _pImpl->broadcastAddress(index); } @@ -721,9 +721,9 @@ const NetworkInterface::MACAddress& NetworkInterface::macAddress() const } -const IPAddress& NetworkInterface::destAddress(unsigned interfaceIndex) const +const IPAddress& NetworkInterface::destAddress(unsigned index) const { - return _pImpl->destAddress(interfaceIndex); + return _pImpl->destAddress(index); } @@ -793,14 +793,14 @@ bool NetworkInterface::isUp() const } -NetworkInterface NetworkInterface::forName(const std::string& rName, bool requireIPv6) +NetworkInterface NetworkInterface::forName(const std::string& name, bool requireIPv6) { - if (requireIPv6) return forName(rName, IPv6_ONLY); - else return forName(rName, IPv4_OR_IPv6); + if (requireIPv6) return forName(name, IPv6_ONLY); + else return forName(name, IPv4_OR_IPv6); } -NetworkInterface NetworkInterface::forName(const std::string& rName, IPVersion ipVersion) +NetworkInterface NetworkInterface::forName(const std::string& name, IPVersion ipVersion) { Map map = NetworkInterface::map(false, false); Map::const_iterator it = map.begin(); @@ -808,7 +808,7 @@ NetworkInterface NetworkInterface::forName(const std::string& rName, IPVersion i for (; it != end; ++it) { - if (it->second.name() == rName) + if (it->second.name() == name) { if (ipVersion == IPv4_ONLY && it->second.supportsIPv4()) return it->second; @@ -818,7 +818,7 @@ NetworkInterface NetworkInterface::forName(const std::string& rName, IPVersion i return it->second; } } - throw InterfaceNotFoundException(rName); + throw InterfaceNotFoundException(name); } @@ -864,10 +864,10 @@ NetworkInterface::List NetworkInterface::list(bool ipOnly, bool upOnly) NetworkInterface::Map::const_iterator end = m.end(); for (; it != end; ++it) { - int interfaceIndex = it->second.index(); - std::string interfaceName = it->second.name(); - std::string interfaceDisplayName = it->second.displayName(); - std::string interfaceAdapterName = it->second.adapterName(); + int index = it->second.index(); + std::string name = it->second.name(); + std::string displayName = it->second.displayName(); + std::string adapterName = it->second.adapterName(); NetworkInterface::MACAddress mac = it->second.macAddress(); typedef NetworkInterface::AddressList List; @@ -881,12 +881,12 @@ NetworkInterface::List NetworkInterface::list(bool ipOnly, bool upOnly) NetworkInterface ni; if (mask.isWildcard()) { - ni = NetworkInterface(interfaceName, interfaceDisplayName, interfaceAdapterName, addr, interfaceIndex, &mac); + ni = NetworkInterface(name, displayName, adapterName, addr, index, &mac); } else { IPAddress broadcast = ipIt->get(); - ni = NetworkInterface(interfaceName, interfaceDisplayName, interfaceAdapterName, addr, mask, broadcast, interfaceIndex, &mac); + ni = NetworkInterface(name, displayName, adapterName, addr, mask, broadcast, index, &mac); } ni._pImpl->_broadcast = it->second._pImpl->_broadcast; @@ -984,7 +984,7 @@ NetworkInterface::Type fromNative(DWORD type) } -IPAddress subnetMaskForInterface(const std::string& rName, bool isLoopback) +IPAddress subnetMaskForInterface(const std::string& name, bool isLoopback) { if (isLoopback) { @@ -994,7 +994,7 @@ IPAddress subnetMaskForInterface(const std::string& rName, bool isLoopback) { #if !defined(_WIN32_WCE) std::string subKey("SYSTEM\\CurrentControlSet\\services\\Tcpip\\Parameters\\Interfaces\\"); - subKey += rName; + subKey += name; std::string netmask; HKEY hKey; #if defined(POCO_WIN32_UTF8) && !defined(POCO_NO_WSTRING) @@ -1081,9 +1081,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) poco_assert (NO_ERROR == dwRetVal); for (; pAddress; pAddress = pAddress->Next) { - IPAddress ipAddress; - IPAddress ipSubnetMask; - IPAddress ipBroadcastAddress; + IPAddress address; + IPAddress subnetMask; + IPAddress broadcastAddress; unsigned ifIndex = 0; #if defined(POCO_HAVE_IPv6) @@ -1138,26 +1138,26 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) #endif if (ifIndex == 0) continue; - std::string interfaceName; - std::string interfaceDisplayName; - std::string interfaceAdapterName(pAddress->AdapterName); + std::string name; + std::string displayName; + std::string adapterName(pAddress->AdapterName); #ifdef POCO_WIN32_UTF8 - Poco::UnicodeConverter::toUTF8(pAddress->FriendlyName, interfaceName); - Poco::UnicodeConverter::toUTF8(pAddress->Description, interfaceDisplayName); + Poco::UnicodeConverter::toUTF8(pAddress->FriendlyName, name); + Poco::UnicodeConverter::toUTF8(pAddress->Description, displayName); #else char nameBuffer[1024]; int rc = WideCharToMultiByte(CP_ACP, 0, pAddress->FriendlyName, -1, nameBuffer, sizeof(nameBuffer), NULL, NULL); - if (rc) interfaceName = nameBuffer; + if (rc) name = nameBuffer; char displayNameBuffer[1024]; rc = WideCharToMultiByte(CP_ACP, 0, pAddress->Description, -1, displayNameBuffer, sizeof(displayNameBuffer), NULL, NULL); - if (rc) interfaceDisplayName = displayNameBuffer; + if (rc) displayName = displayNameBuffer; #endif bool isUp = (pAddress->OperStatus == IfOperStatusUp); bool isIP = (0 != pAddress->FirstUnicastAddress); if (((ipOnly && isIP) || !ipOnly) && ((upOnly && isUp) || !upOnly)) { - NetworkInterface ni(interfaceName, interfaceDisplayName, interfaceAdapterName, ifIndex); + NetworkInterface ni(name, displayName, adapterName, ifIndex); // Create interface even if it has an empty list of addresses; also, set // physical attributes which are protocol independent (name, media type, // MAC address, MTU, operational status, etc). @@ -1184,7 +1184,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) pUniAddr; pUniAddr = pUniAddr->Next) { - ipAddress = IPAddress(pUniAddr->Address); + address = IPAddress(pUniAddr->Address); ADDRESS_FAMILY family = pUniAddr->Address.lpSockaddr->sa_family; switch (family) { @@ -1201,67 +1201,67 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) #if defined(_WIN32_WCE) #if _WIN32_WCE >= 0x0800 prefixLength = pUniAddr->OnLinkPrefixLength; - ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress); + broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address); #else - ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress, &prefixLength); + broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address, &prefixLength); #endif // if previous call did not do it, make last-ditch attempt for prefix and broadcast if (prefixLength == 0 && pAddress->FirstPrefix) prefixLength = pAddress->FirstPrefix->PrefixLength; poco_assert (prefixLength <= 32); - if (ipBroadcastAddress.isWildcard()) + if (broadcastAddress.isWildcard()) { IPAddress mask(static_cast(prefixLength), IPAddress::IPv4); - IPAddress host(mask & ipAddress); - ipBroadcastAddress = host | ~mask; + IPAddress host(mask & address); + broadcastAddress = host | ~mask; } #elif (_WIN32_WINNT >= 0x0501) && (NTDDI_VERSION >= 0x05010100) // Win XP SP1 #if (_WIN32_WINNT >= 0x0600) // Vista and newer if (osvi.dwMajorVersion >= 6) { prefixLength = pUniAddr->OnLinkPrefixLength; - ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress); + broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address); } else { - ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress, &prefixLength); + broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address, &prefixLength); } #else - ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress, &prefixLength); + broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address, &prefixLength); #endif poco_assert (prefixLength <= 32); - if (ipBroadcastAddress.isWildcard()) + if (broadcastAddress.isWildcard()) { IPAddress mask(static_cast(prefixLength), IPAddress::IPv4); - IPAddress host(mask & ipAddress); - ipBroadcastAddress = host | ~mask; + IPAddress host(mask & address); + broadcastAddress = host | ~mask; } #endif // (_WIN32_WINNT >= 0x0501) && (NTDDI_VERSION >= 0x05010100) if (prefixLength) { - ipSubnetMask = IPAddress(static_cast(prefixLength), IPAddress::IPv4); + subnetMask = IPAddress(static_cast(prefixLength), IPAddress::IPv4); } else // if all of the above fails, look up the subnet mask in the registry { - ipAddress = IPAddress(&reinterpret_cast(pUniAddr->Address.lpSockaddr)->sin_addr, sizeof(in_addr)); - ipSubnetMask = subnetMaskForInterface(interfaceName, ipAddress.isLoopback()); - if (!ipAddress.isLoopback()) + address = IPAddress(&reinterpret_cast(pUniAddr->Address.lpSockaddr)->sin_addr, sizeof(in_addr)); + subnetMask = subnetMaskForInterface(name, address.isLoopback()); + if (!address.isLoopback()) { - ipBroadcastAddress = ipAddress; - ipBroadcastAddress.mask(ipSubnetMask, IPAddress::broadcast()); + broadcastAddress = address; + broadcastAddress.mask(subnetMask, IPAddress::broadcast()); } } - ifIt->second.addAddress(ipAddress, ipSubnetMask, ipBroadcastAddress); + ifIt->second.addAddress(address, subnetMask, broadcastAddress); } else { - ifIt->second.addAddress(ipAddress); + ifIt->second.addAddress(address); } } break; #if defined(POCO_HAVE_IPv6) case AF_INET6: - ifIt->second.addAddress(ipAddress); + ifIt->second.addAddress(address); break; #endif } // switch family @@ -1408,7 +1408,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) { if (!currIface->ifa_addr) continue; - IPAddress ipAddress, ipSubnetMask, ipBroadcastAddress; + IPAddress address, subnetMask, broadcastAddress; unsigned family = currIface->ifa_addr->sa_family; switch (family) { @@ -1432,17 +1432,17 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly)) ifIt = result.insert(Map::value_type(ifIndex, intf)).first; - ipAddress = IPAddress(*(currIface->ifa_addr)); + address = IPAddress(*(currIface->ifa_addr)); if (( currIface->ifa_flags & IFF_LOOPBACK ) == 0 && currIface->ifa_netmask) - ipSubnetMask = IPAddress(*(currIface->ifa_netmask)); + subnetMask = IPAddress(*(currIface->ifa_netmask)); if (currIface->ifa_flags & IFF_BROADCAST && currIface->ifa_broadaddr) - ipBroadcastAddress = IPAddress(*(currIface->ifa_broadaddr)); + broadcastAddress = IPAddress(*(currIface->ifa_broadaddr)); else if (currIface->ifa_flags & IFF_POINTOPOINT && currIface->ifa_dstaddr) - ipBroadcastAddress = IPAddress(*(currIface->ifa_dstaddr)); + broadcastAddress = IPAddress(*(currIface->ifa_dstaddr)); else - ipBroadcastAddress = IPAddress(); + broadcastAddress = IPAddress(); break; #if defined(POCO_HAVE_IPv6) case AF_INET6: @@ -1453,10 +1453,10 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly)) ifIt = result.insert(Map::value_type(ifIndex, intf)).first; - ipAddress = IPAddress(&reinterpret_cast(currIface->ifa_addr)->sin6_addr, + address = IPAddress(&reinterpret_cast(currIface->ifa_addr)->sin6_addr, sizeof(struct in6_addr), ifIndex); - ipSubnetMask = IPAddress(*(currIface->ifa_netmask)); - ipBroadcastAddress = IPAddress(); + subnetMask = IPAddress(*(currIface->ifa_netmask)); + broadcastAddress = IPAddress(); break; #endif default: @@ -1472,7 +1472,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) if ((upOnly && intf.isUp()) || !upOnly) { if ((ifIt = result.find(ifIndex)) != result.end()) - ifIt->second.addAddress(ipAddress, ipSubnetMask, ipBroadcastAddress); + ifIt->second.addAddress(address, subnetMask, broadcastAddress); } } } @@ -1582,7 +1582,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) { if (!iface->ifa_addr) continue; - IPAddress ipAddress, ipSubnetMask, ipBroadcastAddress; + IPAddress address, subnetMask, broadcastAddress; unsigned family = iface->ifa_addr->sa_family; switch (family) { @@ -1607,15 +1607,15 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly)) ifIt = result.insert(Map::value_type(ifIndex, intf)).first; - ipAddress = IPAddress(*(iface->ifa_addr)); - ipSubnetMask = IPAddress(*(iface->ifa_netmask)); + address = IPAddress(*(iface->ifa_addr)); + subnetMask = IPAddress(*(iface->ifa_netmask)); if (iface->ifa_flags & IFF_BROADCAST && iface->ifa_broadaddr) - ipBroadcastAddress = IPAddress(*(iface->ifa_broadaddr)); + broadcastAddress = IPAddress(*(iface->ifa_broadaddr)); else if (iface->ifa_flags & IFF_POINTOPOINT && iface->ifa_dstaddr) - ipBroadcastAddress = IPAddress(*(iface->ifa_dstaddr)); + broadcastAddress = IPAddress(*(iface->ifa_dstaddr)); else - ipBroadcastAddress = IPAddress(); + broadcastAddress = IPAddress(); break; #if defined(POCO_HAVE_IPv6) @@ -1628,9 +1628,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly)) result.insert(Map::value_type(ifIndex, intf)); - ipAddress = IPAddress(&reinterpret_cast(iface->ifa_addr)->sin6_addr, sizeof(struct in6_addr), ifIndex); - ipSubnetMask = IPAddress(*(iface->ifa_netmask)); - ipBroadcastAddress = IPAddress(); + address = IPAddress(&reinterpret_cast(iface->ifa_addr)->sin6_addr, sizeof(struct in6_addr), ifIndex); + subnetMask = IPAddress(*(iface->ifa_netmask)); + broadcastAddress = IPAddress(); break; #endif @@ -1644,11 +1644,11 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) #endif ) { - intf = NetworkInterface(std::string(iface->ifa_name), ipAddress, ipSubnetMask, ipBroadcastAddress, ifIndex); + intf = NetworkInterface(std::string(iface->ifa_name), address, subnetMask, broadcastAddress, ifIndex); if ((upOnly && intf.isUp()) || !upOnly) { if ((ifIt = result.find(ifIndex)) != result.end()) - ifIt->second.addAddress(ipAddress, ipSubnetMask, ipBroadcastAddress); + ifIt->second.addAddress(address, subnetMask, broadcastAddress); } } } // for interface diff --git a/Net/src/PartSource.cpp b/Net/src/PartSource.cpp index 5f036f2f2..63b032c27 100644 --- a/Net/src/PartSource.cpp +++ b/Net/src/PartSource.cpp @@ -30,8 +30,8 @@ PartSource::PartSource(): } -PartSource::PartSource(const std::string& rMediaType): - _mediaType(rMediaType) +PartSource::PartSource(const std::string& mediaType): + _mediaType(mediaType) { } diff --git a/Net/src/PartStore.cpp b/Net/src/PartStore.cpp index cc27d371d..0ad723d9b 100644 --- a/Net/src/PartStore.cpp +++ b/Net/src/PartStore.cpp @@ -29,7 +29,7 @@ namespace Net { // -PartStore::PartStore(const std::string& rMediaType): PartSource(rMediaType) +PartStore::PartStore(const std::string& mediaType): PartSource(mediaType) { } @@ -44,9 +44,9 @@ PartStore::~PartStore() // -FilePartStore::FilePartStore(const std::string& content, const std::string& rMediaType, const std::string& rFilename): - PartStore(rMediaType), - _filename(rFilename), +FilePartStore::FilePartStore(const std::string& content, const std::string& mediaType, const std::string& filename): + PartStore(mediaType), + _filename(filename), _path(TemporaryFile::tempName()), _fstr(_path) { diff --git a/Net/src/RawSocket.cpp b/Net/src/RawSocket.cpp index 96f4e2624..2f35c3027 100644 --- a/Net/src/RawSocket.cpp +++ b/Net/src/RawSocket.cpp @@ -38,10 +38,10 @@ RawSocket::RawSocket(SocketAddress::Family family, int proto): } -RawSocket::RawSocket(const SocketAddress& rAddress, bool reuseAddress): - Socket(new RawSocketImpl(rAddress.family())) +RawSocket::RawSocket(const SocketAddress& address, bool reuseAddress): + Socket(new RawSocketImpl(address.family())) { - bind(rAddress, reuseAddress); + bind(address, reuseAddress); } @@ -74,15 +74,15 @@ RawSocket& RawSocket::operator = (const Socket& socket) } -void RawSocket::connect(const SocketAddress& rAddress) +void RawSocket::connect(const SocketAddress& address) { - impl()->connect(rAddress); + impl()->connect(address); } -void RawSocket::bind(const SocketAddress& rAddress, bool reuseAddress) +void RawSocket::bind(const SocketAddress& address, bool reuseAddress) { - impl()->bind(rAddress, reuseAddress); + impl()->bind(address, reuseAddress); } @@ -98,15 +98,15 @@ int RawSocket::receiveBytes(void* buffer, int length, int flags) } -int RawSocket::sendTo(const void* buffer, int length, const SocketAddress& rAddress, int flags) +int RawSocket::sendTo(const void* buffer, int length, const SocketAddress& address, int flags) { - return impl()->sendTo(buffer, length, rAddress, flags); + return impl()->sendTo(buffer, length, address, flags); } -int RawSocket::receiveFrom(void* buffer, int length, SocketAddress& rAddress, int flags) +int RawSocket::receiveFrom(void* buffer, int length, SocketAddress& address, int flags) { - return impl()->receiveFrom(buffer, length, rAddress, flags); + return impl()->receiveFrom(buffer, length, address, flags); } diff --git a/Net/src/RawSocketImpl.cpp b/Net/src/RawSocketImpl.cpp index 7cf235156..0377a08c1 100644 --- a/Net/src/RawSocketImpl.cpp +++ b/Net/src/RawSocketImpl.cpp @@ -44,8 +44,8 @@ RawSocketImpl::RawSocketImpl(SocketAddress::Family family, int proto) } -RawSocketImpl::RawSocketImpl(poco_socket_t socketfd): - SocketImpl(socketfd) +RawSocketImpl::RawSocketImpl(poco_socket_t sockfd): + SocketImpl(sockfd) { } diff --git a/Net/src/RemoteSyslogListener.cpp b/Net/src/RemoteSyslogListener.cpp index 73070bc3e..633b1e1c8 100644 --- a/Net/src/RemoteSyslogListener.cpp +++ b/Net/src/RemoteSyslogListener.cpp @@ -43,15 +43,15 @@ namespace Net { class MessageNotification: public Poco::Notification { public: - MessageNotification(const char* buffer, std::size_t length, const Poco::Net::SocketAddress& rSourceAddress): + MessageNotification(const char* buffer, std::size_t length, const Poco::Net::SocketAddress& sourceAddress): _message(buffer, length), - _sourceAddress(rSourceAddress) + _sourceAddress(sourceAddress) { } - MessageNotification(const std::string& rMessage, const Poco::Net::SocketAddress& rSourceAddress): - _message(rMessage), - _sourceAddress(rSourceAddress) + MessageNotification(const std::string& message, const Poco::Net::SocketAddress& sourceAddress): + _message(message), + _sourceAddress(sourceAddress) { } diff --git a/Net/src/SMTPClientSession.cpp b/Net/src/SMTPClientSession.cpp index 2c2bf26f1..f72b4b3a5 100644 --- a/Net/src/SMTPClientSession.cpp +++ b/Net/src/SMTPClientSession.cpp @@ -51,8 +51,8 @@ namespace Poco { namespace Net { -SMTPClientSession::SMTPClientSession(const StreamSocket& rSocket): - _socket(rSocket), +SMTPClientSession::SMTPClientSession(const StreamSocket& socket): + _socket(socket), _isOpen(false) { } @@ -346,8 +346,8 @@ void SMTPClientSession::sendCommands(const MailMessage& message, const Recipient for (Recipients::const_iterator it = pRecipients->begin(); it != pRecipients->end(); ++it) { recipient << '<' << *it << '>'; - int commandStatus = sendCommand("RCPT TO:", recipient.str(), response); - if (!isPositiveCompletion(commandStatus)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, commandStatus); + int status = sendCommand("RCPT TO:", recipient.str(), response); + if (!isPositiveCompletion(status)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, status); recipient.str(""); } } @@ -356,8 +356,8 @@ void SMTPClientSession::sendCommands(const MailMessage& message, const Recipient for (MailMessage::Recipients::const_iterator it = message.recipients().begin(); it != message.recipients().end(); ++it) { recipient << '<' << it->getAddress() << '>'; - int commandStatus = sendCommand("RCPT TO:", recipient.str(), response); - if (!isPositiveCompletion(commandStatus)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, commandStatus); + int status = sendCommand("RCPT TO:", recipient.str(), response); + if (!isPositiveCompletion(status)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, status); recipient.str(""); } } @@ -393,8 +393,8 @@ void SMTPClientSession::sendAddresses(const std::string& from, const Recipients& { recipient << '<' << *it << '>'; - int commandStatus = sendCommand("RCPT TO:", recipient.str(), response); - if (!isPositiveCompletion(commandStatus)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, commandStatus); + int status = sendCommand("RCPT TO:", recipient.str(), response); + if (!isPositiveCompletion(status)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, status); recipient.str(""); } } diff --git a/Net/src/ServerSocket.cpp b/Net/src/ServerSocket.cpp index 0ebca76d1..d52e5977a 100644 --- a/Net/src/ServerSocket.cpp +++ b/Net/src/ServerSocket.cpp @@ -38,9 +38,9 @@ ServerSocket::ServerSocket(const Socket& socket): Socket(socket) } -ServerSocket::ServerSocket(const SocketAddress& rAddress, int backlog): Socket(new ServerSocketImpl) +ServerSocket::ServerSocket(const SocketAddress& address, int backlog): Socket(new ServerSocketImpl) { - impl()->bind(rAddress, true); + impl()->bind(address, true); impl()->listen(backlog); } @@ -48,8 +48,8 @@ ServerSocket::ServerSocket(const SocketAddress& rAddress, int backlog): Socket(n ServerSocket::ServerSocket(Poco::UInt16 port, int backlog): Socket(new ServerSocketImpl) { IPAddress wildcardAddr; - SocketAddress socketAddress(wildcardAddr, port); - impl()->bind(socketAddress, true); + SocketAddress address(wildcardAddr, port); + impl()->bind(address, true); impl()->listen(backlog); } @@ -74,23 +74,23 @@ ServerSocket& ServerSocket::operator = (const Socket& socket) } -void ServerSocket::bind(const SocketAddress& rAddress, bool reuseAddress) +void ServerSocket::bind(const SocketAddress& address, bool reuseAddress) { - impl()->bind(rAddress, reuseAddress); + impl()->bind(address, reuseAddress); } void ServerSocket::bind(Poco::UInt16 port, bool reuseAddress) { IPAddress wildcardAddr; - SocketAddress socketAddress(wildcardAddr, port); - impl()->bind(socketAddress, reuseAddress); + SocketAddress address(wildcardAddr, port); + impl()->bind(address, reuseAddress); } -void ServerSocket::bind6(const SocketAddress& rAddress, bool reuseAddress, bool ipV6Only) +void ServerSocket::bind6(const SocketAddress& address, bool reuseAddress, bool ipV6Only) { - impl()->bind6(rAddress, reuseAddress, ipV6Only); + impl()->bind6(address, reuseAddress, ipV6Only); } @@ -98,8 +98,8 @@ void ServerSocket::bind6(Poco::UInt16 port, bool reuseAddress, bool ipV6Only) { #if defined(POCO_HAVE_IPv6) IPAddress wildcardAddr(IPAddress::IPv6); - SocketAddress socketAddress(wildcardAddr, port); - impl()->bind6(socketAddress, reuseAddress, ipV6Only); + SocketAddress address(wildcardAddr, port); + impl()->bind6(address, reuseAddress, ipV6Only); #else throw Poco::NotImplementedException("No IPv6 support available"); #endif // POCO_HAVE_IPv6 diff --git a/Net/src/SocketAddress.cpp b/Net/src/SocketAddress.cpp index c377b1517..1c2608394 100644 --- a/Net/src/SocketAddress.cpp +++ b/Net/src/SocketAddress.cpp @@ -101,9 +101,9 @@ SocketAddress::SocketAddress(const std::string& hostAddress, const std::string& } -SocketAddress::SocketAddress(Family addressFamily, const std::string& rAddr) +SocketAddress::SocketAddress(Family family, const std::string& addr) { - init(addressFamily, rAddr); + init(family, addr); } @@ -128,16 +128,16 @@ SocketAddress::SocketAddress(const SocketAddress& socketAddress) } -SocketAddress::SocketAddress(const struct sockaddr* sockAddr, poco_socklen_t addressLength) +SocketAddress::SocketAddress(const struct sockaddr* sockAddr, poco_socklen_t length) { - if (addressLength == sizeof(struct sockaddr_in) && sockAddr->sa_family == AF_INET) + if (length == sizeof(struct sockaddr_in) && sockAddr->sa_family == AF_INET) newIPv4(reinterpret_cast(sockAddr)); #if defined(POCO_HAVE_IPv6) - else if (addressLength == sizeof(struct sockaddr_in6) && sockAddr->sa_family == AF_INET6) + else if (length == sizeof(struct sockaddr_in6) && sockAddr->sa_family == AF_INET6) newIPv6(reinterpret_cast(sockAddr)); #endif #if defined(POCO_OS_FAMILY_UNIX) - else if (addressLength > 0 && addressLength <= sizeof(struct sockaddr_un) && sockAddr->sa_family == AF_UNIX) + else if (length > 0 && length <= sizeof(struct sockaddr_un) && sockAddr->sa_family == AF_UNIX) newLocal(reinterpret_cast(sockAddr)); #endif else throw Poco::InvalidArgumentException("Invalid address length or family passed to SocketAddress()"); @@ -281,8 +281,8 @@ void SocketAddress::init(const std::string& hostAndPort) { poco_assert (!hostAndPort.empty()); - std::string socketHost; - std::string socketPort; + std::string host; + std::string port; std::string::const_iterator it = hostAndPort.begin(); std::string::const_iterator end = hostAndPort.end(); @@ -296,30 +296,30 @@ void SocketAddress::init(const std::string& hostAndPort) if (*it == '[') { ++it; - while (it != end && *it != ']') socketHost += *it++; + while (it != end && *it != ']') host += *it++; if (it == end) throw InvalidArgumentException("Malformed IPv6 address"); ++it; } else { - while (it != end && *it != ':') socketHost += *it++; + while (it != end && *it != ':') host += *it++; } if (it != end && *it == ':') { ++it; - while (it != end) socketPort += *it++; + while (it != end) port += *it++; } else throw InvalidArgumentException("Missing port number"); - init(socketHost, resolveService(socketPort)); + init(host, resolveService(port)); } Poco::UInt16 SocketAddress::resolveService(const std::string& service) { - unsigned socketPort; - if (NumberParser::tryParseUnsigned(service, socketPort) && socketPort <= 0xFFFF) + unsigned port; + if (NumberParser::tryParseUnsigned(service, port) && port <= 0xFFFF) { - return (UInt16) socketPort; + return (UInt16) port; } else { diff --git a/Net/src/SocketAddressImpl.cpp b/Net/src/SocketAddressImpl.cpp index 1e1fa47ab..02715af8b 100644 --- a/Net/src/SocketAddressImpl.cpp +++ b/Net/src/SocketAddressImpl.cpp @@ -53,19 +53,19 @@ IPv4SocketAddressImpl::IPv4SocketAddressImpl() } -IPv4SocketAddressImpl::IPv4SocketAddressImpl(const struct sockaddr_in* pAddr) +IPv4SocketAddressImpl::IPv4SocketAddressImpl(const struct sockaddr_in* addr) { - std::memcpy(&_addr, pAddr, sizeof(_addr)); + std::memcpy(&_addr, addr, sizeof(_addr)); } -IPv4SocketAddressImpl::IPv4SocketAddressImpl(const void* pAddr, UInt16 socketPort) +IPv4SocketAddressImpl::IPv4SocketAddressImpl(const void* addr, UInt16 port) { std::memset(&_addr, 0, sizeof(_addr)); _addr.sin_family = AF_INET; poco_set_sin_len(&_addr); - std::memcpy(&_addr.sin_addr, pAddr, sizeof(_addr.sin_addr)); - _addr.sin_port = socketPort; + std::memcpy(&_addr.sin_addr, addr, sizeof(_addr.sin_addr)); + _addr.sin_port = port; } @@ -87,29 +87,29 @@ std::string IPv4SocketAddressImpl::toString() const // -IPv6SocketAddressImpl::IPv6SocketAddressImpl(const struct sockaddr_in6* pAddr) +IPv6SocketAddressImpl::IPv6SocketAddressImpl(const struct sockaddr_in6* addr) { - std::memcpy(&_addr, pAddr, sizeof(_addr)); + std::memcpy(&_addr, addr, sizeof(_addr)); } -IPv6SocketAddressImpl::IPv6SocketAddressImpl(const void* pAddr, UInt16 socketPort) +IPv6SocketAddressImpl::IPv6SocketAddressImpl(const void* addr, UInt16 port) { std::memset(&_addr, 0, sizeof(_addr)); _addr.sin6_family = AF_INET6; poco_set_sin6_len(&_addr); - std::memcpy(&_addr.sin6_addr, pAddr, sizeof(_addr.sin6_addr)); - _addr.sin6_port = socketPort; + std::memcpy(&_addr.sin6_addr, addr, sizeof(_addr.sin6_addr)); + _addr.sin6_port = port; } -IPv6SocketAddressImpl::IPv6SocketAddressImpl(const void* pAddr, UInt16 socketPort, UInt32 scope) +IPv6SocketAddressImpl::IPv6SocketAddressImpl(const void* addr, UInt16 port, UInt32 scope) { std::memset(&_addr, 0, sizeof(_addr)); _addr.sin6_family = AF_INET6; poco_set_sin6_len(&_addr); - std::memcpy(&_addr.sin6_addr, pAddr, sizeof(_addr.sin6_addr)); - _addr.sin6_port = socketPort; + std::memcpy(&_addr.sin6_addr, addr, sizeof(_addr.sin6_addr)); + _addr.sin6_port = port; _addr.sin6_scope_id = scope; } @@ -137,19 +137,19 @@ std::string IPv6SocketAddressImpl::toString() const // -LocalSocketAddressImpl::LocalSocketAddressImpl(const struct sockaddr_un* pAddr) +LocalSocketAddressImpl::LocalSocketAddressImpl(const struct sockaddr_un* addr) { _pAddr = new sockaddr_un; - std::memcpy(_pAddr, pAddr, sizeof(struct sockaddr_un)); + std::memcpy(_pAddr, addr, sizeof(struct sockaddr_un)); } -LocalSocketAddressImpl::LocalSocketAddressImpl(const char* pPath) +LocalSocketAddressImpl::LocalSocketAddressImpl(const char* path) { _pAddr = new sockaddr_un; - poco_set_sun_len(_pAddr, std::strlen(pPath) + sizeof(struct sockaddr_un) - sizeof(_pAddr->sun_path) + 1); + poco_set_sun_len(_pAddr, std::strlen(path) + sizeof(struct sockaddr_un) - sizeof(_pAddr->sun_path) + 1); _pAddr->sun_family = AF_UNIX; - std::strcpy(_pAddr->sun_path, pPath); + std::strcpy(_pAddr->sun_path, path); } diff --git a/Net/src/SocketImpl.cpp b/Net/src/SocketImpl.cpp index a14280775..40bda76a2 100644 --- a/Net/src/SocketImpl.cpp +++ b/Net/src/SocketImpl.cpp @@ -73,8 +73,8 @@ SocketImpl::SocketImpl(): } -SocketImpl::SocketImpl(poco_socket_t socketfd): - _sockfd(socketfd), +SocketImpl::SocketImpl(poco_socket_t sockfd): + _sockfd(sockfd), _blocking(true), _isBrokenTimeout(checkIsBrokenTimeout()) { @@ -110,51 +110,51 @@ SocketImpl* SocketImpl::acceptConnection(SocketAddress& clientAddr) } -void SocketImpl::connect(const SocketAddress& rAddress) +void SocketImpl::connect(const SocketAddress& address) { if (_sockfd == POCO_INVALID_SOCKET) { - init(rAddress.af()); + init(address.af()); } int rc; do { #if defined(POCO_VXWORKS) - rc = ::connect(_sockfd, (sockaddr*) rAddress.addr(), rAddress.length()); + rc = ::connect(_sockfd, (sockaddr*) address.addr(), address.length()); #else - rc = ::connect(_sockfd, rAddress.addr(), rAddress.length()); + rc = ::connect(_sockfd, address.addr(), address.length()); #endif } while (rc != 0 && lastError() == POCO_EINTR); if (rc != 0) { int err = lastError(); - error(err, rAddress.toString()); + error(err, address.toString()); } } -void SocketImpl::connect(const SocketAddress& rAddress, const Poco::Timespan& timeout) +void SocketImpl::connect(const SocketAddress& address, const Poco::Timespan& timeout) { if (_sockfd == POCO_INVALID_SOCKET) { - init(rAddress.af()); + init(address.af()); } setBlocking(false); try { #if defined(POCO_VXWORKS) - int rc = ::connect(_sockfd, (sockaddr*) rAddress.addr(), rAddress.length()); + int rc = ::connect(_sockfd, (sockaddr*) address.addr(), address.length()); #else - int rc = ::connect(_sockfd, rAddress.addr(), rAddress.length()); + int rc = ::connect(_sockfd, address.addr(), address.length()); #endif if (rc != 0) { int err = lastError(); if (err != POCO_EINPROGRESS && err != POCO_EWOULDBLOCK) - error(err, rAddress.toString()); + error(err, address.toString()); if (!poll(timeout, SELECT_READ | SELECT_WRITE | SELECT_ERROR)) - throw Poco::TimeoutException("connect timed out", rAddress.toString()); + throw Poco::TimeoutException("connect timed out", address.toString()); err = socketError(); if (err != 0) error(err); } @@ -168,32 +168,32 @@ void SocketImpl::connect(const SocketAddress& rAddress, const Poco::Timespan& ti } -void SocketImpl::connectNB(const SocketAddress& rAddress) +void SocketImpl::connectNB(const SocketAddress& address) { if (_sockfd == POCO_INVALID_SOCKET) { - init(rAddress.af()); + init(address.af()); } setBlocking(false); #if defined(POCO_VXWORKS) - int rc = ::connect(_sockfd, (sockaddr*) rAddress.addr(), rAddress.length()); + int rc = ::connect(_sockfd, (sockaddr*) address.addr(), address.length()); #else - int rc = ::connect(_sockfd, rAddress.addr(), rAddress.length()); + int rc = ::connect(_sockfd, address.addr(), address.length()); #endif if (rc != 0) { int err = lastError(); if (err != POCO_EINPROGRESS && err != POCO_EWOULDBLOCK) - error(err, rAddress.toString()); + error(err, address.toString()); } } -void SocketImpl::bind(const SocketAddress& rAddress, bool reuseAddress) +void SocketImpl::bind(const SocketAddress& address, bool reuseAddress) { if (_sockfd == POCO_INVALID_SOCKET) { - init(rAddress.af()); + init(address.af()); } if (reuseAddress) { @@ -201,23 +201,23 @@ void SocketImpl::bind(const SocketAddress& rAddress, bool reuseAddress) setReusePort(true); } #if defined(POCO_VXWORKS) - int rc = ::bind(_sockfd, (sockaddr*) rAddress.addr(), rAddress.length()); + int rc = ::bind(_sockfd, (sockaddr*) address.addr(), address.length()); #else - int rc = ::bind(_sockfd, rAddress.addr(), rAddress.length()); + int rc = ::bind(_sockfd, address.addr(), address.length()); #endif - if (rc != 0) error(rAddress.toString()); + if (rc != 0) error(address.toString()); } -void SocketImpl::bind6(const SocketAddress& rAddress, bool reuseAddress, bool ipV6Only) +void SocketImpl::bind6(const SocketAddress& address, bool reuseAddress, bool ipV6Only) { #if defined(POCO_HAVE_IPv6) - if (rAddress.family() != SocketAddress::IPv6) + if (address.family() != SocketAddress::IPv6) throw Poco::InvalidArgumentException("SocketAddress must be an IPv6 address"); if (_sockfd == POCO_INVALID_SOCKET) { - init(rAddress.af()); + init(address.af()); } #ifdef IPV6_V6ONLY setOption(IPPROTO_IPV6, IPV6_V6ONLY, ipV6Only ? 1 : 0); @@ -229,8 +229,8 @@ void SocketImpl::bind6(const SocketAddress& rAddress, bool reuseAddress, bool ip setReuseAddress(true); setReusePort(true); } - int rc = ::bind(_sockfd, rAddress.addr(), rAddress.length()); - if (rc != 0) error(rAddress.toString()); + int rc = ::bind(_sockfd, address.addr(), address.length()); + if (rc != 0) error(address.toString()); #else throw Poco::NotImplementedException("No IPv6 support available"); #endif @@ -338,16 +338,16 @@ int SocketImpl::receiveBytes(void* buffer, int length, int flags) } -int SocketImpl::sendTo(const void* buffer, int length, const SocketAddress& rAddress, int flags) +int SocketImpl::sendTo(const void* buffer, int length, const SocketAddress& address, int flags) { int rc; do { if (_sockfd == POCO_INVALID_SOCKET) throw InvalidSocketException(); #if defined(POCO_VXWORKS) - rc = ::sendto(_sockfd, (char*) buffer, length, flags, (sockaddr*) rAddress.addr(), rAddress.length()); + rc = ::sendto(_sockfd, (char*) buffer, length, flags, (sockaddr*) address.addr(), address.length()); #else - rc = ::sendto(_sockfd, reinterpret_cast(buffer), length, flags, rAddress.addr(), rAddress.length()); + rc = ::sendto(_sockfd, reinterpret_cast(buffer), length, flags, address.addr(), address.length()); #endif } while (_blocking && rc < 0 && lastError() == POCO_EINTR); @@ -356,7 +356,7 @@ int SocketImpl::sendTo(const void* buffer, int length, const SocketAddress& rAdd } -int SocketImpl::receiveFrom(void* buffer, int length, SocketAddress& rAddress, int flags) +int SocketImpl::receiveFrom(void* buffer, int length, SocketAddress& address, int flags) { if (_isBrokenTimeout) { @@ -379,7 +379,7 @@ int SocketImpl::receiveFrom(void* buffer, int length, SocketAddress& rAddress, i while (_blocking && rc < 0 && lastError() == POCO_EINTR); if (rc >= 0) { - rAddress = SocketAddress(pSA, saLen); + address = SocketAddress(pSA, saLen); } else { @@ -420,8 +420,8 @@ bool SocketImpl::secure() const bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) { - poco_socket_t socketfd = _sockfd; - if (socketfd == POCO_INVALID_SOCKET) throw InvalidSocketException(); + poco_socket_t sockfd = _sockfd; + if (sockfd == POCO_INVALID_SOCKET) throw InvalidSocketException(); #if defined(POCO_HAVE_FD_EPOLL) @@ -443,7 +443,7 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) if (mode & SELECT_ERROR) evin.events |= EPOLLERR; - if (epoll_ctl(epollfd, EPOLL_CTL_ADD, socketfd, &evin) < 0) + if (epoll_ctl(epollfd, EPOLL_CTL_ADD, sockfd, &evin) < 0) { char buf[1024]; strerror_r(errno, buf, sizeof(buf)); @@ -516,15 +516,15 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) FD_ZERO(&fdExcept); if (mode & SELECT_READ) { - FD_SET(socketfd, &fdRead); + FD_SET(sockfd, &fdRead); } if (mode & SELECT_WRITE) { - FD_SET(socketfd, &fdWrite); + FD_SET(sockfd, &fdWrite); } if (mode & SELECT_ERROR) { - FD_SET(socketfd, &fdExcept); + FD_SET(sockfd, &fdExcept); } Poco::Timespan remainingTime(timeout); int errorCode = POCO_ENOERR; @@ -535,7 +535,7 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) tv.tv_sec = (long) remainingTime.totalSeconds(); tv.tv_usec = (long) remainingTime.useconds(); Poco::Timestamp start; - rc = ::select(int(socketfd) + 1, &fdRead, &fdWrite, &fdExcept, &tv); + rc = ::select(int(sockfd) + 1, &fdRead, &fdWrite, &fdExcept, &tv); if (rc < 0 && (errorCode = lastError()) == POCO_EINTR) { Poco::Timestamp end; diff --git a/Net/src/SocketNotification.cpp b/Net/src/SocketNotification.cpp index f444158c6..d29a2203c 100644 --- a/Net/src/SocketNotification.cpp +++ b/Net/src/SocketNotification.cpp @@ -32,9 +32,9 @@ SocketNotification::~SocketNotification() } -void SocketNotification::setSocket(const Socket& rSocket) +void SocketNotification::setSocket(const Socket& socket) { - _socket = rSocket; + _socket = socket; } diff --git a/Net/src/SocketStream.cpp b/Net/src/SocketStream.cpp index 01988e300..1649253b5 100644 --- a/Net/src/SocketStream.cpp +++ b/Net/src/SocketStream.cpp @@ -66,8 +66,8 @@ int SocketStreamBuf::writeToDevice(const char* buffer, std::streamsize length) // -SocketIOS::SocketIOS(const Socket& rSocket): - _buf(rSocket) +SocketIOS::SocketIOS(const Socket& socket): + _buf(socket) { poco_ios_init(&_buf); } @@ -109,8 +109,8 @@ StreamSocket SocketIOS::socket() const // -SocketOutputStream::SocketOutputStream(const Socket& rSocket): - SocketIOS(rSocket), +SocketOutputStream::SocketOutputStream(const Socket& socket): + SocketIOS(socket), std::ostream(&_buf) { } @@ -126,8 +126,8 @@ SocketOutputStream::~SocketOutputStream() // -SocketInputStream::SocketInputStream(const Socket& rSocket): - SocketIOS(rSocket), +SocketInputStream::SocketInputStream(const Socket& socket): + SocketIOS(socket), std::istream(&_buf) { } @@ -143,8 +143,8 @@ SocketInputStream::~SocketInputStream() // -SocketStream::SocketStream(const Socket& rSocket): - SocketIOS(rSocket), +SocketStream::SocketStream(const Socket& socket): + SocketIOS(socket), std::iostream(&_buf) { } diff --git a/Net/src/StreamSocket.cpp b/Net/src/StreamSocket.cpp index d695e9eaf..ba35a9aff 100644 --- a/Net/src/StreamSocket.cpp +++ b/Net/src/StreamSocket.cpp @@ -35,9 +35,9 @@ StreamSocket::StreamSocket(): Socket(new StreamSocketImpl) } -StreamSocket::StreamSocket(const SocketAddress& rAddress): Socket(new StreamSocketImpl(rAddress.family())) +StreamSocket::StreamSocket(const SocketAddress& address): Socket(new StreamSocketImpl(address.family())) { - connect(rAddress); + connect(address); } @@ -75,21 +75,21 @@ StreamSocket& StreamSocket::operator = (const Socket& socket) } -void StreamSocket::connect(const SocketAddress& rAddress) +void StreamSocket::connect(const SocketAddress& address) { - impl()->connect(rAddress); + impl()->connect(address); } -void StreamSocket::connect(const SocketAddress& rAddress, const Poco::Timespan& timeout) +void StreamSocket::connect(const SocketAddress& address, const Poco::Timespan& timeout) { - impl()->connect(rAddress, timeout); + impl()->connect(address, timeout); } -void StreamSocket::connectNB(const SocketAddress& rAddress) +void StreamSocket::connectNB(const SocketAddress& address) { - impl()->connectNB(rAddress); + impl()->connectNB(address); } diff --git a/Net/src/StreamSocketImpl.cpp b/Net/src/StreamSocketImpl.cpp index fba8727ec..06b736fa7 100644 --- a/Net/src/StreamSocketImpl.cpp +++ b/Net/src/StreamSocketImpl.cpp @@ -44,7 +44,7 @@ StreamSocketImpl::StreamSocketImpl(SocketAddress::Family family) } -StreamSocketImpl::StreamSocketImpl(poco_socket_t socketfd): SocketImpl(socketfd) +StreamSocketImpl::StreamSocketImpl(poco_socket_t sockfd): SocketImpl(sockfd) { } diff --git a/Net/src/StringPartSource.cpp b/Net/src/StringPartSource.cpp index e61e8b3ed..62831f16e 100644 --- a/Net/src/StringPartSource.cpp +++ b/Net/src/StringPartSource.cpp @@ -28,17 +28,17 @@ StringPartSource::StringPartSource(const std::string& str): } -StringPartSource::StringPartSource(const std::string& str, const std::string& rMediaType): - PartSource(rMediaType), +StringPartSource::StringPartSource(const std::string& str, const std::string& mediaType): + PartSource(mediaType), _istr(str) { } -StringPartSource::StringPartSource(const std::string& str, const std::string& rMediaType, const std::string& rFilename): - PartSource(rMediaType), +StringPartSource::StringPartSource(const std::string& str, const std::string& mediaType, const std::string& filename): + PartSource(mediaType), _istr(str), - _filename(rFilename) + _filename(filename) { } diff --git a/Net/src/TCPServer.cpp b/Net/src/TCPServer.cpp index 945e67904..7b06d694c 100644 --- a/Net/src/TCPServer.cpp +++ b/Net/src/TCPServer.cpp @@ -46,9 +46,9 @@ TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::UInt16 port } -TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSocket& rSocket, TCPServerParams::Ptr pParams): - _socket(rSocket), - _thread(threadName(rSocket)), +TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSocket& socket, TCPServerParams::Ptr pParams): + _socket(socket), + _thread(threadName(socket)), _stopped(true) { Poco::ThreadPool& pool = Poco::ThreadPool::defaultPool(); @@ -61,10 +61,10 @@ TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSocke } -TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& rSocket, TCPServerParams::Ptr pParams): - _socket(rSocket), +TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, TCPServerParams::Ptr pParams): + _socket(socket), _pDispatcher(new TCPServerDispatcher(pFactory, threadPool, pParams)), - _thread(threadName(rSocket)), + _thread(threadName(socket)), _stopped(true) { } diff --git a/Net/src/TCPServerConnection.cpp b/Net/src/TCPServerConnection.cpp index fad30cccf..08dc1b0d9 100644 --- a/Net/src/TCPServerConnection.cpp +++ b/Net/src/TCPServerConnection.cpp @@ -27,8 +27,8 @@ namespace Poco { namespace Net { -TCPServerConnection::TCPServerConnection(const StreamSocket& rSocket): - _socket(rSocket) +TCPServerConnection::TCPServerConnection(const StreamSocket& socket): + _socket(socket) { } diff --git a/Net/src/TCPServerDispatcher.cpp b/Net/src/TCPServerDispatcher.cpp index b9ad20969..a5f2de3c6 100644 --- a/Net/src/TCPServerDispatcher.cpp +++ b/Net/src/TCPServerDispatcher.cpp @@ -33,8 +33,8 @@ namespace Net { class TCPConnectionNotification: public Notification { public: - TCPConnectionNotification(const StreamSocket& rSocket): - _socket(rSocket) + TCPConnectionNotification(const StreamSocket& socket): + _socket(socket) { } diff --git a/Net/src/WebSocketImpl.cpp b/Net/src/WebSocketImpl.cpp index 33e4dd56c..760a75061 100644 --- a/Net/src/WebSocketImpl.cpp +++ b/Net/src/WebSocketImpl.cpp @@ -29,11 +29,11 @@ namespace Poco { namespace Net { -WebSocketImpl::WebSocketImpl(StreamSocketImpl* pStreamSocketImpl, bool isMustMaskPayload): +WebSocketImpl::WebSocketImpl(StreamSocketImpl* pStreamSocketImpl, bool mustMaskPayload): StreamSocketImpl(pStreamSocketImpl->sockfd()), _pStreamSocketImpl(pStreamSocketImpl), _frameFlags(0), - _mustMaskPayload(isMustMaskPayload) + _mustMaskPayload(mustMaskPayload) { poco_check_ptr(pStreamSocketImpl); _pStreamSocketImpl->duplicate(); @@ -233,31 +233,31 @@ SocketImpl* WebSocketImpl::acceptConnection(SocketAddress& clientAddr) } -void WebSocketImpl::connect(const SocketAddress& rAddress) +void WebSocketImpl::connect(const SocketAddress& address) { throw Poco::InvalidAccessException("Cannot connect() a WebSocketImpl"); } -void WebSocketImpl::connect(const SocketAddress& rAddress, const Poco::Timespan& timeout) +void WebSocketImpl::connect(const SocketAddress& address, const Poco::Timespan& timeout) { throw Poco::InvalidAccessException("Cannot connect() a WebSocketImpl"); } -void WebSocketImpl::connectNB(const SocketAddress& rAddress) +void WebSocketImpl::connectNB(const SocketAddress& address) { throw Poco::InvalidAccessException("Cannot connectNB() a WebSocketImpl"); } -void WebSocketImpl::bind(const SocketAddress& rAddress, bool reuseAddress) +void WebSocketImpl::bind(const SocketAddress& address, bool reuseAddress) { throw Poco::InvalidAccessException("Cannot bind() a WebSocketImpl"); } -void WebSocketImpl::bind6(const SocketAddress& rAddress, bool reuseAddress, bool ipV6Only) +void WebSocketImpl::bind6(const SocketAddress& address, bool reuseAddress, bool ipV6Only) { throw Poco::InvalidAccessException("Cannot bind6() a WebSocketImpl"); } @@ -294,13 +294,13 @@ void WebSocketImpl::shutdown() } -int WebSocketImpl::sendTo(const void* buffer, int length, const SocketAddress& rAddress, int flags) +int WebSocketImpl::sendTo(const void* buffer, int length, const SocketAddress& address, int flags) { throw Poco::InvalidAccessException("Cannot sendTo() on a WebSocketImpl"); } -int WebSocketImpl::receiveFrom(void* buffer, int length, SocketAddress& rAddress, int flags) +int WebSocketImpl::receiveFrom(void* buffer, int length, SocketAddress& address, int flags) { throw Poco::InvalidAccessException("Cannot receiveFrom() on a WebSocketImpl"); } From ff2d8b65c7351894114be089eb78caa91ee3adac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Mon, 5 Sep 2016 08:37:47 +0200 Subject: [PATCH 26/31] Revert "GH #1050 JSON: fix gcc -Wshadow warnings" --- Foundation/include/Poco/Nullable.h | 20 ++++++++++---------- JSON/include/Poco/JSON/Array.h | 8 ++++---- JSON/include/Poco/JSON/Object.h | 12 ++++++------ JSON/include/Poco/JSON/PrintHandler.h | 4 ++-- JSON/src/Array.cpp | 4 ++-- JSON/src/Object.cpp | 12 ++++++------ JSON/src/ParseHandler.cpp | 6 +++--- JSON/src/PrintHandler.cpp | 12 ++++++------ 8 files changed, 39 insertions(+), 39 deletions(-) diff --git a/Foundation/include/Poco/Nullable.h b/Foundation/include/Poco/Nullable.h index 7857ffe68..adceafd87 100644 --- a/Foundation/include/Poco/Nullable.h +++ b/Foundation/include/Poco/Nullable.h @@ -74,9 +74,9 @@ public: { } - Nullable(const C& rValue): + Nullable(const C& value): /// Creates a Nullable with the given value. - _value(rValue), + _value(value), _isNull(false) { } @@ -93,10 +93,10 @@ public: { } - Nullable& assign(const C& rValue) + Nullable& assign(const C& value) /// Assigns a value to the Nullable. { - _value = rValue; + _value = value; _isNull = false; return *this; } @@ -116,10 +116,10 @@ public: return *this; } - Nullable& operator = (const C& rValue) + Nullable& operator = (const C& value) /// Assigns a value to the Nullable. { - return assign(rValue); + return assign(value); } Nullable& operator = (const Nullable& other) @@ -148,10 +148,10 @@ public: return (_isNull && other._isNull) || (_isNull == other._isNull && _value == other._value); } - bool operator == (const C& rValue) const + bool operator == (const C& value) const /// Compares Nullable with value for equality { - return (!_isNull && _value == rValue); + return (!_isNull && _value == value); } bool operator == (const NullType&) const @@ -160,10 +160,10 @@ public: return _isNull; } - bool operator != (const C& rValue) const + bool operator != (const C& value) const /// Compares Nullable with value for non equality { - return !(*this == rValue); + return !(*this == value); } bool operator != (const Nullable& other) const diff --git a/JSON/include/Poco/JSON/Array.h b/JSON/include/Poco/JSON/Array.h index 3fef77237..54769460c 100644 --- a/JSON/include/Poco/JSON/Array.h +++ b/JSON/include/Poco/JSON/Array.h @@ -300,9 +300,9 @@ public: throw BadCastException(); } - void convert(bool& rValue) const + void convert(bool& value) const { - rValue = !_val.isNull() && _val->size() > 0; + value = !_val.isNull() && _val->size() > 0; } void convert(float&) const @@ -439,9 +439,9 @@ public: throw BadCastException(); } - void convert(bool& rValue) const + void convert(bool& value) const { - rValue = _val.size() > 0; + value = _val.size() > 0; } void convert(float&) const diff --git a/JSON/include/Poco/JSON/Object.h b/JSON/include/Poco/JSON/Object.h index ac3c4e455..a14e022d3 100644 --- a/JSON/include/Poco/JSON/Object.h +++ b/JSON/include/Poco/JSON/Object.h @@ -216,8 +216,8 @@ private: if (indent > 0) out << std::endl; typename C::const_iterator it = container.begin(); - typename C::const_iterator itEnd = container.end(); - for (; it != itEnd;) + typename C::const_iterator end = container.end(); + for (; it != end;) { for(unsigned int i = 0; i < indent; i++) out << ' '; @@ -405,9 +405,9 @@ public: throw BadCastException(); } - void convert(bool& rValue) const + void convert(bool& value) const { - rValue = !_val.isNull() && _val->size() > 0; + value = !_val.isNull() && _val->size() > 0; } void convert(float&) const @@ -547,9 +547,9 @@ public: throw BadCastException(); } - void convert(bool& rValue) const + void convert(bool& value) const { - rValue = _val.size() > 0; + value = _val.size() > 0; } void convert(float&) const diff --git a/JSON/include/Poco/JSON/PrintHandler.h b/JSON/include/Poco/JSON/PrintHandler.h index de95539c1..b063565ad 100644 --- a/JSON/include/Poco/JSON/PrintHandler.h +++ b/JSON/include/Poco/JSON/PrintHandler.h @@ -119,9 +119,9 @@ private: }; -inline void PrintHandler::setIndent(unsigned newIndent) +inline void PrintHandler::setIndent(unsigned indent) { - _indent = newIndent; + _indent = indent; } diff --git a/JSON/src/Array.cpp b/JSON/src/Array.cpp index 94a5866ac..d49c01077 100644 --- a/JSON/src/Array.cpp +++ b/JSON/src/Array.cpp @@ -149,10 +149,10 @@ Array::operator const Poco::Dynamic::Array& () const if (!_pArray) { ValueVec::const_iterator it = _values.begin(); - ValueVec::const_iterator itEnd = _values.end(); + ValueVec::const_iterator end = _values.end(); _pArray = new Poco::Dynamic::Array; int index = 0; - for (; it != itEnd; ++it, ++index) + for (; it != end; ++it, ++index) { if (isObject(it)) { diff --git a/JSON/src/Object.cpp b/JSON/src/Object.cpp index d23f52fc6..d81fa3e81 100644 --- a/JSON/src/Object.cpp +++ b/JSON/src/Object.cpp @@ -113,8 +113,8 @@ void Object::stringify(std::ostream& out, unsigned int indent, int step) const const std::string& Object::getKey(KeyPtrList::const_iterator& iter) const { ValueMap::const_iterator it = _values.begin(); - ValueMap::const_iterator itEnd = _values.end(); - for (; it != itEnd; ++it) + ValueMap::const_iterator end = _values.end(); + for (; it != end; ++it) { if (it->first == **iter) return it->first; } @@ -130,8 +130,8 @@ void Object::set(const std::string& key, const Dynamic::Var& value) if (_preserveInsOrder) { KeyPtrList::iterator it = _keys.begin(); - KeyPtrList::iterator itEnd = _keys.end(); - for (; it != itEnd; ++it) + KeyPtrList::iterator end = _keys.end(); + for (; it != end; ++it) { if (key == **it) return; } @@ -173,9 +173,9 @@ Object::operator const Poco::DynamicStruct& () const if (!_pStruct) { ValueMap::const_iterator it = _values.begin(); - ValueMap::const_iterator itEnd = _values.end(); + ValueMap::const_iterator end = _values.end(); _pStruct = new Poco::DynamicStruct; - for (; it != itEnd; ++it) + for (; it != end; ++it) { if (isObject(it)) { diff --git a/JSON/src/ParseHandler.cpp b/JSON/src/ParseHandler.cpp index cb1cb248b..74296493a 100644 --- a/JSON/src/ParseHandler.cpp +++ b/JSON/src/ParseHandler.cpp @@ -122,20 +122,20 @@ void ParseHandler::key(const std::string& k) } -void ParseHandler::setValue(const Var& rValue) +void ParseHandler::setValue(const Var& value) { Var parent = _stack.top(); if ( parent.type() == typeid(Array::Ptr) ) { Array::Ptr arr = parent.extract(); - arr->add(rValue); + arr->add(value); } else if ( parent.type() == typeid(Object::Ptr) ) { poco_assert_dbg(!_key.empty()); Object::Ptr obj = parent.extract(); - obj->set(_key, rValue); + obj->set(_key, value); _key.clear(); } } diff --git a/JSON/src/PrintHandler.cpp b/JSON/src/PrintHandler.cpp index 92bc6d09f..d88ee37ff 100644 --- a/JSON/src/PrintHandler.cpp +++ b/JSON/src/PrintHandler.cpp @@ -23,18 +23,18 @@ namespace Poco { namespace JSON { -PrintHandler::PrintHandler(unsigned newIndent): +PrintHandler::PrintHandler(unsigned indent): _out(std::cout), - _indent(newIndent), + _indent(indent), _array(0), _objStart(true) { } -PrintHandler::PrintHandler(std::ostream& out, unsigned newIndent): +PrintHandler::PrintHandler(std::ostream& out, unsigned indent): _out(out), - _indent(newIndent), + _indent(indent), _array(0), _objStart(true) { @@ -172,10 +172,10 @@ void PrintHandler::value(UInt64 v) #endif -void PrintHandler::value(const std::string& rValue) +void PrintHandler::value(const std::string& value) { arrayValue(); - Stringifier::formatString(rValue, _out); + Stringifier::formatString(value, _out); _objStart = false; } From 60f5d630b38b99e931f75a3189e3a51de53758b9 Mon Sep 17 00:00:00 2001 From: Guenter Obiltschnig Date: Tue, 6 Sep 2016 15:25:41 +0200 Subject: [PATCH 27/31] fixed a unused warning --- Foundation/src/Process.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Foundation/src/Process.cpp b/Foundation/src/Process.cpp index 845611166..d3e7a5d5a 100644 --- a/Foundation/src/Process.cpp +++ b/Foundation/src/Process.cpp @@ -47,6 +47,7 @@ namespace return envbuf; } +#if defined(POCO_OS_FAMILY_VMS) void setEnvironmentVariables(const Poco::Process::Env& env) { for (Poco::Process::Env::const_iterator it = env.begin(); it != env.end(); ++it) @@ -54,6 +55,7 @@ namespace Poco::Environment::set(it->first, it->second); } } +#endif } From d074e5e6eab72d2b2728e01a9b30d6d6f29d137f Mon Sep 17 00:00:00 2001 From: Guenter Obiltschnig Date: Tue, 6 Sep 2016 16:30:59 +0200 Subject: [PATCH 28/31] fixed warnings with GCC on Linux --- Net/src/Socket.cpp | 6 ++++-- Net/src/SocketImpl.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Net/src/Socket.cpp b/Net/src/Socket.cpp index 5f1726418..0d4758c39 100644 --- a/Net/src/Socket.cpp +++ b/Net/src/Socket.cpp @@ -148,7 +148,8 @@ int Socket::select(SocketList& readList, SocketList& writeList, SocketList& exce if (epollfd < 0) { char buf[1024]; - strerror_r(errno, buf, sizeof(buf)); + int rc = strerror_r(errno, buf, sizeof(buf)); + poco_assert (rc == 0); SocketImpl::error(std::string("Can't create epoll queue: ") + buf); } @@ -160,8 +161,9 @@ int Socket::select(SocketList& readList, SocketList& writeList, SocketList& exce if (epoll_ctl(epollfd, EPOLL_CTL_ADD, sockfd, e) < 0) { char buf[1024]; - strerror_r(errno, buf, sizeof(buf)); + int rc = strerror_r(errno, buf, sizeof(buf)); ::close(epollfd); + poco_assert (rc == 0); SocketImpl::error(std::string("Can't insert socket to epoll queue: ") + buf); } } diff --git a/Net/src/SocketImpl.cpp b/Net/src/SocketImpl.cpp index 40bda76a2..e74a767b9 100644 --- a/Net/src/SocketImpl.cpp +++ b/Net/src/SocketImpl.cpp @@ -429,7 +429,8 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) if (epollfd < 0) { char buf[1024]; - strerror_r(errno, buf, sizeof(buf)); + int rc = strerror_r(errno, buf, sizeof(buf)); + poco_assert (rc == 0); error(std::string("Can't create epoll queue: ") + buf); } @@ -446,8 +447,9 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) if (epoll_ctl(epollfd, EPOLL_CTL_ADD, sockfd, &evin) < 0) { char buf[1024]; - strerror_r(errno, buf, sizeof(buf)); + int rc = strerror_r(errno, buf, sizeof(buf)); ::close(epollfd); + poco_assert (rc == 0); error(std::string("Can't insert socket to epoll queue: ") + buf); } From c0906ab5aa3afd69c921c1e737a68c8a3770a51f Mon Sep 17 00:00:00 2001 From: CREMARENCO Cosmin Date: Tue, 6 Sep 2016 17:18:25 +0200 Subject: [PATCH 29/31] Fix failing testStartsWith: startsWith/endsWith will dereference invalid string iterator when the prefix/suffix is longer than the actual length of the string --- Foundation/include/Poco/String.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Foundation/include/Poco/String.h b/Foundation/include/Poco/String.h index f1d379f6f..da12d1c04 100644 --- a/Foundation/include/Poco/String.h +++ b/Foundation/include/Poco/String.h @@ -627,7 +627,7 @@ template bool startsWith(const S& str, const S& prefix) /// Tests whether the string starts with the given prefix. { - return equal(prefix.begin(), prefix.end(), str.begin()); + return str.size() >= prefix.size() && equal(prefix.begin(), prefix.end(), str.begin()); } @@ -635,7 +635,7 @@ template bool endsWith(const S& str, const S& suffix) /// Tests whether the string ends with the given suffix. { - return equal(suffix.rbegin(), suffix.rend(), str.rbegin()); + return str.size() >= suffix.size() && equal(suffix.rbegin(), suffix.rend(), str.rbegin()); } From 28ff1f2530ea9f808b0dbc8bd6eaec70d19de6ae Mon Sep 17 00:00:00 2001 From: Guenter Obiltschnig Date: Thu, 8 Sep 2016 09:36:28 +0200 Subject: [PATCH 30/31] fixed strerror_r issue --- Net/src/Socket.cpp | 6 ++---- Net/src/SocketImpl.cpp | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Net/src/Socket.cpp b/Net/src/Socket.cpp index 0d4758c39..935308d81 100644 --- a/Net/src/Socket.cpp +++ b/Net/src/Socket.cpp @@ -148,8 +148,7 @@ int Socket::select(SocketList& readList, SocketList& writeList, SocketList& exce if (epollfd < 0) { char buf[1024]; - int rc = strerror_r(errno, buf, sizeof(buf)); - poco_assert (rc == 0); + (void) strerror_r(errno, buf, sizeof(buf)); SocketImpl::error(std::string("Can't create epoll queue: ") + buf); } @@ -161,9 +160,8 @@ int Socket::select(SocketList& readList, SocketList& writeList, SocketList& exce if (epoll_ctl(epollfd, EPOLL_CTL_ADD, sockfd, e) < 0) { char buf[1024]; - int rc = strerror_r(errno, buf, sizeof(buf)); + (void) strerror_r(errno, buf, sizeof(buf)); ::close(epollfd); - poco_assert (rc == 0); SocketImpl::error(std::string("Can't insert socket to epoll queue: ") + buf); } } diff --git a/Net/src/SocketImpl.cpp b/Net/src/SocketImpl.cpp index e74a767b9..4d0bbe422 100644 --- a/Net/src/SocketImpl.cpp +++ b/Net/src/SocketImpl.cpp @@ -429,8 +429,7 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) if (epollfd < 0) { char buf[1024]; - int rc = strerror_r(errno, buf, sizeof(buf)); - poco_assert (rc == 0); + (void) strerror_r(errno, buf, sizeof(buf)); error(std::string("Can't create epoll queue: ") + buf); } @@ -447,9 +446,8 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) if (epoll_ctl(epollfd, EPOLL_CTL_ADD, sockfd, &evin) < 0) { char buf[1024]; - int rc = strerror_r(errno, buf, sizeof(buf)); + (void) strerror_r(errno, buf, sizeof(buf)); ::close(epollfd); - poco_assert (rc == 0); error(std::string("Can't insert socket to epoll queue: ") + buf); } From 20c7392c21d73ad8a167e863782944e313966928 Mon Sep 17 00:00:00 2001 From: Guenter Obiltschnig Date: Thu, 8 Sep 2016 10:10:39 +0200 Subject: [PATCH 31/31] giving up on strerror_r --- Net/src/Socket.cpp | 8 ++------ Net/src/SocketImpl.cpp | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Net/src/Socket.cpp b/Net/src/Socket.cpp index 935308d81..0dd1c8851 100644 --- a/Net/src/Socket.cpp +++ b/Net/src/Socket.cpp @@ -147,9 +147,7 @@ int Socket::select(SocketList& readList, SocketList& writeList, SocketList& exce epollfd = epoll_create(epollSize); if (epollfd < 0) { - char buf[1024]; - (void) strerror_r(errno, buf, sizeof(buf)); - SocketImpl::error(std::string("Can't create epoll queue: ") + buf); + SocketImpl::error("Can't create epoll queue"); } for (struct epoll_event* e = eventsIn; e != eventLast; ++e) @@ -159,10 +157,8 @@ int Socket::select(SocketList& readList, SocketList& writeList, SocketList& exce { if (epoll_ctl(epollfd, EPOLL_CTL_ADD, sockfd, e) < 0) { - char buf[1024]; - (void) strerror_r(errno, buf, sizeof(buf)); ::close(epollfd); - SocketImpl::error(std::string("Can't insert socket to epoll queue: ") + buf); + SocketImpl::error("Can't insert socket to epoll queue: "); } } } diff --git a/Net/src/SocketImpl.cpp b/Net/src/SocketImpl.cpp index 4d0bbe422..1357b3501 100644 --- a/Net/src/SocketImpl.cpp +++ b/Net/src/SocketImpl.cpp @@ -428,9 +428,7 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) int epollfd = epoll_create(1); if (epollfd < 0) { - char buf[1024]; - (void) strerror_r(errno, buf, sizeof(buf)); - error(std::string("Can't create epoll queue: ") + buf); + error("Can't create epoll queue"); } struct epoll_event evin; @@ -445,10 +443,8 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) if (epoll_ctl(epollfd, EPOLL_CTL_ADD, sockfd, &evin) < 0) { - char buf[1024]; - (void) strerror_r(errno, buf, sizeof(buf)); ::close(epollfd); - error(std::string("Can't insert socket to epoll queue: ") + buf); + error("Can't insert socket to epoll queue"); } Poco::Timespan remainingTime(timeout);