diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d86870..4a8d7bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## v0.16.1 - 2020-01-26 + +* bug fixes: parsing of `?` in query expressions +* deps updates + ## v0.16.0 - 2019-12-05 * internal API refactoring diff --git a/Manifest.toml b/Manifest.toml index 0f3931e..180f272 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -15,10 +15,10 @@ uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82" version = "0.2.0" [[CategoricalArrays]] -deps = ["Compat", "DataAPI", "Future", "JSON", "Missings", "Printf", "Reexport", "Unicode"] -git-tree-sha1 = "4d85a015093760ff23b20f3e25fa195b4cb76794" +deps = ["Compat", "DataAPI", "Future", "JSON", "Missings", "Printf", "Reexport", "Statistics", "Unicode"] +git-tree-sha1 = "23d7324164c89638c18f6d7f90d972fa9c4fa9fb" uuid = "324d7699-5711-5eae-9e2f-1d82baa6b597" -version = "0.7.3" +version = "0.7.7" [[CodeTracking]] deps = ["InteractiveUtils", "UUIDs"] @@ -49,10 +49,10 @@ uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" version = "1.1.0" [[DataFrames]] -deps = ["CategoricalArrays", "Compat", "DataAPI", "InvertedIndices", "IteratorInterfaceExtensions", "Missings", "PooledArrays", "Printf", "REPL", "Reexport", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"] -git-tree-sha1 = "271528230c65a4517522e2968c3deed76b92b998" +deps = ["CategoricalArrays", "Compat", "DataAPI", "Future", "InvertedIndices", "IteratorInterfaceExtensions", "Missings", "PooledArrays", "Printf", "REPL", "Reexport", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"] +git-tree-sha1 = "00136fcd39d503e66ab1b2eab800c47deaf7ca04" uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" -version = "0.19.4" +version = "0.20.0" [[DataStreams]] deps = ["Missings", "WeakRefStrings"] @@ -62,9 +62,9 @@ version = "0.4.2" [[DataStructures]] deps = ["InteractiveUtils", "OrderedCollections"] -git-tree-sha1 = "a1b652fb77ae8ca7ea328fa7ba5aa151036e5c10" +git-tree-sha1 = "b7720de347734f4716d1815b00ce5664ed6bbfd4" uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" -version = "0.17.6" +version = "0.17.9" [[DataValueInterfaces]] git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6" @@ -102,10 +102,10 @@ uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" version = "0.8.1" [[EzXML]] -deps = ["BinaryProvider", "Libdl", "Printf"] -git-tree-sha1 = "469de9cb996a9c03f31905619ff3c33e905711f3" +deps = ["Printf", "XML2_jll"] +git-tree-sha1 = "0fa3b52a04a4e210aeb1626def9c90df3ae65268" uuid = "8f5d6c58-4d21-5cfd-889c-e3ad7ee6a615" -version = "0.9.5" +version = "1.1.0" [[FileWatching]] uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" @@ -142,9 +142,9 @@ version = "0.21.0" [[JuliaInterpreter]] deps = ["CodeTracking", "InteractiveUtils", "Random", "UUIDs"] -git-tree-sha1 = "5bb6a8b09d881c1cbe39bd8135667ed5978168e9" +git-tree-sha1 = "a4f675340a109713f74c47a2b499df06f800c8d0" uuid = "aa1ae85d-cabe-5617-a682-6adf51b2e16a" -version = "0.7.4" +version = "0.7.8" [[LayerDicts]] git-tree-sha1 = "6087ad3521d6278ebe5c27ae55e7bbb15ca312cb" @@ -156,13 +156,19 @@ uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" [[LibPQ]] deps = ["BinaryProvider", "CEnum", "Dates", "Decimals", "DocStringExtensions", "FileWatching", "IterTools", "LayerDicts", "Libdl", "Memento", "OffsetArrays", "Tables", "TimeZones"] -git-tree-sha1 = "9926e5aa60b6eccd09cda2dd6b4f356891827736" +git-tree-sha1 = "68277b29fe9f9e2708f0d0969cdfe36daf4445d6" uuid = "194296ae-ab2e-5f79-8cd4-7183a0a5a0d1" -version = "1.0.5" +version = "1.0.6" [[Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" +[[Libiconv_jll]] +deps = ["Libdl", "Pkg"] +git-tree-sha1 = "48563fe30f00c9d4a4d61891e71df389bf901142" +uuid = "94ce4f54-9a6c-5748-9c1c-f9c7231a4531" +version = "1.16.0+0" + [[LinearAlgebra]] deps = ["Libdl"] uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" @@ -193,9 +199,9 @@ uuid = "f28f55f0-a522-5efc-85c2-fe41dfb9b2d9" version = "0.12.1" [[Millboard]] -git-tree-sha1 = "c6d4a61d1b74ba35b1efe5cb025bf852145521e1" +git-tree-sha1 = "e6197b7827b092bbaeeccd7d1b8c7dc9e970308f" uuid = "39ec1447-df44-5f4c-beaa-866f30b4d3b2" -version = "0.2.1" +version = "0.2.4" [[Missings]] deps = ["DataAPI"] @@ -218,9 +224,9 @@ uuid = "39abe10b-433b-5dbd-92d4-e302a9df00cd" version = "0.7.1" [[OffsetArrays]] -git-tree-sha1 = "1ae707306f6e33dbb37d0742e08828562772b73f" +git-tree-sha1 = "87d0a91efe29352d5caaa271ae3927083c096e33" uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" -version = "0.11.2" +version = "0.11.4" [[OpenSpecFun_jll]] deps = ["Libdl", "Pkg"] @@ -241,13 +247,14 @@ uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" version = "0.3.10" [[Pkg]] -deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"] +deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Test", "UUIDs"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" [[PooledArrays]] -git-tree-sha1 = "6e8c38927cb6e9ae144f7277c753714861b27d14" +deps = ["DataAPI"] +git-tree-sha1 = "b1333d4eced1826e15adbdf01a4ecaccca9d353c" uuid = "2dfb63ee-cc39-5dd5-95bd-886bf059d720" -version = "0.5.2" +version = "0.5.3" [[Printf]] deps = ["Unicode"] @@ -269,18 +276,18 @@ version = "0.2.0" [[Revise]] deps = ["CodeTracking", "Distributed", "FileWatching", "JuliaInterpreter", "LibGit2", "LoweredCodeUtils", "OrderedCollections", "Pkg", "REPL", "UUIDs", "Unicode"] -git-tree-sha1 = "855751b1fc9337d8cbe1e6d80ab6aa948a004a7e" +git-tree-sha1 = "2ecbd19f31a934b035bfc38036d5f7ac575d0878" uuid = "295af30f-e4ad-537b-8983-00126c2a3abe" -version = "2.3.2" +version = "2.5.0" [[SHA]] uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" [[SQLite]] deps = ["BinaryProvider", "DataFrames", "Dates", "Libdl", "Random", "Serialization", "Tables", "Test", "WeakRefStrings"] -git-tree-sha1 = "0b4a56ae5df77c6b725cd22e4734ea137f883c7a" +git-tree-sha1 = "5c53dd3d239c327812cba66b110c4789e87942c8" uuid = "0aa819cd-b072-5ff4-a722-6bc24af294d9" -version = "0.8.2" +version = "0.9.0" [[Serialization]] uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" @@ -304,9 +311,9 @@ uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [[SpecialFunctions]] deps = ["OpenSpecFun_jll"] -git-tree-sha1 = "268052ee908b2c086cc0011f528694f02f3e2408" +git-tree-sha1 = "e19b98acb182567bcb7b75bb5d9eedf3a3b5ec6c" uuid = "276daf66-3868-5448-9aa4-cd146d93841b" -version = "0.9.0" +version = "0.10.0" [[Statistics]] deps = ["LinearAlgebra", "SparseArrays"] @@ -336,9 +343,9 @@ uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [[TimeZones]] deps = ["Dates", "EzXML", "Mocking", "Printf", "Serialization", "Unicode"] -git-tree-sha1 = "29c7ae3f50f291358043e21db47b3e1a516df891" +git-tree-sha1 = "24a7474411886cede89529f9b848989b783d954e" uuid = "f269a46b-ccf7-5d73-abea-4c690281aa53" -version = "0.10.3" +version = "0.10.5" [[UUIDs]] deps = ["Random", "SHA"] @@ -348,13 +355,25 @@ uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" [[WeakRefStrings]] -deps = ["Random", "Test"] -git-tree-sha1 = "9a0bb82eede528debe631b642eeb48a631a69bc2" +deps = ["DataAPI", "Random", "Test"] +git-tree-sha1 = "28807f85197eaad3cbd2330386fac1dcb9e7e11d" uuid = "ea10d353-3f73-51f8-a26c-33c1cb351aa5" -version = "0.6.1" +version = "0.6.2" + +[[XML2_jll]] +deps = ["Libdl", "Libiconv_jll", "Pkg", "Zlib_jll"] +git-tree-sha1 = "ed5603a695aefe3e9e404fc7b052e02cc72cfab6" +uuid = "02c8fc9c-b97f-50b9-bbe4-9be30ff0a78a" +version = "2.9.9+1" [[YAML]] deps = ["Codecs", "Compat"] git-tree-sha1 = "3bde77cee95cce0c0b9b18813d85e18e8ed4f415" uuid = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6" version = "0.3.2" + +[[Zlib_jll]] +deps = ["Libdl", "Pkg"] +git-tree-sha1 = "5618a43055eb09377edca21d19d0e99bce24a9c3" +uuid = "83775a58-1f1d-513f-b197-d71354ab007a" +version = "1.2.11+7" diff --git a/Project.toml b/Project.toml index 97f0bc4..f7e71f2 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SearchLight" uuid = "340e8cb6-72eb-11e8-37ce-c97ebeb32050" authors = ["Adrian Salceanu "] -version = "0.16.0" +version = "0.16.1" [deps] Crayons = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f" @@ -25,7 +25,7 @@ YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6" [compat] Crayons = "4" -DataFrames = "0.19" +DataFrames = "0.20" DataStreams = "0.4" JSON = "0.21" LibPQ = "1" @@ -35,6 +35,6 @@ MySQL = "0.7" OrderedCollections = "1" Reexport = "0.2" Revise = "2" -SQLite = "0.8" +SQLite = "0.9" YAML = "0.3" julia = "1" diff --git a/src/model_types.jl b/src/model_types.jl index 1409131..ac7f6d7 100644 --- a/src/model_types.jl +++ b/src/model_types.jl @@ -306,18 +306,22 @@ struct SQLWhereExpression <: SQLType sql_expression::String values::Vector{SQLInput} condition::String +end - function SQLWhereExpression(sql_expression::String, values::Vector{SQLInput}) - condition = "AND" - parts = split(sql_expression, " ") - if in(parts[1], ["AND", "OR", "and", "or"]) - condition = parts |> first |> uppercase - sql_expression = parts[2:end] |> strip - end +const QUESTION_MARK_REPLACEMENT = "&QM;" + +function SQLWhereExpression(sql_expression::String, values::Vector{SQLInput}) + condition = "AND" - new(sql_expression, values, condition) + parts = split(sql_expression, " ") + if in(parts[1], ["AND", "OR", "and", "or"]) + condition = parts |> first |> uppercase + sql_expression = parts[2:end] |> strip end + + SQLWhereExpression(sql_expression, [SQLInput(replace(v.value, '?' => QUESTION_MARK_REPLACEMENT)) for v in values], condition) end + SQLWhereExpression(sql_expression::String, values...) = SQLWhereExpression(sql_expression, [values...]) SQLWhereExpression(sql_expression::String) = SQLWhereExpression(sql_expression, SQLInput[]) SQLWhereExpression(sql_expression::String, values::Dates.Date) = SQLWhereExpression(sql_expression, [SQLInput(string(values))]) @@ -340,6 +344,8 @@ function string(we::SQLWhereExpression) counter += 1 end + result = replace(result, QUESTION_MARK_REPLACEMENT => '?') + string(we.condition, " ", result) end