mirror of
https://github.com/openharmony/third_party_ejdb.git
synced 2026-07-01 04:52:25 -04:00
update from v2.0.59 to v2.72
Signed-off-by: zhouhaifeng <kutcher.zhou@huawei.com>
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
[*]
|
||||
charset=utf-8
|
||||
end_of_line=lf
|
||||
insert_final_newline=false
|
||||
indent_style=space
|
||||
indent_size=2
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
|
||||
[*.{c,cpp,cc,h,hpp}]
|
||||
insert_final_newline=true
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
cd ./build/src/jql/tests
|
||||
file ./jql_test1
|
||||
#set args --ssl
|
||||
|
||||
set confirm off
|
||||
set follow-fork-mode parent
|
||||
set detach-on-fork on
|
||||
set print elements 4096
|
||||
|
||||
define lb
|
||||
set breakpoint pending on
|
||||
source ~/.breakpoints
|
||||
set breakpoint pending auto
|
||||
echo breakpoints loaded\n
|
||||
end
|
||||
|
||||
define sb
|
||||
save breakpoints ~/.breakpoints
|
||||
echo breakpoints saved\n
|
||||
end
|
||||
|
||||
|
||||
+194
@@ -0,0 +1,194 @@
|
||||
/hints.txt
|
||||
/t.*
|
||||
|
||||
.DS_Store
|
||||
.codelite/
|
||||
.cache/
|
||||
node_modules/
|
||||
build-xcode/
|
||||
install-xcode/
|
||||
.cmaketools.json
|
||||
*.tags
|
||||
*.dll
|
||||
build/
|
||||
build_*/
|
||||
cmake-build*
|
||||
.cmake_dirty
|
||||
Makefile
|
||||
Testing/
|
||||
compile_commands.json
|
||||
*.dat
|
||||
*.db
|
||||
*-wal
|
||||
|
||||
jniLibs/
|
||||
|
||||
.vscode/ipch/
|
||||
|
||||
### JetBrains template
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# CMake
|
||||
cmake-build-debug/
|
||||
cmake-build-release/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
|
||||
# Created by https://www.gitignore.io/api/dart
|
||||
# Edit at https://www.gitignore.io/?templates=dart
|
||||
|
||||
### Dart ###
|
||||
# See https://www.dartlang.org/guides/libraries/private-files
|
||||
|
||||
# Files and directories created by pub
|
||||
.dart_tool/
|
||||
.packages
|
||||
build/
|
||||
# If you're building an application, you may want to check-in your pubspec.lock
|
||||
pubspec.lock
|
||||
|
||||
# Directory created by dartdoc
|
||||
# If you don't generate documentation locally you can remove this line.
|
||||
doc/api/
|
||||
|
||||
# Avoid committing generated Javascript files:
|
||||
*.dart.js
|
||||
*.info.json # Produced by the --dump-info flag.
|
||||
*.js # When generated by dart2js. Don't specify *.js if your
|
||||
# project includes source files written in JavaScript.
|
||||
*.js_
|
||||
*.js.deps
|
||||
*.js.map
|
||||
|
||||
# End of https://www.gitignore.io/api/dart
|
||||
|
||||
# Created by https://www.gitignore.io/api/maven
|
||||
# Edit at https://www.gitignore.io/?templates=maven
|
||||
|
||||
### Maven ###
|
||||
target/
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn/timing.properties
|
||||
.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
# End of https://www.gitignore.io/api/maven
|
||||
|
||||
# Created by https://www.gitignore.io/api/java
|
||||
# Edit at https://www.gitignore.io/?templates=java
|
||||
|
||||
### Java ###
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
# End of https://www.gitignore.io/api/java
|
||||
|
||||
# Created by https://www.gitignore.io/api/code-java
|
||||
# Edit at https://www.gitignore.io/?templates=code-java
|
||||
|
||||
### Code-Java ###
|
||||
# Language Support for Java(TM) by Red Hat extension for Visual Studio Code - https://marketplace.visualstudio.com/items?itemName=redhat.java
|
||||
|
||||
.project
|
||||
.classpath
|
||||
**/.settings/*
|
||||
!**/.settings/org.eclipse.jdt.core.prefs
|
||||
factoryConfiguration.json
|
||||
|
||||
# End of https://www.gitignore.io/api/code-java
|
||||
|
||||
# Created by https://www.gitignore.io/api/gradle
|
||||
# Edit at https://www.gitignore.io/?templates=gradle
|
||||
|
||||
### Gradle ###
|
||||
.gradle
|
||||
build/
|
||||
|
||||
# Ignore Gradle GUI config
|
||||
gradle-app.setting
|
||||
|
||||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||
!gradle-wrapper.jar
|
||||
|
||||
# Cache of project
|
||||
.gradletasknamecache
|
||||
|
||||
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
|
||||
# gradle/wrapper/gradle-wrapper.properties
|
||||
|
||||
### Gradle Patch ###
|
||||
**/build/
|
||||
|
||||
# End of https://www.gitignore.io/api/gradle
|
||||
@@ -0,0 +1,9 @@
|
||||
[submodule "src/bindings/ejdb2_swift/EJDB2Swift"]
|
||||
path = src/bindings/ejdb2_swift/EJDB2Swift
|
||||
url = https://github.com/Softmotions/EJDB2Swift.git
|
||||
[submodule "extra/iowow"]
|
||||
path = extra/iowow
|
||||
url = https://github.com/Softmotions/iowow
|
||||
[submodule "extra/iwnet"]
|
||||
path = extra/iwnet
|
||||
url = https://github.com/Softmotions/iwnet
|
||||
@@ -0,0 +1,30 @@
|
||||
" Local vim rc
|
||||
|
||||
if exists('g:build_dir')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:build_type = get(g:, 'build_type', 'Debug')
|
||||
let g:build_tests = get(g:, 'build_tests', 'ON')
|
||||
let g:cc = get(g:, 'cc', 'clang')
|
||||
let g:cxx = get(g:, 'cxx', 'clang++')
|
||||
|
||||
let g:root_dir = g:localvimrc_script_dir_unresolved
|
||||
let $ROOT_DIR = g:root_dir
|
||||
let $UNCRUSTIFY_CONFIG = g:root_dir.'/uncrustify.cfg'
|
||||
|
||||
let g:build_dir = g:root_dir.'/build'
|
||||
let &g:makeprg = 'cd '.g:build_dir.' && make -j1'
|
||||
|
||||
packadd termdebug
|
||||
let g:termdebug_wide=1
|
||||
|
||||
nnoremap <leader>c :call asyncrun#run('',
|
||||
\ {'mode':'terminal','cwd':g:build_dir,'save':2},
|
||||
\ 'cmake .. -DCMAKE_BUILD_TYPE='.g:build_type.' -DBUILD_TESTS='.g:build_tests
|
||||
\ .' -DCMAKE_CXX_COMPILER='.g:cxx.' -DCMAKE_C_COMPILER='.g:cc
|
||||
\ .' -DCMAKE_EXPORT_COMPILE_COMMANDS=ON'
|
||||
\ .' -DBUILD_JNI_BINDING=ON'
|
||||
\ .' -DBUILD_NODEJS_BINDING=ON'
|
||||
\ .' -DBUILD_DART_BINDING=OFF')
|
||||
\<CR>
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[](https://tlg.name/ejdb2)
|
||||
[](https://github.com/Softmotions/ejdb/blob/master/LICENSE)
|
||||

|
||||

|
||||
|
||||
EJDB2 is an embeddable JSON database engine published under MIT license.
|
||||
|
||||
@@ -19,14 +19,14 @@ EJDB2 is an embeddable JSON database engine published under MIT license.
|
||||
* [rfc6901](https://tools.ietf.org/html/rfc6901) JSON Path
|
||||
* [Support of collection joins](#jql-collection-joins)
|
||||
* Powered by [iowow.io](http://iowow.io) - The persistent key/value storage engine
|
||||
* Provides HTTP REST/Websockets network endpoints with help of [facil.io](http://facil.io)
|
||||
* HTTP REST/Websockets endpoints powered by [IWNET](https://github.com/Softmotions/iwnet) and [BearSSL](https://github.com/Softmotions/BearSSL).
|
||||
* JSON documents are stored in using fast and compact [binn](https://github.com/liteserver/binn) binary format
|
||||
|
||||
---
|
||||
* [Native language bindings](#native-language-bindings)
|
||||
* Supported platforms
|
||||
* [OSX](#osx)
|
||||
* [iOS](https://github.com/Softmotions/EJDB2Swift)
|
||||
* [macOS](#osx)
|
||||
* [iOS](https://github.com/Softmotions/EJDB2Swift) (outdated)
|
||||
* [Linux](#linux)
|
||||
* [Android](#android)
|
||||
* [Windows](#windows)
|
||||
@@ -64,7 +64,6 @@ EJDB2 is an embeddable JSON database engine published under MIT license.
|
||||
<br> `[3]` Can be build, but needed a linkage with windows node/dart `libs`.
|
||||
<br> `[4]` Porting in progress [#273](https://github.com/Softmotions/ejdb/issues/273)
|
||||
|
||||
|
||||
## Native language bindings
|
||||
|
||||
* [NodeJS](https://www.npmjs.com/package/ejdb2_node)
|
||||
@@ -77,6 +76,8 @@ EJDB2 is an embeddable JSON database engine published under MIT license.
|
||||
|
||||
### Unofficial EJDB2 language bindings
|
||||
|
||||
* Rust
|
||||
* https://crates.io/crates/ejdb2
|
||||
* .Net
|
||||
* https://github.com/kmvi/ejdb2-csharp
|
||||
* Haskell
|
||||
@@ -90,14 +91,15 @@ EJDB2 is an embeddable JSON database engine published under MIT license.
|
||||
## Status
|
||||
|
||||
* **EJDB 2.0 core engine is well tested and used in various heavily loaded deployments**
|
||||
* Tested on `Linux` and `OSX` platforms. [Limited Windows support](./WINDOWS.md)
|
||||
* Tested on `Linux`, `macOS` and `FreeBSD`. [Has limited Windows support](./WINDOWS.md)
|
||||
* Old EJDB 1.x version can be found in separate [ejdb_1.x](https://github.com/Softmotions/ejdb/tree/ejdb_1.x) branch.
|
||||
We are not maintaining ejdb 1.x.
|
||||
|
||||
## Use cases
|
||||
|
||||
* Softmotions trading robots platform
|
||||
* [Gimme - a social toy tokens exchange mobile application.](https://play.google.com/store/apps/details?id=com.softmotions.gimme) EJDB2 is used both on mobile and server sides.
|
||||
* Wirow video conferencing platform https://wirow.io
|
||||
* Softmotions trading robots
|
||||
* [Gimme - social toy tokens exchange mobile application.](https://play.google.com/store/apps/details?id=com.softmotions.gimme) EJDB2 is used both on mobile and server sides.
|
||||
|
||||
Are you using EJDB? [Let me know!](mailto:info@softmotions.com)
|
||||
|
||||
@@ -105,7 +107,8 @@ Are you using EJDB? [Let me know!](mailto:info@softmotions.com)
|
||||
|
||||
EJDB2 code ported and tested on `High Sierra` / `Mojave` / `Catalina`
|
||||
|
||||
See also [EJDB2 Swift binding](https://github.com/Softmotions/EJDB2Swift) for OSX, iOS and Linux
|
||||
[EJDB2 Swift binding](https://github.com/Softmotions/EJDB2Swift) for MacOS, iOS and Linux.
|
||||
Swift binding is outdated at now. Looking for contributors.
|
||||
|
||||
```
|
||||
brew install ejdb
|
||||
@@ -131,7 +134,7 @@ sudo apt-get install ejdb2
|
||||
|
||||
#### Building debian packages
|
||||
|
||||
cmake v3.15 or higher required
|
||||
cmake v3.10 or higher required
|
||||
|
||||
```sh
|
||||
mkdir build && cd build
|
||||
@@ -149,8 +152,7 @@ make package
|
||||
## Windows
|
||||
EJDB2 can be cross-compiled for windows
|
||||
|
||||
**Note:** HTTP/Websocket network API is disabled and not supported
|
||||
on Windows until port of http://facil.io library (#257)
|
||||
**Note:** HTTP/Websocket network API is disabled and not yet supported
|
||||
|
||||
Nodejs/Dart bindings not yet ported to Windows.
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ action("copy_iowow_header") {
|
||||
"$target_gen_dir/ejdb2/iowow/iwp.h",
|
||||
"$target_gen_dir/ejdb2/iowow/iwpool.h",
|
||||
"$target_gen_dir/ejdb2/iowow/iwrdb.h",
|
||||
"$target_gen_dir/ejdb2/iowow/iwre.h",
|
||||
"$target_gen_dir/ejdb2/iowow/iwsha2.h",
|
||||
"$target_gen_dir/ejdb2/iowow/iwstree.h",
|
||||
"$target_gen_dir/ejdb2/iowow/iwstw.h",
|
||||
@@ -78,6 +79,7 @@ config("ejdb_config") {
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wfatal-errors",
|
||||
"-Wno-gnu-statement-expression",
|
||||
"-Wno-implicit-fallthrough",
|
||||
"-Wno-missing-braces",
|
||||
"-Wno-missing-field-initializers",
|
||||
@@ -95,8 +97,6 @@ config("ejdb_config") {
|
||||
defines = [
|
||||
"IW_64",
|
||||
"IW_API_EXPORTS",
|
||||
|
||||
#"JB_HAVE_QSORT_R",
|
||||
"JB_PTHREADS",
|
||||
"_DEFAULT_SOURCE",
|
||||
"_FILE_OFFSET_BITS=64",
|
||||
@@ -125,7 +125,6 @@ ohos_shared_library("ejdb") {
|
||||
"src/jbl/jbl_json.c",
|
||||
"src/jql/jql.c",
|
||||
"src/jql/jqp.c",
|
||||
"src/util/lwre.c",
|
||||
"src/util/utf8proc.c",
|
||||
]
|
||||
|
||||
@@ -158,7 +157,6 @@ ohos_static_library("ejdb_static_lib_for_tdd") {
|
||||
"src/jbl/jbl_json.c",
|
||||
"src/jql/jql.c",
|
||||
"src/jql/jqp.c",
|
||||
"src/util/lwre.c",
|
||||
"src/util/utf8proc.c",
|
||||
]
|
||||
|
||||
|
||||
+9
-25
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
|
||||
@@ -15,10 +15,8 @@ project(${PROJECT_NAME} C)
|
||||
set(PROJECT_VENDOR "Softmotions (https://softmotions.com)")
|
||||
set(PROJECT_WEBSITE "http://ejdb.org")
|
||||
set(PROJECT_MAINTAINER "Anton Adamansky <adamansky@gmail.com>")
|
||||
set(PROJECT_DESCRIPTION_SUMMARY
|
||||
"Embeddable JSON database engine with network support (EJDB2).")
|
||||
set(PROJECT_DESCRIPTION
|
||||
"Embeddable JSON database engine with network support (EJDB2).")
|
||||
set(PROJECT_DESCRIPTION_SUMMARY "Embeddable JSON database engine (EJDB2).")
|
||||
set(PROJECT_DESCRIPTION "Embeddable JSON database engine (EJDB2).")
|
||||
set(CHANGELOG_MESSAGE ${CHANGELOG_LAST_MESSAGE})
|
||||
set(PROJECT_PPA "ppa:adamansky/ejdb2")
|
||||
set(PROJECT_PPA_USER "adamansky")
|
||||
@@ -28,12 +26,11 @@ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
|
||||
set(PROJECT_VERSION_MAJOR ${CHANGELOG_LAST_VERSION_MAJOR})
|
||||
set(PROJECT_VERSION_MINOR ${CHANGELOG_LAST_VERSION_MINOR})
|
||||
set(PROJECT_VERSION_PATCH ${CHANGELOG_LAST_VERSION_PATCH})
|
||||
set(PROJECT_VERSION
|
||||
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||
set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
|
||||
set(${PROJECT_NAME}_VERSION ${PROJECT_VERSION})
|
||||
set(${PROJECT_NAME}_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
|
||||
set(${PROJECT_NAME}_VERSION_MINOR ${PROJECT_VERSION_MINOR})
|
||||
set(${PROJECT_NAME}_VERSION_PATCH ${PROJECT_VERSION_PATCH})
|
||||
set(${PROJECT_NAME}_VERSION_PATCH 0)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
||||
option(ENABLE_HTTP "Enable HTTP endpoint and standalone server (jbs)" ON)
|
||||
@@ -60,7 +57,7 @@ set(PPA_DEBIAN_VERSION
|
||||
CACHE STRING "PPA version suffix for debian packages")
|
||||
|
||||
set(PROJECT_PPA_DISTRIB_TARGET
|
||||
"focal;bionic;xenial"
|
||||
"focal"
|
||||
CACHE STRING "Ubuntu PPA distribution names")
|
||||
|
||||
set(ANDROID_ABIS
|
||||
@@ -128,13 +125,7 @@ if(PACKAGE_RPM)
|
||||
list(APPEND CPACK_GENERATORS "RPM")
|
||||
endif()
|
||||
|
||||
if(NOT
|
||||
(CPACK_GENERATORS
|
||||
AND (BUILD_JNI_BINDING
|
||||
OR BUILD_DART_BINDING
|
||||
OR BUILD_NODEJS_BINDING)))
|
||||
set(DO_INSTALL_CORE ON)
|
||||
endif()
|
||||
set(DO_INSTALL_CORE ON)
|
||||
|
||||
add_subdirectory(man)
|
||||
|
||||
@@ -154,27 +145,20 @@ if(CPACK_GENERATORS)
|
||||
"/mxe/"
|
||||
"/build/"
|
||||
"/target/"
|
||||
"/tools/"
|
||||
"/docker/"
|
||||
"/benchmark/"
|
||||
"/node_modules/"
|
||||
"/cmake-.*/"
|
||||
"/Makefile$"
|
||||
"hints\\\\.txt$"
|
||||
"/\\\\.clang/"
|
||||
"/\\\\.codelite/"
|
||||
"/\\\\.cache/"
|
||||
"/\\\\.git/"
|
||||
"/\\\\.idea/"
|
||||
"/\\\\.settings/"
|
||||
"/\\\\.vscode/"
|
||||
"\\\\.classpath$"
|
||||
"\\\\.editorconfig$"
|
||||
"\\\\.iml$"
|
||||
"\\\\.ipr$"
|
||||
"\\\\.log$"
|
||||
"\\\\.mk$"
|
||||
"\\\\.project$"
|
||||
"\\\\.workspace$"
|
||||
"\\\\.astylerc$"
|
||||
"uncrustify\\\\.cfg")
|
||||
set(PROJECT_ARCH "${CMAKE_SYSTEM_PROCESSOR}")
|
||||
add_subdirectory(installer)
|
||||
|
||||
@@ -1,3 +1,56 @@
|
||||
ejdb2 (2.72) testing; urgency=medium
|
||||
|
||||
* Upgraded to the stable verion of iwnet lib.
|
||||
|
||||
-- Anton Adamansky <adamansky@gmail.com> Wed, 23 Feb 2022 17:00:23 +0700
|
||||
|
||||
ejdb2 (2.71) testing; urgency=medium
|
||||
|
||||
* Fixed wrong format of printf like function calls.
|
||||
* Query placeholders with the same name can be specified multiply times.
|
||||
* Query placeholders API is supported in projections.
|
||||
* Removed potential memory leaks in `jql_set_xx` query API (jql.h)
|
||||
* Added BearSSL include files as part of ejdb2 distribution
|
||||
|
||||
-- Anton Adamansky <adamansky@gmail.com> Fri, 18 Feb 2022 21:57:08 +0700
|
||||
|
||||
ejdb2 (2.70) testing; urgency=medium
|
||||
|
||||
* Network API is now powered by IWNET https://github.com/Softmotions/iwnet
|
||||
* Correct handling of `vsnprintf` return value. (jbl.c)
|
||||
* Moved `lwre` regexp library into `iowow` project.
|
||||
* Java: Added JSON.clone() method.
|
||||
* Java: Added JSON ObjectBuilder.move() method.
|
||||
|
||||
-- Anton Adamansky <adamansky@gmail.com> Mon, 14 Feb 2022 18:18:10 +0700
|
||||
|
||||
ejdb2 (2.62) testing; urgency=medium
|
||||
|
||||
* Fixed incorrect query results on array values (#331)
|
||||
* Fixed error in parsing FP JSON value (#333)
|
||||
* Java: com.softmotions.ejdb2.JSON.ValueType.getTypeOf set to be public
|
||||
* Flutter: Fixed #305
|
||||
* Java: com.softmotions.ejdb2.JSON typo fixed
|
||||
* Java: com.softmotions.ejdb2.JSON added Comparable support
|
||||
* Java: com.softmotions.ejdb2.JSON added better JSON.equals() implementation
|
||||
|
||||
-- Anton Adamansky <adamansky@gmail.com> Tue, 26 Oct 2021 19:34:01 +0700
|
||||
|
||||
ejdb2 (2.61) testing; urgency=medium
|
||||
|
||||
* Fixed incorrect arguments check in `jbn_merge_patch`
|
||||
|
||||
-- Anton Adamansky <adamansky@gmail.com> Tue, 22 Jun 2021 10:51:46 +0700
|
||||
|
||||
ejdb2 (2.0.60) testing; urgency=medium
|
||||
|
||||
* Upgraded to iowow v1.4.11
|
||||
* Fixed Macos build error (#313)
|
||||
* Added typescript generic to JBDOC in node binding (#311)
|
||||
* Removed -fvisibility=hidden compiler flag from facil.io lib
|
||||
|
||||
-- Anton Adamansky <adamansky@gmail.com> Mon, 10 May 2021 16:50:12 +0700
|
||||
|
||||
ejdb2 (2.0.59) testing; urgency=medium
|
||||
|
||||
* Fixed some uninitialized data issues with `jbl_clone()`
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
SOFTWARE.
|
||||
|
||||
@@ -64,6 +64,7 @@ Note:If the text contains special characters, please escape them according to th
|
||||
<filefilter name="defaultFilter" desc="Files not to check">
|
||||
</filefilter>
|
||||
<filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
|
||||
<filteritem type="filepath" name="Changelog" desc="the header of the file is not license" />
|
||||
<filteritem type="filepath" name="release.sh" desc="the header of the file is not license" />
|
||||
<filteritem type="filepath" name="src/bindings/ejdb2_flutter/ios/ejdb2_flutter.podspec" desc="the header of the file is not license" />
|
||||
</filefilter>
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
"Name": "EJDB2",
|
||||
"License": "MIT License",
|
||||
"License File": "LICENSE",
|
||||
"Version Number": "v2.0.59",
|
||||
"Version Number": "v2.72",
|
||||
"Owner": "kutcher.zhou@huawei.com",
|
||||
"Upstream URL": "https://github.com/Softmotions/ejdb",
|
||||
"Description": "An embeddable JSON database engine"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[](https://tlg.name/ejdb2)
|
||||
[](https://github.com/Softmotions/ejdb/blob/master/LICENSE)
|
||||

|
||||

|
||||
|
||||
EJDB2 is an embeddable JSON database engine published under MIT license.
|
||||
|
||||
@@ -19,14 +19,14 @@ EJDB2 is an embeddable JSON database engine published under MIT license.
|
||||
* [rfc6901](https://tools.ietf.org/html/rfc6901) JSON Path
|
||||
* [Support of collection joins](#jql-collection-joins)
|
||||
* Powered by [iowow.io](http://iowow.io) - The persistent key/value storage engine
|
||||
* Provides HTTP REST/Websockets network endpoints with help of [facil.io](http://facil.io)
|
||||
* HTTP REST/Websockets endpoints powered by [IWNET](https://github.com/Softmotions/iwnet) and [BearSSL](https://github.com/Softmotions/BearSSL).
|
||||
* JSON documents are stored in using fast and compact [binn](https://github.com/liteserver/binn) binary format
|
||||
|
||||
---
|
||||
* [Native language bindings](#native-language-bindings)
|
||||
* Supported platforms
|
||||
* [OSX](#osx)
|
||||
* [iOS](https://github.com/Softmotions/EJDB2Swift)
|
||||
* [macOS](#osx)
|
||||
* [iOS](https://github.com/Softmotions/EJDB2Swift) (outdated)
|
||||
* [Linux](#linux)
|
||||
* [Android](#android)
|
||||
* [Windows](#windows)
|
||||
@@ -64,7 +64,6 @@ EJDB2 is an embeddable JSON database engine published under MIT license.
|
||||
<br> `[3]` Can be build, but needed a linkage with windows node/dart `libs`.
|
||||
<br> `[4]` Porting in progress [#273](https://github.com/Softmotions/ejdb/issues/273)
|
||||
|
||||
|
||||
## Native language bindings
|
||||
|
||||
* [NodeJS](https://www.npmjs.com/package/ejdb2_node)
|
||||
@@ -77,6 +76,8 @@ EJDB2 is an embeddable JSON database engine published under MIT license.
|
||||
|
||||
### Unofficial EJDB2 language bindings
|
||||
|
||||
* Rust
|
||||
* https://crates.io/crates/ejdb2
|
||||
* .Net
|
||||
* https://github.com/kmvi/ejdb2-csharp
|
||||
* Haskell
|
||||
@@ -90,14 +91,15 @@ EJDB2 is an embeddable JSON database engine published under MIT license.
|
||||
## Status
|
||||
|
||||
* **EJDB 2.0 core engine is well tested and used in various heavily loaded deployments**
|
||||
* Tested on `Linux` and `OSX` platforms. [Limited Windows support](./WINDOWS.md)
|
||||
* Tested on `Linux`, `macOS` and `FreeBSD`. [Has limited Windows support](./WINDOWS.md)
|
||||
* Old EJDB 1.x version can be found in separate [ejdb_1.x](https://github.com/Softmotions/ejdb/tree/ejdb_1.x) branch.
|
||||
We are not maintaining ejdb 1.x.
|
||||
|
||||
## Use cases
|
||||
|
||||
* Softmotions trading robots platform
|
||||
* [Gimme - a social toy tokens exchange mobile application.](https://play.google.com/store/apps/details?id=com.softmotions.gimme) EJDB2 is used both on mobile and server sides.
|
||||
* Wirow video conferencing platform https://wirow.io
|
||||
* Softmotions trading robots
|
||||
* [Gimme - social toy tokens exchange mobile application.](https://play.google.com/store/apps/details?id=com.softmotions.gimme) EJDB2 is used both on mobile and server sides.
|
||||
|
||||
Are you using EJDB? [Let me know!](mailto:info@softmotions.com)
|
||||
|
||||
@@ -105,7 +107,8 @@ Are you using EJDB? [Let me know!](mailto:info@softmotions.com)
|
||||
|
||||
EJDB2 code ported and tested on `High Sierra` / `Mojave` / `Catalina`
|
||||
|
||||
See also [EJDB2 Swift binding](https://github.com/Softmotions/EJDB2Swift) for OSX, iOS and Linux
|
||||
[EJDB2 Swift binding](https://github.com/Softmotions/EJDB2Swift) for MacOS, iOS and Linux.
|
||||
Swift binding is outdated at now. Looking for contributors.
|
||||
|
||||
```
|
||||
brew install ejdb
|
||||
@@ -131,7 +134,7 @@ sudo apt-get install ejdb2
|
||||
|
||||
#### Building debian packages
|
||||
|
||||
cmake v3.15 or higher required
|
||||
cmake v3.10 or higher required
|
||||
|
||||
```sh
|
||||
mkdir build && cd build
|
||||
@@ -149,8 +152,7 @@ make package
|
||||
## Windows
|
||||
EJDB2 can be cross-compiled for windows
|
||||
|
||||
**Note:** HTTP/Websocket network API is disabled and not supported
|
||||
on Windows until port of http://facil.io library (#257)
|
||||
**Note:** HTTP/Websocket network API is disabled and not yet supported
|
||||
|
||||
Nodejs/Dart bindings not yet ported to Windows.
|
||||
|
||||
@@ -614,6 +616,8 @@ PROJECTIONS = PROJECTION [ {'+' | '-'} PROJECTION ]
|
||||
|
||||
Projection allows to get only subset of JSON document excluding not needed data.
|
||||
|
||||
**Query placeholders API is supported in projections.**
|
||||
|
||||
Lets add one more document to our collection:
|
||||
|
||||
```sh
|
||||
@@ -903,45 +907,45 @@ modifier to the query to get rid of unnecessary data transferring and json data
|
||||
# HTTP REST/Websocket API endpoint
|
||||
|
||||
EJDB engine provides the ability to start a separate HTTP/Websocket endpoint worker exposing network API for quering and data modifications.
|
||||
SSL (TLS 1.2) is supported by `jbs` server.
|
||||
|
||||
The easiest way to expose database over the network is using the standalone `jbs` server. (Of course if you plan to avoid `C API` integration).
|
||||
The easiest way to expose database over the network is use the standalone `jbs` server. (Of course if you want to avoid `C API` integration).
|
||||
|
||||
## jbs server
|
||||
|
||||
```
|
||||
jbs -h
|
||||
Usage:
|
||||
|
||||
EJDB 2.0.0 standalone REST/Websocket server. http://ejdb.org
|
||||
./jbs [options]
|
||||
|
||||
--file <> Database file path. Default: db.jb
|
||||
-f <> (same as --file)
|
||||
--port ## HTTP port number listen to. Default: 9191
|
||||
-p ## (same as --port)
|
||||
--bind <> Address server listen. Default: localhost
|
||||
-b <> (same as --bind)
|
||||
--access <> Server access token matched to 'X-Access-Token' HTTP header value
|
||||
-a <> (same as --access)
|
||||
--trunc Cleanup existing database file on open
|
||||
-t (same as --trunc)
|
||||
--wal Use write ahead logging (WAL). Must be set for data durability.
|
||||
-w (same as --wal)
|
||||
-v, --version Print program version.
|
||||
-f, --file=<> Database file path. Default: ejdb2.db
|
||||
-p, --port=NUM HTTP server port numer. Default: 9191
|
||||
-l, --listen=<> Network address server will listen. Default: localhost
|
||||
-k, --key=<> PEM private key file for TLS 1.2 HTTP server.
|
||||
-c, --certs=<> PEM certificates file for TLS 1.2 HTTP server.
|
||||
-a, --access=TOKEN|@FILE Access token to match 'X-Access-Token' HTTP header value.
|
||||
-r, --access-read Allows unrestricted read-only data access.
|
||||
-C, --cors Enable COSR response headers for HTTP server
|
||||
-t, --trunc Cleanup/reset database file on open.
|
||||
-w, --wal use the write ahead log (WAL). Used to provide data durability.
|
||||
|
||||
Advanced options
|
||||
--sbz ## Max sorting buffer size. If exceeded, an overflow temp file for data will be created. Default: 16777216, min: 1048576
|
||||
--dsz ## Initial size of buffer to process/store document on queries. Preferable average size of document. Default: 65536, min: 16384
|
||||
--bsz ## Max HTTP/WS API document body size. Default: 67108864, min: 524288
|
||||
Advanced options:
|
||||
-S, --sbz=NUM Max sorting buffer size. If exceeded, an overflow temp file for data will be created.
|
||||
Default: 16777216, min: 1048576
|
||||
-D, --dsz=NUM Initial size of buffer to process/store document on queries. Preferable average size of document.
|
||||
Default: 65536, min: 16384
|
||||
-T, --trylock Exit with error if database is locked by another process.
|
||||
If not set, current process will wait for lock release.
|
||||
|
||||
Use any of the following input formats:
|
||||
-arg <value> -arg=<value> -arg<value>
|
||||
|
||||
Use the -h, -help or -? to get this information again.
|
||||
```
|
||||
|
||||
## HTTP API
|
||||
|
||||
Access to HTTP endpoint can be protected by a token specified with `--access`
|
||||
command flag or by C API `EJDB_HTTP` options. If access token specified on server, client must provide `X-Access-Token` HTTP header value. If token is required and not provided by client the `401` HTTP code will be reported. If access token is not matched to the token provided the `403` HTTP code will be returned.
|
||||
For any other errors server will respond with `500` error code.
|
||||
HTTP endpoint may be protected by a token specified with `--access` flag or C API `EJDB_HTTP` struct.
|
||||
If access token was set, client should provide `X-Access-Token` HTTP header.
|
||||
If token is required but not provided by client `401` HTTP code will be reported.
|
||||
If access token is not matched to the token provided by client server will respond with `403` HTTP code.
|
||||
|
||||
## REST API
|
||||
|
||||
@@ -956,7 +960,7 @@ Replaces/store document under specific numeric `id`
|
||||
### DELETE /{collection}/{id}
|
||||
Removes document identified by `id` from a `collection`
|
||||
* `200` on success. Empty body
|
||||
* `404` if document not found
|
||||
* `404` document not found
|
||||
|
||||
### PATCH /{collection}/{id}
|
||||
Patch a document identified by `id` by [rfc7396](https://tools.ietf.org/html/rfc7396),
|
||||
@@ -968,7 +972,7 @@ Retrieve document identified by `id` from a `collection`.
|
||||
* `200` on success. Body: JSON document text.
|
||||
* `content-type:application/json`
|
||||
* `content-length:`
|
||||
* `404` if document not found
|
||||
* `404` document not found
|
||||
|
||||
### POST /
|
||||
Query a collection by provided query as POST body.
|
||||
@@ -1322,7 +1326,7 @@ gcc -o example1 example1.o -lejdb2
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -1341,5 +1345,6 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
```
|
||||
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
# Windows cross compilation
|
||||
|
||||
**Note:** HTTP/Websocket network API is disabled and not supported
|
||||
on Windows until porting of http://facil.io library
|
||||
**Note:** HTTP/Websocket network API is disabled and not yet supported.
|
||||
|
||||
Nodejs/Dart bindings not yet ported to Windows.
|
||||
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
include(ExternalProject)
|
||||
|
||||
if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||
set(_UPDATE_DISCONNECTED 0)
|
||||
else()
|
||||
set(_UPDATE_DISCONNECTED 1)
|
||||
endif()
|
||||
|
||||
set(FACIL_SOURCE_DIR "${CMAKE_BINARY_DIR}/src/extern_facil")
|
||||
set(FACIL_BINARY_DIR "${CMAKE_BINARY_DIR}/src/extern_facil")
|
||||
set(FACIL_INCLUDE_DIR "${FACIL_BINARY_DIR}/lib/facil")
|
||||
set(FACIL_LIBRARY_DIR "${FACIL_BINARY_DIR}")
|
||||
|
||||
if("${FACIL_URL}" STREQUAL "")
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/facil.zip)
|
||||
set(FACIL_URL ${CMAKE_SOURCE_DIR}/facil.zip)
|
||||
else()
|
||||
set(FACIL_URL https://github.com/Softmotions/facil.io/archive/master.zip)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message("FACIL_URL: ${FACIL_URL}")
|
||||
|
||||
set(CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DCMAKE_C_FLAGS=-fPIC -fvisibility=hidden)
|
||||
|
||||
foreach(extra
|
||||
CMAKE_C_COMPILER
|
||||
CMAKE_TOOLCHAIN_FILE
|
||||
ANDROID_PLATFORM
|
||||
ANDROID_ABI
|
||||
TEST_TOOL_CMD
|
||||
PLATFORM
|
||||
ENABLE_BITCODE
|
||||
ENABLE_ARC
|
||||
ENABLE_VISIBILITY
|
||||
ENABLE_STRICT_TRY_COMPILE
|
||||
ARCHS)
|
||||
if(DEFINED ${extra})
|
||||
list(APPEND CMAKE_ARGS "-D${extra}=${${extra}}")
|
||||
endif()
|
||||
endforeach()
|
||||
message("FACIL CMAKE_ARGS: ${CMAKE_ARGS}")
|
||||
|
||||
ExternalProject_Add(
|
||||
extern_facil
|
||||
URL ${FACIL_URL}
|
||||
DOWNLOAD_NAME facil.zip
|
||||
TIMEOUT 360
|
||||
# Remove in-source makefile to avoid clashing
|
||||
PATCH_COMMAND rm -f ./makefile
|
||||
PREFIX ${CMAKE_BINARY_DIR}
|
||||
BUILD_IN_SOURCE ON
|
||||
GIT_PROGRESS ON
|
||||
UPDATE_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
UPDATE_DISCONNECTED ${_UPDATE_DISCONNECTED}
|
||||
LOG_DOWNLOAD OFF
|
||||
LOG_UPDATE OFF
|
||||
LOG_BUILD OFF
|
||||
LOG_CONFIGURE OFF
|
||||
LOG_INSTALL OFF
|
||||
CMAKE_ARGS ${CMAKE_ARGS}
|
||||
BUILD_BYPRODUCTS "${FACIL_LIBRARY_DIR}/libfacil.io.a"
|
||||
)
|
||||
|
||||
add_library(facil_s STATIC IMPORTED GLOBAL)
|
||||
set_target_properties(
|
||||
facil_s
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${FACIL_LIBRARY_DIR}/libfacil.io.a"
|
||||
)
|
||||
add_dependencies(facil_s extern_facil)
|
||||
|
||||
if (DO_INSTALL_CORE)
|
||||
install(FILES "${FACIL_LIBRARY_DIR}/libfacil.io.a"
|
||||
RENAME "libfacilio-1.a"
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
||||
list(APPEND PROJECT_LLIBRARIES facil_s)
|
||||
list(APPEND PROJECT_INCLUDE_DIRS "${FACIL_INCLUDE_DIR}"
|
||||
"${FACIL_INCLUDE_DIR}/fiobj"
|
||||
"${FACIL_INCLUDE_DIR}/http"
|
||||
"${FACIL_INCLUDE_DIR}/cli"
|
||||
"${FACIL_INCLUDE_DIR}/tls")
|
||||
@@ -1,52 +1,64 @@
|
||||
include(ExternalProject)
|
||||
|
||||
if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||
set(_UPDATE_DISCONNECTED 0)
|
||||
else()
|
||||
set(_UPDATE_DISCONNECTED 1)
|
||||
endif()
|
||||
|
||||
set(IOWOW_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include")
|
||||
set(IOWOW_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/${PROJECT_NAME}")
|
||||
file(MAKE_DIRECTORY ${IOWOW_INCLUDE_DIR})
|
||||
|
||||
if("${IOWOW_URL}" STREQUAL "")
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/iowow.zip)
|
||||
set(IOWOW_URL ${CMAKE_SOURCE_DIR}/iowow.zip)
|
||||
else()
|
||||
set(IOWOW_URL https://github.com/Softmotions/iowow/archive/master.zip)
|
||||
set(IOWOW_URL ${CMAKE_SOURCE_DIR}/extra/iowow)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message("IOWOW_URL: ${IOWOW_URL}")
|
||||
|
||||
if (IOS)
|
||||
if(APPLE)
|
||||
set(BYPRODUCT "${CMAKE_BINARY_DIR}/lib/libiowow-1.a")
|
||||
else()
|
||||
set(BYPRODUCT "${CMAKE_BINARY_DIR}/src/extern_iowow-build/src/libiowow-1.a")
|
||||
endif()
|
||||
|
||||
set(CMAKE_ARGS -DOWNER_PROJECT_NAME=${PROJECT_NAME}
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}
|
||||
-DASAN=${ASAN}
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-DBUILD_EXAMPLES=OFF)
|
||||
set(CMAKE_ARGS
|
||||
-DOWNER_PROJECT_NAME=${PROJECT_NAME} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DASAN=${ASAN}
|
||||
-DBUILD_SHARED_LIBS=OFF -DBUILD_EXAMPLES=OFF)
|
||||
|
||||
foreach(extra
|
||||
CMAKE_C_COMPILER
|
||||
CMAKE_TOOLCHAIN_FILE
|
||||
ANDROID_PLATFORM
|
||||
ANDROID_ABI
|
||||
TEST_TOOL_CMD
|
||||
PLATFORM
|
||||
ENABLE_BITCODE
|
||||
ENABLE_ARC
|
||||
ENABLE_VISIBILITY
|
||||
ENABLE_STRICT_TRY_COMPILE
|
||||
ARCHS)
|
||||
# In order to properly pass owner project CMAKE variables than contains
|
||||
# semicolons, we used a specific separator for 'ExternalProject_Add', using the
|
||||
# LIST_SEPARATOR parameter. This allows building fat binaries on macOS, etc.
|
||||
# (ie: -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64") Otherwise, semicolons get
|
||||
# replaced with spaces and CMake isn't aware of a multi-arch setup.
|
||||
set(SSUB "^^")
|
||||
|
||||
foreach(
|
||||
extra
|
||||
CMAKE_OSX_ARCHITECTURES
|
||||
CMAKE_C_COMPILER
|
||||
CMAKE_TOOLCHAIN_FILE
|
||||
ANDROID_PLATFORM
|
||||
ANDROID_ABI
|
||||
TEST_TOOL_CMD
|
||||
PLATFORM
|
||||
ENABLE_BITCODE
|
||||
ENABLE_ARC
|
||||
ENABLE_VISIBILITY
|
||||
ENABLE_STRICT_TRY_COMPILE
|
||||
ARCHS)
|
||||
if(DEFINED ${extra})
|
||||
list(APPEND CMAKE_ARGS "-D${extra}=${${extra}}")
|
||||
# Replace occurences of ";" with our custom separator and append to
|
||||
# CMAKE_ARGS
|
||||
string(REPLACE ";" "${SSUB}" extra_sub "${${extra}}")
|
||||
list(APPEND CMAKE_ARGS "-D${extra}=${extra_sub}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
message("IOWOW CMAKE_ARGS: ${CMAKE_ARGS}")
|
||||
|
||||
ExternalProject_Add(
|
||||
@@ -58,27 +70,24 @@ ExternalProject_Add(
|
||||
BUILD_IN_SOURCE OFF
|
||||
UPDATE_COMMAND ""
|
||||
UPDATE_DISCONNECTED ${_UPDATE_DISCONNECTED}
|
||||
LOG_DOWNLOAD OFF
|
||||
LOG_UPDATE OFF
|
||||
LOG_BUILD OFF
|
||||
LOG_CONFIGURE OFF
|
||||
LOG_INSTALL OFF
|
||||
LIST_SEPARATOR "${SSUB}"
|
||||
CMAKE_ARGS ${CMAKE_ARGS}
|
||||
BUILD_BYPRODUCTS ${BYPRODUCT}
|
||||
)
|
||||
BUILD_BYPRODUCTS ${BYPRODUCT})
|
||||
|
||||
add_library(iowow_s STATIC IMPORTED GLOBAL)
|
||||
set_target_properties(
|
||||
iowow_s
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION ${BYPRODUCT}
|
||||
)
|
||||
add_dependencies(iowow_s extern_iowow)
|
||||
|
||||
if (DO_INSTALL_CORE)
|
||||
install(FILES "${BYPRODUCT}"
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
if(DO_INSTALL_CORE)
|
||||
install(FILES "${BYPRODUCT}" DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
||||
list(APPEND PROJECT_LLIBRARIES iowow_s m)
|
||||
list(APPEND PROJECT_INCLUDE_DIRS "${IOWOW_INCLUDE_DIR}")
|
||||
add_library(IOWOW::static STATIC IMPORTED GLOBAL)
|
||||
set_target_properties(
|
||||
IOWOW::static
|
||||
PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION ${BYPRODUCT})
|
||||
|
||||
add_dependencies(IOWOW::static extern_iowow)
|
||||
|
||||
list(PREPEND PROJECT_LLIBRARIES m)
|
||||
list(PREPEND PROJECT_LLIBRARIES IOWOW::static)
|
||||
list(APPEND PROJECT_INCLUDE_DIRS ${IOWOW_INCLUDE_DIR})
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
include(ExternalProject)
|
||||
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||
set(_UPDATE_DISCONNECTED 0)
|
||||
else()
|
||||
set(_UPDATE_DISCONNECTED 1)
|
||||
endif()
|
||||
|
||||
set(IWNET_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/${PROJECT_NAME}")
|
||||
file(MAKE_DIRECTORY ${IWNET_INCLUDE_DIR})
|
||||
|
||||
if("${IWNET_URL}" STREQUAL "")
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/iwnet.zip)
|
||||
set(IWNET_URL ${CMAKE_SOURCE_DIR}/iwnet.zip)
|
||||
else()
|
||||
set(IWNET_URL ${CMAKE_SOURCE_DIR}/extra/iwnet)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message("IWNET_URL: ${IWNET_URL}")
|
||||
|
||||
if(APPLE)
|
||||
set(BYPRODUCT "${CMAKE_BINARY_DIR}/lib/libiwnet-1.a")
|
||||
else()
|
||||
set(BYPRODUCT "${CMAKE_BINARY_DIR}/src/extern_iwnet-build/src/libiwnet-1.a")
|
||||
endif()
|
||||
|
||||
# In order to properly pass owner project CMAKE variables than contains
|
||||
# semicolons, we used a specific separator for 'ExternalProject_Add', using the
|
||||
# LIST_SEPARATOR parameter. This allows building fat binaries on macOS, etc.
|
||||
# (ie: -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64") Otherwise, semicolons get
|
||||
# replaced with spaces and CMake isn't aware of a multi-arch setup.
|
||||
set(SSUB "^^")
|
||||
|
||||
set(CMAKE_ARGS
|
||||
-DOWNER_PROJECT_NAME=${PROJECT_NAME} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DASAN=${ASAN}
|
||||
-DBUILD_SHARED_LIBS=OFF -DBUILD_EXAMPLES=OFF)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
foreach(
|
||||
extra
|
||||
CMAKE_FIND_ROOT_PATH
|
||||
CMAKE_OSX_ARCHITECTURES
|
||||
CMAKE_C_COMPILER
|
||||
CMAKE_TOOLCHAIN_FILE
|
||||
ANDROID_PLATFORM
|
||||
ANDROID_ABI
|
||||
TEST_TOOL_CMD
|
||||
PLATFORM
|
||||
ENABLE_BITCODE
|
||||
ENABLE_ARC
|
||||
ENABLE_VISIBILITY
|
||||
ENABLE_STRICT_TRY_COMPILE
|
||||
ARCHS)
|
||||
if(DEFINED ${extra})
|
||||
# Replace occurences of ";" with our custom separator and append to
|
||||
# CMAKE_ARGS
|
||||
string(REPLACE ";" "${SSUB}" extra_sub "${${extra}}")
|
||||
list(APPEND CMAKE_ARGS "-D${extra}=${extra_sub}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
message("IWNET CMAKE_ARGS: ${CMAKE_ARGS}")
|
||||
|
||||
ExternalProject_Add(
|
||||
extern_iwnet
|
||||
URL ${IWNET_URL}
|
||||
DOWNLOAD_NAME iwnet.zip
|
||||
TIMEOUT 360
|
||||
PREFIX ${CMAKE_BINARY_DIR}
|
||||
BUILD_IN_SOURCE OFF
|
||||
UPDATE_COMMAND ""
|
||||
UPDATE_DISCONNECTED ${_UPDATE_DISCONNECTED}
|
||||
LIST_SEPARATOR "${SSUB}"
|
||||
CMAKE_ARGS ${CMAKE_ARGS}
|
||||
BUILD_BYPRODUCTS ${BYPRODUCT})
|
||||
|
||||
if(DO_INSTALL_CORE)
|
||||
install(FILES "${BYPRODUCT}" DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
||||
add_library(IWNET::static STATIC IMPORTED GLOBAL)
|
||||
set_target_properties(
|
||||
IWNET::static PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION ${BYPRODUCT})
|
||||
|
||||
add_dependencies(IWNET::static IOWOW:static extern_iwnet)
|
||||
|
||||
list(PREPEND PROJECT_LLIBRARIES IWNET::static)
|
||||
list(APPEND PROJECT_INCLUDE_DIRS ${IWNET_INCLUDE_DIR})
|
||||
@@ -26,16 +26,21 @@ file(STRINGS "${DEB_CHANGELOG}" _DEBCHANGELOGN)
|
||||
foreach(CLINE IN LISTS _DEBCHANGELOGN)
|
||||
if (NOT CHANGELOG_LAST_VERSION)
|
||||
#ejdb (1.2.6) testing; urgency=low
|
||||
string(REGEX MATCH "^[A-Za-z0-9_].*[ \t]+\\((([0-9]+)\\.([0-9]+)\\.([0-9]+))\\)[ \t]+[A-Za-z]+;[ \t].*" _MATCHED "${CLINE}")
|
||||
#ejdb (1.2) testing; urgency=low
|
||||
string(REGEX MATCH "^[A-Za-z0-9_].*[ \t]+\\((([0-9]+)\\.([0-9]+)(\\.([0-9]+))?)\\)[ \t]+[A-Za-z]+;[ \t].*" _MATCHED "${CLINE}")
|
||||
if (_MATCHED)
|
||||
set(CHANGELOG_LAST_LINE "${_MATCHED}")
|
||||
set(CHANGELOG_LAST_VERSION "${CMAKE_MATCH_1}")
|
||||
set(CHANGELOG_LAST_VERSION_MAJOR "${CMAKE_MATCH_2}")
|
||||
set(CHANGELOG_LAST_VERSION_MINOR "${CMAKE_MATCH_3}")
|
||||
set(CHANGELOG_LAST_VERSION_PATCH "${CMAKE_MATCH_4}")
|
||||
set(CHANGELOG_LAST_VERSION_MINOR "${CMAKE_MATCH_3}")
|
||||
if (NOT CMAKE_MATCH5)
|
||||
set(CHANGELOG_LAST_VERSION_PATCH "0")
|
||||
else()
|
||||
set(CHANGELOG_LAST_VERSION_PATCH "${CMAKE_MATCH_5}")
|
||||
endif()
|
||||
endif()
|
||||
elseif(NOT CHANGELOG_LAST_MESSAGE)
|
||||
string(REGEX MATCH "^[A-Za-z0-9_].*[ \t]+\\((([0-9]+)\\.([0-9]+)\\.([0-9]+))\\)[ \t]+[A-Za-z]+;[ \t].*" _MATCHED "${CLINE}")
|
||||
string(REGEX MATCH "^[A-Za-z0-9_].*[ \t]+\\((([0-9]+)\\.([0-9]+)(\\.([0-9]+))?)\\)[ \t]+[A-Za-z]+;[ \t].*" _MATCHED "${CLINE}")
|
||||
if (_MATCHED)
|
||||
string(STRIP "${_CDESC}" CHANGELOG_LAST_MESSAGE)
|
||||
return()
|
||||
|
||||
+72
-71
@@ -41,6 +41,8 @@ The following cache variables are also available to set or use:
|
||||
the include path to jni.h
|
||||
``JAVA_INCLUDE_PATH2``
|
||||
the include path to jni_md.h and jniport.h
|
||||
``JAVA_AWT_INCLUDE_PATH``
|
||||
the include path to jawt.h
|
||||
#]=======================================================================]
|
||||
|
||||
# Expand {libarch} occurrences to java_libarch subdirectory(-ies) and set ${_var}
|
||||
@@ -57,6 +59,8 @@ macro(java_append_library_directories _var)
|
||||
endif()
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
|
||||
set(_java_libarch "i386")
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
|
||||
set(_java_libarch "arm64" "aarch64")
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha")
|
||||
set(_java_libarch "alpha")
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
|
||||
@@ -115,7 +119,7 @@ macro(java_append_library_directories _var)
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
include(CMakeFindJavaCommon)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindJavaCommon.cmake)
|
||||
|
||||
# Save CMAKE_FIND_FRAMEWORK
|
||||
if(DEFINED CMAKE_FIND_FRAMEWORK)
|
||||
@@ -141,7 +145,7 @@ endif()
|
||||
|
||||
if (WIN32)
|
||||
set (_JNI_HINTS)
|
||||
execute_process(COMMAND REG QUERY HKLM\\SOFTWARE\\JavaSoft\\JDK /f "." /k
|
||||
execute_process(COMMAND REG QUERY HKLM\\SOFTWARE\\JavaSoft\\JDK
|
||||
RESULT_VARIABLE _JNI_RESULT
|
||||
OUTPUT_VARIABLE _JNI_VERSIONS
|
||||
ERROR_QUIET)
|
||||
@@ -172,8 +176,6 @@ if (WIN32)
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit;CurrentVersion]" NAME)
|
||||
|
||||
list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\11;JavaHome]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\10;JavaHome]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.9;JavaHome]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.8;JavaHome]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.7;JavaHome]/lib"
|
||||
@@ -185,46 +187,67 @@ if (WIN32)
|
||||
)
|
||||
endif()
|
||||
|
||||
JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
|
||||
/usr/lib/jvm/java/lib
|
||||
/usr/lib/java/jre/lib/{libarch}
|
||||
/usr/lib/jvm/jre/lib/{libarch}
|
||||
/usr/local/lib/java/jre/lib/{libarch}
|
||||
/usr/local/share/java/jre/lib/{libarch}
|
||||
set(_JNI_JAVA_DIRECTORIES_BASE
|
||||
/usr/lib/jvm/java
|
||||
/usr/lib/java
|
||||
/usr/lib/jvm
|
||||
/usr/local/lib/java
|
||||
/usr/local/share/java
|
||||
/usr/lib/j2sdk1.4-sun
|
||||
/usr/lib/j2sdk1.5-sun
|
||||
/opt/sun-jdk-1.5.0.04
|
||||
/usr/lib/jvm/java-6-sun
|
||||
/usr/lib/jvm/java-1.5.0-sun
|
||||
/usr/lib/jvm/java-6-sun-1.6.0.00 # can this one be removed according to #8821 ? Alex
|
||||
/usr/lib/jvm/java-6-openjdk
|
||||
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0 # fedora
|
||||
# Debian specific paths for default JVM
|
||||
/usr/lib/jvm/default-java/jre/lib/{libarch}
|
||||
/usr/lib/jvm/default-java/jre/lib
|
||||
/usr/lib/jvm/default-java/lib
|
||||
/usr/lib/jvm/default-java
|
||||
# Arch Linux specific paths for default JVM
|
||||
/usr/lib/jvm/default/jre/lib/{libarch}
|
||||
/usr/lib/jvm/default/lib/{libarch}
|
||||
# SuSE specific paths for default JVM
|
||||
/usr/lib64/jvm/java/jre/lib/{libarch}
|
||||
/usr/lib64/jvm/jre/lib/{libarch}
|
||||
/usr/lib/jvm/java-11-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 18.04 LTS
|
||||
/usr/lib/jvm/java-11-oracle/lib/{libarch}
|
||||
/usr/lib/jvm/java-10-openjdk-{libarch}/jre/lib/{libarch}
|
||||
/usr/lib/jvm/java-10-oracle/lib/{libarch}
|
||||
/usr/lib/jvm/java-9-openjdk-{libarch}/jre/lib/{libarch}
|
||||
/usr/lib/jvm/java-9-oracle/lib/{libarch}
|
||||
/usr/lib/jvm/java-8-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10
|
||||
/usr/lib/jvm/java-8-oracle/lib/{libarch}
|
||||
/usr/lib/jvm/default
|
||||
# Ubuntu specific paths for default JVM
|
||||
/usr/lib/jvm/java-7-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10
|
||||
/usr/lib/jvm/java-7-oracle/lib/{libarch}
|
||||
/usr/lib/jvm/java-6-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10
|
||||
/usr/lib/jvm/java-6-oracle/lib/{libarch}
|
||||
/usr/lib/jvm/java-6-sun/jre/lib/{libarch}
|
||||
/usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/{libarch} # can this one be removed according to #8821 ? Alex
|
||||
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/{libarch} # fedora
|
||||
/usr/lib/jvm/java-6-openjdk/jre/lib/{libarch}
|
||||
/usr/lib/jvm/java-16-openjdk-{libarch}
|
||||
/usr/lib/jvm/java-11-openjdk-{libarch} # Ubuntu 18.04 LTS
|
||||
/usr/lib/jvm/java-8-openjdk-{libarch} # Ubuntu 15.10
|
||||
/usr/lib/jvm/java-7-openjdk-{libarch} # Ubuntu 15.10
|
||||
/usr/lib/jvm/java-6-openjdk-{libarch} # Ubuntu 15.10
|
||||
# OpenBSD specific paths for default JVM
|
||||
/usr/local/jdk-1.8.0/jre/lib/{libarch}
|
||||
/usr/local/jre-1.8.0/lib/{libarch}
|
||||
/usr/local/jdk-1.7.0/jre/lib/{libarch}
|
||||
/usr/local/jre-1.7.0/lib/{libarch}
|
||||
/usr/local/jdk-1.6.0/jre/lib/{libarch}
|
||||
/usr/local/jre-1.6.0/lib/{libarch}
|
||||
/usr/local/jdk-1.7.0
|
||||
/usr/local/jre-1.7.0
|
||||
/usr/local/jdk-1.6.0
|
||||
/usr/local/jre-1.6.0
|
||||
# FreeBSD specific paths for default JVM
|
||||
/usr/local/openjdk16
|
||||
/usr/local/openjdk15
|
||||
/usr/local/openjdk14
|
||||
/usr/local/openjdk13
|
||||
/usr/local/openjdk12
|
||||
/usr/local/openjdk11
|
||||
/usr/local/openjdk8
|
||||
/usr/local/openjdk7
|
||||
# SuSE specific paths for default JVM
|
||||
/usr/lib64/jvm/java
|
||||
/usr/lib64/jvm/jre
|
||||
)
|
||||
|
||||
set(_JNI_JAVA_AWT_LIBRARY_TRIES)
|
||||
set(_JNI_JAVA_INCLUDE_TRIES)
|
||||
|
||||
foreach(_java_dir IN LISTS _JNI_JAVA_DIRECTORIES_BASE)
|
||||
list(APPEND _JNI_JAVA_AWT_LIBRARY_TRIES
|
||||
${_java_dir}/jre/lib/{libarch}
|
||||
${_java_dir}/jre/lib
|
||||
${_java_dir}/lib/{libarch}
|
||||
${_java_dir}/lib
|
||||
${_java_dir}
|
||||
)
|
||||
list(APPEND _JNI_JAVA_INCLUDE_TRIES
|
||||
${_java_dir}/include
|
||||
)
|
||||
endforeach()
|
||||
|
||||
JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
|
||||
${_JNI_JAVA_AWT_LIBRARY_TRIES}
|
||||
)
|
||||
|
||||
set(JAVA_JVM_LIBRARY_DIRECTORIES)
|
||||
@@ -248,8 +271,6 @@ if (WIN32)
|
||||
list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES "${_JNI_HINT}/include")
|
||||
endforeach()
|
||||
list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\11;JavaHome]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\10;JavaHome]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.9;JavaHome]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.8;JavaHome]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.7;JavaHome]/include"
|
||||
@@ -262,34 +283,7 @@ if (WIN32)
|
||||
endif()
|
||||
|
||||
JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_INCLUDE_DIRECTORIES
|
||||
/usr/lib/java/include
|
||||
/usr/local/lib/java/include
|
||||
/usr/lib/jvm/java/include
|
||||
/usr/lib/jvm/java-11-openjdk-{libarch}/include
|
||||
/usr/lib/jvm/java-11-oracle/include
|
||||
/usr/lib/jvm/java-10-openjdk-{libarch}/include
|
||||
/usr/lib/jvm/java-10-oracle/include
|
||||
/usr/lib/jvm/java-9-openjdk-{libarch}/include
|
||||
/usr/lib/jvm/java-9-oracle/include
|
||||
/usr/lib/jvm/java-8-openjdk-{libarch}/include
|
||||
/usr/lib/jvm/java-8-oracle/include
|
||||
/usr/lib/jvm/java-7-openjdk-{libarch}/include
|
||||
/usr/lib/jvm/java-7-oracle/include
|
||||
/usr/lib/jvm/java-6-openjdk-{libarch}/include
|
||||
/usr/lib/jvm/java-6-openjdk/include
|
||||
/usr/lib/jvm/java-6-oracle/include
|
||||
/usr/lib/jvm/java-6-sun/include
|
||||
/usr/local/share/java/include
|
||||
# Debian specific path for default JVM
|
||||
/usr/lib/jvm/default-java/include
|
||||
# Arch specific path for default JVM
|
||||
/usr/lib/jvm/default/include
|
||||
# OpenBSD specific path for default JVM
|
||||
/usr/local/jdk-1.8.0/include
|
||||
/usr/local/jdk-1.7.0/include
|
||||
/usr/local/jdk-1.6.0/include
|
||||
# SuSE specific paths for default JVM
|
||||
/usr/lib64/jvm/java/include
|
||||
${_JNI_JAVA_INCLUDE_TRIES}
|
||||
)
|
||||
|
||||
foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}")
|
||||
@@ -374,6 +368,10 @@ find_path(JAVA_INCLUDE_PATH2 NAMES jni_md.h jniport.h
|
||||
${JAVA_INCLUDE_PATH}/aix
|
||||
)
|
||||
|
||||
find_path(JAVA_AWT_INCLUDE_PATH jawt.h
|
||||
${JAVA_INCLUDE_PATH}
|
||||
)
|
||||
|
||||
# Restore CMAKE_FIND_FRAMEWORK
|
||||
if(DEFINED _JNI_CMAKE_FIND_FRAMEWORK)
|
||||
set(CMAKE_FIND_FRAMEWORK ${_JNI_CMAKE_FIND_FRAMEWORK})
|
||||
@@ -386,11 +384,13 @@ include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JNI DEFAULT_MSG JAVA_AWT_LIBRARY
|
||||
JAVA_JVM_LIBRARY
|
||||
JAVA_INCLUDE_PATH
|
||||
JAVA_INCLUDE_PATH2)
|
||||
JAVA_INCLUDE_PATH2
|
||||
JAVA_AWT_INCLUDE_PATH)
|
||||
|
||||
mark_as_advanced(
|
||||
JAVA_AWT_LIBRARY
|
||||
JAVA_JVM_LIBRARY
|
||||
JAVA_AWT_INCLUDE_PATH
|
||||
JAVA_INCLUDE_PATH
|
||||
JAVA_INCLUDE_PATH2
|
||||
)
|
||||
@@ -403,4 +403,5 @@ set(JNI_LIBRARIES
|
||||
set(JNI_INCLUDE_DIRS
|
||||
${JAVA_INCLUDE_PATH}
|
||||
${JAVA_INCLUDE_PATH2}
|
||||
${JAVA_AWT_INCLUDE_PATH}
|
||||
)
|
||||
|
||||
@@ -13,6 +13,9 @@ to specify a Java installation prefix explicitly.
|
||||
|
||||
See also the :module:`FindJNI` module to find Java Native Interface (JNI).
|
||||
|
||||
.. versionadded:: 3.10
|
||||
Added support for Java 9+ version parsing.
|
||||
|
||||
Specify one or more of the following components as you call this find module. See example below.
|
||||
|
||||
::
|
||||
@@ -41,7 +44,9 @@ This module sets the following result variables:
|
||||
Java_VERSION_TWEAK = The tweak version of the package found (after '_')
|
||||
Java_VERSION = This is set to: $major[.$minor[.$patch[.$tweak]]]
|
||||
|
||||
|
||||
.. versionadded:: 3.4
|
||||
Added the ``Java_IDLJ_EXECUTABLE`` and ``Java_JARSIGNER_EXECUTABLE``
|
||||
variables.
|
||||
|
||||
The minimum required version of Java can be specified using the
|
||||
:command:`find_package` syntax, e.g.
|
||||
@@ -76,7 +81,7 @@ Example Usages:
|
||||
find_package(Java COMPONENTS Development)
|
||||
#]=======================================================================]
|
||||
|
||||
include(CMakeFindJavaCommon)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindJavaCommon.cmake)
|
||||
|
||||
# The HINTS option should only be used for values computed from the system.
|
||||
set(_JAVA_HINTS)
|
||||
@@ -85,7 +90,7 @@ if(_JAVA_HOME)
|
||||
endif()
|
||||
if (WIN32)
|
||||
macro (_JAVA_GET_INSTALLED_VERSIONS _KIND)
|
||||
execute_process(COMMAND REG QUERY HKLM\\SOFTWARE\\JavaSoft\\${_KIND}
|
||||
execute_process(COMMAND REG QUERY HKLM\\SOFTWARE\\JavaSoft\\${_KIND}
|
||||
RESULT_VARIABLE _JAVA_RESULT
|
||||
OUTPUT_VARIABLE _JAVA_VERSIONS
|
||||
ERROR_QUIET)
|
||||
|
||||
@@ -282,14 +282,11 @@ set(CPACK_SOURCE_IGNORE_FILES
|
||||
${CPACK_SOURCE_IGNORE_FILES}
|
||||
"/build.*/"
|
||||
"/Testing/"
|
||||
"/test/"
|
||||
"/tmp/"
|
||||
"/packaging/"
|
||||
"/debian/"
|
||||
"/node_modules/"
|
||||
"/\\\\.git.*"
|
||||
"/\\\\.idea/"
|
||||
"/\\\\.codelite/"
|
||||
"*~$")
|
||||
|
||||
#set(package_file_name "${CPACK_DEBIAN_PACKAGE_NAME}_${DEBIAN_PACKAGE_VERSION}")
|
||||
|
||||
@@ -27,13 +27,9 @@ def copy_file(src_dir, dst_dir):
|
||||
'fs/iwfile.h',
|
||||
'fs/iwfsmfile.h',
|
||||
'iowow.h',
|
||||
#'kv/iwal.h',
|
||||
'kv/iwkv.h',
|
||||
#'kv/iwkv_internal.h',
|
||||
#'kv/tests/iwkv_tests.h',
|
||||
'log/iwlog.h',
|
||||
'platform/iwp.h',
|
||||
#'platform/win32/mman/mman.h',
|
||||
'rdb/iwrdb.h',
|
||||
'tmpl/iwcfg.h',
|
||||
'utils/iwarr.h',
|
||||
@@ -41,6 +37,7 @@ def copy_file(src_dir, dst_dir):
|
||||
'utils/iwconv.h',
|
||||
'utils/iwhmap.h',
|
||||
'utils/iwpool.h',
|
||||
'utils/iwre.h',
|
||||
'utils/iwsha2.h',
|
||||
'utils/iwstree.h',
|
||||
'utils/iwstw.h',
|
||||
@@ -48,12 +45,7 @@ def copy_file(src_dir, dst_dir):
|
||||
'utils/iwutils.h',
|
||||
'utils/iwuuid.h',
|
||||
'utils/iwxstr.h',
|
||||
#'utils/kbtree.h',
|
||||
#'utils/khash.h',
|
||||
#'utils/ksort.h',
|
||||
#'utils/mt19937ar.h',
|
||||
'utils/murmur3.h',
|
||||
#'utils/pthread_spin_lock_shim.h'
|
||||
]
|
||||
for header in headers:
|
||||
src_file = os.path.join(src_dir, header)
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FROM alpine:3.9
|
||||
FROM alpine:latest
|
||||
|
||||
MAINTAINER Anton Adamansky <adamansky@gmail.com>
|
||||
|
||||
|
||||
@@ -33,15 +33,14 @@ if (PACKAGE_DEB)
|
||||
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${PROJECT_WEBSITE})
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION libs)
|
||||
set(CPACK_DEBIAN_PACKAGE_PRIORITY optional)
|
||||
#set(CPACK_DEBIAN_PACKAGE_DEPENDS zlib1g)
|
||||
set(CPACK_DEBIAN_PACKAGE_BUILD_DEPENDS pkg-config git devscripts dh-make)
|
||||
#set(CPACK_DEBIAN_PACKAGE_DEPENDS libcurl4)
|
||||
set(CPACK_DEBIAN_PACKAGE_BUILD_DEPENDS pkg-config git devscripts dh-make libcurl4-openssl-dev)
|
||||
if (NOT PPA_DEBIAN_VERSION)
|
||||
set(PPA_DEBIAN_VERSION ppa1)
|
||||
endif ()
|
||||
if (PROJECT_PPA)
|
||||
set(DPUT_HOST ${PROJECT_PPA})
|
||||
endif ()
|
||||
#set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "any")
|
||||
set(CPACK_DEBIAN_RESOURCE_FILE_CHANGELOG ${CMAKE_SOURCE_DIR}/Changelog)
|
||||
set(CPACK_DEBIAN_UPDATE_CHANGELOG ON)
|
||||
endif (PACKAGE_DEB)
|
||||
@@ -53,7 +52,6 @@ endif (PACKAGE_TGZ)
|
||||
include(CPack)
|
||||
|
||||
if (ENABLE_PPA)
|
||||
set(CPACK_SOURCE_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/../fetch_libs.cmake")
|
||||
if (NOT PROJECT_PPA_DISTRIB_TARGET)
|
||||
set(PROJECT_PPA_DISTRIB_TARGET focal)
|
||||
endif ()
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
message("DOWNLOAD https://github.com/Softmotions/facil.io/archive/master.zip")
|
||||
file(DOWNLOAD https://github.com/Softmotions/facil.io/archive/master.zip ${CMAKE_CURRENT_BINARY_DIR}/facil.zip)
|
||||
|
||||
message("DOWNLOAD https://github.com/Softmotions/iowow/archive/master.zip")
|
||||
file(DOWNLOAD https://github.com/Softmotions/iowow/archive/master.zip ${CMAKE_CURRENT_BINARY_DIR}/iowow.zip)
|
||||
@@ -44,7 +44,7 @@ if(PACKAGE_DEB)
|
||||
set(CPACK_DEBIAN_PACKAGE_PRIORITY optional)
|
||||
# set(CPACK_DEBIAN_PACKAGE_DEPENDS zlib1g)
|
||||
set(CPACK_DEBIAN_PACKAGE_BUILD_DEPENDS pkg-config git devscripts dh-make
|
||||
openjdk-8-jdk)
|
||||
openjdk-11-jdk libcurl4-openssl-dev)
|
||||
if(NOT PPA_DEBIAN_VERSION)
|
||||
set(PPA_DEBIAN_VERSION ppa1)
|
||||
endif()
|
||||
@@ -63,8 +63,6 @@ endif(PACKAGE_TGZ)
|
||||
include(CPack)
|
||||
|
||||
if(ENABLE_PPA)
|
||||
set(CPACK_SOURCE_INSTALL_SCRIPT
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../fetch_libs.cmake")
|
||||
if(NOT PROJECT_PPA_DISTRIB_TARGET)
|
||||
set(PROJECT_PPA_DISTRIB_TARGET focal)
|
||||
endif()
|
||||
|
||||
+526
-303
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,24 @@
|
||||
# See https://github.com/richfelker/musl-cross-make
|
||||
|
||||
if(NOT MUSL_HOME)
|
||||
set(MUSL_HOME $ENV{MUSL_HOME})
|
||||
endif()
|
||||
if(NOT MUSL_HOME)
|
||||
message(FATAL_ERROR "Please setup MUSL_HOME environment variable")
|
||||
endif()
|
||||
|
||||
set(MUSL_CFG x86_64-linux-musl)
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR x86_64)
|
||||
set(CROSS_HOST x86_64-unknown-linux)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH "${MUSL_HOME}/${MUSL_CFG};${FIND_ROOT};${CMAKE_BINARY_DIR}")
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
|
||||
set(CMAKE_C_COMPILER ${MUSL_HOME}/bin/${MUSL_CFG}-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${MUSL_HOME}/bin/${MUSL_CFG}-g++)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
|
||||
+51
-32
@@ -12,8 +12,9 @@ set(ALL_SRC)
|
||||
set(ALL_HDRS)
|
||||
set(PUB_HDRS)
|
||||
set(PROJECT_GENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated)
|
||||
|
||||
list(APPEND PROJECT_INCLUDE_DIRS "${PROJECT_GENERATED_DIR}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/include")
|
||||
|
||||
if(APPLE)
|
||||
option(BUILD_FRAMEWORK "Build an OS X framework" OFF)
|
||||
@@ -22,6 +23,12 @@ if(APPLE)
|
||||
CACHE STRING "Directory to install frameworks to.")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set(STRIP_CMD strip -x)
|
||||
else()
|
||||
set(STRIP_CMD ${CMAKE_STRIP} -s)
|
||||
endif()
|
||||
|
||||
include(CheckIncludeFile)
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckLibraryExists)
|
||||
@@ -33,7 +40,7 @@ if(ENABLE_HTTP)
|
||||
if(WIN32)
|
||||
message(FATAL_ERROR "ENABLE_HTTP option cannot be used in Windows build")
|
||||
endif()
|
||||
include(AddFacil)
|
||||
include(AddIWNET)
|
||||
add_definitions(-DJB_HTTP)
|
||||
list(APPEND MODULES jbr)
|
||||
endif()
|
||||
@@ -100,15 +107,11 @@ else()
|
||||
add_definitions(-D_POSIX_THREAD_SAFE_FUNCTIONS)
|
||||
endif()
|
||||
|
||||
foreach(HF IN ITEMS stdlib stddef stdint stdbool)
|
||||
string(TOUPPER "${HF}" UHF)
|
||||
check_include_file(${HF}.h "JB_HAVE_${UHF}")
|
||||
if(NOT JB_HAVE_${UHF})
|
||||
message(FATAL_ERROR "Include file '${HF}.h' not FOUND")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_definitions(-D_XOPEN_SOURCE=600)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
# Needed by Linux in order to use nftw() but fail to build on FreeBSD due to
|
||||
# __BSD_VISIBLE define state.
|
||||
add_definitions(-D_XOPEN_SOURCE=700)
|
||||
endif()
|
||||
add_definitions(-D_DEFAULT_SOURCE)
|
||||
add_definitions(-D_LARGEFILE_SOURCE)
|
||||
add_definitions(-D_FILE_OFFSET_BITS=64)
|
||||
@@ -128,19 +131,18 @@ foreach(MODULE IN LISTS MODULES)
|
||||
endforeach(MODULE)
|
||||
|
||||
list(
|
||||
APPEND
|
||||
PUB_HDRS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ejdb2.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/jbl/jbl.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/jbr/jbr.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/jql/jql.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/util/lwre.h)
|
||||
APPEND PUB_HDRS ${CMAKE_CURRENT_SOURCE_DIR}/ejdb2.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/jbl/jbl.h ${CMAKE_CURRENT_SOURCE_DIR}/jbr/jbr.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/jql/jql.h)
|
||||
|
||||
set(CMAKE_C_FLAGS
|
||||
"${CMAKE_C_FLAGS} -std=gnu11 -fsigned-char -pedantic -Wfatal-errors -Wall -Wextra \
|
||||
"${CMAKE_C_FLAGS} -std=gnu11 -fsigned-char -Wfatal-errors -Wall -Wextra \
|
||||
-Wno-sign-compare -Wno-unused-parameter -Wno-unknown-pragmas -Wno-unused-function \
|
||||
-Wno-missing-field-initializers -Wno-missing-braces \
|
||||
-Wno-shorten-64-to-32")
|
||||
-Wno-missing-field-initializers -Wno-missing-braces")
|
||||
|
||||
if(APPLE)
|
||||
set("${CMAKE_C_FLAGS} -Wno-shorten-64-to-32")
|
||||
endif()
|
||||
|
||||
if(NOT WIN32)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-implicit-fallthrough -fPIC")
|
||||
@@ -172,6 +174,11 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tmpl/ejdb2cfg.h
|
||||
file(GLOB PROJECT_GENERATED_HDRS ${PROJECT_GENERATED_DIR}/*.h)
|
||||
list(APPEND ALL_HDRS ${PROJECT_GENERATED_HDRS})
|
||||
|
||||
set(PCLIBS "-liowow -lm")
|
||||
if(DEFINED IWNET_INCLUDE_DIR)
|
||||
set(PCLIBS "-liwnet ${PCLIBS}")
|
||||
endif()
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tmpl/libejdb2.pc.in
|
||||
${PROJECT_GENERATED_DIR}/libejdb2.pc @ONLY)
|
||||
|
||||
@@ -254,9 +261,9 @@ else()
|
||||
add_library(ejdb2_s STATIC ${ALL_SRC})
|
||||
endif()
|
||||
|
||||
target_link_libraries(ejdb2 ${PROJECT_LLIBRARIES})
|
||||
target_link_libraries(ejdb2 PUBLIC ${PROJECT_LLIBRARIES})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_link_libraries(ejdb2_s ${PROJECT_LLIBRARIES})
|
||||
target_link_libraries(ejdb2_s PUBLIC ${PROJECT_LLIBRARIES})
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
@@ -273,8 +280,8 @@ if(BUILD_SHARED_LIBS)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libejdb2.exp
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
set_target_properties(
|
||||
ejdb2
|
||||
PROPERTIES VERSION ${PROJECT_VERSION}
|
||||
@@ -286,23 +293,27 @@ if(BUILD_SHARED_LIBS)
|
||||
add_custom_command(
|
||||
TARGET ejdb2
|
||||
POST_BUILD
|
||||
COMMAND strip -s $<TARGET_FILE:ejdb2>)
|
||||
COMMAND ${STRIP_CMD} $<TARGET_FILE:ejdb2>)
|
||||
endif()
|
||||
|
||||
set_target_properties(
|
||||
ejdb2_s PROPERTIES VERSION ${PROJECT_VERSION} COMPILE_FLAGS "-DIW_NODLL"
|
||||
OUTPUT_NAME ejdb2-${PROJECT_VERSION_MAJOR})
|
||||
ejdb2_s
|
||||
PROPERTIES VERSION ${PROJECT_VERSION}
|
||||
COMPILE_FLAGS "-DIW_STATIC"
|
||||
OUTPUT_NAME ejdb2-${PROJECT_VERSION_MAJOR})
|
||||
else()
|
||||
|
||||
set_target_properties(
|
||||
ejdb2
|
||||
PROPERTIES VERSION ${PROJECT_VERSION}
|
||||
PUBLIC_HEADER "${PUB_HDRS}"
|
||||
COMPILE_FLAGS "-DIW_NODLL"
|
||||
COMPILE_FLAGS "-DIW_STATIC"
|
||||
LINK_FLAGS_RELEASE "${LINK_FLAGS_RELEASE} -s"
|
||||
OUTPUT_NAME ejdb2-${PROJECT_VERSION_MAJOR})
|
||||
endif()
|
||||
|
||||
if(DO_INSTALL_CORE)
|
||||
include(InstallRequiredSystemLibraries)
|
||||
install(
|
||||
TARGETS ejdb2
|
||||
EXPORT ejdb2-exports
|
||||
@@ -329,13 +340,23 @@ if(BUILD_SHARED_LIBS AND DO_INSTALL_CORE)
|
||||
endif()
|
||||
|
||||
if(DO_INSTALL_CORE)
|
||||
# Install iowow headers included into ejdb2
|
||||
|
||||
if(DEFINED IWNET_INCLUDE_DIR)
|
||||
install(
|
||||
DIRECTORY ${IWNET_INCLUDE_DIR}/iwnet
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
|
||||
COMPONENT headers
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h")
|
||||
endif()
|
||||
|
||||
install(
|
||||
DIRECTORY ${IOWOW_INCLUDE_DIR}/${PROJECT_NAME}/iowow
|
||||
DIRECTORY ${IOWOW_INCLUDE_DIR}/iowow
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
|
||||
COMPONENT headers
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h")
|
||||
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE ${CMAKE_SOURCE_DIR}/Changelog
|
||||
DESTINATION ${CMAKE_INSTALL_DOCDIR})
|
||||
install(
|
||||
@@ -350,8 +371,6 @@ if(DO_INSTALL_CORE)
|
||||
|
||||
endif()
|
||||
|
||||
include(InstallRequiredSystemLibraries)
|
||||
|
||||
set(${PROJECT_NAME}_PUB_HDRS
|
||||
${PUB_HDRS}
|
||||
CACHE INTERNAL "${PROJECT_NAME}: Public headers" FORCE)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
ejdb_dart (@EJDB2_DART_VERSION@)
|
||||
|
||||
- Upgraded to Dart v2.12.x (null safety and native bindings API)
|
||||
- Used new versioning scheme: {EJDB_VERSION}{BINDING_VERSION_NUMBER}
|
||||
- Upgraded to ejdb2 v@PROJECT_VERSION@
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/version.txt _VERSION)
|
||||
set_property(GLOBAL PROPERTY EJDB2_DART_VERSION_PROPERTY
|
||||
"${PROJECT_VERSION}${_VERSION}")
|
||||
set(EJDB2_DART_VERSION "${PROJECT_VERSION}${_VERSION}")
|
||||
"${PROJECT_VERSION}.${_VERSION}")
|
||||
set(EJDB2_DART_VERSION "${PROJECT_VERSION}.${_VERSION}")
|
||||
|
||||
add_library(ejdb2_dart SHARED lib/ejdb2_dart.c)
|
||||
target_link_libraries(ejdb2_dart ejdb2_s ${PROJECT_LLIBRARIES})
|
||||
@@ -43,7 +43,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
add_custom_command(
|
||||
TARGET ejdb2_dart
|
||||
POST_BUILD
|
||||
COMMAND strip -s $<TARGET_FILE:ejdb2_dart>)
|
||||
COMMAND ${STRIP_CMD} $<TARGET_FILE:ejdb2_dart>)
|
||||
endif()
|
||||
|
||||
set_target_properties(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
SOFTWARE.
|
||||
|
||||
@@ -6,10 +6,10 @@ issue_tracker: https://github.com/Softmotions/ejdb/issues?q=is%3Aissue+label%3AD
|
||||
license: MIT
|
||||
|
||||
environment:
|
||||
sdk: ">=2.12.0-0 <3.0.0"
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
json_at: ^2.0.0-nullsafety.1
|
||||
path: ^1.8.0-nullsafety.3
|
||||
quiver: ^3.0.0-nullsafety.2
|
||||
test: ^1.16.0-nullsafety.13
|
||||
json_at: ^2.1.0
|
||||
path: ^1.8.0
|
||||
quiver: ^3.0.1
|
||||
test: ^1.17.8
|
||||
|
||||
@@ -1 +1 @@
|
||||
1-nullsafety.1
|
||||
4
|
||||
@@ -1,5 +1,5 @@
|
||||
## @EJDB2_FLUTTER_VERSION@
|
||||
|
||||
- Used new versioning scheme: {EJDB_VERSION}{BINDING_VERSION_NUMBER}
|
||||
- Opted out null safety mode
|
||||
- Fixed java.util.concurrent.RejectedExecutionException #305
|
||||
- Upgraded to ejdb2 v@PROJECT_VERSION@
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/version.txt _VERSION)
|
||||
set_property(GLOBAL PROPERTY EJDB2_FLUTTER_VERSION_PROPERTY
|
||||
"${PROJECT_VERSION}${_VERSION}")
|
||||
set(EJDB2_FLUTTER_VERSION "${PROJECT_VERSION}${_VERSION}")
|
||||
"${PROJECT_VERSION}.${_VERSION}")
|
||||
set(EJDB2_FLUTTER_VERSION "${PROJECT_VERSION}.${_VERSION}")
|
||||
|
||||
|
||||
file(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
+50
-50
@@ -5,7 +5,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.SynchronousQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
@@ -38,7 +38,7 @@ public final class Ejdb2FlutterPlugin implements MethodCallHandler, StreamHandle
|
||||
static final Map<String, DbMethod> methods = new ConcurrentHashMap<>();
|
||||
|
||||
static final Executor executor = new ThreadPoolExecutor(0, 5, 60L, TimeUnit.SECONDS,
|
||||
new SynchronousQueue<Runnable>());
|
||||
new LinkedBlockingQueue<Runnable>());
|
||||
|
||||
static {
|
||||
methods.put("executeFirst", thread(Ejdb2FlutterPlugin::executeFirst));
|
||||
@@ -199,12 +199,12 @@ public final class Ejdb2FlutterPlugin implements MethodCallHandler, StreamHandle
|
||||
for (Map.Entry<String, Object> entry : qspec.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
switch (key) {
|
||||
case "l": // limit
|
||||
q.setLimit(asLong(entry.getValue(), 0));
|
||||
break;
|
||||
case "s": // skip
|
||||
q.setSkip(asLong(entry.getValue(), 0));
|
||||
break;
|
||||
case "l": // limit
|
||||
q.setLimit(asLong(entry.getValue(), 0));
|
||||
break;
|
||||
case "s": // skip
|
||||
q.setSkip(asLong(entry.getValue(), 0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (List<Object> pslot : params) {
|
||||
@@ -219,48 +219,48 @@ public final class Ejdb2FlutterPlugin implements MethodCallHandler, StreamHandle
|
||||
}
|
||||
} else {
|
||||
switch (type) {
|
||||
case 1: // String
|
||||
if (plh instanceof Number) {
|
||||
q.setString(((Number) plh).intValue(), asString(val, null));
|
||||
} else {
|
||||
q.setString((String) plh, asString(val, null));
|
||||
}
|
||||
break;
|
||||
case 2: // Long
|
||||
if (plh instanceof Number) {
|
||||
q.setLong(((Number) plh).intValue(), asLong(val, 0));
|
||||
} else {
|
||||
q.setLong((String) plh, asLong(val, 0));
|
||||
}
|
||||
break;
|
||||
case 3: // Double
|
||||
if (plh instanceof Number) {
|
||||
q.setDouble(((Number) plh).intValue(), asDouble(val, 0));
|
||||
} else {
|
||||
q.setDouble((String) plh, asDouble(val, 0));
|
||||
}
|
||||
break;
|
||||
case 4: // Boolean
|
||||
if (plh instanceof Number) {
|
||||
q.setBoolean(((Number) plh).intValue(), asBoolean(val, false));
|
||||
} else {
|
||||
q.setBoolean((String) plh, asBoolean(val, false));
|
||||
}
|
||||
break;
|
||||
case 5: // Regexp
|
||||
if (plh instanceof Number) {
|
||||
q.setRegexp(((Number) plh).intValue(), asString(val, null));
|
||||
} else {
|
||||
q.setRegexp((String) plh, asString(val, null));
|
||||
}
|
||||
break;
|
||||
case 6: // JSON
|
||||
if (plh instanceof Number) {
|
||||
q.setJSON(((Number) plh).intValue(), asString(val, null));
|
||||
} else {
|
||||
q.setJSON((String) plh, asString(val, null));
|
||||
}
|
||||
break;
|
||||
case 1: // String
|
||||
if (plh instanceof Number) {
|
||||
q.setString(((Number) plh).intValue(), asString(val, null));
|
||||
} else {
|
||||
q.setString((String) plh, asString(val, null));
|
||||
}
|
||||
break;
|
||||
case 2: // Long
|
||||
if (plh instanceof Number) {
|
||||
q.setLong(((Number) plh).intValue(), asLong(val, 0));
|
||||
} else {
|
||||
q.setLong((String) plh, asLong(val, 0));
|
||||
}
|
||||
break;
|
||||
case 3: // Double
|
||||
if (plh instanceof Number) {
|
||||
q.setDouble(((Number) plh).intValue(), asDouble(val, 0));
|
||||
} else {
|
||||
q.setDouble((String) plh, asDouble(val, 0));
|
||||
}
|
||||
break;
|
||||
case 4: // Boolean
|
||||
if (plh instanceof Number) {
|
||||
q.setBoolean(((Number) plh).intValue(), asBoolean(val, false));
|
||||
} else {
|
||||
q.setBoolean((String) plh, asBoolean(val, false));
|
||||
}
|
||||
break;
|
||||
case 5: // Regexp
|
||||
if (plh instanceof Number) {
|
||||
q.setRegexp(((Number) plh).intValue(), asString(val, null));
|
||||
} else {
|
||||
q.setRegexp((String) plh, asString(val, null));
|
||||
}
|
||||
break;
|
||||
case 6: // JSON
|
||||
if (plh instanceof Number) {
|
||||
q.setJSON(((Number) plh).intValue(), asString(val, null));
|
||||
} else {
|
||||
q.setJSON((String) plh, asString(val, null));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ homepage: https://ejdb.org
|
||||
|
||||
environment:
|
||||
sdk: '>=2.5.0 <3.0.0'
|
||||
flutter: ">=1.10.0 <2.0.0"
|
||||
flutter: ">=1.10.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
||||
@@ -5,7 +5,7 @@ homepage: https://ejdb.org
|
||||
|
||||
environment:
|
||||
sdk: '>=2.5.0 <3.0.0'
|
||||
flutter: ">=1.10.0 <2.0.0"
|
||||
flutter: ">=1.10.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
||||
@@ -1 +1 @@
|
||||
1
|
||||
4
|
||||
@@ -27,7 +27,7 @@
|
||||
<dependency>
|
||||
<groupId>softmotions</groupId>
|
||||
<artifactId>ejdb2</artifactId>
|
||||
<version>2.0.57.11</version>
|
||||
<version>2.62.18</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -62,7 +62,8 @@ else()
|
||||
com/softmotions/ejdb2/JQL.java
|
||||
com/softmotions/ejdb2/JQLCallback.java
|
||||
com/softmotions/ejdb2/JSON.java
|
||||
com/softmotions/ejdb2/JSONException.java)
|
||||
com/softmotions/ejdb2/JSONException.java
|
||||
com/softmotions/ejdb2/JSONMissingException.java)
|
||||
|
||||
utils_list_prepend(EJDB2_JAVA_SOURCES_JAR "main/java/" ${EJDB2_JAVA_SOURCES})
|
||||
|
||||
@@ -123,7 +124,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
add_custom_command(
|
||||
TARGET ejdb2jni
|
||||
POST_BUILD
|
||||
COMMAND strip -s $<TARGET_FILE:ejdb2jni>)
|
||||
COMMAND ${STRIP_CMD} $<TARGET_FILE:ejdb2jni>)
|
||||
endif()
|
||||
|
||||
install(
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.io.Writer;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -13,6 +14,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* JSON parser/container.
|
||||
@@ -23,7 +25,16 @@ import java.util.Objects;
|
||||
*
|
||||
* - https://github.com/ralfstx/minimal-json (MIT)
|
||||
*/
|
||||
public final class JSON {
|
||||
public final class JSON implements Comparable<JSON>, Cloneable {
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
if (isContainer()) {
|
||||
return JSON.fromString(toString());
|
||||
} else {
|
||||
return new JSON(type, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static ObjectBuilder buildObject() {
|
||||
return new ObjectBuilder();
|
||||
@@ -41,6 +52,10 @@ public final class JSON {
|
||||
return new JSON(bytes);
|
||||
}
|
||||
|
||||
public static JSON fromBytes(byte[] bytes, int off, int len) {
|
||||
return new JSON(bytes, off, len);
|
||||
}
|
||||
|
||||
public static JSON fromMap(Map<String, Object> map) {
|
||||
return new JSON(ValueType.OBJECT, map);
|
||||
}
|
||||
@@ -107,6 +122,22 @@ public final class JSON {
|
||||
reset();
|
||||
}
|
||||
|
||||
JSON(byte[] buf, int off, int len) {
|
||||
if (buf.length < off + len) {
|
||||
throw new ArrayIndexOutOfBoundsException();
|
||||
}
|
||||
if (off == 0) {
|
||||
this.buf = buf;
|
||||
} else {
|
||||
this.buf = new byte[len - off];
|
||||
System.arraycopy(buf, off, this.buf, 0, len);
|
||||
}
|
||||
tail = len;
|
||||
type = whatIsNext();
|
||||
value = read(type);
|
||||
reset();
|
||||
}
|
||||
|
||||
JSON(String data) {
|
||||
this(data.getBytes());
|
||||
}
|
||||
@@ -157,10 +188,21 @@ public final class JSON {
|
||||
return type == ValueType.ARRAY;
|
||||
}
|
||||
|
||||
public boolean isContainer() {
|
||||
return type == ValueType.OBJECT || type == ValueType.ARRAY;
|
||||
}
|
||||
|
||||
public Builder modify() {
|
||||
return new Builder(this);
|
||||
}
|
||||
|
||||
public Set<String> keys() {
|
||||
if (type != ValueType.OBJECT) {
|
||||
return Collections.EMPTY_SET;
|
||||
}
|
||||
return ((Map<String, Object>) value).keySet();
|
||||
}
|
||||
|
||||
public JSON get(String key) {
|
||||
if (type == ValueType.ARRAY) {
|
||||
try {
|
||||
@@ -191,6 +233,22 @@ public final class JSON {
|
||||
return new JSON(ValueType.getTypeOf(v), v);
|
||||
}
|
||||
|
||||
public JSON getOrThrow(String key) {
|
||||
JSON json = get(key);
|
||||
if (json.isUnknown()) {
|
||||
throw new JSONMissingException(key);
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
public JSON getOrThrow(int index) {
|
||||
JSON json = get(index);
|
||||
if (json.isUnknown()) {
|
||||
throw new JSONMissingException(index);
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
public <T> T cast() {
|
||||
return (T) value;
|
||||
}
|
||||
@@ -282,6 +340,14 @@ public final class JSON {
|
||||
return traverse(this, createPointer(pointer));
|
||||
}
|
||||
|
||||
public JSON atOrThrow(String pointer) {
|
||||
JSON json = at(pointer);
|
||||
if (json.isUnknown()) {
|
||||
throw new JSONMissingException(pointer);
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
private JSON traverse(JSON obj, List<String> pp) {
|
||||
if (pp.isEmpty() || obj.isUnknown()) {
|
||||
return obj;
|
||||
@@ -757,14 +823,13 @@ public final class JSON {
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
JSON other = (JSON) obj;
|
||||
return type == other.type && Objects.equals(value, other.value);
|
||||
return this.compareTo((JSON) obj) == 0;
|
||||
}
|
||||
|
||||
public static enum ValueType {
|
||||
UNKNOWN, STRING, NUMBER, NULL, BOOLEAN, ARRAY, OBJECT;
|
||||
UNKNOWN, NULL, BOOLEAN, NUMBER, STRING, OBJECT, ARRAY;
|
||||
|
||||
static ValueType getTypeOf(Object v) {
|
||||
public static ValueType getTypeOf(Object v) {
|
||||
if (v == null) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -1018,6 +1083,10 @@ public final class JSON {
|
||||
return getO().delete(key);
|
||||
}
|
||||
|
||||
public ObjectBuilder move(String oldKey, String newKey) {
|
||||
return getO().move(oldKey, newKey);
|
||||
}
|
||||
|
||||
public Iterable<String> keys() {
|
||||
return getO().keys();
|
||||
}
|
||||
@@ -1208,6 +1277,14 @@ public final class JSON {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ObjectBuilder move(String oldKey, String newKey) {
|
||||
if (value.containsKey(oldKey)) {
|
||||
value.put(newKey, value.get(oldKey));
|
||||
value.remove(oldKey);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public ObjectBuilder delete(String key) {
|
||||
value.remove(key);
|
||||
return this;
|
||||
@@ -1231,4 +1308,98 @@ public final class JSON {
|
||||
return sw.toString();
|
||||
}
|
||||
}
|
||||
|
||||
private int compareRaw(Object v1, Object v2) {
|
||||
ValueType t1 = ValueType.getTypeOf(v1);
|
||||
ValueType t2 = ValueType.getTypeOf(v2);
|
||||
if (t1 != t2) {
|
||||
return t1.ordinal() - t2.ordinal();
|
||||
}
|
||||
switch (t1) {
|
||||
case STRING:
|
||||
return ((String) v1).compareTo((String) v2);
|
||||
case OBJECT:
|
||||
return compareRawObjects((Map<String, ?>) v1, (Map<String, ?>) v2);
|
||||
case NUMBER:
|
||||
return ((Comparable<Number>) v1).compareTo((Number) v2);
|
||||
case BOOLEAN:
|
||||
return ((Boolean) v1).compareTo((Boolean) v2);
|
||||
case ARRAY: {
|
||||
return compareRawLists((List<Object>) v1, (List<Object>) v2);
|
||||
}
|
||||
case NULL:
|
||||
case UNKNOWN:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int compareRawLists(List<Object> l1, List<Object> l2) {
|
||||
for (int i = 0, l = Math.min(l1.size(), l2.size()); i < l; ++i) {
|
||||
int res = compareRaw(l1.get(i), l2.get(i));
|
||||
if (res != 0) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
if (l1.size() > l2.size()) {
|
||||
return 1;
|
||||
} else if (l2.size() < l2.size()) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private int compareRawObjects(Map<String, ?> m1, Map<String, ?> m2) {
|
||||
int cnt = m1.size();
|
||||
int i = m2.size();
|
||||
if (cnt > i) {
|
||||
return 1;
|
||||
} else if (cnt < i) {
|
||||
return -1;
|
||||
} else if (cnt == 0) {
|
||||
return 0;
|
||||
}
|
||||
String[] k1 = m1.keySet().toArray(new String[0]);
|
||||
String[] k2 = m2.keySet().toArray(new String[0]);
|
||||
Arrays.sort(k1);
|
||||
Arrays.sort(k2);
|
||||
for (i = 0; i < cnt; ++i) {
|
||||
int res = k1[i].compareTo(k2[i]);
|
||||
if (res != 0) {
|
||||
return res;
|
||||
}
|
||||
res = compareRaw(m1.get(k1[i]), m2.get(k2[i]));
|
||||
if (res != 0) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(JSON o) {
|
||||
if (o == null) {
|
||||
return 1;
|
||||
}
|
||||
if (type != o.type) {
|
||||
return type.ordinal() - o.type.ordinal();
|
||||
}
|
||||
switch (type) {
|
||||
case OBJECT:
|
||||
return compareRawObjects((Map<String, ?>) value, (Map<String, ?>) o.value);
|
||||
case ARRAY:
|
||||
return compareRawLists((List<Object>) value, (List<Object>) value);
|
||||
case STRING:
|
||||
return ((String) value).compareTo(o.cast());
|
||||
case NUMBER:
|
||||
return ((Comparable<Number>) value).compareTo(o.cast());
|
||||
case BOOLEAN:
|
||||
return ((Boolean) value).compareTo(o.cast());
|
||||
case NULL:
|
||||
case UNKNOWN:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.softmotions.ejdb2;
|
||||
|
||||
/**
|
||||
* Missing JSON value at key exception.
|
||||
*/
|
||||
public class JSONMissingException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = -1180177018517230756L;
|
||||
|
||||
public JSONMissingException(String key) {
|
||||
super("Missing JSON value at: '" + key + '\'');
|
||||
}
|
||||
|
||||
public JSONMissingException(int index) {
|
||||
super("Missing JSON value at: '" + index + '\'');
|
||||
}
|
||||
}
|
||||
@@ -164,6 +164,9 @@ public class TestEJDB2 {
|
||||
assert (q.getLimit() == 2);
|
||||
assert (q.getSkip() == 3);
|
||||
|
||||
// Test #333
|
||||
db.put("test333", "{\"foo\":1.1}");
|
||||
|
||||
long ts0 = System.currentTimeMillis();
|
||||
long ts = db.onlineBackup("test-bkp.db");
|
||||
assert (ts > ts0);
|
||||
|
||||
@@ -1 +1 @@
|
||||
12
|
||||
25
|
||||
@@ -1,3 +1,3 @@
|
||||
ejdb_node (@EJDB2_NODE_VERSION@)
|
||||
|
||||
- Fixed Stalling under stress issue (#306)
|
||||
- Upgraded to ejdb2 v@PROJECT_VERSION@
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/version.txt _VERSION)
|
||||
set_property(GLOBAL PROPERTY EJDB2_NODE_VERSION_PROPERTY
|
||||
"${PROJECT_VERSION}${_VERSION}")
|
||||
set(EJDB2_NODE_VERSION "${PROJECT_VERSION}${_VERSION}")
|
||||
"${PROJECT_VERSION}.${_VERSION}")
|
||||
set(EJDB2_NODE_VERSION "${PROJECT_VERSION}.${_VERSION}")
|
||||
|
||||
if(NOT DEFINED NODE_PUB_DIR)
|
||||
set(NODE_PUB_DIR ${CMAKE_CURRENT_BINARY_DIR}/ejdb2_node)
|
||||
@@ -42,8 +42,11 @@ add_library(ejdb2_node MODULE ejdb2_node.c)
|
||||
target_link_libraries(ejdb2_node ejdb2_s ${PROJECT_LLIBRARIES})
|
||||
|
||||
set_target_properties(
|
||||
ejdb2_node PROPERTIES OUTPUT_NAME ejdb2_node PREFIX "" SUFFIX ".node"
|
||||
LIBRARY_OUTPUT_DIRECTORY ${NODE_BIN_DIR})
|
||||
ejdb2_node
|
||||
PROPERTIES OUTPUT_NAME ejdb2_node
|
||||
PREFIX ""
|
||||
SUFFIX ".node"
|
||||
LIBRARY_OUTPUT_DIRECTORY ${NODE_BIN_DIR})
|
||||
|
||||
target_compile_options(ejdb2_node PRIVATE -DIW_API_EXPORTS
|
||||
-DNODE_ADDON_API_DISABLE_DEPRECATED)
|
||||
@@ -61,7 +64,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
add_custom_command(
|
||||
TARGET ejdb2_node
|
||||
POST_BUILD
|
||||
COMMAND strip -s $<TARGET_FILE:ejdb2_node>)
|
||||
COMMAND ${STRIP_CMD} $<TARGET_FILE:ejdb2_node>)
|
||||
endif()
|
||||
|
||||
configure_file(package.json ${NODE_PUB_DIR}/package.json @ONLY)
|
||||
@@ -76,7 +79,7 @@ configure_file(install.js ${NODE_PUB_DIR}/install.js COPYONLY)
|
||||
configure_file(test.js ${NODE_PUB_DIR}/test.js COPYONLY)
|
||||
|
||||
add_custom_command(
|
||||
COMMAND yarn install
|
||||
COMMAND yarn --non-interactive --no-progress install
|
||||
OUTPUT ${NODE_PUB_DIR}/node_modules
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/yarn.lock
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/package.json
|
||||
@@ -87,6 +90,6 @@ add_custom_target(yarn ALL DEPENDS ${NODE_PUB_DIR}/node_modules)
|
||||
if(BUILD_TESTS)
|
||||
add_test(
|
||||
NAME ejdb2node
|
||||
COMMAND ${YARN_EXEC} run test
|
||||
COMMAND ${YARN_EXEC} --non-interactive --no-progress run test
|
||||
WORKING_DIRECTORY ${NODE_PUB_DIR})
|
||||
endif()
|
||||
|
||||
@@ -6,14 +6,6 @@ See https://github.com/Softmotions/ejdb/blob/master/README.md
|
||||
|
||||
For API usage examples take a look into [/example](https://github.com/Softmotions/ejdb/tree/master/src/bindings/ejdb2_node/example) and [test.js](https://github.com/Softmotions/ejdb/tree/master/src/bindings/ejdb2_node/test.js)
|
||||
|
||||
## Note on versioning
|
||||
|
||||
Since `2020-12-22` a new version scheme is used and the major version
|
||||
of node package has been incremented. Now package version is the concatenation
|
||||
of ejdb2 core engine version and version serial number of this binding.
|
||||
For example: given ejdb2 version `2.0.52` and binding serial `2`
|
||||
the actual package version will be `2.0.522`.
|
||||
|
||||
## Sample code
|
||||
|
||||
```ts
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
* Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -33,4 +33,4 @@ const utils = require('./utils');
|
||||
module.exports = function (name) {
|
||||
const file = path.join(__dirname, utils.binariesDir, name);
|
||||
return require(file);
|
||||
};
|
||||
};
|
||||
|
||||
Vendored
+11
-11
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
* Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -50,7 +50,7 @@ declare namespace ejdb2_node {
|
||||
/**
|
||||
* EJDB document.
|
||||
*/
|
||||
interface JBDOC {
|
||||
interface JBDOC<T extends object = { [key: string]: any }> {
|
||||
/**
|
||||
* Document identifier
|
||||
*/
|
||||
@@ -59,7 +59,7 @@ declare namespace ejdb2_node {
|
||||
/**
|
||||
* Document JSON object
|
||||
*/
|
||||
json: any;
|
||||
json: T;
|
||||
|
||||
/**
|
||||
* String represen
|
||||
@@ -67,8 +67,8 @@ declare namespace ejdb2_node {
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
interface JBDOCStream {
|
||||
[Symbol.asyncIterator](): AsyncIterableIterator<JBDOC>;
|
||||
interface JBDOCStream<T extends object = { [key: string]: any }> {
|
||||
[Symbol.asyncIterator](): AsyncIterableIterator<JBDOC<T>>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +105,7 @@ declare namespace ejdb2_node {
|
||||
* readable stream of matched documents.
|
||||
*
|
||||
*/
|
||||
stream(opts?: QueryOptions): JBDOCStream;
|
||||
stream<T extends object = { [key: string]: any }>(opts?: QueryOptions): JBDOCStream<T>;
|
||||
|
||||
/**
|
||||
* Executes this query and waits its completion.
|
||||
@@ -122,18 +122,18 @@ declare namespace ejdb2_node {
|
||||
* Returns result set as a list.
|
||||
* Use it with caution on large data sets.
|
||||
*/
|
||||
list(opts?: QueryOptions): Promise<Array<JBDOC>>;
|
||||
list<T extends object = { [key: string]: any }>(opts?: QueryOptions): Promise<Array<JBDOC<T>>>;
|
||||
|
||||
/**
|
||||
* Collects up to [n] documents from result set into array.
|
||||
*/
|
||||
firstN(n: number, opts?: QueryOptions): Promise<Array<JBDOC>>;
|
||||
firstN<T extends object = { [key: string]: any }>(n: number, opts?: QueryOptions): Promise<Array<JBDOC<T>>>;
|
||||
|
||||
/**
|
||||
* Returns a first record in result set.
|
||||
* If record is not found promise with `undefined` will be returned.
|
||||
*/
|
||||
first(opts?: QueryOptions): Promise<JBDOC | undefined>;
|
||||
first<T extends object = { [key: string]: any }>(opts?: QueryOptions): Promise<JBDOC<T> | undefined>;
|
||||
|
||||
/**
|
||||
* Set [json] at the specified [placeholder].
|
||||
@@ -380,14 +380,14 @@ declare namespace ejdb2_node {
|
||||
* If document with given `id` is not found then `Error` will be thrown.
|
||||
* Not found error can be detected by {@link JBE.isNotFound}
|
||||
*/
|
||||
get(collection: string, id: number): Promise<object>;
|
||||
get<T extends object = { [key: string]: any }>(collection: string, id: number): Promise<T>;
|
||||
|
||||
/**
|
||||
* Get json body of document identified by [id] and stored in [collection].
|
||||
*
|
||||
* If document with given `id` is not found then `null` will be resoved.
|
||||
*/
|
||||
getOrNull(collection: string, id: number): Promise<object|null>;
|
||||
getOrNull<T extends object = { [key: string]: any }>(collection: string, id: number): Promise<T|null>;
|
||||
|
||||
/**
|
||||
* Get json body with database metadata.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
* Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
* Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
* Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
* Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -125,4 +125,4 @@ module.exports = {
|
||||
awaitProcess,
|
||||
runProcess,
|
||||
runProcessAndGetOutput
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1 +1 @@
|
||||
2
|
||||
6
|
||||
@@ -336,11 +336,11 @@
|
||||
integrity sha512-LcsGbPomWsad6wmMNv7nBLw7YYYyfdYcz6xryKYQhx89c3XXan+8Q6AJ43G5XDIaklaVkK3mE4fCb0SBvMiPSQ==
|
||||
|
||||
ajv@^6.5.5:
|
||||
version "6.10.0"
|
||||
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.0.tgz#90d0d54439da587cd7e843bfb7045f50bd22bdf1"
|
||||
integrity sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==
|
||||
version "6.12.6"
|
||||
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4"
|
||||
integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==
|
||||
dependencies:
|
||||
fast-deep-equal "^2.0.1"
|
||||
fast-deep-equal "^3.1.1"
|
||||
fast-json-stable-stringify "^2.0.0"
|
||||
json-schema-traverse "^0.4.1"
|
||||
uri-js "^4.2.2"
|
||||
@@ -1057,9 +1057,9 @@ dir-glob@^3.0.1:
|
||||
path-type "^4.0.0"
|
||||
|
||||
dot-prop@^4.1.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.0.tgz#1f19e0c2e1aa0e32797c49799f2837ac6af69c57"
|
||||
integrity sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==
|
||||
version "4.2.1"
|
||||
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.1.tgz#45884194a71fc2cda71cbb4bceb3a4dd2f433ba4"
|
||||
integrity sha512-l0p4+mIuJIua0mhxGoh4a+iNL9bmeK5DvnSVQa6T0OhrVmaEa1XScX5Etc673FePCJOArq/4Pa2cLGODUWTPOQ==
|
||||
dependencies:
|
||||
is-obj "^1.0.0"
|
||||
|
||||
@@ -1215,10 +1215,10 @@ extsprintf@^1.2.0:
|
||||
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f"
|
||||
integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8=
|
||||
|
||||
fast-deep-equal@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49"
|
||||
integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=
|
||||
fast-deep-equal@^3.1.1:
|
||||
version "3.1.3"
|
||||
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
|
||||
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
|
||||
|
||||
fast-diff@^1.1.2:
|
||||
version "1.2.0"
|
||||
@@ -1238,9 +1238,9 @@ fast-glob@^3.0.3:
|
||||
micromatch "^4.0.2"
|
||||
|
||||
fast-json-stable-stringify@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2"
|
||||
integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I=
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
|
||||
integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==
|
||||
|
||||
fastq@^1.6.0:
|
||||
version "1.6.0"
|
||||
@@ -1374,9 +1374,9 @@ getpass@^0.1.1:
|
||||
assert-plus "^1.0.0"
|
||||
|
||||
glob-parent@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.0.0.tgz#1dc99f0f39b006d3e92c2c284068382f0c20e954"
|
||||
integrity sha512-Z2RwiujPRGluePM6j699ktJYxmPpJKCfpGA13jz2hmFZC7gKetzrWvg5KN3+OsIFmydGyZ1AVwERCq1w/ZZwRg==
|
||||
version "5.1.2"
|
||||
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
|
||||
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
|
||||
dependencies:
|
||||
is-glob "^4.0.1"
|
||||
|
||||
@@ -1498,9 +1498,9 @@ hasha@^5.0.0:
|
||||
type-fest "^0.3.0"
|
||||
|
||||
hosted-git-info@^2.1.4:
|
||||
version "2.7.1"
|
||||
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047"
|
||||
integrity sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==
|
||||
version "2.8.9"
|
||||
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9"
|
||||
integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==
|
||||
|
||||
http-cache-semantics@^4.0.0:
|
||||
version "4.0.3"
|
||||
@@ -1905,9 +1905,9 @@ lodash.merge@4.6.2, lodash.merge@^4.6.1:
|
||||
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==
|
||||
|
||||
lodash@^4.17.11:
|
||||
version "4.17.11"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
|
||||
integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==
|
||||
version "4.17.21"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
||||
|
||||
log-symbols@^2.2.0:
|
||||
version "2.2.0"
|
||||
@@ -2113,9 +2113,9 @@ normalize-path@^3.0.0:
|
||||
integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==
|
||||
|
||||
normalize-url@^4.1.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.3.0.tgz#9c49e10fc1876aeb76dba88bf1b2b5d9fa57b2ee"
|
||||
integrity sha512-0NLtR71o4k6GLP+mr6Ty34c5GA6CMoEsncKJxvQd8NzPxaHRJNnb5gZE8R1XF4CPIS7QPHLJ74IFszwtNVAHVQ==
|
||||
version "4.5.1"
|
||||
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.5.1.tgz#0dd90cf1288ee1d1313b87081c9a5932ee48518a"
|
||||
integrity sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==
|
||||
|
||||
npm-run-path@^2.0.0:
|
||||
version "2.0.2"
|
||||
@@ -2319,9 +2319,9 @@ path-key@^2.0.0:
|
||||
integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=
|
||||
|
||||
path-parse@^1.0.6:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
|
||||
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
|
||||
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
|
||||
|
||||
path-type@^3.0.0:
|
||||
version "3.0.0"
|
||||
@@ -2336,9 +2336,9 @@ path-type@^4.0.0:
|
||||
integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==
|
||||
|
||||
pathval@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.0.tgz#b942e6d4bde653005ef6b71361def8727d0645e0"
|
||||
integrity sha1-uULm1L3mUwBe9rcTYd74cn0GReA=
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d"
|
||||
integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==
|
||||
|
||||
pend@~1.2.0:
|
||||
version "1.2.0"
|
||||
@@ -2974,9 +2974,9 @@ trim-newlines@^2.0.0:
|
||||
integrity sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=
|
||||
|
||||
trim-off-newlines@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz#9f9ba9d9efa8764c387698bcbfeb2c848f11adb3"
|
||||
integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM=
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/trim-off-newlines/-/trim-off-newlines-1.0.3.tgz#8df24847fcb821b0ab27d58ab6efec9f2fe961a1"
|
||||
integrity sha512-kh6Tu6GbeSNMGfrrZh6Bb/4ZEHV1QlB4xNDBeog8Y9/QwFlKTRyWvY3Fs9tRDAMZliVUwieMgEdIeL/FtqjkJg==
|
||||
|
||||
trim-right@^1.0.1:
|
||||
version "1.0.1"
|
||||
@@ -3085,9 +3085,9 @@ update-notifier@^3.0.1:
|
||||
xdg-basedir "^3.0.0"
|
||||
|
||||
uri-js@^4.2.2:
|
||||
version "4.2.2"
|
||||
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0"
|
||||
integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==
|
||||
version "4.4.1"
|
||||
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"
|
||||
integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==
|
||||
dependencies:
|
||||
punycode "^2.1.0"
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
ejdb2_react_native (@EJDB2_RN_VERSION@)
|
||||
|
||||
- Used new versioning scheme: {EJDB_VERSION}{BINDING_VERSION_NUMBER}
|
||||
- Upgraded to ejdb2 v@PROJECT_VERSION@
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/version.txt _VERSION)
|
||||
set_property(GLOBAL PROPERTY EJDB2_RN_VERSION_PROPERTY "${PROJECT_VERSION}${_VERSION}")
|
||||
set(EJDB2_RN_VERSION "${PROJECT_VERSION}${_VERSION}")
|
||||
set_property(GLOBAL PROPERTY EJDB2_RN_VERSION_PROPERTY "${PROJECT_VERSION}.${_VERSION}")
|
||||
set(EJDB2_RN_VERSION "${PROJECT_VERSION}.${_VERSION}")
|
||||
|
||||
if (NOT DEFINED REACT_NATIVE_PUB_DIR)
|
||||
set(REACT_NATIVE_PUB_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
@@ -24,7 +24,7 @@ add_custom_target(
|
||||
DEPENDS ${ANDROID_ABIS_LIBS}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/../../ejdb2_android/libs ${ANDROID_LIBS_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../README.md ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMAND ${YARN_EXEC} pack --filename ${REACT_NATIVE_PUB_DIR}/ejdb2_react_native.tgz
|
||||
COMMAND ${YARN_EXEC} --non-interactive --no-progress pack --filename ${REACT_NATIVE_PUB_DIR}/ejdb2_react_native.tgz
|
||||
WORKING_DIRECTORY ${REACT_NATIVE_PUB_DIR}
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
* Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1 +1 @@
|
||||
1
|
||||
4
|
||||
@@ -2,7 +2,7 @@ include(CTest)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT node_modules
|
||||
COMMAND ${YARN_EXEC} install
|
||||
COMMAND ${YARN_EXEC} --non-interactive --no-progress install
|
||||
DEPENDS ejdb2_react_native
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/package.json
|
||||
VERBATIM
|
||||
@@ -10,10 +10,10 @@ add_custom_command(
|
||||
|
||||
add_custom_target(
|
||||
ejdb2_react_native_tests ALL
|
||||
COMMAND ${YARN_EXEC} build-dev
|
||||
COMMAND ${YARN_EXEC} --non-interactive --no-progress build-dev
|
||||
DEPENDS node_modules
|
||||
)
|
||||
|
||||
add_test(NAME ejdb2_react_native
|
||||
COMMAND ${YARN_EXEC} test-dev
|
||||
COMMAND ${YARN_EXEC} --non-interactive --no-progress test-dev
|
||||
)
|
||||
+74
-113
@@ -1,7 +1,5 @@
|
||||
#include "ejdb2_internal.h"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
static iwrc _jb_put_new_lw(JBCOLL jbc, JBL jbl, int64_t *id);
|
||||
|
||||
static const IWKV_val EMPTY_VAL = { 0 };
|
||||
@@ -70,6 +68,7 @@ static void _jb_coll_release(JBCOLL jbc) {
|
||||
}
|
||||
|
||||
static iwrc _jb_coll_load_index_lr(JBCOLL jbc, IWKV_val *mval) {
|
||||
iwrc rc;
|
||||
binn *bn;
|
||||
char *ptr;
|
||||
struct _JBL imeta;
|
||||
@@ -78,8 +77,7 @@ static iwrc _jb_coll_load_index_lr(JBCOLL jbc, IWKV_val *mval) {
|
||||
return iwrc_set_errno(IW_ERROR_ALLOC, errno);
|
||||
}
|
||||
|
||||
iwrc rc = jbl_from_buf_keep_onstack(&imeta, mval->data, mval->size);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_from_buf_keep_onstack(&imeta, mval->data, mval->size));
|
||||
bn = &imeta.bn;
|
||||
|
||||
if ( !binn_object_get_str(bn, "ptr", &ptr)
|
||||
@@ -89,11 +87,10 @@ static iwrc _jb_coll_load_index_lr(JBCOLL jbc, IWKV_val *mval) {
|
||||
rc = EJDB_ERROR_INVALID_COLLECTION_INDEX_META;
|
||||
goto finish;
|
||||
}
|
||||
rc = jbl_ptr_alloc(ptr, &idx->ptr);
|
||||
RCGO(rc, finish);
|
||||
|
||||
rc = iwkv_db(jbc->db->iwkv, idx->dbid, idx->idbf, &idx->idb);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_ptr_alloc(ptr, &idx->ptr));
|
||||
RCC(rc, finish, iwkv_db(jbc->db->iwkv, idx->dbid, idx->idbf, &idx->idb));
|
||||
|
||||
idx->jbc = jbc;
|
||||
idx->rnum = _jb_meta_nrecs_get(jbc->db, idx->dbid);
|
||||
idx->next = jbc->idx;
|
||||
@@ -127,12 +124,10 @@ static iwrc _jb_coll_load_indexes_lr(JBCOLL jbc) {
|
||||
|
||||
do {
|
||||
IWKV_val key, val;
|
||||
rc = iwkv_cursor_key(cur, &key);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_key(cur, &key));
|
||||
if ((key.size > sz) && !strncmp(buf, key.data, sz)) {
|
||||
iwkv_val_dispose(&key);
|
||||
rc = iwkv_cursor_val(cur, &val);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_val(cur, &val));
|
||||
rc = _jb_coll_load_index_lr(jbc, &val);
|
||||
iwkv_val_dispose(&val);
|
||||
RCBREAK(rc);
|
||||
@@ -184,8 +179,7 @@ static iwrc _jb_coll_load_meta_lr(JBCOLL jbc) {
|
||||
}
|
||||
} else {
|
||||
size_t sz;
|
||||
rc = iwkv_cursor_copy_key(cur, &jbc->id_seq, sizeof(jbc->id_seq), &sz, 0);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_copy_key(cur, &jbc->id_seq, sizeof(jbc->id_seq), &sz, 0));
|
||||
}
|
||||
|
||||
finish:
|
||||
@@ -235,8 +229,7 @@ static iwrc _jb_idx_add_meta_lr(JBIDX idx, binn *list) {
|
||||
iwxstr_destroy(xstr);
|
||||
return rc;
|
||||
}
|
||||
rc = jbl_ptr_serialize(idx->ptr, xstr);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_ptr_serialize(idx->ptr, xstr));
|
||||
|
||||
if ( !binn_object_set_str(meta, "ptr", iwxstr_ptr(xstr))
|
||||
|| !binn_object_set_uint32(meta, "mode", idx->mode)
|
||||
@@ -276,8 +269,7 @@ static iwrc _jb_coll_add_meta_lr(JBCOLL jbc, binn *list) {
|
||||
goto finish;
|
||||
}
|
||||
for (JBIDX idx = jbc->idx; idx; idx = idx->next) {
|
||||
rc = _jb_idx_add_meta_lr(idx, ilist);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, _jb_idx_add_meta_lr(idx, ilist));
|
||||
}
|
||||
if (!binn_object_set_list(meta, "indexes", ilist)) {
|
||||
rc = JBL_ERROR_CREATION;
|
||||
@@ -312,8 +304,7 @@ static iwrc _jb_db_meta_load(EJDB db) {
|
||||
RCRET(rc);
|
||||
while (!(rc = iwkv_cursor_to(cur, IWKV_CURSOR_NEXT))) {
|
||||
IWKV_val key, val;
|
||||
rc = iwkv_cursor_get(cur, &key, &val);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_get(cur, &key, &val));
|
||||
if (!strncmp(key.data, KEY_PREFIX_COLLMETA, sizeof(KEY_PREFIX_COLLMETA) - 1)) {
|
||||
JBCOLL jbc = calloc(1, sizeof(*jbc));
|
||||
if (!jbc) {
|
||||
@@ -347,9 +338,7 @@ static iwrc _jb_db_release(EJDB *dbp) {
|
||||
EJDB db = *dbp;
|
||||
*dbp = 0;
|
||||
#ifdef JB_HTTP
|
||||
if (db->jbr) {
|
||||
IWRC(jbr_shutdown(&db->jbr), rc);
|
||||
}
|
||||
jbr_shutdown_wait(db->jbr);
|
||||
#endif
|
||||
if (db->mcolls) {
|
||||
for (khiter_t k = kh_begin(db->mcolls); k != kh_end(db->mcolls); ++k) {
|
||||
@@ -379,7 +368,7 @@ static iwrc _jb_db_release(EJDB *dbp) {
|
||||
}
|
||||
|
||||
static iwrc _jb_coll_acquire_keeplock2(EJDB db, const char *coll, jb_coll_acquire_t acm, JBCOLL *jbcp) {
|
||||
if (strlen(coll) > EJDB_COLLECTION_NAME_MAX_LEN) {
|
||||
if (!coll || *coll == '\0' || strlen(coll) > EJDB_COLLECTION_NAME_MAX_LEN) {
|
||||
return EJDB_ERROR_INVALID_COLLECTION_NAME;
|
||||
}
|
||||
int rci;
|
||||
@@ -421,15 +410,13 @@ static iwrc _jb_coll_acquire_keeplock2(EJDB db, const char *coll, jb_coll_acquir
|
||||
char keybuf[JBNUMBUF_SIZE + sizeof(KEY_PREFIX_COLLMETA)];
|
||||
IWKV_val key, val;
|
||||
|
||||
rc = iwkv_new_db(db->iwkv, IWDB_VNUM64_KEYS, &dbid, &cdb);
|
||||
RCGO(rc, create_finish);
|
||||
RCC(rc, create_finish, iwkv_new_db(db->iwkv, IWDB_VNUM64_KEYS, &dbid, &cdb));
|
||||
jbc = calloc(1, sizeof(*jbc));
|
||||
if (!jbc) {
|
||||
rc = iwrc_set_errno(IW_ERROR_ALLOC, errno);
|
||||
goto create_finish;
|
||||
}
|
||||
rc = jbl_create_empty_object(&meta);
|
||||
RCGO(rc, create_finish);
|
||||
RCC(rc, create_finish, jbl_create_empty_object(&meta));
|
||||
if (!binn_object_set_str(&meta->bn, "name", coll)) {
|
||||
rc = JBL_ERROR_CREATION;
|
||||
goto create_finish;
|
||||
@@ -438,8 +425,7 @@ static iwrc _jb_coll_acquire_keeplock2(EJDB db, const char *coll, jb_coll_acquir
|
||||
rc = JBL_ERROR_CREATION;
|
||||
goto create_finish;
|
||||
}
|
||||
rc = jbl_as_buf(meta, &val.data, &val.size);
|
||||
RCGO(rc, create_finish);
|
||||
RCC(rc, create_finish, jbl_as_buf(meta, &val.data, &val.size));
|
||||
|
||||
key.size = snprintf(keybuf, sizeof(keybuf), KEY_PREFIX_COLLMETA "%u", dbid);
|
||||
if (key.size >= sizeof(keybuf)) {
|
||||
@@ -447,8 +433,7 @@ static iwrc _jb_coll_acquire_keeplock2(EJDB db, const char *coll, jb_coll_acquir
|
||||
goto create_finish;
|
||||
}
|
||||
key.data = keybuf;
|
||||
rc = iwkv_put(db->metadb, &key, &val, IWKV_SYNC);
|
||||
RCGO(rc, create_finish);
|
||||
RCC(rc, create_finish, iwkv_put(db->metadb, &key, &val, IWKV_SYNC));
|
||||
|
||||
jbc->db = db;
|
||||
jbc->meta = meta;
|
||||
@@ -532,12 +517,10 @@ static iwrc _jb_idx_record_add(JBIDX idx, int64_t id, JBL jbl, JBL jblprev) {
|
||||
goto finish;
|
||||
}
|
||||
JBL_NODE jbvprev_node, jbv_node;
|
||||
rc = jbl_to_node(&jbv, &jbv_node, false, pool);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_to_node(&jbv, &jbv_node, false, pool));
|
||||
jbv.node = jbv_node;
|
||||
|
||||
rc = jbl_to_node(&jbvprev, &jbvprev_node, false, pool);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_to_node(&jbvprev, &jbvprev_node, false, pool));
|
||||
jbvprev.node = jbvprev_node;
|
||||
|
||||
if (_jbl_compare_nodes(jbv_node, jbvprev_node, &rc) == 0) {
|
||||
@@ -553,12 +536,10 @@ static iwrc _jb_idx_record_add(JBIDX idx, int64_t id, JBL jbl, JBL jblprev) {
|
||||
if (!pool) {
|
||||
pool = iwpool_create(1024);
|
||||
if (!pool) {
|
||||
rc = iwrc_set_errno(IW_ERROR_ALLOC, errno);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwrc_set_errno(IW_ERROR_ALLOC, errno));
|
||||
}
|
||||
}
|
||||
rc = jbl_to_node(&jbvprev, &n, false, pool);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_to_node(&jbvprev, &n, false, pool));
|
||||
for (n = n->child; n; n = n->next) {
|
||||
jbi_node_fill_ikey(idx, n, &key, numbuf);
|
||||
if (key.size) {
|
||||
@@ -593,12 +574,10 @@ static iwrc _jb_idx_record_add(JBIDX idx, int64_t id, JBL jbl, JBL jblprev) {
|
||||
if (!pool) {
|
||||
pool = iwpool_create(1024);
|
||||
if (!pool) {
|
||||
rc = iwrc_set_errno(IW_ERROR_ALLOC, errno);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwrc_set_errno(IW_ERROR_ALLOC, errno));
|
||||
}
|
||||
}
|
||||
rc = jbl_to_node(&jbv, &n, false, pool);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_to_node(&jbv, &n, false, pool));
|
||||
for (n = n->child; n; n = n->next) {
|
||||
jbi_node_fill_ikey(idx, n, &key, numbuf);
|
||||
if (key.size) {
|
||||
@@ -899,8 +878,7 @@ iwrc ejdb_exec(EJDB_EXEC *ux) {
|
||||
RCRET(rc);
|
||||
}
|
||||
|
||||
rc = _jb_exec_scan_init(&ctx);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, _jb_exec_scan_init(&ctx));
|
||||
if (ctx.sorting) {
|
||||
if (ux->log) {
|
||||
iwxstr_cat2(ux->log, " [COLLECTOR] SORTER\n");
|
||||
@@ -1042,8 +1020,7 @@ iwrc ejdb_list3(EJDB db, const char *coll, const char *query, int64_t limit, IWX
|
||||
list->first = 0;
|
||||
list->db = db;
|
||||
list->pool = pool;
|
||||
rc = jql_create(&list->q, coll, query);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jql_create(&list->q, coll, query));
|
||||
rc = _jb_list(db, list->q, &list->first, limit, log, list->pool);
|
||||
|
||||
finish:
|
||||
@@ -1117,8 +1094,7 @@ iwrc ejdb_remove_index(EJDB db, const char *coll, const char *path, ejdb_idx_mod
|
||||
iwrc rc = _jb_coll_acquire_keeplock2(db, coll, JB_COLL_ACQUIRE_WRITE | JB_COLL_ACQUIRE_EXISTING, &jbc);
|
||||
RCRET(rc);
|
||||
|
||||
rc = jbl_ptr_alloc(path, &ptr);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_ptr_alloc(path, &ptr));
|
||||
|
||||
for (JBIDX idx = jbc->idx, prev = 0; idx; idx = idx->next) {
|
||||
if (((idx->mode & ~EJDB_IDX_UNIQUE) == (mode & ~EJDB_IDX_UNIQUE)) && !jbl_ptr_cmp(idx->ptr, ptr)) {
|
||||
@@ -1128,8 +1104,7 @@ iwrc ejdb_remove_index(EJDB db, const char *coll, const char *path, ejdb_idx_mod
|
||||
rc = IW_ERROR_OVERFLOW;
|
||||
goto finish;
|
||||
}
|
||||
rc = iwkv_del(db->metadb, &key, 0);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_del(db->metadb, &key, 0));
|
||||
_jb_meta_nrecs_removedb(db, idx->dbid);
|
||||
if (prev) {
|
||||
prev->next = idx->next;
|
||||
@@ -1175,8 +1150,8 @@ iwrc ejdb_ensure_index(EJDB db, const char *coll, const char *path, ejdb_idx_mod
|
||||
|
||||
iwrc rc = _jb_coll_acquire_keeplock(db, coll, true, &jbc);
|
||||
RCRET(rc);
|
||||
rc = jbl_ptr_alloc(path, &ptr);
|
||||
RCGO(rc, finish);
|
||||
|
||||
RCC(rc, finish, jbl_ptr_alloc(path, &ptr));
|
||||
|
||||
for (idx = jbc->idx; idx; idx = idx->next) {
|
||||
if (((idx->mode & ~EJDB_IDX_UNIQUE) == (mode & ~EJDB_IDX_UNIQUE)) && !jbl_ptr_cmp(idx->ptr, ptr)) {
|
||||
@@ -1206,11 +1181,9 @@ iwrc ejdb_ensure_index(EJDB db, const char *coll, const char *path, ejdb_idx_mod
|
||||
if (!(mode & EJDB_IDX_UNIQUE)) {
|
||||
idx->idbf |= IWDB_COMPOUND_KEYS;
|
||||
}
|
||||
rc = iwkv_new_db(db->iwkv, idx->idbf, &idx->dbid, &idx->idb);
|
||||
RCGO(rc, finish);
|
||||
|
||||
rc = _jb_idx_fill(idx);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_new_db(db->iwkv, idx->idbf, &idx->dbid, &idx->idb));
|
||||
RCC(rc, finish, _jb_idx_fill(idx));
|
||||
|
||||
// save index meta into metadb
|
||||
imeta = binn_object();
|
||||
@@ -1236,8 +1209,7 @@ iwrc ejdb_ensure_index(EJDB db, const char *coll, const char *path, ejdb_idx_mod
|
||||
}
|
||||
val.data = binn_ptr(imeta);
|
||||
val.size = binn_size(imeta);
|
||||
rc = iwkv_put(db->metadb, &key, &val, 0);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_put(db->metadb, &key, &val, 0));
|
||||
|
||||
idx->next = jbc->idx;
|
||||
jbc->idx = idx;
|
||||
@@ -1260,8 +1232,8 @@ finish:
|
||||
|
||||
static iwrc _jb_patch(
|
||||
EJDB db, const char *coll, int64_t id, bool upsert,
|
||||
const char *patchjson, JBL_NODE patchjbn, JBL patchjbl) {
|
||||
|
||||
const char *patchjson, JBL_NODE patchjbn, JBL patchjbl
|
||||
) {
|
||||
int rci;
|
||||
JBCOLL jbc;
|
||||
struct _JBL sjbl;
|
||||
@@ -1275,7 +1247,7 @@ static iwrc _jb_patch(
|
||||
};
|
||||
|
||||
iwrc rc = _jb_coll_acquire_keeplock(db, coll, true, &jbc);
|
||||
RCGO(rc, finish);
|
||||
RCRET(rc);
|
||||
|
||||
rc = iwkv_get(jbc->cdb, &key, &val);
|
||||
if (upsert && (rc == IWKV_ERROR_NOTFOUND)) {
|
||||
@@ -1302,8 +1274,7 @@ static iwrc _jb_patch(
|
||||
RCGO(rc, finish);
|
||||
}
|
||||
|
||||
rc = jbl_from_buf_keep_onstack(&sjbl, val.data, val.size);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_from_buf_keep_onstack(&sjbl, val.data, val.size));
|
||||
|
||||
pool = iwpool_create_empty();
|
||||
if (!pool) {
|
||||
@@ -1311,8 +1282,7 @@ static iwrc _jb_patch(
|
||||
goto finish;
|
||||
}
|
||||
|
||||
rc = jbl_to_node(&sjbl, &root, false, pool);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_to_node(&sjbl, &root, false, pool));
|
||||
|
||||
if (patchjson) {
|
||||
rc = jbn_from_json(patchjson, &patch, pool);
|
||||
@@ -1325,22 +1295,18 @@ static iwrc _jb_patch(
|
||||
}
|
||||
RCGO(rc, finish);
|
||||
|
||||
rc = jbn_patch_auto(root, patch, pool);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbn_patch_auto(root, patch, pool));
|
||||
|
||||
if (root->type == JBV_OBJECT) {
|
||||
rc = jbl_create_empty_object(&ujbl);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_create_empty_object(&ujbl));
|
||||
} else if (root->type == JBV_ARRAY) {
|
||||
rc = jbl_create_empty_array(&ujbl);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_create_empty_array(&ujbl));
|
||||
} else {
|
||||
rc = JBL_ERROR_CREATION;
|
||||
goto finish;
|
||||
}
|
||||
rc = jbl_fill_from_node(ujbl, root);
|
||||
RCGO(rc, finish);
|
||||
|
||||
RCC(rc, finish, jbl_fill_from_node(ujbl, root));
|
||||
rc = _jb_put_impl(jbc, ujbl, id);
|
||||
|
||||
finish:
|
||||
@@ -1408,6 +1374,15 @@ iwrc ejdb_put(EJDB db, const char *coll, JBL jbl, int64_t id) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
iwrc ejdb_put_jbn(EJDB db, const char *coll, JBL_NODE jbn, int64_t id) {
|
||||
JBL jbl = 0;
|
||||
iwrc rc = jbl_from_node(&jbl, jbn);
|
||||
RCRET(rc);
|
||||
rc = ejdb_put(db, coll, jbl, id);
|
||||
jbl_destroy(&jbl);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static iwrc _jb_put_new_lw(JBCOLL jbc, JBL jbl, int64_t *id) {
|
||||
iwrc rc = 0;
|
||||
int64_t oid = jbc->id_seq + 1;
|
||||
@@ -1465,18 +1440,19 @@ iwrc jb_get(EJDB db, const char *coll, int64_t id, jb_coll_acquire_t acm, JBL *j
|
||||
return IW_ERROR_INVALID_ARGS;
|
||||
}
|
||||
*jblp = 0;
|
||||
|
||||
int rci;
|
||||
JBCOLL jbc;
|
||||
JBL jbl = 0;
|
||||
IWKV_val val = { 0 };
|
||||
IWKV_val key = { .data = &id, .size = sizeof(id) };
|
||||
|
||||
iwrc rc = _jb_coll_acquire_keeplock2(db, coll, acm, &jbc);
|
||||
RCRET(rc);
|
||||
|
||||
rc = iwkv_get(jbc->cdb, &key, &val);
|
||||
RCGO(rc, finish);
|
||||
rc = jbl_from_buf_keep(&jbl, val.data, val.size, false);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_get(jbc->cdb, &key, &val));
|
||||
RCC(rc, finish, jbl_from_buf_keep(&jbl, val.data, val.size, false));
|
||||
|
||||
*jblp = jbl;
|
||||
|
||||
finish:
|
||||
@@ -1501,20 +1477,18 @@ iwrc ejdb_del(EJDB db, const char *coll, int64_t id) {
|
||||
struct _JBL jbl;
|
||||
IWKV_val val = { 0 };
|
||||
IWKV_val key = { .data = &id, .size = sizeof(id) };
|
||||
|
||||
iwrc rc = _jb_coll_acquire_keeplock2(db, coll, JB_COLL_ACQUIRE_WRITE | JB_COLL_ACQUIRE_EXISTING, &jbc);
|
||||
RCRET(rc);
|
||||
|
||||
rc = iwkv_get(jbc->cdb, &key, &val);
|
||||
RCGO(rc, finish);
|
||||
|
||||
rc = jbl_from_buf_keep_onstack(&jbl, val.data, val.size);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_get(jbc->cdb, &key, &val));
|
||||
RCC(rc, finish, jbl_from_buf_keep_onstack(&jbl, val.data, val.size));
|
||||
|
||||
for (JBIDX idx = jbc->idx; idx; idx = idx->next) {
|
||||
IWRC(_jb_idx_record_remove(idx, id, &jbl), rc);
|
||||
}
|
||||
rc = iwkv_del(jbc->cdb, &key, 0);
|
||||
RCGO(rc, finish);
|
||||
|
||||
RCC(rc, finish, iwkv_del(jbc->cdb, &key, 0));
|
||||
_jb_meta_nrecs_update(jbc->db, jbc->dbid, -1);
|
||||
jbc->rnum -= 1;
|
||||
|
||||
@@ -1573,20 +1547,18 @@ iwrc ejdb_remove_collection(EJDB db, const char *coll) {
|
||||
khiter_t k = kh_get(JBCOLLM, db->mcolls, coll);
|
||||
|
||||
if (k != kh_end(db->mcolls)) {
|
||||
|
||||
jbc = kh_value(db->mcolls, k);
|
||||
key.data = keybuf;
|
||||
key.size = snprintf(keybuf, sizeof(keybuf), KEY_PREFIX_COLLMETA "%u", jbc->dbid);
|
||||
rc = iwkv_del(jbc->db->metadb, &key, IWKV_SYNC);
|
||||
RCGO(rc, finish);
|
||||
|
||||
RCC(rc, finish, iwkv_del(jbc->db->metadb, &key, IWKV_SYNC));
|
||||
|
||||
_jb_meta_nrecs_removedb(db, jbc->dbid);
|
||||
|
||||
for (JBIDX idx = jbc->idx; idx; idx = idx->next) {
|
||||
key.data = keybuf;
|
||||
key.size = snprintf(keybuf, sizeof(keybuf), KEY_PREFIX_IDXMETA "%u" "." "%u", jbc->dbid, idx->dbid);
|
||||
rc = iwkv_del(jbc->db->metadb, &key, 0);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_del(jbc->db->metadb, &key, 0));
|
||||
_jb_meta_nrecs_removedb(db, idx->dbid);
|
||||
}
|
||||
for (JBIDX idx = jbc->idx, nidx; idx; idx = nidx) {
|
||||
@@ -1654,9 +1626,7 @@ iwrc ejdb_rename_collection(EJDB db, const char *coll, const char *new_coll) {
|
||||
}
|
||||
|
||||
JBCOLL jbc = kh_value(db->mcolls, k);
|
||||
|
||||
rc = jbl_create_empty_object(&nmeta);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_create_empty_object(&nmeta));
|
||||
|
||||
if (!binn_object_set_str(&nmeta->bn, "name", new_coll)) {
|
||||
rc = JBL_ERROR_CREATION;
|
||||
@@ -1667,8 +1637,7 @@ iwrc ejdb_rename_collection(EJDB db, const char *coll, const char *new_coll) {
|
||||
goto finish;
|
||||
}
|
||||
|
||||
rc = jbl_as_buf(nmeta, &val.data, &val.size);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_as_buf(nmeta, &val.data, &val.size));
|
||||
key.size = snprintf(keybuf, sizeof(keybuf), KEY_PREFIX_COLLMETA "%u", jbc->dbid);
|
||||
if (key.size >= sizeof(keybuf)) {
|
||||
rc = IW_ERROR_OVERFLOW;
|
||||
@@ -1676,13 +1645,9 @@ iwrc ejdb_rename_collection(EJDB db, const char *coll, const char *new_coll) {
|
||||
}
|
||||
key.data = keybuf;
|
||||
|
||||
rc = jbl_at(nmeta, "/name", &jbv);
|
||||
RCGO(rc, finish);
|
||||
|
||||
RCC(rc, finish, jbl_at(nmeta, "/name", &jbv));
|
||||
const char *new_name = jbl_get_str(jbv);
|
||||
|
||||
rc = iwkv_put(db->metadb, &key, &val, IWKV_SYNC);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_put(db->metadb, &key, &val, IWKV_SYNC));
|
||||
|
||||
kh_del(JBCOLLM, db->mcolls, k);
|
||||
k2 = kh_put(JBCOLLM, db->mcolls, new_name, &rci);
|
||||
@@ -1740,8 +1705,7 @@ iwrc ejdb_get_meta(EJDB db, JBL *jblp) {
|
||||
continue;
|
||||
}
|
||||
JBCOLL jbc = kh_val(db->mcolls, k);
|
||||
rc = _jb_coll_add_meta_lr(jbc, clist);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, _jb_coll_add_meta_lr(jbc, clist));
|
||||
}
|
||||
if (!binn_object_set_list(&jbl->bn, "collections", clist)) {
|
||||
rc = JBL_ERROR_CREATION;
|
||||
@@ -1838,12 +1802,10 @@ iwrc ejdb_open(const EJDB_OPTS *_opts, EJDB *ejdbp) {
|
||||
kvopts.wal.wal_lock_interceptor = _jb_wal_lock_interceptor;
|
||||
kvopts.wal.wal_lock_interceptor_opaque = db;
|
||||
|
||||
rc = iwkv_open(&kvopts, &db->iwkv);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_open(&kvopts, &db->iwkv));
|
||||
|
||||
db->oflags = kvopts.oflags;
|
||||
rc = _jb_db_meta_load(db);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, _jb_db_meta_load(db));
|
||||
|
||||
if (db->opts.http.enabled) {
|
||||
// Maximum WS/HTTP API body size. Default: 64Mb, Min: 512K
|
||||
@@ -1856,8 +1818,7 @@ iwrc ejdb_open(const EJDB_OPTS *_opts, EJDB *ejdbp) {
|
||||
|
||||
#ifdef JB_HTTP
|
||||
if (db->opts.http.enabled && !db->opts.http.blocking) {
|
||||
rc = jbr_start(db, &db->opts, &db->jbr);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbr_start(db, &db->opts, &db->jbr));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1889,11 +1850,11 @@ iwrc ejdb_close(EJDB *ejdbp) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
const char *ejdb_git_revision(void) {
|
||||
const char* ejdb_git_revision(void) {
|
||||
return EJDB2_GIT_REVISION;
|
||||
}
|
||||
|
||||
const char *ejdb_version_full(void) {
|
||||
const char* ejdb_version_full(void) {
|
||||
return EJDB2_VERSION;
|
||||
}
|
||||
|
||||
@@ -1909,7 +1870,7 @@ unsigned int ejdb_version_patch(void) {
|
||||
return EJDB2_VERSION_PATCH;
|
||||
}
|
||||
|
||||
static const char *_ejdb_ecodefn(locale_t locale, uint32_t ecode) {
|
||||
static const char* _ejdb_ecodefn(locale_t locale, uint32_t ecode) {
|
||||
if (!((ecode > _EJDB_ERROR_START) && (ecode < _EJDB_ERROR_END))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
+19
-4
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
* Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -99,7 +99,9 @@ typedef struct _EJDB_HTTP {
|
||||
Otherwise HTTP server will be started in background. */
|
||||
bool read_anon; /**< Allow anonymous read-only database access */
|
||||
size_t max_body_size; /**< Maximum WS/HTTP API body size. Default: 64Mb, Min: 512K */
|
||||
bool cors; /**< Allow CORS */
|
||||
bool cors; /**< Allow CORS */
|
||||
const char *ssl_private_key; /**< Path to TLS 1.2 private key PEM */
|
||||
const char *ssl_certs; /**< Path to TLS 1.2 certificates */
|
||||
} EJDB_HTTP;
|
||||
|
||||
/**
|
||||
@@ -467,6 +469,19 @@ IW_EXPORT WUR iwrc ejdb_merge_or_put_jbl(EJDB db, const char *coll, JBL patch, i
|
||||
*/
|
||||
IW_EXPORT WUR iwrc ejdb_put(EJDB db, const char *coll, JBL jbl, int64_t id);
|
||||
|
||||
/**
|
||||
* @brief Save a given `jbn` document under specified `id`.
|
||||
*
|
||||
* @param db Database handle. Not zero.
|
||||
* @param coll Collection name. Not zero.
|
||||
* @param jbn JSON document. Not zero.
|
||||
* @param id Document identifier. Not zero.
|
||||
*
|
||||
* @return `0` on success.
|
||||
* Any non zero error codes.
|
||||
*/
|
||||
IW_EXPORT WUR iwrc ejdb_put_jbn(EJDB db, const char *coll, JBL_NODE jbn, int64_t id);
|
||||
|
||||
/**
|
||||
* @brief Save a document into `coll` under new identifier.
|
||||
*
|
||||
@@ -676,12 +691,12 @@ IW_EXPORT iwrc ejdb_get_iwkv(EJDB db, IWKV *kvp);
|
||||
/**
|
||||
* @brief Return `\0` terminated ejdb2 source GIT revision hash.
|
||||
*/
|
||||
IW_EXPORT const char *ejdb_git_revision(void);
|
||||
IW_EXPORT const char* ejdb_git_revision(void);
|
||||
|
||||
/**
|
||||
* @brief Return `\0` terminated EJDB version string.
|
||||
*/
|
||||
IW_EXPORT const char *ejdb_version_full(void);
|
||||
IW_EXPORT const char* ejdb_version_full(void);
|
||||
|
||||
/**
|
||||
* @brief Return major library version.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
* Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -150,7 +150,7 @@ typedef iwrc (*JB_SCAN_CONSUMER)(
|
||||
int64_t *step, bool *matched, iwrc err);
|
||||
|
||||
/**
|
||||
* @brief Index can sorter consumer context
|
||||
* @brief Index scan sorter consumer context
|
||||
*/
|
||||
struct _JBSSC {
|
||||
iwrc rc; /**< RC code used for in `_jb_do_sorting` */
|
||||
|
||||
+3
-3
@@ -33,10 +33,10 @@
|
||||
#endif
|
||||
|
||||
#define EJDB2_GIT_REVISION ""
|
||||
#define EJDB2_VERSION "2.0.59"
|
||||
#define EJDB2_VERSION "2.72"
|
||||
#define EJDB2_VERSION_MAJOR 2
|
||||
#define EJDB2_VERSION_MINOR 0
|
||||
#define EJDB2_VERSION_PATCH 59
|
||||
#define EJDB2_VERSION_MINOR 72
|
||||
#define EJDB2_VERSION_PATCH 0
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
+7
-12
@@ -37,6 +37,7 @@ start:
|
||||
goto finish;
|
||||
}
|
||||
RCGO(rc, finish);
|
||||
|
||||
if (vsz > ctx->jblbufsz) {
|
||||
size_t nsize = MAX(vsz, ctx->jblbufsz * 2);
|
||||
void *nbuf = realloc(ctx->jblbuf, nsize);
|
||||
@@ -50,8 +51,7 @@ start:
|
||||
}
|
||||
}
|
||||
|
||||
rc = jbl_from_buf_keep_onstack(&jbl, ctx->jblbuf, vsz);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_from_buf_keep_onstack(&jbl, ctx->jblbuf, vsz));
|
||||
|
||||
rc = jql_matched(ux->q, &jbl, matched);
|
||||
if (rc || !*matched || (ux->skip && (ux->skip-- > 0))) {
|
||||
@@ -79,8 +79,7 @@ start:
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
rc = jbl_to_node(&jbl, &root, true, pool);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_to_node(&jbl, &root, true, pool));
|
||||
doc.node = root;
|
||||
if (aux->qmode & JQP_QRY_APPLY_DEL) {
|
||||
if (cur) {
|
||||
@@ -90,10 +89,8 @@ start:
|
||||
}
|
||||
} else if (aux->apply || aux->apply_placeholder) {
|
||||
struct _JBL sn = { 0 };
|
||||
rc = jql_apply(q, root, pool);
|
||||
RCGO(rc, finish);
|
||||
rc = _jbl_from_node(&sn, root);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jql_apply(q, root, pool));
|
||||
RCC(rc, finish, _jbl_from_node(&sn, root));
|
||||
if (cur) {
|
||||
rc = jb_cursor_set(ctx->jbc, cur, id, &sn);
|
||||
} else {
|
||||
@@ -103,8 +100,7 @@ start:
|
||||
}
|
||||
RCGO(rc, finish);
|
||||
if (aux->projection) {
|
||||
rc = jql_project(q, root, pool, ctx);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jql_project(q, root, pool, ctx));
|
||||
}
|
||||
} else if (aux->qmode & JQP_QRY_APPLY_DEL) {
|
||||
if (cur) {
|
||||
@@ -117,8 +113,7 @@ start:
|
||||
if (!(aux->qmode & JQP_QRY_AGGREGATE)) {
|
||||
do {
|
||||
ctx->istep = 1;
|
||||
rc = ux->visitor(ux, &doc, &ctx->istep);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, ux->visitor(ux, &doc, &ctx->istep));
|
||||
} while (ctx->istep == -1);
|
||||
}
|
||||
++ux->cnt;
|
||||
|
||||
+14
-26
@@ -33,14 +33,12 @@ static iwrc _jbi_consume_eq(struct _JBEXEC *ctx, JQVAL *jqval, JB_SCAN_CONSUMER
|
||||
}
|
||||
if (!step) {
|
||||
int64_t id;
|
||||
rc = iwkv_cursor_is_matched_key(cur, &key, &matched, &id);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_is_matched_key(cur, &key, &matched, &id));
|
||||
if (!matched) {
|
||||
break;
|
||||
}
|
||||
step = 1;
|
||||
rc = consumer(ctx, 0, id, &step, &matched, 0);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, consumer(ctx, 0, id, &step, &matched, 0));
|
||||
}
|
||||
} while (step && !(rc = iwkv_cursor_to(cur, step > 0 ? midx->cursor_step : cursor_reverse_step)));
|
||||
|
||||
@@ -106,8 +104,7 @@ static iwrc _jbi_consume_in_node(struct _JBEXEC *ctx, JQVAL *jqval, JB_SCAN_CONS
|
||||
if (cur) {
|
||||
iwkv_cursor_close(&cur);
|
||||
}
|
||||
rc = iwkv_cursor_open(idx->idb, &cur, IWKV_CURSOR_GE, &key);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_open(idx->idb, &cur, IWKV_CURSOR_GE, &key));
|
||||
do {
|
||||
if (step > 0) {
|
||||
--step;
|
||||
@@ -115,14 +112,12 @@ static iwrc _jbi_consume_in_node(struct _JBEXEC *ctx, JQVAL *jqval, JB_SCAN_CONS
|
||||
++step;
|
||||
}
|
||||
if (!step) {
|
||||
rc = iwkv_cursor_is_matched_key(cur, &key, &matched, &id);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_is_matched_key(cur, &key, &matched, &id));
|
||||
if (!matched) {
|
||||
break;
|
||||
}
|
||||
step = 1;
|
||||
rc = consumer(ctx, 0, id, &step, &matched, 0);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, consumer(ctx, 0, id, &step, &matched, 0));
|
||||
}
|
||||
} while (step && !(rc = iwkv_cursor_to(cur, IWKV_CURSOR_PREV))); // !!! only one direction
|
||||
}
|
||||
@@ -163,8 +158,7 @@ static iwrc _jbi_consume_scan(struct _JBEXEC *ctx, JQVAL *jqval, JB_SCAN_CONSUME
|
||||
key.compound = INT64_MAX;
|
||||
midx->cursor_init = IWKV_CURSOR_BEFORE_FIRST;
|
||||
midx->cursor_step = IWKV_CURSOR_NEXT;
|
||||
rc = iwkv_cursor_open(idx->idb, &cur, midx->cursor_init, 0);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_open(idx->idb, &cur, midx->cursor_init, 0));
|
||||
if (!midx->expr2) { // Fail fast
|
||||
midx->expr2 = midx->expr1;
|
||||
}
|
||||
@@ -173,8 +167,7 @@ static iwrc _jbi_consume_scan(struct _JBEXEC *ctx, JQVAL *jqval, JB_SCAN_CONSUME
|
||||
}
|
||||
|
||||
if (midx->cursor_init < IWKV_CURSOR_NEXT) { // IWKV_CURSOR_BEFORE_FIRST || IWKV_CURSOR_AFTER_LAST
|
||||
rc = iwkv_cursor_to(cur, midx->cursor_step);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_to(cur, midx->cursor_step));
|
||||
}
|
||||
|
||||
IWKV_cursor_op cursor_reverse_step = (midx->cursor_step == IWKV_CURSOR_PREV)
|
||||
@@ -188,8 +181,7 @@ static iwrc _jbi_consume_scan(struct _JBEXEC *ctx, JQVAL *jqval, JB_SCAN_CONSUME
|
||||
if (!step) {
|
||||
int64_t id;
|
||||
bool matched = false;
|
||||
rc = iwkv_cursor_copy_key(cur, 0, 0, &sz, &id);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_copy_key(cur, 0, 0, &sz, &id));
|
||||
if ( midx->expr2
|
||||
&& !midx->expr2->prematched
|
||||
&& !jbi_node_expr_matched(ctx->ux->q->aux, midx->idx, cur, midx->expr2, &rc)) {
|
||||
@@ -202,8 +194,7 @@ static iwrc _jbi_consume_scan(struct _JBEXEC *ctx, JQVAL *jqval, JB_SCAN_CONSUME
|
||||
RCGO(rc, finish);
|
||||
step = 1;
|
||||
if (id != prev_id) {
|
||||
rc = consumer(ctx, 0, id, &step, &matched, 0);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, consumer(ctx, 0, id, &step, &matched, 0));
|
||||
if (!midx->expr1->prematched && matched && (expr1_op != JQP_OP_PREFIX)) {
|
||||
// Further scan will always match main index expression
|
||||
midx->expr1->prematched = true;
|
||||
@@ -224,6 +215,7 @@ finish:
|
||||
}
|
||||
|
||||
static iwrc _jbi_consume_noxpr_scan(struct _JBEXEC *ctx, JB_SCAN_CONSUMER consumer) {
|
||||
iwrc rc;
|
||||
size_t sz;
|
||||
IWKV_cursor cur;
|
||||
int64_t step = 1, prev_id = 0;
|
||||
@@ -231,11 +223,9 @@ static iwrc _jbi_consume_noxpr_scan(struct _JBEXEC *ctx, JB_SCAN_CONSUMER consum
|
||||
IWKV_cursor_op cursor_reverse_step = (midx->cursor_step == IWKV_CURSOR_PREV)
|
||||
? IWKV_CURSOR_NEXT : IWKV_CURSOR_PREV;
|
||||
|
||||
iwrc rc = iwkv_cursor_open(midx->idx->idb, &cur, midx->cursor_init, 0);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_open(midx->idx->idb, &cur, midx->cursor_init, 0));
|
||||
if (midx->cursor_init < IWKV_CURSOR_NEXT) { // IWKV_CURSOR_BEFORE_FIRST || IWKV_CURSOR_AFTER_LAST
|
||||
rc = iwkv_cursor_to(cur, midx->cursor_step);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_to(cur, midx->cursor_step));
|
||||
}
|
||||
do {
|
||||
if (step > 0) {
|
||||
@@ -246,12 +236,10 @@ static iwrc _jbi_consume_noxpr_scan(struct _JBEXEC *ctx, JB_SCAN_CONSUMER consum
|
||||
if (!step) {
|
||||
int64_t id;
|
||||
bool matched;
|
||||
rc = iwkv_cursor_copy_key(cur, 0, 0, &sz, &id);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_copy_key(cur, 0, 0, &sz, &id));
|
||||
step = 1;
|
||||
if (id != prev_id) {
|
||||
rc = consumer(ctx, 0, id, &step, &matched, 0);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, consumer(ctx, 0, id, &step, &matched, 0));
|
||||
prev_id = step < 1 ? 0 : id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ static void _jbi_print_index(struct _JBIDX *idx, IWXSTR *xstr) {
|
||||
if (cnt++) {
|
||||
iwxstr_cat2(xstr, "|");
|
||||
}
|
||||
iwxstr_printf(xstr, "%lld ", idx->rnum);
|
||||
iwxstr_printf(xstr, "%" PRId64 " ", idx->rnum);
|
||||
jbl_ptr_serialize(idx->ptr, xstr);
|
||||
}
|
||||
|
||||
@@ -115,8 +115,8 @@ static bool _jbi_is_solid_node_expression(const JQP_NODE *n) {
|
||||
JQPUNIT *unit = n->value;
|
||||
for (const JQP_EXPR *expr = &unit->expr; expr; expr = expr->next) {
|
||||
if ( expr->op->negate
|
||||
|| (expr->join && (expr->join->negate || (expr->join->value == JQP_JOIN_OR) ))
|
||||
|| (expr->op->value == JQP_OP_RE) ) {
|
||||
|| (expr->join && (expr->join->negate || (expr->join->value == JQP_JOIN_OR)))
|
||||
|| (expr->op->value == JQP_OP_RE)) {
|
||||
// No negate conditions, No OR, No regexp
|
||||
return false;
|
||||
}
|
||||
@@ -154,10 +154,10 @@ static iwrc _jbi_compute_index_rules(JBEXEC *ctx, struct _JBMIDX *mctx) {
|
||||
continue;
|
||||
}
|
||||
int vcnt = 0;
|
||||
for (JBL_NODE n = rv->vnode->child; n; n = n->next, ++vcnt) ;
|
||||
for (JBL_NODE n = rv->vnode->child; n; n = n->next, ++vcnt);
|
||||
if ( (vcnt > JB_IDX_EMPIRIC_MIN_INOP_ARRAY_SIZE)
|
||||
&& ( (vcnt > JB_IDX_EMPIRIC_MAX_INOP_ARRAY_SIZE)
|
||||
|| (mctx->idx->rnum < rv->vbinn->count * JB_IDX_EMPIRIC_MAX_INOP_ARRAY_RATIO) )) {
|
||||
|| (mctx->idx->rnum < rv->vbinn->count * JB_IDX_EMPIRIC_MAX_INOP_ARRAY_RATIO))) {
|
||||
// No index for large IN array | small collection size
|
||||
continue;
|
||||
}
|
||||
@@ -267,8 +267,8 @@ static iwrc _jbi_collect_indexes(
|
||||
JBEXEC *ctx,
|
||||
const struct JQP_EXPR_NODE *en,
|
||||
struct _JBMIDX marr[static JB_SOLID_EXPRNUM],
|
||||
size_t *snp) {
|
||||
|
||||
size_t *snp
|
||||
) {
|
||||
iwrc rc = 0;
|
||||
if (*snp >= JB_SOLID_EXPRNUM - 1) {
|
||||
return 0;
|
||||
@@ -388,7 +388,7 @@ static int _jbi_idx_cmp(const void *o1, const void *o2) {
|
||||
return (d1->idx->ptr->cnt - d2->idx->ptr->cnt);
|
||||
}
|
||||
|
||||
static struct _JBIDX *_jbi_select_index_for_orderby(JBEXEC *ctx) {
|
||||
static struct _JBIDX* _jbi_select_index_for_orderby(JBEXEC *ctx) {
|
||||
struct JQP_AUX *aux = ctx->ux->q->aux;
|
||||
struct _JBL_PTR *obp = aux->orderby_ptrs[0];
|
||||
assert(obp);
|
||||
@@ -398,7 +398,7 @@ static struct _JBIDX *_jbi_select_index_for_orderby(JBEXEC *ctx) {
|
||||
continue;
|
||||
}
|
||||
int i = 0;
|
||||
for ( ; i < obp->cnt && !strcmp(ptr->n[i], obp->n[i]); ++i) ;
|
||||
for ( ; i < obp->cnt && !strcmp(ptr->n[i], obp->n[i]); ++i);
|
||||
if (i == obp->cnt) {
|
||||
memset(&ctx->midx, 0, sizeof(ctx->midx));
|
||||
if (!(obp->op & 1)) { // Asc sort
|
||||
|
||||
@@ -14,6 +14,7 @@ static void _jbi_scan_sorter_release(struct _JBEXEC *ctx) {
|
||||
|
||||
static int _jbi_scan_sorter_cmp(const void *o1, const void *o2, void *op) {
|
||||
int rv = 0;
|
||||
iwrc rc;
|
||||
uint32_t r1, r2;
|
||||
struct _JBL d1, d2;
|
||||
struct _JBEXEC *ctx = op;
|
||||
@@ -28,10 +29,8 @@ static int _jbi_scan_sorter_cmp(const void *o1, const void *o2, void *op) {
|
||||
p1 = ssc->docs + r1 + sizeof(uint64_t) /*id*/;
|
||||
p2 = ssc->docs + r2 + sizeof(uint64_t) /*id*/;
|
||||
|
||||
iwrc rc = jbl_from_buf_keep_onstack2(&d1, p1);
|
||||
RCGO(rc, finish);
|
||||
rc = jbl_from_buf_keep_onstack2(&d2, p2);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_from_buf_keep_onstack2(&d1, p1));
|
||||
RCC(rc, finish, jbl_from_buf_keep_onstack2(&d2, p2));
|
||||
|
||||
for (int i = 0; i < aux->orderby_num; ++i) {
|
||||
struct _JBL v1 = { 0 };
|
||||
@@ -61,7 +60,7 @@ static iwrc _jbi_scan_sorter_apply(IWPOOL *pool, struct _JBEXEC *ctx, JQL q, str
|
||||
iwrc rc = jbl_to_node(jbl, &root, true, pool);
|
||||
RCRET(rc);
|
||||
doc->node = root;
|
||||
if (aux->qmode & JQP_QRY_APPLY_DEL) {
|
||||
if (aux->qmode & JQP_QRY_APPLY_DEL) {
|
||||
rc = jb_del(ctx->jbc, jbl, doc->id);
|
||||
RCRET(rc);
|
||||
} else if (aux->apply || aux->apply_placeholder) {
|
||||
@@ -97,8 +96,7 @@ static iwrc _jbi_scan_sorter_do(struct _JBEXEC *ctx) {
|
||||
}
|
||||
if (!ssc->docs) {
|
||||
size_t sp;
|
||||
rc = ssc->sof.probe_mmap(&ssc->sof, 0, &ssc->docs, &sp);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, ssc->sof.probe_mmap(&ssc->sof, 0, &ssc->docs, &sp));
|
||||
}
|
||||
|
||||
sort_r(ssc->refs, rnum, sizeof(ssc->refs[0]), _jbi_scan_sorter_cmp, ctx);
|
||||
@@ -108,12 +106,13 @@ static iwrc _jbi_scan_sorter_do(struct _JBEXEC *ctx) {
|
||||
uint8_t *rp = ssc->docs + ssc->refs[i];
|
||||
memcpy(&id, rp, sizeof(id));
|
||||
rp += sizeof(id);
|
||||
rc = jbl_from_buf_keep_onstack2(&jbl, rp);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_from_buf_keep_onstack2(&jbl, rp));
|
||||
|
||||
struct _EJDB_DOC doc = {
|
||||
.id = id,
|
||||
.raw = &jbl
|
||||
};
|
||||
|
||||
if (aux->apply || aux->projection) {
|
||||
if (!pool) {
|
||||
pool = iwpool_create(jbl.bn.size * 2);
|
||||
@@ -122,19 +121,18 @@ static iwrc _jbi_scan_sorter_do(struct _JBEXEC *ctx) {
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
rc = _jbi_scan_sorter_apply(pool, ctx, ux->q, &doc);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, _jbi_scan_sorter_apply(pool, ctx, ux->q, &doc));
|
||||
} else if (aux->qmode & JQP_QRY_APPLY_DEL) {
|
||||
rc = jb_del(ctx->jbc, &jbl, id);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jb_del(ctx->jbc, &jbl, id));
|
||||
}
|
||||
|
||||
if (!(aux->qmode & JQP_QRY_AGGREGATE)) {
|
||||
do {
|
||||
step = 1;
|
||||
rc = ux->visitor(ux, &doc, &step);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, ux->visitor(ux, &doc, &step));
|
||||
} while (step == -1);
|
||||
}
|
||||
|
||||
++ux->cnt;
|
||||
i += step;
|
||||
if (pool != ux->pool) {
|
||||
@@ -174,7 +172,8 @@ static iwrc _jbi_scan_sorter_init(struct _JBSSC *ssc, off_t initial_size) {
|
||||
|
||||
iwrc jbi_sorter_consumer(
|
||||
struct _JBEXEC *ctx, IWKV_cursor cur, int64_t id,
|
||||
int64_t *step, bool *matched, iwrc err) {
|
||||
int64_t *step, bool *matched, iwrc err
|
||||
) {
|
||||
if (!id) {
|
||||
// End of scan
|
||||
if (err) {
|
||||
|
||||
+10
-18
@@ -67,8 +67,7 @@ static iwrc _jbi_consume_in_node(struct _JBEXEC *ctx, JQVAL *jqval, JB_SCAN_CONS
|
||||
if (!step) {
|
||||
IW_READVNUMBUF64_2(numbuf, id);
|
||||
step = 1;
|
||||
rc = consumer(ctx, 0, id, &step, &matched, 0);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, consumer(ctx, 0, id, &step, &matched, 0));
|
||||
}
|
||||
} while (step && (step > 0 ? (nv = nv->next) : (nv = nv->prev)));
|
||||
|
||||
@@ -94,8 +93,7 @@ static iwrc _jbi_consume_scan(struct _JBEXEC *ctx, JQVAL *jqval, JB_SCAN_CONSUME
|
||||
iwkv_cursor_close(&cur);
|
||||
midx->cursor_init = IWKV_CURSOR_BEFORE_FIRST;
|
||||
midx->cursor_step = IWKV_CURSOR_NEXT;
|
||||
rc = iwkv_cursor_open(idx->idb, &cur, midx->cursor_init, 0);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_open(idx->idb, &cur, midx->cursor_init, 0));
|
||||
if (!midx->expr2) { // Fail fast
|
||||
midx->expr2 = midx->expr1;
|
||||
}
|
||||
@@ -107,8 +105,7 @@ static iwrc _jbi_consume_scan(struct _JBEXEC *ctx, JQVAL *jqval, JB_SCAN_CONSUME
|
||||
? IWKV_CURSOR_PREV : IWKV_CURSOR_NEXT;
|
||||
|
||||
if (midx->cursor_init < IWKV_CURSOR_NEXT) { // IWKV_CURSOR_BEFORE_FIRST || IWKV_CURSOR_AFTER_LAST
|
||||
rc = iwkv_cursor_to(cur, midx->cursor_step);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_to(cur, midx->cursor_step));
|
||||
}
|
||||
do {
|
||||
if (step > 0) {
|
||||
@@ -119,8 +116,7 @@ static iwrc _jbi_consume_scan(struct _JBEXEC *ctx, JQVAL *jqval, JB_SCAN_CONSUME
|
||||
if (!step) {
|
||||
int64_t id;
|
||||
bool matched = false;
|
||||
rc = iwkv_cursor_copy_val(cur, &numbuf, IW_VNUMBUFSZ, &sz);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_copy_val(cur, &numbuf, IW_VNUMBUFSZ, &sz));
|
||||
if (sz > IW_VNUMBUFSZ) {
|
||||
rc = IWKV_ERROR_CORRUPTED;
|
||||
iwlog_ecode_error3(rc);
|
||||
@@ -139,8 +135,7 @@ static iwrc _jbi_consume_scan(struct _JBEXEC *ctx, JQVAL *jqval, JB_SCAN_CONSUME
|
||||
RCGO(rc, finish);
|
||||
|
||||
step = 1;
|
||||
rc = consumer(ctx, 0, id, &step, &matched, 0);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, consumer(ctx, 0, id, &step, &matched, 0));
|
||||
if (!midx->expr1->prematched && matched && (expr1_op != JQP_OP_PREFIX)) {
|
||||
// Further scan will always match the main index expression
|
||||
midx->expr1->prematched = true;
|
||||
@@ -159,6 +154,7 @@ finish:
|
||||
}
|
||||
|
||||
iwrc _jbi_consume_noxpr_scan(struct _JBEXEC *ctx, JB_SCAN_CONSUMER consumer) {
|
||||
iwrc rc;
|
||||
size_t sz;
|
||||
IWKV_cursor cur;
|
||||
char numbuf[JBNUMBUF_SIZE];
|
||||
@@ -167,11 +163,9 @@ iwrc _jbi_consume_noxpr_scan(struct _JBEXEC *ctx, JB_SCAN_CONSUMER consumer) {
|
||||
IWKV_cursor_op cursor_reverse_step = (midx->cursor_step == IWKV_CURSOR_NEXT)
|
||||
? IWKV_CURSOR_PREV : IWKV_CURSOR_NEXT;
|
||||
|
||||
iwrc rc = iwkv_cursor_open(midx->idx->idb, &cur, midx->cursor_init, 0);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_open(midx->idx->idb, &cur, midx->cursor_init, 0));
|
||||
if (midx->cursor_init < IWKV_CURSOR_NEXT) { // IWKV_CURSOR_BEFORE_FIRST || IWKV_CURSOR_AFTER_LAST
|
||||
rc = iwkv_cursor_to(cur, midx->cursor_step);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_to(cur, midx->cursor_step));
|
||||
}
|
||||
do {
|
||||
if (step > 0) {
|
||||
@@ -182,8 +176,7 @@ iwrc _jbi_consume_noxpr_scan(struct _JBEXEC *ctx, JB_SCAN_CONSUMER consumer) {
|
||||
if (!step) {
|
||||
int64_t id;
|
||||
bool matched;
|
||||
rc = iwkv_cursor_copy_val(cur, &numbuf, IW_VNUMBUFSZ, &sz);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, iwkv_cursor_copy_val(cur, &numbuf, IW_VNUMBUFSZ, &sz));
|
||||
if (sz > IW_VNUMBUFSZ) {
|
||||
rc = IWKV_ERROR_CORRUPTED;
|
||||
iwlog_ecode_error3(rc);
|
||||
@@ -192,8 +185,7 @@ iwrc _jbi_consume_noxpr_scan(struct _JBEXEC *ctx, JB_SCAN_CONSUMER consumer) {
|
||||
IW_READVNUMBUF64_2(numbuf, id);
|
||||
RCGO(rc, finish);
|
||||
step = 1;
|
||||
rc = consumer(ctx, 0, id, &step, &matched, 0);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, consumer(ctx, 0, id, &step, &matched, 0));
|
||||
}
|
||||
} while (step && !(rc = iwkv_cursor_to(cur, step > 0 ? midx->cursor_step : cursor_reverse_step)));
|
||||
|
||||
|
||||
+49
-49
@@ -81,11 +81,11 @@ void binn_set_alloc_functions(
|
||||
free_fn = new_free;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void *binn_malloc(int size) {
|
||||
IW_INLINE void* binn_malloc(int size) {
|
||||
return malloc_fn(size);
|
||||
}
|
||||
|
||||
BINN_PRIVATE void *binn_memdup(const void *src, int size) {
|
||||
BINN_PRIVATE void* binn_memdup(const void *src, int size) {
|
||||
void *dest;
|
||||
if ((src == NULL) || (size <= 0)) {
|
||||
return NULL;
|
||||
@@ -210,7 +210,7 @@ loc_exit:
|
||||
return retval;
|
||||
}
|
||||
|
||||
binn *binn_new(int type, int size, void *pointer) {
|
||||
binn* binn_new(int type, int size, void *pointer) {
|
||||
binn *item;
|
||||
item = (binn*) binn_malloc(sizeof(binn));
|
||||
if (binn_create(item, type, size, pointer) == FALSE) {
|
||||
@@ -233,15 +233,15 @@ BOOL binn_create_object(binn *object) {
|
||||
return binn_create(object, BINN_OBJECT, 0, NULL);
|
||||
}
|
||||
|
||||
binn *binn_list() {
|
||||
binn* binn_list() {
|
||||
return binn_new(BINN_LIST, 0, 0);
|
||||
}
|
||||
|
||||
binn *binn_map() {
|
||||
binn* binn_map() {
|
||||
return binn_new(BINN_MAP, 0, 0);
|
||||
}
|
||||
|
||||
binn *binn_object() {
|
||||
binn* binn_object() {
|
||||
return binn_new(BINN_OBJECT, 0, 0);
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ BOOL binn_load(void *data, binn *value) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
binn *binn_open(void *data) {
|
||||
binn* binn_open(void *data) {
|
||||
binn *item;
|
||||
item = (binn*) binn_malloc(sizeof(binn));
|
||||
if (binn_load(data, item) == FALSE) {
|
||||
@@ -341,7 +341,7 @@ BINN_PRIVATE int get_storage_size(int storage_type) {
|
||||
|
||||
#endif
|
||||
|
||||
BINN_PRIVATE unsigned char *AdvanceDataPos(unsigned char *p, unsigned char *plimit) {
|
||||
BINN_PRIVATE unsigned char* AdvanceDataPos(unsigned char *p, unsigned char *plimit) {
|
||||
unsigned char byte;
|
||||
int storage_type, dsize;
|
||||
if (p > plimit) {
|
||||
@@ -422,7 +422,7 @@ BINN_PRIVATE unsigned char *AdvanceDataPos(unsigned char *p, unsigned char *plim
|
||||
return p;
|
||||
}
|
||||
|
||||
BINN_PRIVATE unsigned char *SearchForID(unsigned char *p, int header_size, int size, int numitems, int id) {
|
||||
BINN_PRIVATE unsigned char* SearchForID(unsigned char *p, int header_size, int size, int numitems, int id) {
|
||||
unsigned char *plimit, *base;
|
||||
int i, int32;
|
||||
|
||||
@@ -451,7 +451,7 @@ BINN_PRIVATE unsigned char *SearchForID(unsigned char *p, int header_size, int s
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BINN_PRIVATE unsigned char *SearchForKey(
|
||||
BINN_PRIVATE unsigned char* SearchForKey(
|
||||
unsigned char *p, int header_size, int size, int numitems, const char *key,
|
||||
int keylen) {
|
||||
unsigned char len, *plimit, *base;
|
||||
@@ -573,7 +573,7 @@ BINN_PRIVATE BOOL binn_map_set_raw(binn *item, int id, int type, void *pvalue, i
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BINN_PRIVATE void *compress_int(int *pstorage_type, int *ptype, void *psource) {
|
||||
BINN_PRIVATE void* compress_int(int *pstorage_type, int *ptype, void *psource) {
|
||||
int storage_type, storage_type2, type, type2 = 0;
|
||||
int64 vint = 0;
|
||||
uint64 vuint;
|
||||
@@ -907,7 +907,7 @@ void binn_free(binn *item) {
|
||||
|
||||
// free the binn structure but keeps the binn buffer allocated, returning a pointer to it. use the free function to
|
||||
// release the buffer later
|
||||
void *binn_release(binn *item) {
|
||||
void* binn_release(binn *item) {
|
||||
void *data;
|
||||
if (item == NULL) {
|
||||
return NULL;
|
||||
@@ -1012,7 +1012,7 @@ BINN_PRIVATE BOOL IsValidBinnHeader(const void *pbuf, int *ptype, int *pcount, i
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
binn *binn_copy(void *old) {
|
||||
binn* binn_copy(void *old) {
|
||||
int type, count, size, header_size;
|
||||
unsigned char *old_ptr = binn_ptr(old);
|
||||
binn *item;
|
||||
@@ -1059,7 +1059,7 @@ int binn_buf_size(const void *pbuf) {
|
||||
return size;
|
||||
}
|
||||
|
||||
void *binn_ptr(void *ptr) {
|
||||
void* binn_ptr(void *ptr) {
|
||||
binn *item;
|
||||
switch (binn_get_ptr_type(ptr)) {
|
||||
case BINN_STRUCT:
|
||||
@@ -1344,7 +1344,7 @@ BINN_PRIVATE BOOL GetValue(unsigned char *p, binn *value) {
|
||||
|
||||
binn local_value;
|
||||
|
||||
BINN_PRIVATE void *store_value(binn *value) {
|
||||
BINN_PRIVATE void* store_value(binn *value) {
|
||||
memcpy(&local_value, value, sizeof(binn));
|
||||
switch (binn_get_read_storage(value->type)) {
|
||||
case BINN_STORAGE_NOBYTES:
|
||||
@@ -1542,7 +1542,7 @@ BOOL binn_object_get_pair(void *ptr, int pos, char *pkey, binn *value) {
|
||||
return binn_read_pair(BINN_OBJECT, ptr, pos, NULL, pkey, value);
|
||||
}
|
||||
|
||||
binn *binn_map_pair(void *map, int pos, int *pid) {
|
||||
binn* binn_map_pair(void *map, int pos, int *pid) {
|
||||
binn *value;
|
||||
value = (binn*) binn_malloc(sizeof(binn));
|
||||
if (binn_read_pair(BINN_MAP, map, pos, pid, NULL, value) == FALSE) {
|
||||
@@ -1553,7 +1553,7 @@ binn *binn_map_pair(void *map, int pos, int *pid) {
|
||||
return value;
|
||||
}
|
||||
|
||||
binn *binn_object_pair(void *obj, int pos, char *pkey) {
|
||||
binn* binn_object_pair(void *obj, int pos, char *pkey) {
|
||||
binn *value;
|
||||
value = (binn*) binn_malloc(sizeof(binn));
|
||||
if (binn_read_pair(BINN_OBJECT, obj, pos, NULL, pkey, value) == FALSE) {
|
||||
@@ -1564,7 +1564,7 @@ binn *binn_object_pair(void *obj, int pos, char *pkey) {
|
||||
return value;
|
||||
}
|
||||
|
||||
void *binn_map_read_pair(void *ptr, int pos, int *pid, int *ptype, int *psize) {
|
||||
void* binn_map_read_pair(void *ptr, int pos, int *pid, int *ptype, int *psize) {
|
||||
binn value;
|
||||
|
||||
if (binn_map_get_pair(ptr, pos, pid, &value) == FALSE) {
|
||||
@@ -1583,7 +1583,7 @@ void *binn_map_read_pair(void *ptr, int pos, int *pid, int *ptype, int *psize) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void *binn_object_read_pair(void *ptr, int pos, char *pkey, int *ptype, int *psize) {
|
||||
void* binn_object_read_pair(void *ptr, int pos, char *pkey, int *ptype, int *psize) {
|
||||
binn value;
|
||||
|
||||
if (binn_object_get_pair(ptr, pos, pkey, &value) == FALSE) {
|
||||
@@ -1778,7 +1778,7 @@ BOOL binn_object_next2(binn_iter *iter, char **pkey, int *klen, binn *value) {
|
||||
return binn_read_next_pair2(BINN_OBJECT, iter, klen, pkey, value);
|
||||
}
|
||||
|
||||
binn *binn_list_next_value(binn_iter *iter) {
|
||||
binn* binn_list_next_value(binn_iter *iter) {
|
||||
binn *value;
|
||||
value = (binn*) binn_malloc(sizeof(binn));
|
||||
if (binn_list_next(iter, value) == FALSE) {
|
||||
@@ -1789,7 +1789,7 @@ binn *binn_list_next_value(binn_iter *iter) {
|
||||
return value;
|
||||
}
|
||||
|
||||
binn *binn_map_next_value(binn_iter *iter, int *pid) {
|
||||
binn* binn_map_next_value(binn_iter *iter, int *pid) {
|
||||
binn *value;
|
||||
value = (binn*) binn_malloc(sizeof(binn));
|
||||
if (binn_map_next(iter, pid, value) == FALSE) {
|
||||
@@ -1800,7 +1800,7 @@ binn *binn_map_next_value(binn_iter *iter, int *pid) {
|
||||
return value;
|
||||
}
|
||||
|
||||
binn *binn_object_next_value(binn_iter *iter, char *pkey) {
|
||||
binn* binn_object_next_value(binn_iter *iter, char *pkey) {
|
||||
binn *value;
|
||||
value = (binn*) binn_malloc(sizeof(binn));
|
||||
if (binn_object_next(iter, pkey, value) == FALSE) {
|
||||
@@ -1811,7 +1811,7 @@ binn *binn_object_next_value(binn_iter *iter, char *pkey) {
|
||||
return value;
|
||||
}
|
||||
|
||||
void *binn_list_read_next(binn_iter *iter, int *ptype, int *psize) {
|
||||
void* binn_list_read_next(binn_iter *iter, int *ptype, int *psize) {
|
||||
binn value;
|
||||
if (binn_list_next(iter, &value) == FALSE) {
|
||||
return NULL;
|
||||
@@ -1829,7 +1829,7 @@ void *binn_list_read_next(binn_iter *iter, int *ptype, int *psize) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void *binn_map_read_next(binn_iter *iter, int *pid, int *ptype, int *psize) {
|
||||
void* binn_map_read_next(binn_iter *iter, int *pid, int *ptype, int *psize) {
|
||||
binn value;
|
||||
if (binn_map_next(iter, pid, &value) == FALSE) {
|
||||
return NULL;
|
||||
@@ -1847,7 +1847,7 @@ void *binn_map_read_next(binn_iter *iter, int *pid, int *ptype, int *psize) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void *binn_object_read_next(binn_iter *iter, char *pkey, int *ptype, int *psize) {
|
||||
void* binn_object_read_next(binn_iter *iter, char *pkey, int *ptype, int *psize) {
|
||||
binn value;
|
||||
|
||||
if (binn_object_next(iter, pkey, &value) == FALSE) {
|
||||
@@ -2295,7 +2295,7 @@ BOOL binn_object_set_new2(binn *obj, const char *key, int keylen, binn *value) {
|
||||
|
||||
/*** READ FUNCTIONS ******************************************************************/
|
||||
|
||||
binn *binn_list_value(void *ptr, int pos) {
|
||||
binn* binn_list_value(void *ptr, int pos) {
|
||||
binn *value;
|
||||
value = (binn*) binn_malloc(sizeof(binn));
|
||||
if (binn_list_get_value(ptr, pos, value) == FALSE) {
|
||||
@@ -2306,7 +2306,7 @@ binn *binn_list_value(void *ptr, int pos) {
|
||||
return value;
|
||||
}
|
||||
|
||||
binn *binn_map_value(void *ptr, int id) {
|
||||
binn* binn_map_value(void *ptr, int id) {
|
||||
binn *value;
|
||||
value = (binn*) binn_malloc(sizeof(binn));
|
||||
if (binn_map_get_value(ptr, id, value) == FALSE) {
|
||||
@@ -2317,7 +2317,7 @@ binn *binn_map_value(void *ptr, int id) {
|
||||
return value;
|
||||
}
|
||||
|
||||
binn *binn_object_value(void *ptr, const char *key) {
|
||||
binn* binn_object_value(void *ptr, const char *key) {
|
||||
binn *value;
|
||||
value = (binn*) binn_malloc(sizeof(binn));
|
||||
if (binn_object_get_value(ptr, key, value) == FALSE) {
|
||||
@@ -2328,7 +2328,7 @@ binn *binn_object_value(void *ptr, const char *key) {
|
||||
return value;
|
||||
}
|
||||
|
||||
void *binn_list_read(void *list, int pos, int *ptype, int *psize) {
|
||||
void* binn_list_read(void *list, int pos, int *ptype, int *psize) {
|
||||
binn value;
|
||||
if (binn_list_get_value(list, pos, &value) == FALSE) {
|
||||
return NULL;
|
||||
@@ -2346,7 +2346,7 @@ void *binn_list_read(void *list, int pos, int *ptype, int *psize) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void *binn_map_read(void *map, int id, int *ptype, int *psize) {
|
||||
void* binn_map_read(void *map, int id, int *ptype, int *psize) {
|
||||
binn value;
|
||||
if (binn_map_get_value(map, id, &value) == FALSE) {
|
||||
return NULL;
|
||||
@@ -2364,7 +2364,7 @@ void *binn_map_read(void *map, int id, int *ptype, int *psize) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void *binn_object_read(void *obj, const char *key, int *ptype, int *psize) {
|
||||
void* binn_object_read(void *obj, const char *key, int *ptype, int *psize) {
|
||||
binn value;
|
||||
if (binn_object_get_value(obj, key, &value) == FALSE) {
|
||||
return NULL;
|
||||
@@ -2519,31 +2519,31 @@ BOOL binn_list_null(void *list, int pos) {
|
||||
return binn_list_get(list, pos, BINN_NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
char *binn_list_str(void *list, int pos) {
|
||||
char* binn_list_str(void *list, int pos) {
|
||||
char *value;
|
||||
binn_list_get(list, pos, BINN_STRING, &value, NULL);
|
||||
return value;
|
||||
}
|
||||
|
||||
void *binn_list_blob(void *list, int pos, int *psize) {
|
||||
void* binn_list_blob(void *list, int pos, int *psize) {
|
||||
void *value;
|
||||
binn_list_get(list, pos, BINN_BLOB, &value, psize);
|
||||
return value;
|
||||
}
|
||||
|
||||
void *binn_list_list(void *list, int pos) {
|
||||
void* binn_list_list(void *list, int pos) {
|
||||
void *value;
|
||||
binn_list_get(list, pos, BINN_LIST, &value, NULL);
|
||||
return value;
|
||||
}
|
||||
|
||||
void *binn_list_map(void *list, int pos) {
|
||||
void* binn_list_map(void *list, int pos) {
|
||||
void *value;
|
||||
binn_list_get(list, pos, BINN_MAP, &value, NULL);
|
||||
return value;
|
||||
}
|
||||
|
||||
void *binn_list_object(void *list, int pos) {
|
||||
void* binn_list_object(void *list, int pos) {
|
||||
void *value;
|
||||
binn_list_get(list, pos, BINN_OBJECT, &value, NULL);
|
||||
return value;
|
||||
@@ -2619,31 +2619,31 @@ BOOL binn_map_null(void *map, int id) {
|
||||
return binn_map_get(map, id, BINN_NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
char *binn_map_str(void *map, int id) {
|
||||
char* binn_map_str(void *map, int id) {
|
||||
char *value;
|
||||
binn_map_get(map, id, BINN_STRING, &value, NULL);
|
||||
return value;
|
||||
}
|
||||
|
||||
void *binn_map_blob(void *map, int id, int *psize) {
|
||||
void* binn_map_blob(void *map, int id, int *psize) {
|
||||
void *value;
|
||||
binn_map_get(map, id, BINN_BLOB, &value, psize);
|
||||
return value;
|
||||
}
|
||||
|
||||
void *binn_map_list(void *map, int id) {
|
||||
void* binn_map_list(void *map, int id) {
|
||||
void *value;
|
||||
binn_map_get(map, id, BINN_LIST, &value, NULL);
|
||||
return value;
|
||||
}
|
||||
|
||||
void *binn_map_map(void *map, int id) {
|
||||
void* binn_map_map(void *map, int id) {
|
||||
void *value;
|
||||
binn_map_get(map, id, BINN_MAP, &value, NULL);
|
||||
return value;
|
||||
}
|
||||
|
||||
void *binn_map_object(void *map, int id) {
|
||||
void* binn_map_object(void *map, int id) {
|
||||
void *value;
|
||||
binn_map_get(map, id, BINN_OBJECT, &value, NULL);
|
||||
return value;
|
||||
@@ -2719,37 +2719,37 @@ BOOL binn_object_null(void *obj, const char *key) {
|
||||
return binn_object_get(obj, key, BINN_NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
char *binn_object_str(void *obj, const char *key) {
|
||||
char* binn_object_str(void *obj, const char *key) {
|
||||
char *value;
|
||||
binn_object_get(obj, key, BINN_STRING, &value, NULL);
|
||||
return value;
|
||||
}
|
||||
|
||||
void *binn_object_blob(void *obj, const char *key, int *psize) {
|
||||
void* binn_object_blob(void *obj, const char *key, int *psize) {
|
||||
void *value;
|
||||
binn_object_get(obj, key, BINN_BLOB, &value, psize);
|
||||
return value;
|
||||
}
|
||||
|
||||
void *binn_object_list(void *obj, const char *key) {
|
||||
void* binn_object_list(void *obj, const char *key) {
|
||||
void *value;
|
||||
binn_object_get(obj, key, BINN_LIST, &value, NULL);
|
||||
return value;
|
||||
}
|
||||
|
||||
void *binn_object_map(void *obj, const char *key) {
|
||||
void* binn_object_map(void *obj, const char *key) {
|
||||
void *value;
|
||||
binn_object_get(obj, key, BINN_MAP, &value, NULL);
|
||||
return value;
|
||||
}
|
||||
|
||||
void *binn_object_object(void *obj, const char *key) {
|
||||
void* binn_object_object(void *obj, const char *key) {
|
||||
void *value;
|
||||
binn_object_get(obj, key, BINN_OBJECT, &value, NULL);
|
||||
return value;
|
||||
}
|
||||
|
||||
BINN_PRIVATE binn *binn_alloc_item() {
|
||||
BINN_PRIVATE binn* binn_alloc_item() {
|
||||
binn *item;
|
||||
item = (binn*) binn_malloc(sizeof(binn));
|
||||
if (item) {
|
||||
@@ -2760,7 +2760,7 @@ BINN_PRIVATE binn *binn_alloc_item() {
|
||||
return item;
|
||||
}
|
||||
|
||||
binn *binn_value(int type, void *pvalue, int size, binn_mem_free freefn) {
|
||||
binn* binn_value(int type, void *pvalue, int size, binn_mem_free freefn) {
|
||||
int storage_type;
|
||||
binn *item = binn_alloc_item();
|
||||
if (item) {
|
||||
@@ -3088,7 +3088,7 @@ BOOL binn_get_bool(binn *value, BOOL *pbool) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char *binn_get_str(binn *value) {
|
||||
char* binn_get_str(binn *value) {
|
||||
int64 vint;
|
||||
char buf[128];
|
||||
if (value == NULL) {
|
||||
|
||||
+161
-171
@@ -22,9 +22,8 @@
|
||||
#ifndef BINN_H
|
||||
#define BINN_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <ejdb2/iowow/basedefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -58,15 +57,6 @@ typedef int BOOL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define INLINE __inline
|
||||
#define ALWAYS_INLINE __forceinline
|
||||
#else
|
||||
// you can change to 'extern inline' if using the gcc option -flto
|
||||
#define INLINE static inline
|
||||
#define ALWAYS_INLINE static inline __attribute__((always_inline))
|
||||
#endif
|
||||
|
||||
#ifndef int64
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
typedef __int64 int64;
|
||||
@@ -278,10 +268,10 @@ void binn_set_user_data(binn *item, void *user_data, binn_user_data_free freefn)
|
||||
BOOL binn_save_header(binn *item);
|
||||
|
||||
// create a new binn allocating memory for the structure
|
||||
binn *binn_new(int type, int size, void *buffer);
|
||||
binn *binn_list();
|
||||
binn *binn_map();
|
||||
binn *binn_object();
|
||||
IW_ALLOC binn* binn_new(int type, int size, void *buffer);
|
||||
IW_ALLOC binn* binn_list();
|
||||
IW_ALLOC binn* binn_map();
|
||||
IW_ALLOC binn* binn_object();
|
||||
|
||||
// create a new binn storing the structure on the stack
|
||||
BOOL binn_create(binn *item, int type, int size, void *buffer);
|
||||
@@ -290,7 +280,7 @@ BOOL binn_create_map(binn *map);
|
||||
BOOL binn_create_object(binn *object);
|
||||
|
||||
// create a new binn as a copy from another
|
||||
binn *binn_copy(void *old);
|
||||
IW_ALLOC binn* binn_copy(void *old);
|
||||
|
||||
BOOL binn_list_add_new(binn *list, binn *value);
|
||||
BOOL binn_map_set_new(binn *map, int id, binn *value);
|
||||
@@ -308,77 +298,77 @@ void binn_free(binn *item);
|
||||
|
||||
// free the binn structure but keeps the binn buffer allocated, returning a pointer to it.
|
||||
// use the free function to release the buffer later
|
||||
void *binn_release(binn *item);
|
||||
void* binn_release(binn *item);
|
||||
|
||||
// --- CREATING VALUES ---------------------------------------------------
|
||||
|
||||
binn *binn_value(int type, void *pvalue, int size, binn_mem_free freefn);
|
||||
IW_ALLOC binn* binn_value(int type, void *pvalue, int size, binn_mem_free freefn);
|
||||
|
||||
ALWAYS_INLINE void binn_init_item(binn *item) {
|
||||
IW_INLINE void binn_init_item(binn *item) {
|
||||
memset(item, 0, sizeof(binn));
|
||||
item->header = BINN_MAGIC;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE binn *binn_int8(signed char value) {
|
||||
IW_ALLOC IW_INLINE binn* binn_int8(signed char value) {
|
||||
return binn_value(BINN_INT8, &value, 0, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE binn *binn_int16(short value) {
|
||||
IW_ALLOC IW_INLINE binn* binn_int16(short value) {
|
||||
return binn_value(BINN_INT16, &value, 0, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE binn *binn_int32(int value) {
|
||||
IW_ALLOC IW_INLINE binn* binn_int32(int value) {
|
||||
return binn_value(BINN_INT32, &value, 0, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE binn *binn_int64(int64 value) {
|
||||
IW_ALLOC IW_INLINE binn* binn_int64(int64 value) {
|
||||
return binn_value(BINN_INT64, &value, 0, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE binn *binn_uint8(unsigned char value) {
|
||||
IW_ALLOC IW_INLINE binn* binn_uint8(unsigned char value) {
|
||||
return binn_value(BINN_UINT8, &value, 0, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE binn *binn_uint16(unsigned short value) {
|
||||
IW_ALLOC IW_INLINE binn* binn_uint16(unsigned short value) {
|
||||
return binn_value(BINN_UINT16, &value, 0, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE binn *binn_uint32(unsigned int value) {
|
||||
IW_ALLOC IW_INLINE binn* binn_uint32(unsigned int value) {
|
||||
return binn_value(BINN_UINT32, &value, 0, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE binn *binn_uint64(uint64 value) {
|
||||
IW_ALLOC IW_INLINE binn* binn_uint64(uint64 value) {
|
||||
return binn_value(BINN_UINT64, &value, 0, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE binn *binn_float(float value) {
|
||||
IW_ALLOC IW_INLINE binn* binn_float(float value) {
|
||||
return binn_value(BINN_FLOAT, &value, 0, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE binn *binn_double(double value) {
|
||||
IW_ALLOC IW_INLINE binn* binn_double(double value) {
|
||||
return binn_value(BINN_DOUBLE, &value, 0, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE binn *binn_bool(BOOL value) {
|
||||
IW_ALLOC IW_INLINE binn* binn_bool(BOOL value) {
|
||||
return binn_value(BINN_BOOL, &value, 0, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE binn *binn_null() {
|
||||
IW_ALLOC IW_INLINE binn* binn_null() {
|
||||
return binn_value(BINN_NULL, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE binn *binn_string(const char *str, binn_mem_free freefn) {
|
||||
IW_ALLOC IW_INLINE binn* binn_string(const char *str, binn_mem_free freefn) {
|
||||
return binn_value(BINN_STRING, (void*) str, 0, freefn);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE binn *binn_blob(void *ptr, int size, binn_mem_free freefn) {
|
||||
IW_ALLOC IW_INLINE binn* binn_blob(void *ptr, int size, binn_mem_free freefn) {
|
||||
return binn_value(BINN_BLOB, ptr, size, freefn);
|
||||
}
|
||||
|
||||
// --- READ FUNCTIONS -------------------------------------------------------------
|
||||
|
||||
// these functions accept pointer to the binn structure and pointer to the binn buffer
|
||||
void *binn_ptr(void *ptr);
|
||||
void* binn_ptr(void *ptr);
|
||||
int binn_size(void *ptr);
|
||||
int binn_buf_size(const void *ptr);
|
||||
int binn_type(void *ptr);
|
||||
@@ -410,7 +400,7 @@ BOOL binn_is_struct(void *ptr);
|
||||
// Loading a binn buffer into a binn value - this is optional
|
||||
|
||||
BOOL binn_load(void *data, binn *item); // on stack
|
||||
binn *binn_open(void *data); // allocated
|
||||
binn* binn_open(void *data); // allocated
|
||||
|
||||
// easiest interface to use, but don't check if the value is there
|
||||
|
||||
@@ -426,11 +416,11 @@ float binn_list_float(void *list, int pos);
|
||||
double binn_list_double(void *list, int pos);
|
||||
BOOL binn_list_bool(void *list, int pos);
|
||||
BOOL binn_list_null(void *list, int pos);
|
||||
char *binn_list_str(void *list, int pos);
|
||||
void *binn_list_blob(void *list, int pos, int *psize);
|
||||
void *binn_list_list(void *list, int pos);
|
||||
void *binn_list_map(void *list, int pos);
|
||||
void *binn_list_object(void *list, int pos);
|
||||
char* binn_list_str(void *list, int pos);
|
||||
void* binn_list_blob(void *list, int pos, int *psize);
|
||||
void* binn_list_list(void *list, int pos);
|
||||
void* binn_list_map(void *list, int pos);
|
||||
void* binn_list_object(void *list, int pos);
|
||||
|
||||
signed char binn_map_int8(void *map, int id);
|
||||
short binn_map_int16(void *map, int id);
|
||||
@@ -444,11 +434,11 @@ float binn_map_float(void *map, int id);
|
||||
double binn_map_double(void *map, int id);
|
||||
BOOL binn_map_bool(void *map, int id);
|
||||
BOOL binn_map_null(void *map, int id);
|
||||
char *binn_map_str(void *map, int id);
|
||||
void *binn_map_blob(void *map, int id, int *psize);
|
||||
void *binn_map_list(void *map, int id);
|
||||
void *binn_map_map(void *map, int id);
|
||||
void *binn_map_object(void *map, int id);
|
||||
char* binn_map_str(void *map, int id);
|
||||
void* binn_map_blob(void *map, int id, int *psize);
|
||||
void* binn_map_list(void *map, int id);
|
||||
void* binn_map_map(void *map, int id);
|
||||
void* binn_map_object(void *map, int id);
|
||||
|
||||
signed char binn_object_int8(void *obj, const char *key);
|
||||
short binn_object_int16(void *obj, const char *key);
|
||||
@@ -462,18 +452,18 @@ float binn_object_float(void *obj, const char *key);
|
||||
double binn_object_double(void *obj, const char *key);
|
||||
BOOL binn_object_bool(void *obj, const char *key);
|
||||
BOOL binn_object_null(void *obj, const char *key);
|
||||
char *binn_object_str(void *obj, const char *key);
|
||||
void *binn_object_blob(void *obj, const char *key, int *psize);
|
||||
void *binn_object_list(void *obj, const char *key);
|
||||
void *binn_object_map(void *obj, const char *key);
|
||||
void *binn_object_object(void *obj, const char *key);
|
||||
char* binn_object_str(void *obj, const char *key);
|
||||
void* binn_object_blob(void *obj, const char *key, int *psize);
|
||||
void* binn_object_list(void *obj, const char *key);
|
||||
void* binn_object_map(void *obj, const char *key);
|
||||
void* binn_object_object(void *obj, const char *key);
|
||||
|
||||
|
||||
// return a pointer to an allocated binn structure - must be released with the free() function or equivalent set in
|
||||
// binn_set_alloc_functions()
|
||||
binn *binn_list_value(void *list, int pos);
|
||||
binn *binn_map_value(void *map, int id);
|
||||
binn *binn_object_value(void *obj, const char *key);
|
||||
binn* binn_list_value(void *list, int pos);
|
||||
binn* binn_map_value(void *map, int id);
|
||||
binn* binn_object_value(void *obj, const char *key);
|
||||
|
||||
// read the value to a binn structure on the stack
|
||||
BOOL binn_list_get_value(void *list, int pos, binn *value);
|
||||
@@ -489,9 +479,9 @@ BOOL binn_object_get(void *obj, const char *key, int type, void *pvalue, int *ps
|
||||
// they are thread-safe on big-endian devices
|
||||
// on little-endian devices they are thread-safe only to return pointers to list, map, object, blob and strings
|
||||
// the returned pointer to 16, 32 and 64 bits values must be used only by single-threaded applications
|
||||
void *binn_list_read(void *list, int pos, int *ptype, int *psize);
|
||||
void *binn_map_read(void *map, int id, int *ptype, int *psize);
|
||||
void *binn_object_read(void *obj, const char *key, int *ptype, int *psize);
|
||||
void* binn_list_read(void *list, int pos, int *ptype, int *psize);
|
||||
void* binn_map_read(void *map, int id, int *ptype, int *psize);
|
||||
void* binn_object_read(void *obj, const char *key, int *ptype, int *psize);
|
||||
|
||||
// READ PAIR FUNCTIONS
|
||||
|
||||
@@ -504,15 +494,15 @@ BOOL binn_object_get_pair(
|
||||
binn *value); // must free the memory returned in the pkey
|
||||
|
||||
// allocated
|
||||
binn *binn_map_pair(void *map, int pos, int *pid);
|
||||
binn *binn_object_pair(void *obj, int pos, char *pkey); // must free the memory returned in the pkey
|
||||
IW_ALLOC binn* binn_map_pair(void *map, int pos, int *pid);
|
||||
IW_ALLOC binn* binn_object_pair(void *obj, int pos, char *pkey); // must free the memory returned in the pkey
|
||||
|
||||
// these 2 functions return a pointer to the value and the data type
|
||||
// they are thread-safe on big-endian devices
|
||||
// on little-endian devices they are thread-safe only to return pointers to list, map, object, blob and strings
|
||||
// the returned pointer to 16, 32 and 64 bits values must be used only by single-threaded applications
|
||||
void *binn_map_read_pair(void *ptr, int pos, int *pid, int *ptype, int *psize);
|
||||
void *binn_object_read_pair(void *ptr, int pos, char *pkey, int *ptype, int *psize);
|
||||
void* binn_map_read_pair(void *ptr, int pos, int *pid, int *ptype, int *psize);
|
||||
void* binn_object_read_pair(void *ptr, int pos, char *pkey, int *ptype, int *psize);
|
||||
|
||||
// SEQUENTIAL READ FUNCTIONS
|
||||
|
||||
@@ -527,9 +517,9 @@ typedef struct binn_iter_struct {
|
||||
BOOL binn_iter_init(binn_iter *iter, void *pbuf, int type);
|
||||
|
||||
// allocated
|
||||
binn *binn_list_next_value(binn_iter *iter);
|
||||
binn *binn_map_next_value(binn_iter *iter, int *pid);
|
||||
binn *binn_object_next_value(binn_iter *iter, char *pkey); // the key must be declared as: char key[256];
|
||||
IW_ALLOC binn* binn_list_next_value(binn_iter *iter);
|
||||
IW_ALLOC binn* binn_map_next_value(binn_iter *iter, int *pid);
|
||||
IW_ALLOC binn* binn_object_next_value(binn_iter *iter, char *pkey); // the key must be declared as: char key[256];
|
||||
|
||||
// on stack
|
||||
BOOL binn_list_next(binn_iter *iter, binn *value);
|
||||
@@ -543,9 +533,9 @@ BOOL binn_object_next2(binn_iter *iter, char **pkey, int *klen, binn *value);
|
||||
// they are thread-safe on big-endian devices
|
||||
// on little-endian devices they are thread-safe only to return pointers to list, map, object, blob and strings
|
||||
// the returned pointer to 16, 32 and 64 bits values must be used only by single-threaded applications
|
||||
void *binn_list_read_next(binn_iter *iter, int *ptype, int *psize);
|
||||
void *binn_map_read_next(binn_iter *iter, int *pid, int *ptype, int *psize);
|
||||
void *binn_object_read_next(
|
||||
void* binn_list_read_next(binn_iter *iter, int *ptype, int *psize);
|
||||
void* binn_map_read_next(binn_iter *iter, int *pid, int *ptype, int *psize);
|
||||
void* binn_object_read_next(
|
||||
binn_iter *iter, char *pkey, int *ptype,
|
||||
int *psize); // the key must be declared as: char key[256];
|
||||
|
||||
@@ -608,231 +598,231 @@ BOOL binn_set_blob(binn *item, void *ptr, int size, binn_mem_free pfree);
|
||||
/*** SET FUNCTIONS *******************************************************************/
|
||||
/*************************************************************************************/
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_int8(binn *list, signed char value) {
|
||||
IW_INLINE BOOL binn_list_add_int8(binn *list, signed char value) {
|
||||
return binn_list_add(list, BINN_INT8, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_int16(binn *list, short value) {
|
||||
IW_INLINE BOOL binn_list_add_int16(binn *list, short value) {
|
||||
return binn_list_add(list, BINN_INT16, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_int32(binn *list, int value) {
|
||||
IW_INLINE BOOL binn_list_add_int32(binn *list, int value) {
|
||||
return binn_list_add(list, BINN_INT32, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_int64(binn *list, int64 value) {
|
||||
IW_INLINE BOOL binn_list_add_int64(binn *list, int64 value) {
|
||||
return binn_list_add(list, BINN_INT64, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_uint8(binn *list, unsigned char value) {
|
||||
IW_INLINE BOOL binn_list_add_uint8(binn *list, unsigned char value) {
|
||||
return binn_list_add(list, BINN_UINT8, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_uint16(binn *list, unsigned short value) {
|
||||
IW_INLINE BOOL binn_list_add_uint16(binn *list, unsigned short value) {
|
||||
return binn_list_add(list, BINN_UINT16, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_uint32(binn *list, unsigned int value) {
|
||||
IW_INLINE BOOL binn_list_add_uint32(binn *list, unsigned int value) {
|
||||
return binn_list_add(list, BINN_UINT32, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_uint64(binn *list, uint64 value) {
|
||||
IW_INLINE BOOL binn_list_add_uint64(binn *list, uint64 value) {
|
||||
return binn_list_add(list, BINN_UINT64, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_float(binn *list, float value) {
|
||||
IW_INLINE BOOL binn_list_add_float(binn *list, float value) {
|
||||
return binn_list_add(list, BINN_FLOAT32, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_double(binn *list, double value) {
|
||||
IW_INLINE BOOL binn_list_add_double(binn *list, double value) {
|
||||
return binn_list_add(list, BINN_FLOAT64, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_bool(binn *list, BOOL value) {
|
||||
IW_INLINE BOOL binn_list_add_bool(binn *list, BOOL value) {
|
||||
return binn_list_add(list, BINN_BOOL, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_null(binn *list) {
|
||||
IW_INLINE BOOL binn_list_add_null(binn *list) {
|
||||
return binn_list_add(list, BINN_NULL, NULL, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_str(binn *list, char *str) {
|
||||
IW_INLINE BOOL binn_list_add_str(binn *list, char *str) {
|
||||
return binn_list_add(list, BINN_STRING, str, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_const_str(binn *list, const char *str) {
|
||||
IW_INLINE BOOL binn_list_add_const_str(binn *list, const char *str) {
|
||||
return binn_list_add(list, BINN_STRING, (char*) str, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_blob(binn *list, void *ptr, int size) {
|
||||
IW_INLINE BOOL binn_list_add_blob(binn *list, void *ptr, int size) {
|
||||
return binn_list_add(list, BINN_BLOB, ptr, size);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_list(binn *list, void *list2) {
|
||||
IW_INLINE BOOL binn_list_add_list(binn *list, void *list2) {
|
||||
return binn_list_add(list, BINN_LIST, binn_ptr(list2), binn_size(list2));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_map(binn *list, void *map) {
|
||||
IW_INLINE BOOL binn_list_add_map(binn *list, void *map) {
|
||||
return binn_list_add(list, BINN_MAP, binn_ptr(map), binn_size(map));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_object(binn *list, void *obj) {
|
||||
IW_INLINE BOOL binn_list_add_object(binn *list, void *obj) {
|
||||
return binn_list_add(list, BINN_OBJECT, binn_ptr(obj), binn_size(obj));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_add_value(binn *list, binn *value) {
|
||||
IW_INLINE BOOL binn_list_add_value(binn *list, binn *value) {
|
||||
return binn_list_add(list, value->type, binn_ptr(value), binn_size(value));
|
||||
}
|
||||
|
||||
/*************************************************************************************/
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_set_int8(binn *map, int id, signed char value) {
|
||||
IW_INLINE BOOL binn_map_set_int8(binn *map, int id, signed char value) {
|
||||
return binn_map_set(map, id, BINN_INT8, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_set_int16(binn *map, int id, short value) {
|
||||
IW_INLINE BOOL binn_map_set_int16(binn *map, int id, short value) {
|
||||
return binn_map_set(map, id, BINN_INT16, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_set_int32(binn *map, int id, int value) {
|
||||
IW_INLINE BOOL binn_map_set_int32(binn *map, int id, int value) {
|
||||
return binn_map_set(map, id, BINN_INT32, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_set_int64(binn *map, int id, int64 value) {
|
||||
IW_INLINE BOOL binn_map_set_int64(binn *map, int id, int64 value) {
|
||||
return binn_map_set(map, id, BINN_INT64, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_set_uint8(binn *map, int id, unsigned char value) {
|
||||
IW_INLINE BOOL binn_map_set_uint8(binn *map, int id, unsigned char value) {
|
||||
return binn_map_set(map, id, BINN_UINT8, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_set_uint16(binn *map, int id, unsigned short value) {
|
||||
IW_INLINE BOOL binn_map_set_uint16(binn *map, int id, unsigned short value) {
|
||||
return binn_map_set(map, id, BINN_UINT16, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_set_uint32(binn *map, int id, unsigned int value) {
|
||||
IW_INLINE BOOL binn_map_set_uint32(binn *map, int id, unsigned int value) {
|
||||
return binn_map_set(map, id, BINN_UINT32, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_set_uint64(binn *map, int id, uint64 value) {
|
||||
IW_INLINE BOOL binn_map_set_uint64(binn *map, int id, uint64 value) {
|
||||
return binn_map_set(map, id, BINN_UINT64, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_set_float(binn *map, int id, float value) {
|
||||
IW_INLINE BOOL binn_map_set_float(binn *map, int id, float value) {
|
||||
return binn_map_set(map, id, BINN_FLOAT32, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_set_double(binn *map, int id, double value) {
|
||||
IW_INLINE BOOL binn_map_set_double(binn *map, int id, double value) {
|
||||
return binn_map_set(map, id, BINN_FLOAT64, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_set_bool(binn *map, int id, BOOL value) {
|
||||
IW_INLINE BOOL binn_map_set_bool(binn *map, int id, BOOL value) {
|
||||
return binn_map_set(map, id, BINN_BOOL, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_set_null(binn *map, int id) {
|
||||
IW_INLINE BOOL binn_map_set_null(binn *map, int id) {
|
||||
return binn_map_set(map, id, BINN_NULL, NULL, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_set_str(binn *map, int id, char *str) {
|
||||
IW_INLINE BOOL binn_map_set_str(binn *map, int id, char *str) {
|
||||
return binn_map_set(map, id, BINN_STRING, str, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_set_blob(binn *map, int id, void *ptr, int size) {
|
||||
IW_INLINE BOOL binn_map_set_blob(binn *map, int id, void *ptr, int size) {
|
||||
return binn_map_set(map, id, BINN_BLOB, ptr, size);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_set_list(binn *map, int id, void *list) {
|
||||
IW_INLINE BOOL binn_map_set_list(binn *map, int id, void *list) {
|
||||
return binn_map_set(map, id, BINN_LIST, binn_ptr(list), binn_size(list));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_set_map(binn *map, int id, void *map2) {
|
||||
IW_INLINE BOOL binn_map_set_map(binn *map, int id, void *map2) {
|
||||
return binn_map_set(map, id, BINN_MAP, binn_ptr(map2), binn_size(map2));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_set_object(binn *map, int id, void *obj) {
|
||||
IW_INLINE BOOL binn_map_set_object(binn *map, int id, void *obj) {
|
||||
return binn_map_set(map, id, BINN_OBJECT, binn_ptr(obj), binn_size(obj));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_set_value(binn *map, int id, binn *value) {
|
||||
IW_INLINE BOOL binn_map_set_value(binn *map, int id, binn *value) {
|
||||
return binn_map_set(map, id, value->type, binn_ptr(value), binn_size(value));
|
||||
}
|
||||
|
||||
/*************************************************************************************/
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_int8(binn *obj, const char *key, signed char value) {
|
||||
IW_INLINE BOOL binn_object_set_int8(binn *obj, const char *key, signed char value) {
|
||||
return binn_object_set(obj, key, BINN_INT8, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_int16(binn *obj, const char *key, short value) {
|
||||
IW_INLINE BOOL binn_object_set_int16(binn *obj, const char *key, short value) {
|
||||
return binn_object_set(obj, key, BINN_INT16, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_int32(binn *obj, const char *key, int value) {
|
||||
IW_INLINE BOOL binn_object_set_int32(binn *obj, const char *key, int value) {
|
||||
return binn_object_set(obj, key, BINN_INT32, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_int64(binn *obj, const char *key, int64 value) {
|
||||
IW_INLINE BOOL binn_object_set_int64(binn *obj, const char *key, int64 value) {
|
||||
return binn_object_set(obj, key, BINN_INT64, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_uint8(binn *obj, const char *key, unsigned char value) {
|
||||
IW_INLINE BOOL binn_object_set_uint8(binn *obj, const char *key, unsigned char value) {
|
||||
return binn_object_set(obj, key, BINN_UINT8, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_uint16(binn *obj, const char *key, unsigned short value) {
|
||||
IW_INLINE BOOL binn_object_set_uint16(binn *obj, const char *key, unsigned short value) {
|
||||
return binn_object_set(obj, key, BINN_UINT16, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_uint32(binn *obj, const char *key, unsigned int value) {
|
||||
IW_INLINE BOOL binn_object_set_uint32(binn *obj, const char *key, unsigned int value) {
|
||||
return binn_object_set(obj, key, BINN_UINT32, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_uint64(binn *obj, const char *key, uint64 value) {
|
||||
IW_INLINE BOOL binn_object_set_uint64(binn *obj, const char *key, uint64 value) {
|
||||
return binn_object_set(obj, key, BINN_UINT64, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_float(binn *obj, const char *key, float value) {
|
||||
IW_INLINE BOOL binn_object_set_float(binn *obj, const char *key, float value) {
|
||||
return binn_object_set(obj, key, BINN_FLOAT32, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_double(binn *obj, const char *key, double value) {
|
||||
IW_INLINE BOOL binn_object_set_double(binn *obj, const char *key, double value) {
|
||||
return binn_object_set(obj, key, BINN_FLOAT64, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_bool(binn *obj, const char *key, BOOL value) {
|
||||
IW_INLINE BOOL binn_object_set_bool(binn *obj, const char *key, BOOL value) {
|
||||
return binn_object_set(obj, key, BINN_BOOL, &value, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_null(binn *obj, const char *key) {
|
||||
IW_INLINE BOOL binn_object_set_null(binn *obj, const char *key) {
|
||||
return binn_object_set(obj, key, BINN_NULL, NULL, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_str(binn *obj, const char *key, const char *str) {
|
||||
IW_INLINE BOOL binn_object_set_str(binn *obj, const char *key, const char *str) {
|
||||
return binn_object_set(obj, key, BINN_STRING, (char*) str, 0); // todo
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_blob(binn *obj, const char *key, void *ptr, int size) {
|
||||
IW_INLINE BOOL binn_object_set_blob(binn *obj, const char *key, void *ptr, int size) {
|
||||
return binn_object_set(obj, key, BINN_BLOB, ptr, size);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_list(binn *obj, const char *key, void *list) {
|
||||
IW_INLINE BOOL binn_object_set_list(binn *obj, const char *key, void *list) {
|
||||
return binn_object_set(obj, key, BINN_LIST, binn_ptr(list), binn_size(list));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_map(binn *obj, const char *key, void *map) {
|
||||
IW_INLINE BOOL binn_object_set_map(binn *obj, const char *key, void *map) {
|
||||
return binn_object_set(obj, key, BINN_MAP, binn_ptr(map), binn_size(map));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_object(binn *obj, const char *key, void *obj2) {
|
||||
IW_INLINE BOOL binn_object_set_object(binn *obj, const char *key, void *obj2) {
|
||||
return binn_object_set(obj, key, BINN_OBJECT, binn_ptr(obj2), binn_size(obj2));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_value(binn *obj, const char *key, binn *value) {
|
||||
IW_INLINE BOOL binn_object_set_value(binn *obj, const char *key, binn *value) {
|
||||
return binn_object_set(obj, key, value->type, binn_ptr(value), binn_size(value));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_set_value2(binn *obj, const char *key, int keylen, binn *value) {
|
||||
IW_INLINE BOOL binn_object_set_value2(binn *obj, const char *key, int keylen, binn *value) {
|
||||
return binn_object_set2(obj, key, keylen, value->type, binn_ptr(value), binn_size(value));
|
||||
}
|
||||
|
||||
@@ -840,133 +830,133 @@ ALWAYS_INLINE BOOL binn_object_set_value2(binn *obj, const char *key, int keylen
|
||||
/*** GET FUNCTIONS *******************************************************************/
|
||||
/*************************************************************************************/
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_get_int8(void *list, int pos, signed char *pvalue) {
|
||||
IW_INLINE BOOL binn_list_get_int8(void *list, int pos, signed char *pvalue) {
|
||||
return binn_list_get(list, pos, BINN_INT8, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_get_int16(void *list, int pos, short *pvalue) {
|
||||
IW_INLINE BOOL binn_list_get_int16(void *list, int pos, short *pvalue) {
|
||||
return binn_list_get(list, pos, BINN_INT16, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_get_int32(void *list, int pos, int *pvalue) {
|
||||
IW_INLINE BOOL binn_list_get_int32(void *list, int pos, int *pvalue) {
|
||||
return binn_list_get(list, pos, BINN_INT32, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_get_int64(void *list, int pos, int64 *pvalue) {
|
||||
IW_INLINE BOOL binn_list_get_int64(void *list, int pos, int64 *pvalue) {
|
||||
return binn_list_get(list, pos, BINN_INT64, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_get_uint8(void *list, int pos, unsigned char *pvalue) {
|
||||
IW_INLINE BOOL binn_list_get_uint8(void *list, int pos, unsigned char *pvalue) {
|
||||
return binn_list_get(list, pos, BINN_UINT8, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_get_uint16(void *list, int pos, unsigned short *pvalue) {
|
||||
IW_INLINE BOOL binn_list_get_uint16(void *list, int pos, unsigned short *pvalue) {
|
||||
return binn_list_get(list, pos, BINN_UINT16, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_get_uint32(void *list, int pos, unsigned int *pvalue) {
|
||||
IW_INLINE BOOL binn_list_get_uint32(void *list, int pos, unsigned int *pvalue) {
|
||||
return binn_list_get(list, pos, BINN_UINT32, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_get_uint64(void *list, int pos, uint64 *pvalue) {
|
||||
IW_INLINE BOOL binn_list_get_uint64(void *list, int pos, uint64 *pvalue) {
|
||||
return binn_list_get(list, pos, BINN_UINT64, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_get_float(void *list, int pos, float *pvalue) {
|
||||
IW_INLINE BOOL binn_list_get_float(void *list, int pos, float *pvalue) {
|
||||
return binn_list_get(list, pos, BINN_FLOAT32, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_get_double(void *list, int pos, double *pvalue) {
|
||||
IW_INLINE BOOL binn_list_get_double(void *list, int pos, double *pvalue) {
|
||||
return binn_list_get(list, pos, BINN_FLOAT64, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_get_bool(void *list, int pos, BOOL *pvalue) {
|
||||
IW_INLINE BOOL binn_list_get_bool(void *list, int pos, BOOL *pvalue) {
|
||||
return binn_list_get(list, pos, BINN_BOOL, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_get_str(void *list, int pos, char **pvalue) {
|
||||
IW_INLINE BOOL binn_list_get_str(void *list, int pos, char **pvalue) {
|
||||
return binn_list_get(list, pos, BINN_STRING, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_get_blob(void *list, int pos, void **pvalue, int *psize) {
|
||||
IW_INLINE BOOL binn_list_get_blob(void *list, int pos, void **pvalue, int *psize) {
|
||||
return binn_list_get(list, pos, BINN_BLOB, pvalue, psize);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_get_list(void *list, int pos, void **pvalue) {
|
||||
IW_INLINE BOOL binn_list_get_list(void *list, int pos, void **pvalue) {
|
||||
return binn_list_get(list, pos, BINN_LIST, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_get_map(void *list, int pos, void **pvalue) {
|
||||
IW_INLINE BOOL binn_list_get_map(void *list, int pos, void **pvalue) {
|
||||
return binn_list_get(list, pos, BINN_MAP, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_list_get_object(void *list, int pos, void **pvalue) {
|
||||
IW_INLINE BOOL binn_list_get_object(void *list, int pos, void **pvalue) {
|
||||
return binn_list_get(list, pos, BINN_OBJECT, pvalue, NULL);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_get_int8(void *map, int id, signed char *pvalue) {
|
||||
IW_INLINE BOOL binn_map_get_int8(void *map, int id, signed char *pvalue) {
|
||||
return binn_map_get(map, id, BINN_INT8, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_get_int16(void *map, int id, short *pvalue) {
|
||||
IW_INLINE BOOL binn_map_get_int16(void *map, int id, short *pvalue) {
|
||||
return binn_map_get(map, id, BINN_INT16, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_get_int32(void *map, int id, int *pvalue) {
|
||||
IW_INLINE BOOL binn_map_get_int32(void *map, int id, int *pvalue) {
|
||||
return binn_map_get(map, id, BINN_INT32, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_get_int64(void *map, int id, int64 *pvalue) {
|
||||
IW_INLINE BOOL binn_map_get_int64(void *map, int id, int64 *pvalue) {
|
||||
return binn_map_get(map, id, BINN_INT64, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_get_uint8(void *map, int id, unsigned char *pvalue) {
|
||||
IW_INLINE BOOL binn_map_get_uint8(void *map, int id, unsigned char *pvalue) {
|
||||
return binn_map_get(map, id, BINN_UINT8, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_get_uint16(void *map, int id, unsigned short *pvalue) {
|
||||
IW_INLINE BOOL binn_map_get_uint16(void *map, int id, unsigned short *pvalue) {
|
||||
return binn_map_get(map, id, BINN_UINT16, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_get_uint32(void *map, int id, unsigned int *pvalue) {
|
||||
IW_INLINE BOOL binn_map_get_uint32(void *map, int id, unsigned int *pvalue) {
|
||||
return binn_map_get(map, id, BINN_UINT32, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_get_uint64(void *map, int id, uint64 *pvalue) {
|
||||
IW_INLINE BOOL binn_map_get_uint64(void *map, int id, uint64 *pvalue) {
|
||||
return binn_map_get(map, id, BINN_UINT64, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_get_float(void *map, int id, float *pvalue) {
|
||||
IW_INLINE BOOL binn_map_get_float(void *map, int id, float *pvalue) {
|
||||
return binn_map_get(map, id, BINN_FLOAT32, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_get_double(void *map, int id, double *pvalue) {
|
||||
IW_INLINE BOOL binn_map_get_double(void *map, int id, double *pvalue) {
|
||||
return binn_map_get(map, id, BINN_FLOAT64, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_get_bool(void *map, int id, BOOL *pvalue) {
|
||||
IW_INLINE BOOL binn_map_get_bool(void *map, int id, BOOL *pvalue) {
|
||||
return binn_map_get(map, id, BINN_BOOL, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_get_str(void *map, int id, char **pvalue) {
|
||||
IW_INLINE BOOL binn_map_get_str(void *map, int id, char **pvalue) {
|
||||
return binn_map_get(map, id, BINN_STRING, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_get_blob(void *map, int id, void **pvalue, int *psize) {
|
||||
IW_INLINE BOOL binn_map_get_blob(void *map, int id, void **pvalue, int *psize) {
|
||||
return binn_map_get(map, id, BINN_BLOB, pvalue, psize);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_get_list(void *map, int id, void **pvalue) {
|
||||
IW_INLINE BOOL binn_map_get_list(void *map, int id, void **pvalue) {
|
||||
return binn_map_get(map, id, BINN_LIST, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_get_map(void *map, int id, void **pvalue) {
|
||||
IW_INLINE BOOL binn_map_get_map(void *map, int id, void **pvalue) {
|
||||
return binn_map_get(map, id, BINN_MAP, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_map_get_object(void *map, int id, void **pvalue) {
|
||||
IW_INLINE BOOL binn_map_get_object(void *map, int id, void **pvalue) {
|
||||
return binn_map_get(map, id, BINN_OBJECT, pvalue, NULL);
|
||||
}
|
||||
|
||||
@@ -975,67 +965,67 @@ ALWAYS_INLINE BOOL binn_map_get_object(void *map, int id, void **pvalue) {
|
||||
// usage:
|
||||
// if (binn_object_get_int32(obj, "key", &value) == FALSE) xxx;
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_get_int8(void *obj, const char *key, signed char *pvalue) {
|
||||
IW_INLINE BOOL binn_object_get_int8(void *obj, const char *key, signed char *pvalue) {
|
||||
return binn_object_get(obj, key, BINN_INT8, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_get_int16(void *obj, const char *key, short *pvalue) {
|
||||
IW_INLINE BOOL binn_object_get_int16(void *obj, const char *key, short *pvalue) {
|
||||
return binn_object_get(obj, key, BINN_INT16, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_get_int32(void *obj, const char *key, int *pvalue) {
|
||||
IW_INLINE BOOL binn_object_get_int32(void *obj, const char *key, int *pvalue) {
|
||||
return binn_object_get(obj, key, BINN_INT32, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_get_int64(void *obj, const char *key, int64 *pvalue) {
|
||||
IW_INLINE BOOL binn_object_get_int64(void *obj, const char *key, int64 *pvalue) {
|
||||
return binn_object_get(obj, key, BINN_INT64, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_get_uint8(void *obj, const char *key, unsigned char *pvalue) {
|
||||
IW_INLINE BOOL binn_object_get_uint8(void *obj, const char *key, unsigned char *pvalue) {
|
||||
return binn_object_get(obj, key, BINN_UINT8, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_get_uint16(void *obj, const char *key, unsigned short *pvalue) {
|
||||
IW_INLINE BOOL binn_object_get_uint16(void *obj, const char *key, unsigned short *pvalue) {
|
||||
return binn_object_get(obj, key, BINN_UINT16, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_get_uint32(void *obj, const char *key, unsigned int *pvalue) {
|
||||
IW_INLINE BOOL binn_object_get_uint32(void *obj, const char *key, unsigned int *pvalue) {
|
||||
return binn_object_get(obj, key, BINN_UINT32, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_get_uint64(void *obj, const char *key, uint64 *pvalue) {
|
||||
IW_INLINE BOOL binn_object_get_uint64(void *obj, const char *key, uint64 *pvalue) {
|
||||
return binn_object_get(obj, key, BINN_UINT64, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_get_float(void *obj, const char *key, float *pvalue) {
|
||||
IW_INLINE BOOL binn_object_get_float(void *obj, const char *key, float *pvalue) {
|
||||
return binn_object_get(obj, key, BINN_FLOAT32, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_get_double(void *obj, const char *key, double *pvalue) {
|
||||
IW_INLINE BOOL binn_object_get_double(void *obj, const char *key, double *pvalue) {
|
||||
return binn_object_get(obj, key, BINN_FLOAT64, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_get_bool(void *obj, const char *key, BOOL *pvalue) {
|
||||
IW_INLINE BOOL binn_object_get_bool(void *obj, const char *key, BOOL *pvalue) {
|
||||
return binn_object_get(obj, key, BINN_BOOL, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_get_str(void *obj, const char *key, char **pvalue) {
|
||||
IW_INLINE BOOL binn_object_get_str(void *obj, const char *key, char **pvalue) {
|
||||
return binn_object_get(obj, key, BINN_STRING, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_get_blob(void *obj, const char *key, void **pvalue, int *psize) {
|
||||
IW_INLINE BOOL binn_object_get_blob(void *obj, const char *key, void **pvalue, int *psize) {
|
||||
return binn_object_get(obj, key, BINN_BLOB, pvalue, psize);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_get_list(void *obj, const char *key, void **pvalue) {
|
||||
IW_INLINE BOOL binn_object_get_list(void *obj, const char *key, void **pvalue) {
|
||||
return binn_object_get(obj, key, BINN_LIST, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_get_map(void *obj, const char *key, void **pvalue) {
|
||||
IW_INLINE BOOL binn_object_get_map(void *obj, const char *key, void **pvalue) {
|
||||
return binn_object_get(obj, key, BINN_MAP, pvalue, NULL);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE BOOL binn_object_get_object(void *obj, const char *key, void **pvalue) {
|
||||
IW_INLINE BOOL binn_object_get_object(void *obj, const char *key, void **pvalue) {
|
||||
return binn_object_get(obj, key, BINN_OBJECT, pvalue, NULL);
|
||||
}
|
||||
|
||||
@@ -1045,7 +1035,7 @@ BOOL binn_get_int32(binn *value, int *pint);
|
||||
BOOL binn_get_int64(binn *value, int64 *pint);
|
||||
BOOL binn_get_double(binn *value, double *pfloat);
|
||||
BOOL binn_get_bool(binn *value, BOOL *pbool);
|
||||
char *binn_get_str(binn *value);
|
||||
char* binn_get_str(binn *value);
|
||||
|
||||
// boolean string values:
|
||||
// 1, true, yes, on
|
||||
|
||||
+34
-14
@@ -11,7 +11,12 @@
|
||||
|
||||
IW_INLINE int _jbl_printf_estimate_size(const char *format, va_list ap) {
|
||||
char buf[1];
|
||||
return vsnprintf(buf, sizeof(buf), format, ap) + 1;
|
||||
int ret = vsnprintf(buf, sizeof(buf), format, ap);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
} else {
|
||||
return ret + 1;
|
||||
}
|
||||
}
|
||||
|
||||
IW_INLINE void _jbn_remove_item(JBL_NODE parent, JBL_NODE child);
|
||||
@@ -39,7 +44,7 @@ void jbl_set_user_data(JBL jbl, void *user_data, void (*user_data_free_fn)(void*
|
||||
binn_set_user_data(&jbl->bn, user_data, user_data_free_fn);
|
||||
}
|
||||
|
||||
void *jbl_get_user_data(JBL jbl) {
|
||||
void* jbl_get_user_data(JBL jbl) {
|
||||
return jbl->bn.user_data;
|
||||
}
|
||||
|
||||
@@ -121,6 +126,10 @@ iwrc jbl_set_string_printf(JBL jbl, const char *key, const char *format, ...) {
|
||||
|
||||
va_start(ap, format);
|
||||
int size = _jbl_printf_estimate_size(format, ap);
|
||||
if (size < 0) {
|
||||
va_end(ap);
|
||||
return IW_ERROR_INVALID_ARGS;
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
va_start(ap, format);
|
||||
@@ -141,6 +150,10 @@ iwrc jbl_from_json_printf_va(JBL *jblp, const char *format, va_list va) {
|
||||
|
||||
va_copy(cva, va);
|
||||
int size = _jbl_printf_estimate_size(format, va);
|
||||
if (size < 0) {
|
||||
va_end(cva);
|
||||
return IW_ERROR_INVALID_ARGS;
|
||||
}
|
||||
char *buf = malloc(size);
|
||||
RCGA(buf, finish);
|
||||
vsnprintf(buf, size, format, cva);
|
||||
@@ -168,6 +181,10 @@ iwrc jbn_from_json_printf_va(JBL_NODE *node, IWPOOL *pool, const char *format, v
|
||||
|
||||
va_copy(cva, va);
|
||||
int size = _jbl_printf_estimate_size(format, va);
|
||||
if (size < 0) {
|
||||
va_end(cva);
|
||||
return IW_ERROR_INVALID_ARGS;
|
||||
}
|
||||
char *buf = malloc(size);
|
||||
RCGA(buf, finish);
|
||||
vsnprintf(buf, size, format, cva);
|
||||
@@ -614,7 +631,6 @@ static iwrc _jbl_as_json(binn *bn, jbl_json_printer pt, void *op, int lvl, jbl_p
|
||||
} while (0)
|
||||
|
||||
switch (bn->type) {
|
||||
|
||||
case BINN_LIST:
|
||||
if (!binn_iter_init(&iter, bn, bn->type)) {
|
||||
rc = JBL_ERROR_INVALID;
|
||||
@@ -910,7 +926,7 @@ double jbl_get_f64(JBL jbl) {
|
||||
}
|
||||
}
|
||||
|
||||
const char *jbl_get_str(JBL jbl) {
|
||||
const char* jbl_get_str(JBL jbl) {
|
||||
assert(jbl && jbl->bn.type == BINN_STRING);
|
||||
if (jbl->bn.type != BINN_STRING) {
|
||||
return 0;
|
||||
@@ -1281,7 +1297,7 @@ IW_INLINE bool _jbn_visitor_update_jptr_cursor(JBN_VCTX *vctx, int lvl, const ch
|
||||
}
|
||||
int jplen = (int) strlen(jp->n[lvl]);
|
||||
if (( (idx == jplen)
|
||||
&& !strncmp(keyptr, jp->n[lvl], idx)) || ((jp->n[lvl][0] == '*') && (jp->n[lvl][1] == '\0') )) {
|
||||
&& !strncmp(keyptr, jp->n[lvl], idx)) || ((jp->n[lvl][0] == '*') && (jp->n[lvl][1] == '\0'))) {
|
||||
vctx->pos = lvl;
|
||||
return (jp->cnt == lvl + 1);
|
||||
}
|
||||
@@ -1711,7 +1727,9 @@ iwrc jbn_add_item_bool(JBL_NODE parent, const char *key, bool val, JBL_NODE *nod
|
||||
n->type = JBV_BOOL;
|
||||
n->vbool = val;
|
||||
jbn_add_item(parent, n);
|
||||
|
||||
if (node_out) {
|
||||
*node_out = n;
|
||||
}
|
||||
finish:
|
||||
return rc;
|
||||
}
|
||||
@@ -1775,7 +1793,8 @@ iwrc jbn_copy_path(
|
||||
const char *target_path,
|
||||
bool overwrite_on_nulls,
|
||||
bool no_src_clone,
|
||||
IWPOOL *pool) {
|
||||
IWPOOL *pool
|
||||
) {
|
||||
if (!src || !src_path || !target || !target_path || !pool) {
|
||||
return IW_ERROR_INVALID_ARGS;
|
||||
}
|
||||
@@ -1823,7 +1842,8 @@ IW_EXPORT iwrc jbn_copy_paths(
|
||||
const char **paths,
|
||||
bool overwrite_on_nulls,
|
||||
bool no_src_clone,
|
||||
IWPOOL *pool) {
|
||||
IWPOOL *pool
|
||||
) {
|
||||
if (!target || !src || !paths || !pool) {
|
||||
return IW_ERROR_INVALID_ARGS;
|
||||
}
|
||||
@@ -1878,7 +1898,8 @@ static iwrc _jbl_create_node(
|
||||
const char *key,
|
||||
int klidx,
|
||||
JBL_NODE *node,
|
||||
bool clone_strings) {
|
||||
bool clone_strings
|
||||
) {
|
||||
iwrc rc = 0;
|
||||
JBL_NODE n = iwpool_alloc(sizeof(*n), ctx->pool);
|
||||
if (node) {
|
||||
@@ -1992,7 +2013,8 @@ static iwrc _jbl_node_from_binn_impl(
|
||||
JBL_NODE parent,
|
||||
char *key,
|
||||
int klidx,
|
||||
bool clone_strings) {
|
||||
bool clone_strings
|
||||
) {
|
||||
binn bv;
|
||||
binn_iter iter;
|
||||
iwrc rc = 0;
|
||||
@@ -2248,7 +2270,6 @@ int jbn_compare_nodes(JBL_NODE n1, JBL_NODE n2, iwrc *rcp) {
|
||||
}
|
||||
|
||||
static iwrc _jbl_target_apply_patch(JBL_NODE target, const JBL_PATCHEXT *ex, IWPOOL *pool) {
|
||||
|
||||
struct _JBL_NODE *ntmp;
|
||||
jbp_patch_t op = ex->p->op;
|
||||
JBL_PTR path = ex->path;
|
||||
@@ -2850,7 +2871,6 @@ finish:
|
||||
}
|
||||
|
||||
iwrc jbl_merge_patch_jbl(JBL jbl, JBL patch) {
|
||||
|
||||
IWXSTR *xstr = iwxstr_new();
|
||||
if (!xstr) {
|
||||
return iwrc_set_errno(IW_ERROR_ALLOC, errno);
|
||||
@@ -2883,7 +2903,7 @@ iwrc jbn_patch_auto(JBL_NODE root, JBL_NODE patch, IWPOOL *pool) {
|
||||
}
|
||||
|
||||
iwrc jbn_merge_patch(JBL_NODE root, JBL_NODE patch, IWPOOL *pool) {
|
||||
if (!root || !patch || pool || (root->type != JBV_OBJECT)) {
|
||||
if (!root || !patch || !pool || (root->type != JBV_OBJECT)) {
|
||||
return IW_ERROR_INVALID_ARGS;
|
||||
}
|
||||
iwrc rc = 0;
|
||||
@@ -2891,7 +2911,7 @@ iwrc jbn_merge_patch(JBL_NODE root, JBL_NODE patch, IWPOOL *pool) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
static const char *_jbl_ecodefn(locale_t locale, uint32_t ecode) {
|
||||
static const char* _jbl_ecodefn(locale_t locale, uint32_t ecode) {
|
||||
if (!((ecode > _JBL_ERROR_START) && (ecode < _JBL_ERROR_END))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
+5
-5
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
* Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -198,7 +198,7 @@ typedef iwrc (*jbl_json_printer)(const char *data, int size, char ch, int count,
|
||||
* @see `jbl_fill_from_node()`
|
||||
* @param [out] jblp Pointer to be initialized by new object.
|
||||
*/
|
||||
IW_EXPORT iwrc jbl_create_empty_object(JBL *jblp);
|
||||
IW_EXPORT WUR iwrc jbl_create_empty_object(JBL *jblp);
|
||||
|
||||
/**
|
||||
* @brief Create empty binary JSON array.
|
||||
@@ -207,7 +207,7 @@ IW_EXPORT iwrc jbl_create_empty_object(JBL *jblp);
|
||||
* @see `jbl_fill_from_node()`
|
||||
* @param [out] jblp Pointer to be initialized by new object.
|
||||
*/
|
||||
IW_EXPORT iwrc jbl_create_empty_array(JBL *jblp);
|
||||
IW_EXPORT WUR iwrc jbl_create_empty_array(JBL *jblp);
|
||||
|
||||
/**
|
||||
* @brief Sets arbitrary user data associated with JBL object.
|
||||
@@ -223,7 +223,7 @@ IW_EXPORT void jbl_set_user_data(JBL jbl, void *user_data, void (*user_data_free
|
||||
*
|
||||
* @param jbl JBL container.
|
||||
*/
|
||||
IW_EXPORT void *jbl_get_user_data(JBL jbl);
|
||||
IW_EXPORT void* jbl_get_user_data(JBL jbl);
|
||||
|
||||
/**
|
||||
* @brief Set integer JBL object property value
|
||||
@@ -485,7 +485,7 @@ IW_EXPORT double jbl_get_f64(JBL jbl);
|
||||
* @brief Interpret `jbl` value as `\0` terminated character array.
|
||||
* Returns zero if value cannot be converted.
|
||||
*/
|
||||
IW_EXPORT const char *jbl_get_str(JBL jbl);
|
||||
IW_EXPORT const char* jbl_get_str(JBL jbl);
|
||||
|
||||
IW_EXPORT iwrc jbl_object_get_i64(JBL jbl, const char *key, int64_t *out);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
* Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
+8
-4
@@ -1,7 +1,11 @@
|
||||
#include "jbl.h"
|
||||
#include "utf8proc.h"
|
||||
#include "jbl_internal.h"
|
||||
#include <ejdb2/iowow/iwconv.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <locale.h>
|
||||
|
||||
#define IS_WHITESPACE(c_) ((unsigned char) (c_) <= (unsigned char) ' ')
|
||||
|
||||
@@ -183,7 +187,7 @@ static int _jbl_unescape_json_string(const char *p, char *d, int dlen, const cha
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *_jbl_parse_key(const char **key, const char *p, JCTX *ctx) {
|
||||
static const char* _jbl_parse_key(const char **key, const char *p, JCTX *ctx) {
|
||||
char c;
|
||||
*key = "";
|
||||
while ((c = *p++)) {
|
||||
@@ -226,7 +230,7 @@ static const char *_jbl_parse_key(const char **key, const char *p, JCTX *ctx) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *_jbl_parse_value(
|
||||
static const char* _jbl_parse_value(
|
||||
int lvl,
|
||||
JBL_NODE parent,
|
||||
const char *key, int klidx,
|
||||
@@ -330,7 +334,7 @@ static const char *_jbl_parse_value(
|
||||
if (*p == '}') {
|
||||
return p + 1; // -V522
|
||||
}
|
||||
p = _jbl_parse_value(lvl + 1, node, nkey, strlen(nkey), p, ctx);
|
||||
p = _jbl_parse_value(lvl + 1, node, nkey, (int) strlen(nkey), p, ctx);
|
||||
if (ctx->rc) {
|
||||
return 0;
|
||||
}
|
||||
@@ -378,7 +382,7 @@ static const char *_jbl_parse_value(
|
||||
}
|
||||
if ((*pe == '.') || (*pe == 'e') || (*pe == 'E')) {
|
||||
node->type = JBV_F64;
|
||||
node->vf64 = strtod(p, &pe);
|
||||
node->vf64 = iwstrtod(p, &pe);
|
||||
if ((pe == p) || (errno == ERANGE)) {
|
||||
ctx->rc = JBL_ERROR_PARSE_JSON;
|
||||
return 0;
|
||||
|
||||
@@ -866,6 +866,11 @@ void jbl_test1_11(void) {
|
||||
}
|
||||
|
||||
void jbl_test1_12(void) {
|
||||
IWPOOL *pool = iwpool_create_empty();
|
||||
JBL_NODE n;
|
||||
iwrc rc = jbn_from_json("{\"foo\":1.1}", &n, pool);
|
||||
CU_ASSERT_EQUAL_FATAL(rc, 0);
|
||||
iwpool_destroy(pool);
|
||||
}
|
||||
|
||||
int main() {
|
||||
@@ -888,7 +893,9 @@ int main() {
|
||||
|| (NULL == CU_add_test(pSuite, "jbl_test1_8", jbl_test1_8))
|
||||
|| (NULL == CU_add_test(pSuite, "jbl_test1_9", jbl_test1_9))
|
||||
|| (NULL == CU_add_test(pSuite, "jbl_test1_10", jbl_test1_10))
|
||||
|| (NULL == CU_add_test(pSuite, "jbl_test1_11", jbl_test1_11))) {
|
||||
|| (NULL == CU_add_test(pSuite, "jbl_test1_11", jbl_test1_11))
|
||||
|| (NULL == CU_add_test(pSuite, "jbl_test1_12", jbl_test1_12))
|
||||
) {
|
||||
CU_cleanup_registry();
|
||||
return CU_get_error();
|
||||
}
|
||||
|
||||
+28
-28
@@ -1,45 +1,45 @@
|
||||
# HTTP REST/Websocket API endpoint
|
||||
|
||||
EJDB engine provides the ability to start a separate HTTP/Websocket endpoint worker exposing network API for quering and data modifications.
|
||||
SSL (TLS 1.2) is supported by `jbs` server.
|
||||
|
||||
The easiest way to expose database over the network is using the standalone `jbs` server. (Of course if you plan to avoid `C API` integration).
|
||||
The easiest way to expose database over the network is use the standalone `jbs` server. (Of course if you want to avoid `C API` integration).
|
||||
|
||||
## jbs server
|
||||
|
||||
```
|
||||
jbs -h
|
||||
Usage:
|
||||
|
||||
EJDB 2.0.0 standalone REST/Websocket server. http://ejdb.org
|
||||
./jbs [options]
|
||||
|
||||
--file <> Database file path. Default: db.jb
|
||||
-f <> (same as --file)
|
||||
--port ## HTTP port number listen to. Default: 9191
|
||||
-p ## (same as --port)
|
||||
--bind <> Address server listen. Default: localhost
|
||||
-b <> (same as --bind)
|
||||
--access <> Server access token matched to 'X-Access-Token' HTTP header value
|
||||
-a <> (same as --access)
|
||||
--trunc Cleanup existing database file on open
|
||||
-t (same as --trunc)
|
||||
--wal Use write ahead logging (WAL). Must be set for data durability.
|
||||
-w (same as --wal)
|
||||
-v, --version Print program version.
|
||||
-f, --file=<> Database file path. Default: ejdb2.db
|
||||
-p, --port=NUM HTTP server port numer. Default: 9191
|
||||
-l, --listen=<> Network address server will listen. Default: localhost
|
||||
-k, --key=<> PEM private key file for TLS 1.2 HTTP server.
|
||||
-c, --certs=<> PEM certificates file for TLS 1.2 HTTP server.
|
||||
-a, --access=TOKEN|@FILE Access token to match 'X-Access-Token' HTTP header value.
|
||||
-r, --access-read Allows unrestricted read-only data access.
|
||||
-C, --cors Enable COSR response headers for HTTP server
|
||||
-t, --trunc Cleanup/reset database file on open.
|
||||
-w, --wal use the write ahead log (WAL). Used to provide data durability.
|
||||
|
||||
Advanced options
|
||||
--sbz ## Max sorting buffer size. If exceeded, an overflow temp file for data will be created. Default: 16777216, min: 1048576
|
||||
--dsz ## Initial size of buffer to process/store document on queries. Preferable average size of document. Default: 65536, min: 16384
|
||||
--bsz ## Max HTTP/WS API document body size. Default: 67108864, min: 524288
|
||||
Advanced options:
|
||||
-S, --sbz=NUM Max sorting buffer size. If exceeded, an overflow temp file for data will be created.
|
||||
Default: 16777216, min: 1048576
|
||||
-D, --dsz=NUM Initial size of buffer to process/store document on queries. Preferable average size of document.
|
||||
Default: 65536, min: 16384
|
||||
-T, --trylock Exit with error if database is locked by another process.
|
||||
If not set, current process will wait for lock release.
|
||||
|
||||
Use any of the following input formats:
|
||||
-arg <value> -arg=<value> -arg<value>
|
||||
|
||||
Use the -h, -help or -? to get this information again.
|
||||
```
|
||||
|
||||
## HTTP API
|
||||
|
||||
Access to HTTP endpoint can be protected by a token specified with `--access`
|
||||
command flag or by C API `EJDB_HTTP` options. If access token specified on server, client must provide `X-Access-Token` HTTP header value. If token is required and not provided by client the `401` HTTP code will be reported. If access token is not matched to the token provided the `403` HTTP code will be returned.
|
||||
For any other errors server will respond with `500` error code.
|
||||
HTTP endpoint may be protected by a token specified with `--access` flag or C API `EJDB_HTTP` struct.
|
||||
If access token was set, client should provide `X-Access-Token` HTTP header.
|
||||
If token is required but not provided by client `401` HTTP code will be reported.
|
||||
If access token is not matched to the token provided by client server will respond with `403` HTTP code.
|
||||
|
||||
## REST API
|
||||
|
||||
@@ -54,7 +54,7 @@ Replaces/store document under specific numeric `id`
|
||||
### DELETE /{collection}/{id}
|
||||
Removes document identified by `id` from a `collection`
|
||||
* `200` on success. Empty body
|
||||
* `404` if document not found
|
||||
* `404` document not found
|
||||
|
||||
### PATCH /{collection}/{id}
|
||||
Patch a document identified by `id` by [rfc7396](https://tools.ietf.org/html/rfc7396),
|
||||
@@ -66,7 +66,7 @@ Retrieve document identified by `id` from a `collection`.
|
||||
* `200` on success. Body: JSON document text.
|
||||
* `content-type:application/json`
|
||||
* `content-length:`
|
||||
* `404` if document not found
|
||||
* `404` document not found
|
||||
|
||||
### POST /
|
||||
Query a collection by provided query as POST body.
|
||||
|
||||
+894
-1180
File diff suppressed because it is too large
Load Diff
+6
-15
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
* Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -32,23 +32,14 @@
|
||||
|
||||
IW_EXTERN_C_START
|
||||
|
||||
typedef enum {
|
||||
_JBR_ERROR_START = (IW_ERROR_START + 15000UL + 3000),
|
||||
JBR_ERROR_HTTP_LISTEN, /**< Failed to start HTTP network listener (JBR_ERROR_HTTP_LISTEN) */
|
||||
JBR_ERROR_PORT_INVALID, /**< Invalid port specified (JBR_ERROR_PORT_INVALID) */
|
||||
JBR_ERROR_SEND_RESPONSE, /**< Error sending response (JBR_ERROR_SEND_RESPONSE) */
|
||||
JBR_ERROR_WS_UPGRADE, /**< Failed upgrading to websocket connection (JBR_ERROR_WS_UPGRADE) */
|
||||
JBR_ERROR_WS_INVALID_MESSAGE, /**< Invalid message recieved (JBR_ERROR_WS_INVALID_MESSAGE) */
|
||||
JBR_ERROR_WS_ACCESS_DENIED, /**< Access denied (JBR_ERROR_WS_ACCESS_DENIED) */
|
||||
_JBR_ERROR_END,
|
||||
} jbr_ecode_t;
|
||||
struct jbr;
|
||||
typedef struct jbr*JBR;
|
||||
|
||||
struct _JBR;
|
||||
typedef struct _JBR*JBR;
|
||||
iwrc jbr_start(EJDB db, const EJDB_OPTS *opts, JBR *out_jbr);
|
||||
|
||||
iwrc jbr_start(EJDB db, const EJDB_OPTS *opts, JBR *pjbr);
|
||||
void jbr_shutdown_request(EJDB db);
|
||||
|
||||
iwrc jbr_shutdown(JBR *pjbr);
|
||||
void jbr_shutdown_wait(JBR jbr);
|
||||
|
||||
iwrc jbr_init(void);
|
||||
|
||||
|
||||
@@ -106,8 +106,8 @@ static void jbr_test1_1() {
|
||||
" \"foo\": \"bar\"\n"
|
||||
"}"
|
||||
);
|
||||
CU_ASSERT_PTR_NOT_NULL(strstr(iwxstr_ptr(hstr), "content-type:application/json"));
|
||||
CU_ASSERT_PTR_NOT_NULL(strstr(iwxstr_ptr(hstr), "content-length:17"));
|
||||
CU_ASSERT_PTR_NOT_NULL(strstr(iwxstr_ptr(hstr), "content-type: application/json"));
|
||||
CU_ASSERT_PTR_NOT_NULL(strstr(iwxstr_ptr(hstr), "content-length: 17"));
|
||||
CU_ASSERT_EQUAL(iwxstr_size(xstr), 17);
|
||||
|
||||
// PUT document under specific ID
|
||||
@@ -147,8 +147,8 @@ static void jbr_test1_1() {
|
||||
" \"foo\": \"b\\nar\"\n"
|
||||
"}"
|
||||
);
|
||||
CU_ASSERT_PTR_NOT_NULL(strstr(iwxstr_ptr(hstr), "content-type:application/json"));
|
||||
CU_ASSERT_PTR_NOT_NULL(strstr(iwxstr_ptr(hstr), "content-length:19"));
|
||||
CU_ASSERT_PTR_NOT_NULL(strstr(iwxstr_ptr(hstr), "content-type: application/json"));
|
||||
CU_ASSERT_PTR_NOT_NULL(strstr(iwxstr_ptr(hstr), "content-length: 19"));
|
||||
CU_ASSERT_EQUAL(iwxstr_size(xstr), 19);
|
||||
|
||||
// Perform a query
|
||||
|
||||
@@ -6,7 +6,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
add_custom_command(
|
||||
TARGET jbs
|
||||
POST_BUILD
|
||||
COMMAND strip -s $<TARGET_FILE:jbs>)
|
||||
COMMAND ${STRIP_CMD} $<TARGET_FILE:jbs>)
|
||||
endif()
|
||||
|
||||
if(DO_INSTALL_CORE)
|
||||
|
||||
+24
-23
@@ -1,31 +1,32 @@
|
||||
# Standalone REST/Websocket HTTP server
|
||||
# REST/Websocket HTTP server.
|
||||
|
||||
SSL (TLS 1.2) provided by fork of BearSSL library https://github.com/Softmotions/BearSSL
|
||||
|
||||
## jbs server
|
||||
|
||||
```
|
||||
jbs -h
|
||||
Usage:
|
||||
|
||||
EJDB 2.0.0 standalone REST/Websocket server. http://ejdb.org
|
||||
./jbs [options]
|
||||
|
||||
--file <> Database file path. Default: db.jb
|
||||
-f <> (same as --file)
|
||||
--port ## HTTP port number listen to. Default: 9191
|
||||
-p ## (same as --port)
|
||||
--bind <> Address server listen. Default: localhost
|
||||
-b <> (same as --bind)
|
||||
--access <> Server access token matched to 'X-Access-Token' HTTP header value
|
||||
-a <> (same as --access)
|
||||
--trunc Cleanup existing database file on open
|
||||
-t (same as --trunc)
|
||||
--wal Use write ahead logging (WAL). Must be set for data durability.
|
||||
-w (same as --wal)
|
||||
-v, --version Print program version.
|
||||
-f, --file=<> Database file path. Default: ejdb2.db
|
||||
-p, --port=NUM HTTP server port numer. Default: 9191
|
||||
-l, --listen=<> Network address server will listen. Default: localhost
|
||||
-k, --key=<> PEM private key file for TLS 1.2 HTTP server.
|
||||
-c, --certs=<> PEM certificates file for TLS 1.2 HTTP server.
|
||||
-a, --access=TOKEN|@FILE Access token to match 'X-Access-Token' HTTP header value.
|
||||
-r, --access-read Allows unrestricted read-only data access.
|
||||
-C, --cors Enable COSR response headers for HTTP server
|
||||
-t, --trunc Cleanup/reset database file on open.
|
||||
-w, --wal use the write ahead log (WAL). Used to provide data durability.
|
||||
|
||||
Advanced options
|
||||
--sbz ## Max sorting buffer size. If exceeded, an overflow temp file for data will be created. Default: 16777216, min: 1048576
|
||||
--dsz ## Initial size of buffer to process/store document on queries. Preferable average size of document. Default: 65536, min: 16384
|
||||
--bsz ## Max HTTP/WS API document body size. Default: 67108864, min: 524288
|
||||
Advanced options:
|
||||
-S, --sbz=NUM Max sorting buffer size. If exceeded, an overflow temp file for data will be created.
|
||||
Default: 16777216, min: 1048576
|
||||
-D, --dsz=NUM Initial size of buffer to process/store document on queries. Preferable average size of document.
|
||||
Default: 65536, min: 16384
|
||||
-T, --trylock Exit with error if database is locked by another process.
|
||||
If not set, current process will wait for lock release.
|
||||
|
||||
Use any of the following input formats:
|
||||
-arg <value> -arg=<value> -arg<value>
|
||||
|
||||
Use the -h, -help or -? to get this information again.
|
||||
```
|
||||
|
||||
+174
-88
@@ -1,105 +1,191 @@
|
||||
#include "ejdb2.h"
|
||||
#include "jbr.h"
|
||||
#include "ejdb2cfg.h"
|
||||
|
||||
#include <fio_cli.h>
|
||||
#include <iowow/iwpool.h>
|
||||
#include <iowow/iwconv.h>
|
||||
#include <iwnet/utils.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <signal.h>
|
||||
|
||||
EJDB db; // -V707
|
||||
EJDB_OPTS opts;
|
||||
struct env {
|
||||
const char *program;
|
||||
EJDB db;
|
||||
EJDB_OPTS opts;
|
||||
IWPOOL *pool;
|
||||
} env;
|
||||
|
||||
int main(int argc, char const *argv[]) {
|
||||
iwrc rc = 0;
|
||||
fio_cli_start(argc, argv, 0, 0,
|
||||
"EJDB " EJDB2_VERSION " standalone HTTP REST/Websocket server. http://ejdb.org\n",
|
||||
FIO_CLI_STRING("--file -f Database file path. Default: ejdb2.db"),
|
||||
FIO_CLI_INT("--port -p HTTP port number listen to. Default: 9191"),
|
||||
FIO_CLI_STRING("--bind -b Address server listen. Default: localhost"),
|
||||
FIO_CLI_STRING("--access -a Server access token matched to 'X-Access-Token' HTTP header value.\n"
|
||||
"If token prefixed by '@' it will be treated as file."),
|
||||
FIO_CLI_BOOL("--trunc -t Cleanup existing database file on open"),
|
||||
FIO_CLI_BOOL("--wal -w Use write ahead logging (WAL). Must be set for data durability."),
|
||||
FIO_CLI_BOOL("--cors Enable Cross-Origin Resource Sharing (CORS)."),
|
||||
FIO_CLI_PRINT_HEADER("Advanced options"),
|
||||
FIO_CLI_INT(
|
||||
"--sbz Max sorting buffer size. If exceeded, an overflow temp file for data will be created. "
|
||||
"Default: 16777216, min: 1048576"),
|
||||
FIO_CLI_INT("--dsz Initial size of buffer to process/store document on queries. "
|
||||
"Preferable average size of document. "
|
||||
"Default: 65536, min: 16384"),
|
||||
FIO_CLI_INT("--bsz Max HTTP/WS API document body size. " "Default: 67108864, min: 524288"),
|
||||
FIO_CLI_BOOL("--trylock Fail if database is locked by another process."
|
||||
" If not set, current process will wait for lock release")
|
||||
static int _usage(const char *err) {
|
||||
if (err) {
|
||||
fprintf(stderr, "\n%s\n", err);
|
||||
}
|
||||
fprintf(stderr, "\n\tEJDB " EJDB2_VERSION " HTTP REST/Websocket server. http://ejdb.org\n");
|
||||
fprintf(stderr, "\nUsage:\n\n\t %s [options]\n\n", env.program);
|
||||
fprintf(stderr, "\t-v, --version\t\tPrint program version.\n");
|
||||
fprintf(stderr, "\t-f, --file=<>\t\tDatabase file path. Default: ejdb2.db\n");
|
||||
fprintf(stderr, "\t-p, --port=NUM\t\tHTTP server port numer. Default: 9191\n");
|
||||
fprintf(stderr, "\t-l, --listen=<>\t\tNetwork address server will listen. Default: localhost\n");
|
||||
fprintf(stderr, "\t-k, --key=<>\t\tPEM private key file for TLS 1.2 HTTP server.\n");
|
||||
fprintf(stderr, "\t-c, --certs=<>\t\tPEM certificates file for TLS 1.2 HTTP server.\n");
|
||||
fprintf(stderr, "\t-a, --access=TOKEN|@FILE\t\tAccess token to match 'X-Access-Token' HTTP header value.\n");
|
||||
fprintf(stderr, "\t-r, --access-read\t\tAllows unrestricted read-only data access.\n");
|
||||
fprintf(stderr, "\t-C, --cors\t\tEnable COSR response headers for HTTP server\n");
|
||||
fprintf(stderr, "\t-t, --trunc\t\tCleanup/reset database file on open.\n");
|
||||
fprintf(stderr, "\t-w, --wal\t\tuse the write ahead log (WAL). Used to provide data durability.\n");
|
||||
fprintf(stderr, "\nAdvanced options:\n");
|
||||
fprintf(stderr,
|
||||
"\t-S, --sbz=NUM\t\tMax sorting buffer size. If exceeded, an overflow temp file for data will be created."
|
||||
"Default: 16777216, min: 1048576\n");
|
||||
fprintf(stderr, "\t-D, --dsz=NUM\t\tInitial size of buffer to process/store document on queries."
|
||||
" Preferable average size of document. Default: 65536, min: 16384\n");
|
||||
fprintf(stderr, "\t-T, --trylock Exit with error if database is locked by another process."
|
||||
" If not set, current process will wait for lock release.");
|
||||
fprintf(stderr, "\n\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
);
|
||||
fio_cli_set_default("--file", "ejdb2.db");
|
||||
fio_cli_set_default("-f", "ejdb2.db");
|
||||
fio_cli_set_default("--port", "9191");
|
||||
fio_cli_set_default("-p", "9191");
|
||||
fio_cli_set_default("--sbz", "16777216");
|
||||
fio_cli_set_default("--dsz", "65536");
|
||||
fio_cli_set_default("--bsz", "67108864");
|
||||
static void _on_signal(int signo) {
|
||||
if (env.db) {
|
||||
jbr_shutdown_request(env.db);
|
||||
}
|
||||
}
|
||||
|
||||
char access_token_buf[255];
|
||||
const char *access_token = fio_cli_get("-a");
|
||||
if (access_token && (*access_token == '@')) {
|
||||
access_token = access_token + 1;
|
||||
FILE *f = fopen(access_token, "r");
|
||||
if (!f) {
|
||||
rc = iwrc_set_errno(IW_ERROR_IO_ERRNO, errno);
|
||||
goto finish;
|
||||
}
|
||||
size_t n = fread(access_token_buf, 1, sizeof(access_token_buf), f);
|
||||
if ((n == 0) || (n == sizeof(access_token_buf))) {
|
||||
fclose(f);
|
||||
rc = IW_ERROR_INVALID_VALUE;
|
||||
iwlog_error("Invalid access token from %s", access_token);
|
||||
goto finish;
|
||||
}
|
||||
access_token_buf[n] = '\0';
|
||||
for (int i = 0; i < n; ++i) {
|
||||
if (isspace(access_token_buf[i])) {
|
||||
access_token_buf[i] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
access_token = access_token_buf;
|
||||
} else if (access_token && (strlen(access_token) >= sizeof(access_token_buf))) {
|
||||
rc = IW_ERROR_INVALID_VALUE;
|
||||
iwlog_error2("Invalid access token");
|
||||
goto finish;
|
||||
static void _version(void) {
|
||||
fprintf(stdout, EJDB2_VERSION);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
signal(SIGHUP, SIG_IGN);
|
||||
signal(SIGALRM, SIG_IGN);
|
||||
signal(SIGUSR1, SIG_IGN);
|
||||
signal(SIGUSR2, SIG_IGN);
|
||||
if (signal(SIGTERM, _on_signal) == SIG_ERR) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (signal(SIGINT, _on_signal) == SIG_ERR) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
EJDB_OPTS ov = {
|
||||
.kv = {
|
||||
.path = fio_cli_get("-f"),
|
||||
.oflags = fio_cli_get_i("-t") ? IWKV_TRUNC : 0,
|
||||
.file_lock_fail_fast = fio_cli_get_bool("--trylock")
|
||||
},
|
||||
.no_wal = !fio_cli_get_i("-w"),
|
||||
.sort_buffer_sz = fio_cli_get_i("--sbz"),
|
||||
.document_buffer_sz = fio_cli_get_i("--dsz"),
|
||||
.http = {
|
||||
.enabled = true,
|
||||
.blocking = true,
|
||||
.port = fio_cli_get_i("-p"),
|
||||
.bind = fio_cli_get("-b"),
|
||||
.access_token = access_token,
|
||||
.max_body_size = fio_cli_get_i("--bsz"),
|
||||
.cors = fio_cli_get_bool("--cors")
|
||||
}
|
||||
};
|
||||
memcpy(&opts, &ov, sizeof(ov));
|
||||
IWPOOL *pool;
|
||||
int ec = 0, ch;
|
||||
|
||||
env.program = argc ? argv[0] : "";
|
||||
env.opts.http.enabled = true;
|
||||
env.opts.http.blocking = true;
|
||||
env.opts.no_wal = true;
|
||||
|
||||
iwrc rc = ejdb_init();
|
||||
if (rc) {
|
||||
iwlog_ecode_error3(rc);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
RCA(pool = env.pool = iwpool_create_empty(), finish);
|
||||
|
||||
static const struct option long_options[] = {
|
||||
{ "help", 0, 0, 'h' },
|
||||
{ "version", 0, 0, 'v' },
|
||||
{ "file", 1, 0, 'f' },
|
||||
{ "port", 1, 0, 'p' },
|
||||
{ "bind", 1, 0, 'b' }, // for backward compatibility
|
||||
{ "listen", 1, 0, 'l' },
|
||||
{ "key", 1, 0, 'k' },
|
||||
{ "certs", 1, 0, 'c' },
|
||||
{ "access", 1, 0, 'a' },
|
||||
{ "access-read", 0, 0, 'r' },
|
||||
{ "cors", 0, 0, 'C' },
|
||||
{ "trunc", 0, 0, 't' },
|
||||
{ "wal", 0, 0, 'w' },
|
||||
{ "sbz", 1, 0, 'S' },
|
||||
{ "dsz", 1, 0, 'D' },
|
||||
{ "trylock", 0, 0, 'T' }
|
||||
};
|
||||
|
||||
while ((ch = getopt_long(argc, argv, "f:p:b:l:k:c:a:S:D:rCtwThv", long_options, 0)) != -1) {
|
||||
switch (ch) {
|
||||
case 'h':
|
||||
ec = _usage(0);
|
||||
goto finish;
|
||||
case 'v':
|
||||
_version();
|
||||
goto finish;
|
||||
case 'f':
|
||||
env.opts.kv.path = iwpool_strdup2(pool, optarg);
|
||||
break;
|
||||
case 'p':
|
||||
env.opts.http.port = iwatoi(optarg);
|
||||
break;
|
||||
case 'b':
|
||||
case 'l':
|
||||
env.opts.http.bind = iwpool_strdup2(pool, optarg);
|
||||
break;
|
||||
case 'k':
|
||||
env.opts.http.ssl_private_key = iwpool_strdup2(pool, optarg);
|
||||
break;
|
||||
case 'c':
|
||||
env.opts.http.ssl_certs = iwpool_strdup2(pool, optarg);
|
||||
break;
|
||||
case 'a':
|
||||
env.opts.http.access_token = iwpool_strdup2(pool, optarg);
|
||||
env.opts.http.access_token_len = env.opts.http.access_token ? strlen(env.opts.http.access_token) : 0;
|
||||
break;
|
||||
case 'C':
|
||||
env.opts.http.cors = true;
|
||||
break;
|
||||
case 't':
|
||||
env.opts.kv.oflags |= IWKV_TRUNC;
|
||||
break;
|
||||
case 'w':
|
||||
env.opts.no_wal = false;
|
||||
break;
|
||||
case 'S':
|
||||
env.opts.sort_buffer_sz = iwatoi(optarg);
|
||||
break;
|
||||
case 'D':
|
||||
env.opts.document_buffer_sz = iwatoi(optarg);
|
||||
break;
|
||||
case 'T':
|
||||
env.opts.kv.file_lock_fail_fast = true;
|
||||
break;
|
||||
case 'r':
|
||||
env.opts.http.read_anon = true;
|
||||
break;
|
||||
default:
|
||||
ec = _usage(0);
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
|
||||
if (!env.opts.kv.path) {
|
||||
env.opts.kv.path = "ejdb2.db";
|
||||
}
|
||||
if (env.opts.http.port < 1) {
|
||||
env.opts.http.port = 9191;
|
||||
}
|
||||
if (env.opts.sort_buffer_sz < 1) {
|
||||
env.opts.sort_buffer_sz = 16777216;
|
||||
} else if (env.opts.sort_buffer_sz < 1048576) {
|
||||
env.opts.sort_buffer_sz = 1048576;
|
||||
}
|
||||
if (env.opts.document_buffer_sz < 1) {
|
||||
env.opts.document_buffer_sz = 65536;
|
||||
} else if (env.opts.document_buffer_sz < 16384) {
|
||||
env.opts.document_buffer_sz = 16384;
|
||||
}
|
||||
|
||||
RCC(rc, finish, ejdb_open(&env.opts, &env.db));
|
||||
RCC(rc, finish, ejdb_close(&env.db));
|
||||
|
||||
rc = ejdb_open(&opts, &db);
|
||||
RCGO(rc, finish);
|
||||
IWRC(ejdb_close(&db), rc);
|
||||
finish:
|
||||
fio_cli_end();
|
||||
if (rc) {
|
||||
iwlog_ecode_error3(rc);
|
||||
}
|
||||
return rc ? 1 : 0;
|
||||
iwpool_destroy(env.pool);
|
||||
fflush(0);
|
||||
return rc == 0 ? ec : 1;
|
||||
}
|
||||
|
||||
@@ -442,6 +442,8 @@ PROJECTIONS = PROJECTION [ {'+' | '-'} PROJECTION ]
|
||||
|
||||
Projection allows to get only subset of JSON document excluding not needed data.
|
||||
|
||||
**Query placeholders API is supported in projections.**
|
||||
|
||||
Lets add one more document to our collection:
|
||||
|
||||
```sh
|
||||
|
||||
+48
-34
@@ -22,7 +22,7 @@ static void _jqp_fatal(yycontext *yy, iwrc rc) {
|
||||
longjmp(aux->fatal_jmp, 1);
|
||||
}
|
||||
|
||||
static void *_jqp_malloc(struct _yycontext *yy, size_t size) {
|
||||
static void* _jqp_malloc(struct _yycontext *yy, size_t size) {
|
||||
void *ret = malloc(size);
|
||||
if (!ret) {
|
||||
JQP_AUX *aux = yy->aux;
|
||||
@@ -32,7 +32,7 @@ static void *_jqp_malloc(struct _yycontext *yy, size_t size) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void *_jqp_realloc(struct _yycontext *yy, void *ptr, size_t size) {
|
||||
static void* _jqp_realloc(struct _yycontext *yy, void *ptr, size_t size) {
|
||||
void *ret = realloc(ptr, size);
|
||||
if (!ret) {
|
||||
JQP_AUX *aux = yy->aux;
|
||||
@@ -55,14 +55,14 @@ static iwrc _jqp_aux_set_input(JQP_AUX *aux, const char *input) {
|
||||
|
||||
//-----------------
|
||||
|
||||
IW_INLINE char *_jqp_strdup(struct _yycontext *yy, const char *text) {
|
||||
IW_INLINE char* _jqp_strdup(struct _yycontext *yy, const char *text) {
|
||||
iwrc rc = 0;
|
||||
char *ret = iwpool_strdup(yy->aux->pool, text, &rc);
|
||||
JQRC(yy, rc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_unit(yycontext *yy) {
|
||||
static JQPUNIT* _jqp_unit(yycontext *yy) {
|
||||
JQPUNIT *ret = iwpool_calloc(sizeof(JQPUNIT), yy->aux->pool);
|
||||
if (!ret) {
|
||||
JQRC(yy, iwrc_set_errno(IW_ERROR_ALLOC, errno));
|
||||
@@ -70,7 +70,7 @@ static JQPUNIT *_jqp_unit(yycontext *yy) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
static JQP_STACK *_jqp_push(yycontext *yy) {
|
||||
static JQP_STACK* _jqp_push(yycontext *yy) {
|
||||
JQP_AUX *aux = yy->aux;
|
||||
JQP_STACK *stack;
|
||||
if (aux->stackn < (sizeof(aux->stackpool) / sizeof(aux->stackpool[0]))) {
|
||||
@@ -120,7 +120,7 @@ static void _jqp_unit_push(yycontext *yy, JQPUNIT *unit) {
|
||||
stack->unit = unit;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_unit_pop(yycontext *yy) {
|
||||
static JQPUNIT* _jqp_unit_pop(yycontext *yy) {
|
||||
JQP_STACK stack = _jqp_pop(yy);
|
||||
if (stack.type != STACK_UNIT) {
|
||||
iwlog_error("Unexpected type: %d", stack.type);
|
||||
@@ -143,7 +143,7 @@ static void _jqp_string_push(yycontext *yy, char *str, bool dup) {
|
||||
}
|
||||
}
|
||||
|
||||
static char *_jqp_string_pop(yycontext *yy) {
|
||||
static char* _jqp_string_pop(yycontext *yy) {
|
||||
JQP_STACK stack = _jqp_pop(yy);
|
||||
if (stack.type != STACK_STRING) {
|
||||
iwlog_error("Unexpected type: %d", stack.type);
|
||||
@@ -152,7 +152,7 @@ static char *_jqp_string_pop(yycontext *yy) {
|
||||
return stack.str;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_string(yycontext *yy, jqp_string_flavours_t flavour, const char *text) {
|
||||
static JQPUNIT* _jqp_string(yycontext *yy, jqp_string_flavours_t flavour, const char *text) {
|
||||
JQPUNIT *unit = _jqp_unit(yy);
|
||||
unit->type = JQP_STRING_TYPE;
|
||||
unit->string.flavour |= flavour;
|
||||
@@ -160,7 +160,7 @@ static JQPUNIT *_jqp_string(yycontext *yy, jqp_string_flavours_t flavour, const
|
||||
return unit;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_number(yycontext *yy, jqp_int_flavours_t flavour, const char *text) {
|
||||
static JQPUNIT* _jqp_number(yycontext *yy, jqp_int_flavours_t flavour, const char *text) {
|
||||
JQPUNIT *unit = _jqp_unit(yy);
|
||||
char *eptr;
|
||||
int64_t ival = strtoll(text, &eptr, 0);
|
||||
@@ -184,7 +184,7 @@ static JQPUNIT *_jqp_number(yycontext *yy, jqp_int_flavours_t flavour, const cha
|
||||
return unit;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_json_number(yycontext *yy, const char *text) {
|
||||
static JQPUNIT* _jqp_json_number(yycontext *yy, const char *text) {
|
||||
JQPUNIT *unit = _jqp_unit(yy);
|
||||
char *eptr;
|
||||
unit->type = JQP_JSON_TYPE;
|
||||
@@ -207,7 +207,7 @@ static JQPUNIT *_jqp_json_number(yycontext *yy, const char *text) {
|
||||
return unit;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_placeholder(yycontext *yy, const char *text) {
|
||||
static JQPUNIT* _jqp_placeholder(yycontext *yy, const char *text) {
|
||||
JQP_AUX *aux = yy->aux;
|
||||
JQPUNIT *unit = _jqp_unit(yy);
|
||||
unit->type = JQP_STRING_TYPE;
|
||||
@@ -345,7 +345,7 @@ static int _jqp_unescape_json_string(const char *p, char *d, int dlen, iwrc *rcp
|
||||
return 0;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_unescaped_string(struct _yycontext *yy, jqp_string_flavours_t flv, const char *text) {
|
||||
static JQPUNIT* _jqp_unescaped_string(struct _yycontext *yy, jqp_string_flavours_t flv, const char *text) {
|
||||
JQP_AUX *aux = yy->aux;
|
||||
JQPUNIT *unit = _jqp_unit(yy);
|
||||
unit->type = JQP_STRING_TYPE;
|
||||
@@ -367,7 +367,7 @@ static JQPUNIT *_jqp_unescaped_string(struct _yycontext *yy, jqp_string_flavours
|
||||
return unit;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_json_string(struct _yycontext *yy, const char *text) {
|
||||
static JQPUNIT* _jqp_json_string(struct _yycontext *yy, const char *text) {
|
||||
JQP_AUX *aux = yy->aux;
|
||||
JQPUNIT *unit = _jqp_unit(yy);
|
||||
unit->type = JQP_JSON_TYPE;
|
||||
@@ -390,7 +390,7 @@ static JQPUNIT *_jqp_json_string(struct _yycontext *yy, const char *text) {
|
||||
return unit;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_json_pair(yycontext *yy, JQPUNIT *key, JQPUNIT *val) {
|
||||
static JQPUNIT* _jqp_json_pair(yycontext *yy, JQPUNIT *key, JQPUNIT *val) {
|
||||
if ((key->type != JQP_JSON_TYPE) || (val->type != JQP_JSON_TYPE) || (key->json.jn.type != JBV_STR)) {
|
||||
iwlog_error2("Invalid arguments");
|
||||
JQRC(yy, JQL_ERROR_QUERY_PARSE);
|
||||
@@ -400,7 +400,7 @@ static JQPUNIT *_jqp_json_pair(yycontext *yy, JQPUNIT *key, JQPUNIT *val) {
|
||||
return val;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_json_collect(yycontext *yy, jbl_type_t type, JQPUNIT *until) {
|
||||
static JQPUNIT* _jqp_json_collect(yycontext *yy, jbl_type_t type, JQPUNIT *until) {
|
||||
JQP_AUX *aux = yy->aux;
|
||||
JQPUNIT *ret = _jqp_unit(yy);
|
||||
ret->type = JQP_JSON_TYPE;
|
||||
@@ -430,7 +430,7 @@ static JQPUNIT *_jqp_json_collect(yycontext *yy, jbl_type_t type, JQPUNIT *until
|
||||
return ret;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_json_true_false_null(yycontext *yy, const char *text) {
|
||||
static JQPUNIT* _jqp_json_true_false_null(yycontext *yy, const char *text) {
|
||||
JQPUNIT *unit = _jqp_unit(yy);
|
||||
unit->type = JQP_JSON_TYPE;
|
||||
int len = strlen(text);
|
||||
@@ -457,7 +457,7 @@ static void _jqp_op_negate_reset(yycontext *yy) {
|
||||
yy->aux->negate = false;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_unit_op(yycontext *yy, const char *text) {
|
||||
static JQPUNIT* _jqp_unit_op(yycontext *yy, const char *text) {
|
||||
JQP_AUX *aux = yy->aux;
|
||||
JQPUNIT *unit = _jqp_unit(yy);
|
||||
unit->type = JQP_OP_TYPE;
|
||||
@@ -495,7 +495,7 @@ static JQPUNIT *_jqp_unit_op(yycontext *yy, const char *text) {
|
||||
return unit;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_unit_join(yycontext *yy, const char *text) {
|
||||
static JQPUNIT* _jqp_unit_join(yycontext *yy, const char *text) {
|
||||
JQP_AUX *aux = yy->aux;
|
||||
JQPUNIT *unit = _jqp_unit(yy);
|
||||
unit->type = JQP_JOIN_TYPE;
|
||||
@@ -509,7 +509,7 @@ static JQPUNIT *_jqp_unit_join(yycontext *yy, const char *text) {
|
||||
return unit;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_expr(yycontext *yy, JQPUNIT *left, JQPUNIT *op, JQPUNIT *right) {
|
||||
static JQPUNIT* _jqp_expr(yycontext *yy, JQPUNIT *left, JQPUNIT *op, JQPUNIT *right) {
|
||||
if (!left || !op || !right) {
|
||||
iwlog_error2("Invalid arguments");
|
||||
JQRC(yy, JQL_ERROR_QUERY_PARSE);
|
||||
@@ -526,7 +526,7 @@ static JQPUNIT *_jqp_expr(yycontext *yy, JQPUNIT *left, JQPUNIT *op, JQPUNIT *ri
|
||||
return unit;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_pop_expr_chain(yycontext *yy, JQPUNIT *until) {
|
||||
static JQPUNIT* _jqp_pop_expr_chain(yycontext *yy, JQPUNIT *until) {
|
||||
JQPUNIT *expr = 0;
|
||||
JQP_AUX *aux = yy->aux;
|
||||
while (aux->stack && aux->stack->type == STACK_UNIT) {
|
||||
@@ -550,7 +550,7 @@ static JQPUNIT *_jqp_pop_expr_chain(yycontext *yy, JQPUNIT *until) {
|
||||
return expr;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_projection(struct _yycontext *yy, JQPUNIT *value, uint8_t flags) {
|
||||
static JQPUNIT* _jqp_projection(struct _yycontext *yy, JQPUNIT *value, uint8_t flags) {
|
||||
if (value->type != JQP_STRING_TYPE) {
|
||||
iwlog_error("Unexpected type: %d", value->type);
|
||||
JQRC(yy, JQL_ERROR_QUERY_PARSE);
|
||||
@@ -562,7 +562,7 @@ static JQPUNIT *_jqp_projection(struct _yycontext *yy, JQPUNIT *value, uint8_t f
|
||||
return unit;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_pop_projection_nodes(yycontext *yy, JQPUNIT *until) {
|
||||
static JQPUNIT* _jqp_pop_projection_nodes(yycontext *yy, JQPUNIT *until) {
|
||||
JQPUNIT *first = 0;
|
||||
JQP_AUX *aux = yy->aux;
|
||||
uint8_t flags = 0;
|
||||
@@ -586,6 +586,8 @@ static JQPUNIT *_jqp_pop_projection_nodes(yycontext *yy, JQPUNIT *until) {
|
||||
} else if (strchr(unit->string.value, '<')) { // JOIN Projection?
|
||||
unit->string.flavour |= JQP_STR_PROJOIN;
|
||||
flags |= JQP_PROJECTION_FLAG_JOINS;
|
||||
} else {
|
||||
unit->string.flavour |= JQP_STR_PROJPATH;
|
||||
}
|
||||
first = unit;
|
||||
_jqp_pop(yy);
|
||||
@@ -599,7 +601,7 @@ static JQPUNIT *_jqp_pop_projection_nodes(yycontext *yy, JQPUNIT *until) {
|
||||
return _jqp_projection(yy, first, flags);
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_push_joined_projection(struct _yycontext *yy, JQPUNIT *p) {
|
||||
static JQPUNIT* _jqp_push_joined_projection(struct _yycontext *yy, JQPUNIT *p) {
|
||||
JQP_AUX *aux = yy->aux;
|
||||
if (!aux->stack || (aux->stack->type != STACK_STRING)) {
|
||||
iwlog_error2("Invalid stack state");
|
||||
@@ -614,7 +616,7 @@ static JQPUNIT *_jqp_push_joined_projection(struct _yycontext *yy, JQPUNIT *p) {
|
||||
return p;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_pop_joined_projections(yycontext *yy, JQPUNIT *until) {
|
||||
static JQPUNIT* _jqp_pop_joined_projections(yycontext *yy, JQPUNIT *until) {
|
||||
JQPUNIT *first = 0;
|
||||
JQP_AUX *aux = yy->aux;
|
||||
while (aux->stack && aux->stack->type == STACK_UNIT) {
|
||||
@@ -635,7 +637,7 @@ static JQPUNIT *_jqp_pop_joined_projections(yycontext *yy, JQPUNIT *until) {
|
||||
return first;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_pop_projfields_chain(yycontext *yy, JQPUNIT *until) {
|
||||
static JQPUNIT* _jqp_pop_projfields_chain(yycontext *yy, JQPUNIT *until) {
|
||||
JQPUNIT *field = 0;
|
||||
JQP_AUX *aux = yy->aux;
|
||||
while (aux->stack && aux->stack->type == STACK_UNIT) {
|
||||
@@ -660,7 +662,7 @@ static JQPUNIT *_jqp_pop_projfields_chain(yycontext *yy, JQPUNIT *until) {
|
||||
return field;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_pop_ordernodes(yycontext *yy, JQPUNIT *until) {
|
||||
static JQPUNIT* _jqp_pop_ordernodes(yycontext *yy, JQPUNIT *until) {
|
||||
JQPUNIT *first = 0;
|
||||
JQP_AUX *aux = yy->aux;
|
||||
while (aux->stack && aux->stack->type == STACK_UNIT) {
|
||||
@@ -681,7 +683,7 @@ static JQPUNIT *_jqp_pop_ordernodes(yycontext *yy, JQPUNIT *until) {
|
||||
return until;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_node(yycontext *yy, JQPUNIT *value) {
|
||||
static JQPUNIT* _jqp_node(yycontext *yy, JQPUNIT *value) {
|
||||
JQPUNIT *unit = _jqp_unit(yy);
|
||||
unit->type = JQP_NODE_TYPE;
|
||||
unit->node.value = value;
|
||||
@@ -704,7 +706,7 @@ static JQPUNIT *_jqp_node(yycontext *yy, JQPUNIT *value) {
|
||||
return unit;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_pop_node_chain(yycontext *yy, JQPUNIT *until) {
|
||||
static JQPUNIT* _jqp_pop_node_chain(yycontext *yy, JQPUNIT *until) {
|
||||
JQPUNIT *filter, *first = 0;
|
||||
JQP_AUX *aux = yy->aux;
|
||||
while (aux->stack && aux->stack->type == STACK_UNIT) {
|
||||
@@ -741,7 +743,7 @@ static JQPUNIT *_jqp_pop_node_chain(yycontext *yy, JQPUNIT *until) {
|
||||
return filter;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_pop_filter_factor_chain(yycontext *yy, JQPUNIT *until) {
|
||||
static JQPUNIT* _jqp_pop_filter_factor_chain(yycontext *yy, JQPUNIT *until) {
|
||||
JQP_EXPR_NODE *factor = 0;
|
||||
JQP_AUX *aux = yy->aux;
|
||||
JQPUNIT *exprnode = _jqp_unit(yy);
|
||||
@@ -782,7 +784,7 @@ static void _jqp_set_filters_expr(yycontext *yy, JQPUNIT *expr) {
|
||||
aux->query = &query->query;
|
||||
}
|
||||
|
||||
static JQPUNIT *_jqp_create_filterexpr_pk(yycontext *yy, JQPUNIT *argument) {
|
||||
static JQPUNIT* _jqp_create_filterexpr_pk(yycontext *yy, JQPUNIT *argument) {
|
||||
JQP_AUX *aux = yy->aux;
|
||||
const char *anchor = 0;
|
||||
// Looking for optional
|
||||
@@ -1062,6 +1064,8 @@ finish:
|
||||
RCRET(rc); \
|
||||
} while (0)
|
||||
|
||||
IW_INLINE iwrc _print_placeholder(const char *value, jbl_json_printer pt, void *op);
|
||||
|
||||
static iwrc _jqp_print_projection_nodes(const JQP_STRING *p, jbl_json_printer pt, void *op) {
|
||||
iwrc rc = 0;
|
||||
for (const JQP_STRING *s = p; s; s = s->next) {
|
||||
@@ -1071,14 +1075,22 @@ static iwrc _jqp_print_projection_nodes(const JQP_STRING *p, jbl_json_printer pt
|
||||
if (s->flavour & JQP_STR_PROJFIELD) {
|
||||
PT(0, 0, '{', 1);
|
||||
for (const JQP_STRING *pf = s; pf; pf = pf->subnext) {
|
||||
PT(pf->value, -1, 0, 0);
|
||||
if (pf->flavour & JQP_STR_PLACEHOLDER) {
|
||||
RCR(_print_placeholder(pf->value, pt, op));
|
||||
} else {
|
||||
PT(pf->value, -1, 0, 0);
|
||||
}
|
||||
if (pf->subnext) {
|
||||
PT(0, 0, ',', 1);
|
||||
}
|
||||
}
|
||||
PT(0, 0, '}', 1);
|
||||
} else {
|
||||
PT(s->value, -1, 0, 0);
|
||||
if (s->flavour & JQP_STR_PLACEHOLDER) {
|
||||
RCR(_print_placeholder(s->value, pt, op));
|
||||
} else {
|
||||
PT(s->value, -1, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
@@ -1258,7 +1270,8 @@ static iwrc _jqp_print_filter(
|
||||
const JQP_QUERY *q,
|
||||
const JQP_FILTER *f,
|
||||
jbl_json_printer pt,
|
||||
void *op) {
|
||||
void *op
|
||||
) {
|
||||
iwrc rc = 0;
|
||||
if (f->anchor) {
|
||||
PT(0, 0, '@', 1);
|
||||
@@ -1275,7 +1288,8 @@ static iwrc _jqp_print_expression_node(
|
||||
const JQP_QUERY *q,
|
||||
const JQP_EXPR_NODE *en,
|
||||
jbl_json_printer pt,
|
||||
void *op) {
|
||||
void *op
|
||||
) {
|
||||
iwrc rc = 0;
|
||||
bool inbraces = (en != q->aux->expr && en->type == JQP_EXPR_NODE_TYPE);
|
||||
if (inbraces) {
|
||||
|
||||
+158
-73
@@ -3,7 +3,9 @@
|
||||
#include "jbl_internal.h"
|
||||
#include "jql_internal.h"
|
||||
#include "jqp.h"
|
||||
#include "lwre.h"
|
||||
|
||||
#include <ejdb2/iowow/iwre.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/** Query matching context */
|
||||
@@ -30,7 +32,7 @@ typedef struct MFCTX {
|
||||
JQP_FILTER *qpf;
|
||||
} MFCTX;
|
||||
|
||||
static JQP_NODE *_jql_match_node(MCTX *mctx, JQP_NODE *n, bool *res, iwrc *rcp);
|
||||
static JQP_NODE* _jql_match_node(MCTX *mctx, JQP_NODE *n, bool *res, iwrc *rcp);
|
||||
|
||||
IW_INLINE void _jql_jqval_destroy(JQP_STRING *pv) {
|
||||
JQVAL *qv = pv->opaque;
|
||||
@@ -42,7 +44,7 @@ IW_INLINE void _jql_jqval_destroy(JQP_STRING *pv) {
|
||||
break;
|
||||
case JQVAL_RE:
|
||||
ptr = (void*) qv->vre->expression;
|
||||
lwre_free(qv->vre);
|
||||
iwre_free(qv->vre);
|
||||
break;
|
||||
case JQVAL_JBLNODE:
|
||||
ptr = qv->vnode;
|
||||
@@ -51,15 +53,17 @@ IW_INLINE void _jql_jqval_destroy(JQP_STRING *pv) {
|
||||
ptr = 0;
|
||||
break;
|
||||
}
|
||||
if (ptr && qv->freefn) {
|
||||
qv->freefn(ptr, qv->freefn_op);
|
||||
if (--qv->refs <= 0) {
|
||||
if (ptr && qv->freefn) {
|
||||
qv->freefn(ptr, qv->freefn_op);
|
||||
}
|
||||
free(qv);
|
||||
}
|
||||
pv->opaque = 0;
|
||||
free(qv);
|
||||
}
|
||||
}
|
||||
|
||||
static JQVAL *_jql_find_placeholder(JQL q, const char *name) {
|
||||
static JQVAL* _jql_find_placeholder(JQL q, const char *name) {
|
||||
JQP_AUX *aux = q->aux;
|
||||
for (JQP_STRING *pv = aux->start_placeholder; pv; pv = pv->placeholder_next) {
|
||||
if (!strcmp(pv->value, name)) {
|
||||
@@ -69,46 +73,74 @@ static JQVAL *_jql_find_placeholder(JQL q, const char *name) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
JQVAL *jql_find_placeholder(JQL q, const char *name) {
|
||||
JQVAL* jql_find_placeholder(JQL q, const char *name) {
|
||||
return _jql_find_placeholder(q, name);
|
||||
}
|
||||
|
||||
static iwrc _jql_set_placeholder(JQL q, const char *placeholder, int index, JQVAL *val) {
|
||||
JQP_AUX *aux = q->aux;
|
||||
iwrc rc = JQL_ERROR_INVALID_PLACEHOLDER;
|
||||
if (!placeholder) { // Index
|
||||
char nbuf[JBNUMBUF_SIZE];
|
||||
iwitoa(index, nbuf, JBNUMBUF_SIZE);
|
||||
for (JQP_STRING *pv = aux->start_placeholder; pv; pv = pv->placeholder_next) {
|
||||
if ((pv->value[0] == '?') && !strcmp(pv->value + 1, nbuf)) {
|
||||
if ((pv->flavour & (JQP_STR_PROJFIELD | JQP_STR_PROJPATH)) && val->type != JQVAL_STR) {
|
||||
return JQL_ERROR_INVALID_PLACEHOLDER_VALUE_TYPE;
|
||||
}
|
||||
_jql_jqval_destroy(pv);
|
||||
pv->opaque = val;
|
||||
val->refs++;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (JQP_STRING *pv = aux->start_placeholder; pv; pv = pv->placeholder_next) {
|
||||
if (!strcmp(pv->value, placeholder)) {
|
||||
if ((pv->flavour & (JQP_STR_PROJFIELD | JQP_STR_PROJPATH)) && val->type != JQVAL_STR) {
|
||||
rc = JQL_ERROR_INVALID_PLACEHOLDER_VALUE_TYPE;
|
||||
goto finish;
|
||||
}
|
||||
_jql_jqval_destroy(pv);
|
||||
pv->opaque = val;
|
||||
return 0;
|
||||
val->refs++;
|
||||
rc = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return JQL_ERROR_INVALID_PLACEHOLDER;
|
||||
finish:
|
||||
if (rc) {
|
||||
val->refs = 0;
|
||||
for (JQP_STRING *pv = aux->start_placeholder; pv; pv = pv->placeholder_next) {
|
||||
if (pv->opaque == val) {
|
||||
pv->opaque = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
iwrc jql_set_json2(
|
||||
JQL q, const char *placeholder, int index, JBL_NODE val,
|
||||
void (*freefn)(void*, void*), void *op) {
|
||||
void (*freefn)(void*, void*), void *op
|
||||
) {
|
||||
JQVAL *qv = malloc(sizeof(*qv));
|
||||
if (!qv) {
|
||||
return iwrc_set_errno(IW_ERROR_ALLOC, errno);
|
||||
}
|
||||
qv->refs = 0;
|
||||
qv->freefn = freefn;
|
||||
qv->freefn_op = op;
|
||||
qv->type = JQVAL_JBLNODE;
|
||||
qv->vnode = val;
|
||||
return _jql_set_placeholder(q, placeholder, index, qv);
|
||||
iwrc rc = _jql_set_placeholder(q, placeholder, index, qv);
|
||||
if (rc) {
|
||||
if (freefn) {
|
||||
freefn(val, op);
|
||||
}
|
||||
free(qv);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
iwrc jql_set_json(JQL q, const char *placeholder, int index, JBL_NODE val) {
|
||||
@@ -124,10 +156,11 @@ iwrc jql_set_json_jbl(JQL q, const char *placeholder, int index, JBL jbl) {
|
||||
if (!pool) {
|
||||
return iwrc_set_errno(IW_ERROR_ALLOC, errno);
|
||||
}
|
||||
iwrc rc;
|
||||
JBL_NODE n;
|
||||
iwrc rc = jbl_to_node(jbl, &n, true, pool);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jbl_to_node(jbl, &n, true, pool));
|
||||
rc = jql_set_json2(q, placeholder, index, n, _jql_free_iwpool, pool);
|
||||
|
||||
finish:
|
||||
if (rc) {
|
||||
iwpool_destroy(pool);
|
||||
@@ -140,11 +173,16 @@ iwrc jql_set_i64(JQL q, const char *placeholder, int index, int64_t val) {
|
||||
if (!qv) {
|
||||
return iwrc_set_errno(IW_ERROR_ALLOC, errno);
|
||||
}
|
||||
qv->refs = 0;
|
||||
qv->freefn = 0;
|
||||
qv->freefn_op = 0;
|
||||
qv->type = JQVAL_I64;
|
||||
qv->vi64 = val;
|
||||
return _jql_set_placeholder(q, placeholder, index, qv);
|
||||
iwrc rc = _jql_set_placeholder(q, placeholder, index, qv);
|
||||
if (rc) {
|
||||
free(qv);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
iwrc jql_set_f64(JQL q, const char *placeholder, int index, double val) {
|
||||
@@ -152,25 +190,39 @@ iwrc jql_set_f64(JQL q, const char *placeholder, int index, double val) {
|
||||
if (!qv) {
|
||||
return iwrc_set_errno(IW_ERROR_ALLOC, errno);
|
||||
}
|
||||
qv->refs = 0;
|
||||
qv->freefn = 0;
|
||||
qv->freefn_op = 0;
|
||||
qv->type = JQVAL_F64;
|
||||
qv->vf64 = val;
|
||||
return _jql_set_placeholder(q, placeholder, index, qv);
|
||||
iwrc rc = _jql_set_placeholder(q, placeholder, index, qv);
|
||||
if (rc) {
|
||||
free(qv);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
iwrc jql_set_str2(
|
||||
JQL q, const char *placeholder, int index, const char *val,
|
||||
void (*freefn)(void*, void*), void *op) {
|
||||
void (*freefn)(void*, void*), void *op
|
||||
) {
|
||||
JQVAL *qv = malloc(sizeof(*qv));
|
||||
if (!qv) {
|
||||
return iwrc_set_errno(IW_ERROR_ALLOC, errno);
|
||||
}
|
||||
qv->refs = 0;
|
||||
qv->freefn = freefn;
|
||||
qv->freefn_op = op;
|
||||
qv->type = JQVAL_STR;
|
||||
qv->vstr = val;
|
||||
return _jql_set_placeholder(q, placeholder, index, qv);
|
||||
iwrc rc = _jql_set_placeholder(q, placeholder, index, qv);
|
||||
if (rc) {
|
||||
if (freefn) {
|
||||
freefn((void*) val, op);
|
||||
}
|
||||
free(qv);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
iwrc jql_set_str(JQL q, const char *placeholder, int index, const char *val) {
|
||||
@@ -182,31 +234,44 @@ iwrc jql_set_bool(JQL q, const char *placeholder, int index, bool val) {
|
||||
if (!qv) {
|
||||
return iwrc_set_errno(IW_ERROR_ALLOC, errno);
|
||||
}
|
||||
qv->refs = 0;
|
||||
qv->freefn = 0;
|
||||
qv->freefn_op = 0;
|
||||
qv->type = JQVAL_BOOL;
|
||||
qv->vbool = val;
|
||||
return _jql_set_placeholder(q, placeholder, index, qv);
|
||||
iwrc rc = _jql_set_placeholder(q, placeholder, index, qv);
|
||||
if (rc) {
|
||||
free(qv);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
iwrc jql_set_regexp2(
|
||||
JQL q, const char *placeholder, int index, const char *expr,
|
||||
void (*freefn)(void*, void*), void *op) {
|
||||
struct re *rx = lwre_new(expr);
|
||||
if (!rx) {
|
||||
return iwrc_set_errno(IW_ERROR_ALLOC, errno);
|
||||
}
|
||||
JQVAL *qv = malloc(sizeof(*qv));
|
||||
if (!qv) {
|
||||
iwrc rc = iwrc_set_errno(IW_ERROR_ALLOC, errno);
|
||||
lwre_free(rx);
|
||||
return rc;
|
||||
}
|
||||
void (*freefn)(void*, void*), void *op
|
||||
) {
|
||||
iwrc rc = 0;
|
||||
JQVAL *qv = 0;
|
||||
struct re *rx = 0;
|
||||
|
||||
RCA(rx = iwre_new(expr), finish);
|
||||
RCA(qv = malloc(sizeof(*qv)), finish);
|
||||
qv->refs = 0;
|
||||
qv->freefn = freefn;
|
||||
qv->freefn_op = op;
|
||||
qv->type = JQVAL_RE;
|
||||
qv->vre = rx;
|
||||
return _jql_set_placeholder(q, placeholder, index, qv);
|
||||
rc = _jql_set_placeholder(q, placeholder, index, qv);
|
||||
|
||||
finish:
|
||||
if (rc) {
|
||||
if (freefn) {
|
||||
freefn((void*) expr, op);
|
||||
}
|
||||
iwre_free(rx);
|
||||
free(qv);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
iwrc jql_set_regexp(JQL q, const char *placeholder, int index, const char *expr) {
|
||||
@@ -218,10 +283,15 @@ iwrc jql_set_null(JQL q, const char *placeholder, int index) {
|
||||
if (!qv) {
|
||||
return iwrc_set_errno(IW_ERROR_ALLOC, errno);
|
||||
}
|
||||
qv->refs = 0;
|
||||
qv->freefn = 0;
|
||||
qv->freefn_op = 0;
|
||||
qv->type = JQVAL_NULL;
|
||||
return _jql_set_placeholder(q, placeholder, index, qv);
|
||||
iwrc rc = _jql_set_placeholder(q, placeholder, index, qv);
|
||||
if (rc) {
|
||||
free(qv);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
static bool _jql_need_deeper_match(JQP_EXPR_NODE *en, int lvl) {
|
||||
@@ -310,16 +380,13 @@ iwrc jql_create2(JQL *qptr, const char *coll, const char *query, jql_create_mode
|
||||
aux->mode = mode;
|
||||
q->aux = aux;
|
||||
|
||||
rc = jqp_parse(aux);
|
||||
RCGO(rc, finish);
|
||||
RCC(rc, finish, jqp_parse(aux));
|
||||
|
||||
if (coll) {
|
||||
if (coll && *coll != '\0') {
|
||||
// Get a copy of collection name
|
||||
coll = iwpool_strdup(aux->pool, coll, &rc);
|
||||
RCGO(rc, finish);
|
||||
q->coll = iwpool_strdup2(aux->pool, coll);
|
||||
}
|
||||
|
||||
q->coll = coll;
|
||||
q->qp = aux->query;
|
||||
|
||||
if (!q->coll) {
|
||||
@@ -359,7 +426,7 @@ size_t jql_estimate_allocated_size(JQL q) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
const char *jql_collection(JQL q) {
|
||||
const char* jql_collection(JQL q) {
|
||||
return q->coll;
|
||||
}
|
||||
|
||||
@@ -388,7 +455,7 @@ void jql_destroy(JQL *qptr) {
|
||||
for (JQP_OP *op = aux->start_op; op; op = op->next) {
|
||||
if (op->opaque) {
|
||||
if (op->value == JQP_OP_RE) {
|
||||
lwre_free(op->opaque);
|
||||
iwre_free(op->opaque);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -598,8 +665,15 @@ static int _jql_cmp_jqval_pair(const JQVAL *left, const JQVAL *right, iwrc *rcp)
|
||||
return lv->vbool - (rv->vi64 != 0L);
|
||||
case JQVAL_F64:
|
||||
return lv->vbool - (rv->vf64 != 0.0); // -V550
|
||||
case JQVAL_STR:
|
||||
return lv->vbool - !strcmp(rv->vstr, "true");
|
||||
case JQVAL_STR: {
|
||||
if (strcmp(rv->vstr, "true") == 0) {
|
||||
return lv->vbool - 1;
|
||||
} else if (strcmp(rv->vstr, "false") == 0) {
|
||||
return lv->vbool;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
case JQVAL_NULL:
|
||||
return lv->vbool;
|
||||
default:
|
||||
@@ -653,7 +727,8 @@ int jql_cmp_jqval_pair(const JQVAL *left, const JQVAL *right, iwrc *rcp) {
|
||||
static bool _jql_match_regexp(
|
||||
JQP_AUX *aux,
|
||||
JQVAL *left, JQP_OP *jqop, JQVAL *right,
|
||||
iwrc *rcp) {
|
||||
iwrc *rcp
|
||||
) {
|
||||
struct re *rx;
|
||||
char nbuf[JBNUMBUF_SIZE];
|
||||
static_assert(JBNUMBUF_SIZE >= IWFTOA_BUFSIZE, "JBNUMBUF_SIZE >= IWFTOA_BUFSIZE");
|
||||
@@ -731,7 +806,7 @@ static bool _jql_match_regexp(
|
||||
aexpr[rci - 1] = '\0';
|
||||
expr = aexpr;
|
||||
}
|
||||
rx = lwre_new(expr);
|
||||
rx = iwre_new(expr);
|
||||
if (!rx) {
|
||||
*rcp = iwrc_set_errno(IW_ERROR_ALLOC, errno);
|
||||
return false;
|
||||
@@ -763,7 +838,7 @@ static bool _jql_match_regexp(
|
||||
}
|
||||
|
||||
assert(input);
|
||||
int mret = lwre_match(rx, input);
|
||||
int mret = iwre_match(rx, input);
|
||||
switch (mret) {
|
||||
case RE_ERROR_NOMATCH:
|
||||
return false;
|
||||
@@ -798,8 +873,8 @@ static bool _jql_match_regexp(
|
||||
|
||||
static bool _jql_match_in(
|
||||
JQVAL *left, JQP_OP *jqop, JQVAL *right,
|
||||
iwrc *rcp) {
|
||||
|
||||
iwrc *rcp
|
||||
) {
|
||||
JQVAL sleft; // Stack allocated left/right converted values
|
||||
JQVAL *lv = left, *rv = right;
|
||||
if ((rv->type != JQVAL_JBLNODE) && (rv->vnode->type != JBV_ARRAY)) {
|
||||
@@ -833,8 +908,8 @@ static bool _jql_match_in(
|
||||
|
||||
static bool _jql_match_ni(
|
||||
JQVAL *left, JQP_OP *jqop, JQVAL *right,
|
||||
iwrc *rcp) {
|
||||
|
||||
iwrc *rcp
|
||||
) {
|
||||
JQVAL sleft; // Stack allocated left/right converted values
|
||||
JQVAL *lv = left, *rv = right;
|
||||
binn bv;
|
||||
@@ -877,8 +952,8 @@ static bool _jql_match_ni(
|
||||
|
||||
static bool _jql_match_starts(
|
||||
JQVAL *left, JQP_OP *jqop, JQVAL *right,
|
||||
iwrc *rcp) {
|
||||
|
||||
iwrc *rcp
|
||||
) {
|
||||
JQVAL sleft; // Stack allocated left/right converted values
|
||||
JQVAL *lv = left, *rv = right;
|
||||
char nbuf[JBNUMBUF_SIZE];
|
||||
@@ -945,7 +1020,8 @@ static bool _jql_match_starts(
|
||||
static bool _jql_match_jqval_pair(
|
||||
JQP_AUX *aux,
|
||||
JQVAL *left, JQP_OP *jqop, JQVAL *right,
|
||||
iwrc *rcp) {
|
||||
iwrc *rcp
|
||||
) {
|
||||
bool match = false;
|
||||
jqp_op_t op = jqop->value;
|
||||
if ((op >= JQP_OP_EQ) && (op <= JQP_OP_LTE)) {
|
||||
@@ -1006,11 +1082,12 @@ finish:
|
||||
bool jql_match_jqval_pair(
|
||||
JQP_AUX *aux,
|
||||
JQVAL *left, JQP_OP *jqop, JQVAL *right,
|
||||
iwrc *rcp) {
|
||||
iwrc *rcp
|
||||
) {
|
||||
return _jql_match_jqval_pair(aux, left, jqop, right, rcp);
|
||||
}
|
||||
|
||||
static JQVAL *_jql_unit_to_jqval(JQP_AUX *aux, JQPUNIT *unit, iwrc *rcp) {
|
||||
static JQVAL* _jql_unit_to_jqval(JQP_AUX *aux, JQPUNIT *unit, iwrc *rcp) {
|
||||
*rcp = 0;
|
||||
switch (unit->type) {
|
||||
case JQP_STRING_TYPE: {
|
||||
@@ -1105,7 +1182,7 @@ static JQVAL *_jql_unit_to_jqval(JQP_AUX *aux, JQPUNIT *unit, iwrc *rcp) {
|
||||
}
|
||||
}
|
||||
|
||||
JQVAL *jql_unit_to_jqval(JQP_AUX *aux, JQPUNIT *unit, iwrc *rcp) {
|
||||
JQVAL* jql_unit_to_jqval(JQP_AUX *aux, JQPUNIT *unit, iwrc *rcp) {
|
||||
return _jql_unit_to_jqval(aux, unit, rcp);
|
||||
}
|
||||
|
||||
@@ -1238,7 +1315,7 @@ IW_INLINE bool _jql_match_node_field(MCTX *mctx, JQP_NODE *n, iwrc *rcp) {
|
||||
return (strcmp(n->value->string.value, mctx->key) == 0);
|
||||
}
|
||||
|
||||
IW_INLINE JQP_NODE *_jql_match_node_anys(MCTX *mctx, JQP_NODE *n, bool *res, iwrc *rcp) {
|
||||
IW_INLINE JQP_NODE* _jql_match_node_anys(MCTX *mctx, JQP_NODE *n, bool *res, iwrc *rcp) {
|
||||
if (n->start < 0) {
|
||||
n->start = mctx->lvl;
|
||||
}
|
||||
@@ -1257,7 +1334,7 @@ IW_INLINE JQP_NODE *_jql_match_node_anys(MCTX *mctx, JQP_NODE *n, bool *res, iwr
|
||||
return n;
|
||||
}
|
||||
|
||||
static JQP_NODE *_jql_match_node(MCTX *mctx, JQP_NODE *n, bool *res, iwrc *rcp) {
|
||||
static JQP_NODE* _jql_match_node(MCTX *mctx, JQP_NODE *n, bool *res, iwrc *rcp) {
|
||||
switch (n->ntype) {
|
||||
case JQP_NODE_FIELD:
|
||||
*res = _jql_match_node_field(mctx, n, rcp);
|
||||
@@ -1413,7 +1490,7 @@ iwrc jql_matched(JQL q, JBL jbl, bool *out) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
const char *jql_error(JQL q) {
|
||||
const char* jql_error(JQL q) {
|
||||
if (q && q->aux) {
|
||||
return iwxstr_ptr(q->aux->xerr);
|
||||
} else {
|
||||
@@ -1421,7 +1498,7 @@ const char *jql_error(JQL q) {
|
||||
}
|
||||
}
|
||||
|
||||
const char *jql_first_anchor(JQL q) {
|
||||
const char* jql_first_anchor(JQL q) {
|
||||
return q->aux->first_anchor;
|
||||
}
|
||||
|
||||
@@ -1507,7 +1584,8 @@ static bool _jql_proj_matched(
|
||||
int16_t lvl, JBL_NODE n,
|
||||
const char *key, int keylen,
|
||||
JBN_VCTX *vctx, JQP_PROJECTION *proj,
|
||||
iwrc *rc) {
|
||||
iwrc *rc
|
||||
) {
|
||||
if (proj->cnt <= lvl) {
|
||||
return false;
|
||||
}
|
||||
@@ -1516,11 +1594,11 @@ static bool _jql_proj_matched(
|
||||
}
|
||||
if (proj->pos + 1 == lvl) {
|
||||
JQP_STRING *ps = proj->value;
|
||||
for (int i = 0; i < lvl; ps = ps->next, ++i) ; // -V529
|
||||
for (int i = 0; i < lvl; ps = ps->next, ++i); // -V529
|
||||
assert(ps);
|
||||
if (ps->flavour & JQP_STR_PROJFIELD) {
|
||||
for (JQP_STRING *sn = ps; sn; sn = sn->subnext) {
|
||||
const char *pv = sn->value;
|
||||
const char *pv = IW_UNLIKELY(sn->flavour & JQP_STR_PLACEHOLDER) ? ((JQVAL*) sn->opaque)->vstr : sn->value;
|
||||
int pvlen = (int) strlen(pv);
|
||||
if ((pvlen == keylen) && !strncmp(key, pv, keylen)) {
|
||||
proj->pos = lvl;
|
||||
@@ -1528,7 +1606,7 @@ static bool _jql_proj_matched(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const char *pv = ps->value;
|
||||
const char *pv = IW_UNLIKELY(ps->flavour & JQP_STR_PLACEHOLDER) ? ((JQVAL*) ps->opaque)->vstr : ps->value;
|
||||
int pvlen = (int) strlen(pv);
|
||||
if (((pvlen == keylen) && !strncmp(key, pv, keylen)) || ((pv[0] == '*') && (pv[1] == '\0'))) {
|
||||
proj->pos = lvl;
|
||||
@@ -1544,8 +1622,8 @@ static bool _jql_proj_join_matched(
|
||||
const char *key, int keylen,
|
||||
JBN_VCTX *vctx, JQP_PROJECTION *proj,
|
||||
JBL *out,
|
||||
iwrc *rcp) {
|
||||
|
||||
iwrc *rcp
|
||||
) {
|
||||
PROJ_CTX *pctx = vctx->op;
|
||||
if (proj->cnt != lvl + 1) {
|
||||
return _jql_proj_matched(lvl, n, key, keylen, vctx, proj, rcp);
|
||||
@@ -1556,12 +1634,12 @@ static bool _jql_proj_join_matched(
|
||||
const char *pv, *spos;
|
||||
bool ret = false;
|
||||
JQP_STRING *ps = proj->value;
|
||||
for (int i = 0; i < lvl; ps = ps->next, ++i) ; // -V529
|
||||
for (int i = 0; i < lvl; ps = ps->next, ++i); // -V529
|
||||
assert(ps);
|
||||
|
||||
if (ps->flavour & JQP_STR_PROJFIELD) {
|
||||
for (JQP_STRING *sn = ps; sn; sn = sn->subnext) {
|
||||
pv = sn->value;
|
||||
pv = IW_UNLIKELY(sn->flavour & JQP_STR_PLACEHOLDER) ? ((JQVAL*) sn->opaque)->vstr : sn->value;
|
||||
spos = strchr(pv, '<');
|
||||
if (!spos) {
|
||||
if ((strlen(pv) == keylen) && !strncmp(key, pv, keylen)) {
|
||||
@@ -1575,7 +1653,7 @@ static bool _jql_proj_join_matched(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pv = ps->value;
|
||||
pv = IW_UNLIKELY(ps->flavour & JQP_STR_PLACEHOLDER) ? ((JQVAL*) ps->opaque)->vstr : ps->value;
|
||||
spos = strchr(pv, '<');
|
||||
assert(spos);
|
||||
ret = !strncmp(key, pv, spos - pv);
|
||||
@@ -1686,7 +1764,8 @@ static jbn_visitor_cmd_t _jql_proj_visitor(int lvl, JBL_NODE n, const char *key,
|
||||
|
||||
static jbn_visitor_cmd_t _jql_proj_keep_visitor(
|
||||
int lvl, JBL_NODE n, const char *key, int klidx, JBN_VCTX *vctx,
|
||||
iwrc *rc) {
|
||||
iwrc *rc
|
||||
) {
|
||||
if ((lvl < 0) || (n->flags & PROJ_MARK_PATH)) {
|
||||
return 0;
|
||||
}
|
||||
@@ -1697,6 +1776,7 @@ static jbn_visitor_cmd_t _jql_proj_keep_visitor(
|
||||
}
|
||||
|
||||
static iwrc _jql_project(JBL_NODE root, JQL q, IWPOOL *pool, JBEXEC *exec_ctx) {
|
||||
iwrc rc;
|
||||
JQP_AUX *aux = q->aux;
|
||||
if (aux->has_exclude_all_projection) {
|
||||
jbn_data(root);
|
||||
@@ -1717,6 +1797,11 @@ static iwrc _jql_project(JBL_NODE root, JQL q, IWPOOL *pool, JBEXEC *exec_ctx) {
|
||||
p->pos = -1;
|
||||
p->cnt = 0;
|
||||
for (JQP_STRING *s = p->value; s; s = s->next) {
|
||||
if (s->flavour & JQP_STR_PLACEHOLDER) {
|
||||
if (s->opaque == 0 || ((JQVAL*) s->opaque)->type != JQVAL_STR) {
|
||||
return JQL_ERROR_INVALID_PLACEHOLDER_VALUE_TYPE;
|
||||
}
|
||||
}
|
||||
p->cnt++;
|
||||
}
|
||||
}
|
||||
@@ -1724,10 +1809,10 @@ static iwrc _jql_project(JBL_NODE root, JQL q, IWPOOL *pool, JBEXEC *exec_ctx) {
|
||||
.root = root,
|
||||
.op = &pctx
|
||||
};
|
||||
iwrc rc = jbn_visit(root, 0, &vctx, _jql_proj_visitor);
|
||||
RCGO(rc, finish);
|
||||
|
||||
RCC(rc, finish, jbn_visit(root, 0, &vctx, _jql_proj_visitor));
|
||||
if (aux->has_keep_projections) { // We have keep projections
|
||||
RCHECK(rc, finish, jbn_visit(root, 0, &vctx, _jql_proj_keep_visitor));
|
||||
RCC(rc, finish, jbn_visit(root, 0, &vctx, _jql_proj_keep_visitor));
|
||||
}
|
||||
|
||||
finish:
|
||||
@@ -1783,7 +1868,7 @@ iwrc jql_apply_and_project(JQL q, JBL jbl, JBL_NODE *out, void *exec_ctx, IWPOOL
|
||||
return rc;
|
||||
}
|
||||
|
||||
static const char *_ecodefn(locale_t locale, uint32_t ecode) {
|
||||
static const char* _ecodefn(locale_t locale, uint32_t ecode) {
|
||||
if (!((ecode > _JQL_ERROR_START) && (ecode < _JQL_ERROR_END))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
+4
-4
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
* Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -95,7 +95,7 @@ IW_EXPORT WUR iwrc jql_create(JQL *qptr, const char *coll, const char *query);
|
||||
|
||||
IW_EXPORT WUR iwrc jql_create2(JQL *qptr, const char *coll, const char *query, jql_create_mode_t mode);
|
||||
|
||||
IW_EXPORT const char *jql_collection(JQL q);
|
||||
IW_EXPORT const char* jql_collection(JQL q);
|
||||
|
||||
/**
|
||||
* @brief Bind JSON node data to query placeholder.
|
||||
@@ -146,9 +146,9 @@ IW_EXPORT WUR iwrc jql_set_null(JQL q, const char *placeholder, int index);
|
||||
|
||||
IW_EXPORT WUR iwrc jql_matched(JQL q, JBL jbl, bool *out);
|
||||
|
||||
IW_EXPORT const char *jql_first_anchor(JQL q);
|
||||
IW_EXPORT const char* jql_first_anchor(JQL q);
|
||||
|
||||
IW_EXPORT const char *jql_error(JQL q);
|
||||
IW_EXPORT const char* jql_error(JQL q);
|
||||
|
||||
IW_EXPORT bool jql_has_apply(JQL q);
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ typedef struct {
|
||||
jqval_type_t type;
|
||||
void (*freefn)(void*, void*);
|
||||
void *freefn_op;
|
||||
int refs;
|
||||
union {
|
||||
JBL_NODE vnode;
|
||||
binn *vbinn;
|
||||
@@ -45,9 +46,9 @@ typedef struct {
|
||||
};
|
||||
} JQVAL;
|
||||
|
||||
JQVAL *jql_find_placeholder(JQL q, const char *name);
|
||||
JQVAL* jql_find_placeholder(JQL q, const char *name);
|
||||
|
||||
JQVAL *jql_unit_to_jqval(JQP_AUX *aux, JQPUNIT *unit, iwrc *rcp);
|
||||
JQVAL* jql_unit_to_jqval(JQP_AUX *aux, JQPUNIT *unit, iwrc *rcp);
|
||||
|
||||
bool jql_jqval_as_int(JQVAL *jqval, int64_t *out);
|
||||
|
||||
|
||||
+210
-209
@@ -2599,7 +2599,8 @@ YY_RULE(int) yy_PROJPROP(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
|
||||
yyprintf((stderr, "%s\n", "PROJPROP"));
|
||||
{ int yypos133= yy->__pos, yythunkpos133= yy->__thunkpos; if (!yy_STRN(yy)) goto l134; goto l133;
|
||||
l134:; yy->__pos= yypos133; yy->__thunkpos= yythunkpos133; if (!yy_PSTRP(yy)) goto l132;
|
||||
l134:; yy->__pos= yypos133; yy->__thunkpos= yythunkpos133; if (!yy_PLACEHOLDER(yy)) goto l135; goto l133;
|
||||
l135:; yy->__pos= yypos133; yy->__thunkpos= yythunkpos133; if (!yy_PSTRP(yy)) goto l132;
|
||||
}
|
||||
l133:;
|
||||
yyprintf((stderr, " ok %s @ %s\n", "PROJPROP", yy->__buf+yy->__pos));
|
||||
@@ -2610,228 +2611,228 @@ YY_RULE(int) yy_PROJPROP(yycontext *yy)
|
||||
}
|
||||
YY_RULE(int) yy_ORDERNODE(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
|
||||
yyprintf((stderr, "%s\n", "ORDERNODE")); if (!yymatchChar(yy, '/')) goto l135; if (!yy_PROJPROP(yy)) goto l135;
|
||||
yyprintf((stderr, "%s\n", "ORDERNODE")); if (!yymatchChar(yy, '/')) goto l136; if (!yy_PROJPROP(yy)) goto l136;
|
||||
yyprintf((stderr, " ok %s @ %s\n", "ORDERNODE", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
l135:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l136:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "ORDERNODE", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_ORDERNODES(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyDo(yy, yyPush, 2, 0);
|
||||
yyprintf((stderr, "%s\n", "ORDERNODES")); if (!yy_ORDERNODE(yy)) goto l136; yyDo(yy, yySet, -2, 0); yyDo(yy, yy_1_ORDERNODES, yy->__begin, yy->__end);
|
||||
l137:;
|
||||
{ int yypos138= yy->__pos, yythunkpos138= yy->__thunkpos; if (!yy_ORDERNODE(yy)) goto l138; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_2_ORDERNODES, yy->__begin, yy->__end); goto l137;
|
||||
l138:; yy->__pos= yypos138; yy->__thunkpos= yythunkpos138;
|
||||
yyprintf((stderr, "%s\n", "ORDERNODES")); if (!yy_ORDERNODE(yy)) goto l137; yyDo(yy, yySet, -2, 0); yyDo(yy, yy_1_ORDERNODES, yy->__begin, yy->__end);
|
||||
l138:;
|
||||
{ int yypos139= yy->__pos, yythunkpos139= yy->__thunkpos; if (!yy_ORDERNODE(yy)) goto l139; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_2_ORDERNODES, yy->__begin, yy->__end); goto l138;
|
||||
l139:; yy->__pos= yypos139; yy->__thunkpos= yythunkpos139;
|
||||
} yyDo(yy, yy_3_ORDERNODES, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "ORDERNODES", yy->__buf+yy->__pos)); yyDo(yy, yyPop, 2, 0);
|
||||
return 1;
|
||||
l136:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l137:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "ORDERNODES", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_NUMI(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
|
||||
yyprintf((stderr, "%s\n", "NUMI"));
|
||||
{ int yypos140= yy->__pos, yythunkpos140= yy->__thunkpos; if (!yymatchChar(yy, '0')) goto l141; goto l140;
|
||||
l141:; yy->__pos= yypos140; yy->__thunkpos= yythunkpos140; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\376\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l139;
|
||||
l142:;
|
||||
{ int yypos143= yy->__pos, yythunkpos143= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l143; goto l142;
|
||||
l143:; yy->__pos= yypos143; yy->__thunkpos= yythunkpos143;
|
||||
{ int yypos141= yy->__pos, yythunkpos141= yy->__thunkpos; if (!yymatchChar(yy, '0')) goto l142; goto l141;
|
||||
l142:; yy->__pos= yypos141; yy->__thunkpos= yythunkpos141; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\376\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l140;
|
||||
l143:;
|
||||
{ int yypos144= yy->__pos, yythunkpos144= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l144; goto l143;
|
||||
l144:; yy->__pos= yypos144; yy->__thunkpos= yythunkpos144;
|
||||
}
|
||||
}
|
||||
l140:;
|
||||
l141:;
|
||||
yyprintf((stderr, " ok %s @ %s\n", "NUMI", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
l139:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l140:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "NUMI", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_INVERSE(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
|
||||
yyprintf((stderr, "%s\n", "INVERSE")); if (!yymatchString(yy, "inverse")) goto l144; yyDo(yy, yy_1_INVERSE, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, "%s\n", "INVERSE")); if (!yymatchString(yy, "inverse")) goto l145; yyDo(yy, yy_1_INVERSE, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "INVERSE", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
l144:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l145:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "INVERSE", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_NOIDX(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
|
||||
yyprintf((stderr, "%s\n", "NOIDX")); if (!yymatchString(yy, "noidx")) goto l145; yyDo(yy, yy_1_NOIDX, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, "%s\n", "NOIDX")); if (!yymatchString(yy, "noidx")) goto l146; yyDo(yy, yy_1_NOIDX, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "NOIDX", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
l145:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l146:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "NOIDX", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_COUNT(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
|
||||
yyprintf((stderr, "%s\n", "COUNT")); if (!yymatchString(yy, "count")) goto l146; yyDo(yy, yy_1_COUNT, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, "%s\n", "COUNT")); if (!yymatchString(yy, "count")) goto l147; yyDo(yy, yy_1_COUNT, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "COUNT", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
l146:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l147:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "COUNT", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_ORDERBY(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyDo(yy, yyPush, 1, 0);
|
||||
yyprintf((stderr, "%s\n", "ORDERBY"));
|
||||
{ int yypos148= yy->__pos, yythunkpos148= yy->__thunkpos; if (!yymatchString(yy, "asc")) goto l149; goto l148;
|
||||
l149:; yy->__pos= yypos148; yy->__thunkpos= yythunkpos148; if (!yymatchString(yy, "desc")) goto l147; yyDo(yy, yy_1_ORDERBY, yy->__begin, yy->__end);
|
||||
{ int yypos149= yy->__pos, yythunkpos149= yy->__thunkpos; if (!yymatchString(yy, "asc")) goto l150; goto l149;
|
||||
l150:; yy->__pos= yypos149; yy->__thunkpos= yythunkpos149; if (!yymatchString(yy, "desc")) goto l148; yyDo(yy, yy_1_ORDERBY, yy->__begin, yy->__end);
|
||||
}
|
||||
l148:; if (!yy___(yy)) goto l147;
|
||||
{ int yypos150= yy->__pos, yythunkpos150= yy->__thunkpos; if (!yy_ORDERNODES(yy)) goto l151; yyDo(yy, yySet, -1, 0); goto l150;
|
||||
l151:; yy->__pos= yypos150; yy->__thunkpos= yythunkpos150; if (!yy_PLACEHOLDER(yy)) goto l147; yyDo(yy, yySet, -1, 0);
|
||||
l149:; if (!yy___(yy)) goto l148;
|
||||
{ int yypos151= yy->__pos, yythunkpos151= yy->__thunkpos; if (!yy_ORDERNODES(yy)) goto l152; yyDo(yy, yySet, -1, 0); goto l151;
|
||||
l152:; yy->__pos= yypos151; yy->__thunkpos= yythunkpos151; if (!yy_PLACEHOLDER(yy)) goto l148; yyDo(yy, yySet, -1, 0);
|
||||
}
|
||||
l150:; yyDo(yy, yy_2_ORDERBY, yy->__begin, yy->__end);
|
||||
l151:; yyDo(yy, yy_2_ORDERBY, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "ORDERBY", yy->__buf+yy->__pos)); yyDo(yy, yyPop, 1, 0);
|
||||
return 1;
|
||||
l147:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l148:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "ORDERBY", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_LIMIT(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyDo(yy, yyPush, 1, 0);
|
||||
yyprintf((stderr, "%s\n", "LIMIT")); if (!yymatchString(yy, "limit")) goto l152; if (!yy___(yy)) goto l152;
|
||||
{ int yypos153= yy->__pos, yythunkpos153= yy->__thunkpos; yyText(yy, yy->__begin, yy->__end); {
|
||||
yyprintf((stderr, "%s\n", "LIMIT")); if (!yymatchString(yy, "limit")) goto l153; if (!yy___(yy)) goto l153;
|
||||
{ int yypos154= yy->__pos, yythunkpos154= yy->__thunkpos; yyText(yy, yy->__begin, yy->__end); {
|
||||
#define yytext yy->__text
|
||||
#define yyleng yy->__textlen
|
||||
if (!(YY_BEGIN)) goto l154;
|
||||
if (!(YY_BEGIN)) goto l155;
|
||||
#undef yytext
|
||||
#undef yyleng
|
||||
} if (!yy_NUMI(yy)) goto l154; yyText(yy, yy->__begin, yy->__end); {
|
||||
} if (!yy_NUMI(yy)) goto l155; yyText(yy, yy->__begin, yy->__end); {
|
||||
#define yytext yy->__text
|
||||
#define yyleng yy->__textlen
|
||||
if (!(YY_END)) goto l154;
|
||||
if (!(YY_END)) goto l155;
|
||||
#undef yytext
|
||||
#undef yyleng
|
||||
} yyDo(yy, yy_1_LIMIT, yy->__begin, yy->__end); goto l153;
|
||||
l154:; yy->__pos= yypos153; yy->__thunkpos= yythunkpos153; if (!yy_PLACEHOLDER(yy)) goto l152; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_2_LIMIT, yy->__begin, yy->__end);
|
||||
} yyDo(yy, yy_1_LIMIT, yy->__begin, yy->__end); goto l154;
|
||||
l155:; yy->__pos= yypos154; yy->__thunkpos= yythunkpos154; if (!yy_PLACEHOLDER(yy)) goto l153; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_2_LIMIT, yy->__begin, yy->__end);
|
||||
}
|
||||
l153:; yyDo(yy, yy_3_LIMIT, yy->__begin, yy->__end);
|
||||
l154:; yyDo(yy, yy_3_LIMIT, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "LIMIT", yy->__buf+yy->__pos)); yyDo(yy, yyPop, 1, 0);
|
||||
return 1;
|
||||
l152:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l153:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "LIMIT", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_SKIP(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyDo(yy, yyPush, 1, 0);
|
||||
yyprintf((stderr, "%s\n", "SKIP")); if (!yymatchString(yy, "skip")) goto l155; if (!yy___(yy)) goto l155;
|
||||
{ int yypos156= yy->__pos, yythunkpos156= yy->__thunkpos; yyText(yy, yy->__begin, yy->__end); {
|
||||
yyprintf((stderr, "%s\n", "SKIP")); if (!yymatchString(yy, "skip")) goto l156; if (!yy___(yy)) goto l156;
|
||||
{ int yypos157= yy->__pos, yythunkpos157= yy->__thunkpos; yyText(yy, yy->__begin, yy->__end); {
|
||||
#define yytext yy->__text
|
||||
#define yyleng yy->__textlen
|
||||
if (!(YY_BEGIN)) goto l157;
|
||||
if (!(YY_BEGIN)) goto l158;
|
||||
#undef yytext
|
||||
#undef yyleng
|
||||
} if (!yy_NUMI(yy)) goto l157; yyText(yy, yy->__begin, yy->__end); {
|
||||
} if (!yy_NUMI(yy)) goto l158; yyText(yy, yy->__begin, yy->__end); {
|
||||
#define yytext yy->__text
|
||||
#define yyleng yy->__textlen
|
||||
if (!(YY_END)) goto l157;
|
||||
if (!(YY_END)) goto l158;
|
||||
#undef yytext
|
||||
#undef yyleng
|
||||
} yyDo(yy, yy_1_SKIP, yy->__begin, yy->__end); goto l156;
|
||||
l157:; yy->__pos= yypos156; yy->__thunkpos= yythunkpos156; if (!yy_PLACEHOLDER(yy)) goto l155; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_2_SKIP, yy->__begin, yy->__end);
|
||||
} yyDo(yy, yy_1_SKIP, yy->__begin, yy->__end); goto l157;
|
||||
l158:; yy->__pos= yypos157; yy->__thunkpos= yythunkpos157; if (!yy_PLACEHOLDER(yy)) goto l156; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_2_SKIP, yy->__begin, yy->__end);
|
||||
}
|
||||
l156:; yyDo(yy, yy_3_SKIP, yy->__begin, yy->__end);
|
||||
l157:; yyDo(yy, yy_3_SKIP, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "SKIP", yy->__buf+yy->__pos)); yyDo(yy, yyPop, 1, 0);
|
||||
return 1;
|
||||
l155:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l156:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "SKIP", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_OPT(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
|
||||
yyprintf((stderr, "%s\n", "OPT"));
|
||||
{ int yypos159= yy->__pos, yythunkpos159= yy->__thunkpos; if (!yy_SKIP(yy)) goto l160; goto l159;
|
||||
l160:; yy->__pos= yypos159; yy->__thunkpos= yythunkpos159; if (!yy_LIMIT(yy)) goto l161; goto l159;
|
||||
l161:; yy->__pos= yypos159; yy->__thunkpos= yythunkpos159; if (!yy_ORDERBY(yy)) goto l162; goto l159;
|
||||
l162:; yy->__pos= yypos159; yy->__thunkpos= yythunkpos159; if (!yy_COUNT(yy)) goto l163; goto l159;
|
||||
l163:; yy->__pos= yypos159; yy->__thunkpos= yythunkpos159; if (!yy_NOIDX(yy)) goto l164; goto l159;
|
||||
l164:; yy->__pos= yypos159; yy->__thunkpos= yythunkpos159; if (!yy_INVERSE(yy)) goto l158;
|
||||
{ int yypos160= yy->__pos, yythunkpos160= yy->__thunkpos; if (!yy_SKIP(yy)) goto l161; goto l160;
|
||||
l161:; yy->__pos= yypos160; yy->__thunkpos= yythunkpos160; if (!yy_LIMIT(yy)) goto l162; goto l160;
|
||||
l162:; yy->__pos= yypos160; yy->__thunkpos= yythunkpos160; if (!yy_ORDERBY(yy)) goto l163; goto l160;
|
||||
l163:; yy->__pos= yypos160; yy->__thunkpos= yythunkpos160; if (!yy_COUNT(yy)) goto l164; goto l160;
|
||||
l164:; yy->__pos= yypos160; yy->__thunkpos= yythunkpos160; if (!yy_NOIDX(yy)) goto l165; goto l160;
|
||||
l165:; yy->__pos= yypos160; yy->__thunkpos= yythunkpos160; if (!yy_INVERSE(yy)) goto l159;
|
||||
}
|
||||
l159:;
|
||||
l160:;
|
||||
yyprintf((stderr, " ok %s @ %s\n", "OPT", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
l158:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l159:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "OPT", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_PROJOIN(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
|
||||
yyprintf((stderr, "%s\n", "PROJOIN"));
|
||||
{ int yypos166= yy->__pos, yythunkpos166= yy->__thunkpos; if (!yymatchChar(yy, '+')) goto l167; goto l166;
|
||||
l167:; yy->__pos= yypos166; yy->__thunkpos= yythunkpos166; if (!yymatchChar(yy, '-')) goto l165;
|
||||
{ int yypos167= yy->__pos, yythunkpos167= yy->__thunkpos; if (!yymatchChar(yy, '+')) goto l168; goto l167;
|
||||
l168:; yy->__pos= yypos167; yy->__thunkpos= yythunkpos167; if (!yymatchChar(yy, '-')) goto l166;
|
||||
}
|
||||
l166:;
|
||||
l167:;
|
||||
yyprintf((stderr, " ok %s @ %s\n", "PROJOIN", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
l165:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l166:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "PROJOIN", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_PROJNODES(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyDo(yy, yyPush, 3, 0);
|
||||
yyprintf((stderr, "%s\n", "PROJNODES"));
|
||||
{ int yypos169= yy->__pos, yythunkpos169= yy->__thunkpos; if (!yy_PROJALL(yy)) goto l170; yyDo(yy, yySet, -3, 0); yyDo(yy, yy_1_PROJNODES, yy->__begin, yy->__end); goto l169;
|
||||
l170:; yy->__pos= yypos169; yy->__thunkpos= yythunkpos169; if (!yy_PROJNODE(yy)) goto l168; yyDo(yy, yySet, -2, 0); yyDo(yy, yy_2_PROJNODES, yy->__begin, yy->__end);
|
||||
l171:;
|
||||
{ int yypos172= yy->__pos, yythunkpos172= yy->__thunkpos; if (!yy_PROJNODE(yy)) goto l172; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_3_PROJNODES, yy->__begin, yy->__end); goto l171;
|
||||
l172:; yy->__pos= yypos172; yy->__thunkpos= yythunkpos172;
|
||||
{ int yypos170= yy->__pos, yythunkpos170= yy->__thunkpos; if (!yy_PROJALL(yy)) goto l171; yyDo(yy, yySet, -3, 0); yyDo(yy, yy_1_PROJNODES, yy->__begin, yy->__end); goto l170;
|
||||
l171:; yy->__pos= yypos170; yy->__thunkpos= yythunkpos170; if (!yy_PROJNODE(yy)) goto l169; yyDo(yy, yySet, -2, 0); yyDo(yy, yy_2_PROJNODES, yy->__begin, yy->__end);
|
||||
l172:;
|
||||
{ int yypos173= yy->__pos, yythunkpos173= yy->__thunkpos; if (!yy_PROJNODE(yy)) goto l173; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_3_PROJNODES, yy->__begin, yy->__end); goto l172;
|
||||
l173:; yy->__pos= yypos173; yy->__thunkpos= yythunkpos173;
|
||||
} yyDo(yy, yy_4_PROJNODES, yy->__begin, yy->__end);
|
||||
}
|
||||
l169:;
|
||||
l170:;
|
||||
yyprintf((stderr, " ok %s @ %s\n", "PROJNODES", yy->__buf+yy->__pos)); yyDo(yy, yyPop, 3, 0);
|
||||
return 1;
|
||||
l168:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l169:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "PROJNODES", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_ARRJ(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyDo(yy, yyPush, 3, 0);
|
||||
yyprintf((stderr, "%s\n", "ARRJ")); if (!yy_SARRJ(yy)) goto l173; yyDo(yy, yySet, -3, 0); yyDo(yy, yy_1_ARRJ, yy->__begin, yy->__end); if (!yy__(yy)) goto l173;
|
||||
{ int yypos174= yy->__pos, yythunkpos174= yy->__thunkpos; if (!yy_VALJ(yy)) goto l174; yyDo(yy, yySet, -2, 0); yyDo(yy, yy_2_ARRJ, yy->__begin, yy->__end);
|
||||
l176:;
|
||||
{ int yypos177= yy->__pos, yythunkpos177= yy->__thunkpos; if (!yy__(yy)) goto l177; if (!yymatchChar(yy, ',')) goto l177; if (!yy__(yy)) goto l177; if (!yy_VALJ(yy)) goto l177; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_3_ARRJ, yy->__begin, yy->__end); goto l176;
|
||||
l177:; yy->__pos= yypos177; yy->__thunkpos= yythunkpos177;
|
||||
} goto l175;
|
||||
l174:; yy->__pos= yypos174; yy->__thunkpos= yythunkpos174;
|
||||
yyprintf((stderr, "%s\n", "ARRJ")); if (!yy_SARRJ(yy)) goto l174; yyDo(yy, yySet, -3, 0); yyDo(yy, yy_1_ARRJ, yy->__begin, yy->__end); if (!yy__(yy)) goto l174;
|
||||
{ int yypos175= yy->__pos, yythunkpos175= yy->__thunkpos; if (!yy_VALJ(yy)) goto l175; yyDo(yy, yySet, -2, 0); yyDo(yy, yy_2_ARRJ, yy->__begin, yy->__end);
|
||||
l177:;
|
||||
{ int yypos178= yy->__pos, yythunkpos178= yy->__thunkpos; if (!yy__(yy)) goto l178; if (!yymatchChar(yy, ',')) goto l178; if (!yy__(yy)) goto l178; if (!yy_VALJ(yy)) goto l178; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_3_ARRJ, yy->__begin, yy->__end); goto l177;
|
||||
l178:; yy->__pos= yypos178; yy->__thunkpos= yythunkpos178;
|
||||
} goto l176;
|
||||
l175:; yy->__pos= yypos175; yy->__thunkpos= yythunkpos175;
|
||||
}
|
||||
l175:; if (!yy__(yy)) goto l173; if (!yymatchChar(yy, ']')) goto l173; yyDo(yy, yy_4_ARRJ, yy->__begin, yy->__end);
|
||||
l176:; if (!yy__(yy)) goto l174; if (!yymatchChar(yy, ']')) goto l174; yyDo(yy, yy_4_ARRJ, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "ARRJ", yy->__buf+yy->__pos)); yyDo(yy, yyPop, 3, 0);
|
||||
return 1;
|
||||
l173:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l174:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "ARRJ", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_OBJJ(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyDo(yy, yyPush, 3, 0);
|
||||
yyprintf((stderr, "%s\n", "OBJJ")); if (!yy_SOBJJ(yy)) goto l178; yyDo(yy, yySet, -3, 0); yyDo(yy, yy_1_OBJJ, yy->__begin, yy->__end); if (!yy__(yy)) goto l178;
|
||||
{ int yypos179= yy->__pos, yythunkpos179= yy->__thunkpos; if (!yy_PAIRJ(yy)) goto l179; yyDo(yy, yySet, -2, 0); yyDo(yy, yy_2_OBJJ, yy->__begin, yy->__end);
|
||||
l181:;
|
||||
{ int yypos182= yy->__pos, yythunkpos182= yy->__thunkpos; if (!yy__(yy)) goto l182; if (!yymatchChar(yy, ',')) goto l182; if (!yy__(yy)) goto l182; if (!yy_PAIRJ(yy)) goto l182; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_3_OBJJ, yy->__begin, yy->__end); goto l181;
|
||||
l182:; yy->__pos= yypos182; yy->__thunkpos= yythunkpos182;
|
||||
} goto l180;
|
||||
l179:; yy->__pos= yypos179; yy->__thunkpos= yythunkpos179;
|
||||
yyprintf((stderr, "%s\n", "OBJJ")); if (!yy_SOBJJ(yy)) goto l179; yyDo(yy, yySet, -3, 0); yyDo(yy, yy_1_OBJJ, yy->__begin, yy->__end); if (!yy__(yy)) goto l179;
|
||||
{ int yypos180= yy->__pos, yythunkpos180= yy->__thunkpos; if (!yy_PAIRJ(yy)) goto l180; yyDo(yy, yySet, -2, 0); yyDo(yy, yy_2_OBJJ, yy->__begin, yy->__end);
|
||||
l182:;
|
||||
{ int yypos183= yy->__pos, yythunkpos183= yy->__thunkpos; if (!yy__(yy)) goto l183; if (!yymatchChar(yy, ',')) goto l183; if (!yy__(yy)) goto l183; if (!yy_PAIRJ(yy)) goto l183; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_3_OBJJ, yy->__begin, yy->__end); goto l182;
|
||||
l183:; yy->__pos= yypos183; yy->__thunkpos= yythunkpos183;
|
||||
} goto l181;
|
||||
l180:; yy->__pos= yypos180; yy->__thunkpos= yythunkpos180;
|
||||
}
|
||||
l180:; if (!yy__(yy)) goto l178; if (!yymatchChar(yy, '}')) goto l178; yyDo(yy, yy_4_OBJJ, yy->__begin, yy->__end);
|
||||
l181:; if (!yy__(yy)) goto l179; if (!yymatchChar(yy, '}')) goto l179; yyDo(yy, yy_4_OBJJ, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "OBJJ", yy->__buf+yy->__pos)); yyDo(yy, yyPop, 3, 0);
|
||||
return 1;
|
||||
l178:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l179:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "OBJJ", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy___(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
|
||||
yyprintf((stderr, "%s\n", "__")); if (!yy_SPACE(yy)) goto l183;
|
||||
l184:;
|
||||
{ int yypos185= yy->__pos, yythunkpos185= yy->__thunkpos; if (!yy_SPACE(yy)) goto l185; goto l184;
|
||||
l185:; yy->__pos= yypos185; yy->__thunkpos= yythunkpos185;
|
||||
yyprintf((stderr, "%s\n", "__")); if (!yy_SPACE(yy)) goto l184;
|
||||
l185:;
|
||||
{ int yypos186= yy->__pos, yythunkpos186= yy->__thunkpos; if (!yy_SPACE(yy)) goto l186; goto l185;
|
||||
l186:; yy->__pos= yypos186; yy->__thunkpos= yythunkpos186;
|
||||
}
|
||||
yyprintf((stderr, " ok %s @ %s\n", "__", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
l183:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l184:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "__", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
@@ -2840,44 +2841,44 @@ YY_RULE(int) yy_FILTERJOIN(yycontext *yy)
|
||||
yyprintf((stderr, "%s\n", "FILTERJOIN")); yyText(yy, yy->__begin, yy->__end); {
|
||||
#define yytext yy->__text
|
||||
#define yyleng yy->__textlen
|
||||
if (!(YY_BEGIN)) goto l186;
|
||||
if (!(YY_BEGIN)) goto l187;
|
||||
#undef yytext
|
||||
#undef yyleng
|
||||
}
|
||||
{ int yypos187= yy->__pos, yythunkpos187= yy->__thunkpos; if (!yymatchString(yy, "and")) goto l188; goto l187;
|
||||
l188:; yy->__pos= yypos187; yy->__thunkpos= yythunkpos187; if (!yymatchString(yy, "or")) goto l186;
|
||||
{ int yypos188= yy->__pos, yythunkpos188= yy->__thunkpos; if (!yymatchString(yy, "and")) goto l189; goto l188;
|
||||
l189:; yy->__pos= yypos188; yy->__thunkpos= yythunkpos188; if (!yymatchString(yy, "or")) goto l187;
|
||||
}
|
||||
l187:; yyText(yy, yy->__begin, yy->__end); {
|
||||
l188:; yyText(yy, yy->__begin, yy->__end); {
|
||||
#define yytext yy->__text
|
||||
#define yyleng yy->__textlen
|
||||
if (!(YY_END)) goto l186;
|
||||
if (!(YY_END)) goto l187;
|
||||
#undef yytext
|
||||
#undef yyleng
|
||||
}
|
||||
{ int yypos189= yy->__pos, yythunkpos189= yy->__thunkpos; if (!yy___(yy)) goto l189; if (!yymatchString(yy, "not")) goto l189; yyDo(yy, yy_1_FILTERJOIN, yy->__begin, yy->__end); goto l190;
|
||||
l189:; yy->__pos= yypos189; yy->__thunkpos= yythunkpos189;
|
||||
{ int yypos190= yy->__pos, yythunkpos190= yy->__thunkpos; if (!yy___(yy)) goto l190; if (!yymatchString(yy, "not")) goto l190; yyDo(yy, yy_1_FILTERJOIN, yy->__begin, yy->__end); goto l191;
|
||||
l190:; yy->__pos= yypos190; yy->__thunkpos= yythunkpos190;
|
||||
}
|
||||
l190:; yyDo(yy, yy_2_FILTERJOIN, yy->__begin, yy->__end);
|
||||
l191:; yyDo(yy, yy_2_FILTERJOIN, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "FILTERJOIN", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
l186:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l187:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "FILTERJOIN", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_NUMPK_ARR(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyDo(yy, yyPush, 3, 0);
|
||||
yyprintf((stderr, "%s\n", "NUMPK_ARR")); if (!yy_SARRJ(yy)) goto l191; yyDo(yy, yySet, -3, 0); yyDo(yy, yy_1_NUMPK_ARR, yy->__begin, yy->__end); if (!yy__(yy)) goto l191;
|
||||
{ int yypos192= yy->__pos, yythunkpos192= yy->__thunkpos; if (!yy_NUMPK(yy)) goto l192; yyDo(yy, yySet, -2, 0); yyDo(yy, yy_2_NUMPK_ARR, yy->__begin, yy->__end);
|
||||
l194:;
|
||||
{ int yypos195= yy->__pos, yythunkpos195= yy->__thunkpos; if (!yy__(yy)) goto l195; if (!yymatchChar(yy, ',')) goto l195; if (!yy__(yy)) goto l195; if (!yy_NUMPK(yy)) goto l195; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_3_NUMPK_ARR, yy->__begin, yy->__end); goto l194;
|
||||
l195:; yy->__pos= yypos195; yy->__thunkpos= yythunkpos195;
|
||||
} goto l193;
|
||||
l192:; yy->__pos= yypos192; yy->__thunkpos= yythunkpos192;
|
||||
yyprintf((stderr, "%s\n", "NUMPK_ARR")); if (!yy_SARRJ(yy)) goto l192; yyDo(yy, yySet, -3, 0); yyDo(yy, yy_1_NUMPK_ARR, yy->__begin, yy->__end); if (!yy__(yy)) goto l192;
|
||||
{ int yypos193= yy->__pos, yythunkpos193= yy->__thunkpos; if (!yy_NUMPK(yy)) goto l193; yyDo(yy, yySet, -2, 0); yyDo(yy, yy_2_NUMPK_ARR, yy->__begin, yy->__end);
|
||||
l195:;
|
||||
{ int yypos196= yy->__pos, yythunkpos196= yy->__thunkpos; if (!yy__(yy)) goto l196; if (!yymatchChar(yy, ',')) goto l196; if (!yy__(yy)) goto l196; if (!yy_NUMPK(yy)) goto l196; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_3_NUMPK_ARR, yy->__begin, yy->__end); goto l195;
|
||||
l196:; yy->__pos= yypos196; yy->__thunkpos= yythunkpos196;
|
||||
} goto l194;
|
||||
l193:; yy->__pos= yypos193; yy->__thunkpos= yythunkpos193;
|
||||
}
|
||||
l193:; if (!yy__(yy)) goto l191; if (!yymatchChar(yy, ']')) goto l191; yyDo(yy, yy_4_NUMPK_ARR, yy->__begin, yy->__end);
|
||||
l194:; if (!yy__(yy)) goto l192; if (!yymatchChar(yy, ']')) goto l192; yyDo(yy, yy_4_NUMPK_ARR, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "NUMPK_ARR", yy->__buf+yy->__pos)); yyDo(yy, yyPop, 3, 0);
|
||||
return 1;
|
||||
l191:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l192:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "NUMPK_ARR", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
@@ -2886,191 +2887,191 @@ YY_RULE(int) yy_NUMPK(yycontext *yy)
|
||||
yyprintf((stderr, "%s\n", "NUMPK")); yyText(yy, yy->__begin, yy->__end); {
|
||||
#define yytext yy->__text
|
||||
#define yyleng yy->__textlen
|
||||
if (!(YY_BEGIN)) goto l196;
|
||||
#undef yytext
|
||||
#undef yyleng
|
||||
} if (!yy_NUMI(yy)) goto l196; yyText(yy, yy->__begin, yy->__end); {
|
||||
#define yytext yy->__text
|
||||
#define yyleng yy->__textlen
|
||||
if (!(YY_END)) goto l196;
|
||||
#undef yytext
|
||||
#undef yyleng
|
||||
} yyDo(yy, yy_1_NUMPK, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "NUMPK", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
l196:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "NUMPK", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_PLACEHOLDER(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
|
||||
yyprintf((stderr, "%s\n", "PLACEHOLDER")); if (!yymatchChar(yy, ':')) goto l197; yyText(yy, yy->__begin, yy->__end); {
|
||||
#define yytext yy->__text
|
||||
#define yyleng yy->__textlen
|
||||
if (!(YY_BEGIN)) goto l197;
|
||||
#undef yytext
|
||||
#undef yyleng
|
||||
}
|
||||
{ int yypos198= yy->__pos, yythunkpos198= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\376\377\377\007\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l199;
|
||||
l200:;
|
||||
{ int yypos201= yy->__pos, yythunkpos201= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\376\377\377\007\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l201; goto l200;
|
||||
l201:; yy->__pos= yypos201; yy->__thunkpos= yythunkpos201;
|
||||
} goto l198;
|
||||
l199:; yy->__pos= yypos198; yy->__thunkpos= yythunkpos198; if (!yymatchChar(yy, '?')) goto l197;
|
||||
}
|
||||
l198:; yyText(yy, yy->__begin, yy->__end); {
|
||||
} if (!yy_NUMI(yy)) goto l197; yyText(yy, yy->__begin, yy->__end); {
|
||||
#define yytext yy->__text
|
||||
#define yyleng yy->__textlen
|
||||
if (!(YY_END)) goto l197;
|
||||
#undef yytext
|
||||
#undef yyleng
|
||||
} yyDo(yy, yy_1_NUMPK, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "NUMPK", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
l197:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "NUMPK", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_PLACEHOLDER(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
|
||||
yyprintf((stderr, "%s\n", "PLACEHOLDER")); if (!yymatchChar(yy, ':')) goto l198; yyText(yy, yy->__begin, yy->__end); {
|
||||
#define yytext yy->__text
|
||||
#define yyleng yy->__textlen
|
||||
if (!(YY_BEGIN)) goto l198;
|
||||
#undef yytext
|
||||
#undef yyleng
|
||||
}
|
||||
{ int yypos199= yy->__pos, yythunkpos199= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\376\377\377\007\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l200;
|
||||
l201:;
|
||||
{ int yypos202= yy->__pos, yythunkpos202= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\376\377\377\007\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l202; goto l201;
|
||||
l202:; yy->__pos= yypos202; yy->__thunkpos= yythunkpos202;
|
||||
} goto l199;
|
||||
l200:; yy->__pos= yypos199; yy->__thunkpos= yythunkpos199; if (!yymatchChar(yy, '?')) goto l198;
|
||||
}
|
||||
l199:; yyText(yy, yy->__begin, yy->__end); {
|
||||
#define yytext yy->__text
|
||||
#define yyleng yy->__textlen
|
||||
if (!(YY_END)) goto l198;
|
||||
#undef yytext
|
||||
#undef yyleng
|
||||
} yyDo(yy, yy_1_PLACEHOLDER, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "PLACEHOLDER", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
l197:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l198:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "PLACEHOLDER", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_FILTERANCHOR(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
|
||||
yyprintf((stderr, "%s\n", "FILTERANCHOR")); if (!yymatchChar(yy, '@')) goto l202; yyText(yy, yy->__begin, yy->__end); {
|
||||
yyprintf((stderr, "%s\n", "FILTERANCHOR")); if (!yymatchChar(yy, '@')) goto l203; yyText(yy, yy->__begin, yy->__end); {
|
||||
#define yytext yy->__text
|
||||
#define yyleng yy->__textlen
|
||||
if (!(YY_BEGIN)) goto l202;
|
||||
if (!(YY_BEGIN)) goto l203;
|
||||
#undef yytext
|
||||
#undef yyleng
|
||||
} if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\040\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l202;
|
||||
l203:;
|
||||
{ int yypos204= yy->__pos, yythunkpos204= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\040\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l204; goto l203;
|
||||
l204:; yy->__pos= yypos204; yy->__thunkpos= yythunkpos204;
|
||||
} if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\040\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l203;
|
||||
l204:;
|
||||
{ int yypos205= yy->__pos, yythunkpos205= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\040\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l205; goto l204;
|
||||
l205:; yy->__pos= yypos205; yy->__thunkpos= yythunkpos205;
|
||||
} yyText(yy, yy->__begin, yy->__end); {
|
||||
#define yytext yy->__text
|
||||
#define yyleng yy->__textlen
|
||||
if (!(YY_END)) goto l202;
|
||||
if (!(YY_END)) goto l203;
|
||||
#undef yytext
|
||||
#undef yyleng
|
||||
} yyDo(yy, yy_1_FILTERANCHOR, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "FILTERANCHOR", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
l202:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l203:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "FILTERANCHOR", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_FILTEREXPR(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyDo(yy, yyPush, 3, 0);
|
||||
yyprintf((stderr, "%s\n", "FILTEREXPR")); if (!yy_FILTERFACTOR(yy)) goto l205; yyDo(yy, yySet, -3, 0); yyDo(yy, yy_1_FILTEREXPR, yy->__begin, yy->__end);
|
||||
l206:;
|
||||
{ int yypos207= yy->__pos, yythunkpos207= yy->__thunkpos; if (!yy___(yy)) goto l207; if (!yy_FILTERJOIN(yy)) goto l207; yyDo(yy, yySet, -2, 0); yyDo(yy, yy_2_FILTEREXPR, yy->__begin, yy->__end); if (!yy___(yy)) goto l207; if (!yy_FILTERFACTOR(yy)) goto l207; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_3_FILTEREXPR, yy->__begin, yy->__end); goto l206;
|
||||
l207:; yy->__pos= yypos207; yy->__thunkpos= yythunkpos207;
|
||||
yyprintf((stderr, "%s\n", "FILTEREXPR")); if (!yy_FILTERFACTOR(yy)) goto l206; yyDo(yy, yySet, -3, 0); yyDo(yy, yy_1_FILTEREXPR, yy->__begin, yy->__end);
|
||||
l207:;
|
||||
{ int yypos208= yy->__pos, yythunkpos208= yy->__thunkpos; if (!yy___(yy)) goto l208; if (!yy_FILTERJOIN(yy)) goto l208; yyDo(yy, yySet, -2, 0); yyDo(yy, yy_2_FILTEREXPR, yy->__begin, yy->__end); if (!yy___(yy)) goto l208; if (!yy_FILTERFACTOR(yy)) goto l208; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_3_FILTEREXPR, yy->__begin, yy->__end); goto l207;
|
||||
l208:; yy->__pos= yypos208; yy->__thunkpos= yythunkpos208;
|
||||
} yyDo(yy, yy_4_FILTEREXPR, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "FILTEREXPR", yy->__buf+yy->__pos)); yyDo(yy, yyPop, 3, 0);
|
||||
return 1;
|
||||
l205:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l206:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "FILTEREXPR", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_FILTEREXPR_PK(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyDo(yy, yyPush, 2, 0);
|
||||
yyprintf((stderr, "%s\n", "FILTEREXPR_PK"));
|
||||
{ int yypos209= yy->__pos, yythunkpos209= yy->__thunkpos; if (!yy_FILTERANCHOR(yy)) goto l209; yyDo(yy, yySet, -2, 0); yyDo(yy, yy_1_FILTEREXPR_PK, yy->__begin, yy->__end); goto l210;
|
||||
l209:; yy->__pos= yypos209; yy->__thunkpos= yythunkpos209;
|
||||
{ int yypos210= yy->__pos, yythunkpos210= yy->__thunkpos; if (!yy_FILTERANCHOR(yy)) goto l210; yyDo(yy, yySet, -2, 0); yyDo(yy, yy_1_FILTEREXPR_PK, yy->__begin, yy->__end); goto l211;
|
||||
l210:; yy->__pos= yypos210; yy->__thunkpos= yythunkpos210;
|
||||
}
|
||||
l210:; if (!yymatchChar(yy, '/')) goto l208; if (!yy__(yy)) goto l208; if (!yymatchChar(yy, '=')) goto l208; if (!yy__(yy)) goto l208;
|
||||
{ int yypos211= yy->__pos, yythunkpos211= yy->__thunkpos; if (!yy_PLACEHOLDER(yy)) goto l212; yyDo(yy, yySet, -1, 0); goto l211;
|
||||
l212:; yy->__pos= yypos211; yy->__thunkpos= yythunkpos211; if (!yy_NUMPK(yy)) goto l213; yyDo(yy, yySet, -1, 0); goto l211;
|
||||
l213:; yy->__pos= yypos211; yy->__thunkpos= yythunkpos211; if (!yy_NUMPK_ARR(yy)) goto l208; yyDo(yy, yySet, -1, 0);
|
||||
l211:; if (!yymatchChar(yy, '/')) goto l209; if (!yy__(yy)) goto l209; if (!yymatchChar(yy, '=')) goto l209; if (!yy__(yy)) goto l209;
|
||||
{ int yypos212= yy->__pos, yythunkpos212= yy->__thunkpos; if (!yy_PLACEHOLDER(yy)) goto l213; yyDo(yy, yySet, -1, 0); goto l212;
|
||||
l213:; yy->__pos= yypos212; yy->__thunkpos= yythunkpos212; if (!yy_NUMPK(yy)) goto l214; yyDo(yy, yySet, -1, 0); goto l212;
|
||||
l214:; yy->__pos= yypos212; yy->__thunkpos= yythunkpos212; if (!yy_NUMPK_ARR(yy)) goto l209; yyDo(yy, yySet, -1, 0);
|
||||
}
|
||||
l211:; yyDo(yy, yy_2_FILTEREXPR_PK, yy->__begin, yy->__end);
|
||||
l212:; yyDo(yy, yy_2_FILTEREXPR_PK, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "FILTEREXPR_PK", yy->__buf+yy->__pos)); yyDo(yy, yyPop, 2, 0);
|
||||
return 1;
|
||||
l208:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l209:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "FILTEREXPR_PK", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_EOF(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
|
||||
yyprintf((stderr, "%s\n", "EOF"));
|
||||
{ int yypos215= yy->__pos, yythunkpos215= yy->__thunkpos; if (!yymatchDot(yy)) goto l215; goto l214;
|
||||
l215:; yy->__pos= yypos215; yy->__thunkpos= yythunkpos215;
|
||||
{ int yypos216= yy->__pos, yythunkpos216= yy->__thunkpos; if (!yymatchDot(yy)) goto l216; goto l215;
|
||||
l216:; yy->__pos= yypos216; yy->__thunkpos= yythunkpos216;
|
||||
}
|
||||
yyprintf((stderr, " ok %s @ %s\n", "EOF", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
l214:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l215:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "EOF", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_OPTS(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
|
||||
yyprintf((stderr, "%s\n", "OPTS")); if (!yymatchChar(yy, '|')) goto l216; if (!yy__(yy)) goto l216; if (!yy_OPT(yy)) goto l216;
|
||||
l217:;
|
||||
{ int yypos218= yy->__pos, yythunkpos218= yy->__thunkpos; if (!yy___(yy)) goto l218; if (!yy_OPT(yy)) goto l218; goto l217;
|
||||
l218:; yy->__pos= yypos218; yy->__thunkpos= yythunkpos218;
|
||||
yyprintf((stderr, "%s\n", "OPTS")); if (!yymatchChar(yy, '|')) goto l217; if (!yy__(yy)) goto l217; if (!yy_OPT(yy)) goto l217;
|
||||
l218:;
|
||||
{ int yypos219= yy->__pos, yythunkpos219= yy->__thunkpos; if (!yy___(yy)) goto l219; if (!yy_OPT(yy)) goto l219; goto l218;
|
||||
l219:; yy->__pos= yypos219; yy->__thunkpos= yythunkpos219;
|
||||
}
|
||||
yyprintf((stderr, " ok %s @ %s\n", "OPTS", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
l216:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l217:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "OPTS", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_PROJECTION(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyDo(yy, yyPush, 2, 0);
|
||||
yyprintf((stderr, "%s\n", "PROJECTION")); if (!yymatchChar(yy, '|')) goto l219; if (!yy__(yy)) goto l219; if (!yy_PROJNODES(yy)) goto l219; yyDo(yy, yySet, -2, 0); yyDo(yy, yy_1_PROJECTION, yy->__begin, yy->__end);
|
||||
l220:;
|
||||
{ int yypos221= yy->__pos, yythunkpos221= yy->__thunkpos; if (!yy__(yy)) goto l221; yyText(yy, yy->__begin, yy->__end); {
|
||||
yyprintf((stderr, "%s\n", "PROJECTION")); if (!yymatchChar(yy, '|')) goto l220; if (!yy__(yy)) goto l220; if (!yy_PROJNODES(yy)) goto l220; yyDo(yy, yySet, -2, 0); yyDo(yy, yy_1_PROJECTION, yy->__begin, yy->__end);
|
||||
l221:;
|
||||
{ int yypos222= yy->__pos, yythunkpos222= yy->__thunkpos; if (!yy__(yy)) goto l222; yyText(yy, yy->__begin, yy->__end); {
|
||||
#define yytext yy->__text
|
||||
#define yyleng yy->__textlen
|
||||
if (!(YY_BEGIN)) goto l221;
|
||||
if (!(YY_BEGIN)) goto l222;
|
||||
#undef yytext
|
||||
#undef yyleng
|
||||
} if (!yy_PROJOIN(yy)) goto l221; yyText(yy, yy->__begin, yy->__end); {
|
||||
} if (!yy_PROJOIN(yy)) goto l222; yyText(yy, yy->__begin, yy->__end); {
|
||||
#define yytext yy->__text
|
||||
#define yyleng yy->__textlen
|
||||
if (!(YY_END)) goto l221;
|
||||
if (!(YY_END)) goto l222;
|
||||
#undef yytext
|
||||
#undef yyleng
|
||||
} yyDo(yy, yy_2_PROJECTION, yy->__begin, yy->__end); if (!yy__(yy)) goto l221; if (!yy_PROJNODES(yy)) goto l221; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_3_PROJECTION, yy->__begin, yy->__end); goto l220;
|
||||
l221:; yy->__pos= yypos221; yy->__thunkpos= yythunkpos221;
|
||||
} yyDo(yy, yy_2_PROJECTION, yy->__begin, yy->__end); if (!yy__(yy)) goto l222; if (!yy_PROJNODES(yy)) goto l222; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_3_PROJECTION, yy->__begin, yy->__end); goto l221;
|
||||
l222:; yy->__pos= yypos222; yy->__thunkpos= yythunkpos222;
|
||||
} yyDo(yy, yy_4_PROJECTION, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "PROJECTION", yy->__buf+yy->__pos)); yyDo(yy, yyPop, 2, 0);
|
||||
return 1;
|
||||
l219:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l220:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "PROJECTION", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_UPSERT(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
|
||||
yyprintf((stderr, "%s\n", "UPSERT")); if (!yymatchString(yy, "upsert")) goto l222; if (!yy___(yy)) goto l222;
|
||||
{ int yypos223= yy->__pos, yythunkpos223= yy->__thunkpos; if (!yy_PLACEHOLDER(yy)) goto l224; goto l223;
|
||||
l224:; yy->__pos= yypos223; yy->__thunkpos= yythunkpos223; if (!yy_OBJJ(yy)) goto l225; goto l223;
|
||||
l225:; yy->__pos= yypos223; yy->__thunkpos= yythunkpos223; if (!yy_ARRJ(yy)) goto l222;
|
||||
yyprintf((stderr, "%s\n", "UPSERT")); if (!yymatchString(yy, "upsert")) goto l223; if (!yy___(yy)) goto l223;
|
||||
{ int yypos224= yy->__pos, yythunkpos224= yy->__thunkpos; if (!yy_PLACEHOLDER(yy)) goto l225; goto l224;
|
||||
l225:; yy->__pos= yypos224; yy->__thunkpos= yythunkpos224; if (!yy_OBJJ(yy)) goto l226; goto l224;
|
||||
l226:; yy->__pos= yypos224; yy->__thunkpos= yythunkpos224; if (!yy_ARRJ(yy)) goto l223;
|
||||
}
|
||||
l223:;
|
||||
l224:;
|
||||
yyprintf((stderr, " ok %s @ %s\n", "UPSERT", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
l222:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l223:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "UPSERT", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_APPLY(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
|
||||
yyprintf((stderr, "%s\n", "APPLY")); if (!yymatchString(yy, "apply")) goto l226; if (!yy___(yy)) goto l226;
|
||||
{ int yypos227= yy->__pos, yythunkpos227= yy->__thunkpos; if (!yy_PLACEHOLDER(yy)) goto l228; goto l227;
|
||||
l228:; yy->__pos= yypos227; yy->__thunkpos= yythunkpos227; if (!yy_OBJJ(yy)) goto l229; goto l227;
|
||||
l229:; yy->__pos= yypos227; yy->__thunkpos= yythunkpos227; if (!yy_ARRJ(yy)) goto l226;
|
||||
yyprintf((stderr, "%s\n", "APPLY")); if (!yymatchString(yy, "apply")) goto l227; if (!yy___(yy)) goto l227;
|
||||
{ int yypos228= yy->__pos, yythunkpos228= yy->__thunkpos; if (!yy_PLACEHOLDER(yy)) goto l229; goto l228;
|
||||
l229:; yy->__pos= yypos228; yy->__thunkpos= yythunkpos228; if (!yy_OBJJ(yy)) goto l230; goto l228;
|
||||
l230:; yy->__pos= yypos228; yy->__thunkpos= yythunkpos228; if (!yy_ARRJ(yy)) goto l227;
|
||||
}
|
||||
l227:;
|
||||
l228:;
|
||||
yyprintf((stderr, " ok %s @ %s\n", "APPLY", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
l226:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l227:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "APPLY", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy__(yycontext *yy)
|
||||
{
|
||||
yyprintf((stderr, "%s\n", "_"));
|
||||
l231:;
|
||||
{ int yypos232= yy->__pos, yythunkpos232= yy->__thunkpos; if (!yy_SPACE(yy)) goto l232; goto l231;
|
||||
l232:; yy->__pos= yypos232; yy->__thunkpos= yythunkpos232;
|
||||
l232:;
|
||||
{ int yypos233= yy->__pos, yythunkpos233= yy->__thunkpos; if (!yy_SPACE(yy)) goto l233; goto l232;
|
||||
l233:; yy->__pos= yypos233; yy->__thunkpos= yythunkpos233;
|
||||
}
|
||||
yyprintf((stderr, " ok %s @ %s\n", "_", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
@@ -3078,39 +3079,39 @@ YY_RULE(int) yy__(yycontext *yy)
|
||||
YY_RULE(int) yy_QEXPR(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
|
||||
yyprintf((stderr, "%s\n", "QEXPR"));
|
||||
{ int yypos234= yy->__pos, yythunkpos234= yy->__thunkpos; if (!yy_FILTEREXPR_PK(yy)) goto l235; goto l234;
|
||||
l235:; yy->__pos= yypos234; yy->__thunkpos= yythunkpos234; if (!yy_FILTEREXPR(yy)) goto l233;
|
||||
{ int yypos235= yy->__pos, yythunkpos235= yy->__thunkpos; if (!yy_FILTEREXPR_PK(yy)) goto l236; goto l235;
|
||||
l236:; yy->__pos= yypos235; yy->__thunkpos= yythunkpos235; if (!yy_FILTEREXPR(yy)) goto l234;
|
||||
}
|
||||
l234:;
|
||||
l235:;
|
||||
yyprintf((stderr, " ok %s @ %s\n", "QEXPR", yy->__buf+yy->__pos));
|
||||
return 1;
|
||||
l233:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l234:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "QEXPR", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
YY_RULE(int) yy_QUERY(yycontext *yy)
|
||||
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyDo(yy, yyPush, 4, 0);
|
||||
yyprintf((stderr, "%s\n", "QUERY")); if (!yy_QEXPR(yy)) goto l236; yyDo(yy, yySet, -4, 0); yyDo(yy, yy_1_QUERY, yy->__begin, yy->__end);
|
||||
{ int yypos237= yy->__pos, yythunkpos237= yy->__thunkpos; if (!yy__(yy)) goto l237; if (!yymatchChar(yy, '|')) goto l237; if (!yy__(yy)) goto l237;
|
||||
{ int yypos239= yy->__pos, yythunkpos239= yy->__thunkpos; if (!yy_APPLY(yy)) goto l240; yyDo(yy, yySet, -3, 0); yyDo(yy, yy_2_QUERY, yy->__begin, yy->__end); goto l239;
|
||||
l240:; yy->__pos= yypos239; yy->__thunkpos= yythunkpos239; if (!yymatchString(yy, "del")) goto l241; yyDo(yy, yy_3_QUERY, yy->__begin, yy->__end); goto l239;
|
||||
l241:; yy->__pos= yypos239; yy->__thunkpos= yythunkpos239; if (!yy_UPSERT(yy)) goto l237; yyDo(yy, yySet, -2, 0); yyDo(yy, yy_4_QUERY, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, "%s\n", "QUERY")); if (!yy_QEXPR(yy)) goto l237; yyDo(yy, yySet, -4, 0); yyDo(yy, yy_1_QUERY, yy->__begin, yy->__end);
|
||||
{ int yypos238= yy->__pos, yythunkpos238= yy->__thunkpos; if (!yy__(yy)) goto l238; if (!yymatchChar(yy, '|')) goto l238; if (!yy__(yy)) goto l238;
|
||||
{ int yypos240= yy->__pos, yythunkpos240= yy->__thunkpos; if (!yy_APPLY(yy)) goto l241; yyDo(yy, yySet, -3, 0); yyDo(yy, yy_2_QUERY, yy->__begin, yy->__end); goto l240;
|
||||
l241:; yy->__pos= yypos240; yy->__thunkpos= yythunkpos240; if (!yymatchString(yy, "del")) goto l242; yyDo(yy, yy_3_QUERY, yy->__begin, yy->__end); goto l240;
|
||||
l242:; yy->__pos= yypos240; yy->__thunkpos= yythunkpos240; if (!yy_UPSERT(yy)) goto l238; yyDo(yy, yySet, -2, 0); yyDo(yy, yy_4_QUERY, yy->__begin, yy->__end);
|
||||
}
|
||||
l239:; goto l238;
|
||||
l237:; yy->__pos= yypos237; yy->__thunkpos= yythunkpos237;
|
||||
l240:; goto l239;
|
||||
l238:; yy->__pos= yypos238; yy->__thunkpos= yythunkpos238;
|
||||
}
|
||||
l238:;
|
||||
{ int yypos242= yy->__pos, yythunkpos242= yy->__thunkpos; if (!yy__(yy)) goto l242; if (!yy_PROJECTION(yy)) goto l242; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_5_QUERY, yy->__begin, yy->__end); goto l243;
|
||||
l242:; yy->__pos= yypos242; yy->__thunkpos= yythunkpos242;
|
||||
l239:;
|
||||
{ int yypos243= yy->__pos, yythunkpos243= yy->__thunkpos; if (!yy__(yy)) goto l243; if (!yy_PROJECTION(yy)) goto l243; yyDo(yy, yySet, -1, 0); yyDo(yy, yy_5_QUERY, yy->__begin, yy->__end); goto l244;
|
||||
l243:; yy->__pos= yypos243; yy->__thunkpos= yythunkpos243;
|
||||
}
|
||||
l243:;
|
||||
{ int yypos244= yy->__pos, yythunkpos244= yy->__thunkpos; if (!yy__(yy)) goto l244; if (!yy_OPTS(yy)) goto l244; goto l245;
|
||||
l244:; yy->__pos= yypos244; yy->__thunkpos= yythunkpos244;
|
||||
l244:;
|
||||
{ int yypos245= yy->__pos, yythunkpos245= yy->__thunkpos; if (!yy__(yy)) goto l245; if (!yy_OPTS(yy)) goto l245; goto l246;
|
||||
l245:; yy->__pos= yypos245; yy->__thunkpos= yythunkpos245;
|
||||
}
|
||||
l245:; if (!yy__(yy)) goto l236; if (!yy_EOF(yy)) goto l236; yyDo(yy, yy_6_QUERY, yy->__begin, yy->__end);
|
||||
l246:; if (!yy__(yy)) goto l237; if (!yy_EOF(yy)) goto l237; yyDo(yy, yy_6_QUERY, yy->__begin, yy->__end);
|
||||
yyprintf((stderr, " ok %s @ %s\n", "QUERY", yy->__buf+yy->__pos)); yyDo(yy, yyPop, 4, 0);
|
||||
return 1;
|
||||
l236:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
l237:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
|
||||
yyprintf((stderr, " fail %s @ %s\n", "QUERY", yy->__buf+yy->__pos));
|
||||
return 0;
|
||||
}
|
||||
|
||||
+3
-1
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
* Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -56,6 +56,8 @@ typedef uint16_t jqp_string_flavours_t;
|
||||
#define JQP_STR_DBL_STAR ((jqp_string_flavours_t) 0x80U)
|
||||
/** Projection JOIN */
|
||||
#define JQP_STR_PROJOIN ((jqp_string_flavours_t) 0x100U)
|
||||
/** Projection path */
|
||||
#define JQP_STR_PROJPATH ((jqp_string_flavours_t) 0x200U)
|
||||
|
||||
|
||||
typedef uint8_t jqp_int_flavours_t;
|
||||
|
||||
+1
-1
@@ -133,7 +133,7 @@ PROJNODE = '/' (PROJFIELDS | PROJPROP)
|
||||
PROJFIELDS = ('{' _ sp:PROJPROP { _jqp_unit_push(yy, sp); } (_ ',' _ p:PROJPROP { _jqp_unit_push(yy, p); } )* _ '}')
|
||||
{ $$ = _jqp_pop_projfields_chain(yy, sp); }
|
||||
|
||||
PROJPROP = STRN | PSTRP
|
||||
PROJPROP = STRN | PLACEHOLDER | PSTRP
|
||||
|
||||
PROJOIN = ('+' | '-')
|
||||
|
||||
|
||||
@@ -66,8 +66,7 @@ finish:
|
||||
jqp_aux_destroy(&aux);
|
||||
}
|
||||
|
||||
void jql_test1_1() {
|
||||
|
||||
static void jql_test1_1(void) {
|
||||
_jql_test1_1(22, 0);
|
||||
|
||||
for (int i = 0; i <= 10; ++i) {
|
||||
@@ -100,7 +99,7 @@ static void _jql_test1_2(const char *jsondata, const char *q, bool match) {
|
||||
free(json);
|
||||
}
|
||||
|
||||
void jql_test1_2() {
|
||||
static void jql_test1_2(void) {
|
||||
_jql_test1_2("{}", "/*", true);
|
||||
_jql_test1_2("{}", "/**", true);
|
||||
_jql_test1_2("{'foo':{'bar':22}}", "/*", true);
|
||||
@@ -249,8 +248,7 @@ finish:
|
||||
iwpool_destroy(pool);
|
||||
}
|
||||
|
||||
void jql_test1_3() {
|
||||
|
||||
static void jql_test1_3(void) {
|
||||
_jql_test1_3(true, "{'foo':{'bar':22}}",
|
||||
"/foo/bar | apply [{'op':'add', 'path':'/baz', 'value':'qux'}]",
|
||||
"{'foo':{'bar':22},'baz':'qux'}");
|
||||
@@ -261,8 +259,7 @@ void jql_test1_3() {
|
||||
}
|
||||
|
||||
// Test projections
|
||||
void jql_test_1_4() {
|
||||
|
||||
static void jql_test_1_4(void) {
|
||||
_jql_test1_3(false, "{'foo':{'bar':22}}", "/** | all", "{'foo':{'bar':22}}");
|
||||
_jql_test1_3(false, "{'foo':{'bar':22}}", "/** | all+all + all", "{'foo':{'bar':22}}");
|
||||
_jql_test1_3(true, "{'foo':{'bar':22}}", "/** | all - all", "{}");
|
||||
@@ -281,6 +278,45 @@ void jql_test_1_4() {
|
||||
_jql_test1_3(true, "{'foo':{'bar':22},'name':'test'}", "/** | all - /name", "{'foo':{'bar':22}}");
|
||||
}
|
||||
|
||||
// Test placeholder projecttion
|
||||
static void jql_test_1_5(void) {
|
||||
JQL q = 0;
|
||||
JBL jbl = 0;
|
||||
JBL_NODE n = 0, n2 = 0;
|
||||
IWXSTR *xstr = iwxstr_new();
|
||||
IWPOOL *pool = iwpool_create_empty();
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(pool);
|
||||
iwrc rc = jql_create(&q, "c1", "/* | /:name+/:?");
|
||||
CU_ASSERT_EQUAL_FATAL(rc, 0);
|
||||
|
||||
rc = jql_set_i64(q, 0, 0, 1);
|
||||
CU_ASSERT_EQUAL(rc, JQL_ERROR_INVALID_PLACEHOLDER_VALUE_TYPE);
|
||||
|
||||
rc = jql_set_str(q, "name", 0, "foo");
|
||||
CU_ASSERT_EQUAL_FATAL(rc, 0);
|
||||
|
||||
rc = jql_set_str(q, 0, 0, "baz");
|
||||
CU_ASSERT_EQUAL_FATAL(rc, 0);
|
||||
|
||||
rc = jbl_from_json(&jbl, "{\"foo\":1,\"bar\":2,\"baz\":3}");
|
||||
CU_ASSERT_EQUAL_FATAL(rc, 0);
|
||||
bool m = false;
|
||||
rc = jql_matched(q, jbl, &m);
|
||||
CU_ASSERT_EQUAL_FATAL(rc, 0);
|
||||
CU_ASSERT_TRUE(m && jql_has_projection(q));
|
||||
|
||||
rc = jql_apply_and_project(q, jbl, &n, 0, pool);
|
||||
CU_ASSERT_EQUAL_FATAL(rc, 0);
|
||||
|
||||
jbn_as_json(n, jbl_xstr_json_printer, xstr, 0);
|
||||
CU_ASSERT_STRING_EQUAL(iwxstr_ptr(xstr), "{\"foo\":1,\"baz\":3}");
|
||||
|
||||
jql_destroy(&q);
|
||||
jbl_destroy(&jbl);
|
||||
iwpool_destroy(pool);
|
||||
iwxstr_destroy(xstr);
|
||||
}
|
||||
|
||||
int main() {
|
||||
CU_pSuite pSuite = NULL;
|
||||
if (CUE_SUCCESS != CU_initialize_registry()) {
|
||||
@@ -294,7 +330,8 @@ int main() {
|
||||
if ( (NULL == CU_add_test(pSuite, "jql_test1_1", jql_test1_1))
|
||||
|| (NULL == CU_add_test(pSuite, "jql_test1_2", jql_test1_2))
|
||||
|| (NULL == CU_add_test(pSuite, "jql_test1_3", jql_test1_3))
|
||||
|| (NULL == CU_add_test(pSuite, "jql_test1_4", jql_test_1_4))) {
|
||||
|| (NULL == CU_add_test(pSuite, "jql_test1_4", jql_test_1_4))
|
||||
|| (NULL == CU_add_test(pSuite, "jql_test1_5", jql_test_1_5))) {
|
||||
CU_cleanup_registry();
|
||||
return CU_get_error();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2012-2021 Softmotions Ltd <info@softmotions.com>
|
||||
* Copyright (c) 2012-2022 Softmotions Ltd <info@softmotions.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -81,7 +81,7 @@ static iwrc ejdb_test2_1_exec_visitor1(struct _EJDB_EXEC *ctx, const EJDB_DOC do
|
||||
*step = -1;
|
||||
}
|
||||
jbl_destroy(&jbl);
|
||||
iwxstr_printf(tc->xstr, "%lld", llv);
|
||||
iwxstr_printf(tc->xstr, "%" PRId64, llv);
|
||||
tc->cnt++;
|
||||
return rc;
|
||||
}
|
||||
|
||||
+33
-1
@@ -1119,6 +1119,37 @@ void ejdb_test3_8(void) {
|
||||
iwpool_destroy(pool);
|
||||
}
|
||||
|
||||
static void ejdb_test3_9(void) {
|
||||
EJDB_OPTS opts = {
|
||||
.kv = {
|
||||
.path = "ejdb_test3_9",
|
||||
.oflags = IWKV_TRUNC
|
||||
},
|
||||
.no_wal = true
|
||||
};
|
||||
EJDB db;
|
||||
EJDB_LIST list = 0;
|
||||
iwrc rc = ejdb_open(&opts, &db);
|
||||
CU_ASSERT_EQUAL_FATAL(rc, 0)
|
||||
|
||||
rc = put_json(db, "zzz", "[[\"one\",\"two\"]]");
|
||||
CU_ASSERT_EQUAL_FATAL(rc, 0);
|
||||
|
||||
rc = put_json(db, "zzz", "[[\"red\",\"brown\"],[false]]");
|
||||
CU_ASSERT_EQUAL_FATAL(rc, 0);
|
||||
|
||||
rc = ejdb_list3(db, "zzz", "/*/[** = one]", 0, 0, &list);
|
||||
CU_ASSERT_EQUAL_FATAL(rc, 0);
|
||||
|
||||
CU_ASSERT_PTR_NOT_NULL(list->first);
|
||||
CU_ASSERT_PTR_NULL(list->first->next);
|
||||
|
||||
ejdb_list_destroy(&list);
|
||||
|
||||
rc = ejdb_close(&db);
|
||||
CU_ASSERT_EQUAL_FATAL(rc, 0);
|
||||
}
|
||||
|
||||
int main() {
|
||||
CU_pSuite pSuite = NULL;
|
||||
if (CUE_SUCCESS != CU_initialize_registry()) {
|
||||
@@ -1136,7 +1167,8 @@ int main() {
|
||||
|| (NULL == CU_add_test(pSuite, "ejdb_test3_5", ejdb_test3_5))
|
||||
|| (NULL == CU_add_test(pSuite, "ejdb_test3_6", ejdb_test3_6))
|
||||
|| (NULL == CU_add_test(pSuite, "ejdb_test3_7", ejdb_test3_7))
|
||||
|| (NULL == CU_add_test(pSuite, "ejdb_test3_8", ejdb_test3_8))) {
|
||||
|| (NULL == CU_add_test(pSuite, "ejdb_test3_8", ejdb_test3_8))
|
||||
|| (NULL == CU_add_test(pSuite, "ejdb_test3_9", ejdb_test3_9))) {
|
||||
CU_cleanup_registry();
|
||||
return CU_get_error();
|
||||
}
|
||||
|
||||
+23
-23
@@ -165,11 +165,11 @@ acorn@^7.1.0:
|
||||
integrity sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==
|
||||
|
||||
ajv@^6.10.0, ajv@^6.10.2:
|
||||
version "6.10.2"
|
||||
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52"
|
||||
integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==
|
||||
version "6.12.6"
|
||||
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4"
|
||||
integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==
|
||||
dependencies:
|
||||
fast-deep-equal "^2.0.1"
|
||||
fast-deep-equal "^3.1.1"
|
||||
fast-json-stable-stringify "^2.0.0"
|
||||
json-schema-traverse "^0.4.1"
|
||||
uri-js "^4.2.2"
|
||||
@@ -554,10 +554,10 @@ external-editor@^3.0.3:
|
||||
iconv-lite "^0.4.24"
|
||||
tmp "^0.0.33"
|
||||
|
||||
fast-deep-equal@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49"
|
||||
integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=
|
||||
fast-deep-equal@^3.1.1:
|
||||
version "3.1.3"
|
||||
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
|
||||
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
|
||||
|
||||
fast-diff@^1.1.1:
|
||||
version "1.2.0"
|
||||
@@ -565,9 +565,9 @@ fast-diff@^1.1.1:
|
||||
integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==
|
||||
|
||||
fast-json-stable-stringify@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2"
|
||||
integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I=
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
|
||||
integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==
|
||||
|
||||
fast-levenshtein@~2.0.6:
|
||||
version "2.0.6"
|
||||
@@ -618,9 +618,9 @@ functional-red-black-tree@^1.0.1:
|
||||
integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=
|
||||
|
||||
glob-parent@^5.0.0:
|
||||
version "5.1.0"
|
||||
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.0.tgz#5f4c1d1e748d30cd73ad2944b3577a81b081e8c2"
|
||||
integrity sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==
|
||||
version "5.1.2"
|
||||
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
|
||||
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
|
||||
dependencies:
|
||||
is-glob "^4.0.1"
|
||||
|
||||
@@ -831,9 +831,9 @@ lodash.unescape@4.0.1:
|
||||
integrity sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=
|
||||
|
||||
lodash@^4.17.10, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15:
|
||||
version "4.17.15"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
|
||||
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
|
||||
version "4.17.21"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
||||
|
||||
loose-envify@^1.4.0:
|
||||
version "1.4.0"
|
||||
@@ -970,9 +970,9 @@ path-key@^2.0.1:
|
||||
integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=
|
||||
|
||||
path-parse@^1.0.6:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
|
||||
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
|
||||
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
|
||||
|
||||
prelude-ls@~1.1.2:
|
||||
version "1.1.2"
|
||||
@@ -1220,9 +1220,9 @@ type-fest@^0.5.2:
|
||||
integrity sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw==
|
||||
|
||||
uri-js@^4.2.2:
|
||||
version "4.2.2"
|
||||
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0"
|
||||
integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==
|
||||
version "4.4.1"
|
||||
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"
|
||||
integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==
|
||||
dependencies:
|
||||
punycode "^2.1.0"
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user