diff --git a/collector/compile-benchmarks/README.md b/collector/compile-benchmarks/README.md index 3e8164423..37503db07 100644 --- a/collector/compile-benchmarks/README.md +++ b/collector/compile-benchmarks/README.md @@ -25,7 +25,6 @@ They mostly consist of real-world crates. - **cranelift-codegen-0.82.1**: The largest crate from a code generator. Used by wasmtime. Stresses obligation processing. - **cranelift-codegen-0.119.0**: The largest crate from a code generator. Used by wasmtime. Stresses obligation processing. -- **diesel-1.4.8**: A type-safe SQL query builder. Utilizes the type system to ensure a lot of invariants. Stresses anything related to resolving trait bounds, by having a lot of trait impls for a large number of different types. - **diesel-2.2:10**: A type-safe SQL query builder. Utilizes the type system to ensure a lot of invariants. Stresses anything related to resolving trait bounds, by having a lot of trait impls for a large number of different types. - **exa-0.10.1**: An `ls` replacement. A widely-used utility, and a binary crate. - **eza-0.21.2**: An `ls` replacement. A widely-used utility, and a binary crate. Fork of `exa`. diff --git a/collector/compile-benchmarks/REUSE.toml b/collector/compile-benchmarks/REUSE.toml index bc9a75cca..1560ecc6d 100644 --- a/collector/compile-benchmarks/REUSE.toml +++ b/collector/compile-benchmarks/REUSE.toml @@ -72,11 +72,6 @@ path = "derive/**" SPDX-FileCopyrightText = "The Rust Project Developers (see https://thanks.rust-lang.org)" SPDX-License-Identifier = "MIT" -[[annotations]] -path = "diesel-1.4.8/**" -SPDX-FileCopyrightText = "diesel contributors" -SPDX-License-Identifier = "MIT OR Apache-2.0" - [[annotations]] path = "diesel-2.2.10/**" SPDX-FileCopyrightText = "diesel contributors" diff --git a/collector/compile-benchmarks/diesel-1.4.8/.cargo_vcs_info.json b/collector/compile-benchmarks/diesel-1.4.8/.cargo_vcs_info.json deleted file mode 100644 index cfd256027..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/.cargo_vcs_info.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "git": { - "sha1": "09f8bcd78e3fb634ed69c66f46695b821a5b3822" - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/0-println.patch b/collector/compile-benchmarks/diesel-1.4.8/0-println.patch deleted file mode 100644 index b9b9dc0f6..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/0-println.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/src/query_dsl/mod.rs b/src/query_dsl/mod.rs -index 68c1cf74..1dcd513d 100644 ---- a/src/query_dsl/mod.rs -+++ b/src/query_dsl/mod.rs -@@ -112,6 +112,7 @@ pub trait QueryDsl: Sized { - where - Self: methods::DistinctDsl, - { -+ println!("testing"); - methods::DistinctDsl::distinct(self) - } - diff --git a/collector/compile-benchmarks/diesel-1.4.8/Cargo.lock b/collector/compile-benchmarks/diesel-1.4.8/Cargo.lock deleted file mode 100644 index 77f4de563..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/Cargo.lock +++ /dev/null @@ -1,837 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "addr2line" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "aho-corasick" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66" -dependencies = [ - "memchr 0.1.11", -] - -[[package]] -name = "aho-corasick" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5" -dependencies = [ - "memchr 2.4.1", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e121dee8023ce33ab248d9ce1493df03c3b38a659b240096fcbd7048ff9c31f" -dependencies = [ - "addr2line", - "cc", - "cfg-if 1.0.0", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "bigdecimal" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1374191e2dd25f9ae02e3aa95041ed5d747fc77b3c102b49fe2dd9a8117a6244" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "cc" -version = "1.0.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" -dependencies = [ - "libc", - "num-integer", - "num-traits", - "time", - "winapi 0.3.9", -] - -[[package]] -name = "derive-error-chain" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c9ca9ade651388daad7c993f005d0d20c4f6fe78c1cdc93e95f161c6f5ede4a" -dependencies = [ - "quote 0.3.15", - "syn 0.11.11", -] - -[[package]] -name = "diesel" -version = "1.4.8" -dependencies = [ - "bigdecimal", - "bitflags", - "byteorder", - "cfg-if 0.1.10", - "chrono", - "diesel_derives", - "dotenv", - "ipnetwork", - "libc", - "libsqlite3-sys", - "mysqlclient-sys", - "num-bigint", - "num-integer", - "num-traits", - "pq-sys", - "quickcheck", - "r2d2", - "serde_json", - "tempdir", - "time", - "url", - "uuid 0.6.5", - "uuid 0.8.2", -] - -[[package]] -name = "diesel_derives" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3" -dependencies = [ - "proc-macro2", - "quote 1.0.16", - "syn 1.0.89", -] - -[[package]] -name = "dotenv" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f0e2bb24d163428d8031d3ebd2d2bd903ad933205a97d0f18c7c1aade380f3" -dependencies = [ - "derive-error-chain", - "error-chain", - "regex 0.2.11", -] - -[[package]] -name = "env_logger" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15abd780e45b3ea4f76b4e9a26ff4843258dd8a3eed2775a0e7368c2e7936c2f" -dependencies = [ - "log 0.3.9", - "regex 0.1.80", -] - -[[package]] -name = "error-chain" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9435d864e017c3c6afeac1654189b06cdb491cf2ff73dbf0d73b0f292f42ff8" -dependencies = [ - "backtrace", -] - -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - -[[package]] -name = "gimli" -version = "0.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" - -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "ipnetwork" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4088d739b183546b239688ddbc79891831df421773df95e236daf7867866d355" -dependencies = [ - "serde", -] - -[[package]] -name = "itoa" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" - -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.121" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" - -[[package]] -name = "libsqlite3-sys" -version = "0.22.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290b64917f8b0cb885d9de0f9959fe1f775d7fa12f1da2db9001c1c8ab60f89d" -dependencies = [ - "pkg-config", - "vcpkg", -] - -[[package]] -name = "lock_api" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" -dependencies = [ - "log 0.4.16", -] - -[[package]] -name = "log" -version = "0.4.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "matches" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" - -[[package]] -name = "memchr" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" -dependencies = [ - "libc", -] - -[[package]] -name = "memchr" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" - -[[package]] -name = "miniz_oxide" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" -dependencies = [ - "adler", - "autocfg", -] - -[[package]] -name = "mysqlclient-sys" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61b381528ba293005c42a409dd73d034508e273bf90481f17ec2e964a6e969b" -dependencies = [ - "pkg-config", - "vcpkg", -] - -[[package]] -name = "num-bigint" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-integer" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" -dependencies = [ - "autocfg", -] - -[[package]] -name = "object" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" -dependencies = [ - "memchr 2.4.1", -] - -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" -dependencies = [ - "cfg-if 1.0.0", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi 0.3.9", -] - -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" - -[[package]] -name = "pkg-config" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" - -[[package]] -name = "pq-sys" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac25eee5a0582f45a67e837e350d784e7003bd29a5f460796772061ca49ffda" -dependencies = [ - "vcpkg", -] - -[[package]] -name = "proc-macro2" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" -dependencies = [ - "unicode-xid 0.2.2", -] - -[[package]] -name = "quickcheck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c2411d418cea2364325b18a205664f9ef8252e06b2e911db97c0b0d98b1406" -dependencies = [ - "env_logger", - "log 0.3.9", - "rand 0.3.23", -] - -[[package]] -name = "quote" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" - -[[package]] -name = "quote" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4af2ec4714533fcdf07e886f17025ace8b997b9ce51204ee69b6da831c3da57" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r2d2" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545c5bc2b880973c9c10e4067418407a0ccaa3091781d1671d46eb35107cb26f" -dependencies = [ - "log 0.4.16", - "parking_lot", - "scheduled-thread-pool", -] - -[[package]] -name = "rand" -version = "0.3.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" -dependencies = [ - "libc", - "rand 0.4.6", -] - -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -dependencies = [ - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "rdrand", - "winapi 0.3.9", -] - -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "redox_syscall" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8380fe0152551244f0747b1bf41737e0f8a74f97a14ccefd1148187271634f3c" -dependencies = [ - "bitflags", -] - -[[package]] -name = "regex" -version = "0.1.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f" -dependencies = [ - "aho-corasick 0.5.3", - "memchr 0.1.11", - "regex-syntax 0.3.9", - "thread_local 0.2.7", - "utf8-ranges 0.1.3", -] - -[[package]] -name = "regex" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384" -dependencies = [ - "aho-corasick 0.6.10", - "memchr 2.4.1", - "regex-syntax 0.5.6", - "thread_local 0.3.6", - "utf8-ranges 1.0.4", -] - -[[package]] -name = "regex-syntax" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957" - -[[package]] -name = "regex-syntax" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7" -dependencies = [ - "ucd-util", -] - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" - -[[package]] -name = "ryu" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" - -[[package]] -name = "scheduled-thread-pool" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f74fd1204073fa02d5d5d68bec8021be4c38690b61264b2fdb48083d0e7d7" -dependencies = [ - "parking_lot", -] - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "serde" -version = "1.0.136" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" - -[[package]] -name = "serde_json" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "smallvec" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" - -[[package]] -name = "syn" -version = "0.11.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -dependencies = [ - "quote 0.3.15", - "synom", - "unicode-xid 0.0.4", -] - -[[package]] -name = "syn" -version = "1.0.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea297be220d52398dcc07ce15a209fce436d361735ac1db700cab3b6cdfb9f54" -dependencies = [ - "proc-macro2", - "quote 1.0.16", - "unicode-xid 0.2.2", -] - -[[package]] -name = "synom" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" -dependencies = [ - "unicode-xid 0.0.4", -] - -[[package]] -name = "tempdir" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" -dependencies = [ - "rand 0.4.6", - "remove_dir_all", -] - -[[package]] -name = "thread-id" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" -dependencies = [ - "kernel32-sys", - "libc", -] - -[[package]] -name = "thread_local" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5" -dependencies = [ - "thread-id", -] - -[[package]] -name = "thread_local" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "time" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" -dependencies = [ - "libc", - "wasi", - "winapi 0.3.9", -] - -[[package]] -name = "tinyvec" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" - -[[package]] -name = "ucd-util" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85f514e095d348c279b1e5cd76795082cf15bd59b93207832abe0b1d8fed236" - -[[package]] -name = "unicode-bidi" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" - -[[package]] -name = "unicode-normalization" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-xid" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" - -[[package]] -name = "unicode-xid" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" - -[[package]] -name = "url" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -dependencies = [ - "idna", - "matches", - "percent-encoding", -] - -[[package]] -name = "utf8-ranges" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" - -[[package]] -name = "utf8-ranges" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba" - -[[package]] -name = "uuid" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1436e58182935dcd9ce0add9ea0b558e8a87befe01c1a301e6020aeb0876363" -dependencies = [ - "cfg-if 0.1.10", -] - -[[package]] -name = "uuid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/collector/compile-benchmarks/diesel-1.4.8/Cargo.toml b/collector/compile-benchmarks/diesel-1.4.8/Cargo.toml deleted file mode 100644 index 874e8fb44..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/Cargo.toml +++ /dev/null @@ -1,140 +0,0 @@ -# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO -# -# When uploading crates to the registry Cargo will automatically -# "normalize" Cargo.toml files for maximal compatibility -# with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies -# -# If you believe there's an error in this file please file an -# issue against the rust-lang/cargo repository. If you're -# editing this file be aware that the upstream Cargo.toml -# will likely look very different (and much more reasonable) - -[package] -name = "diesel" -version = "1.4.8" -authors = ["Sean Griffin "] -description = "A safe, extensible ORM and Query Builder for PostgreSQL, SQLite, and MySQL" -homepage = "https://diesel.rs" -documentation = "https://docs.rs/diesel/" -readme = "README.md" -keywords = ["orm", "database", "blockchain", "sql"] -categories = ["database"] -license = "MIT OR Apache-2.0" -repository = "https://github.com/diesel-rs/diesel" -[package.metadata.docs.rs] -features = ["postgres", "mysql", "sqlite", "extras"] -no-default-features = true -[dependencies.bigdecimal] -version = ">= 0.0.10, < 0.2.0" -optional = true - -[dependencies.bitflags] -version = "1.0" -optional = true - -[dependencies.byteorder] -version = "1.0" - -[dependencies.chrono] -version = "0.4" -optional = true - -[dependencies.diesel_derives] -version = "~1.4.0" - -[dependencies.ipnetwork] -version = ">=0.12.2, <0.19.0" -optional = true - -[dependencies.libc] -version = "0.2.0" -optional = true - -[dependencies.libsqlite3-sys] -version = ">=0.8.0, <0.23.0" -features = ["min_sqlite_version_3_7_16"] -optional = true - -[dependencies.mysqlclient-sys] -version = ">=0.1.0, <0.3.0" -optional = true - -[dependencies.num-bigint] -version = ">=0.1.41, <0.3" -optional = true - -[dependencies.num-integer] -version = ">=0.1.33, <0.3" -optional = true - -[dependencies.num-traits] -version = ">=0.1.37, <0.3" -optional = true - -[dependencies.pq-sys] -version = ">=0.3.0, <0.5.0" -optional = true - -[dependencies.quickcheck] -version = "0.4" -optional = true - -[dependencies.r2d2] -version = ">= 0.8, < 0.9" -optional = true - -[dependencies.serde_json] -version = ">=0.8.0, <2.0" -optional = true - -[dependencies.time] -version = "0.1" -optional = true - -[dependencies.url] -version = "1.4.0" -optional = true - -[dependencies.uuid] -version = ">=0.2.0, <0.7.0" -features = ["use_std"] -optional = true - -[dependencies.uuidv07] -version = ">=0.7.0, <0.9.0" -optional = true -package = "uuid" -[dev-dependencies.cfg-if] -version = "0.1.0" - -[dev-dependencies.dotenv] -version = ">=0.8, <0.11" - -[dev-dependencies.quickcheck] -version = "0.4" - -[dev-dependencies.tempdir] -version = "^0.3.4" - -[features] -128-column-tables = ["64-column-tables"] -32-column-tables = [] -64-column-tables = ["32-column-tables"] -default = ["with-deprecated", "32-column-tables"] -deprecated-time = ["time"] -extras = ["chrono", "serde_json", "uuid", "deprecated-time", "network-address", "numeric", "r2d2"] -huge-tables = ["64-column-tables"] -large-tables = ["32-column-tables"] -mysql = ["mysqlclient-sys", "url", "diesel_derives/mysql"] -network-address = ["ipnetwork", "libc"] -numeric = ["num-bigint", "bigdecimal", "num-traits", "num-integer"] -postgres = ["pq-sys", "bitflags", "diesel_derives/postgres"] -sqlite = ["libsqlite3-sys", "diesel_derives/sqlite"] -unstable = ["diesel_derives/nightly"] -with-deprecated = [] -x128-column-tables = ["128-column-tables"] -x32-column-tables = ["32-column-tables"] -x64-column-tables = ["64-column-tables"] - -[workspace] diff --git a/collector/compile-benchmarks/diesel-1.4.8/Cargo.toml.orig b/collector/compile-benchmarks/diesel-1.4.8/Cargo.toml.orig deleted file mode 100644 index f9d6c73b7..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/Cargo.toml.orig +++ /dev/null @@ -1,64 +0,0 @@ -[package] -name = "diesel" -version = "1.4.8" -authors = ["Sean Griffin "] -license = "MIT OR Apache-2.0" -description = "A safe, extensible ORM and Query Builder for PostgreSQL, SQLite, and MySQL" -readme = "README.md" -documentation = "https://docs.rs/diesel/" -homepage = "https://diesel.rs" -repository = "https://github.com/diesel-rs/diesel" -keywords = ["orm", "database", "blockchain", "sql"] -categories = ["database"] - -[dependencies] -byteorder = "1.0" -diesel_derives = "~1.4.0" -chrono = { version = "0.4", optional = true } -libc = { version = "0.2.0", optional = true } -libsqlite3-sys = { version = ">=0.8.0, <0.23.0", optional = true, features = ["min_sqlite_version_3_7_16"] } -mysqlclient-sys = { version = ">=0.1.0, <0.3.0", optional = true } -pq-sys = { version = ">=0.3.0, <0.5.0", optional = true } -quickcheck = { version = "0.4", optional = true } -serde_json = { version = ">=0.8.0, <2.0", optional = true } -time = { version = "0.1", optional = true } -url = { version = "1.4.0", optional = true } -uuid = { version = ">=0.2.0, <0.7.0", optional = true, features = ["use_std"] } -uuidv07 = { version = ">=0.7.0, <0.9.0", optional = true, package = "uuid"} -ipnetwork = { version = ">=0.12.2, <0.19.0", optional = true } -num-bigint = { version = ">=0.1.41, <0.3", optional = true } -num-traits = { version = ">=0.1.37, <0.3", optional = true } -num-integer = { version = ">=0.1.33, <0.3", optional = true } -bigdecimal = { version = ">= 0.0.10, < 0.2.0", optional = true } -bitflags = { version = "1.0", optional = true } -r2d2 = { version = ">= 0.8, < 0.9", optional = true } - -[dev-dependencies] -cfg-if = "0.1.0" -dotenv = ">=0.8, <0.11" -quickcheck = "0.4" -tempdir = "^0.3.4" - -[features] -default = ["with-deprecated", "32-column-tables"] -extras = ["chrono", "serde_json", "uuid", "deprecated-time", "network-address", "numeric", "r2d2"] -unstable = ["diesel_derives/nightly"] -large-tables = ["32-column-tables"] -huge-tables = ["64-column-tables"] -x32-column-tables = ["32-column-tables"] -32-column-tables = [] -x64-column-tables = ["64-column-tables"] -64-column-tables = ["32-column-tables"] -x128-column-tables = ["128-column-tables"] -128-column-tables = ["64-column-tables"] -postgres = ["pq-sys", "bitflags", "diesel_derives/postgres"] -sqlite = ["libsqlite3-sys", "diesel_derives/sqlite"] -mysql = ["mysqlclient-sys", "url", "diesel_derives/mysql"] -with-deprecated = [] -deprecated-time = ["time"] -network-address = ["ipnetwork", "libc"] -numeric = ["num-bigint", "bigdecimal", "num-traits", "num-integer"] - -[package.metadata.docs.rs] -features = ["postgres", "mysql", "sqlite", "extras"] -no-default-features = true diff --git a/collector/compile-benchmarks/diesel-1.4.8/LICENSE-APACHE b/collector/compile-benchmarks/diesel-1.4.8/LICENSE-APACHE deleted file mode 100644 index 164de5d86..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/LICENSE-APACHE +++ /dev/null @@ -1,190 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright 2015-2018 Sean Griffin - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/collector/compile-benchmarks/diesel-1.4.8/LICENSE-MIT b/collector/compile-benchmarks/diesel-1.4.8/LICENSE-MIT deleted file mode 100644 index 4e932e5cc..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/LICENSE-MIT +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015-2018 Sean Griffin - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE 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. diff --git a/collector/compile-benchmarks/diesel-1.4.8/README.md b/collector/compile-benchmarks/diesel-1.4.8/README.md deleted file mode 100644 index 0e150e8d3..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/README.md +++ /dev/null @@ -1,9 +0,0 @@ -[![Diesel](https://diesel.rs/assets/images/diesel_logo_stacked_black.png)](https://diesel.rs) - -# Diesel - A safe, extensible ORM and Query Builder for Rust - -Diesel is the most productive way to interact with databases in Rust because of its safe and composable abstractions over queries. - -## Getting Started - -This is the Readme of the main crate. You can find [an extensive Getting Started tutorial](https://diesel.rs/guides/getting-started) and more information on our [website](https://diesel.rs). diff --git a/collector/compile-benchmarks/diesel-1.4.8/perf-config.json b/collector/compile-benchmarks/diesel-1.4.8/perf-config.json deleted file mode 100644 index f5204c638..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/perf-config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "category": "primary", - "artifact": "library" -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/associations/belongs_to.rs b/collector/compile-benchmarks/diesel-1.4.8/src/associations/belongs_to.rs deleted file mode 100644 index f89133658..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/associations/belongs_to.rs +++ /dev/null @@ -1,176 +0,0 @@ -use super::{HasTable, Identifiable}; -use dsl::{Eq, EqAny, Filter, FindBy}; -use expression::array_comparison::AsInExpression; -use expression::AsExpression; -use prelude::*; -use query_dsl::methods::FilterDsl; - -use std::borrow::Borrow; -use std::hash::Hash; - -/// Indicates that a type belongs to `Parent` -/// -/// Specifically, this means that this struct has fields -/// which correspond to the primary key of `Parent`. -/// This implies that a foreign key relationship exists on the tables. -/// -/// This trait is not capable of supporting composite foreign keys -pub trait BelongsTo { - /// The foreign key of this struct - type ForeignKey: Hash + ::std::cmp::Eq; - /// The database column representing the foreign key - /// of the table this struct represents - type ForeignKeyColumn: Column; - - /// Returns the foreign key for `self` - fn foreign_key(&self) -> Option<&Self::ForeignKey>; - /// Returns the foreign key column of this struct's table - fn foreign_key_column() -> Self::ForeignKeyColumn; -} - -/// The `grouped_by` function groups records by their parent. -/// -/// `grouped_by` is called on a `Vec` with a `&[Parent]`. -/// The return value will be `Vec>` indexed to match their parent. -/// Or to put it another way, the returned data can be passed to `zip`, -/// and it will be combined with its parent. -/// This function does not generate a `GROUP BY` SQL statement, -/// as it operates on data structures already loaded from the database -/// -/// **Child** refers to the "many" part of a "one to many" relationship. It "belongs to" its parent -/// **Parent** refers to the "one" part of a "one to many" relationship and can "have many" children. -/// The child always has a foreign key, which refers to its parent's primary key. -/// In the following relationship, User has many Posts, -/// so User is the parent and Posts are children. -/// -/// # Example -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # use schema::{posts, users}; -/// # -/// # #[derive(Identifiable, Queryable, PartialEq, Debug)] -/// # pub struct User { -/// # id: i32, -/// # name: String, -/// # } -/// # -/// # #[derive(Debug, PartialEq)] -/// # #[derive(Identifiable, Queryable, Associations)] -/// # #[belongs_to(User)] -/// # pub struct Post { -/// # id: i32, -/// # user_id: i32, -/// # title: String, -/// # } -/// # -/// # fn main() { -/// # run_test(); -/// # } -/// # -/// # fn run_test() -> QueryResult<()> { -/// # let connection = establish_connection(); -/// let users = users::table.load::(&connection)?; -/// let posts = Post::belonging_to(&users) -/// .load::(&connection)? -/// .grouped_by(&users); -/// let data = users.into_iter().zip(posts).collect::>(); -/// -/// let expected_data = vec![ -/// ( -/// User { id: 1, name: "Sean".into() }, -/// vec![ -/// Post { id: 1, user_id: 1, title: "My first post".into() }, -/// Post { id: 2, user_id: 1, title: "About Rust".into() }, -/// ], -/// ), -/// ( -/// User { id: 2, name: "Tess".into() }, -/// vec![ -/// Post { id: 3, user_id: 2, title: "My first post too".into() }, -/// ], -/// ), -/// ]; -/// -/// assert_eq!(expected_data, data); -/// # Ok(()) -/// # } -/// ``` -/// -/// See [the module documentation] for more examples -/// -/// [the module documentation]: index.html -pub trait GroupedBy<'a, Parent>: IntoIterator + Sized { - /// See the trait documentation. - fn grouped_by(self, parents: &'a [Parent]) -> Vec>; -} - -type Id = ::Id; - -impl<'a, Parent: 'a, Child, Iter> GroupedBy<'a, Parent> for Iter -where - Iter: IntoIterator, - Child: BelongsTo, - &'a Parent: Identifiable, - Id<&'a Parent>: Borrow, -{ - fn grouped_by(self, parents: &'a [Parent]) -> Vec> { - use std::collections::HashMap; - - let id_indices: HashMap<_, _> = parents - .iter() - .enumerate() - .map(|(i, u)| (u.id(), i)) - .collect(); - let mut result = parents.iter().map(|_| Vec::new()).collect::>(); - for child in self { - if let Some(index) = child.foreign_key().map(|i| id_indices[i]) { - result[index].push(child); - } - } - result - } -} - -impl<'a, Parent, Child> BelongingToDsl<&'a Parent> for Child -where - &'a Parent: Identifiable, - Child: HasTable + BelongsTo, - Id<&'a Parent>: AsExpression<::SqlType>, - Child::Table: FilterDsl>>, - Child::ForeignKeyColumn: ExpressionMethods, -{ - type Output = FindBy>; - - fn belonging_to(parent: &'a Parent) -> Self::Output { - FilterDsl::filter(Child::table(), Child::foreign_key_column().eq(parent.id())) - } -} - -impl<'a, Parent, Child> BelongingToDsl<&'a [Parent]> for Child -where - &'a Parent: Identifiable, - Child: HasTable + BelongsTo, - Vec>: AsInExpression<::SqlType>, - ::Table: FilterDsl>>>, - Child::ForeignKeyColumn: ExpressionMethods, -{ - type Output = Filter>>>; - - fn belonging_to(parents: &'a [Parent]) -> Self::Output { - let ids = parents.iter().map(Identifiable::id).collect::>(); - FilterDsl::filter(Child::table(), Child::foreign_key_column().eq_any(ids)) - } -} - -impl<'a, Parent, Child> BelongingToDsl<&'a Vec> for Child -where - Child: BelongingToDsl<&'a [Parent]>, -{ - type Output = Child::Output; - - fn belonging_to(parents: &'a Vec) -> Self::Output { - Self::belonging_to(&**parents) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/associations/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/associations/mod.rs deleted file mode 100644 index 0448cbff6..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/associations/mod.rs +++ /dev/null @@ -1,429 +0,0 @@ -//! Traits related to relationships between multiple tables. -//! -//! Associations in Diesel are always child-to-parent. -//! You can declare an association between two records with `#[belongs_to]`. -//! Unlike other ORMs, Diesel has no concept of `#[has_many`] -//! -//! ```rust -//! # #[macro_use] extern crate diesel; -//! # include!("../doctest_setup.rs"); -//! use schema::{posts, users}; -//! -//! #[derive(Identifiable, Queryable, PartialEq, Debug)] -//! #[table_name = "users"] -//! pub struct User { -//! id: i32, -//! name: String, -//! } -//! -//! #[derive(Identifiable, Queryable, Associations, PartialEq, Debug)] -//! #[belongs_to(User)] -//! #[table_name = "posts"] -//! pub struct Post { -//! id: i32, -//! user_id: i32, -//! title: String, -//! } -//! -//! # fn main() { -//! # run_test().unwrap(); -//! # } -//! # -//! # fn run_test() -> QueryResult<()> { -//! # let connection = establish_connection(); -//! # use users::dsl::*; -//! let user = users.find(2).get_result::(&connection)?; -//! let users_post = Post::belonging_to(&user) -//! .first(&connection)?; -//! let expected = Post { id: 3, user_id: 2, title: "My first post too".into() }; -//! assert_eq!(expected, users_post); -//! # Ok(()) -//! # } -//! ``` -//! -//! Note that in addition to the `#[belongs_to]` annotation, we also need to -//! `#[derive(Associations)]` -//! -//! `#[belongs_to]` is given the name of the struct that represents the parent. -//! Both the parent and child must implement [`Identifiable`]. -//! The struct given to `#[belongs_to]` must be in scope, -//! so you will need `use some_module::User` if `User` is defined in another module. -//! -//! If the parent record is generic over lifetimes, they can be written as `'_`. -//! You will also need to wrap the type in quotes until -//! `unrestricted_attribute_tokens` is stable. -//! -//! ```rust -//! # #[macro_use] extern crate diesel; -//! # include!("../doctest_setup.rs"); -//! # use schema::{posts, users}; -//! # use std::borrow::Cow; -//! # -//! #[derive(Identifiable)] -//! #[table_name = "users"] -//! pub struct User<'a> { -//! id: i32, -//! name: Cow<'a, str>, -//! } -//! -//! #[derive(Associations)] -//! #[belongs_to(parent = "User<'_>")] -//! #[table_name = "posts"] -//! pub struct Post { -//! id: i32, -//! user_id: i32, -//! title: String, -//! } -//! # -//! # fn main() {} -//! ``` -//! -//! [`Identifiable`]: trait.Identifiable.html -//! -//! By default, Diesel assumes that your foreign keys will follow the convention `table_name_id`. -//! If your foreign key has a different name, -//! you can provide the `foreign_key` argument to `#[belongs_to]`. -//! For example, `#[belongs_to(Foo, foreign_key = "mykey")]`. -//! -//! Associated data is typically loaded in multiple queries (one query per table). -//! This is usually more efficient than using a join, -//! especially if 3 or more tables are involved. -//! For most datasets, -//! using a join to load in a single query transmits so much duplicate data -//! that it costs more time than the extra round trip would have. -//! -//! You can load the children for one or more parents using -//! [`belonging_to`] -//! -//! [`belonging_to`]: ../query_dsl/trait.BelongingToDsl.html#tymethod.belonging_to -//! -//! ```rust -//! # #[macro_use] extern crate diesel; -//! # include!("../doctest_setup.rs"); -//! # use schema::users; -//! # use schema::posts; -//! # -//! # #[derive(Debug, PartialEq, Identifiable, Queryable)] -//! # pub struct User { -//! # id: i32, -//! # name: String, -//! # } -//! # -//! # #[derive(Debug, PartialEq, Identifiable, Queryable, Associations)] -//! # #[belongs_to(User)] -//! # pub struct Post { -//! # id: i32, -//! # user_id: i32, -//! # title: String, -//! # } -//! # -//! # fn main() { -//! # use users::dsl::*; -//! # let connection = establish_connection(); -//! # -//! let user = users.find(1).first::(&connection).expect("Error loading user"); -//! let post_list = Post::belonging_to(&user) -//! .load::(&connection) -//! .expect("Error loading posts"); -//! let expected = vec![ -//! Post { id: 1, user_id: 1, title: "My first post".to_string() }, -//! Post { id: 2, user_id: 1, title: "About Rust".to_string() }, -//! ]; -//! -//! assert_eq!(post_list, expected); -//! # } -//! ``` -//! -//! If you're coming from other ORMs, you'll notice that this design is quite different from most. -//! There you would have an instance method on the parent, or have the children stored somewhere on -//! the posts. This design leads to many problems, including [N+1 query -//! bugs][load-your-entire-database-into-memory-lol], and runtime errors when accessing an -//! association that isn't there. -//! -//! [load-your-entire-database-into-memory-lol]: https://stackoverflow.com/q/97197/1254484 -//! -//! In Diesel, data and its associations are considered to be separate. If you want to pass around -//! a user and all of its posts, that type is `(User, Vec)`. -//! -//! Next lets look at how to load the children for more than one parent record. -//! [`belonging_to`][belonging-to] can be used to load the data, but we'll also need to group it -//! with its parents. For this we use an additional method [`grouped_by`][grouped-by] -//! -//! [grouped-by]: trait.GroupedBy.html#tymethod.grouped_by -//! -//! ```rust -//! # #[macro_use] extern crate diesel; -//! # include!("../doctest_setup.rs"); -//! # use schema::{posts, users}; -//! # -//! # #[derive(Identifiable, Queryable)] -//! # pub struct User { -//! # id: i32, -//! # name: String, -//! # } -//! # -//! # #[derive(Debug, PartialEq)] -//! # #[derive(Identifiable, Queryable, Associations)] -//! # #[belongs_to(User)] -//! # pub struct Post { -//! # id: i32, -//! # user_id: i32, -//! # title: String, -//! # } -//! # -//! # fn main() { -//! # run_test(); -//! # } -//! # -//! # fn run_test() -> QueryResult<()> { -//! # let connection = establish_connection(); -//! # use users::dsl::*; -//! # use posts::dsl::{posts, title}; -//! let sean = users.filter(name.eq("Sean")).first::(&connection)?; -//! let tess = users.filter(name.eq("Tess")).first::(&connection)?; -//! -//! let seans_posts = Post::belonging_to(&sean) -//! .select(title) -//! .load::(&connection)?; -//! assert_eq!(vec!["My first post", "About Rust"], seans_posts); -//! -//! // A vec or slice can be passed as well -//! let more_posts = Post::belonging_to(&vec![sean, tess]) -//! .select(title) -//! .load::(&connection)?; -//! assert_eq!(vec!["My first post", "About Rust", "My first post too"], more_posts); -//! # Ok(()) -//! # } -//! ``` -//! -//! Typically you will want to group up the children with their parents. -//! In other ORMs, this is often called a `has_many` relationship. -//! Diesel provides support for doing this grouping, once the data has been -//! loaded. -//! -//! [`grouped_by`][grouped-by] is called on a `Vec` with a `&[Parent]`. -//! The return value will be `Vec>` indexed to match their parent. -//! Or to put it another way, the returned data can be passed to `zip`, -//! and it will be combined with its parent. -//! -//! ```rust -//! # #[macro_use] extern crate diesel; -//! # include!("../doctest_setup.rs"); -//! # use schema::{posts, users}; -//! # -//! # #[derive(Identifiable, Queryable, PartialEq, Debug)] -//! # pub struct User { -//! # id: i32, -//! # name: String, -//! # } -//! # -//! # #[derive(Debug, PartialEq)] -//! # #[derive(Identifiable, Queryable, Associations)] -//! # #[belongs_to(User)] -//! # pub struct Post { -//! # id: i32, -//! # user_id: i32, -//! # title: String, -//! # } -//! # -//! # fn main() { -//! # run_test(); -//! # } -//! # -//! # fn run_test() -> QueryResult<()> { -//! # let connection = establish_connection(); -//! let users = users::table.load::(&connection)?; -//! let posts = Post::belonging_to(&users) -//! .load::(&connection)? -//! .grouped_by(&users); -//! let data = users.into_iter().zip(posts).collect::>(); -//! -//! let expected_data = vec![ -//! ( -//! User { id: 1, name: "Sean".into() }, -//! vec![ -//! Post { id: 1, user_id: 1, title: "My first post".into() }, -//! Post { id: 2, user_id: 1, title: "About Rust".into() }, -//! ], -//! ), -//! ( -//! User { id: 2, name: "Tess".into() }, -//! vec![ -//! Post { id: 3, user_id: 2, title: "My first post too".into() }, -//! ], -//! ), -//! ]; -//! -//! assert_eq!(expected_data, data); -//! # Ok(()) -//! # } -//! ``` -//! -//! `grouped_by` can be called multiple times -//! if you have multiple children or grandchildren. -//! -//! For example, this code will load some users, -//! all of their posts, -//! and all of the comments on those posts. -//! Explicit type annotations have been added -//! to make each line a bit more clear. -//! -//! ```rust -//! # #[macro_use] extern crate diesel; -//! # include!("../doctest_setup.rs"); -//! # use schema::{users, posts, comments}; -//! # -//! # #[derive(Debug, PartialEq, Identifiable, Queryable)] -//! # pub struct User { -//! # id: i32, -//! # name: String, -//! # } -//! # -//! # #[derive(Debug, PartialEq, Identifiable, Queryable, Associations)] -//! # #[belongs_to(User)] -//! # pub struct Post { -//! # id: i32, -//! # user_id: i32, -//! # title: String, -//! # } -//! # -//! # #[derive(Debug, PartialEq, Identifiable, Queryable, Associations)] -//! # #[belongs_to(Post)] -//! # pub struct Comment { -//! # id: i32, -//! # post_id: i32, -//! # body: String, -//! # } -//! # -//! # fn main() { -//! # let connection = establish_connection(); -//! # -//! let users: Vec = users::table.load::(&connection) -//! .expect("error loading users"); -//! let posts: Vec = Post::belonging_to(&users) -//! .load::(&connection) -//! .expect("error loading posts"); -//! let comments: Vec = Comment::belonging_to(&posts) -//! .load::(&connection) -//! .expect("Error loading comments"); -//! let grouped_comments: Vec> = comments.grouped_by(&posts); -//! let posts_and_comments: Vec)>> = posts -//! .into_iter() -//! .zip(grouped_comments) -//! .grouped_by(&users); -//! let result: Vec<(User, Vec<(Post, Vec)>)> = users -//! .into_iter() -//! .zip(posts_and_comments) -//! .collect(); -//! let expected = vec![ -//! ( -//! User { id: 1, name: "Sean".to_string() }, -//! vec![ -//! ( -//! Post { id: 1, user_id: 1, title: "My first post".to_string() }, -//! vec![ Comment { id: 1, post_id: 1, body: "Great post".to_string() } ] -//! ), -//! ( -//! Post { id: 2, user_id: 1, title: "About Rust".to_string() }, -//! vec![ -//! Comment { id: 2, post_id: 2, body: "Yay! I am learning Rust".to_string() } -//! ] -//! -//! ) -//! ] -//! ), -//! ( -//! User { id: 2, name: "Tess".to_string() }, -//! vec![ -//! ( -//! Post { id: 3, user_id: 2, title: "My first post too".to_string() }, -//! vec![ Comment { id: 3, post_id: 3, body: "I enjoyed your post".to_string() } ] -//! ) -//! ] -//! ) -//! ]; -//! -//! assert_eq!(result, expected); -//! # } -//! ``` -//! -//! And that's it. -//! It may seem odd to have load, group, and zip be explicit separate steps -//! if you are coming from another ORM. -//! However, the goal is to provide simple building blocks which can -//! be used to construct the complex behavior applications need. -mod belongs_to; - -use std::hash::Hash; - -use query_source::Table; - -pub use self::belongs_to::{BelongsTo, GroupedBy}; - -/// This trait indicates that a struct is associated with a single database table. -/// -/// This trait is implemented by structs which implement `Identifiable`, -/// as well as database tables themselves. -pub trait HasTable { - /// The table this type is associated with. - type Table: Table; - - /// Returns the table this type is associated with. - fn table() -> Self::Table; -} - -impl<'a, T: HasTable> HasTable for &'a T { - type Table = T::Table; - - fn table() -> Self::Table { - T::table() - } -} - -/// This trait indicates that a struct represents a single row in a database table. -/// -/// This must be implemented to use associations. -/// Additionally, implementing this trait allows you to pass your struct to `update` -/// (`update(&your_struct)` is equivalent to -/// `update(YourStruct::table().find(&your_struct.primary_key())`). -/// -/// This trait is usually implemented on a reference to a struct, -/// not the struct itself. -/// -/// ### Deriving -/// -/// This trait can be automatically derived by adding `#[derive(Identifiable)]` -/// to your struct. -/// By default, the "id" field is assumed to be a single field called `id`. -/// If it's not, you can put `#[primary_key(your_id)]` on your struct. -/// If you have a composite primary key, the syntax is `#[primary_key(id1, id2)]`. -/// -/// By default, `#[derive(Identifiable)]` will assume that your table -/// name is the plural form of your struct name. -/// Diesel uses very simple pluralization rules. -/// It only adds an `s` to the end, and converts `CamelCase` to `snake_case`. -/// If your table name does not follow this convention -/// or the plural form isn't just an `s`, -/// you can specify the table name with `#[table_name = "some_table_name"]`. -/// Our rules for inferring table names is considered public API. -/// It will never change without a major version bump. -pub trait Identifiable: HasTable { - /// The type of this struct's identifier. - /// - /// For single-field primary keys, this is typically `&'a i32`, or `&'a String` - /// For composite primary keys, this is typically `(&'a i32, &'a i32)` - /// or `(&'a String, &'a String)`, etc. - type Id: Hash + Eq; - - /// Returns the identifier for this record. - /// - /// This takes `self` by value, not reference. - /// This is because composite primary keys - /// are typically stored as multiple fields. - /// We could not return `&(String, String)` if each string is a separate field. - /// - /// Because of Rust's rules about specifying lifetimes, - /// this means that `Identifiable` is usually implemented on references - /// so that we have a lifetime to use for `Id`. - fn id(self) -> Self::Id; -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/backend.rs b/collector/compile-benchmarks/diesel-1.4.8/src/backend.rs deleted file mode 100644 index 83460970e..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/backend.rs +++ /dev/null @@ -1,64 +0,0 @@ -//! Types which represent various database backends - -use byteorder::ByteOrder; - -use query_builder::bind_collector::BindCollector; -use query_builder::QueryBuilder; -use sql_types::{self, HasSqlType}; - -/// A database backend -/// -/// This trait represents the concept of a backend (e.g. "MySQL" vs "SQLite"). -/// It is separate from a [`Connection`](../connection/trait.Connection.html) -/// to that backend. -/// One backend may have multiple concrete connection implementations. -/// -/// Implementations of this trait should not assume details about how the -/// connection is implemented. -/// For example, the `Pg` backend does not assume that `libpq` is being used. -/// Implementations of this trait can and should care about details of the wire -/// protocol used to communicated with the database. -pub trait Backend -where - Self: Sized, - Self: HasSqlType, - Self: HasSqlType, - Self: HasSqlType, - Self: HasSqlType, - Self: HasSqlType, - Self: HasSqlType, - Self: HasSqlType, - Self: HasSqlType, - Self: HasSqlType, - Self: HasSqlType, - Self: HasSqlType, -{ - /// The concrete `QueryBuilder` implementation for this backend. - type QueryBuilder: QueryBuilder; - /// The concrete `BindCollector` implementation for this backend. - /// - /// Most backends should use [`RawBytesBindCollector`]. - /// - /// [`RawBytesBindCollector`]: ../query_builder/bind_collector/struct.RawBytesBindCollector.html - type BindCollector: BindCollector; - /// The raw representation of a database value given to `FromSql`. - /// - /// Since most backends transmit data as opaque blobs of bytes, this type - /// is usually `[u8]`. - type RawValue: ?Sized; - /// What byte order is used to transmit integers? - /// - /// This type is only used if `RawValue` is `[u8]`. - type ByteOrder: ByteOrder; -} - -/// Does this backend support `RETURNING` clauses? -pub trait SupportsReturningClause {} -/// Does this backend support the bare `DEFAULT` keyword? -pub trait SupportsDefaultKeyword {} -/// Does this backend use the standard `SAVEPOINT` syntax? -pub trait UsesAnsiSavepointSyntax {} - -#[cfg(feature = "with-deprecated")] -#[deprecated(since = "1.1.0", note = "use `sql_types::TypeMetadata` instead")] -pub use sql_types::TypeMetadata; diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/connection/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/connection/mod.rs deleted file mode 100644 index b16986414..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/connection/mod.rs +++ /dev/null @@ -1,193 +0,0 @@ -//! Types related to database connections - -mod statement_cache; -mod transaction_manager; - -use std::fmt::Debug; - -use backend::Backend; -use deserialize::{Queryable, QueryableByName}; -use query_builder::{AsQuery, QueryFragment, QueryId}; -use result::*; -use sql_types::HasSqlType; - -#[doc(hidden)] -pub use self::statement_cache::{MaybeCached, StatementCache, StatementCacheKey}; -pub use self::transaction_manager::{AnsiTransactionManager, TransactionManager}; - -/// Perform simple operations on a backend. -/// -/// You should likely use [`Connection`](trait.Connection.html) instead. -pub trait SimpleConnection { - /// Execute multiple SQL statements within the same string. - /// - /// This function is used to execute migrations, - /// which may contain more than one SQL statement. - fn batch_execute(&self, query: &str) -> QueryResult<()>; -} - -/// A connection to a database -pub trait Connection: SimpleConnection + Sized + Send { - /// The backend this type connects to - type Backend: Backend; - #[doc(hidden)] - type TransactionManager: TransactionManager; - - /// Establishes a new connection to the database - /// - /// The argument to this method varies by backend. - /// See the documentation for that backend's connection class - /// for details about what it accepts. - fn establish(database_url: &str) -> ConnectionResult; - - /// Executes the given function inside of a database transaction - /// - /// If there is already an open transaction, - /// savepoints will be used instead. - /// - /// If the transaction fails to commit due to a `SerializationFailure`, a rollback will be attempted. - /// If the rollback succeeds, the original error will be returned, otherwise the error generated by - /// the rollback will be returned. In the second case the connection should be considered broken - /// as it contains a uncommitted unabortable open transaction. - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// use diesel::result::Error; - /// - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::users::dsl::*; - /// # let conn = establish_connection(); - /// conn.transaction::<_, Error, _>(|| { - /// diesel::insert_into(users) - /// .values(name.eq("Ruby")) - /// .execute(&conn)?; - /// - /// let all_names = users.select(name).load::(&conn)?; - /// assert_eq!(vec!["Sean", "Tess", "Ruby"], all_names); - /// - /// Ok(()) - /// })?; - /// - /// conn.transaction::<(), _, _>(|| { - /// diesel::insert_into(users) - /// .values(name.eq("Pascal")) - /// .execute(&conn)?; - /// - /// let all_names = users.select(name).load::(&conn)?; - /// assert_eq!(vec!["Sean", "Tess", "Ruby", "Pascal"], all_names); - /// - /// // If we want to roll back the transaction, but don't have an - /// // actual error to return, we can return `RollbackTransaction`. - /// Err(Error::RollbackTransaction) - /// }); - /// - /// let all_names = users.select(name).load::(&conn)?; - /// assert_eq!(vec!["Sean", "Tess", "Ruby"], all_names); - /// # Ok(()) - /// # } - /// ``` - fn transaction(&self, f: F) -> Result - where - F: FnOnce() -> Result, - E: From, - { - let transaction_manager = self.transaction_manager(); - transaction_manager.begin_transaction(self)?; - match f() { - Ok(value) => { - transaction_manager.commit_transaction(self)?; - Ok(value) - } - Err(e) => { - transaction_manager.rollback_transaction(self)?; - Err(e) - } - } - } - - /// Creates a transaction that will never be committed. This is useful for - /// tests. Panics if called while inside of a transaction. - fn begin_test_transaction(&self) -> QueryResult<()> { - let transaction_manager = self.transaction_manager(); - assert_eq!(transaction_manager.get_transaction_depth(), 0); - transaction_manager.begin_transaction(self) - } - - /// Executes the given function inside a transaction, but does not commit - /// it. Panics if the given function returns an error. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// use diesel::result::Error; - /// - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::users::dsl::*; - /// # let conn = establish_connection(); - /// conn.test_transaction::<_, Error, _>(|| { - /// diesel::insert_into(users) - /// .values(name.eq("Ruby")) - /// .execute(&conn)?; - /// - /// let all_names = users.select(name).load::(&conn)?; - /// assert_eq!(vec!["Sean", "Tess", "Ruby"], all_names); - /// - /// Ok(()) - /// }); - /// - /// // Even though we returned `Ok`, the transaction wasn't committed. - /// let all_names = users.select(name).load::(&conn)?; - /// assert_eq!(vec!["Sean", "Tess"], all_names); - /// # Ok(()) - /// # } - /// ``` - fn test_transaction(&self, f: F) -> T - where - F: FnOnce() -> Result, - E: Debug, - { - let mut user_result = None; - let _ = self.transaction::<(), _, _>(|| { - user_result = f().ok(); - Err(Error::RollbackTransaction) - }); - user_result.expect("Transaction did not succeed") - } - - #[doc(hidden)] - fn execute(&self, query: &str) -> QueryResult; - - #[doc(hidden)] - fn query_by_index(&self, source: T) -> QueryResult> - where - T: AsQuery, - T::Query: QueryFragment + QueryId, - Self::Backend: HasSqlType, - U: Queryable; - - #[doc(hidden)] - fn query_by_name(&self, source: &T) -> QueryResult> - where - T: QueryFragment + QueryId, - U: QueryableByName; - - #[doc(hidden)] - fn execute_returning_count(&self, source: &T) -> QueryResult - where - T: QueryFragment + QueryId; - - #[doc(hidden)] - fn transaction_manager(&self) -> &Self::TransactionManager; -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/connection/statement_cache.rs b/collector/compile-benchmarks/diesel-1.4.8/src/connection/statement_cache.rs deleted file mode 100644 index 6c6a94721..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/connection/statement_cache.rs +++ /dev/null @@ -1,256 +0,0 @@ -#![doc(hidden)] -//! A primer on prepared statement caching in Diesel -//! ------------------------------------------------ -//! -//! Diesel uses prepared statements for virtually all queries. This is most -//! visible in our lack of any sort of "quoting" API. Values must always be -//! transmitted as bind parameters, we do not support direct interpolation. The -//! only method in the public API that doesn't require the use of prepared -//! statements is `Connection#batch_execute`. -//! -//! In order to avoid the cost of re-parsing and planning subsequent queries, -//! Diesel caches the prepared statement whenever possible. Queries will fall -//! into one of three buckets: -//! -//! - Unsafe to cache -//! - Cached by SQL -//! - Cached by type -//! -//! A query is considered unsafe to cache if it represents a potentially -//! unbounded number of queries. This is communicated to the connection through -//! `QueryFragment#is_safe_to_cache_prepared`. While this is done as a full AST -//! pass, after monomorphisation and inlining this will usually be optimized to -//! a constant. Only boxed queries will need to do actual work to answer this -//! question. -//! -//! The majority of AST nodes are safe to cache if their components are safe to -//! cache. There are at least 4 cases where a query is unsafe to cache: -//! -//! - queries containing `IN` with bind parameters -//! - This requires 1 bind parameter per value, and is therefore unbounded -//! - `IN` with subselects are cached (assuming the subselect is safe to -//! cache) -//! - `INSERT` statements -//! - The SQL varies based on the number of rows being inserted. We could in -//! theory cache the single row case, but the cost of parsing in a write -//! query is pretty insignificant compared to reads -//! - `UPDATE` statements -//! - Technically it's bounded on "number of optional values being passed to -//! `SET` factorial" but that's still quite high, and not worth caching -//! for the same reason as single row inserts -//! - `SqlLiteral` nodes -//! - We have no way of knowing whether the SQL was generated dynamically or -//! not, so we must assume that it's unbounded -//! -//! For queries which are unsafe to cache, the statement cache will never insert -//! them. They will be prepared and immediately released after use (or in the -//! case of PG they will use the unnamed prepared statement). -//! -//! For statements which are able to be cached, we then have to determine what -//! to use as the cache key. The standard method that virtually all ORMs or -//! database access layers use in the wild is to store the statements in a -//! hash map, using the SQL as the key. -//! -//! However, the majority of queries using Diesel that are safe to cache as -//! prepared statements will be uniquely identified by their type. For these -//! queries, we can bypass the query builder entirely. Since our AST is -//! generally optimized away by the compiler, for these queries the cost of -//! fetching a prepared statement from the cache is the cost of `HashMap::get`, where the key we're fetching by is a compile time constant. For -//! these types, the AST pass to gather the bind parameters will also be -//! optimized to accessing each parameter individually. -//! -//! Determining if a query can be cached by type is the responsibility of the -//! `QueryId` trait. This trait is quite similar to `Any`, but with a few -//! differences: -//! -//! - No `'static` bound -//! - Something being a reference never changes the SQL that is generated, -//! so `&T` has the same query id as `T`. -//! - `Option` instead of `TypeId` -//! - We need to be able to constrain on this trait being implemented, but -//! not all types will actually have a static query id. Hopefully once -//! specialization is stable we can remove the `QueryId` bound and -//! specialize on it instead (or provide a blanket impl for all `T`) -//! - Implementors give a more broad type than `Self` -//! - This really only affects bind parameters. There are 6 different Rust -//! types which can be used for a parameter of type `timestamp`. The same -//! statement can be used regardless of the Rust type, so `Bound` -//! defines its `QueryId` as `Bound`. -//! -//! A type returning `Some(id)` or `None` for its query ID is based on whether -//! the SQL it generates can change without the type changing. At the moment, -//! the only type which is safe to cache as a prepared statement but does not -//! have a static query ID is something which has been boxed. -//! -//! One potential optimization that we don't perform is storing the queries -//! which are cached by type ID in a separate map. Since a type ID is a u64, -//! this would allow us to use a specialized map which knows that there will -//! never be hashing collisions (also known as a perfect hashing function), -//! which would mean lookups are always constant time. However, this would save -//! nanoseconds on an operation that will take microseconds or even -//! milliseconds. - -use std::any::TypeId; -use std::borrow::Cow; -use std::cell::{RefCell, RefMut}; -use std::collections::HashMap; -use std::hash::Hash; -use std::ops::{Deref, DerefMut}; - -use backend::Backend; -use query_builder::*; -use result::QueryResult; - -#[doc(hidden)] -#[allow(missing_debug_implementations)] -pub struct StatementCache { - pub cache: RefCell, Statement>>, -} - -#[allow(clippy::len_without_is_empty, clippy::new_without_default_derive)] -impl StatementCache -where - DB: Backend, - DB::TypeMetadata: Clone, - DB::QueryBuilder: Default, - StatementCacheKey: Hash + Eq, -{ - pub fn new() -> Self { - StatementCache { - cache: RefCell::new(HashMap::new()), - } - } - - pub fn len(&self) -> usize { - self.cache.borrow().len() - } - - pub fn cached_statement( - &self, - source: &T, - bind_types: &[DB::TypeMetadata], - prepare_fn: F, - ) -> QueryResult> - where - T: QueryFragment + QueryId, - F: FnOnce(&str) -> QueryResult, - { - use std::collections::hash_map::Entry::{Occupied, Vacant}; - - let cache_key = StatementCacheKey::for_source(source, bind_types)?; - - if !source.is_safe_to_cache_prepared()? { - let sql = cache_key.sql(source)?; - return prepare_fn(&sql).map(MaybeCached::CannotCache); - } - - refmut_map_result(self.cache.borrow_mut(), |cache| { - match cache.entry(cache_key) { - Occupied(entry) => Ok(entry.into_mut()), - Vacant(entry) => { - let statement = { - let sql = entry.key().sql(source)?; - prepare_fn(&sql) - }; - - Ok(entry.insert(statement?)) - } - } - }) - .map(MaybeCached::Cached) - } -} - -#[doc(hidden)] -#[allow(missing_debug_implementations)] -pub enum MaybeCached<'a, T: 'a> { - CannotCache(T), - Cached(RefMut<'a, T>), -} - -impl<'a, T> Deref for MaybeCached<'a, T> { - type Target = T; - - fn deref(&self) -> &Self::Target { - match *self { - MaybeCached::CannotCache(ref x) => x, - MaybeCached::Cached(ref x) => &**x, - } - } -} - -impl<'a, T> DerefMut for MaybeCached<'a, T> { - fn deref_mut(&mut self) -> &mut Self::Target { - match *self { - MaybeCached::CannotCache(ref mut x) => x, - MaybeCached::Cached(ref mut x) => &mut **x, - } - } -} - -#[doc(hidden)] -#[allow(missing_debug_implementations)] -#[derive(Hash, PartialEq, Eq)] -pub enum StatementCacheKey { - Type(TypeId), - Sql { - sql: String, - bind_types: Vec, - }, -} - -impl StatementCacheKey -where - DB: Backend, - DB::QueryBuilder: Default, - DB::TypeMetadata: Clone, -{ - pub fn for_source(source: &T, bind_types: &[DB::TypeMetadata]) -> QueryResult - where - T: QueryFragment + QueryId, - { - match T::query_id() { - Some(id) => Ok(StatementCacheKey::Type(id)), - None => { - let sql = Self::construct_sql(source)?; - Ok(StatementCacheKey::Sql { - sql: sql, - bind_types: bind_types.into(), - }) - } - } - } - - pub fn sql>(&self, source: &T) -> QueryResult> { - match *self { - StatementCacheKey::Type(_) => Self::construct_sql(source).map(Cow::Owned), - StatementCacheKey::Sql { ref sql, .. } => Ok(Cow::Borrowed(sql)), - } - } - - fn construct_sql>(source: &T) -> QueryResult { - let mut query_builder = DB::QueryBuilder::default(); - source.to_sql(&mut query_builder)?; - Ok(query_builder.finish()) - } -} - -/// Similar to `RefMut::map`, but for functions which return `Result` -/// -/// If we were in Haskell (and if `RefMut` were a functor), this would just be -/// `sequenceA`. -fn refmut_map_result(mut refmut: RefMut, mapper: F) -> QueryResult> -where - F: FnOnce(&mut T) -> QueryResult<&mut U>, -{ - // We can't just use `RefMut::map` here, since to lift the error out of that - // closure we'd need to return *something*. - // - // Instead we will very briefly convert to a raw pointer to eliminate - // lifetimes from the equation. Ultimately the cast is safe since the input - // and output lifetimes are identical. However, without the raw pointer - // we would have two live mutable references at the same time. - let ptr = mapper(&mut *refmut).map(|x| x as *mut _)?; - Ok(RefMut::map(refmut, |_| unsafe { &mut *ptr })) -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/connection/transaction_manager.rs b/collector/compile-benchmarks/diesel-1.4.8/src/connection/transaction_manager.rs deleted file mode 100644 index 104542878..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/connection/transaction_manager.rs +++ /dev/null @@ -1,245 +0,0 @@ -use backend::UsesAnsiSavepointSyntax; -use connection::{Connection, SimpleConnection}; -use result::{DatabaseErrorKind, Error, QueryResult}; - -/// Manages the internal transaction state for a connection. -/// -/// You will not need to interact with this trait, unless you are writing an -/// implementation of [`Connection`](trait.Connection.html). -pub trait TransactionManager { - /// Begin a new transaction or savepoint - /// - /// If the transaction depth is greater than 0, - /// this should create a savepoint instead. - /// This function is expected to increment the transaction depth by 1. - fn begin_transaction(&self, conn: &Conn) -> QueryResult<()>; - - /// Rollback the inner-most transaction or savepoint - /// - /// If the transaction depth is greater than 1, - /// this should rollback to the most recent savepoint. - /// This function is expected to decrement the transaction depth by 1. - fn rollback_transaction(&self, conn: &Conn) -> QueryResult<()>; - - /// Commit the inner-most transaction or savepoint - /// - /// If the transaction depth is greater than 1, - /// this should release the most recent savepoint. - /// This function is expected to decrement the transaction depth by 1. - fn commit_transaction(&self, conn: &Conn) -> QueryResult<()>; - - /// Fetch the current transaction depth - /// - /// Used to ensure that `begin_test_transaction` is not called when already - /// inside of a transaction. - fn get_transaction_depth(&self) -> u32; -} - -use std::cell::Cell; - -/// An implementation of `TransactionManager` which can be used for backends -/// which use ANSI standard syntax for savepoints such as SQLite and PostgreSQL. -#[allow(missing_debug_implementations)] -#[derive(Default)] -pub struct AnsiTransactionManager { - transaction_depth: Cell, -} - -impl AnsiTransactionManager { - /// Create a new transaction manager - pub fn new() -> Self { - AnsiTransactionManager::default() - } - - fn change_transaction_depth(&self, by: i32, query: QueryResult<()>) -> QueryResult<()> { - if query.is_ok() { - self.transaction_depth - .set(self.transaction_depth.get() + by) - } - query - } - - /// Begin a transaction with custom SQL - /// - /// This is used by connections to implement more complex transaction APIs - /// to set things such as isolation levels. - /// Returns an error if already inside of a transaction. - pub fn begin_transaction_sql(&self, conn: &Conn, sql: &str) -> QueryResult<()> - where - Conn: SimpleConnection, - { - use result::Error::AlreadyInTransaction; - - if self.transaction_depth.get() == 0 { - self.change_transaction_depth(1, conn.batch_execute(sql)) - } else { - Err(AlreadyInTransaction) - } - } -} - -impl TransactionManager for AnsiTransactionManager -where - Conn: Connection, - Conn::Backend: UsesAnsiSavepointSyntax, -{ - fn begin_transaction(&self, conn: &Conn) -> QueryResult<()> { - let transaction_depth = self.transaction_depth.get(); - self.change_transaction_depth( - 1, - if transaction_depth == 0 { - conn.batch_execute("BEGIN") - } else { - conn.batch_execute(&format!("SAVEPOINT diesel_savepoint_{}", transaction_depth)) - }, - ) - } - - fn rollback_transaction(&self, conn: &Conn) -> QueryResult<()> { - let transaction_depth = self.transaction_depth.get(); - self.change_transaction_depth( - -1, - if transaction_depth == 1 { - conn.batch_execute("ROLLBACK") - } else { - conn.batch_execute(&format!( - "ROLLBACK TO SAVEPOINT diesel_savepoint_{}", - transaction_depth - 1 - )) - }, - ) - } - - /// If the transaction fails to commit due to a `SerializationFailure`, a rollback will be attempted. - /// If the rollback succeeds, the original error will be returned, otherwise the error generated by - /// the rollback will be returned. In the second case the connection should be considered broken - /// as it contains a uncommitted unabortable open transaction. - fn commit_transaction(&self, conn: &Conn) -> QueryResult<()> { - let transaction_depth = self.transaction_depth.get(); - if transaction_depth <= 1 { - match conn.batch_execute("COMMIT") { - // When this kind of error happens on `COMMIT`, it is expected - // that a `ROLLBACK` would succeed, leaving the transaction in a non-broken state. - // If there are other such errors, it is fine to add them here. - e @ Err(Error::DatabaseError(DatabaseErrorKind::SerializationFailure, _)) => { - self.change_transaction_depth(-1, conn.batch_execute("ROLLBACK"))?; - e - } - result => self.change_transaction_depth(-1, result), - } - } else { - self.change_transaction_depth( - -1, - conn.batch_execute(&format!( - "RELEASE SAVEPOINT diesel_savepoint_{}", - transaction_depth - 1 - )), - ) - } - } - - fn get_transaction_depth(&self) -> u32 { - self.transaction_depth.get() as u32 - } -} - -#[cfg(test)] -mod test { - #[cfg(feature = "postgres")] - macro_rules! matches { - ($expression:expr, $( $pattern:pat )|+ $( if $guard: expr )?) => { - match $expression { - $( $pattern )|+ $( if $guard )? => true, - _ => false - } - } - } - - #[test] - #[cfg(feature = "postgres")] - fn transaction_depth_is_tracked_properly_on_commit_failure() { - use crate::result::DatabaseErrorKind::SerializationFailure; - use crate::result::Error::DatabaseError; - use crate::*; - use std::sync::{Arc, Barrier}; - use std::thread; - - table! { - #[sql_name = "transaction_depth_is_tracked_properly_on_commit_failure"] - serialization_example { - id -> Serial, - class -> Integer, - } - } - - let conn = crate::test_helpers::pg_connection_no_transaction(); - - sql_query("DROP TABLE IF EXISTS transaction_depth_is_tracked_properly_on_commit_failure;") - .execute(&conn) - .unwrap(); - sql_query( - r#" - CREATE TABLE transaction_depth_is_tracked_properly_on_commit_failure ( - id SERIAL PRIMARY KEY, - class INTEGER NOT NULL - ) - "#, - ) - .execute(&conn) - .unwrap(); - - insert_into(serialization_example::table) - .values(&vec![ - serialization_example::class.eq(1), - serialization_example::class.eq(2), - ]) - .execute(&conn) - .unwrap(); - - let barrier = Arc::new(Barrier::new(2)); - let threads = (1..3) - .map(|i| { - let barrier = barrier.clone(); - thread::spawn(move || { - use crate::connection::transaction_manager::AnsiTransactionManager; - use crate::connection::transaction_manager::TransactionManager; - let conn = crate::test_helpers::pg_connection_no_transaction(); - assert_eq!(0, >::get_transaction_depth(&conn.transaction_manager)); - - let result = - conn.build_transaction().serializable().run(|| { - assert_eq!(1, >::get_transaction_depth(&conn.transaction_manager)); - - let _ = serialization_example::table - .filter(serialization_example::class.eq(i)) - .count() - .execute(&conn)?; - - barrier.wait(); - - let other_i = if i == 1 { 2 } else { 1 }; - insert_into(serialization_example::table) - .values(serialization_example::class.eq(other_i)) - .execute(&conn) - }); - - assert_eq!(0, >::get_transaction_depth(&conn.transaction_manager)); - result - }) - }) - .collect::>(); - - let mut results = threads - .into_iter() - .map(|t| t.join().unwrap()) - .collect::>(); - - results.sort_by_key(|r| r.is_err()); - - assert!(matches!(results[0], Ok(_))); - assert!(matches!( - results[1], - Err(DatabaseError(SerializationFailure, _)) - )); - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/data_types.rs b/collector/compile-benchmarks/diesel-1.4.8/src/data_types.rs deleted file mode 100644 index 5baefcab2..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/data_types.rs +++ /dev/null @@ -1,7 +0,0 @@ -//! Structs to represent the primitive equivalent of SQL types where -//! there is no existing Rust primitive, or where using it would be -//! confusing (such as date and time types). This module will re-export -//! all backend specific data structures when compiled against that -//! backend. -#[cfg(feature = "postgres")] -pub use pg::data_types::*; diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/deserialize.rs b/collector/compile-benchmarks/diesel-1.4.8/src/deserialize.rs deleted file mode 100644 index 24f2cc9f1..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/deserialize.rs +++ /dev/null @@ -1,413 +0,0 @@ -//! Types and traits related to deserializing values from the database - -use std::error::Error; -use std::result; - -use backend::Backend; -use row::{NamedRow, Row}; - -/// A specialized result type representing the result of deserializing -/// a value from the database. -pub type Result = result::Result>; - -/// Trait indicating that a record can be queried from the database. -/// -/// Types which implement `Queryable` represent the result of a SQL query. This -/// does not necessarily mean they represent a single database table. -/// -/// Diesel represents the return type of a query as a tuple. The purpose of this -/// trait is to convert from a tuple of Rust values that have been deserialized -/// into your struct. -/// -/// # Deriving -/// -/// This trait can be derived automatically using `#[derive(Queryable)]`. This -/// trait can only be derived for structs, not enums. -/// -/// When this trait is derived, it will assume that the order of fields on your -/// struct match the order of the fields in the query. This means that field -/// order is significant if you are using `#[derive(Queryable)]`. Field name has -/// no effect. -/// -/// To provide custom deserialization behavior for a field, you can use -/// `#[diesel(deserialize_as = "Type")]`. If this attribute is present, Diesel -/// will deserialize into that type, rather than the type on your struct and -/// call `.into` to convert it. This can be used to add custom behavior for a -/// single field, or use types that are otherwise unsupported by Diesel. -/// -/// # Examples -/// -/// If we just want to map a query to our struct, we can use `derive`. -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("doctest_setup.rs"); -/// # -/// #[derive(Queryable, PartialEq, Debug)] -/// struct User { -/// id: i32, -/// name: String, -/// } -/// -/// # fn main() { -/// # run_test(); -/// # } -/// # -/// # fn run_test() -> QueryResult<()> { -/// # use schema::users::dsl::*; -/// # let connection = establish_connection(); -/// let first_user = users.first(&connection)?; -/// let expected = User { id: 1, name: "Sean".into() }; -/// assert_eq!(expected, first_user); -/// # Ok(()) -/// # } -/// ``` -/// -/// If we want to do additional work during deserialization, we can use -/// `deserialize_as` to use a different implementation. -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("doctest_setup.rs"); -/// # -/// # use schema::users; -/// # use diesel::backend::Backend; -/// # use diesel::deserialize::Queryable; -/// # -/// struct LowercaseString(String); -/// -/// impl Into for LowercaseString { -/// fn into(self) -> String { -/// self.0 -/// } -/// } -/// -/// impl Queryable for LowercaseString -/// where -/// DB: Backend, -/// String: Queryable, -/// { -/// type Row = >::Row; -/// -/// fn build(row: Self::Row) -> Self { -/// LowercaseString(String::build(row).to_lowercase()) -/// } -/// } -/// -/// #[derive(Queryable, PartialEq, Debug)] -/// struct User { -/// id: i32, -/// #[diesel(deserialize_as = "LowercaseString")] -/// name: String, -/// } -/// -/// # fn main() { -/// # run_test(); -/// # } -/// # -/// # fn run_test() -> QueryResult<()> { -/// # use schema::users::dsl::*; -/// # let connection = establish_connection(); -/// let first_user = users.first(&connection)?; -/// let expected = User { id: 1, name: "sean".into() }; -/// assert_eq!(expected, first_user); -/// # Ok(()) -/// # } -/// ``` -/// -/// Alternatively, we can implement the trait for our struct manually. -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("doctest_setup.rs"); -/// # -/// use schema::users; -/// use diesel::deserialize::Queryable; -/// -/// # /* -/// type DB = diesel::sqlite::Sqlite; -/// # */ -/// -/// #[derive(PartialEq, Debug)] -/// struct User { -/// id: i32, -/// name: String, -/// } -/// -/// impl Queryable for User { -/// type Row = (i32, String); -/// -/// fn build(row: Self::Row) -> Self { -/// User { -/// id: row.0, -/// name: row.1.to_lowercase(), -/// } -/// } -/// } -/// -/// # fn main() { -/// # run_test(); -/// # } -/// # -/// # fn run_test() -> QueryResult<()> { -/// # use schema::users::dsl::*; -/// # let connection = establish_connection(); -/// let first_user = users.first(&connection)?; -/// let expected = User { id: 1, name: "sean".into() }; -/// assert_eq!(expected, first_user); -/// # Ok(()) -/// # } -/// ``` -pub trait Queryable -where - DB: Backend, -{ - /// The Rust type you'd like to map from. - /// - /// This is typically a tuple of all of your struct's fields. - type Row: FromSqlRow; - - /// Construct an instance of this type - fn build(row: Self::Row) -> Self; -} - -/// Deserializes the result of a query constructed with [`sql_query`]. -/// -/// # Deriving -/// -/// To derive this trait, Diesel needs to know the SQL type of each field. You -/// can do this by either annotating your struct with `#[table_name = -/// "some_table"]` (in which case the SQL type will be -/// `diesel::dsl::SqlTypeOf`), or by annotating each -/// field with `#[sql_type = "SomeType"]`. -/// -/// If you are using `#[table_name]`, the module for that table must be in -/// scope. For example, to derive this for a struct called `User`, you will -/// likely need a line such as `use schema::users;` -/// -/// If the name of a field on your struct is different than the column in your -/// `table!` declaration, or if you are deriving this trait on a tuple struct, -/// you can annotate the field with `#[column_name = "some_column"]`. For tuple -/// structs, all fields must have this annotation. -/// -/// If a field is another struct which implements `QueryableByName`, instead of -/// a column, you can annotate that struct with `#[diesel(embed)]` -/// -/// To provide custom deserialization behavior for a field, you can use -/// `#[diesel(deserialize_as = "Type")]`. If this attribute is present, Diesel -/// will deserialize into that type, rather than the type on your struct and -/// call `.into` to convert it. This can be used to add custom behavior for a -/// single field, or use types that are otherwise unsupported by Diesel. -/// -/// [`sql_query`]: ../fn.sql_query.html -/// -/// # Examples -/// -/// -/// If we just want to map a query to our struct, we can use `derive`. -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("doctest_setup.rs"); -/// # use schema::users; -/// # use diesel::sql_query; -/// # -/// #[derive(QueryableByName, PartialEq, Debug)] -/// #[table_name = "users"] -/// struct User { -/// id: i32, -/// name: String, -/// } -/// -/// # fn main() { -/// # run_test(); -/// # } -/// # -/// # fn run_test() -> QueryResult<()> { -/// # let connection = establish_connection(); -/// let first_user = sql_query("SELECT * FROM users ORDER BY id LIMIT 1") -/// .get_result(&connection)?; -/// let expected = User { id: 1, name: "Sean".into() }; -/// assert_eq!(expected, first_user); -/// # Ok(()) -/// # } -/// ``` -/// -/// If we want to do additional work during deserialization, we can use -/// `deserialize_as` to use a different implementation. -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("doctest_setup.rs"); -/// # use diesel::sql_query; -/// # use schema::users; -/// # use diesel::backend::Backend; -/// # use diesel::deserialize::{self, FromSql}; -/// # -/// struct LowercaseString(String); -/// -/// impl Into for LowercaseString { -/// fn into(self) -> String { -/// self.0 -/// } -/// } -/// -/// impl FromSql for LowercaseString -/// where -/// DB: Backend, -/// String: FromSql, -/// { -/// fn from_sql(bytes: Option<&DB::RawValue>) -> deserialize::Result { -/// String::from_sql(bytes) -/// .map(|s| LowercaseString(s.to_lowercase())) -/// } -/// } -/// -/// #[derive(QueryableByName, PartialEq, Debug)] -/// #[table_name = "users"] -/// struct User { -/// id: i32, -/// #[diesel(deserialize_as = "LowercaseString")] -/// name: String, -/// } -/// -/// # fn main() { -/// # run_test(); -/// # } -/// # -/// # fn run_test() -> QueryResult<()> { -/// # let connection = establish_connection(); -/// let first_user = sql_query("SELECT * FROM users ORDER BY id LIMIT 1") -/// .get_result(&connection)?; -/// let expected = User { id: 1, name: "sean".into() }; -/// assert_eq!(expected, first_user); -/// # Ok(()) -/// # } -/// ``` -pub trait QueryableByName -where - Self: Sized, - DB: Backend, -{ - /// Construct an instance of `Self` from the database row - fn build>(row: &R) -> Result; -} - -/// Deserialize a single field of a given SQL type. -/// -/// When possible, implementations of this trait should prefer to use an -/// existing implementation, rather than reading from `bytes`. (For example, if -/// you are implementing this for an enum which is represented as an integer in -/// the database, prefer `i32::from_sql(bytes)` over reading from `bytes` -/// directly) -/// -/// Types which implement this trait should also have `#[derive(FromSqlRow)]` -/// -/// ### Backend specific details -/// -/// - For PostgreSQL, the bytes will be sent using the binary protocol, not text. -/// - For SQLite, the actual type of `DB::RawValue` is private API. All -/// implementations of this trait must be written in terms of an existing -/// primitive. -/// - For MySQL, the value of `bytes` will depend on the return value of -/// `type_metadata` for the given SQL type. See [`MysqlType`] for details. -/// - For third party backends, consult that backend's documentation. -/// -/// [`MysqlType`]: ../mysql/enum.MysqlType.html -/// -/// ### Examples -/// -/// Most implementations of this trait will be defined in terms of an existing -/// implementation. -/// -/// ```rust -/// # use diesel::backend::Backend; -/// # use diesel::sql_types::*; -/// # use diesel::deserialize::{self, FromSql}; -/// # -/// #[repr(i32)] -/// #[derive(Debug, Clone, Copy)] -/// pub enum MyEnum { -/// A = 1, -/// B = 2, -/// } -/// -/// impl FromSql for MyEnum -/// where -/// DB: Backend, -/// i32: FromSql, -/// { -/// fn from_sql(bytes: Option<&DB::RawValue>) -> deserialize::Result { -/// match i32::from_sql(bytes)? { -/// 1 => Ok(MyEnum::A), -/// 2 => Ok(MyEnum::B), -/// x => Err(format!("Unrecognized variant {}", x).into()), -/// } -/// } -/// } -/// ``` -pub trait FromSql: Sized { - /// See the trait documentation. - fn from_sql(bytes: Option<&DB::RawValue>) -> Result; -} - -/// Deserialize one or more fields. -/// -/// All types which implement `FromSql` should also implement this trait. This -/// trait differs from `FromSql` in that it is also implemented by tuples. -/// Implementations of this trait are usually derived. -/// -/// In the future, we hope to be able to provide a blanket impl of this trait -/// for all types which implement `FromSql`. However, as of Diesel 1.0, such an -/// impl would conflict with our impl for tuples. -/// -/// ## Deriving -/// -/// This trait can be automatically derived by Diesel -/// for any type which implements `FromSql`. -/// There are no options or special considerations needed for this derive. -/// Note that `#[derive(FromSqlRow)]` will also generate a `Queryable` implementation. -pub trait FromSqlRow: Sized { - /// The number of fields that this type will consume. Must be equal to - /// the number of times you would call `row.take()` in `build_from_row` - const FIELDS_NEEDED: usize = 1; - - /// See the trait documentation. - fn build_from_row>(row: &mut T) -> Result; -} - -// Reasons we can't write this: -// -// impl FromSqlRow for T -// where -// DB: Backend + HasSqlType, -// T: FromSql, -// { -// fn build_from_row>(row: &mut T) -> Result { -// Self::from_sql(row.take()) -// } -// } -// -// (this is mostly here so @sgrif has a better reference every time he thinks -// he's somehow had a breakthrough on solving this problem): -// -// - It conflicts with our impl for tuples, because `DB` is a bare type -// parameter, it could in theory be a local type for some other impl. -// - This is fixed by replacing our impl with 3 impls, where `DB` is changed -// concrete backends. This would mean that any third party crates adding new -// backends would need to add the tuple impls, which sucks but is fine. -// - It conflicts with our impl for `Option` -// - So we could in theory fix this by both splitting the generic impl into -// backend specific impls, and removing the `FromSql` impls. In theory there -// is no reason that it needs to implement `FromSql`, since everything -// requires `FromSqlRow`, but it really feels like it should. -// - Specialization might also fix this one. The impl isn't quite a strict -// subset (the `FromSql` impl has `T: FromSql`, and the `FromSqlRow` impl -// has `T: FromSqlRow`), but if `FromSql` implies `FromSqlRow`, -// specialization might consider that a subset? -// - I don't know that we really need it. `#[derive(FromSqlRow)]` is probably -// good enough. That won't improve our own codebase, since 99% of our -// `FromSqlRow` impls are for types from another crate, but it's almost -// certainly good enough for user types. -// - Still, it really feels like `FromSql` *should* be able to imply both -// `FromSqlRow` and `Queryable` diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/doctest_setup.rs b/collector/compile-benchmarks/diesel-1.4.8/src/doctest_setup.rs deleted file mode 100644 index c3c98c153..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/doctest_setup.rs +++ /dev/null @@ -1,234 +0,0 @@ -extern crate dotenv; -#[macro_use] extern crate cfg_if; - -use diesel::prelude::*; -use self::dotenv::dotenv; - -cfg_if! { - if #[cfg(feature = "postgres")] { - #[allow(dead_code)] - type DB = diesel::pg::Pg; - - fn connection_no_transaction() -> PgConnection { - let connection_url = database_url_from_env("PG_DATABASE_URL"); - PgConnection::establish(&connection_url).unwrap() - } - - fn connection_no_data() -> PgConnection { - let connection = connection_no_transaction(); - connection.begin_test_transaction().unwrap(); - connection.execute("DROP TABLE IF EXISTS users CASCADE").unwrap(); - connection.execute("DROP TABLE IF EXISTS animals CASCADE").unwrap(); - connection.execute("DROP TABLE IF EXISTS posts CASCADE").unwrap(); - connection.execute("DROP TABLE IF EXISTS comments CASCADE").unwrap(); - - connection - } - - #[allow(dead_code)] - fn establish_connection() -> PgConnection { - let connection = connection_no_data(); - - connection.execute("CREATE TABLE users ( - id SERIAL PRIMARY KEY, - name VARCHAR NOT NULL - )").unwrap(); - connection.execute("INSERT INTO users (name) VALUES ('Sean'), ('Tess')").unwrap(); - - connection.execute("CREATE TABLE animals ( - id SERIAL PRIMARY KEY, - species VARCHAR NOT NULL, - legs INTEGER NOT NULL, - name VARCHAR - )").unwrap(); - connection.execute("INSERT INTO animals (species, legs, name) VALUES - ('dog', 4, 'Jack'), - ('spider', 8, null)").unwrap(); - - connection.execute("CREATE TABLE posts ( - id SERIAL PRIMARY KEY, - user_id INTEGER NOT NULL, - title VARCHAR NOT NULL - )").unwrap(); - connection.execute("INSERT INTO posts (user_id, title) VALUES - (1, 'My first post'), - (1, 'About Rust'), - (2, 'My first post too')").unwrap(); - - connection.execute("CREATE TABLE comments ( - id SERIAL PRIMARY KEY, - post_id INTEGER NOT NULL, - body VARCHAR NOT NULL - )").unwrap(); - connection.execute("INSERT INTO comments (post_id, body) VALUES - (1, 'Great post'), - (2, 'Yay! I am learning Rust'), - (3, 'I enjoyed your post')").unwrap(); - - connection - } - } else if #[cfg(feature = "sqlite")] { - #[allow(dead_code)] - type DB = diesel::sqlite::Sqlite; - - fn connection_no_data() -> SqliteConnection { - SqliteConnection::establish(":memory:").unwrap() - } - - #[allow(dead_code)] - fn establish_connection() -> SqliteConnection { - let connection = connection_no_data(); - - connection.execute("CREATE TABLE users ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - name VARCHAR NOT NULL - )").unwrap(); - connection.execute("INSERT INTO users (name) VALUES ('Sean'), ('Tess')").unwrap(); - - connection.execute("CREATE TABLE animals ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - species VARCHAR NOT NULL, - legs INTEGER NOT NULL, - name VARCHAR - )").unwrap(); - connection.execute("INSERT INTO animals (species, legs, name) VALUES - ('dog', 4, 'Jack'), - ('spider', 8, null)").unwrap(); - - connection.execute("CREATE TABLE posts ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - user_id INTEGER NOT NULL, - title VARCHAR NOT NULL - )").unwrap(); - connection.execute("INSERT INTO posts (user_id, title) VALUES - (1, 'My first post'), - (1, 'About Rust'), - (2, 'My first post too')").unwrap(); - - connection.execute("CREATE TABLE comments ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - post_id INTEGER NOT NULL, - body VARCHAR NOT NULL - )").unwrap(); - connection.execute("INSERT INTO comments (post_id, body) VALUES - (1, 'Great post'), - (2, 'Yay! I am learning Rust'), - (3, 'I enjoyed your post')").unwrap(); - - connection - } - } else if #[cfg(feature = "mysql")] { - #[allow(dead_code)] - type DB = diesel::mysql::Mysql; - - fn connection_no_data() -> MysqlConnection { - let connection_url = database_url_from_env("MYSQL_UNIT_TEST_DATABASE_URL"); - let connection = MysqlConnection::establish(&connection_url).unwrap(); - connection.execute("DROP TABLE IF EXISTS users CASCADE").unwrap(); - connection.execute("DROP TABLE IF EXISTS animals CASCADE").unwrap(); - connection.execute("DROP TABLE IF EXISTS posts CASCADE").unwrap(); - connection.execute("DROP TABLE IF EXISTS comments CASCADE").unwrap(); - - connection - } - - #[allow(dead_code)] - fn establish_connection() -> MysqlConnection { - let connection = connection_no_data(); - - connection.execute("CREATE TABLE users ( - id INTEGER PRIMARY KEY AUTO_INCREMENT, - name TEXT NOT NULL - ) CHARACTER SET utf8mb4").unwrap(); - connection.execute("INSERT INTO users (name) VALUES ('Sean'), ('Tess')").unwrap(); - - connection.execute("CREATE TABLE animals ( - id INTEGER PRIMARY KEY AUTO_INCREMENT, - species TEXT NOT NULL, - legs INTEGER NOT NULL, - name TEXT - ) CHARACTER SET utf8mb4").unwrap(); - connection.execute("INSERT INTO animals (species, legs, name) VALUES - ('dog', 4, 'Jack'), - ('spider', 8, null)").unwrap(); - - connection.execute("CREATE TABLE posts ( - id INTEGER PRIMARY KEY AUTO_INCREMENT, - user_id INTEGER NOT NULL, - title TEXT NOT NULL - ) CHARACTER SET utf8mb4").unwrap(); - connection.execute("INSERT INTO posts (user_id, title) VALUES - (1, 'My first post'), - (1, 'About Rust'), - (2, 'My first post too')").unwrap(); - - connection.execute("CREATE TABLE comments ( - id INTEGER PRIMARY KEY AUTO_INCREMENT, - post_id INTEGER NOT NULL, - body TEXT NOT NULL - ) CHARACTER SET utf8mb4").unwrap(); - connection.execute("INSERT INTO comments (post_id, body) VALUES - (1, 'Great post'), - (2, 'Yay! I am learning Rust'), - (3, 'I enjoyed your post')").unwrap(); - - connection.begin_test_transaction().unwrap(); - connection - } - } else { - compile_error!( - "At least one backend must be used to test this crate.\n \ - Pass argument `--features \"\"` with one or more of the following backends, \ - 'mysql', 'postgres', or 'sqlite'. \n\n \ - ex. cargo test --features \"mysql postgres sqlite\"\n" - ); - } -} - -fn database_url_from_env(backend_specific_env_var: &str) -> String { - use std::env; - - dotenv().ok(); - - env::var(backend_specific_env_var) - .or_else(|_| env::var("DATABASE_URL")) - .expect("DATABASE_URL must be set in order to run tests") -} - - -mod schema { - table! { - animals { - id -> Integer, - species -> VarChar, - legs -> Integer, - name -> Nullable, - } - } - - table! { - comments { - id -> Integer, - post_id -> Integer, - body -> VarChar, - } - } - - table! { - posts { - id -> Integer, - user_id -> Integer, - title -> VarChar, - } - } - - table! { - users { - id -> Integer, - name -> VarChar, - } - } - - joinable!(posts -> users (user_id)); - allow_tables_to_appear_in_same_query!(animals, comments, posts, users); -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/array_comparison.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/array_comparison.rs deleted file mode 100644 index 5698de63d..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/array_comparison.rs +++ /dev/null @@ -1,198 +0,0 @@ -use backend::Backend; -use expression::subselect::Subselect; -use expression::*; -use query_builder::*; -use result::QueryResult; -use sql_types::Bool; - -#[derive(Debug, Copy, Clone, QueryId)] -pub struct In { - left: T, - values: U, -} - -#[derive(Debug, Copy, Clone, QueryId)] -pub struct NotIn { - left: T, - values: U, -} - -impl In { - pub fn new(left: T, values: U) -> Self { - In { - left: left, - values: values, - } - } -} - -impl NotIn { - pub fn new(left: T, values: U) -> Self { - NotIn { - left: left, - values: values, - } - } -} - -impl Expression for In -where - T: Expression, - U: Expression, -{ - type SqlType = Bool; -} - -impl Expression for NotIn -where - T: Expression, - U: Expression, -{ - type SqlType = Bool; -} - -impl NonAggregate for In where In: Expression {} - -impl NonAggregate for NotIn where NotIn: Expression {} - -impl QueryFragment for In -where - DB: Backend, - T: QueryFragment, - U: QueryFragment + MaybeEmpty, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - if self.values.is_empty() { - out.push_sql("1=0"); - } else { - self.left.walk_ast(out.reborrow())?; - out.push_sql(" IN ("); - self.values.walk_ast(out.reborrow())?; - out.push_sql(")"); - } - Ok(()) - } -} - -impl QueryFragment for NotIn -where - DB: Backend, - T: QueryFragment, - U: QueryFragment + MaybeEmpty, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - if self.values.is_empty() { - out.push_sql("1=1"); - } else { - self.left.walk_ast(out.reborrow())?; - out.push_sql(" NOT IN ("); - self.values.walk_ast(out.reborrow())?; - out.push_sql(")"); - } - Ok(()) - } -} - -impl_selectable_expression!(In); -impl_selectable_expression!(NotIn); - -use query_builder::{BoxedSelectStatement, SelectStatement}; - -pub trait AsInExpression { - type InExpression: MaybeEmpty + Expression; - - fn as_in_expression(self) -> Self::InExpression; -} - -impl AsInExpression for I -where - I: IntoIterator, - T: AsExpression, -{ - type InExpression = Many; - - fn as_in_expression(self) -> Self::InExpression { - let expressions = self.into_iter().map(AsExpression::as_expression).collect(); - Many(expressions) - } -} - -pub trait MaybeEmpty { - fn is_empty(&self) -> bool; -} - -impl AsInExpression for SelectStatement -where - Subselect: Expression, - Self: SelectQuery, -{ - type InExpression = Subselect; - - fn as_in_expression(self) -> Self::InExpression { - Subselect::new(self) - } -} - -impl<'a, ST, QS, DB> AsInExpression for BoxedSelectStatement<'a, ST, QS, DB> -where - Subselect, ST>: Expression, -{ - type InExpression = Subselect; - - fn as_in_expression(self) -> Self::InExpression { - Subselect::new(self) - } -} - -#[derive(Debug, Clone)] -pub struct Many(Vec); - -impl Expression for Many { - type SqlType = T::SqlType; -} - -impl MaybeEmpty for Many { - fn is_empty(&self) -> bool { - self.0.is_empty() - } -} - -impl SelectableExpression for Many -where - Many: AppearsOnTable, - T: SelectableExpression, -{ -} - -impl AppearsOnTable for Many -where - Many: Expression, - T: AppearsOnTable, -{ -} - -impl QueryFragment for Many -where - DB: Backend, - T: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.unsafe_to_cache_prepared(); - let mut first = true; - for value in &self.0 { - if first { - first = false; - } else { - out.push_sql(", "); - } - value.walk_ast(out.reborrow())?; - } - Ok(()) - } -} - -impl QueryId for Many { - type QueryId = (); - - const HAS_STATIC_QUERY_ID: bool = false; -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/bound.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/bound.rs deleted file mode 100644 index c09006a21..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/bound.rs +++ /dev/null @@ -1,50 +0,0 @@ -use std::marker::PhantomData; - -use super::*; -use backend::Backend; -use query_builder::*; -use result::QueryResult; -use serialize::ToSql; -use sql_types::HasSqlType; - -#[derive(Debug, Clone, Copy, DieselNumericOps)] -pub struct Bound { - item: U, - _marker: PhantomData, -} - -impl Bound { - pub fn new(item: U) -> Self { - Bound { - item: item, - _marker: PhantomData, - } - } -} - -impl Expression for Bound { - type SqlType = T; -} - -impl QueryFragment for Bound -where - DB: Backend + HasSqlType, - U: ToSql, -{ - fn walk_ast(&self, mut pass: AstPass) -> QueryResult<()> { - pass.push_bind_param(&self.item)?; - Ok(()) - } -} - -impl QueryId for Bound { - type QueryId = Bound; - - const HAS_STATIC_QUERY_ID: bool = T::HAS_STATIC_QUERY_ID; -} - -impl SelectableExpression for Bound where Bound: AppearsOnTable {} - -impl AppearsOnTable for Bound where Bound: Expression {} - -impl NonAggregate for Bound where Bound: Expression {} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/coerce.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/coerce.rs deleted file mode 100644 index a38358398..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/coerce.rs +++ /dev/null @@ -1,61 +0,0 @@ -use std::marker::PhantomData; - -use backend::Backend; -use expression::*; -use query_builder::*; -use result::QueryResult; - -#[derive(Debug, Copy, Clone, QueryId, DieselNumericOps)] -#[doc(hidden)] -/// Coerces an expression to be another type. No checks are performed to ensure -/// that the new type is valid in all positions that the previous type was. -/// This does not perform an actual cast, it just lies to our type system. -/// -/// This is used for a few expressions where we know that the types are actually -/// always interchangeable. (Examples of this include `Timestamp` vs -/// `Timestamptz`, `VarChar` vs `Text`, and `Json` vs `Jsonb`). -/// -/// This struct should not be considered a general solution to equivalent types. -/// It is a short term workaround for expressions which are known to be commonly -/// used. -pub struct Coerce { - expr: T, - _marker: PhantomData, -} - -impl Coerce { - pub fn new(expr: T) -> Self { - Coerce { - expr: expr, - _marker: PhantomData, - } - } -} - -impl Expression for Coerce -where - T: Expression, -{ - type SqlType = ST; -} - -impl SelectableExpression for Coerce where T: SelectableExpression {} - -impl AppearsOnTable for Coerce where T: AppearsOnTable {} - -impl QueryFragment for Coerce -where - T: QueryFragment, - DB: Backend, -{ - fn walk_ast(&self, pass: AstPass) -> QueryResult<()> { - self.expr.walk_ast(pass) - } -} - -impl NonAggregate for Coerce -where - T: NonAggregate, - Coerce: Expression, -{ -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/count.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/count.rs deleted file mode 100644 index e02455366..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/count.rs +++ /dev/null @@ -1,73 +0,0 @@ -use super::Expression; -use backend::Backend; -use query_builder::*; -use result::QueryResult; -use sql_types::BigInt; - -sql_function! { - /// Creates a SQL `COUNT` expression - /// - /// As with most bare functions, this is not exported by default. You can import - /// it specifically as `diesel::dsl::count`, or glob import - /// `diesel::dsl::*` - /// - /// # Examples - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # use diesel::dsl::*; - /// # - /// # fn main() { - /// # use schema::animals::dsl::*; - /// # let connection = establish_connection(); - /// assert_eq!(Ok(1), animals.select(count(name)).first(&connection)); - /// # } - /// ``` - #[aggregate] - fn count(expr: T) -> BigInt; -} - -/// Creates a SQL `COUNT(*)` expression -/// -/// For selecting the count of a query, and nothing else, you can just call -/// [`count`](../query_dsl/trait.QueryDsl.html#method.count) -/// on the query instead. -/// -/// As with most bare functions, this is not exported by default. You can import -/// it specifically as `diesel::dsl::count_star`, or glob import -/// `diesel::dsl::*` -/// -/// # Examples -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # use diesel::dsl::*; -/// # -/// # fn main() { -/// # use schema::users::dsl::*; -/// # let connection = establish_connection(); -/// assert_eq!(Ok(2), users.select(count_star()).first(&connection)); -/// # } -/// ``` -pub fn count_star() -> CountStar { - CountStar -} - -#[derive(Debug, Clone, Copy, QueryId, DieselNumericOps)] -#[doc(hidden)] -pub struct CountStar; - -impl Expression for CountStar { - type SqlType = BigInt; -} - -impl QueryFragment for CountStar { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql("COUNT(*)"); - Ok(()) - } -} - -impl_selectable_expression!(CountStar); diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/exists.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/exists.rs deleted file mode 100644 index 401e63ccb..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/exists.rs +++ /dev/null @@ -1,73 +0,0 @@ -use backend::Backend; -use expression::subselect::Subselect; -use expression::{AppearsOnTable, Expression, NonAggregate, SelectableExpression}; -use query_builder::*; -use result::QueryResult; -use sql_types::Bool; - -/// Creates a SQL `EXISTS` expression. -/// -/// The argument must be a complete SQL query. The query may reference columns -/// from the outer table. -/// -/// # Example -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # -/// # fn main() { -/// # use schema::users::dsl::*; -/// # use diesel::select; -/// # use diesel::dsl::exists; -/// # let connection = establish_connection(); -/// let sean_exists = select(exists(users.filter(name.eq("Sean")))) -/// .get_result(&connection); -/// let jim_exists = select(exists(users.filter(name.eq("Jim")))) -/// .get_result(&connection); -/// assert_eq!(Ok(true), sean_exists); -/// assert_eq!(Ok(false), jim_exists); -/// # } -/// ``` -pub fn exists(query: T) -> Exists { - Exists(Subselect::new(query)) -} - -#[derive(Debug, Clone, Copy, QueryId)] -pub struct Exists(Subselect); - -impl Expression for Exists -where - Subselect: Expression, -{ - type SqlType = Bool; -} - -impl NonAggregate for Exists {} - -impl QueryFragment for Exists -where - DB: Backend, - T: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql("EXISTS ("); - self.0.walk_ast(out.reborrow())?; - out.push_sql(")"); - Ok(()) - } -} - -impl SelectableExpression for Exists -where - Self: AppearsOnTable, - Subselect: SelectableExpression, -{ -} - -impl AppearsOnTable for Exists -where - Self: Expression, - Subselect: AppearsOnTable, -{ -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/functions/aggregate_folding.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/functions/aggregate_folding.rs deleted file mode 100644 index a3ebf9429..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/functions/aggregate_folding.rs +++ /dev/null @@ -1,69 +0,0 @@ -use sql_types::Foldable; - -sql_function! { - /// Represents a SQL `SUM` function. This function can only take types which are - /// Foldable. - /// - /// # Examples - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../../doctest_setup.rs"); - /// # use diesel::dsl::*; - /// # - /// # fn main() { - /// # use schema::animals::dsl::*; - /// # let connection = establish_connection(); - /// assert_eq!(Ok(Some(12i64)), animals.select(sum(legs)).first(&connection)); - /// # } - /// ``` - #[aggregate] - fn sum(expr: ST) -> ST::Sum; -} - -sql_function! { - /// Represents a SQL `AVG` function. This function can only take types which are - /// Foldable. - /// - /// # Examples - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../../doctest_setup.rs"); - /// # use diesel::dsl::*; - /// # #[cfg(feature = "bigdecimal")] - /// # extern crate bigdecimal; - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # table! { - /// # numbers (number) { - /// # number -> Integer, - /// # } - /// # } - /// # - /// # #[cfg(all(feature = "numeric", any(feature = "postgres", not(feature = "sqlite"))))] - /// # fn run_test() -> QueryResult<()> { - /// # use bigdecimal::BigDecimal; - /// # use numbers::dsl::*; - /// # let conn = establish_connection(); - /// # conn.execute("DROP TABLE IF EXISTS numbers")?; - /// # conn.execute("CREATE TABLE numbers (number INTEGER)")?; - /// diesel::insert_into(numbers) - /// .values(&vec![number.eq(1), number.eq(2)]) - /// .execute(&conn)?; - /// let average = numbers.select(avg(number)).get_result(&conn)?; - /// let expected = "1.5".parse::().unwrap(); - /// assert_eq!(Some(expected), average); - /// # Ok(()) - /// # } - /// # - /// # #[cfg(not(all(feature = "numeric", any(feature = "postgres", not(feature = "sqlite")))))] - /// # fn run_test() -> QueryResult<()> { - /// # Ok(()) - /// # } - #[aggregate] - fn avg(expr: ST) -> ST::Avg; -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/functions/aggregate_ordering.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/functions/aggregate_ordering.rs deleted file mode 100644 index 6af9503e6..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/functions/aggregate_ordering.rs +++ /dev/null @@ -1,41 +0,0 @@ -use sql_types::{IntoNullable, SqlOrd}; - -sql_function! { - /// Represents a SQL `MAX` function. This function can only take types which are - /// ordered. - /// - /// # Examples - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../../doctest_setup.rs"); - /// # use diesel::dsl::*; - /// # - /// # fn main() { - /// # use schema::animals::dsl::*; - /// # let connection = establish_connection(); - /// assert_eq!(Ok(Some(8)), animals.select(max(legs)).first(&connection)); - /// # } - #[aggregate] - fn max(expr: ST) -> ST::Nullable; -} - -sql_function! { - /// Represents a SQL `MIN` function. This function can only take types which are - /// ordered. - /// - /// # Examples - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../../doctest_setup.rs"); - /// # use diesel::dsl::*; - /// # - /// # fn main() { - /// # use schema::animals::dsl::*; - /// # let connection = establish_connection(); - /// assert_eq!(Ok(Some(4)), animals.select(min(legs)).first(&connection)); - /// # } - #[aggregate] - fn min(expr: ST) -> ST::Nullable; -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/functions/date_and_time.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/functions/date_and_time.rs deleted file mode 100644 index a0d68f41c..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/functions/date_and_time.rs +++ /dev/null @@ -1,75 +0,0 @@ -use backend::Backend; -use expression::coerce::Coerce; -use expression::{AsExpression, Expression, NonAggregate}; -use query_builder::*; -use result::QueryResult; -use sql_types::*; - -/// Represents the SQL `CURRENT_TIMESTAMP` constant. This is equivalent to the -/// `NOW()` function on backends that support it. -#[allow(non_camel_case_types)] -#[derive(Debug, Copy, Clone, QueryId)] -pub struct now; - -impl Expression for now { - type SqlType = Timestamp; -} - -impl NonAggregate for now {} - -impl QueryFragment for now { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql("CURRENT_TIMESTAMP"); - Ok(()) - } -} - -impl_selectable_expression!(now); - -operator_allowed!(now, Add, add); -operator_allowed!(now, Sub, sub); -sql_function! { - /// Represents the SQL `DATE` function. The argument should be a Timestamp - /// expression, and the return value will be an expression of type Date. - - /// # Examples - - /// ```ignore - /// # #[macro_use] extern crate diesel; - /// # extern crate chrono; - /// # include!("../../doctest_setup.rs"); - /// # use diesel::dsl::*; - /// # - /// # fn main() { - /// # let connection = establish_connection(); - /// let today: chrono::NaiveDate = diesel::select(date(now)).first(&connection).unwrap(); - /// # } - /// ``` - fn date(expr: Timestamp) -> Date; -} - -impl AsExpression> for now { - type Expression = Coerce>; - - fn as_expression(self) -> Self::Expression { - Coerce::new(self) - } -} - -#[cfg(feature = "postgres")] -impl AsExpression for now { - type Expression = Coerce; - - fn as_expression(self) -> Self::Expression { - Coerce::new(self) - } -} - -#[cfg(feature = "postgres")] -impl AsExpression> for now { - type Expression = Coerce>; - - fn as_expression(self) -> Self::Expression { - Coerce::new(self) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/functions/helper_types.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/functions/helper_types.rs deleted file mode 100644 index 1910c1901..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/functions/helper_types.rs +++ /dev/null @@ -1,26 +0,0 @@ -#![allow(non_camel_case_types)] - -use dsl::{AsExprOf, SqlTypeOf}; -use expression::grouped::Grouped; -use expression::operators; -use sql_types::Bool; - -/// The return type of [`not(expr)`](../dsl/fn.not.html) -pub type not = operators::Not>>; - -/// The return type of `not(expr)` -#[deprecated(since = "1.1.0", note = "use `not` instead")] -#[cfg(feature = "with-deprecated")] -pub type Not = not; - -/// The return type of [`max(expr)`](../dsl/fn.max.html) -pub type max = super::aggregate_ordering::max::HelperType, Expr>; - -/// The return type of [`min(expr)`](../dsl/fn.min.html) -pub type min = super::aggregate_ordering::min::HelperType, Expr>; - -/// The return type of [`sum(expr)`](../dsl/fn.sum.html) -pub type sum = super::aggregate_folding::sum::HelperType, Expr>; - -/// The return type of [`avg(expr)`](../dsl/fn.avg.html) -pub type avg = super::aggregate_folding::avg::HelperType, Expr>; diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/functions/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/functions/mod.rs deleted file mode 100644 index 044ee4faa..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/functions/mod.rs +++ /dev/null @@ -1,680 +0,0 @@ -#[macro_export] -#[doc(hidden)] -#[cfg(feature = "with-deprecated")] -#[deprecated( - since = "1.3.0", - note = "The syntax of `sql_function!` and its output have changed significantly. This form has been deprecated. See the documentation of `sql_function!` for details on the new syntax." -)] -macro_rules! sql_function_body { - ( - $fn_name:ident, - $struct_name:ident, - ($($arg_name:ident: $arg_type:ty),*) -> $return_type:ty, - $docs:expr, - $helper_ty_docs:expr - ) => { - #[allow(non_camel_case_types)] - #[derive(Debug, Clone, Copy, QueryId)] - #[doc(hidden)] - pub struct $struct_name<$($arg_name),*> { - $($arg_name: $arg_name),* - } - - #[allow(non_camel_case_types)] - #[doc=$helper_ty_docs] - pub type $fn_name<$($arg_name),*> = $struct_name<$( - <$arg_name as $crate::expression::AsExpression<$arg_type>>::Expression - ),*>; - - #[allow(non_camel_case_types)] - #[doc=$docs] - pub fn $fn_name<$($arg_name),*>($($arg_name: $arg_name),*) - -> $fn_name<$($arg_name),*> - where $($arg_name: $crate::expression::AsExpression<$arg_type>),+ - { - $struct_name { - $($arg_name: $arg_name.as_expression()),+ - } - } - - #[allow(non_camel_case_types)] - impl<$($arg_name),*> $crate::expression::Expression for $struct_name<$($arg_name),*> where - for <'a> ($(&'a $arg_name),*): $crate::expression::Expression, - { - type SqlType = $return_type; - } - - #[allow(non_camel_case_types)] - impl<$($arg_name),*, DB> $crate::query_builder::QueryFragment for $struct_name<$($arg_name),*> where - DB: $crate::backend::Backend, - for <'a> ($(&'a $arg_name),*): $crate::query_builder::QueryFragment, - { - fn walk_ast(&self, mut out: $crate::query_builder::AstPass) -> $crate::result::QueryResult<()> { - out.push_sql(concat!(stringify!($fn_name), "(")); - $crate::query_builder::QueryFragment::walk_ast( - &($(&self.$arg_name),*), out.reborrow())?; - out.push_sql(")"); - Ok(()) - } - } - - #[allow(non_camel_case_types)] - impl<$($arg_name),*, QS> $crate::expression::SelectableExpression for $struct_name<$($arg_name),*> where - $($arg_name: $crate::expression::SelectableExpression,)* - $struct_name<$($arg_name),*>: $crate::expression::AppearsOnTable, - { - } - - #[allow(non_camel_case_types)] - impl<$($arg_name),*, QS> $crate::expression::AppearsOnTable for $struct_name<$($arg_name),*> where - $($arg_name: $crate::expression::AppearsOnTable,)* - $struct_name<$($arg_name),*>: $crate::expression::Expression, - { - } - - #[allow(non_camel_case_types)] - impl<$($arg_name),*> $crate::expression::NonAggregate for $struct_name<$($arg_name),*> where - $($arg_name: $crate::expression::NonAggregate,)* - $struct_name<$($arg_name),*>: $crate::expression::Expression, - { - } - } -} - -#[macro_export] -#[doc(hidden)] -#[cfg(not(feature = "with-deprecated"))] -macro_rules! sql_function_body { - ($($args:tt)*) => { - compile_error!( - "You are using a deprecated form of `sql_function!`. \ - You must enable the `with-deprecated` feature on `diesel`." - ); - }; -} - -#[macro_export] -#[doc(hidden)] -macro_rules! __diesel_sql_function_body { - // Entry point with type arguments. Pull out the rest of the body. - ( - data = ( - meta = $meta:tt, - fn_name = $fn_name:tt, - ), - type_args = $type_args:tt, - type_args_with_bounds = $type_args_with_bounds:tt, - unparsed_tokens = ( - $args:tt -> $return_type:ty $(;)* - ), - ) => { - __diesel_sql_function_body! { - meta = $meta, - fn_name = $fn_name, - type_args = $type_args, - type_args_with_bounds = $type_args_with_bounds, - args = $args, - return_type = $return_type, - } - }; - - // Entry point. We need to search the meta items for our special attributes - ( - meta = $meta:tt, - fn_name = $fn_name:ident, - $($rest:tt)* - ) => { - __diesel_sql_function_body! { - aggregate = no, - sql_name = stringify!($fn_name), - unchecked_meta = $meta, - meta = (), - fn_name = $fn_name, - $($rest)* - } - }; - - // Found #[aggregate] - ( - aggregate = $aggregate:tt, - sql_name = $sql_name:expr, - unchecked_meta = (#[aggregate] $($unchecked:tt)*), - meta = $meta:tt, - $($rest:tt)* - ) => { - __diesel_sql_function_body! { - aggregate = yes, - sql_name = $sql_name, - unchecked_meta = ($($unchecked)*), - meta = $meta, - $($rest)* - } - }; - - // Found #[sql_name]. - ( - aggregate = $aggregate:tt, - sql_name = $ignored:expr, - unchecked_meta = (#[sql_name = $sql_name:expr] $($unchecked:tt)*), - meta = $meta:tt, - $($rest:tt)* - ) => { - __diesel_sql_function_body! { - aggregate = $aggregate, - sql_name = $sql_name, - unchecked_meta = ($($unchecked)*), - meta = $meta, - $($rest)* - } - }; - - // Didn't find a special attribute - ( - aggregate = $aggregate:tt, - sql_name = $sql_name:expr, - unchecked_meta = (#$checked:tt $($unchecked:tt)*), - meta = ($($meta:tt)*), - $($rest:tt)* - ) => { - __diesel_sql_function_body! { - aggregate = $aggregate, - sql_name = $sql_name, - unchecked_meta = ($($unchecked)*), - meta = ($($meta)* #$checked), - $($rest)* - } - }; - - // Done searching for special attributes - ( - aggregate = $aggregate:tt, - sql_name = $sql_name:expr, - unchecked_meta = (), - meta = ($($meta:tt)*), - fn_name = $fn_name:ident, - type_args = ($($type_args:ident,)*), - type_args_with_bounds = ($($type_args_bounds:tt)*), - args = ($($arg_name:ident: $arg_type:ty),*), - return_type = $return_type:ty, - ) => { - $($meta)* - #[allow(non_camel_case_types)] - pub fn $fn_name<$($type_args_bounds)* $($arg_name),*>($($arg_name: $arg_name),*) - -> $fn_name::HelperType<$($type_args,)* $($arg_name),*> - where - $($arg_name: $crate::expression::AsExpression<$arg_type>),+ - { - $fn_name::$fn_name { - $($arg_name: $arg_name.as_expression(),)+ - $($type_args: ::std::marker::PhantomData,)* - } - } - - #[doc(hidden)] - #[allow(non_camel_case_types, non_snake_case, unused_imports)] - pub(crate) mod $fn_name { - use super::*; - use $crate::sql_types::*; - - #[derive(Debug, Clone, Copy, QueryId, DieselNumericOps)] - pub struct $fn_name<$($type_args,)* $($arg_name),*> { - $(pub(in super) $arg_name: $arg_name,)* - $(pub(in super) $type_args: ::std::marker::PhantomData<$type_args>,)* - } - - pub type HelperType<$($type_args,)* $($arg_name),*> = $fn_name< - $($type_args,)* - $( - <$arg_name as $crate::expression::AsExpression<$arg_type>>::Expression - ),* - >; - - impl<$($type_args_bounds)* $($arg_name),*> - $crate::expression::Expression - for $fn_name<$($type_args,)* $($arg_name),*> - where - ($($arg_name),*): $crate::expression::Expression, - { - type SqlType = $return_type; - } - - impl<$($type_args_bounds)* $($arg_name),*, DB> - $crate::query_builder::QueryFragment - for $fn_name<$($type_args,)* $($arg_name),*> - where - DB: $crate::backend::Backend, - for<'a> ($(&'a $arg_name),*): $crate::query_builder::QueryFragment, - { - fn walk_ast(&self, mut out: $crate::query_builder::AstPass) -> $crate::result::QueryResult<()> { - out.push_sql(concat!($sql_name, "(")); - $crate::query_builder::QueryFragment::walk_ast( - &($(&self.$arg_name),*), out.reborrow())?; - out.push_sql(")"); - Ok(()) - } - } - - impl<$($type_args_bounds)* $($arg_name),*, QS> - $crate::expression::SelectableExpression - for $fn_name<$($type_args,)* $($arg_name),*> - where - $($arg_name: $crate::expression::SelectableExpression,)* - Self: $crate::expression::AppearsOnTable, - { - } - - impl<$($type_args_bounds)* $($arg_name),*, QS> - $crate::expression::AppearsOnTable - for $fn_name<$($type_args,)* $($arg_name),*> - where - $($arg_name: $crate::expression::AppearsOnTable,)* - Self: $crate::expression::Expression, - { - } - - static_cond! { - if $aggregate == no { - impl<$($type_args_bounds)* $($arg_name),*> - $crate::expression::NonAggregate - for $fn_name<$($type_args,)* $($arg_name),*> - where - $($arg_name: $crate::expression::NonAggregate,)* - Self: $crate::expression::Expression, - { - } - } - } - - __diesel_sqlite_register_fn! { - type_args = ($($type_args)*), - aggregate = $aggregate, - fn_name = $fn_name, - args = ($($arg_name,)+), - sql_args = ($($arg_type,)+), - ret = $return_type, - } - } - } -} - -#[macro_export] -#[doc(hidden)] -#[cfg(feature = "sqlite")] -macro_rules! __diesel_sqlite_register_fn { - // We can't handle generic functions for SQLite - ( - type_args = ($($type_args:tt)+), - $($rest:tt)* - ) => { - }; - - // We don't currently support aggregate functions for SQLite - ( - type_args = $ignored:tt, - aggregate = yes, - $($rest:tt)* - ) => { - }; - - ( - type_args = (), - aggregate = no, - fn_name = $fn_name:ident, - args = ($($args:ident,)+), - sql_args = $sql_args:ty, - ret = $ret:ty, - ) => { - #[allow(dead_code)] - /// Registers an implementation for this function on the given connection - /// - /// This function must be called for every `SqliteConnection` before - /// this SQL function can be used on SQLite. The implementation must be - /// deterministic (returns the same result given the same arguments). If - /// the function is nondeterministic, call - /// `register_nondeterministic_impl` instead. - pub fn register_impl( - conn: &$crate::SqliteConnection, - f: F, - ) -> $crate::QueryResult<()> - where - F: Fn($($args,)+) -> Ret + Send + 'static, - ($($args,)+): $crate::deserialize::Queryable<$sql_args, $crate::sqlite::Sqlite>, - Ret: $crate::serialize::ToSql<$ret, $crate::sqlite::Sqlite>, - { - conn.register_sql_function::<$sql_args, $ret, _, _, _>( - stringify!($fn_name), - true, - move |($($args,)+)| f($($args),+), - ) - } - - #[allow(dead_code)] - /// Registers an implementation for this function on the given connection - /// - /// This function must be called for every `SqliteConnection` before - /// this SQL function can be used on SQLite. - /// `register_nondeterministic_impl` should only be used if your - /// function can return different results with the same arguments (e.g. - /// `random`). If your function is deterministic, you should call - /// `register_impl` instead. - pub fn register_nondeterministic_impl( - conn: &$crate::SqliteConnection, - mut f: F, - ) -> $crate::QueryResult<()> - where - F: FnMut($($args,)+) -> Ret + Send + 'static, - ($($args,)+): $crate::deserialize::Queryable<$sql_args, $crate::sqlite::Sqlite>, - Ret: $crate::serialize::ToSql<$ret, $crate::sqlite::Sqlite>, - { - conn.register_sql_function::<$sql_args, $ret, _, _, _>( - stringify!($fn_name), - false, - move |($($args,)+)| f($($args),+), - ) - } - }; -} - -#[macro_export] -#[doc(hidden)] -#[cfg(not(feature = "sqlite"))] -macro_rules! __diesel_sqlite_register_fn { - ($($token:tt)*) => {}; -} - -#[macro_export] -/// Declare a sql function for use in your code. -/// -/// Diesel only provides support for a very small number of SQL functions. -/// This macro enables you to add additional functions from the SQL standard, -/// as well as any custom functions your application might have. -/// -/// The syntax for this macro is very similar to that of a normal Rust function, -/// except the argument and return types will be the SQL types being used. -/// Typically these types will come from [`diesel::sql_types`]. -/// -/// This macro will generate two items. A function with the name that you've -/// given, and a module with a helper type representing the return type of your -/// function. For example, this invocation: -/// -/// ```ignore -/// sql_function!(fn lower(x: Text) -> Text); -/// ``` -/// -/// will generate this code: -/// -/// ```ignore -/// pub fn lower(x: X) -> lower::HelperType { -/// ... -/// } -/// -/// pub(crate) mod lower { -/// pub type HelperType = ...; -/// } -/// ``` -/// -/// If you are using this macro for part of a library, where the function is -/// part of your public API, it is highly recommended that you re-export this -/// helper type with the same name as your function. This is the standard -/// structure: -/// -/// ```ignore -/// pub mod functions { -/// use super::types::*; -/// use diesel::sql_types::*; -/// -/// sql_function! { -/// /// Represents the Pg `LENGTH` function used with `tsvector`s. -/// fn length(x: TsVector) -> Integer; -/// } -/// } -/// -/// pub mod helper_types { -/// /// The return type of `length(expr)` -/// pub type Length = functions::length::HelperType; -/// } -/// -/// pub mod dsl { -/// pub use functions::*; -/// pub use helper_types::*; -/// } -/// ``` -/// -/// Most attributes given to this macro will be put on the generated function -/// (including doc comments). -/// -/// # Adding Doc Comments -/// -/// ```no_run -/// # #[macro_use] extern crate diesel; -/// # use diesel::*; -/// # -/// # table! { crates { id -> Integer, name -> VarChar, } } -/// # -/// use diesel::sql_types::Text; -/// -/// sql_function! { -/// /// Represents the `canon_crate_name` SQL function, created in -/// /// migration .... -/// fn canon_crate_name(a: Text) -> Text; -/// } -/// -/// # fn main() { -/// # use self::crates::dsl::*; -/// let target_name = "diesel"; -/// crates.filter(canon_crate_name(name).eq(canon_crate_name(target_name))); -/// // This will generate the following SQL -/// // SELECT * FROM crates WHERE canon_crate_name(crates.name) = canon_crate_name($1) -/// # } -/// ``` -/// -/// # Special Attributes -/// -/// There are a handful of special attributes that Diesel will recognize. They -/// are: -/// -/// - `#[aggregate]` -/// - Indicates that this is an aggregate function, and that `NonAggregate` -/// should not be implemented. -/// - `#[sql_name="name"]` -/// - The SQL to be generated is different than the Rust name of the function. -/// This can be used to represent functions which can take many argument -/// types, or to capitalize function names. -/// -/// Functions can also be generic. Take the definition of `sum` for an example -/// of all of this: -/// -/// ```no_run -/// # #[macro_use] extern crate diesel; -/// # use diesel::*; -/// # -/// # table! { crates { id -> Integer, name -> VarChar, } } -/// # -/// use diesel::sql_types::Foldable; -/// -/// sql_function! { -/// #[aggregate] -/// #[sql_name = "SUM"] -/// fn sum(expr: ST) -> ST::Sum; -/// } -/// -/// # fn main() { -/// # use self::crates::dsl::*; -/// crates.select(sum(id)); -/// # } -/// ``` -/// -/// # Use with SQLite -/// -/// On most backends, the implementation of the function is defined in a -/// migration using `CREATE FUNCTION`. On SQLite, the function is implemented in -/// Rust instead. You must call `register_impl` or -/// `register_nondeterministic_impl` with every connection before you can use -/// the function. -/// -/// These functions will only be generated if the `sqlite` feature is enabled, -/// and the function is not generic. Generic functions and variadic functions -/// are not supported on SQLite. -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # use diesel::*; -/// # -/// # #[cfg(feature = "sqlite")] -/// # fn main() { -/// # run_test().unwrap(); -/// # } -/// # -/// # #[cfg(not(feature = "sqlite"))] -/// # fn main() { -/// # } -/// # -/// use diesel::sql_types::{Integer, Double}; -/// sql_function!(fn add_mul(x: Integer, y: Integer, z: Double) -> Double); -/// -/// # #[cfg(feature = "sqlite")] -/// # fn run_test() -> Result<(), Box<::std::error::Error>> { -/// let connection = SqliteConnection::establish(":memory:")?; -/// -/// add_mul::register_impl(&connection, |x: i32, y: i32, z: f64| { -/// (x + y) as f64 * z -/// })?; -/// -/// let result = select(add_mul(1, 2, 1.5)) -/// .get_result::(&connection)?; -/// assert_eq!(4.5, result); -/// # Ok(()) -/// # } -/// ``` -macro_rules! sql_function { - ($(#$meta:tt)* fn $fn_name:ident $args:tt $(;)*) => { - sql_function!($(#$meta)* fn $fn_name $args -> ()); - }; - - ($(#$meta:tt)* fn $fn_name:ident $args:tt -> $return_type:ty $(;)*) => { - sql_function!($(#$meta)* fn $fn_name <> $args -> $return_type); - }; - - ( - $(#$meta:tt)* - fn $fn_name:ident - < - $($tokens:tt)* - ) => { - __diesel_parse_type_args!( - data = ( - meta = ($(#$meta)*), - fn_name = $fn_name, - ), - callback = __diesel_sql_function_body, - tokens = ($($tokens)*), - ); - }; - - ($fn_name:ident, $struct_name:ident, $args:tt -> $return_type:ty) => { - sql_function!($fn_name, $struct_name, $args -> $return_type, ""); - }; - - ($fn_name:ident, $struct_name:ident, $args:tt -> $return_type:ty, $docs:expr) => { - sql_function!($fn_name, $struct_name, $args -> $return_type, $docs, ""); - }; - - ($fn_name:ident, $struct_name:ident, ($($arg_name:ident: $arg_type:ty),*)) => { - sql_function!($fn_name, $struct_name, ($($arg_name: $arg_type),*) -> ()); - }; - - ( - $fn_name:ident, - $struct_name:ident, - $args:tt -> $return_type:ty, - $docs:expr, - $helper_ty_docs:expr - ) => { - sql_function_body!($fn_name, $struct_name, $args -> $return_type, $docs, $helper_ty_docs); - }; -} - -#[macro_export] -#[doc(hidden)] -macro_rules! no_arg_sql_function_body_except_to_sql { - ($type_name:ident, $return_type:ty, $docs:expr) => { - #[allow(non_camel_case_types)] - #[doc=$docs] - #[derive(Debug, Clone, Copy, QueryId)] - pub struct $type_name; - - impl $crate::expression::Expression for $type_name { - type SqlType = $return_type; - } - - impl $crate::expression::SelectableExpression for $type_name {} - - impl $crate::expression::AppearsOnTable for $type_name {} - - impl $crate::expression::NonAggregate for $type_name {} - }; -} - -#[macro_export] -#[doc(hidden)] -macro_rules! no_arg_sql_function_body { - ($type_name:ident, $return_type:ty, $docs:expr, $($constraint:ident)::+) => { - no_arg_sql_function_body_except_to_sql!($type_name, $return_type, $docs); - - impl $crate::query_builder::QueryFragment for $type_name where - DB: $crate::backend::Backend + $($constraint)::+, - { - fn walk_ast(&self, mut out: $crate::query_builder::AstPass) -> $crate::result::QueryResult<()> { - out.push_sql(concat!(stringify!($type_name), "()")); - Ok(()) - } - } - }; - - ($type_name:ident, $return_type:ty, $docs:expr) => { - no_arg_sql_function_body_except_to_sql!($type_name, $return_type, $docs); - - impl $crate::query_builder::QueryFragment for $type_name where - DB: $crate::backend::Backend, - { - fn walk_ast(&self, mut out: $crate::query_builder::AstPass) -> $crate::result::QueryResult<()> { - out.push_sql(concat!(stringify!($type_name), "()")); - Ok(()) - } - } - }; -} - -#[macro_export] -/// Declare a 0 argument SQL function for use in your code. This will generate a -/// unit struct, which is an expression representing calling this function. See -/// [`now`](expression/dsl/struct.now.html) for example output. `now` was -/// generated using: -/// -/// ```no_run -/// # #[macro_use] extern crate diesel; -/// # pub use diesel::*; -/// no_arg_sql_function!(now, sql_types::Timestamp, "Represents the SQL NOW() function"); -/// # fn main() {} -/// ``` -/// -/// You can optionally pass the name of a trait, as a constraint for backends which support the -/// function. -macro_rules! no_arg_sql_function { - ($type_name:ident, $return_type:ty) => { - no_arg_sql_function!($type_name, $return_type, ""); - }; - - ($type_name:ident, $return_type:ty, $docs:expr) => { - no_arg_sql_function_body!($type_name, $return_type, $docs); - }; - - ($type_name:ident, $return_type:ty, $docs:expr, $($constraint:ident)::+) => { - no_arg_sql_function_body!($type_name, $return_type, $docs, $($constraint)::+); - }; -} - -pub mod aggregate_folding; -pub mod aggregate_ordering; -pub mod date_and_time; -pub mod helper_types; diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/grouped.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/grouped.rs deleted file mode 100644 index baf7f6e07..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/grouped.rs +++ /dev/null @@ -1,24 +0,0 @@ -use backend::Backend; -use expression::{Expression, NonAggregate}; -use query_builder::*; -use result::QueryResult; - -#[derive(Debug, Copy, Clone, QueryId, Default, DieselNumericOps)] -pub struct Grouped(pub T); - -impl Expression for Grouped { - type SqlType = T::SqlType; -} - -impl, DB: Backend> QueryFragment for Grouped { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql("("); - self.0.walk_ast(out.reborrow())?; - out.push_sql(")"); - Ok(()) - } -} - -impl_selectable_expression!(Grouped); - -impl NonAggregate for Grouped where Grouped: Expression {} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/helper_types.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/helper_types.rs deleted file mode 100644 index 7bf350d86..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/helper_types.rs +++ /dev/null @@ -1,103 +0,0 @@ -//! The types in this module are all shorthand for `PredicateType>`. Since we often need to return concrete types, instead of -//! a boxed trait object, these can be useful for writing concise return types. -use super::array_comparison::{AsInExpression, In, NotIn}; -use super::grouped::Grouped; -use super::{AsExpression, Expression}; -use sql_types; - -/// The SQL type of an expression -pub type SqlTypeOf = ::SqlType; - -/// The type of `Item` when converted to an expression with the same type as `TargetExpr` -pub type AsExpr = AsExprOf>; - -/// The type of `Item` when converted to an expression of `Type` -pub type AsExprOf = >::Expression; - -/// The return type of -/// [`lhs.eq(rhs)`](../expression_methods/trait.ExpressionMethods.html#method.eq) -pub type Eq = super::operators::Eq>; - -/// The return type of -/// [`lhs.ne(rhs)`](../expression_methods/trait.ExpressionMethods.html#method.ne) -pub type NotEq = super::operators::NotEq>; - -/// The return type of -/// [`lhs.eq_any(rhs)`](../expression_methods/trait.ExpressionMethods.html#method.eq_any) -pub type EqAny = In>>::InExpression>; - -/// The return type of -/// [`lhs.ne_any(rhs)`](../expression_methods/trait.ExpressionMethods.html#method.ne_any) -pub type NeAny = NotIn>>::InExpression>; - -/// The return type of -/// [`expr.is_null()`](../expression_methods/trait.ExpressionMethods.html#method.is_null) -pub type IsNull = super::operators::IsNull; - -/// The return type of -/// [`expr.is_not_null()`](../expression_methods/trait.ExpressionMethods.html#method.is_not_null) -pub type IsNotNull = super::operators::IsNotNull; - -/// The return type of -/// [`lhs.gt(rhs)`](../expression_methods/trait.ExpressionMethods.html#method.gt) -pub type Gt = super::operators::Gt>; - -/// The return type of -/// [`lhs.ge(rhs)`](../expression_methods/trait.ExpressionMethods.html#method.ge) -pub type GtEq = super::operators::GtEq>; - -/// The return type of -/// [`lhs.lt(rhs)`](../expression_methods/trait.ExpressionMethods.html#method.lt) -pub type Lt = super::operators::Lt>; - -/// The return type of -/// [`lhs.le(rhs)`](../expression_methods/trait.ExpressionMethods.html#method.le) -pub type LtEq = super::operators::LtEq>; - -/// The return type of -/// [`lhs.between(lower, upper)`](../expression_methods/trait.ExpressionMethods.html#method.between) -pub type Between = - super::operators::Between, AsExpr>>; - -/// The return type of -/// [`lhs.not_between(lower, upper)`](../expression_methods/trait.ExpressionMethods.html#method.not_between) -pub type NotBetween = super::operators::NotBetween< - Lhs, - super::operators::And, AsExpr>, ->; - -/// The return type of -/// [`expr.desc()`](../expression_methods/trait.ExpressionMethods.html#method.desc) -pub type Desc = super::operators::Desc; - -/// The return type of -/// [`expr.asc()`](../expression_methods/trait.ExpressionMethods.html#method.asc) -pub type Asc = super::operators::Asc; - -/// The return type of -/// [`expr.nullable()`](../expression_methods/trait.NullableExpressionMethods.html#method.nullable) -pub type Nullable = super::nullable::Nullable; - -/// The return type of -/// [`lhs.and(rhs)`](../expression_methods/trait.BoolExpressionMethods.html#method.and) -pub type And = super::operators::And>; - -/// The return type of -/// [`lhs.or(rhs)`](../expression_methods/trait.BoolExpressionMethods.html#method.or) -pub type Or = Grouped>>; - -/// The return type of -/// [`lhs.escape('x')`](../expression_methods/trait.EscapeExpressionMethods.html#method.escape) -pub type Escape = super::operators::Escape>; - -/// The return type of -/// [`lhs.like(rhs)`](../expression_methods/trait.TextExpressionMethods.html#method.like) -pub type Like = super::operators::Like>; - -/// The return type of -/// [`lhs.not_like(rhs)`](../expression_methods/trait.TextExpressionMethods.html#method.not_like) -pub type NotLike = super::operators::NotLike>; - -#[doc(inline)] -pub use super::functions::helper_types::*; diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/mod.rs deleted file mode 100644 index b6eba49d2..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/mod.rs +++ /dev/null @@ -1,369 +0,0 @@ -//! AST types representing various typed SQL expressions. -//! -//! Almost all types implement either [`Expression`](trait.Expression.html) or -//! [`AsExpression`](trait.AsExpression.html). -//! -//! The most common expression to work with is a -//! [`Column`](../query_source/trait.Column.html). There are various methods -//! that you can call on these, found in -//! [`expression_methods`](../expression_methods). -//! -//! You can also use numeric operators such as `+` on expressions of the -//! appropriate type. -//! -//! Any primitive which implements [`ToSql`](../serialize/trait.ToSql.html) will -//! also implement [`AsExpression`](trait.AsExpression.html), allowing it to be -//! used as an argument to any of the methods described here. -#[macro_use] -#[doc(hidden)] -pub mod ops; -#[doc(hidden)] -#[macro_use] -pub mod functions; - -#[doc(hidden)] -pub mod array_comparison; -#[doc(hidden)] -pub mod bound; -#[doc(hidden)] -pub mod coerce; -#[doc(hidden)] -pub mod count; -#[doc(hidden)] -pub mod exists; -#[doc(hidden)] -pub mod grouped; -#[doc(hidden)] -pub mod helper_types; -mod not; -#[doc(hidden)] -pub mod nullable; -#[doc(hidden)] -#[macro_use] -pub mod operators; -#[doc(hidden)] -pub mod sql_literal; -#[doc(hidden)] -pub mod subselect; - -#[doc(hidden)] -#[allow(non_camel_case_types)] -pub mod dsl { - use dsl::SqlTypeOf; - - #[doc(inline)] - pub use super::count::*; - #[doc(inline)] - pub use super::exists::exists; - #[doc(inline)] - pub use super::functions::aggregate_folding::*; - #[doc(inline)] - pub use super::functions::aggregate_ordering::*; - #[doc(inline)] - pub use super::functions::date_and_time::*; - #[doc(inline)] - pub use super::not::not; - #[doc(inline)] - pub use super::sql_literal::sql; - - #[cfg(feature = "postgres")] - pub use pg::expression::dsl::*; - - /// The return type of [`count(expr)`](../dsl/fn.count.html) - pub type count = super::count::count::HelperType, Expr>; - - /// The return type of [`count_star)(`](../dsl/fn.count_star.html) - pub type count_star = super::count::CountStar; - - /// The return type of [`date(expr)`](../dsl/fn.date.html) - pub type date = super::functions::date_and_time::date::HelperType; -} - -#[doc(inline)] -pub use self::sql_literal::{SqlLiteral, UncheckedBind}; - -use backend::Backend; -use dsl::AsExprOf; - -/// Represents a typed fragment of SQL. -/// -/// Apps should not need to implement this type directly, but it may be common -/// to use this in where clauses. Libraries should consider using -/// [`diesel_infix_operator!`](../macro.diesel_infix_operator.html) or -/// [`diesel_postfix_operator!`](../macro.diesel_postfix_operator.html) instead of -/// implementing this directly. -pub trait Expression { - /// The type that this expression represents in SQL - type SqlType; -} - -impl Expression for Box { - type SqlType = T::SqlType; -} - -impl<'a, T: Expression + ?Sized> Expression for &'a T { - type SqlType = T::SqlType; -} - -/// Converts a type to its representation for use in Diesel's query builder. -/// -/// This trait is used directly. Apps should typically use [`IntoSql`] instead. -/// -/// Implementations of this trait will generally do one of 3 things: -/// -/// - Return `self` for types which are already parts of Diesel's query builder -/// - Perform some implicit coercion (for example, allowing [`now`] to be used as -/// both [`Timestamp`] and [`Timestamptz`]. -/// - Indicate that the type has data which will be sent separately from the -/// query. This is generally referred as a "bind parameter". Types which -/// implement [`ToSql`] will generally implement `AsExpression` this way. -/// -/// [`IntoSql`]: trait.IntoSql.html -/// [`now`]: ../dsl/struct.now.html -/// [`Timestamp`]: ../sql_types/struct.Timestamp.html -/// [`Timestamptz`]: ../pg/types/sql_types/struct.Timestamptz.html -/// [`ToSql`]: ../serialize/trait.ToSql.html -/// -/// ## Deriving -/// -/// This trait can be automatically derived for any type which implements `ToSql`. -/// The type must be annotated with `#[sql_type = "SomeType"]`. -/// If that annotation appears multiple times, -/// implementations will be generated for each one of them. -/// -/// This will generate the following impls: -/// -/// - `impl AsExpression for YourType` -/// - `impl AsExpression> for YourType` -/// - `impl AsExpression for &'a YourType` -/// - `impl AsExpression> for &'a YourType` -/// - `impl AsExpression for &'a &'b YourType` -/// - `impl AsExpression> for &'a &'b YourType` -/// -/// If your type is unsized, -/// you can specify this by adding the annotation `#[diesel(not_sized)]`. -/// This will skip the impls for non-reference types. -pub trait AsExpression { - /// The expression being returned - type Expression: Expression; - - /// Perform the conversion - fn as_expression(self) -> Self::Expression; -} - -impl AsExpression for T { - type Expression = Self; - - fn as_expression(self) -> Self { - self - } -} - -/// Converts a type to its representation for use in Diesel's query builder. -/// -/// This trait only exists to make usage of `AsExpression` more ergonomic when -/// the `SqlType` cannot be inferred. It is generally used when you need to use -/// a Rust value as the left hand side of an expression, or when you want to -/// select a constant value. -/// -/// # Example -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # use schema::users; -/// # -/// # fn main() { -/// use diesel::sql_types::Text; -/// # let conn = establish_connection(); -/// let names = users::table -/// .select("The Amazing ".into_sql::().concat(users::name)) -/// .load(&conn); -/// let expected_names = vec![ -/// "The Amazing Sean".to_string(), -/// "The Amazing Tess".to_string(), -/// ]; -/// assert_eq!(Ok(expected_names), names); -/// # } -/// ``` -pub trait IntoSql { - /// Convert `self` to an expression for Diesel's query builder. - /// - /// There is no difference in behavior between `x.into_sql::()` and - /// `AsExpression::::as_expression(x)`. - fn into_sql(self) -> AsExprOf - where - Self: AsExpression + Sized, - { - self.as_expression() - } - - /// Convert `&self` to an expression for Diesel's query builder. - /// - /// There is no difference in behavior between `x.as_sql::()` and - /// `AsExpression::::as_expression(&x)`. - fn as_sql<'a, T>(&'a self) -> AsExprOf<&'a Self, T> - where - &'a Self: AsExpression, - { - self.as_expression() - } -} - -impl IntoSql for T {} - -/// Indicates that all elements of an expression are valid given a from clause. -/// -/// This is used to ensure that `users.filter(posts::id.eq(1))` fails to -/// compile. This constraint is only used in places where the nullability of a -/// SQL type doesn't matter (everything except `select` and `returning`). For -/// places where nullability is important, `SelectableExpression` is used -/// instead. -pub trait AppearsOnTable: Expression {} - -impl AppearsOnTable for Box -where - T: AppearsOnTable, - Box: Expression, -{ -} - -impl<'a, T: ?Sized, QS> AppearsOnTable for &'a T -where - T: AppearsOnTable, - &'a T: Expression, -{ -} - -/// Indicates that an expression can be selected from a source. -/// -/// Columns will implement this for their table. Certain special types, like -/// `CountStar` and `Bound` will implement this for all sources. Most compound -/// expressions will implement this if each of their parts implement it. -/// -/// Notably, columns will not implement this trait for the right side of a left -/// join. To select a column or expression using a column from the right side of -/// a left join, you must call `.nullable()` on it. -pub trait SelectableExpression: AppearsOnTable {} - -impl SelectableExpression for Box -where - T: SelectableExpression, - Box: AppearsOnTable, -{ -} - -impl<'a, T: ?Sized, QS> SelectableExpression for &'a T -where - T: SelectableExpression, - &'a T: AppearsOnTable, -{ -} - -/// Marker trait to indicate that an expression does not include any aggregate -/// functions. -/// -/// Used to ensure that aggregate expressions aren't mixed with -/// non-aggregate expressions in a select clause, and that they're never -/// included in a where clause. -pub trait NonAggregate {} - -impl NonAggregate for Box {} - -impl<'a, T: NonAggregate + ?Sized> NonAggregate for &'a T {} - -use query_builder::{QueryFragment, QueryId}; - -/// Helper trait used when boxing expressions. -/// -/// In Rust you cannot create a trait object with more than one trait. -/// This type has all of the additional traits you would want when using -/// `Box` as a single trait object. -/// -/// This is typically used as the return type of a function. -/// For cases where you want to dynamically construct a query, -/// [boxing the query] is usually more ergonomic. -/// -/// [boxing the query]: ../query_dsl/trait.QueryDsl.html#method.into_boxed -/// -/// # Examples -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # use schema::users; -/// use diesel::sql_types::Bool; -/// -/// # fn main() { -/// # run_test().unwrap(); -/// # } -/// # -/// # fn run_test() -> QueryResult<()> { -/// # let conn = establish_connection(); -/// enum Search { -/// Id(i32), -/// Name(String), -/// } -/// -/// # /* -/// type DB = diesel::sqlite::Sqlite; -/// # */ -/// -/// fn find_user(search: Search) -> Box> { -/// match search { -/// Search::Id(id) => Box::new(users::id.eq(id)), -/// Search::Name(name) => Box::new(users::name.eq(name)), -/// } -/// } -/// -/// let user_one = users::table -/// .filter(find_user(Search::Id(1))) -/// .first(&conn)?; -/// assert_eq!((1, String::from("Sean")), user_one); -/// -/// let tess = users::table -/// .filter(find_user(Search::Name("Tess".into()))) -/// .first(&conn)?; -/// assert_eq!((2, String::from("Tess")), tess); -/// # Ok(()) -/// # } -/// ``` -pub trait BoxableExpression -where - DB: Backend, - Self: Expression, - Self: SelectableExpression, - Self: NonAggregate, - Self: QueryFragment, -{ -} - -impl BoxableExpression for T -where - DB: Backend, - T: Expression, - T: SelectableExpression, - T: NonAggregate, - T: QueryFragment, -{ -} - -impl<'a, QS, ST, DB> QueryId for dyn BoxableExpression + 'a { - type QueryId = (); - - const HAS_STATIC_QUERY_ID: bool = false; -} - -/// Converts a tuple of values into a tuple of Diesel expressions. -/// -/// This trait is similar to [`AsExpression`], but it operates on tuples. -/// The expressions must all be of the same SQL type. -/// -/// [`AsExpression`]: trait.AsExpression.html -pub trait AsExpressionList { - /// The final output expression - type Expression; - - /// Perform the conversion - fn as_expression_list(self) -> Self::Expression; -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/not.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/not.rs deleted file mode 100644 index 770a10175..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/not.rs +++ /dev/null @@ -1,29 +0,0 @@ -use expression::grouped::Grouped; -use expression::AsExpression; -use helper_types::not; -use sql_types::Bool; - -/// Creates a SQL `NOT` expression -/// -/// # Example -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # -/// # fn main() { -/// # use schema::users::dsl::*; -/// # let connection = establish_connection(); -/// use diesel::dsl::not; -/// -/// let users_with_name = users.select(id).filter(name.eq("Sean")); -/// let users_not_with_name = users.select(id).filter( -/// not(name.eq("Sean"))); -/// -/// assert_eq!(Ok(1), users_with_name.first(&connection)); -/// assert_eq!(Ok(2), users_not_with_name.first(&connection)); -/// # } -/// ``` -pub fn not>(expr: T) -> not { - super::operators::Not::new(Grouped(expr.as_expression())) -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/nullable.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/nullable.rs deleted file mode 100644 index 8396425af..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/nullable.rs +++ /dev/null @@ -1,63 +0,0 @@ -use backend::Backend; -use expression::*; -use query_builder::*; -use query_source::Table; -use result::QueryResult; -use sql_types::IntoNullable; - -#[derive(Debug, Copy, Clone, DieselNumericOps)] -pub struct Nullable(T); - -impl Nullable { - pub fn new(expr: T) -> Self { - Nullable(expr) - } -} - -impl Expression for Nullable -where - T: Expression, - ::SqlType: IntoNullable, -{ - type SqlType = <::SqlType as IntoNullable>::Nullable; -} - -impl QueryFragment for Nullable -where - DB: Backend, - T: QueryFragment, -{ - fn walk_ast(&self, pass: AstPass) -> QueryResult<()> { - self.0.walk_ast(pass) - } -} - -/// Nullable can be used in where clauses everywhere, but can only be used in -/// select clauses for outer joins. -impl AppearsOnTable for Nullable -where - T: AppearsOnTable, - Nullable: Expression, -{ -} - -impl QueryId for Nullable { - type QueryId = T::QueryId; - - const HAS_STATIC_QUERY_ID: bool = T::HAS_STATIC_QUERY_ID; -} - -impl NonAggregate for Nullable -where - T: NonAggregate, - Nullable: Expression, -{ -} - -impl SelectableExpression for Nullable -where - Self: AppearsOnTable, - T: SelectableExpression, - QS: Table, -{ -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/operators.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/operators.rs deleted file mode 100644 index 1bf599652..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/operators.rs +++ /dev/null @@ -1,386 +0,0 @@ -#![cfg_attr(rustfmt, rustfmt_skip)] // https://github.com/rust-lang-nursery/rustfmt/issues/2755 - -#[macro_export] -#[doc(hidden)] -macro_rules! __diesel_operator_body { - ( - notation = $notation:ident, - struct_name = $name:ident, - operator = $operator:expr, - return_ty = ReturnBasedOnArgs, - ty_params = ($($ty_param:ident,)+), - field_names = $field_names:tt, - backend_ty_params = $backend_ty_params:tt, - backend_ty = $backend_ty:ty, - ) => { - __diesel_operator_body! { - notation = $notation, - struct_name = $name, - operator = $operator, - return_ty = ST, - ty_params = ($($ty_param,)+), - field_names = $field_names, - backend_ty_params = $backend_ty_params, - backend_ty = $backend_ty, - expression_ty_params = (ST,), - expression_bounds = ($($ty_param: $crate::expression::Expression,)+), - } - }; - - ( - notation = $notation:ident, - struct_name = $name:ident, - operator = $operator:expr, - return_ty = $return_ty:ty, - ty_params = ($($ty_param:ident,)+), - field_names = $field_names:tt, - backend_ty_params = $backend_ty_params:tt, - backend_ty = $backend_ty:ty, - ) => { - __diesel_operator_body! { - notation = $notation, - struct_name = $name, - operator = $operator, - return_ty = $return_ty, - ty_params = ($($ty_param,)+), - field_names = $field_names, - backend_ty_params = $backend_ty_params, - backend_ty = $backend_ty, - expression_ty_params = (), - expression_bounds = ($($ty_param: $crate::expression::Expression,)+), - } - }; - - ( - notation = $notation:ident, - struct_name = $name:ident, - operator = $operator:expr, - return_ty = $return_ty:ty, - ty_params = ($($ty_param:ident,)+), - field_names = ($($field_name:ident,)+), - backend_ty_params = ($($backend_ty_param:ident,)*), - backend_ty = $backend_ty:ty, - expression_ty_params = ($($expression_ty_params:ident,)*), - expression_bounds = ($($expression_bounds:tt)*), - ) => { - #[derive(Debug, Clone, Copy, QueryId, DieselNumericOps)] - #[doc(hidden)] - pub struct $name<$($ty_param,)+> { - $(pub(crate) $field_name: $ty_param,)+ - } - - impl<$($ty_param,)+> $name<$($ty_param,)+> { - pub fn new($($field_name: $ty_param,)+) -> Self { - $name { $($field_name,)+ } - } - } - - impl_selectable_expression!($name<$($ty_param),+>); - - impl<$($ty_param,)+ $($expression_ty_params,)*> $crate::expression::Expression for $name<$($ty_param,)+> where - $($expression_bounds)* - { - type SqlType = $return_ty; - } - - impl<$($ty_param,)+> $crate::expression::NonAggregate for $name<$($ty_param,)+> where - $($ty_param: $crate::expression::NonAggregate,)+ - { - } - - impl<$($ty_param,)+ $($backend_ty_param,)*> $crate::query_builder::QueryFragment<$backend_ty> - for $name<$($ty_param,)+> where - $($ty_param: $crate::query_builder::QueryFragment<$backend_ty>,)+ - $($backend_ty_param: $crate::backend::Backend,)* - { - fn walk_ast(&self, mut out: $crate::query_builder::AstPass<$backend_ty>) -> $crate::result::QueryResult<()> { - __diesel_operator_to_sql!( - notation = $notation, - operator_expr = out.push_sql($operator), - field_exprs = ($(self.$field_name.walk_ast(out.reborrow())?),+), - ); - Ok(()) - } - } - } -} - -#[macro_export] -#[doc(hidden)] -macro_rules! __diesel_operator_to_sql { - ( - notation = infix, - operator_expr = $op:expr, - field_exprs = ($left:expr, $right:expr), - ) => { - $left; - $op; - $right; - }; - - ( - notation = postfix, - operator_expr = $op:expr, - field_exprs = ($expr:expr), - ) => { - $expr; - $op; - }; - - ( - notation = prefix, - operator_expr = $op:expr, - field_exprs = ($expr:expr), - ) => { - $op; - $expr; - }; -} - -/// Useful for libraries adding support for new SQL types. Apps should never -/// need to call this. -/// -/// This will create a new type with the given name. It will implement all -/// methods needed to be used as an expression in Diesel, placing the given -/// SQL between the two elements. The third argument specifies the SQL type -/// that the operator returns. If it is not given, the type will be assumed -/// to be `Bool`. -/// -/// If the operator is specific to a single backend, you can specify this by -/// adding `backend: Pg` or similar as the last argument. -/// -/// It should be noted that the generated impls will not constrain the SQL -/// types of the arguments. You should ensure that they are of the right -/// type in your function which constructs the operator. -/// -/// Typically you would not expose the type that this generates directly. You'd -/// expose a function (or trait) used to construct the expression, and a helper -/// type which represents the return type of that function. See the source of -/// `diesel::expression::expression_methods` and -/// `diesel::expression::helper_types` for real world examples of this. -/// -/// # Examples -/// -/// # Possible invocations -/// -/// ```ignore -/// // The SQL type will be boolean. The backend will not be constrained -/// diesel_infix_operator!(Matches, " @@ "); -/// -/// // Queries which try to execute `Contains` on a backend other than Pg -/// // will fail to compile -/// diesel_infix_operator!(Contains, " @> ", backend: Pg); -/// -/// // The type of `Concat` will be `TsVector` rather than Bool -/// diesel_infix_operator!(Concat, " || ", TsVector); -/// -/// // It is perfectly fine to have multiple operators with the same SQL. -/// // Diesel will ensure that the queries are always unambiguous in which -/// // operator applies -/// diesel_infix_operator!(Or, " || ", TsQuery); -/// -/// // Specifying both the return types and the backend -/// diesel_infix_operator!(And, " && ", TsQuery, backend: Pg); -/// ``` -/// -/// ## Example usage -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # -/// # fn main() { -/// # use schema::users::dsl::*; -/// # let connection = establish_connection(); -/// diesel_infix_operator!(MyEq, " = "); -/// -/// use diesel::expression::AsExpression; -/// -/// // Normally you would put this on a trait instead -/// fn my_eq(left: T, right: U) -> MyEq where -/// T: Expression, -/// U: AsExpression, -/// { -/// MyEq::new(left, right.as_expression()) -/// } -/// -/// let users_with_name = users.select(id).filter(my_eq(name, "Sean")); -/// -/// assert_eq!(Ok(1), users_with_name.first(&connection)); -/// # } -/// ``` -#[macro_export] -macro_rules! diesel_infix_operator { - ($name:ident, $operator:expr) => { - diesel_infix_operator!($name, $operator, $crate::sql_types::Bool); - }; - - ($name:ident, $operator:expr, backend: $backend:ty) => { - diesel_infix_operator!($name, $operator, $crate::sql_types::Bool, backend: $backend); - }; - - ($name:ident, $operator:expr, $($return_ty:tt)::*) => { - __diesel_operator_body!( - notation = infix, - struct_name = $name, - operator = $operator, - return_ty = $($return_ty)::*, - ty_params = (T, U,), - field_names = (left, right,), - backend_ty_params = (DB,), - backend_ty = DB, - ); - }; - - ($name:ident, $operator:expr, $return_ty:ty, backend: $backend:ty) => { - __diesel_operator_body!( - notation = infix, - struct_name = $name, - operator = $operator, - return_ty = $return_ty, - ty_params = (T, U,), - field_names = (left, right,), - backend_ty_params = (), - backend_ty = $backend, - ); - }; -} - -/// Useful for libraries adding support for new SQL types. Apps should never -/// need to call this. -/// -/// Similar to [`diesel_infix_operator!`], but the generated type will only take -/// a single argument rather than two. The operator SQL will be placed after -/// the single argument. See [`diesel_infix_operator!`] for example usage. -/// -/// [`diesel_infix_operator!`]: macro.diesel_infix_operator.html -#[macro_export] -macro_rules! diesel_postfix_operator { - ($name:ident, $operator:expr) => { - diesel_postfix_operator!($name, $operator, $crate::sql_types::Bool); - }; - - ($name:ident, $operator:expr, backend: $backend:ty) => { - diesel_postfix_operator!($name, $operator, $crate::sql_types::Bool, backend: $backend); - }; - - ($name:ident, $operator:expr, $return_ty:ty) => { - __diesel_operator_body!( - notation = postfix, - struct_name = $name, - operator = $operator, - return_ty = $return_ty, - ty_params = (Expr,), - field_names = (expr,), - backend_ty_params = (DB,), - backend_ty = DB, - ); - }; - - ($name:ident, $operator:expr, $return_ty:ty, backend: $backend:ty) => { - __diesel_operator_body!( - notation = postfix, - struct_name = $name, - operator = $operator, - return_ty = $return_ty, - ty_params = (Expr,), - field_names = (expr,), - backend_ty_params = (), - backend_ty = $backend, - ); - }; -} - -/// Useful for libraries adding support for new SQL types. Apps should never -/// need to call this. -/// -/// Similar to [`diesel_infix_operator!`], but the generated type will only take -/// a single argument rather than two. The operator SQL will be placed before -/// the single argument. See [`diesel_infix_operator!`] for example usage. -/// -/// [`diesel_infix_operator!`]: macro.diesel_infix_operator.html -#[macro_export] -macro_rules! diesel_prefix_operator { - ($name:ident, $operator:expr) => { - diesel_prefix_operator!($name, $operator, $crate::sql_types::Bool); - }; - - ($name:ident, $operator:expr, backend: $backend:ty) => { - diesel_prefix_operator!($name, $operator, $crate::sql_types::Bool, backend: $backend); - }; - - ($name:ident, $operator:expr, $return_ty:ty) => { - __diesel_operator_body!( - notation = prefix, - struct_name = $name, - operator = $operator, - return_ty = $return_ty, - ty_params = (Expr,), - field_names = (expr,), - backend_ty_params = (DB,), - backend_ty = DB, - ); - }; - - ($name:ident, $operator:expr, $return_ty:ty, backend: $backend:ty) => { - __diesel_operator_body!( - notation = prefix, - struct_name = $name, - operator = $operator, - return_ty = $return_ty, - ty_params = (Expr,), - field_names = (expr,), - backend_ty_params = (), - backend_ty = $backend, - ); - }; -} - -diesel_infix_operator!(Concat, " || ", ReturnBasedOnArgs); -diesel_infix_operator!(And, " AND "); -diesel_infix_operator!(Between, " BETWEEN "); -diesel_infix_operator!(Escape, " ESCAPE "); -diesel_infix_operator!(Eq, " = "); -diesel_infix_operator!(Gt, " > "); -diesel_infix_operator!(GtEq, " >= "); -diesel_infix_operator!(Like, " LIKE "); -diesel_infix_operator!(Lt, " < "); -diesel_infix_operator!(LtEq, " <= "); -diesel_infix_operator!(NotBetween, " NOT BETWEEN "); -diesel_infix_operator!(NotEq, " != "); -diesel_infix_operator!(NotLike, " NOT LIKE "); -diesel_infix_operator!(Or, " OR "); - -diesel_postfix_operator!(IsNull, " IS NULL"); -diesel_postfix_operator!(IsNotNull, " IS NOT NULL"); -diesel_postfix_operator!(Asc, " ASC", ()); -diesel_postfix_operator!(Desc, " DESC", ()); - -diesel_prefix_operator!(Not, "NOT "); - -use insertable::{ColumnInsertValue, Insertable}; -use query_builder::ValuesClause; -use query_source::Column; - -impl Insertable for Eq -where - T: Column, -{ - type Values = ValuesClause, T::Table>; - - fn values(self) -> Self::Values { - ValuesClause::new(ColumnInsertValue::Expression(self.left, self.right)) - } -} - -impl<'a, T, Tab, U> Insertable for &'a Eq -where - T: Copy, - Eq: Insertable, -{ - type Values = as Insertable>::Values; - - fn values(self) -> Self::Values { - Eq::new(self.left, &self.right).values() - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/ops/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/ops/mod.rs deleted file mode 100644 index eea4aa4ac..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/ops/mod.rs +++ /dev/null @@ -1,30 +0,0 @@ -macro_rules! generic_numeric_expr_inner { - ($tpe: ident, ($($param: ident),*), $op: ident, $fn_name: ident) => { - impl ::std::ops::$op for $tpe<$($param),*> where - $tpe<$($param),*>: $crate::expression::Expression, - <$tpe<$($param),*> as $crate::Expression>::SqlType: $crate::sql_types::ops::$op, - Rhs: $crate::expression::AsExpression< - <<$tpe<$($param),*> as $crate::Expression>::SqlType as $crate::sql_types::ops::$op>::Rhs, - >, - { - type Output = $crate::expression::ops::$op; - - fn $fn_name(self, rhs: Rhs) -> Self::Output { - $crate::expression::ops::$op::new(self, rhs.as_expression()) - } - } - } -} - -macro_rules! generic_numeric_expr { - ($tpe: ident, $($param: ident),*) => { - generic_numeric_expr_inner!($tpe, ($($param),*), Add, add); - generic_numeric_expr_inner!($tpe, ($($param),*), Sub, sub); - generic_numeric_expr_inner!($tpe, ($($param),*), Div, div); - generic_numeric_expr_inner!($tpe, ($($param),*), Mul, mul); - } -} - -mod numeric; - -pub use self::numeric::{Add, Div, Mul, Sub}; diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/ops/numeric.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/ops/numeric.rs deleted file mode 100644 index 8bdf37bf0..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/ops/numeric.rs +++ /dev/null @@ -1,66 +0,0 @@ -use backend::Backend; -use expression::{Expression, NonAggregate}; -use query_builder::*; -use result::QueryResult; -use sql_types; - -macro_rules! numeric_operation { - ($name:ident, $op:expr) => { - #[derive(Debug, Copy, Clone, QueryId)] - pub struct $name { - lhs: Lhs, - rhs: Rhs, - } - - impl $name { - pub fn new(left: Lhs, right: Rhs) -> Self { - $name { - lhs: left, - rhs: right, - } - } - } - - impl Expression for $name - where - Lhs: Expression, - Lhs::SqlType: sql_types::ops::$name, - Rhs: Expression, - { - type SqlType = ::Output; - } - - impl QueryFragment for $name - where - DB: Backend, - Lhs: QueryFragment, - Rhs: QueryFragment, - { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql("("); - self.lhs.walk_ast(out.reborrow())?; - out.push_sql($op); - self.rhs.walk_ast(out.reborrow())?; - out.push_sql(")"); - Ok(()) - } - } - - impl_selectable_expression!($name); - - impl NonAggregate for $name - where - Lhs: NonAggregate, - Rhs: NonAggregate, - $name: Expression, - { - } - - generic_numeric_expr!($name, A, B); - }; -} - -numeric_operation!(Add, " + "); -numeric_operation!(Sub, " - "); -numeric_operation!(Mul, " * "); -numeric_operation!(Div, " / "); diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/sql_literal.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/sql_literal.rs deleted file mode 100644 index ceca142bd..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/sql_literal.rs +++ /dev/null @@ -1,334 +0,0 @@ -use std::marker::PhantomData; - -use backend::Backend; -use expression::*; -use query_builder::*; -use query_dsl::RunQueryDsl; -use result::QueryResult; - -#[derive(Debug, Clone, DieselNumericOps)] -#[must_use = "Queries are only executed when calling `load`, `get_result`, or similar."] -/// Returned by the [`sql()`] function. -/// -/// [`sql()`]: ../dsl/fn.sql.html -pub struct SqlLiteral { - sql: String, - inner: T, - _marker: PhantomData, -} - -impl SqlLiteral { - #[doc(hidden)] - pub fn new(sql: String, inner: T) -> Self { - SqlLiteral { - sql: sql, - inner: inner, - _marker: PhantomData, - } - } - - /// Bind a value for use with this SQL query. - /// - /// # Safety - /// - /// This function should be used with care, as Diesel cannot validate that - /// the value is of the right type nor can it validate that you have passed - /// the correct number of parameters. - /// - /// # Examples - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # table! { - /// # users { - /// # id -> Integer, - /// # name -> VarChar, - /// # } - /// # } - /// # - /// # fn main() { - /// # use self::users::dsl::*; - /// # use diesel::dsl::sql; - /// # use diesel::sql_types::{Integer, Text}; - /// # let connection = establish_connection(); - /// let seans_id = users - /// .select(id) - /// .filter(sql("name = ").bind::("Sean")) - /// .get_result(&connection); - /// assert_eq!(Ok(1), seans_id); - /// - /// let tess_id = sql::("SELECT id FROM users WHERE name = ") - /// .bind::("Tess") - /// .get_result(&connection); - /// assert_eq!(Ok(2), tess_id); - /// # } - /// ``` - /// - /// ### Multiple Bind Params - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// - /// # table! { - /// # users { - /// # id -> Integer, - /// # name -> VarChar, - /// # } - /// # } - /// # - /// # fn main() { - /// # use self::users::dsl::*; - /// # use diesel::dsl::sql; - /// # use diesel::sql_types::{Integer, Text}; - /// # let connection = establish_connection(); - /// # diesel::insert_into(users).values(name.eq("Ryan")) - /// # .execute(&connection).unwrap(); - /// let query = users - /// .select(name) - /// .filter( - /// sql("id > ") - /// .bind::(1) - /// .sql(" AND name <> ") - /// .bind::("Ryan") - /// ) - /// .get_results(&connection); - /// let expected = vec!["Tess".to_string()]; - /// assert_eq!(Ok(expected), query); - /// # } - /// ``` - pub fn bind(self, bind_value: U) -> UncheckedBind - where - U: AsExpression, - { - UncheckedBind::new(self, bind_value.as_expression()) - } - - /// Use literal SQL in the query builder - /// - /// This function is intended for use when you need a small bit of raw SQL in - /// your query. If you want to write the entire query using raw SQL, use - /// [`sql_query`](../fn.sql_query.html) instead. - /// - /// # Safety - /// - /// This function should be used with care, as Diesel cannot validate that - /// the value is of the right type nor can it validate that you have passed - /// the correct number of parameters. - /// - /// # Examples - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// - /// # table! { - /// # users { - /// # id -> Integer, - /// # name -> VarChar, - /// # } - /// # } - /// # - /// # fn main() { - /// # use self::users::dsl::*; - /// # use diesel::dsl::sql; - /// # use diesel::sql_types::{Integer, Text}; - /// # let connection = establish_connection(); - /// # diesel::insert_into(users).values(name.eq("Ryan")) - /// # .execute(&connection).unwrap(); - /// let query = users - /// .select(name) - /// .filter( - /// sql("id > 1") - /// .sql(" AND name <> 'Ryan'") - /// ) - /// .get_results(&connection); - /// let expected = vec!["Tess".to_string()]; - /// assert_eq!(Ok(expected), query); - /// # } - /// ``` - pub fn sql(self, sql: &str) -> SqlLiteral { - SqlLiteral::new(sql.into(), self) - } -} - -impl Expression for SqlLiteral { - type SqlType = ST; -} - -impl QueryFragment for SqlLiteral -where - DB: Backend, - T: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.unsafe_to_cache_prepared(); - self.inner.walk_ast(out.reborrow())?; - out.push_sql(&self.sql); - Ok(()) - } -} - -impl QueryId for SqlLiteral { - type QueryId = (); - - const HAS_STATIC_QUERY_ID: bool = false; -} - -impl Query for SqlLiteral { - type SqlType = ST; -} - -impl RunQueryDsl for SqlLiteral {} - -impl SelectableExpression for SqlLiteral {} - -impl AppearsOnTable for SqlLiteral {} - -impl NonAggregate for SqlLiteral {} - -/// Use literal SQL in the query builder -/// -/// Available for when you truly cannot represent something using the expression -/// DSL. You will need to provide the SQL type of the expression, in addition to -/// the SQL. -/// -/// This function is intended for use when you need a small bit of raw SQL in -/// your query. If you want to write the entire query using raw SQL, use -/// [`sql_query`](../fn.sql_query.html) instead. -/// -/// # Safety -/// -/// The compiler will be unable to verify the correctness of the annotated type. -/// If you give the wrong type, it'll either return an error when deserializing -/// the query result or produce unexpected values. -/// -/// # Examples -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # fn main() { -/// # run_test().unwrap(); -/// # } -/// # -/// # fn run_test() -> QueryResult<()> { -/// # use schema::users::dsl::*; -/// use diesel::dsl::sql; -/// # let connection = establish_connection(); -/// let user = users.filter(sql("name = 'Sean'")).first(&connection)?; -/// let expected = (1, String::from("Sean")); -/// assert_eq!(expected, user); -/// # Ok(()) -/// # } -/// ``` -pub fn sql(sql: &str) -> SqlLiteral { - SqlLiteral::new(sql.into(), ()) -} - -#[derive(QueryId, Debug, Clone, Copy)] -#[must_use = "Queries are only executed when calling `load`, `get_result`, or similar."] -/// Returned by the [`SqlLiteral::bind()`] method when binding a value to a fragment of SQL. -/// -/// [`bind()`]: ./struct.SqlLiteral.html#method.bind -pub struct UncheckedBind { - query: Query, - value: Value, -} - -impl UncheckedBind -where - Query: Expression, -{ - pub(crate) fn new(query: Query, value: Value) -> Self { - UncheckedBind { query, value } - } - - /// Use literal SQL in the query builder - /// - /// This function is intended for use when you need a small bit of raw SQL in - /// your query. If you want to write the entire query using raw SQL, use - /// [`sql_query`](../fn.sql_query.html) instead. - /// - /// # Safety - /// - /// This function should be used with care, as Diesel cannot validate that - /// the value is of the right type nor can it validate that you have passed - /// the correct number of parameters. - /// - /// # Examples - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// - /// # table! { - /// # users { - /// # id -> Integer, - /// # name -> VarChar, - /// # } - /// # } - /// # - /// # fn main() { - /// # use self::users::dsl::*; - /// # use diesel::dsl::sql; - /// # use diesel::sql_types::{Integer, Text}; - /// # let connection = establish_connection(); - /// # diesel::insert_into(users).values(name.eq("Ryan")) - /// # .execute(&connection).unwrap(); - /// let query = users - /// .select(name) - /// .filter( - /// sql("id > ") - /// .bind::(1) - /// .sql(" AND name <> 'Ryan'") - /// ) - /// .get_results(&connection); - /// let expected = vec!["Tess".to_string()]; - /// assert_eq!(Ok(expected), query); - /// # } - /// ``` - pub fn sql(self, sql: &str) -> SqlLiteral { - SqlLiteral::new(sql.into(), self) - } -} - -impl Expression for UncheckedBind -where - Query: Expression, -{ - type SqlType = Query::SqlType; -} - -impl QueryFragment for UncheckedBind -where - DB: Backend, - Query: QueryFragment, - Value: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - self.query.walk_ast(out.reborrow())?; - self.value.walk_ast(out.reborrow())?; - Ok(()) - } -} - -impl Query for UncheckedBind -where - Q: Query, -{ - type SqlType = Q::SqlType; -} - -impl NonAggregate for UncheckedBind where Self: Expression {} - -impl SelectableExpression for UncheckedBind where - Self: AppearsOnTable -{ -} - -impl AppearsOnTable for UncheckedBind where Self: Expression {} - -impl RunQueryDsl for UncheckedBind {} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression/subselect.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression/subselect.rs deleted file mode 100644 index 4a4e64ba4..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression/subselect.rs +++ /dev/null @@ -1,60 +0,0 @@ -use std::marker::PhantomData; - -use expression::array_comparison::MaybeEmpty; -use expression::*; -use query_builder::*; -use result::QueryResult; - -#[derive(Debug, Copy, Clone, QueryId)] -pub struct Subselect { - values: T, - _sql_type: PhantomData, -} - -impl Subselect { - pub(crate) fn new(values: T) -> Self { - Self { - values, - _sql_type: PhantomData, - } - } -} - -impl Expression for Subselect { - type SqlType = ST; -} - -impl MaybeEmpty for Subselect { - fn is_empty(&self) -> bool { - false - } -} - -impl SelectableExpression for Subselect -where - Subselect: AppearsOnTable, - T: ValidSubselect, -{ -} - -impl AppearsOnTable for Subselect -where - Subselect: Expression, - T: ValidSubselect, -{ -} - -impl NonAggregate for Subselect {} - -impl QueryFragment for Subselect -where - DB: Backend, - T: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - self.values.walk_ast(out.reborrow())?; - Ok(()) - } -} - -pub trait ValidSubselect {} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression_methods/bool_expression_methods.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression_methods/bool_expression_methods.rs deleted file mode 100644 index 0b51dff5d..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression_methods/bool_expression_methods.rs +++ /dev/null @@ -1,87 +0,0 @@ -use expression::grouped::Grouped; -use expression::operators::{And, Or}; -use expression::{AsExpression, Expression}; -use sql_types::Bool; - -/// Methods present on boolean expressions -pub trait BoolExpressionMethods: Expression + Sized { - /// Creates a SQL `AND` expression - /// - /// # Example - /// - /// ``` - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::animals::dsl::*; - /// # let connection = establish_connection(); - /// # - /// diesel::insert_into(animals) - /// .values(&vec![ - /// (species.eq("ferret"), legs.eq(4), name.eq("Freddy")), - /// (species.eq("ferret"), legs.eq(4), name.eq("Jack")), - /// ]) - /// .execute(&connection)?; - /// - /// let data = animals.select((species, name)) - /// .filter(species.eq("ferret").and(name.eq("Jack"))) - /// .load(&connection)?; - /// let expected = vec![ - /// (String::from("ferret"), Some(String::from("Jack"))), - /// ]; - /// assert_eq!(expected, data); - /// # Ok(()) - /// # } - fn and>(self, other: T) -> And { - And::new(self.as_expression(), other.as_expression()) - } - - /// Creates a SQL `OR` expression - /// - /// The result will be wrapped in parenthesis, so that precedence matches - /// that of your function calls. For example, `false.and(false.or(true))` - /// will generate the SQL `FALSE AND (FALSE OR TRUE)`, which returns `false` - /// - /// # Example - /// - /// ``` - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::animals::dsl::*; - /// # let connection = establish_connection(); - /// # - /// diesel::insert_into(animals) - /// .values(&vec![ - /// (species.eq("ferret"), legs.eq(4), name.eq("Freddy")), - /// (species.eq("ferret"), legs.eq(4), name.eq("Jack")), - /// ]) - /// .execute(&connection)?; - /// - /// let data = animals.select((species, name)) - /// .filter(species.eq("ferret").or(name.eq("Jack"))) - /// .load(&connection)?; - /// let expected = vec![ - /// (String::from("dog"), Some(String::from("Jack"))), - /// (String::from("ferret"), Some(String::from("Freddy"))), - /// (String::from("ferret"), Some(String::from("Jack"))), - /// ]; - /// assert_eq!(expected, data); - /// # Ok(()) - /// # } - fn or>(self, other: T) -> Grouped> { - Grouped(Or::new(self, other.as_expression())) - } -} - -impl> BoolExpressionMethods for T {} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression_methods/eq_all.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression_methods/eq_all.rs deleted file mode 100644 index 7fcd101a6..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression_methods/eq_all.rs +++ /dev/null @@ -1,71 +0,0 @@ -use expression::operators::And; -use expression::Expression; -use expression_methods::*; -use sql_types::Bool; - -/// This method is used by `FindDsl` to work with tuples. Because we cannot -/// express this without specialization or overlapping impls, it is brute force -/// implemented on columns in the `column!` macro. -#[doc(hidden)] -pub trait EqAll { - type Output: Expression; - - fn eq_all(self, rhs: Rhs) -> Self::Output; -} - -macro_rules! impl_eq_all { - // General case for 2+ elements - ( - ($Left1:ident, $($Left:ident,)+) - ($Right1:ident, $($Right:ident,)+) - ) => { - #[allow(non_snake_case)] - impl<$Left1, $($Left,)+ $Right1, $($Right,)+> - EqAll<($Right1, $($Right,)+)> for ($Left1, $($Left,)+) - where - $Left1: EqAll<$Right1>, - ($($Left,)+): EqAll<($($Right,)+)>, - { - type Output = And< - <$Left1 as EqAll<$Right1>>::Output, - <($($Left,)+) as EqAll<($($Right,)+)>>::Output, - >; - - fn eq_all(self, rhs: ($Right1, $($Right,)+)) -> Self::Output { - let ($Left1, $($Left,)+) = self; - let ($Right1, $($Right,)+) = rhs; - $Left1.eq_all($Right1).and(($($Left,)+).eq_all(($($Right,)+))) - } - } - }; - - // Special case for 1 element - ( - ($Left:ident,) ($Right:ident,) - ) => { - impl<$Left, $Right> EqAll<($Right,)> for ($Left,) - where - $Left: EqAll<$Right>, - { - type Output = <$Left as EqAll<$Right>>::Output; - - fn eq_all(self, rhs: ($Right,)) -> Self::Output { - self.0.eq_all(rhs.0) - } - } - }; -} - -macro_rules! impl_eq_all_for_all_tuples { - ($( - $unused1:tt { - $($unused2:tt -> $Left:ident, $Right:ident, $unused3:tt,)+ - } - )+) => { - $( - impl_eq_all!(($($Left,)+) ($($Right,)+)); - )+ - }; -} - -__diesel_for_each_tuple!(impl_eq_all_for_all_tuples); diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression_methods/escape_expression_methods.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression_methods/escape_expression_methods.rs deleted file mode 100644 index 58a4fc26e..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression_methods/escape_expression_methods.rs +++ /dev/null @@ -1,43 +0,0 @@ -use dsl::AsExprOf; -use expression::operators::{Escape, Like, NotLike}; -use expression::IntoSql; -use sql_types::VarChar; - -/// Adds the `escape` method to `LIKE` and `NOT LIKE`. This is used to specify -/// the escape character for the pattern. -/// -/// By default, the escape character is `\` on most backends. On SQLite, -/// there is no default escape character. -/// -/// # Example -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # -/// # fn main() { -/// # use schema::users::dsl::*; -/// # use diesel::insert_into; -/// # let connection = establish_connection(); -/// # insert_into(users).values(name.eq("Ha%%0r")) -/// # .execute(&connection).unwrap(); -/// let users_with_percent = users.select(name) -/// .filter(name.like("%😀%%").escape('😀')) -/// .load(&connection); -/// let users_without_percent = users.select(name) -/// .filter(name.not_like("%a%%").escape('a')) -/// .load(&connection); -/// assert_eq!(Ok(vec![String::from("Ha%%0r")]), users_with_percent); -/// assert_eq!(Ok(vec![String::from("Sean"), String::from("Tess")]), users_without_percent); -/// # } -/// ``` -pub trait EscapeExpressionMethods: Sized { - /// See the trait documentation. - fn escape(self, character: char) -> Escape> { - Escape::new(self, character.to_string().into_sql::()) - } -} - -impl EscapeExpressionMethods for Like {} - -impl EscapeExpressionMethods for NotLike {} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression_methods/global_expression_methods.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression_methods/global_expression_methods.rs deleted file mode 100644 index 156887151..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression_methods/global_expression_methods.rs +++ /dev/null @@ -1,479 +0,0 @@ -use expression::array_comparison::{AsInExpression, In, NotIn}; -use expression::operators::*; -use expression::{nullable, AsExpression, Expression}; -use sql_types::SingleValue; - -/// Methods present on all expressions, except tuples -pub trait ExpressionMethods: Expression + Sized { - /// Creates a SQL `=` expression. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// let data = users.select(id).filter(name.eq("Sean")); - /// assert_eq!(Ok(1), data.first(&connection)); - /// # } - /// ``` - fn eq>(self, other: T) -> Eq { - Eq::new(self, other.as_expression()) - } - - /// Creates a SQL `!=` expression. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// let data = users.select(id).filter(name.ne("Sean")); - /// assert_eq!(Ok(2), data.first(&connection)); - /// # } - /// ``` - fn ne>(self, other: T) -> NotEq { - NotEq::new(self, other.as_expression()) - } - - /// Creates a SQL `IN` statement. - /// - /// Queries using this method will not be - /// placed in the prepared statement cache. On PostgreSQL, you should use - /// `eq(any())` instead. This method may change in the future to - /// automatically perform `= ANY` on PostgreSQL. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// # connection.execute("INSERT INTO users (name) VALUES - /// # ('Jim')").unwrap(); - /// let data = users.select(id).filter(name.eq_any(vec!["Sean", "Jim"])); - /// assert_eq!(Ok(vec![1, 3]), data.load(&connection)); - /// - /// // Calling `eq_any` with an empty array is the same as doing `WHERE 1=0` - /// let data = users.select(id).filter(name.eq_any(Vec::::new())); - /// assert_eq!(Ok(vec![]), data.load::(&connection)); - /// # } - /// ``` - fn eq_any(self, values: T) -> In - where - T: AsInExpression, - { - In::new(self, values.as_in_expression()) - } - - /// Deprecated alias for `ne_all` - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// # connection.execute("INSERT INTO users (name) VALUES - /// # ('Jim')").unwrap(); - /// let data = users.select(id).filter(name.ne_any(vec!["Sean", "Jim"])); - /// assert_eq!(Ok(vec![2]), data.load(&connection)); - /// - /// let data = users.select(id).filter(name.ne_any(vec!["Tess"])); - /// assert_eq!(Ok(vec![1, 3]), data.load(&connection)); - /// - /// // Calling `ne_any` with an empty array is the same as doing `WHERE 1=1` - /// let data = users.select(id).filter(name.ne_any(Vec::::new())); - /// assert_eq!(Ok(vec![1, 2, 3]), data.load(&connection)); - /// # } - /// ``` - #[cfg(feature = "with-deprecated")] - #[deprecated(since = "1.2.0", note = "use `ne_all` instead")] - fn ne_any(self, values: T) -> NotIn - where - T: AsInExpression, - { - NotIn::new(self, values.as_in_expression()) - } - - /// Creates a SQL `NOT IN` statement. - /// - /// Queries using this method will not be - /// placed in the prepared statement cache. On PostgreSQL, you should use - /// `ne(all())` instead. This method may change in the future to - /// automatically perform `!= ALL` on PostgreSQL. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// # connection.execute("INSERT INTO users (name) VALUES - /// # ('Jim')").unwrap(); - /// let data = users.select(id).filter(name.ne_all(vec!["Sean", "Jim"])); - /// assert_eq!(Ok(vec![2]), data.load(&connection)); - /// - /// let data = users.select(id).filter(name.ne_all(vec!["Tess"])); - /// assert_eq!(Ok(vec![1, 3]), data.load(&connection)); - /// - /// // Calling `ne_any` with an empty array is the same as doing `WHERE 1=1` - /// let data = users.select(id).filter(name.ne_all(Vec::::new())); - /// assert_eq!(Ok(vec![1, 2, 3]), data.load(&connection)); - /// # } - /// ``` - fn ne_all(self, values: T) -> NotIn - where - T: AsInExpression, - { - NotIn::new(self, values.as_in_expression()) - } - - /// Creates a SQL `IS NULL` expression. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::animals::dsl::*; - /// # let connection = establish_connection(); - /// # - /// let data = animals - /// .select(species) - /// .filter(name.is_null()) - /// .first::(&connection)?; - /// assert_eq!("spider", data); - /// # Ok(()) - /// # } - fn is_null(self) -> IsNull { - IsNull::new(self) - } - - /// Creates a SQL `IS NOT NULL` expression. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::animals::dsl::*; - /// # let connection = establish_connection(); - /// # - /// let data = animals - /// .select(species) - /// .filter(name.is_not_null()) - /// .first::(&connection)?; - /// assert_eq!("dog", data); - /// # Ok(()) - /// # } - fn is_not_null(self) -> IsNotNull { - IsNotNull::new(self) - } - - /// Creates a SQL `>` expression. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// let data = users - /// .select(name) - /// .filter(id.gt(1)) - /// .first::(&connection)?; - /// assert_eq!("Tess", data); - /// # Ok(()) - /// # } - /// ``` - fn gt>(self, other: T) -> Gt { - Gt::new(self, other.as_expression()) - } - - /// Creates a SQL `>=` expression. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// let data = users - /// .select(name) - /// .filter(id.ge(2)) - /// .first::(&connection)?; - /// assert_eq!("Tess", data); - /// # Ok(()) - /// # } - /// ``` - fn ge>(self, other: T) -> GtEq { - GtEq::new(self, other.as_expression()) - } - - /// Creates a SQL `<` expression. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// let data = users - /// .select(name) - /// .filter(id.lt(2)) - /// .first::(&connection)?; - /// assert_eq!("Sean", data); - /// # Ok(()) - /// # } - /// ``` - fn lt>(self, other: T) -> Lt { - Lt::new(self, other.as_expression()) - } - - /// Creates a SQL `<=` expression. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// let data = users - /// .select(name) - /// .filter(id.le(2)) - /// .first::(&connection)?; - /// assert_eq!("Sean", data); - /// # Ok(()) - /// # } - fn le>(self, other: T) -> LtEq { - LtEq::new(self, other.as_expression()) - } - - /// Creates a SQL `BETWEEN` expression using the given lower and upper - /// bounds. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # use schema::animals::dsl::*; - /// # let connection = establish_connection(); - /// # - /// let data = animals - /// .select(species) - /// .filter(legs.between(2, 6)) - /// .first(&connection); - /// # - /// assert_eq!(Ok("dog".to_string()), data); - /// # } - /// ``` - fn between(self, lower: T, upper: U) -> Between> - where - T: AsExpression, - U: AsExpression, - { - Between::new(self, And::new(lower.as_expression(), upper.as_expression())) - } - - /// Creates a SQL `NOT BETWEEN` expression using the given lower and upper - /// bounds. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::animals::dsl::*; - /// # let connection = establish_connection(); - /// # - /// let data = animals - /// .select(species) - /// .filter(legs.not_between(2, 6)) - /// .first::(&connection)?; - /// assert_eq!("spider", data); - /// # Ok(()) - /// # } - fn not_between( - self, - lower: T, - upper: U, - ) -> NotBetween> - where - T: AsExpression, - U: AsExpression, - { - NotBetween::new(self, And::new(lower.as_expression(), upper.as_expression())) - } - - /// Creates a SQL `DESC` expression, representing this expression in - /// descending order. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// # - /// let names = users - /// .select(name) - /// .order(name.desc()) - /// .load::(&connection)?; - /// assert_eq!(vec!["Tess", "Sean"], names); - /// # Ok(()) - /// # } - /// ``` - fn desc(self) -> Desc { - Desc::new(self) - } - - /// Creates a SQL `ASC` expression, representing this expression in - /// ascending order. - /// - /// This is the same as leaving the direction unspecified. It is useful if - /// you need to provide an unknown ordering, and need to box the return - /// value of a function. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # use schema::users::dsl::*; - /// # let order = "name"; - /// let ordering: Box> = - /// if order == "name" { - /// Box::new(name.desc()) - /// } else { - /// Box::new(id.asc()) - /// }; - /// # } - /// ``` - fn asc(self) -> Asc { - Asc::new(self) - } -} - -impl ExpressionMethods for T -where - T: Expression, - T::SqlType: SingleValue, -{ -} - -/// Methods present on all expressions -pub trait NullableExpressionMethods: Expression + Sized { - /// Converts this potentially non-null expression into one which is treated - /// as nullable. This method has no impact on the generated SQL, and is only - /// used to allow certain comparisons that would otherwise fail to compile. - /// - /// # Example - /// ```no_run - /// # #![allow(dead_code)] - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # use diesel::sql_types::*; - /// # use schema::users; - /// # - /// table! { - /// posts { - /// id -> Integer, - /// user_id -> Integer, - /// author_name -> Nullable, - /// } - /// } - /// # - /// # joinable!(posts -> users (user_id)); - /// # allow_tables_to_appear_in_same_query!(posts, users); - /// - /// fn main() { - /// use self::users::dsl::*; - /// use self::posts::dsl::{posts, author_name}; - /// let connection = establish_connection(); - /// - /// let data = users.inner_join(posts) - /// .filter(name.nullable().eq(author_name)) - /// .select(name) - /// .load::(&connection); - /// println!("{:?}", data); - /// } - /// ``` - fn nullable(self) -> nullable::Nullable { - nullable::Nullable::new(self) - } -} - -impl NullableExpressionMethods for T {} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression_methods/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression_methods/mod.rs deleted file mode 100644 index 16fa9d761..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression_methods/mod.rs +++ /dev/null @@ -1,26 +0,0 @@ -//! Adds various methods to construct new expressions. These traits are exported -//! by default, and implemented automatically. -//! -//! You can rely on the methods provided by this trait existing on any -//! `Expression` of the appropriate type. You should not rely on the specific -//! traits existing, their names, or their organization. -mod bool_expression_methods; -mod eq_all; -mod escape_expression_methods; -mod global_expression_methods; -mod text_expression_methods; - -#[doc(inline)] -pub use self::bool_expression_methods::BoolExpressionMethods; -#[doc(hidden)] -pub use self::eq_all::EqAll; -#[doc(inline)] -pub use self::escape_expression_methods::EscapeExpressionMethods; -#[doc(inline)] -pub use self::global_expression_methods::{ExpressionMethods, NullableExpressionMethods}; -#[doc(inline)] -pub use self::text_expression_methods::TextExpressionMethods; - -#[cfg(feature = "postgres")] -#[doc(inline)] -pub use pg::expression::expression_methods::*; diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/expression_methods/text_expression_methods.rs b/collector/compile-benchmarks/diesel-1.4.8/src/expression_methods/text_expression_methods.rs deleted file mode 100644 index 55395bb26..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/expression_methods/text_expression_methods.rs +++ /dev/null @@ -1,143 +0,0 @@ -use expression::operators::{Concat, Like, NotLike}; -use expression::{AsExpression, Expression}; -use sql_types::{Nullable, Text}; - -/// Methods present on text expressions -pub trait TextExpressionMethods: Expression + Sized { - /// Concatenates two strings using the `||` operator. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # table! { - /// # users { - /// # id -> Integer, - /// # name -> VarChar, - /// # hair_color -> Nullable, - /// # } - /// # } - /// # - /// # fn main() { - /// # use self::users::dsl::*; - /// # use diesel::insert_into; - /// # - /// # let connection = connection_no_data(); - /// # connection.execute("CREATE TABLE users ( - /// # id INTEGER PRIMARY KEY, - /// # name VARCHAR(255) NOT NULL, - /// # hair_color VARCHAR(255) - /// # )").unwrap(); - /// # - /// # insert_into(users) - /// # .values(&vec![ - /// # (id.eq(1), name.eq("Sean"), hair_color.eq(Some("Green"))), - /// # (id.eq(2), name.eq("Tess"), hair_color.eq(None)), - /// # ]) - /// # .execute(&connection) - /// # .unwrap(); - /// # - /// let names = users.select(name.concat(" the Greatest")).load(&connection); - /// let expected_names = vec![ - /// "Sean the Greatest".to_string(), - /// "Tess the Greatest".to_string(), - /// ]; - /// assert_eq!(Ok(expected_names), names); - /// - /// // If the value is nullable, the output will be nullable - /// let names = users.select(hair_color.concat("ish")).load(&connection); - /// let expected_names = vec![ - /// Some("Greenish".to_string()), - /// None, - /// ]; - /// assert_eq!(Ok(expected_names), names); - /// # } - /// ``` - fn concat>(self, other: T) -> Concat { - Concat::new(self, other.as_expression()) - } - - /// Returns a SQL `LIKE` expression - /// - /// This method is case insensitive for SQLite and MySQL. - /// On PostgreSQL, `LIKE` is case sensitive. You may use - /// [`ilike()`](../expression_methods/trait.PgTextExpressionMethods.html#method.ilike) - /// for case insensitive comparison on PostgreSQL. - /// - /// # Examples - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// # - /// let starts_with_s = users - /// .select(name) - /// .filter(name.like("S%")) - /// .load::(&connection)?; - /// assert_eq!(vec!["Sean"], starts_with_s); - /// # Ok(()) - /// # } - /// ``` - fn like>(self, other: T) -> Like { - Like::new(self.as_expression(), other.as_expression()) - } - - /// Returns a SQL `NOT LIKE` expression - /// - /// This method is case insensitive for SQLite and MySQL. - /// On PostgreSQL `NOT LIKE` is case sensitive. You may use - /// [`not_ilike()`](../expression_methods/trait.PgTextExpressionMethods.html#method.not_ilike) - /// for case insensitive comparison on PostgreSQL. - /// - /// # Examples - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// # - /// let doesnt_start_with_s = users - /// .select(name) - /// .filter(name.not_like("S%")) - /// .load::(&connection)?; - /// assert_eq!(vec!["Tess"], doesnt_start_with_s); - /// # Ok(()) - /// # } - /// ``` - fn not_like>(self, other: T) -> NotLike { - NotLike::new(self.as_expression(), other.as_expression()) - } -} - -#[doc(hidden)] -/// Marker trait used to implement `TextExpressionMethods` on the appropriate -/// types. Once coherence takes associated types into account, we can remove -/// this trait. -pub trait TextOrNullableText {} - -impl TextOrNullableText for Text {} -impl TextOrNullableText for Nullable {} - -impl TextExpressionMethods for T -where - T: Expression, - T::SqlType: TextOrNullableText, -{ -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/insertable.rs b/collector/compile-benchmarks/diesel-1.4.8/src/insertable.rs deleted file mode 100644 index 7b542f4b4..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/insertable.rs +++ /dev/null @@ -1,320 +0,0 @@ -use std::marker::PhantomData; - -use backend::{Backend, SupportsDefaultKeyword}; -use expression::{AppearsOnTable, Expression}; -use query_builder::{ - AstPass, InsertStatement, QueryFragment, UndecoratedInsertRecord, ValuesClause, -}; -use query_source::{Column, Table}; -use result::QueryResult; -#[cfg(feature = "sqlite")] -use sqlite::Sqlite; - -/// Represents that a structure can be used to insert a new row into the -/// database. This is automatically implemented for `&[T]` and `&Vec` for -/// inserting more than one record. -/// -/// ### Deriving -/// -/// This trait can be automatically derived by adding `#[derive(Insertable)]` -/// to your struct. Structs which derive this trait must also be annotated -/// with `#[table_name = "some_table_name"]`. If the field name of your -/// struct differs from the name of the column, you can annotate the field -/// with `#[column_name = "some_column_name"]`. -/// -/// Your struct can also contain fields which implement `Insertable`. This is -/// useful when you want to have one field map to more than one column (for -/// example, an enum that maps to a label and a value column). Add -/// `#[diesel(embed)]` to any such fields. -pub trait Insertable { - /// The `VALUES` clause to insert these records - /// - /// The types used here are generally internal to Diesel. - /// Implementations of this trait should use the `Values` - /// type of other `Insertable` types. - /// For example ` as Insertable>::Values`. - type Values; - - /// Construct `Self::Values` - /// - /// Implementations of this trait typically call `.values` - /// on other `Insertable` types. - fn values(self) -> Self::Values; - - /// Insert `self` into a given table. - /// - /// `foo.insert_into(table)` is identical to `insert_into(table).values(foo)`. - /// However, when inserting from a select statement, - /// this form is generally preferred. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::{posts, users}; - /// # let conn = establish_connection(); - /// # diesel::delete(posts::table).execute(&conn)?; - /// users::table - /// .select(( - /// users::name.concat("'s First Post"), - /// users::id, - /// )) - /// .insert_into(posts::table) - /// .into_columns((posts::title, posts::user_id)) - /// .execute(&conn)?; - /// - /// let inserted_posts = posts::table - /// .select(posts::title) - /// .load::(&conn)?; - /// let expected = vec!["Sean's First Post", "Tess's First Post"]; - /// assert_eq!(expected, inserted_posts); - /// # Ok(()) - /// # } - /// ``` - fn insert_into(self, table: T) -> InsertStatement - where - Self: Sized, - { - ::insert_into(table).values(self) - } -} - -pub trait CanInsertInSingleQuery { - /// How many rows will this query insert? - /// - /// This function should only return `None` when the query is valid on all - /// backends, regardless of how many rows get inserted. - fn rows_to_insert(&self) -> Option; -} - -impl<'a, T, DB> CanInsertInSingleQuery for &'a T -where - T: ?Sized + CanInsertInSingleQuery, - DB: Backend, -{ - fn rows_to_insert(&self) -> Option { - (*self).rows_to_insert() - } -} - -impl<'a, T, Tab, DB> CanInsertInSingleQuery for BatchInsert<'a, T, Tab> -where - DB: Backend + SupportsDefaultKeyword, -{ - fn rows_to_insert(&self) -> Option { - Some(self.records.len()) - } -} - -impl CanInsertInSingleQuery for OwnedBatchInsert -where - DB: Backend + SupportsDefaultKeyword, -{ - fn rows_to_insert(&self) -> Option { - Some(self.values.len()) - } -} - -impl CanInsertInSingleQuery for ColumnInsertValue -where - DB: Backend, -{ - fn rows_to_insert(&self) -> Option { - Some(1) - } -} - -pub trait InsertValues: QueryFragment { - fn column_names(&self, out: AstPass) -> QueryResult<()>; -} - -#[derive(Debug, Copy, Clone)] -#[doc(hidden)] -pub enum ColumnInsertValue { - Expression(Col, Expr), - Default, -} - -impl Default for ColumnInsertValue { - fn default() -> Self { - ColumnInsertValue::Default - } -} - -impl InsertValues for ColumnInsertValue -where - DB: Backend + SupportsDefaultKeyword, - Col: Column, - Expr: Expression + AppearsOnTable<()>, - Self: QueryFragment, -{ - fn column_names(&self, mut out: AstPass) -> QueryResult<()> { - out.push_identifier(Col::NAME)?; - Ok(()) - } -} - -impl QueryFragment for ColumnInsertValue -where - DB: Backend + SupportsDefaultKeyword, - Expr: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - if let ColumnInsertValue::Expression(_, ref value) = *self { - value.walk_ast(out.reborrow())?; - } else { - out.push_sql("DEFAULT"); - } - Ok(()) - } -} - -#[cfg(feature = "sqlite")] -impl InsertValues for ColumnInsertValue -where - Col: Column, - Expr: Expression + AppearsOnTable<()>, - Self: QueryFragment, -{ - fn column_names(&self, mut out: AstPass) -> QueryResult<()> { - if let ColumnInsertValue::Expression(..) = *self { - out.push_identifier(Col::NAME)?; - } - Ok(()) - } -} - -#[cfg(feature = "sqlite")] -impl QueryFragment for ColumnInsertValue -where - Expr: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - if let ColumnInsertValue::Expression(_, ref value) = *self { - value.walk_ast(out.reborrow())?; - } - Ok(()) - } -} - -impl<'a, T, Tab> Insertable for &'a [T] -where - &'a T: UndecoratedInsertRecord, -{ - type Values = BatchInsert<'a, T, Tab>; - - fn values(self) -> Self::Values { - BatchInsert { - records: self, - _marker: PhantomData, - } - } -} - -impl<'a, T, Tab> Insertable for &'a Vec -where - &'a [T]: Insertable, -{ - type Values = <&'a [T] as Insertable>::Values; - - fn values(self) -> Self::Values { - (&**self).values() - } -} - -impl Insertable for Vec -where - T: Insertable + UndecoratedInsertRecord, -{ - type Values = OwnedBatchInsert; - - fn values(self) -> Self::Values { - OwnedBatchInsert { - values: self.into_iter().map(Insertable::values).collect(), - _marker: PhantomData, - } - } -} - -impl Insertable for Option -where - T: Insertable, - T::Values: Default, -{ - type Values = T::Values; - - fn values(self) -> Self::Values { - self.map(Insertable::values).unwrap_or_default() - } -} - -impl<'a, T, Tab> Insertable for &'a Option -where - Option<&'a T>: Insertable, -{ - type Values = as Insertable>::Values; - - fn values(self) -> Self::Values { - self.as_ref().values() - } -} - -#[derive(Debug, Clone, Copy)] -pub struct BatchInsert<'a, T: 'a, Tab> { - pub(crate) records: &'a [T], - _marker: PhantomData, -} - -impl<'a, T, Tab, Inner, DB> QueryFragment for BatchInsert<'a, T, Tab> -where - DB: Backend + SupportsDefaultKeyword, - &'a T: Insertable>, - ValuesClause: QueryFragment, - Inner: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - let mut records = self.records.iter().map(Insertable::values); - if let Some(record) = records.next() { - record.walk_ast(out.reborrow())?; - } - for record in records { - out.push_sql(", ("); - record.values.walk_ast(out.reborrow())?; - out.push_sql(")"); - } - Ok(()) - } -} - -#[derive(Debug)] -pub struct OwnedBatchInsert { - pub(crate) values: Vec, - _marker: PhantomData, -} - -impl QueryFragment for OwnedBatchInsert, Tab> -where - DB: Backend + SupportsDefaultKeyword, - ValuesClause: QueryFragment, - Inner: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - let mut values = self.values.iter(); - if let Some(value) = values.next() { - value.walk_ast(out.reborrow())?; - } - for value in values { - out.push_sql(", ("); - value.values.walk_ast(out.reborrow())?; - out.push_sql(")"); - } - Ok(()) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/lib.rs b/collector/compile-benchmarks/diesel-1.4.8/src/lib.rs deleted file mode 100644 index 0f7a07b4b..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/lib.rs +++ /dev/null @@ -1,377 +0,0 @@ -//! # Diesel -//! -//! Diesel is an ORM and query builder designed to reduce the boilerplate for database interactions. -//! If this is your first time reading this documentation, -//! we recommend you start with the [getting started guide]. -//! We also have [many other long form guides]. -//! -//! [getting started guide]: https://diesel.rs/guides/getting-started/ -//! [many other long form guides]: https://diesel.rs/guides -//! -//! # Where to find things -//! -//! ## Declaring your schema -//! -//! For Diesel to validate your queries at compile time -//! it requires you to specify your schema in your code, -//! which you can do with [the `table!` macro][`table!`]. -//! `diesel print-schema` or `infer_schema!` can be used -//! to automatically generate these macro calls -//! (by connecting to your database and querying its schema). -//! -//! [`table!`]: macro.table.html -//! -//! ## Getting started -//! -//! Queries usually start from either a table, or a function like [`update`]. -//! Those functions can be found [here](#functions). -//! -//! Diesel provides a [`prelude` module](prelude), -//! which exports most of the typically used traits and types. -//! We are conservative about what goes in this module, -//! and avoid anything which has a generic name. -//! Files which use Diesel are expected to have `use diesel::prelude::*;`. -//! -//! [`update`]: fn.update.html -//! -//! ## Constructing a query -//! -//! The tools the query builder gives you can be put into these three categories: -//! -//! - "Query builder methods" are things that map to portions of a whole query -//! (such as `ORDER` and `WHERE`). These methods usually have the same name -//! as the SQL they map to, except for `WHERE` which is called `filter` in Diesel -//! (To not conflict with the Rust keyword). -//! These methods live in [the `query_dsl` module](query_dsl). -//! - "Expression methods" are things you would call on columns -//! or other individual values. -//! These methods live in [the `expression_methods` module](expression_methods) -//! You can often find these by thinking "what would this be called" -//! if it were a method -//! and typing that into the search bar -//! (e.g. `LIKE` is called `like` in Diesel). -//! Most operators are named based on the Rust function which maps to that -//! operator in [`std::ops`][] -//! (For example `==` is called `.eq`, and `!=` is called `.ne`). -//! - "Bare functions" are normal SQL functions -//! such as `sum`. -//! They live in [the `dsl` module](dsl). -//! Diesel only supports a very small number of these functions. -//! You can declare additional functions you want to use -//! with [the `sql_function!` macro][`sql_function!`]. -//! -//! [`std::ops`]: //doc.rust-lang.org/stable/std/ops/index.html -//! [`sql_function!`]: macro.sql_function.html -//! -//! ## Serializing and Deserializing -//! -//! Types which represent the result of a SQL query implement -//! a trait called [`Queryable`]. -//! -//! Diesel maps "Rust types" (e.g. `i32`) to and from "SQL types" -//! (e.g. [`diesel::sql_types::Integer`]). -//! You can find all the types supported by Diesel in [the `sql_types` module](sql_types). -//! These types are only used to represent a SQL type. -//! You should never put them on your `Queryable` structs. -//! -//! To find all the Rust types which can be used with a given SQL type, -//! see the documentation for that SQL type. -//! -//! To find all the SQL types which can be used with a Rust type, -//! go to the docs for either [`ToSql`] or [`FromSql`], -//! go to the "Implementors" section, -//! and find the Rust type you want to use. -//! -//! [`Queryable`]: deserialize/trait.Queryable.html -//! [`diesel::sql_types::Integer`]: sql_types/struct.Integer.html -//! [`ToSql`]: serialize/trait.ToSql.html -//! [`FromSql`]: deserialize/trait.FromSql.html -//! -//! ## Getting help -//! -//! If you run into problems, Diesel has a very active Gitter room. -//! You can come ask for help at -//! [gitter.im/diesel-rs/diesel](https://gitter.im/diesel-rs/diesel) - -#![cfg_attr( - feature = "large-tables", - deprecated( - since = "1.2.0", - note = "The large-tables feature has been renamed to 32-column-tables" - ) -)] -#![cfg_attr( - feature = "huge-tables", - deprecated( - since = "1.2.0", - note = "The huge-tables feature has been renamed to 64-column-tables" - ) -)] -#![cfg_attr( - feature = "x32-column-tables", - deprecated( - since = "1.2.1", - note = "The x32-column-tables feature has been reanmed to 32-column-tables. The x was a workaround for a bug in crates.io that has since been resolved" - ) -)] -#![cfg_attr( - feature = "x64-column-tables", - deprecated( - since = "1.2.1", - note = "The x64-column-tables feature has been reanmed to 64-column-tables. The x was a workaround for a bug in crates.io that has since been resolved" - ) -)] -#![cfg_attr( - feature = "x128-column-tables", - deprecated( - since = "1.2.1", - note = "The x128-column-tables feature has been reanmed to 128-column-tables. The x was a workaround for a bug in crates.io that has since been resolved" - ) -)] -#![cfg_attr(feature = "unstable", feature(specialization, try_from))] -// Built-in Lints -#![deny( - missing_debug_implementations, - missing_copy_implementations, - missing_docs -)] -// Clippy lints -#![allow( - clippy::option_map_unwrap_or_else, - clippy::option_map_unwrap_or, - clippy::match_same_arms, - clippy::type_complexity, - clippy::redundant_field_names, - // we don't fix that in backports - unused_parens -)] -#![cfg_attr(test, allow(clippy::option_map_unwrap_or, clippy::result_unwrap_used))] -#![warn( - clippy::option_unwrap_used, - clippy::result_unwrap_used, - clippy::print_stdout, - clippy::wrong_pub_self_convention, - clippy::mut_mut, - clippy::non_ascii_literal, - clippy::similar_names, - clippy::unicode_not_nfc, - clippy::enum_glob_use, - clippy::if_not_else, - clippy::items_after_statements, - clippy::used_underscore_binding -)] - -#[cfg(feature = "postgres")] -#[macro_use] -extern crate bitflags; -extern crate byteorder; -#[macro_use] -extern crate diesel_derives; -#[doc(hidden)] -pub use diesel_derives::*; - -#[macro_use] -mod macros; - -#[cfg(test)] -#[macro_use] -extern crate cfg_if; - -#[cfg(test)] -pub mod test_helpers; - -pub mod associations; -pub mod backend; -pub mod connection; -pub mod data_types; -pub mod deserialize; -#[macro_use] -pub mod expression; -pub mod expression_methods; -#[doc(hidden)] -pub mod insertable; -pub mod query_builder; -pub mod query_dsl; -pub mod query_source; -#[cfg(feature = "r2d2")] -pub mod r2d2; -pub mod result; -pub mod serialize; -#[macro_use] -pub mod sql_types; -pub mod migration; -pub mod row; -pub mod types; - -#[cfg(feature = "mysql")] -pub mod mysql; -#[cfg(feature = "postgres")] -pub mod pg; -#[cfg(feature = "sqlite")] -pub mod sqlite; - -mod type_impls; -mod util; - -pub mod dsl { - //! Includes various helper types and bare functions which are named too - //! generically to be included in prelude, but are often used when using Diesel. - - #[doc(inline)] - pub use helper_types::*; - - #[doc(inline)] - pub use expression::dsl::*; - - #[doc(inline)] - pub use query_builder::functions::{ - delete, insert_into, insert_or_ignore_into, replace_into, select, sql_query, update, - }; -} - -pub mod helper_types { - //! Provide helper types for concisely writing the return type of functions. - //! As with iterators, it is unfortunately difficult to return a partially - //! constructed query without exposing the exact implementation of the - //! function. Without higher kinded types, these various DSLs can't be - //! combined into a single trait for boxing purposes. - //! - //! All types here are in the form `>::Output`. So the return type of - //! `users.filter(first_name.eq("John")).order(last_name.asc()).limit(10)` would - //! be `Limit, Asc>>` - use super::query_builder::locking_clause as lock; - use super::query_dsl::methods::*; - use super::query_dsl::*; - use super::query_source::joins; - - #[doc(inline)] - pub use expression::helper_types::*; - - /// Represents the return type of `.select(selection)` - pub type Select = >::Output; - - /// Represents the return type of `.filter(predicate)` - pub type Filter = >::Output; - - /// Represents the return type of `.filter(lhs.eq(rhs))` - pub type FindBy = Filter>; - - /// Represents the return type of `.for_update()` - #[cfg(feature = "with-deprecated")] - #[allow(deprecated)] - pub type ForUpdate = ::Output; - - /// Represents the return type of `.for_update()` - #[cfg(not(feature = "with-deprecated"))] - pub type ForUpdate = >::Output; - - /// Represents the return type of `.for_no_key_update()` - pub type ForNoKeyUpdate = >::Output; - - /// Represents the return type of `.for_share()` - pub type ForShare = >::Output; - - /// Represents the return type of `.for_key_share()` - pub type ForKeyShare = >::Output; - - /// Represents the return type of `.skip_locked()` - pub type SkipLocked = >::Output; - - /// Represents the return type of `.no_wait()` - pub type NoWait = >::Output; - - /// Represents the return type of `.find(pk)` - pub type Find = >::Output; - - /// Represents the return type of `.or_filter(predicate)` - pub type OrFilter = >::Output; - - /// Represents the return type of `.order(ordering)` - pub type Order = >::Output; - - /// Represents the return type of `.then_order_by(ordering)` - pub type ThenOrderBy = >::Output; - - /// Represents the return type of `.limit()` - pub type Limit = ::Output; - - /// Represents the return type of `.offset()` - pub type Offset = ::Output; - - /// Represents the return type of `.inner_join(rhs)` - pub type InnerJoin = - >::Output; - - /// Represents the return type of `.left_join(rhs)` - pub type LeftJoin = - >::Output; - - use super::associations::HasTable; - use super::query_builder::{AsChangeset, IntoUpdateTarget, UpdateStatement}; - /// Represents the return type of `update(lhs).set(rhs)` - pub type Update = UpdateStatement< - ::Table, - ::WhereClause, - ::Changeset, - >; - - /// Represents the return type of `.into_boxed::<'a, DB>()` - pub type IntoBoxed<'a, Source, DB> = >::Output; - - /// Represents the return type of `.distinct()` - pub type Distinct = ::Output; - - /// Represents the return type of `.distinct_on(expr)` - #[cfg(feature = "postgres")] - pub type DistinctOn = >::Output; - - /// Represents the return type of `.single_value()` - pub type SingleValue = ::Output; - - /// Represents the return type of `.nullable()` - pub type NullableSelect = ::Output; -} - -pub mod prelude { - //! Re-exports important traits and types. Meant to be glob imported when using Diesel. - pub use associations::{GroupedBy, Identifiable}; - pub use connection::Connection; - #[deprecated( - since = "1.1.0", - note = "Explicitly `use diesel::deserialize::Queryable" - )] - pub use deserialize::Queryable; - pub use expression::{ - AppearsOnTable, BoxableExpression, Expression, IntoSql, SelectableExpression, - }; - pub use expression_methods::*; - #[doc(inline)] - pub use insertable::Insertable; - #[doc(hidden)] - pub use query_dsl::GroupByDsl; - pub use query_dsl::{BelongingToDsl, JoinOnDsl, QueryDsl, RunQueryDsl, SaveChangesDsl}; - - pub use query_source::{Column, JoinTo, QuerySource, Table}; - pub use result::{ConnectionError, ConnectionResult, OptionalExtension, QueryResult}; - - #[cfg(feature = "mysql")] - pub use mysql::MysqlConnection; - #[cfg(feature = "postgres")] - pub use pg::PgConnection; - #[cfg(feature = "sqlite")] - pub use sqlite::SqliteConnection; -} - -pub use prelude::*; -#[doc(inline)] -pub use query_builder::debug_query; -#[doc(inline)] -pub use query_builder::functions::{ - delete, insert_into, insert_or_ignore_into, replace_into, select, sql_query, update, -}; -pub use result::Error::NotFound; - -pub(crate) mod diesel { - pub use super::*; -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/macros/internal.rs b/collector/compile-benchmarks/diesel-1.4.8/src/macros/internal.rs deleted file mode 100644 index 027e9c448..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/macros/internal.rs +++ /dev/null @@ -1,466 +0,0 @@ -/// This will implement `SelectableExpression` and `AppearsOnTable` for "simple" -/// composite nodes where the where clause is roughly `AllTyParams: -/// SelectableExpression, Self: Expression`. -/// -/// This macro is exported because we want to be able to call it from other -/// macros that are exported, but it is not part of our public API. -#[macro_export] -#[doc(hidden)] -macro_rules! impl_selectable_expression { - ($struct_name:ident) => { - impl_selectable_expression!(ty_params = (), struct_ty = $struct_name,); - }; - - ($struct_name:ident<$($ty_params:ident),+>) => { - impl_selectable_expression!( - ty_params = ($($ty_params),+), - struct_ty = $struct_name<$($ty_params),+>, - ); - }; - - (ty_params = ($($ty_params:ident),*), struct_ty = $struct_ty:ty,) => { - impl<$($ty_params,)* QS> $crate::expression::SelectableExpression - for $struct_ty where - $struct_ty: $crate::expression::AppearsOnTable, - $($ty_params: $crate::expression::SelectableExpression,)* - { - } - - impl<$($ty_params,)* QS> $crate::expression::AppearsOnTable - for $struct_ty where - $struct_ty: $crate::expression::Expression, - $($ty_params: $crate::expression::AppearsOnTable,)* - { - } - }; -} - -/// Parses a sequence of type parameters and their bounds. -/// -/// Ideally we would just be able to write this as -/// `$($param:ident $(: $bound:ty)*),* $(,)*`, but Rust doesn't allow a `ty` -/// fragment in a trait bound position. -/// -/// Assuming we don't care about lifetimes or existentials, we could also -/// possibly write `$($param:ident $(: $bound:path)+*),* $(,)*` but Rust doesn't -/// allow `+` as a separator. In fact, we can't even use the `path` fragment -/// at all, as Rust does not allow it to be followed by `+` or `tt`. -/// -/// This macro takes three arguments. -/// -/// - `data`: Any arbitrary token tree you'd like given back to you when parsing -/// is complete. -/// - `callback`: The name of the macro to call when parsing is complete -/// - `tokens`: The tokens to be parsed. -/// -/// This macro will consume tokens until it reaches a `>` that was not -/// preceded by a `<`. It will then invoke `callback` with 4 arguments: -/// -/// - `data`: Whatever you gave this macro. -/// - `type_args`: The names of the type parameters. Always contains a trailing -/// comma if non-empty. -/// - `type_args_with_bounds`: The arguments and their bounds. Always contains -/// a trailing comma if non-empty -/// - `unparsed_tokens`: Any tokens that were not consumed by this macro. -#[macro_export] -#[doc(hidden)] -macro_rules! __diesel_parse_type_args { - // ENTRYPOINT - // - // Set up our lists. - // Continues to NEXT_ARG, NEXT_ARG_NO_BOUNDS, or EXIT - ( - data = $data:tt, - callback = $callback:ident, - tokens = $tokens:tt, - ) => { - __diesel_parse_type_args! { - data = $data, - callback = $callback, - args = (), - bounds = (), - tokens = $tokens, - } - }; - - // NEXT_ARG - // - // No arg currently being parsed, next token is an argument with a `:`. - // From here we set up a stack of `<` to track, - // and start putting tokens into the bounds. - // - // Continues to BOUNDS or OPENING_BRACKET - ( - data = $data:tt, - callback = $callback:ident, - args = ($($args:tt)*), - bounds = ($($bounds:tt)*), - tokens = ($next_arg:ident : $($tokens:tt)*), - ) => { - __diesel_parse_type_args! { - brackets = (), - data = $data, - callback = $callback, - args = ($($args)* $next_arg,), - bounds = ($($bounds)* $next_arg:), - tokens = ($($tokens)*), - } - }; - - // NEXT_ARG_NO_BOUNDS - // - // No arg currently being parsed, next token is an argument without a :. - // - // Continues to NEXT_ARG, NEXT_ARG_NO_BOUNDS, NO_ARG_COMMA, or EXIT - ( - data = $data:tt, - callback = $callback:ident, - args = ($($args:tt)*), - bounds = ($($bounds:tt)*), - tokens = ($next_arg:ident $($tokens:tt)*), - ) => { - __diesel_parse_type_args! { - data = $data, - callback = $callback, - args = ($($args)* $next_arg,), - bounds = ($($bounds)* $next_arg,), - tokens = ($($tokens)*), - } - }; - - // FINAL_CLOSING_BRACKET - // - // > encountered, no bracket on the stack. We're done. - // - // Continues to EXIT - ( - brackets = (), - data = $data:tt, - callback = $callback:ident, - args = $args:tt, - bounds = ($($bounds:tt)*), - tokens = (> $($tokens:tt)*), - ) => { - __diesel_parse_type_args! { - data = $data, - callback = $callback, - args = $args, - bounds = ($($bounds)*,), - tokens = (> $($tokens)*), - } - }; - - // END_OF_BOUND - // - // , encountered, no bracket on the stack. We're done. - // - // Continues to NEXT_ARG, NEXT_ARG_NO_BOUNDS, or EXIT - ( - brackets = (), - data = $data:tt, - callback = $callback:ident, - args = $args:tt, - bounds = ($($bounds:tt)*), - tokens = (, $($tokens:tt)*), - ) => { - __diesel_parse_type_args! { - data = $data, - callback = $callback, - args = $args, - bounds = ($($bounds)* ,), - tokens = ($($tokens)*), - } - }; - - // OPENING_BRACKET - // - // Token is <, push it on the stack. - // - // Continues to BOUNDS, OPENING_BRACKET, CLOSING_BRACKET, or - // DOUBLE_CLOSING_BRACKET. - ( - brackets = ($($brackets:tt)*), - data = $data:tt, - callback = $callback:ident, - args = $args:tt, - bounds = ($($bounds:tt)*), - tokens = (< $($tokens:tt)*), - ) => { - __diesel_parse_type_args! { - brackets = (< $($brackets)*), - data = $data, - callback = $callback, - args = $args, - bounds = ($($bounds)* <), - tokens = ($($tokens)*), - } - }; - - // DOUBLE_CLOSING_BRACKET - // - // Rust treats >> as a single token, so we have to special case it. - // - // Continues to CLOSING_BRACKET or FINAL_CLOSING_BRACKET. - ( - brackets = (< $($brackets:tt)*), - data = $data:tt, - callback = $callback:ident, - args = $args:tt, - bounds = ($($bounds:tt)*), - tokens = (>> $($tokens:tt)*), - ) => { - __diesel_parse_type_args! { - brackets = ($($brackets)*), - data = $data, - callback = $callback, - args = $args, - bounds = ($($bounds)* >), - tokens = (> $($tokens)*), - } - }; - - // CLOSING_BRACKET - // - // Token is >, and we have a non-empty bracket stack. - // Pop it and continue. - // - // Continues to BOUNDS, OPENING_BRACKET, CLOSING_BRACKET, - // DOUBLE_CLOSING_BRACKET, FINAL_CLOSING_BRACKET, or END_OF_BOUND - ( - brackets = (< $($brackets:tt)*), - data = $data:tt, - callback = $callback:ident, - args = $args:tt, - bounds = ($($bounds:tt)*), - tokens = (> $($tokens:tt)*), - ) => { - __diesel_parse_type_args! { - brackets = ($($brackets)*), - data = $data, - callback = $callback, - args = $args, - bounds = ($($bounds)* >), - tokens = ($($tokens)*), - } - }; - - // BOUNDS - // - // Token is not a , or >. It's part of the trait bounds. - // - // Continues to BOUNDS, OPENING_BRACKET, CLOSING_BRACKET, - // DOUBLE_CLOSING_BRACKET, FINAL_CLOSING_BRACKET, or END_OF_BOUND. - ( - brackets = $brackets:tt, - data = $data:tt, - callback = $callback:ident, - args = $args:tt, - bounds = ($($bounds:tt)*), - tokens = ($token:tt $($tokens:tt)*), - ) => { - __diesel_parse_type_args! { - brackets = $brackets, - data = $data, - callback = $callback, - args = $args, - bounds = ($($bounds)* $token), - tokens = ($($tokens)*), - } - }; - - // NO_ARG_COMMA - // - // No arg currently being parsed, , encountered. Skip. - // - // Continues to NEXT_ARG, NEXT_ARG_NO_BOUNDS, or EXIT - ( - data = $data:tt, - callback = $callback:ident, - args = $args:tt, - bounds = $bounds:tt, - tokens = (, $($tokens:tt)*), - ) => { - __diesel_parse_type_args! { - data = $data, - callback = $callback, - args = $args, - bounds = $bounds, - tokens = ($($tokens)*), - } - }; - - // EXIT - // - // No arg currently being parsed, > encountered. - ( - data = $data:tt, - callback = $callback:ident, - args = $args:tt, - bounds = $bounds:tt, - tokens = (> $($tokens:tt)*), - ) => { - $callback! { - data = $data, - type_args = $args, - type_args_with_bounds = $bounds, - unparsed_tokens = ($($tokens)*), - } - }; -} - -#[test] -fn parse_type_args_empty() { - let expected = stringify!( - data = (), - type_args = (), - type_args_with_bounds = (), - unparsed_tokens = (), - ); - let actual = __diesel_parse_type_args! { - data = (), - callback = stringify, - tokens = (>), - }; - - assert_eq!(expected, actual); -} - -#[test] -fn parse_type_args_simple() { - let expected = stringify!( - data = (foo), - type_args = (T,), - type_args_with_bounds = (T,), - unparsed_tokens = (), - ); - let actual = __diesel_parse_type_args! { - data = (foo), - callback = stringify, - tokens = (T>), - }; - - assert_eq!(expected, actual); - - let actual = __diesel_parse_type_args! { - data = (foo), - callback = stringify, - tokens = (T,>), - }; - - assert_eq!(expected, actual); -} - -#[test] -fn parse_type_args_multiple() { - let expected = stringify!( - data = (foo), - type_args = (T, U,), - type_args_with_bounds = (T, U,), - unparsed_tokens = (), - ); - let actual = __diesel_parse_type_args! { - data = (foo), - callback = stringify, - tokens = (T,U>), - }; - - assert_eq!(expected, actual); - - let actual = __diesel_parse_type_args! { - data = (foo), - callback = stringify, - tokens = (T,U,>), - }; - - assert_eq!(expected, actual); -} - -#[test] -fn parse_type_args_with_bounds() { - let expected = stringify!( - data = (foo), - type_args = (T, U,), - type_args_with_bounds = (T: Foo + Bar, U: Baz,), - unparsed_tokens = (), - ); - let actual = __diesel_parse_type_args! { - data = (foo), - callback = stringify, - tokens = (T: Foo + Bar, U: Baz>), - }; - - assert_eq!(expected, actual); - - let actual = __diesel_parse_type_args! { - data = (foo), - callback = stringify, - tokens = (T: Foo + Bar, U: Baz,>), - }; - - assert_eq!(expected, actual); -} - -#[test] -fn parse_type_args_with_bounds_containing_braces_and_commas() { - let expected = stringify!( - data = (foo), - type_args = (T,U,), - type_args_with_bounds = (T: Foo + Bar,U: Baz, String>,), - unparsed_tokens = (), - ); - let actual = __diesel_parse_type_args! { - data = (foo), - callback = stringify, - tokens = (T: Foo + Bar,U: Baz, String>>), - }; - - assert_eq!(expected, actual); - - let actual = __diesel_parse_type_args! { - data = (foo), - callback = stringify, - tokens = (T: Foo + Bar,U: Baz, String>,>), - }; - - assert_eq!(expected, actual); -} - -#[test] -fn parse_type_args_with_trailer() { - let expected = stringify!( - data = ( - meta = (#[aggregate]), - fn_name = max, - ), - type_args = (ST,), - type_args_with_bounds = (ST: SqlOrd + IntoNullable,), - unparsed_tokens = ((expr: ST) -> ST::Nullable), - ); - let actual = __diesel_parse_type_args! { - data = ( - meta = (#[aggregate]), - fn_name = max, - ), - callback = stringify, - tokens = (ST: SqlOrd + IntoNullable>(expr: ST) -> ST::Nullable), - }; - - assert_eq!(expected, actual); -} - -#[test] -fn parse_type_args_with_existentials_and_lifetimes() { - let expected = stringify! ( - data = (), - type_args = (ST,U,), - type_args_with_bounds = (ST: for<'a> Foo<'a, U> + 'static, U,), - unparsed_tokens = (), - ); - let actual = __diesel_parse_type_args! { - data = (), - callback = stringify, - tokens = (ST: for<'a> Foo<'a, U> + 'static, U>), - }; - - assert_eq!(expected, actual); -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/macros/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/macros/mod.rs deleted file mode 100644 index 09fb69663..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/macros/mod.rs +++ /dev/null @@ -1,1230 +0,0 @@ -#![cfg_attr(rustfmt, rustfmt_skip)] // https://github.com/rust-lang-nursery/rustfmt/issues/2755 - -#[macro_export] -#[doc(hidden)] -macro_rules! __diesel_column { - ( - table = $table:ident, - name = $column_name:ident, - sql_name = $sql_name:expr, - ty = ($($Type:tt)*), - meta = [$($meta:tt)*], - ) => { - $($meta)* - #[allow(non_camel_case_types, dead_code)] - #[derive(Debug, Clone, Copy, QueryId, Default)] - pub struct $column_name; - - impl $crate::expression::Expression for $column_name { - type SqlType = $($Type)*; - } - - impl $crate::query_builder::QueryFragment for $column_name where - DB: $crate::backend::Backend, - <$table as QuerySource>::FromClause: QueryFragment, - { - fn walk_ast(&self, mut out: $crate::query_builder::AstPass) -> $crate::result::QueryResult<()> { - $table.from_clause().walk_ast(out.reborrow())?; - out.push_sql("."); - out.push_identifier($sql_name) - } - } - - impl SelectableExpression<$table> for $column_name { - } - - impl AppearsOnTable for $column_name where - QS: AppearsInFromClause<$table, Count=Once>, - { - } - - impl SelectableExpression< - Join, - > for $column_name where - $column_name: AppearsOnTable>, - Left: AppearsInFromClause<$table, Count=Once>, - Right: AppearsInFromClause<$table, Count=Never>, - { - } - - impl SelectableExpression< - Join, - > for $column_name where - $column_name: AppearsOnTable>, - Join: AppearsInFromClause<$table, Count=Once>, - { - } - - // FIXME: Remove this when overlapping marker traits are stable - impl SelectableExpression> for $column_name where - $column_name: SelectableExpression + AppearsOnTable>, - { - } - - // FIXME: Remove this when overlapping marker traits are stable - impl SelectableExpression> for $column_name where - $column_name: SelectableExpression + AppearsOnTable>, - { - } - - impl $crate::expression::NonAggregate for $column_name {} - - impl $crate::query_source::Column for $column_name { - type Table = $table; - - const NAME: &'static str = $sql_name; - } - - impl $crate::EqAll for $column_name where - T: $crate::expression::AsExpression<$($Type)*>, - $crate::dsl::Eq<$column_name, T>: $crate::Expression, - { - type Output = $crate::dsl::Eq; - - fn eq_all(self, rhs: T) -> Self::Output { - $crate::expression::operators::Eq::new(self, rhs.as_expression()) - } - } - - __diesel_generate_ops_impls_if_numeric!($column_name, $($Type)*); - __diesel_generate_ops_impls_if_date_time!($column_name, $($Type)*); - } -} - -/// Specifies that a table exists, and what columns it has. This will create a -/// new public module, with the same name, as the name of the table. In this -/// module, you'll find a unit struct named `table`, and a unit struct with the -/// names of each of the columns. -/// -/// By default this allows a maximum of 32 columns per table. -/// You can increase this limit to 64 by enabling the `64-column-tables` feature. -/// You can increase it to 128 by enabling the `128-column-tables` feature. -/// You can decrease it to 16 columns, -/// which improves compilation time, -/// by disabling the default features of Diesel. -/// Note that enabling 64 column tables or larger will substantially increase -/// the compile time of Diesel. -/// -/// Example usage -/// ------------- -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// table! { -/// users { -/// id -> Integer, -/// name -> VarChar, -/// favorite_color -> Nullable, -/// } -/// } -/// # fn main() {} -/// ``` -/// -/// You may also specify a primary key if it's called something other than `id`. -/// Tables with no primary key are not supported. -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// table! { -/// users (non_standard_primary_key) { -/// non_standard_primary_key -> Integer, -/// name -> VarChar, -/// favorite_color -> Nullable, -/// } -/// } -/// # fn main() {} -/// ``` -/// -/// For tables with composite primary keys, list all of the columns in the -/// primary key. -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// table! { -/// followings (user_id, post_id) { -/// user_id -> Integer, -/// post_id -> Integer, -/// favorited -> Bool, -/// } -/// } -/// # fn main() { -/// # use diesel::prelude::*; -/// # use self::followings::dsl::*; -/// # // Poor man's assert_eq! -- since this is type level this would fail -/// # // to compile if the wrong primary key were generated -/// # let (user_id {}, post_id {}) = followings.primary_key(); -/// # } -/// ``` -/// -/// If you are using types that aren't from Diesel's core types, you can specify -/// which types to import. -/// -/// ``` -/// #[macro_use] extern crate diesel; -/// # /* -/// extern crate diesel_full_text_search; -/// # */ -/// # mod diesel_full_text_search { -/// # pub struct TsVector; -/// # } -/// -/// table! { -/// use diesel::sql_types::*; -/// use diesel_full_text_search::*; -/// -/// posts { -/// id -> Integer, -/// title -> Text, -/// keywords -> TsVector, -/// } -/// } -/// # fn main() {} -/// ``` -/// -/// If you want to add documentation to the generated code you can use the -/// following syntax: -/// -/// ``` -/// #[macro_use] extern crate diesel; -/// -/// table! { -/// -/// /// The table containing all blog posts -/// posts { -/// /// The post's unique id -/// id -> Integer, -/// /// The post's title -/// title -> Text, -/// } -/// } -/// # fn main() {} -/// ``` -/// -/// If you have a column with the same name as a Rust reserved keyword, you can use -/// the `sql_name` attribute like this: -/// -/// ``` -/// #[macro_use] extern crate diesel; -/// -/// table! { -/// posts { -/// id -> Integer, -/// /// This column is named `mytype` but references the table `type` column. -/// #[sql_name = "type"] -/// mytype -> Text, -/// } -/// } -/// # fn main() {} -/// ``` -/// -/// This module will also contain several helper types: -/// -/// dsl -/// --- -/// -/// This simply re-exports the table, renamed to the same name as the module, -/// and each of the columns. This is useful to glob import when you're dealing -/// primarily with one table, to allow writing `users.filter(name.eq("Sean"))` -/// instead of `users::table.filter(users::name.eq("Sean"))`. -/// -/// `all_columns` -/// ----------- -/// -/// A constant will be assigned called `all_columns`. This is what will be -/// selected if you don't otherwise specify a select clause. It's type will be -/// `table::AllColumns`. You can also get this value from the -/// `Table::all_columns` function. -/// -/// star -/// ---- -/// -/// This will be the qualified "star" expression for this table (e.g. -/// `users.*`). Internally, we read columns by index, not by name, so this -/// column is not safe to read data out of, and it has had it's SQL type set to -/// `()` to prevent accidentally using it as such. It is sometimes useful for -/// count statements however. It can also be accessed through the `Table.star()` -/// method. -/// -/// `SqlType` -/// ------- -/// -/// A type alias called `SqlType` will be created. It will be the SQL type of -/// `all_columns`. The SQL type is needed for things like [returning boxed -/// queries][boxed_queries]. -/// -/// [boxed_queries]: query_dsl/trait.QueryDsl.html#method.into_boxed -/// -/// `BoxedQuery` -/// ---------- -/// -/// ```ignore -/// pub type BoxedQuery<'a, DB, ST = SqlType> = BoxedSelectStatement<'a, ST, table, DB>; -/// ``` -#[macro_export] -macro_rules! table { - ($($tokens:tt)*) => { - __diesel_parse_table! { - tokens = [$($tokens)*], - imports = [], - meta = [], - sql_name = unknown, - name = unknown, - schema = public, - primary_key = (id), - } - } -} - -#[macro_export] -#[doc(hidden)] -macro_rules! __diesel_invalid_table_syntax { - () => { - compile_error!( - "Invalid `table!` syntax. Please see the `table!` macro docs for more info." - ); - }; -} - -#[macro_export] -#[doc(hidden)] -macro_rules! __diesel_parse_table { - // Found an import - ( - tokens = [use $($import:tt)::+; $($rest:tt)*], - imports = [$($imports:tt)*], - $($args:tt)* - ) => { - __diesel_parse_table! { - tokens = [$($rest)*], - imports = [$($imports)* use $($import)::+;], - $($args)* - } - }; - - // Found sql_name attribute, override whatever we had before - ( - tokens = [#[sql_name = $sql_name:expr] $($rest:tt)*], - imports = $imports:tt, - meta = $meta:tt, - sql_name = $ignore:tt, - $($args:tt)* - ) => { - __diesel_parse_table! { - tokens = [$($rest)*], - imports = $imports, - meta = $meta, - sql_name = $sql_name, - $($args)* - } - }; - - // Meta item other than sql_name, attach it to the table struct - ( - tokens = [#$new_meta:tt $($rest:tt)*], - imports = $imports:tt, - meta = [$($meta:tt)*], - $($args:tt)* - ) => { - __diesel_parse_table! { - tokens = [$($rest)*], - imports = $imports, - meta = [$($meta)* #$new_meta], - $($args)* - } - }; - - // Found a schema name, override whatever we had before - ( - tokens = [$schema:ident . $($rest:tt)*], - imports = $imports:tt, - meta = $meta:tt, - sql_name = $sql_name:tt, - name = $name:tt, - schema = $ignore:tt, - $($args:tt)* - ) => { - __diesel_parse_table! { - tokens = [$($rest)*], - imports = $imports, - meta = $meta, - sql_name = $sql_name, - name = $name, - schema = $schema, - $($args)* - } - }; - - // Found a table name, override whatever we had before - ( - tokens = [$name:ident $($rest:tt)*], - imports = $imports:tt, - meta = $meta:tt, - sql_name = $sql_name:tt, - name = $ignore:tt, - $($args:tt)* - ) => { - __diesel_parse_table! { - tokens = [$($rest)*], - imports = $imports, - meta = $meta, - sql_name = $sql_name, - name = $name, - $($args)* - } - }; - - // Found a primary key, override whatever we had before - ( - tokens = [($($pk:ident),+ $(,)*) $($rest:tt)*], - imports = $imports:tt, - meta = $meta:tt, - sql_name = $sql_name:tt, - name = $name:tt, - schema = $schema:tt, - primary_key = $ignore:tt, - $($args:tt)* - ) => { - __diesel_parse_table! { - tokens = [$($rest)*], - imports = $imports, - meta = $meta, - sql_name = $sql_name, - name = $name, - schema = $schema, - primary_key = ($($pk),+), - $($args)* - } - }; - - // Reached columns with no imports, set a default - ( - tokens = [{$($columns:tt)*}], - imports = [], - $($args:tt)* - ) => { - __diesel_parse_table! { - tokens = [{$($columns)*}], - imports = [use $crate::sql_types::*;], - $($args)* - } - }; - - // Reached columns with no sql_name, set a default - ( - tokens = [{$($columns:tt)*}], - imports = $imports:tt, - meta = $meta:tt, - sql_name = unknown, - name = $name:tt, - $($args:tt)* - ) => { - __diesel_parse_table! { - tokens = [{$($columns)*}], - imports = $imports, - meta = $meta, - sql_name = stringify!($name), - name = $name, - $($args)* - } - }; - - // Parse the columns - ( - tokens = [{$($columns:tt)*}], - $($args:tt)* - ) => { - __diesel_parse_columns! { - tokens = [$($columns)*], - table = { $($args)* }, - columns = [], - } - }; - - // Invalid syntax - ($($tokens:tt)*) => { - __diesel_invalid_table_syntax!(); - } -} - -#[macro_export] -#[doc(hidden)] -macro_rules! __diesel_parse_columns { - // No column being parsed, start a new one. - // Attempt to capture the type as separate tokens if at all possible. - ( - tokens = [ - $(#$meta:tt)* - $name:ident -> $($ty:tt)::* $(<$($ty_params:tt)::*>)*, - $($rest:tt)* - ], - $($args:tt)* - ) => { - __diesel_parse_columns! { - current_column = { - unchecked_meta = [$(#$meta)*], - name = $name, - sql_name = stringify!($name), - ty = ($($ty)::* $(<$($ty_params)::*>)*), - meta = [], - }, - tokens = [$($rest)*], - $($args)* - } - }; - - // No column being parsed, start a new one. Couldn't keep the `ty` separate. - ( - tokens = [ - $(#$meta:tt)* - $name:ident -> $ty:ty, - $($rest:tt)* - ], - $($args:tt)* - ) => { - __diesel_parse_columns! { - current_column = { - unchecked_meta = [$(#$meta)*], - name = $name, - sql_name = stringify!($name), - ty = ($ty), - meta = [], - }, - tokens = [$($rest)*], - $($args)* - } - }; - - - // Found #[sql_name] - ( - current_column = { - unchecked_meta = [#[sql_name = $sql_name:expr] $($meta:tt)*], - name = $name:tt, - sql_name = $ignore:expr, - $($current_column:tt)* - }, - $($args:tt)* - ) => { - __diesel_parse_columns! { - current_column = { - unchecked_meta = [$($meta)*], - name = $name, - sql_name = $sql_name, - $($current_column)* - }, - $($args)* - } - }; - - // Meta item other than #[sql_name] - ( - current_column = { - unchecked_meta = [#$new_meta:tt $($unchecked_meta:tt)*], - name = $name:tt, - sql_name = $sql_name:expr, - ty = $ty:tt, - meta = [$($meta:tt)*], - $($current_column:tt)* - }, - $($args:tt)* - ) => { - __diesel_parse_columns! { - current_column = { - unchecked_meta = [$($unchecked_meta)*], - name = $name, - sql_name = $sql_name, - ty = $ty, - meta = [$($meta)* #$new_meta], - $($current_column)* - }, - $($args)* - } - }; - - // Done parsing this column - ( - current_column = { - unchecked_meta = [], - $($current_column:tt)* - }, - tokens = $tokens:tt, - table = $table:tt, - columns = [$($columns:tt,)*], - $($args:tt)* - ) => { - __diesel_parse_columns! { - tokens = $tokens, - table = $table, - columns = [$($columns,)* { $($current_column)* },], - $($args)* - } - }; - - // Done parsing all columns - ( - tokens = [], - $($args:tt)* - ) => { - __diesel_table_impl!($($args)*); - }; - - // Invalid syntax - ($($tokens:tt)*) => { - __diesel_invalid_table_syntax!(); - } -} - -#[macro_export] -#[doc(hidden)] -macro_rules! __diesel_table_impl { - ( - table = { - imports = [$($imports:tt)*], - meta = [$($meta:tt)*], - sql_name = $sql_name:expr, - name = $table_name:ident, - schema = $schema:ident, - primary_key = $primary_key:tt, - }, - columns = [$({ - name = $column_name:ident, - sql_name = $column_sql_name:expr, - ty = ($($column_ty:tt)*), - $($column:tt)* - },)+], - ) => { - $($meta)* - pub mod $table_name { - #![allow(dead_code)] - use $crate::{ - QuerySource, - Table, - JoinTo, - }; - use $crate::associations::HasTable; - use $crate::insertable::Insertable; - use $crate::query_builder::*; - use $crate::query_builder::nodes::Identifier; - use $crate::query_source::{AppearsInFromClause, Once, Never}; - use $crate::query_source::joins::{Join, JoinOn}; - $($imports)* - pub use self::columns::*; - - /// Re-exports all of the columns of this table, as well as the - /// table struct renamed to the module name. This is meant to be - /// glob imported for functions which only deal with one table. - pub mod dsl { - $(static_cond! { - if $table_name == $column_name { - compile_error!(concat!( - "Column `", - stringify!($column_name), - "` cannot be named the same as its table.\n \ - You may use `#[sql_name = \"", - stringify!($column_name), - "\"]` to reference the table's `", - stringify!($column_name), - "` column. \n \ - See the documentation of the `table!` macro for details`\n" - )); - } else { - pub use super::columns::{$column_name}; - } - })+ - pub use super::table as $table_name; - } - - #[allow(non_upper_case_globals, dead_code)] - /// A tuple of all of the columns on this table - pub const all_columns: ($($column_name,)+) = ($($column_name,)+); - - #[allow(non_camel_case_types)] - #[derive(Debug, Clone, Copy, QueryId)] - /// The actual table struct - /// - /// This is the type which provides the base methods of the query - /// builder, such as `.select` and `.filter`. - pub struct table; - - impl table { - #[allow(dead_code)] - /// Represents `table_name.*`, which is sometimes necessary - /// for efficient count queries. It cannot be used in place of - /// `all_columns` - pub fn star(&self) -> star { - star - } - } - - /// The SQL type of all of the columns on this table - pub type SqlType = ($($($column_ty)*,)+); - - /// Helper type for representing a boxed query from this table - pub type BoxedQuery<'a, DB, ST = SqlType> = BoxedSelectStatement<'a, ST, table, DB>; - - __diesel_table_query_source_impl!(table, $schema, $sql_name); - - impl AsQuery for table { - type SqlType = SqlType; - type Query = SelectStatement; - - fn as_query(self) -> Self::Query { - SelectStatement::simple(self) - } - } - - impl Table for table { - type PrimaryKey = $primary_key; - type AllColumns = ($($column_name,)+); - - fn primary_key(&self) -> Self::PrimaryKey { - $primary_key - } - - fn all_columns() -> Self::AllColumns { - ($($column_name,)+) - } - } - - impl HasTable for table { - type Table = Self; - - fn table() -> Self::Table { - table - } - } - - impl IntoUpdateTarget for table { - type WhereClause = <::Query as IntoUpdateTarget>::WhereClause; - - fn into_update_target(self) -> UpdateTarget { - self.as_query().into_update_target() - } - } - - impl AppearsInFromClause
for table { - type Count = Once; - } - - impl AppearsInFromClause
for () { - type Count = Never; - } - - impl JoinTo> for table where - Join: JoinTo
, - { - type FromClause = Join; - type OnClause = as JoinTo
>::OnClause; - - fn join_target(rhs: Join) -> (Self::FromClause, Self::OnClause) { - let (_, on_clause) = Join::join_target(table); - (rhs, on_clause) - } - } - - impl JoinTo> for table where - JoinOn: JoinTo
, - { - type FromClause = JoinOn; - type OnClause = as JoinTo
>::OnClause; - - fn join_target(rhs: JoinOn) -> (Self::FromClause, Self::OnClause) { - let (_, on_clause) = JoinOn::join_target(table); - (rhs, on_clause) - } - } - - impl JoinTo> for table where - SelectStatement: JoinTo
, - { - type FromClause = SelectStatement; - type OnClause = as JoinTo
>::OnClause; - - fn join_target(rhs: SelectStatement) -> (Self::FromClause, Self::OnClause) { - let (_, on_clause) = SelectStatement::join_target(table); - (rhs, on_clause) - } - } - - impl<'a, QS, ST, DB> JoinTo> for table where - BoxedSelectStatement<'a, QS, ST, DB>: JoinTo
, - { - type FromClause = BoxedSelectStatement<'a, QS, ST, DB>; - type OnClause = as JoinTo
>::OnClause; - fn join_target(rhs: BoxedSelectStatement<'a, QS, ST, DB>) -> (Self::FromClause, Self::OnClause) { - let (_, on_clause) = BoxedSelectStatement::join_target(table); - (rhs, on_clause) - } - } - - // This impl should be able to live in Diesel, - // but Rust tries to recurse for no reason - impl Insertable for table - where -
::Query: Insertable, - { - type Values = <
::Query as Insertable>::Values; - - fn values(self) -> Self::Values { - self.as_query().values() - } - } - - impl<'a, T> Insertable for &'a table - where - table: Insertable, - { - type Values =
>::Values; - - fn values(self) -> Self::Values { - (*self).values() - } - } - - /// Contains all of the columns of this table - pub mod columns { - use super::table; - use $crate::{Expression, SelectableExpression, AppearsOnTable, QuerySource}; - use $crate::backend::Backend; - use $crate::query_builder::{QueryFragment, AstPass, SelectStatement}; - use $crate::query_source::joins::{Join, JoinOn, Inner, LeftOuter}; - use $crate::query_source::{AppearsInFromClause, Once, Never}; - use $crate::result::QueryResult; - $($imports)* - - #[allow(non_camel_case_types, dead_code)] - #[derive(Debug, Clone, Copy)] - /// Represents `table_name.*`, which is sometimes needed for - /// efficient count queries. It cannot be used in place of - /// `all_columns`, and has a `SqlType` of `()` to prevent it - /// being used that way - pub struct star; - - impl Expression for star { - type SqlType = (); - } - - impl QueryFragment for star where -
::FromClause: QueryFragment, - { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - table.from_clause().walk_ast(out.reborrow())?; - out.push_sql(".*"); - Ok(()) - } - } - - impl SelectableExpression
for star { - } - - impl AppearsOnTable
for star { - } - - $(__diesel_column! { - table = table, - name = $column_name, - sql_name = $column_sql_name, - ty = ($($column_ty)*), - $($column)* - })+ - } - } - } -} - -#[macro_export] -#[doc(hidden)] -macro_rules! __diesel_table_query_source_impl { - ($table_struct:ident, public, $table_name:expr) => { - impl QuerySource for $table_struct { - type FromClause = Identifier<'static>; - type DefaultSelection = ::AllColumns; - - fn from_clause(&self) -> Self::FromClause { - Identifier($table_name) - } - - fn default_selection(&self) -> Self::DefaultSelection { - Self::all_columns() - } - } - }; - - ($table_struct:ident, $schema_name:ident, $table_name:expr) => { - impl QuerySource for $table_struct { - type FromClause = $crate::query_builder::nodes::InfixNode< - 'static, - Identifier<'static>, - Identifier<'static>, - >; - type DefaultSelection = ::AllColumns; - - fn from_clause(&self) -> Self::FromClause { - $crate::query_builder::nodes::InfixNode::new( - Identifier(stringify!($schema_name)), - Identifier($table_name), - ".", - ) - } - - fn default_selection(&self) -> Self::DefaultSelection { - Self::all_columns() - } - } - }; -} - -/// Allow two tables to be referenced in a join query without providing an -/// explicit `ON` clause. -/// -/// The generated `ON` clause will always join to the primary key of the parent -/// table. This macro removes the need to call [`.on`] explicitly, you will -/// still need to invoke [`allow_tables_to_appear_in_same_query!`] for these two tables to -/// be able to use the resulting query, unless you are using `infer_schema!` or -/// `diesel print-schema` which will generate it for you. -/// -/// If you are using `infer_schema!` or `diesel print-schema`, an invocation of -/// this macro will be generated for every foreign key in your database unless -/// one of the following is true: -/// -/// - The foreign key references something other than the primary key -/// - The foreign key is composite -/// - There is more than one foreign key connecting two tables -/// - The foreign key is self-referential -/// -/// # Example -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// use schema::*; -/// -/// # /* -/// joinable!(posts -> users (user_id)); -/// allow_tables_to_appear_in_same_query!(posts, users); -/// # */ -/// -/// # fn main() { -/// let implicit_on_clause = users::table.inner_join(posts::table); -/// let implicit_on_clause_sql = diesel::debug_query::(&implicit_on_clause).to_string(); -/// -/// let explicit_on_clause = users::table -/// .inner_join(posts::table.on(posts::user_id.eq(users::id))); -/// let explicit_on_clause_sql = diesel::debug_query::(&explicit_on_clause).to_string(); -/// -/// assert_eq!(implicit_on_clause_sql, explicit_on_clause_sql); -/// # } -/// -/// ``` -/// -/// In the example above, the line `joinable!(posts -> users (user_id));` -/// -/// specifies the relation of the tables and the ON clause in the following way: -/// -/// `child_table -> parent_table (foreign_key)` -/// -/// * `parent_table` is the Table with the Primary key. -/// -/// * `child_table` is the Table with the Foreign key. -/// -/// So given the Table decaration from [Associations docs](/associations/index.html) -/// -/// * The parent table would be `User` -/// * The child table would be `Post` -/// * and the Foreign key would be `Post.user_id` -/// -/// For joins that do not explicitly use on clauses via [`JoinOnDsl`](/prelude/trait.JoinOnDsl.html) -/// the following on clause is generated implicitly: -/// ```sql -/// post JOIN users ON posts.user_id = users.id -/// ``` -#[macro_export] -macro_rules! joinable { - ($($child:ident)::* -> $($parent:ident)::* ($source:ident)) => { - joinable_inner!($($child)::* ::table => $($parent)::* ::table : ($($child)::* ::$source = $($parent)::* ::table)); - joinable_inner!($($parent)::* ::table => $($child)::* ::table : ($($child)::* ::$source = $($parent)::* ::table)); - } -} - -#[macro_export] -#[doc(hidden)] -macro_rules! joinable_inner { - ($left_table:path => $right_table:path : ($foreign_key:path = $parent_table:path)) => { - joinable_inner!( - left_table_ty = $left_table, - right_table_ty = $right_table, - right_table_expr = $right_table, - foreign_key = $foreign_key, - primary_key_ty = <$parent_table as $crate::query_source::Table>::PrimaryKey, - primary_key_expr = - <$parent_table as $crate::query_source::Table>::primary_key(&$parent_table), - ); - }; - - ( - left_table_ty = $left_table_ty:ty, - right_table_ty = $right_table_ty:ty, - right_table_expr = $right_table_expr:expr, - foreign_key = $foreign_key:path, - primary_key_ty = $primary_key_ty:ty, - primary_key_expr = $primary_key_expr:expr, - ) => { - impl $crate::JoinTo<$right_table_ty> for $left_table_ty { - type FromClause = $right_table_ty; - type OnClause = $crate::dsl::Eq< - $crate::expression::nullable::Nullable<$foreign_key>, - $crate::expression::nullable::Nullable<$primary_key_ty>, - >; - - fn join_target(rhs: $right_table_ty) -> (Self::FromClause, Self::OnClause) { - use $crate::{ExpressionMethods, NullableExpressionMethods}; - - ( - rhs, - $foreign_key.nullable().eq($primary_key_expr.nullable()), - ) - } - } - }; -} - -/// Allow two or more tables which are otherwise unrelated to be used together -/// in a query. -/// -/// This macro must be invoked any time two tables need to appear in the same -/// query either because they are being joined together, or because one appears -/// in a subselect. When this macro is invoked with more than 2 tables, every -/// combination of those tables will be allowed to appear together. -/// -/// If you are using `infer_schema!` or `diesel print-schema`, an invocation of -/// this macro will be generated for you for all tables in your schema. -/// -/// # Example -/// -/// ```ignore -/// // This would be required to do `users.inner_join(posts.inner_join(comments))` -/// allow_tables_to_appear_in_same_query!(comments, posts, users); -/// ``` -/// -/// When more than two tables are passed, the relevant code is generated for -/// every combination of those tables. This code would be equivalent to the -/// previous example. -/// -/// ```ignore -/// allow_tables_to_appear_in_same_query!(comments, posts); -/// allow_tables_to_appear_in_same_query!(comments, users); -/// allow_tables_to_appear_in_same_query!(posts, users); -/// ``` -#[macro_export] -macro_rules! allow_tables_to_appear_in_same_query { - ($left_mod:ident, $($right_mod:ident),+ $(,)*) => { - $( - impl $crate::query_source::AppearsInFromClause<$left_mod::table> - for $right_mod::table - { - type Count = $crate::query_source::Never; - } - - impl $crate::query_source::AppearsInFromClause<$right_mod::table> - for $left_mod::table - { - type Count = $crate::query_source::Never; - } - )+ - allow_tables_to_appear_in_same_query!($($right_mod,)+); - }; - - ($last_table:ident,) => {}; - - () => {}; -} - -/// Gets the value out of an option, or returns an error. -/// -/// This is used by `FromSql` implementations. -#[macro_export] -macro_rules! not_none { - ($bytes:expr) => { - match $bytes { - Some(bytes) => bytes, - None => return Err(Box::new($crate::result::UnexpectedNullError)), - } - }; -} - -// The order of these modules is important (at least for those which have tests). -// Utility macros which don't call any others need to come first. -#[macro_use] -mod internal; -#[macro_use] -mod query_id; -#[macro_use] -mod static_cond; -#[macro_use] -mod ops; -#[macro_use] -mod tuples; - -#[cfg(test)] -mod tests { - use prelude::*; - - table! { - foo.bars { - id -> Integer, - baz -> Text, - } - } - - mod my_types { - #[derive(Debug, Clone, Copy)] - pub struct MyCustomType; - } - - table! { - use sql_types::*; - use macros::tests::my_types::*; - - table_with_custom_types { - id -> Integer, - my_type -> MyCustomType, - } - } - - table! { - use sql_types::*; - use macros::tests::my_types::*; - - /// Table documentation - /// - /// some in detail documentation - table_with_custom_type_and_id (a) { - /// Column documentation - /// - /// some more details - a -> Integer, - my_type -> MyCustomType, - } - } - - #[test] - #[cfg(feature = "postgres")] - fn table_with_custom_schema() { - use pg::Pg; - let expected_sql = r#"SELECT "foo"."bars"."baz" FROM "foo"."bars" -- binds: []"#; - assert_eq!( - expected_sql, - &::debug_query::(&bars::table.select(bars::baz)).to_string() - ); - } - - table! { - use sql_types; - use sql_types::*; - - table_with_arbitrarily_complex_types { - id -> sql_types::Integer, - qualified_nullable -> sql_types::Nullable, - deeply_nested_type -> Option>, - // This actually should work, but there appears to be a rustc bug - // on the `AsExpression` bound for `EqAll` when the ty param is a projection - // projected_type -> as sql_types::IntoNullable>::Nullable, - random_tuple -> (Integer, Integer), - } - } - - table!( - foo { - /// Column doc - id -> Integer, - - #[sql_name = "type"] - /// Also important to document this column - mytype -> Integer, - - /// And this one - #[sql_name = "bleh"] - hey -> Integer, - } - ); - - #[test] - #[cfg(feature = "postgres")] - fn table_with_column_renaming_postgres() { - use pg::Pg; - let expected_sql = - r#"SELECT "foo"."id", "foo"."type", "foo"."bleh" FROM "foo" WHERE "foo"."type" = $1 -- binds: [1]"#; - assert_eq!( - expected_sql, - ::debug_query::(&foo::table.filter(foo::mytype.eq(1))).to_string() - ); - } - - #[test] - #[cfg(feature = "mysql")] - fn table_with_column_renaming_mysql() { - use mysql::Mysql; - let expected_sql = - r#"SELECT `foo`.`id`, `foo`.`type`, `foo`.`bleh` FROM `foo` WHERE `foo`.`type` = ? -- binds: [1]"#; - assert_eq!( - expected_sql, - ::debug_query::(&foo::table.filter(foo::mytype.eq(1))).to_string() - ); - } - - #[test] - #[cfg(feature = "sqlite")] - fn table_with_column_renaming_sqlite() { - use sqlite::Sqlite; - let expected_sql = - r#"SELECT `foo`.`id`, `foo`.`type`, `foo`.`bleh` FROM `foo` WHERE `foo`.`type` = ? -- binds: [1]"#; - assert_eq!( - expected_sql, - ::debug_query::(&foo::table.filter(foo::mytype.eq(1))).to_string() - ); - } - - table!( - use sql_types::*; - - /// Some documentation - #[sql_name="mod"] - /// Some more documentation - bar { - id -> Integer, - } - ); - - #[test] - #[cfg(feature = "postgres")] - fn table_renaming_postgres() { - use pg::Pg; - let expected_sql = r#"SELECT "mod"."id" FROM "mod" -- binds: []"#; - assert_eq!( - expected_sql, - ::debug_query::(&bar::table.select(bar::id)).to_string() - ); - } - - #[test] - #[cfg(feature = "mysql")] - fn table_renaming_mysql() { - use mysql::Mysql; - let expected_sql = r#"SELECT `mod`.`id` FROM `mod` -- binds: []"#; - assert_eq!( - expected_sql, - ::debug_query::(&bar::table.select(bar::id)).to_string() - ); - } - - #[test] - #[cfg(feature = "sqlite")] - fn table_renaming_sqlite() { - use sqlite::Sqlite; - let expected_sql = r#"SELECT `mod`.`id` FROM `mod` -- binds: []"#; - assert_eq!( - expected_sql, - ::debug_query::(&bar::table.select(bar::id)).to_string() - ); - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/macros/ops.rs b/collector/compile-benchmarks/diesel-1.4.8/src/macros/ops.rs deleted file mode 100644 index e1508981b..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/macros/ops.rs +++ /dev/null @@ -1,86 +0,0 @@ -#[macro_export] -/// Implements the Rust operator for a given type. If you create a new SQL -/// function, which returns a type that you'd like to use an operator on, you -/// should invoke this macro. Unfortunately, Rust disallows us from -/// automatically implementing `Add` and other traits from `std::ops`, under its -/// orphan rules. -macro_rules! operator_allowed { - ($tpe:ty, $op:ident, $fn_name:ident) => { - impl ::std::ops::$op for $tpe - where - Rhs: $crate::expression::AsExpression< - <<$tpe as $crate::Expression>::SqlType as $crate::sql_types::ops::$op>::Rhs, - >, - { - type Output = $crate::expression::ops::$op; - - fn $fn_name(self, rhs: Rhs) -> Self::Output { - $crate::expression::ops::$op::new(self, rhs.as_expression()) - } - } - }; -} - -#[macro_export] -/// Indicates that an expression allows all numeric operators. If you create new -/// SQL functions that return a numeric type, you should invoke this macro that -/// type. Unfortunately, Rust disallows us from automatically implementing `Add` -/// for types which implement `Expression`, under its orphan rules. -macro_rules! numeric_expr { - ($tpe:ty) => { - operator_allowed!($tpe, Add, add); - operator_allowed!($tpe, Sub, sub); - operator_allowed!($tpe, Div, div); - operator_allowed!($tpe, Mul, mul); - }; -} - -#[macro_export] -#[doc(hidden)] -macro_rules! __diesel_generate_ops_impls_if_numeric { - ($column_name:ident, Nullable<$($inner:tt)::*>) => { __diesel_generate_ops_impls_if_numeric!($column_name, $($inner)::*); }; - - ($column_name:ident, SmallInt) => { numeric_expr!($column_name); }; - ($column_name:ident, Int2) => { numeric_expr!($column_name); }; - ($column_name:ident, Smallint) => { numeric_expr!($column_name); }; - ($column_name:ident, SmallSerial) => { numeric_expr!($column_name); }; - - ($column_name:ident, Integer) => { numeric_expr!($column_name); }; - ($column_name:ident, Int4) => { numeric_expr!($column_name); }; - ($column_name:ident, Serial) => { numeric_expr!($column_name); }; - - ($column_name:ident, BigInt) => { numeric_expr!($column_name); }; - ($column_name:ident, Int8) => { numeric_expr!($column_name); }; - ($column_name:ident, Bigint) => { numeric_expr!($column_name); }; - ($column_name:ident, BigSerial) => { numeric_expr!($column_name); }; - - ($column_name:ident, Float) => { numeric_expr!($column_name); }; - ($column_name:ident, Float4) => { numeric_expr!($column_name); }; - - ($column_name:ident, Double) => { numeric_expr!($column_name); }; - ($column_name:ident, Float8) => { numeric_expr!($column_name); }; - - ($column_name:ident, Numeric) => { numeric_expr!($column_name); }; - - ($column_name:ident, $non_numeric_type:ty) => {}; -} - -#[macro_export] -#[doc(hidden)] -macro_rules! date_time_expr { - ($tpe:ty) => { - operator_allowed!($tpe, Add, add); - operator_allowed!($tpe, Sub, sub); - }; -} - -#[macro_export] -#[doc(hidden)] -macro_rules! __diesel_generate_ops_impls_if_date_time { - ($column_name:ident, Nullable<$($inner:tt)::*>) => { __diesel_generate_ops_impls_if_date_time!($column_name, $($inner)::*); }; - ($column_name:ident, Time) => { date_time_expr!($column_name); }; - ($column_name:ident, Date) => { date_time_expr!($column_name); }; - ($column_name:ident, Timestamp) => { date_time_expr!($column_name); }; - ($column_name:ident, Timestamptz) => { date_time_expr!($column_name); }; - ($column_name:ident, $non_date_time_type:ty) => {}; -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/macros/query_id.rs b/collector/compile-benchmarks/diesel-1.4.8/src/macros/query_id.rs deleted file mode 100644 index cb5acea36..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/macros/query_id.rs +++ /dev/null @@ -1,72 +0,0 @@ -/// Provides a standard implementation of `QueryId`. -/// Apps should not need to concern themselves with this macro. -/// -/// This macro should be called with the name of your type, along with all of -/// it's type parameters. -/// If the SQL generated by your type not uniquely identifiable by the type -/// itself, you should put `noop:` in front. -/// -/// For example, given the type `And`, invoking -/// `impl_query_id!(And)` will generate: -/// -/// ```rust,ignore -/// impl QueryId for And -/// where -/// Left: QueryId, -/// Right: QueryId, -/// { -/// type QueryId = And; -/// -/// const HAS_STATIC_QUERY_ID: bool = Left::HAS_STATIC_QUERY_ID && Right::HAS_STATIC_QUERY_ID; -/// } -/// ``` -/// -/// Invoking `impl_query_id!(noop: And)` will generate: -/// -/// ```rust,ignore -/// impl QueryId for And { -/// type QueryId = (); -/// -/// const HAS_STATIC_QUERY_ID: bool = false; -/// } -/// ``` -#[macro_export] -#[cfg(feature = "with-deprecated")] -#[deprecated(since = "1.1.0", note = "Use `#[derive(QueryId)]` instead")] -macro_rules! impl_query_id { - ($name: ident) => { - impl $crate::query_builder::QueryId for $name { - type QueryId = Self; - - const HAS_STATIC_QUERY_ID: bool = true; - } - }; - - ($name: ident<$($ty_param: ident),+>) => { - #[allow(non_camel_case_types)] - impl<$($ty_param),*> $crate::query_builder::QueryId for $name<$($ty_param),*> where - $($ty_param: $crate::query_builder::QueryId),* - { - type QueryId = $name<$($ty_param::QueryId),*>; - - const HAS_STATIC_QUERY_ID: bool = $($ty_param::HAS_STATIC_QUERY_ID &&)* true; - } - }; - - (noop: $name: ident) => { - impl $crate::query_builder::QueryId for $name { - type QueryId = (); - - const HAS_STATIC_QUERY_ID: bool = false; - } - }; - - (noop: $name: ident<$($ty_param: ident),+>) => { - #[allow(non_camel_case_types)] - impl<$($ty_param),*> $crate::query_builder::QueryId for $name<$($ty_param),*> { - type QueryId = (); - - const HAS_STATIC_QUERY_ID: bool = false; - } - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/macros/static_cond.rs b/collector/compile-benchmarks/diesel-1.4.8/src/macros/static_cond.rs deleted file mode 100644 index c6279f69d..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/macros/static_cond.rs +++ /dev/null @@ -1,38 +0,0 @@ -#![cfg_attr(rustfmt, rustfmt_skip)] // https://github.com/rust-lang-nursery/rustfmt/issues/2754 - -// Vendored from the static-cond crate as macro re-exports are not available in stable Rust. -// https://github.com/durka/static-cond/blob/36aa2dd/src/lib.rs -// -// Code is dual licensed under MIT/Apache-2.0 -// Copyright (c) 2016 Alex Burka -#[macro_export] -#[doc(hidden)] -macro_rules! static_cond { - // private rule to define and call the local macro - (@go $lhs:tt $rhs:tt $arm1:tt $arm2:tt) => { - // note that the inner macro has no captures (it can't, because there's no way to escape `$`) - macro_rules! __static_cond { - ($lhs $lhs) => $arm1; - ($lhs $rhs) => $arm2 - } - - __static_cond!($lhs $rhs); - }; - - // no else condition provided: fall through with empty else - (if $lhs:tt == $rhs:tt $then:tt) => { - static_cond!(if $lhs == $rhs $then else { }); - }; - (if $lhs:tt != $rhs:tt $then:tt) => { - static_cond!(if $lhs != $rhs $then else { }); - }; - - // we evaluate a conditional by generating a new macro (in an inner scope, so name shadowing is - // not a big concern) and calling it - (if $lhs:tt == $rhs:tt $then:tt else $els:tt) => { - static_cond!(@go $lhs $rhs $then $els); - }; - (if $lhs:tt != $rhs:tt $then:tt else $els:tt) => { - static_cond!(@go $lhs $rhs $els $then); - }; -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/macros/tuples.rs b/collector/compile-benchmarks/diesel-1.4.8/src/macros/tuples.rs deleted file mode 100644 index 8a83e32a0..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/macros/tuples.rs +++ /dev/null @@ -1,8532 +0,0 @@ -#[macro_export] -#[doc(hidden)] -macro_rules! __diesel_for_each_tuple { - ($callback:ident) => { - $callback! { - 1 { - (0) -> A, SA, TA, - } - 2 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - } - 3 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - } - 4 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - } - 5 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - } - 6 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - } - 7 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - } - 8 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - } - 9 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - } - 10 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - } - 11 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - } - 12 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - } - 13 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - } - 14 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - } - 15 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - } - 16 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - } - } - - #[cfg(feature = "32-column-tables")] - $callback! { - 17 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - } - 18 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - } - 19 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - } - 20 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - } - 21 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - } - 22 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - } - 23 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - } - 24 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - } - 25 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - } - 26 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - } - 27 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - } - 28 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - } - 29 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - } - 30 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - } - 31 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - } - 32 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - } - } - - #[cfg(feature = "64-column-tables")] - $callback! { - 33 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - } - 34 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - } - 35 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - } - 36 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - } - 37 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - } - 38 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - } - 39 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - } - 40 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - } - 41 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - } - 42 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - } - 43 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - } - 44 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - } - 45 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - } - 46 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - } - 47 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - } - 48 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - } - 49 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - } - 50 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - } - 51 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - } - 52 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - } - 53 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - } - 54 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - } - 55 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - } - 56 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - } - 57 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - } - 58 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - } - 59 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - } - 60 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - } - 61 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - } - 62 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - } - 63 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - } - 64 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - } - } - - #[cfg(feature = "128-column-tables")] - $callback! { - 65 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - } - 66 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - } - 67 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - } - 68 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - } - 69 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - } - 70 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - } - 71 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - } - 72 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - } - 73 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - } - 74 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - } - 75 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - } - 76 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - } - 77 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - } - 78 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - } - 79 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - } - 80 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - } - 81 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - } - 82 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - } - 83 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - } - 84 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - } - 85 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - } - 86 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - } - 87 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - } - 88 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - } - 89 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - } - 90 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - } - 91 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - } - 92 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - } - 93 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - } - 94 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - } - 95 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - } - 96 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - } - 97 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - } - 98 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - } - 99 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - } - 100 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - } - 101 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - } - 102 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - } - 103 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - } - 104 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - } - 105 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - } - 106 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - } - 107 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - } - 108 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - } - 109 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - } - 110 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - } - 111 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - (110) -> DG, SDG, TDG, - } - 112 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - (110) -> DG, SDG, TDG, - (111) -> DH, SDH, TDH, - } - 113 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - (110) -> DG, SDG, TDG, - (111) -> DH, SDH, TDH, - (112) -> DI, SDI, TDI, - } - 114 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - (110) -> DG, SDG, TDG, - (111) -> DH, SDH, TDH, - (112) -> DI, SDI, TDI, - (113) -> DJ, SDJ, TDJ, - } - 115 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - (110) -> DG, SDG, TDG, - (111) -> DH, SDH, TDH, - (112) -> DI, SDI, TDI, - (113) -> DJ, SDJ, TDJ, - (114) -> DK, SDK, TDK, - } - 116 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - (110) -> DG, SDG, TDG, - (111) -> DH, SDH, TDH, - (112) -> DI, SDI, TDI, - (113) -> DJ, SDJ, TDJ, - (114) -> DK, SDK, TDK, - (115) -> DL, SDL, TDL, - } - 117 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - (110) -> DG, SDG, TDG, - (111) -> DH, SDH, TDH, - (112) -> DI, SDI, TDI, - (113) -> DJ, SDJ, TDJ, - (114) -> DK, SDK, TDK, - (115) -> DL, SDL, TDL, - (116) -> DM, SDM, TDM, - } - 118 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - (110) -> DG, SDG, TDG, - (111) -> DH, SDH, TDH, - (112) -> DI, SDI, TDI, - (113) -> DJ, SDJ, TDJ, - (114) -> DK, SDK, TDK, - (115) -> DL, SDL, TDL, - (116) -> DM, SDM, TDM, - (117) -> DN, SDN, TDN, - } - 119 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - (110) -> DG, SDG, TDG, - (111) -> DH, SDH, TDH, - (112) -> DI, SDI, TDI, - (113) -> DJ, SDJ, TDJ, - (114) -> DK, SDK, TDK, - (115) -> DL, SDL, TDL, - (116) -> DM, SDM, TDM, - (117) -> DN, SDN, TDN, - (118) -> DO, SDO, TDO, - } - 120 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - (110) -> DG, SDG, TDG, - (111) -> DH, SDH, TDH, - (112) -> DI, SDI, TDI, - (113) -> DJ, SDJ, TDJ, - (114) -> DK, SDK, TDK, - (115) -> DL, SDL, TDL, - (116) -> DM, SDM, TDM, - (117) -> DN, SDN, TDN, - (118) -> DO, SDO, TDO, - (119) -> DP, SDP, TDP, - } - 121 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - (110) -> DG, SDG, TDG, - (111) -> DH, SDH, TDH, - (112) -> DI, SDI, TDI, - (113) -> DJ, SDJ, TDJ, - (114) -> DK, SDK, TDK, - (115) -> DL, SDL, TDL, - (116) -> DM, SDM, TDM, - (117) -> DN, SDN, TDN, - (118) -> DO, SDO, TDO, - (119) -> DP, SDP, TDP, - (120) -> DQ, SDQ, TDQ, - } - 122 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - (110) -> DG, SDG, TDG, - (111) -> DH, SDH, TDH, - (112) -> DI, SDI, TDI, - (113) -> DJ, SDJ, TDJ, - (114) -> DK, SDK, TDK, - (115) -> DL, SDL, TDL, - (116) -> DM, SDM, TDM, - (117) -> DN, SDN, TDN, - (118) -> DO, SDO, TDO, - (119) -> DP, SDP, TDP, - (120) -> DQ, SDQ, TDQ, - (121) -> DR, SDR, TDR, - } - 123 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - (110) -> DG, SDG, TDG, - (111) -> DH, SDH, TDH, - (112) -> DI, SDI, TDI, - (113) -> DJ, SDJ, TDJ, - (114) -> DK, SDK, TDK, - (115) -> DL, SDL, TDL, - (116) -> DM, SDM, TDM, - (117) -> DN, SDN, TDN, - (118) -> DO, SDO, TDO, - (119) -> DP, SDP, TDP, - (120) -> DQ, SDQ, TDQ, - (121) -> DR, SDR, TDR, - (122) -> DS, SDS, TDS, - } - 124 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - (110) -> DG, SDG, TDG, - (111) -> DH, SDH, TDH, - (112) -> DI, SDI, TDI, - (113) -> DJ, SDJ, TDJ, - (114) -> DK, SDK, TDK, - (115) -> DL, SDL, TDL, - (116) -> DM, SDM, TDM, - (117) -> DN, SDN, TDN, - (118) -> DO, SDO, TDO, - (119) -> DP, SDP, TDP, - (120) -> DQ, SDQ, TDQ, - (121) -> DR, SDR, TDR, - (122) -> DS, SDS, TDS, - (123) -> DT, SDT, TDT, - } - 125 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - (110) -> DG, SDG, TDG, - (111) -> DH, SDH, TDH, - (112) -> DI, SDI, TDI, - (113) -> DJ, SDJ, TDJ, - (114) -> DK, SDK, TDK, - (115) -> DL, SDL, TDL, - (116) -> DM, SDM, TDM, - (117) -> DN, SDN, TDN, - (118) -> DO, SDO, TDO, - (119) -> DP, SDP, TDP, - (120) -> DQ, SDQ, TDQ, - (121) -> DR, SDR, TDR, - (122) -> DS, SDS, TDS, - (123) -> DT, SDT, TDT, - (124) -> DU, SDU, TDU, - } - 126 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - (110) -> DG, SDG, TDG, - (111) -> DH, SDH, TDH, - (112) -> DI, SDI, TDI, - (113) -> DJ, SDJ, TDJ, - (114) -> DK, SDK, TDK, - (115) -> DL, SDL, TDL, - (116) -> DM, SDM, TDM, - (117) -> DN, SDN, TDN, - (118) -> DO, SDO, TDO, - (119) -> DP, SDP, TDP, - (120) -> DQ, SDQ, TDQ, - (121) -> DR, SDR, TDR, - (122) -> DS, SDS, TDS, - (123) -> DT, SDT, TDT, - (124) -> DU, SDU, TDU, - (125) -> DV, SDV, TDV, - } - 127 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - (110) -> DG, SDG, TDG, - (111) -> DH, SDH, TDH, - (112) -> DI, SDI, TDI, - (113) -> DJ, SDJ, TDJ, - (114) -> DK, SDK, TDK, - (115) -> DL, SDL, TDL, - (116) -> DM, SDM, TDM, - (117) -> DN, SDN, TDN, - (118) -> DO, SDO, TDO, - (119) -> DP, SDP, TDP, - (120) -> DQ, SDQ, TDQ, - (121) -> DR, SDR, TDR, - (122) -> DS, SDS, TDS, - (123) -> DT, SDT, TDT, - (124) -> DU, SDU, TDU, - (125) -> DV, SDV, TDV, - (126) -> DW, SDW, TDW, - } - 128 { - (0) -> A, SA, TA, - (1) -> B, SB, TB, - (2) -> C, SC, TC, - (3) -> D, SD, TD, - (4) -> E, SE, TE, - (5) -> F, SF, TF, - (6) -> G, SG, TG, - (7) -> H, SH, TH, - (8) -> I, SI, TI, - (9) -> J, SJ, TJ, - (10) -> K, SK, TK, - (11) -> L, SL, TL, - (12) -> M, SM, TM, - (13) -> N, SN, TN, - (14) -> O, SO, TO, - (15) -> P, SP, TP, - (16) -> Q, SQ, TQ, - (17) -> R, SR, TR, - (18) -> S, SS, TS, - (19) -> T, ST, TT, - (20) -> U, SU, TU, - (21) -> V, SV, TV, - (22) -> W, SW, TW, - (23) -> X, SX, TX, - (24) -> Y, SY, TY, - (25) -> Z, SZ, TZ, - (26) -> AA, SAA, TAA, - (27) -> AB, SAB, TAB, - (28) -> AC, SAC, TAC, - (29) -> AD, SAD, TAD, - (30) -> AE, SAE, TAE, - (31) -> AF, SAF, TAF, - (32) -> AG, SAG, TAG, - (33) -> AH, SAH, TAH, - (34) -> AI, SAI, TAI, - (35) -> AJ, SAJ, TAJ, - (36) -> AK, SAK, TAK, - (37) -> AL, SAL, TAL, - (38) -> AM, SAM, TAM, - (39) -> AN, SAN, TAN, - (40) -> AO, SAO, TAO, - (41) -> AP, SAP, TAP, - (42) -> AQ, SAQ, TAQ, - (43) -> AR, SAR, TAR, - (44) -> AS, SAS, TAS, - (45) -> AT, SAT, TAT, - (46) -> AU, SAU, TAU, - (47) -> AV, SAV, TAV, - (48) -> AW, SAW, TAW, - (49) -> AX, SAX, TAX, - (50) -> AY, SAY, TAY, - (51) -> AZ, SAZ, TAZ, - (52) -> BA, SBA, TBA, - (53) -> BB, SBB, TBB, - (54) -> BC, SBC, TBC, - (55) -> BD, SBD, TBD, - (56) -> BE, SBE, TBE, - (57) -> BF, SBF, TBF, - (58) -> BG, SBG, TBG, - (59) -> BH, SBH, TBH, - (60) -> BI, SBI, TBI, - (61) -> BJ, SBJ, TBJ, - (62) -> BK, SBK, TBK, - (63) -> BL, SBL, TBL, - (64) -> BM, SBM, TBM, - (65) -> BN, SBN, TBN, - (66) -> BO, SBO, TBO, - (67) -> BP, SBP, TBP, - (68) -> BQ, SBQ, TBQ, - (69) -> BR, SBR, TBR, - (70) -> BS, SBS, TBS, - (71) -> BT, SBT, TBT, - (72) -> BU, SBU, TBU, - (73) -> BV, SBV, TBV, - (74) -> BW, SBW, TBW, - (75) -> BX, SBX, TBX, - (76) -> BY, SBY, TBY, - (77) -> BZ, SBZ, TBZ, - (78) -> CA, SCA, TCA, - (79) -> CB, SCB, TCB, - (80) -> CC, SCC, TCC, - (81) -> CD, SCD, TCD, - (82) -> CE, SCE, TCE, - (83) -> CF, SCF, TCF, - (84) -> CG, SCG, TCG, - (85) -> CH, SCH, TCH, - (86) -> CI, SCI, TCI, - (87) -> CJ, SCJ, TCJ, - (88) -> CK, SCK, TCK, - (89) -> CL, SCL, TCL, - (90) -> CM, SCM, TCM, - (91) -> CN, SCN, TCN, - (92) -> CO, SCO, TCO, - (93) -> CP, SCP, TCP, - (94) -> CQ, SCQ, TCQ, - (95) -> CR, SCR, TCR, - (96) -> CS, SCS, TCS, - (97) -> CT, SCT, TCT, - (98) -> CU, SCU, TCU, - (99) -> CV, SCV, TCV, - (100) -> CW, SCW, TCW, - (101) -> CX, SCX, TCX, - (102) -> CY, SCY, TCY, - (103) -> CZ, SCZ, TCZ, - (104) -> DA, SDA, TDA, - (105) -> DB, SDB, TDB, - (106) -> DC, SDC, TDC, - (107) -> DD, SDD, TDD, - (108) -> DE, SDE, TDE, - (109) -> DF, SDF, TDF, - (110) -> DG, SDG, TDG, - (111) -> DH, SDH, TDH, - (112) -> DI, SDI, TDI, - (113) -> DJ, SDJ, TDJ, - (114) -> DK, SDK, TDK, - (115) -> DL, SDL, TDL, - (116) -> DM, SDM, TDM, - (117) -> DN, SDN, TDN, - (118) -> DO, SDO, TDO, - (119) -> DP, SDP, TDP, - (120) -> DQ, SDQ, TDQ, - (121) -> DR, SDR, TDR, - (122) -> DS, SDS, TDS, - (123) -> DT, SDT, TDT, - (124) -> DU, SDU, TDU, - (125) -> DV, SDV, TDV, - (126) -> DW, SDW, TDW, - (127) -> DX, SDX, TDX, - } - } - }; -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/migration/errors.rs b/collector/compile-benchmarks/diesel-1.4.8/src/migration/errors.rs deleted file mode 100644 index 5d095eabf..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/migration/errors.rs +++ /dev/null @@ -1,128 +0,0 @@ -//! Error types that represent migration errors. -//! These are split into multiple segments, depending on -//! where in the migration process an error occurs. - -use std::convert::From; -use std::error::Error; -use std::path::PathBuf; -use std::{fmt, io}; - -use result; - -/// Errors that occur while preparing to run migrations -#[derive(Debug)] -pub enum MigrationError { - /// The migration directory wasn't found - MigrationDirectoryNotFound, - /// Provided migration was in an unknown format - UnknownMigrationFormat(PathBuf), - /// General system IO error - IoError(io::Error), - /// Provided migration had an incompatible version number - UnknownMigrationVersion(String), - /// No migrations had to be/ could be run - NoMigrationRun, - /// - #[doc(hidden)] - __NonExhaustive, -} - -impl Error for MigrationError { - fn description(&self) -> &str { - match *self { - MigrationError::MigrationDirectoryNotFound => { - "Unable to find migrations directory in this directory or any parent directories." - } - MigrationError::UnknownMigrationFormat(_) => { - "Invalid migration directory, the directory's name should be \ - _, and it should only contain up.sql and down.sql." - } - MigrationError::IoError(ref error) => error.description(), - MigrationError::UnknownMigrationVersion(_) => { - "Unable to find migration version to revert in the migrations directory." - } - MigrationError::NoMigrationRun => { - "No migrations have been run. Did you forget `diesel migration run`?" - } - MigrationError::__NonExhaustive => unreachable!(), - } - } -} - -impl fmt::Display for MigrationError { - fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { - self.description().fmt(f) - } -} - -impl PartialEq for MigrationError { - fn eq(&self, other: &Self) -> bool { - match (self, other) { - ( - &MigrationError::MigrationDirectoryNotFound, - &MigrationError::MigrationDirectoryNotFound, - ) => true, - ( - &MigrationError::UnknownMigrationFormat(ref p1), - &MigrationError::UnknownMigrationFormat(ref p2), - ) => p1 == p2, - _ => false, - } - } -} - -impl From for MigrationError { - fn from(e: io::Error) -> Self { - MigrationError::IoError(e) - } -} - -/// Errors that occur while running migrations -#[derive(Debug, PartialEq)] -#[allow(clippy::enum_variant_names)] -pub enum RunMigrationsError { - /// A general migration error occured - MigrationError(MigrationError), - /// The provided migration included an invalid query - QueryError(result::Error), - /// The provided migration was empty - EmptyMigration, - /// - #[doc(hidden)] - __NonExhaustive, -} - -impl Error for RunMigrationsError { - fn description(&self) -> &str { - match *self { - RunMigrationsError::MigrationError(ref error) => error.description(), - RunMigrationsError::QueryError(ref error) => error.description(), - RunMigrationsError::EmptyMigration => "Attempted to run an empty migration.", - RunMigrationsError::__NonExhaustive => unreachable!(), - } - } -} - -impl fmt::Display for RunMigrationsError { - fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { - write!(f, "Failed with: {}", self.description()) - } -} - -impl From for RunMigrationsError { - fn from(e: MigrationError) -> Self { - RunMigrationsError::MigrationError(e) - } -} - -impl From for RunMigrationsError { - fn from(e: result::Error) -> Self { - RunMigrationsError::QueryError(e) - } -} - -impl From for RunMigrationsError { - fn from(e: io::Error) -> Self { - RunMigrationsError::MigrationError(e.into()) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/migration/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/migration/mod.rs deleted file mode 100644 index e78cfa2a5..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/migration/mod.rs +++ /dev/null @@ -1,55 +0,0 @@ -//! Representation of migrations - -mod errors; -pub use self::errors::{MigrationError, RunMigrationsError}; - -use connection::SimpleConnection; -use std::path::Path; - -/// Represents a migration that interacts with diesel -pub trait Migration { - /// Get the migration version - fn version(&self) -> &str; - /// Apply this migration - fn run(&self, conn: &dyn SimpleConnection) -> Result<(), RunMigrationsError>; - /// Revert this migration - fn revert(&self, conn: &dyn SimpleConnection) -> Result<(), RunMigrationsError>; - /// Get the migration file path - fn file_path(&self) -> Option<&Path> { - None - } -} - -impl Migration for Box { - fn version(&self) -> &str { - (&**self).version() - } - - fn run(&self, conn: &dyn SimpleConnection) -> Result<(), RunMigrationsError> { - (&**self).run(conn) - } - - fn revert(&self, conn: &dyn SimpleConnection) -> Result<(), RunMigrationsError> { - (&**self).revert(conn) - } - fn file_path(&self) -> Option<&Path> { - (&**self).file_path() - } -} - -impl<'a> Migration for &'a dyn Migration { - fn version(&self) -> &str { - (&**self).version() - } - - fn run(&self, conn: &dyn SimpleConnection) -> Result<(), RunMigrationsError> { - (&**self).run(conn) - } - - fn revert(&self, conn: &dyn SimpleConnection) -> Result<(), RunMigrationsError> { - (&**self).revert(conn) - } - fn file_path(&self) -> Option<&Path> { - (&**self).file_path() - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/backend.rs b/collector/compile-benchmarks/diesel-1.4.8/src/mysql/backend.rs deleted file mode 100644 index 91b32be59..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/backend.rs +++ /dev/null @@ -1,62 +0,0 @@ -//! The MySQL backend - -use byteorder::NativeEndian; - -use super::bind_collector::MysqlBindCollector; -use super::query_builder::MysqlQueryBuilder; -use backend::*; -use sql_types::TypeMetadata; - -/// The MySQL backend -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct Mysql; - -#[allow(missing_debug_implementations)] -/// Represents the possible forms a bind parameter can be transmitted as. -/// Each variant represents one of the forms documented at -/// -/// -/// The null variant is omitted, as we will never prepare a statement in which -/// one of the bind parameters can always be NULL -#[derive(Hash, PartialEq, Eq, Clone, Copy)] -pub enum MysqlType { - /// Sets `buffer_type` to `MYSQL_TYPE_TINY` - Tiny, - /// Sets `buffer_type` to `MYSQL_TYPE_SHORT` - Short, - /// Sets `buffer_type` to `MYSQL_TYPE_LONG` - Long, - /// Sets `buffer_type` to `MYSQL_TYPE_LONGLONG` - LongLong, - /// Sets `buffer_type` to `MYSQL_TYPE_FLOAT` - Float, - /// Sets `buffer_type` to `MYSQL_TYPE_DOUBLE` - Double, - /// Sets `buffer_type` to `MYSQL_TYPE_TIME` - Time, - /// Sets `buffer_type` to `MYSQL_TYPE_DATE` - Date, - /// Sets `buffer_type` to `MYSQL_TYPE_DATETIME` - DateTime, - /// Sets `buffer_type` to `MYSQL_TYPE_TIMESTAMP` - Timestamp, - /// Sets `buffer_type` to `MYSQL_TYPE_STRING` - String, - /// Sets `buffer_type` to `MYSQL_TYPE_BLOB` - Blob, -} - -impl Backend for Mysql { - type QueryBuilder = MysqlQueryBuilder; - type BindCollector = MysqlBindCollector; - type RawValue = [u8]; - type ByteOrder = NativeEndian; -} - -impl TypeMetadata for Mysql { - type TypeMetadata = MysqlType; - type MetadataLookup = (); -} - -impl SupportsDefaultKeyword for Mysql {} -impl UsesAnsiSavepointSyntax for Mysql {} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/bind_collector.rs b/collector/compile-benchmarks/diesel-1.4.8/src/mysql/bind_collector.rs deleted file mode 100644 index 9916c5f02..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/bind_collector.rs +++ /dev/null @@ -1,40 +0,0 @@ -use super::{Mysql, MysqlType}; -use query_builder::BindCollector; -use result::Error::SerializationError; -use result::QueryResult; -use serialize::{IsNull, Output, ToSql}; -use sql_types::{HasSqlType, IsSigned}; - -#[derive(Default)] -#[doc(hidden)] -#[allow(missing_debug_implementations)] -pub struct MysqlBindCollector { - pub(crate) binds: Vec<(MysqlType, IsSigned, Option>)>, -} - -impl MysqlBindCollector { - pub(crate) fn new() -> Self { - Self::default() - } -} - -impl BindCollector for MysqlBindCollector { - fn push_bound_value(&mut self, bind: &U, metadata_lookup: &()) -> QueryResult<()> - where - Mysql: HasSqlType, - U: ToSql, - { - let mut to_sql_output = Output::new(Vec::new(), metadata_lookup); - let is_null = bind - .to_sql(&mut to_sql_output) - .map_err(SerializationError)?; - let bytes = match is_null { - IsNull::No => Some(to_sql_output.into_inner()), - IsNull::Yes => None, - }; - let metadata = Mysql::metadata(metadata_lookup); - let sign = Mysql::is_signed(); - self.binds.push((metadata, sign, bytes)); - Ok(()) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/bind.rs b/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/bind.rs deleted file mode 100644 index 6ee5da4a5..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/bind.rs +++ /dev/null @@ -1,257 +0,0 @@ -extern crate mysqlclient_sys as ffi; - -use std::mem; -use std::os::raw as libc; - -use super::stmt::Statement; -use crate::mysql::types::MYSQL_TIME; -use mysql::MysqlType; -use result::QueryResult; -use sql_types::IsSigned; - -pub struct Binds { - data: Vec, -} - -impl Binds { - pub fn from_input_data(input: Iter) -> Self - where - Iter: IntoIterator>)>, - { - let data = input - .into_iter() - .map(|(tpe, sign, bytes)| BindData::for_input(tpe, is_signed_to_my_bool(sign), bytes)) - .collect(); - - Binds { data: data } - } - - pub fn from_output_types(types: Vec<(MysqlType, IsSigned)>) -> Self { - let data = types - .into_iter() - .map(|(ty, sign)| (mysql_type_to_ffi_type(ty), is_signed_to_my_bool(sign))) - .map(BindData::for_output) - .collect(); - - Binds { data: data } - } - - pub fn from_result_metadata(fields: &[ffi::MYSQL_FIELD]) -> Self { - let data = fields - .iter() - .map(|field| (field.type_, is_field_unsigned(field))) - .map(BindData::for_output) - .collect(); - - Binds { data } - } - - pub fn with_mysql_binds(&mut self, f: F) -> T - where - F: FnOnce(*mut ffi::MYSQL_BIND) -> T, - { - let mut binds = self - .data - .iter_mut() - .map(|x| unsafe { x.mysql_bind() }) - .collect::>(); - f(binds.as_mut_ptr()) - } - - pub fn populate_dynamic_buffers(&mut self, stmt: &Statement) -> QueryResult<()> { - for (i, data) in self.data.iter_mut().enumerate() { - data.did_numeric_overflow_occur()?; - // This is safe because we are re-binding the invalidated buffers - // at the end of this function - unsafe { - if let Some((mut bind, offset)) = data.bind_for_truncated_data() { - stmt.fetch_column(&mut bind, i, offset)? - } else { - data.update_buffer_length() - } - } - } - - unsafe { self.with_mysql_binds(|bind_ptr| stmt.bind_result(bind_ptr)) } - } - - pub fn update_buffer_lengths(&mut self) { - for data in &mut self.data { - data.update_buffer_length(); - } - } - - pub fn field_data(&self, idx: usize) -> Option<&[u8]> { - self.data[idx].bytes() - } -} - -struct BindData { - tpe: ffi::enum_field_types, - bytes: Vec, - length: libc::c_ulong, - is_null: ffi::my_bool, - is_truncated: Option, - is_unsigned: ffi::my_bool, -} - -impl BindData { - fn for_input(tpe: MysqlType, is_unsigned: ffi::my_bool, data: Option>) -> Self { - let is_null = if data.is_none() { 1 } else { 0 }; - let bytes = data.unwrap_or_default(); - let length = bytes.len() as libc::c_ulong; - - BindData { - tpe: mysql_type_to_ffi_type(tpe), - bytes: bytes, - length: length, - is_null: is_null, - is_truncated: None, - is_unsigned, - } - } - - fn for_output((tpe, is_unsigned): (ffi::enum_field_types, ffi::my_bool)) -> Self { - let bytes = known_buffer_size_for_ffi_type(tpe) - .map(|len| vec![0; len]) - .unwrap_or_default(); - let length = bytes.len() as libc::c_ulong; - - BindData { - tpe: tpe, - bytes: bytes, - length: length, - is_null: 0, - is_truncated: Some(0), - is_unsigned, - } - } - - fn is_truncated(&self) -> bool { - self.is_truncated.unwrap_or(0) != 0 - } - - fn is_fixed_size_buffer(&self) -> bool { - known_buffer_size_for_ffi_type(self.tpe).is_some() - } - - fn bytes(&self) -> Option<&[u8]> { - if self.is_null == 0 { - Some(&*self.bytes) - } else { - None - } - } - - fn update_buffer_length(&mut self) { - use std::cmp::min; - - let actual_bytes_in_buffer = min(self.bytes.capacity(), self.length as usize); - unsafe { self.bytes.set_len(actual_bytes_in_buffer) } - } - - unsafe fn mysql_bind(&mut self) -> ffi::MYSQL_BIND { - let mut bind: ffi::MYSQL_BIND = mem::zeroed(); - bind.buffer_type = self.tpe; - bind.buffer = self.bytes.as_mut_ptr() as *mut libc::c_void; - bind.buffer_length = self.bytes.capacity() as libc::c_ulong; - bind.length = &mut self.length; - bind.is_null = &mut self.is_null; - bind.is_unsigned = self.is_unsigned; - - if let Some(ref mut is_truncated) = self.is_truncated { - bind.error = is_truncated; - } - - bind - } - - /// Resizes the byte buffer to fit the value of `self.length`, and returns - /// a tuple of a bind pointing at the truncated data, and the offset to use - /// in order to read the truncated data into it. - /// - /// This invalidates the bind previously returned by `mysql_bind`. Calling - /// this function is unsafe unless the binds are immediately rebound. - unsafe fn bind_for_truncated_data(&mut self) -> Option<(ffi::MYSQL_BIND, usize)> { - if self.is_truncated() { - let offset = self.bytes.capacity(); - let truncated_amount = self.length as usize - offset; - - debug_assert!( - truncated_amount > 0, - "output buffers were invalidated \ - without calling `mysql_stmt_bind_result`" - ); - self.bytes.set_len(offset); - self.bytes.reserve(truncated_amount); - self.bytes.set_len(self.length as usize); - - let mut bind = self.mysql_bind(); - bind.buffer = self.bytes[offset..].as_mut_ptr() as *mut libc::c_void; - bind.buffer_length = truncated_amount as libc::c_ulong; - Some((bind, offset)) - } else { - None - } - } - - fn did_numeric_overflow_occur(&self) -> QueryResult<()> { - use result::Error::DeserializationError; - - if self.is_truncated() && self.is_fixed_size_buffer() { - Err(DeserializationError( - "Numeric overflow/underflow occurred".into(), - )) - } else { - Ok(()) - } - } -} - -fn mysql_type_to_ffi_type(tpe: MysqlType) -> ffi::enum_field_types { - use self::ffi::enum_field_types::*; - - match tpe { - MysqlType::Tiny => MYSQL_TYPE_TINY, - MysqlType::Short => MYSQL_TYPE_SHORT, - MysqlType::Long => MYSQL_TYPE_LONG, - MysqlType::LongLong => MYSQL_TYPE_LONGLONG, - MysqlType::Float => MYSQL_TYPE_FLOAT, - MysqlType::Double => MYSQL_TYPE_DOUBLE, - MysqlType::Time => MYSQL_TYPE_TIME, - MysqlType::Date => MYSQL_TYPE_DATE, - MysqlType::DateTime => MYSQL_TYPE_DATETIME, - MysqlType::Timestamp => MYSQL_TYPE_TIMESTAMP, - MysqlType::String => MYSQL_TYPE_STRING, - MysqlType::Blob => MYSQL_TYPE_BLOB, - } -} - -fn known_buffer_size_for_ffi_type(tpe: ffi::enum_field_types) -> Option { - use self::ffi::enum_field_types as t; - use std::mem::size_of; - - match tpe { - t::MYSQL_TYPE_TINY => Some(1), - t::MYSQL_TYPE_YEAR | t::MYSQL_TYPE_SHORT => Some(2), - t::MYSQL_TYPE_INT24 | t::MYSQL_TYPE_LONG | t::MYSQL_TYPE_FLOAT => Some(4), - t::MYSQL_TYPE_LONGLONG | t::MYSQL_TYPE_DOUBLE => Some(8), - t::MYSQL_TYPE_TIME - | t::MYSQL_TYPE_DATE - | t::MYSQL_TYPE_DATETIME - | t::MYSQL_TYPE_TIMESTAMP => Some(size_of::()), - _ => None, - } -} - -fn is_field_unsigned(field: &ffi::MYSQL_FIELD) -> ffi::my_bool { - const UNSIGNED_FLAG: libc::c_uint = 32; - (field.flags & UNSIGNED_FLAG > 0) as _ -} - -fn is_signed_to_my_bool(sign: IsSigned) -> ffi::my_bool { - match sign { - IsSigned::Signed => false as _, - IsSigned::Unsigned => true as _, - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/mod.rs deleted file mode 100644 index 5efabc13b..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/mod.rs +++ /dev/null @@ -1,176 +0,0 @@ -mod bind; -mod raw; -mod stmt; -mod url; - -use self::raw::RawConnection; -use self::stmt::Statement; -use self::url::ConnectionOptions; -use super::backend::Mysql; -use super::bind_collector::MysqlBindCollector; -use connection::*; -use deserialize::{Queryable, QueryableByName}; -use query_builder::*; -use result::*; -use sql_types::HasSqlType; - -#[allow(missing_debug_implementations, missing_copy_implementations)] -/// A connection to a MySQL database. Connection URLs should be in the form -/// `mysql://[user[:password]@]host/database_name` -pub struct MysqlConnection { - raw_connection: RawConnection, - transaction_manager: AnsiTransactionManager, - statement_cache: StatementCache, -} - -unsafe impl Send for MysqlConnection {} - -impl SimpleConnection for MysqlConnection { - fn batch_execute(&self, query: &str) -> QueryResult<()> { - self.raw_connection - .enable_multi_statements(|| self.raw_connection.execute(query)) - } -} - -impl Connection for MysqlConnection { - type Backend = Mysql; - type TransactionManager = AnsiTransactionManager; - - fn establish(database_url: &str) -> ConnectionResult { - use result::ConnectionError::CouldntSetupConfiguration; - - let raw_connection = RawConnection::new(); - let connection_options = ConnectionOptions::parse(database_url)?; - raw_connection.connect(&connection_options)?; - let conn = MysqlConnection { - raw_connection: raw_connection, - transaction_manager: AnsiTransactionManager::new(), - statement_cache: StatementCache::new(), - }; - conn.set_config_options() - .map_err(CouldntSetupConfiguration)?; - Ok(conn) - } - - #[doc(hidden)] - fn execute(&self, query: &str) -> QueryResult { - self.raw_connection - .execute(query) - .map(|_| self.raw_connection.affected_rows()) - } - - #[doc(hidden)] - fn query_by_index(&self, source: T) -> QueryResult> - where - T: AsQuery, - T::Query: QueryFragment + QueryId, - Self::Backend: HasSqlType, - U: Queryable, - { - use deserialize::FromSqlRow; - use result::Error::DeserializationError; - - let mut stmt = self.prepare_query(&source.as_query())?; - let mut metadata = Vec::new(); - Mysql::mysql_row_metadata(&mut metadata, &()); - let results = unsafe { stmt.results(metadata)? }; - results.map(|mut row| { - U::Row::build_from_row(&mut row) - .map(U::build) - .map_err(DeserializationError) - }) - } - - #[doc(hidden)] - fn query_by_name(&self, source: &T) -> QueryResult> - where - T: QueryFragment + QueryId, - U: QueryableByName, - { - use result::Error::DeserializationError; - - let mut stmt = self.prepare_query(source)?; - let results = unsafe { stmt.named_results()? }; - results.map(|row| U::build(&row).map_err(DeserializationError)) - } - - #[doc(hidden)] - fn execute_returning_count(&self, source: &T) -> QueryResult - where - T: QueryFragment + QueryId, - { - let stmt = self.prepare_query(source)?; - unsafe { - stmt.execute()?; - } - Ok(stmt.affected_rows()) - } - - #[doc(hidden)] - fn transaction_manager(&self) -> &Self::TransactionManager { - &self.transaction_manager - } -} - -impl MysqlConnection { - fn prepare_query(&self, source: &T) -> QueryResult> - where - T: QueryFragment + QueryId, - { - let mut stmt = self - .statement_cache - .cached_statement(source, &[], |sql| self.raw_connection.prepare(sql))?; - let mut bind_collector = MysqlBindCollector::new(); - source.collect_binds(&mut bind_collector, &())?; - stmt.bind(bind_collector.binds)?; - Ok(stmt) - } - - fn set_config_options(&self) -> QueryResult<()> { - self.execute("SET sql_mode=(SELECT CONCAT(@@sql_mode, ',PIPES_AS_CONCAT'))")?; - self.execute("SET time_zone = '+00:00';")?; - self.execute("SET character_set_client = 'utf8mb4'")?; - self.execute("SET character_set_connection = 'utf8mb4'")?; - self.execute("SET character_set_results = 'utf8mb4'")?; - Ok(()) - } -} - -#[cfg(test)] -mod tests { - extern crate dotenv; - - use super::*; - use std::env; - - fn connection() -> MysqlConnection { - let _ = dotenv::dotenv(); - let database_url = env::var("MYSQL_UNIT_TEST_DATABASE_URL") - .or_else(|_| env::var("MYSQL_DATABASE_URL")) - .or_else(|_| env::var("DATABASE_URL")) - .expect("DATABASE_URL must be set in order to run unit tests"); - MysqlConnection::establish(&database_url).unwrap() - } - - #[test] - fn batch_execute_handles_single_queries_with_results() { - let connection = connection(); - assert!(connection.batch_execute("SELECT 1").is_ok()); - assert!(connection.batch_execute("SELECT 1").is_ok()); - } - - #[test] - fn batch_execute_handles_multi_queries_with_results() { - let connection = connection(); - let query = "SELECT 1; SELECT 2; SELECT 3;"; - assert!(connection.batch_execute(query).is_ok()); - assert!(connection.batch_execute(query).is_ok()); - } - - #[test] - fn execute_handles_queries_which_return_results() { - let connection = connection(); - assert!(connection.execute("SELECT 1").is_ok()); - assert!(connection.execute("SELECT 1").is_ok()); - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/raw.rs b/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/raw.rs deleted file mode 100644 index ab832a221..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/raw.rs +++ /dev/null @@ -1,215 +0,0 @@ -extern crate mysqlclient_sys as ffi; - -use std::ffi::CStr; -use std::os::raw as libc; -use std::ptr::{self, NonNull}; -use std::sync::Once; - -use super::stmt::Statement; -use super::url::ConnectionOptions; -use result::{ConnectionError, ConnectionResult, QueryResult}; - -pub struct RawConnection(NonNull); - -impl RawConnection { - pub fn new() -> Self { - perform_thread_unsafe_library_initialization(); - let raw_connection = unsafe { ffi::mysql_init(ptr::null_mut()) }; - // We're trusting https://dev.mysql.com/doc/refman/5.7/en/mysql-init.html - // that null return always means OOM - let raw_connection = - NonNull::new(raw_connection).expect("Insufficient memory to allocate connection"); - let result = RawConnection(raw_connection); - - // This is only non-zero for unrecognized options, which should never happen. - let charset_result = unsafe { - ffi::mysql_options( - result.0.as_ptr(), - ffi::mysql_option::MYSQL_SET_CHARSET_NAME, - b"utf8mb4\0".as_ptr() as *const libc::c_void, - ) - }; - assert_eq!( - 0, charset_result, - "MYSQL_SET_CHARSET_NAME was not \ - recognized as an option by MySQL. This should never \ - happen." - ); - - result - } - - pub fn connect(&self, connection_options: &ConnectionOptions) -> ConnectionResult<()> { - let host = connection_options.host(); - let user = connection_options.user(); - let password = connection_options.password(); - let database = connection_options.database(); - let port = connection_options.port(); - - unsafe { - // Make sure you don't use the fake one! - ffi::mysql_real_connect( - self.0.as_ptr(), - host.map(CStr::as_ptr).unwrap_or_else(|| ptr::null_mut()), - user.as_ptr(), - password - .map(CStr::as_ptr) - .unwrap_or_else(|| ptr::null_mut()), - database - .map(CStr::as_ptr) - .unwrap_or_else(|| ptr::null_mut()), - u32::from(port.unwrap_or(0)), - ptr::null_mut(), - 0, - ) - }; - - let last_error_message = self.last_error_message(); - if last_error_message.is_empty() { - Ok(()) - } else { - Err(ConnectionError::BadConnection(last_error_message)) - } - } - - pub fn last_error_message(&self) -> String { - unsafe { CStr::from_ptr(ffi::mysql_error(self.0.as_ptr())) } - .to_string_lossy() - .into_owned() - } - - pub fn execute(&self, query: &str) -> QueryResult<()> { - unsafe { - // Make sure you don't use the fake one! - ffi::mysql_real_query( - self.0.as_ptr(), - query.as_ptr() as *const libc::c_char, - query.len() as libc::c_ulong, - ); - } - self.did_an_error_occur()?; - self.flush_pending_results()?; - Ok(()) - } - - pub fn enable_multi_statements(&self, f: F) -> QueryResult - where - F: FnOnce() -> QueryResult, - { - unsafe { - ffi::mysql_set_server_option( - self.0.as_ptr(), - ffi::enum_mysql_set_option::MYSQL_OPTION_MULTI_STATEMENTS_ON, - ); - } - self.did_an_error_occur()?; - - let result = f(); - - unsafe { - ffi::mysql_set_server_option( - self.0.as_ptr(), - ffi::enum_mysql_set_option::MYSQL_OPTION_MULTI_STATEMENTS_OFF, - ); - } - self.did_an_error_occur()?; - - result - } - - pub fn affected_rows(&self) -> usize { - let affected_rows = unsafe { ffi::mysql_affected_rows(self.0.as_ptr()) }; - affected_rows as usize - } - - pub fn prepare(&self, query: &str) -> QueryResult { - let stmt = unsafe { ffi::mysql_stmt_init(self.0.as_ptr()) }; - // It is documented that the only reason `mysql_stmt_init` will fail - // is because of OOM. - // https://dev.mysql.com/doc/refman/5.7/en/mysql-stmt-init.html - let stmt = NonNull::new(stmt).expect("Out of memory creating prepared statement"); - let stmt = Statement::new(stmt); - stmt.prepare(query)?; - Ok(stmt) - } - - fn did_an_error_occur(&self) -> QueryResult<()> { - use result::DatabaseErrorKind; - use result::Error::DatabaseError; - - let error_message = self.last_error_message(); - if error_message.is_empty() { - Ok(()) - } else { - Err(DatabaseError( - DatabaseErrorKind::__Unknown, - Box::new(error_message), - )) - } - } - - fn flush_pending_results(&self) -> QueryResult<()> { - // We may have a result to process before advancing - self.consume_current_result()?; - while self.more_results() { - self.next_result()?; - self.consume_current_result()?; - } - Ok(()) - } - - fn consume_current_result(&self) -> QueryResult<()> { - unsafe { - let res = ffi::mysql_store_result(self.0.as_ptr()); - if !res.is_null() { - ffi::mysql_free_result(res); - } - } - self.did_an_error_occur() - } - - fn more_results(&self) -> bool { - unsafe { ffi::mysql_more_results(self.0.as_ptr()) != 0 } - } - - fn next_result(&self) -> QueryResult<()> { - unsafe { ffi::mysql_next_result(self.0.as_ptr()) }; - self.did_an_error_occur() - } -} - -impl Drop for RawConnection { - fn drop(&mut self) { - unsafe { - ffi::mysql_close(self.0.as_ptr()); - } - } -} - -/// > In a non-multi-threaded environment, `mysql_init()` invokes -/// > `mysql_library_init()` automatically as necessary. However, -/// > `mysql_library_init()` is not thread-safe in a multi-threaded environment, -/// > and thus neither is `mysql_init()`. Before calling `mysql_init()`, either -/// > call `mysql_library_init()` prior to spawning any threads, or use a mutex -/// > to protect the `mysql_library_init()` call. This should be done prior to -/// > any other client library call. -/// -/// -static MYSQL_THREAD_UNSAFE_INIT: Once = Once::new(); - -fn perform_thread_unsafe_library_initialization() { - MYSQL_THREAD_UNSAFE_INIT.call_once(|| { - // mysql_library_init is defined by `#define mysql_library_init mysql_server_init` - // which isn't picked up by bindgen - let error_code = unsafe { ffi::mysql_server_init(0, ptr::null_mut(), ptr::null_mut()) }; - if error_code != 0 { - // FIXME: This is documented as Nonzero if an error occurred. - // Presumably the value has some sort of meaning that we should - // reflect in this message. We are going to panic instead of return - // an error here, since the documentation does not indicate whether - // it is safe to call this function twice if the first call failed, - // so I will assume it is not. - panic!("Unable to perform MySQL global initialization"); - } - }) -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/stmt/iterator.rs b/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/stmt/iterator.rs deleted file mode 100644 index 650c393ed..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/stmt/iterator.rs +++ /dev/null @@ -1,147 +0,0 @@ -use std::collections::HashMap; - -use super::{ffi, libc, Binds, Statement, StatementMetadata}; -use mysql::{Mysql, MysqlType}; -use result::QueryResult; -use row::*; -use sql_types::IsSigned; - -pub struct StatementIterator<'a> { - stmt: &'a mut Statement, - output_binds: Binds, -} - -#[allow(clippy::should_implement_trait)] // don't neet `Iterator` here -impl<'a> StatementIterator<'a> { - #[allow(clippy::new_ret_no_self)] - pub fn new(stmt: &'a mut Statement, types: Vec<(MysqlType, IsSigned)>) -> QueryResult { - let mut output_binds = Binds::from_output_types(types); - - execute_statement(stmt, &mut output_binds)?; - - Ok(StatementIterator { - stmt: stmt, - output_binds: output_binds, - }) - } - - pub fn map(mut self, mut f: F) -> QueryResult> - where - F: FnMut(MysqlRow) -> QueryResult, - { - let mut results = Vec::new(); - while let Some(row) = self.next() { - results.push(f(row?)?); - } - Ok(results) - } - - fn next(&mut self) -> Option> { - match populate_row_buffers(self.stmt, &mut self.output_binds) { - Ok(Some(())) => Some(Ok(MysqlRow { - col_idx: 0, - binds: &mut self.output_binds, - })), - Ok(None) => None, - Err(e) => Some(Err(e)), - } - } -} - -pub struct MysqlRow<'a> { - col_idx: usize, - binds: &'a Binds, -} - -impl<'a> Row for MysqlRow<'a> { - fn take(&mut self) -> Option<&[u8]> { - let current_idx = self.col_idx; - self.col_idx += 1; - self.binds.field_data(current_idx) - } - - fn next_is_null(&self, count: usize) -> bool { - (0..count).all(|i| self.binds.field_data(self.col_idx + i).is_none()) - } -} - -pub struct NamedStatementIterator<'a> { - stmt: &'a mut Statement, - output_binds: Binds, - metadata: StatementMetadata, -} - -#[allow(clippy::should_implement_trait)] // don't need `Iterator` here -impl<'a> NamedStatementIterator<'a> { - #[allow(clippy::new_ret_no_self)] - pub fn new(stmt: &'a mut Statement) -> QueryResult { - let metadata = stmt.metadata()?; - let mut output_binds = Binds::from_result_metadata(metadata.fields()); - - execute_statement(stmt, &mut output_binds)?; - - Ok(NamedStatementIterator { - stmt, - output_binds, - metadata, - }) - } - - pub fn map(mut self, mut f: F) -> QueryResult> - where - F: FnMut(NamedMysqlRow) -> QueryResult, - { - let mut results = Vec::new(); - while let Some(row) = self.next() { - results.push(f(row?)?); - } - Ok(results) - } - - fn next(&mut self) -> Option> { - match populate_row_buffers(self.stmt, &mut self.output_binds) { - Ok(Some(())) => Some(Ok(NamedMysqlRow { - binds: &self.output_binds, - column_indices: self.metadata.column_indices(), - })), - Ok(None) => None, - Err(e) => Some(Err(e)), - } - } -} - -pub struct NamedMysqlRow<'a> { - binds: &'a Binds, - column_indices: &'a HashMap<&'a str, usize>, -} - -impl<'a> NamedRow for NamedMysqlRow<'a> { - fn index_of(&self, column_name: &str) -> Option { - self.column_indices.get(column_name).cloned() - } - - fn get_raw_value(&self, idx: usize) -> Option<&[u8]> { - self.binds.field_data(idx) - } -} - -fn execute_statement(stmt: &mut Statement, binds: &mut Binds) -> QueryResult<()> { - unsafe { - binds.with_mysql_binds(|bind_ptr| stmt.bind_result(bind_ptr))?; - stmt.execute()?; - } - Ok(()) -} - -fn populate_row_buffers(stmt: &Statement, binds: &mut Binds) -> QueryResult> { - let next_row_result = unsafe { ffi::mysql_stmt_fetch(stmt.stmt.as_ptr()) }; - match next_row_result as libc::c_uint { - ffi::MYSQL_NO_DATA => Ok(None), - ffi::MYSQL_DATA_TRUNCATED => binds.populate_dynamic_buffers(stmt).map(Some), - 0 => { - binds.update_buffer_lengths(); - Ok(Some(())) - } - _error => stmt.did_an_error_occur().map(Some), - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/stmt/metadata.rs b/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/stmt/metadata.rs deleted file mode 100644 index 331c10013..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/stmt/metadata.rs +++ /dev/null @@ -1,52 +0,0 @@ -use std::collections::HashMap; -use std::ffi::CStr; -use std::slice; - -use super::ffi; - -pub struct StatementMetadata { - result: &'static mut ffi::MYSQL_RES, - column_indices: HashMap<&'static str, usize>, -} - -impl StatementMetadata { - pub fn new(result: &'static mut ffi::MYSQL_RES) -> Self { - let mut res = StatementMetadata { - column_indices: HashMap::new(), - result, - }; - res.populate_column_indices(); - res - } - - pub fn fields(&self) -> &[ffi::MYSQL_FIELD] { - unsafe { - let ptr = self.result as *const _ as *mut _; - let num_fields = ffi::mysql_num_fields(ptr); - let field_ptr = ffi::mysql_fetch_fields(ptr); - slice::from_raw_parts(field_ptr, num_fields as usize) - } - } - - pub fn column_indices(&self) -> &HashMap<&str, usize> { - &self.column_indices - } - - fn populate_column_indices(&mut self) { - self.column_indices = self - .fields() - .iter() - .enumerate() - .map(|(i, field)| { - let c_name = unsafe { CStr::from_ptr(field.name) }; - (c_name.to_str().unwrap_or_default(), i) - }) - .collect() - } -} - -impl Drop for StatementMetadata { - fn drop(&mut self) { - unsafe { ffi::mysql_free_result(self.result) }; - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/stmt/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/stmt/mod.rs deleted file mode 100644 index 2ef3d0119..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/stmt/mod.rs +++ /dev/null @@ -1,159 +0,0 @@ -extern crate mysqlclient_sys as ffi; - -mod iterator; -mod metadata; - -use std::ffi::CStr; -use std::os::raw as libc; -use std::ptr::NonNull; - -use self::iterator::*; -use self::metadata::*; -use super::bind::Binds; -use mysql::MysqlType; -use result::{DatabaseErrorKind, QueryResult}; -use sql_types::IsSigned; - -pub struct Statement { - stmt: NonNull, - input_binds: Option, -} - -impl Statement { - pub(crate) fn new(stmt: NonNull) -> Self { - Statement { - stmt: stmt, - input_binds: None, - } - } - - pub fn prepare(&self, query: &str) -> QueryResult<()> { - unsafe { - ffi::mysql_stmt_prepare( - self.stmt.as_ptr(), - query.as_ptr() as *const libc::c_char, - query.len() as libc::c_ulong, - ); - } - self.did_an_error_occur() - } - - pub fn bind(&mut self, binds: Iter) -> QueryResult<()> - where - Iter: IntoIterator>)>, - { - let mut input_binds = Binds::from_input_data(binds); - input_binds.with_mysql_binds(|bind_ptr| { - // This relies on the invariant that the current value of `self.input_binds` - // will not change without this function being called - unsafe { - ffi::mysql_stmt_bind_param(self.stmt.as_ptr(), bind_ptr); - } - }); - self.input_binds = Some(input_binds); - self.did_an_error_occur() - } - - /// This function should be called instead of `results` on queries which - /// have no return value. It should never be called on a statement on - /// which `results` has previously been called? - pub unsafe fn execute(&self) -> QueryResult<()> { - ffi::mysql_stmt_execute(self.stmt.as_ptr()); - self.did_an_error_occur()?; - ffi::mysql_stmt_store_result(self.stmt.as_ptr()); - self.did_an_error_occur()?; - Ok(()) - } - - pub fn affected_rows(&self) -> usize { - let affected_rows = unsafe { ffi::mysql_stmt_affected_rows(self.stmt.as_ptr()) }; - affected_rows as usize - } - - /// This function should be called instead of `execute` for queries which - /// have a return value. After calling this function, `execute` can never - /// be called on this statement. - pub unsafe fn results( - &mut self, - types: Vec<(MysqlType, IsSigned)>, - ) -> QueryResult { - StatementIterator::new(self, types) - } - - /// This function should be called instead of `execute` for queries which - /// have a return value. After calling this function, `execute` can never - /// be called on this statement. - pub unsafe fn named_results(&mut self) -> QueryResult { - NamedStatementIterator::new(self) - } - - fn last_error_message(&self) -> String { - unsafe { CStr::from_ptr(ffi::mysql_stmt_error(self.stmt.as_ptr())) } - .to_string_lossy() - .into_owned() - } - - /// If the pointers referenced by the `MYSQL_BIND` structures are invalidated, - /// you must call this function again before calling `mysql_stmt_fetch`. - pub unsafe fn bind_result(&self, binds: *mut ffi::MYSQL_BIND) -> QueryResult<()> { - ffi::mysql_stmt_bind_result(self.stmt.as_ptr(), binds); - self.did_an_error_occur() - } - - pub unsafe fn fetch_column( - &self, - bind: &mut ffi::MYSQL_BIND, - idx: usize, - offset: usize, - ) -> QueryResult<()> { - ffi::mysql_stmt_fetch_column( - self.stmt.as_ptr(), - bind, - idx as libc::c_uint, - offset as libc::c_ulong, - ); - self.did_an_error_occur() - } - - fn metadata(&self) -> QueryResult { - use result::Error::DeserializationError; - - let result_ptr = unsafe { ffi::mysql_stmt_result_metadata(self.stmt.as_ptr()).as_mut() }; - self.did_an_error_occur()?; - result_ptr - .map(StatementMetadata::new) - .ok_or_else(|| DeserializationError("No metadata exists".into())) - } - - fn did_an_error_occur(&self) -> QueryResult<()> { - use result::Error::DatabaseError; - - let error_message = self.last_error_message(); - if error_message.is_empty() { - Ok(()) - } else { - Err(DatabaseError( - self.last_error_type(), - Box::new(error_message), - )) - } - } - - fn last_error_type(&self) -> DatabaseErrorKind { - let last_error_number = unsafe { ffi::mysql_stmt_errno(self.stmt.as_ptr()) }; - // These values are not exposed by the C API, but are documented - // at https://dev.mysql.com/doc/refman/5.7/en/error-messages-server.html - // and are from the ANSI SQLSTATE standard - match last_error_number { - 1062 | 1586 | 1859 => DatabaseErrorKind::UniqueViolation, - 1216 | 1217 | 1451 | 1452 | 1830 | 1834 => DatabaseErrorKind::ForeignKeyViolation, - _ => DatabaseErrorKind::__Unknown, - } - } -} - -impl Drop for Statement { - fn drop(&mut self) { - unsafe { ffi::mysql_stmt_close(self.stmt.as_ptr()) }; - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/url.rs b/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/url.rs deleted file mode 100644 index 2eae2a6ac..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/connection/url.rs +++ /dev/null @@ -1,167 +0,0 @@ -extern crate url; - -use self::url::percent_encoding::percent_decode; -use self::url::{Host, Url}; -use std::ffi::{CStr, CString}; - -use result::{ConnectionError, ConnectionResult}; - -pub struct ConnectionOptions { - host: Option, - user: CString, - password: Option, - database: Option, - port: Option, -} - -impl ConnectionOptions { - pub fn parse(database_url: &str) -> ConnectionResult { - let url = match Url::parse(database_url) { - Ok(url) => url, - Err(_) => return Err(connection_url_error()), - }; - - if url.scheme() != "mysql" { - return Err(connection_url_error()); - } - - if url.path_segments().map(|x| x.count()).unwrap_or(0) > 1 { - return Err(connection_url_error()); - } - - let host = match url.host() { - Some(Host::Ipv6(host)) => Some(CString::new(host.to_string())?), - Some(host) => Some(CString::new(host.to_string())?), - None => None, - }; - let user = decode_into_cstring(url.username())?; - let password = match url.password() { - Some(password) => Some(decode_into_cstring(password)?), - None => None, - }; - let database = match url.path_segments().and_then(|mut iter| iter.nth(0)) { - Some("") | None => None, - Some(segment) => Some(CString::new(segment.as_bytes())?), - }; - - Ok(ConnectionOptions { - host: host, - user: user, - password: password, - database: database, - port: url.port(), - }) - } - - pub fn host(&self) -> Option<&CStr> { - self.host.as_ref().map(|x| &**x) - } - - pub fn user(&self) -> &CStr { - &self.user - } - - pub fn password(&self) -> Option<&CStr> { - self.password.as_ref().map(|x| &**x) - } - - pub fn database(&self) -> Option<&CStr> { - self.database.as_ref().map(|x| &**x) - } - - pub fn port(&self) -> Option { - self.port - } -} - -fn decode_into_cstring(s: &str) -> ConnectionResult { - let decoded = percent_decode(s.as_bytes()) - .decode_utf8() - .map_err(|_| connection_url_error())?; - CString::new(decoded.as_bytes()).map_err(Into::into) -} - -fn connection_url_error() -> ConnectionError { - let msg = "MySQL connection URLs must be in the form \ - `mysql://[[user]:[password]@]host[:port][/database]`"; - ConnectionError::InvalidConnectionUrl(msg.into()) -} - -#[test] -fn urls_with_schemes_other_than_mysql_are_errors() { - assert!(ConnectionOptions::parse("postgres://localhost").is_err()); - assert!(ConnectionOptions::parse("http://localhost").is_err()); - assert!(ConnectionOptions::parse("file:///tmp/mysql.sock").is_err()); - assert!(ConnectionOptions::parse("socket:///tmp/mysql.sock").is_err()); - assert!(ConnectionOptions::parse("mysql://localhost").is_ok()); -} - -#[test] -fn urls_must_have_zero_or_one_path_segments() { - assert!(ConnectionOptions::parse("mysql://localhost/foo/bar").is_err()); - assert!(ConnectionOptions::parse("mysql://localhost/foo").is_ok()); -} - -#[test] -fn first_path_segment_is_treated_as_database() { - let foo_cstr = CString::new("foo").unwrap(); - let bar_cstr = CString::new("bar").unwrap(); - assert_eq!( - Some(&*foo_cstr), - ConnectionOptions::parse("mysql://localhost/foo") - .unwrap() - .database() - ); - assert_eq!( - Some(&*bar_cstr), - ConnectionOptions::parse("mysql://localhost/bar") - .unwrap() - .database() - ); - assert_eq!( - None, - ConnectionOptions::parse("mysql://localhost") - .unwrap() - .database() - ); -} - -#[test] -fn userinfo_should_be_percent_decode() { - use self::url::percent_encoding::{utf8_percent_encode, USERINFO_ENCODE_SET}; - - let username = "x#gfuL?4Zuj{n73m}eeJt0"; - let encoded_username = utf8_percent_encode(username, USERINFO_ENCODE_SET); - - let password = "x/gfuL?4Zuj{n73m}eeJt1"; - let encoded_password = utf8_percent_encode(password, USERINFO_ENCODE_SET); - - let db_url = format!( - "mysql://{}:{}@localhost/bar", - encoded_username, encoded_password - ); - let db_url = Url::parse(&db_url).unwrap(); - - let conn_opts = ConnectionOptions::parse(db_url.as_str()).unwrap(); - let username = CString::new(username.as_bytes()).unwrap(); - let password = CString::new(password.as_bytes()).unwrap(); - assert_eq!(username, conn_opts.user); - assert_eq!(password, conn_opts.password.unwrap()); -} - -#[test] -fn ipv6_host_not_wrapped_in_brackets() { - let host1 = CString::new("::1").unwrap(); - let host2 = CString::new("2001:db8:85a3::8a2e:370:7334").unwrap(); - - assert_eq!( - Some(&*host1), - ConnectionOptions::parse("mysql://[::1]").unwrap().host() - ); - assert_eq!( - Some(&*host2), - ConnectionOptions::parse("mysql://[2001:db8:85a3::8a2e:370:7334]") - .unwrap() - .host() - ); -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/mysql/mod.rs deleted file mode 100644 index 745b584e0..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/mod.rs +++ /dev/null @@ -1,16 +0,0 @@ -//! Provides types and functions related to working with MySQL -//! -//! Much of this module is re-exported from database agnostic locations. -//! However, if you are writing code specifically to extend Diesel on -//! MySQL, you may need to work with this module directly. - -mod backend; -mod bind_collector; -mod connection; - -mod query_builder; -pub mod types; - -pub use self::backend::{Mysql, MysqlType}; -pub use self::connection::MysqlConnection; -pub use self::query_builder::MysqlQueryBuilder; diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/query_builder/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/mysql/query_builder/mod.rs deleted file mode 100644 index adfabcbda..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/query_builder/mod.rs +++ /dev/null @@ -1,40 +0,0 @@ -use super::backend::Mysql; -use query_builder::QueryBuilder; -use result::QueryResult; - -mod query_fragment_impls; - -/// The MySQL query builder -#[allow(missing_debug_implementations)] -#[derive(Default)] -pub struct MysqlQueryBuilder { - sql: String, -} - -impl MysqlQueryBuilder { - /// Constructs a new query builder with an empty query - pub fn new() -> Self { - MysqlQueryBuilder::default() - } -} - -impl QueryBuilder for MysqlQueryBuilder { - fn push_sql(&mut self, sql: &str) { - self.sql.push_str(sql); - } - - fn push_identifier(&mut self, identifier: &str) -> QueryResult<()> { - self.push_sql("`"); - self.push_sql(&identifier.replace("`", "``")); - self.push_sql("`"); - Ok(()) - } - - fn push_bind_param(&mut self) { - self.push_sql("?"); - } - - fn finish(self) -> String { - self.sql - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/query_builder/query_fragment_impls.rs b/collector/compile-benchmarks/diesel-1.4.8/src/mysql/query_builder/query_fragment_impls.rs deleted file mode 100644 index f1e820686..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/query_builder/query_fragment_impls.rs +++ /dev/null @@ -1,38 +0,0 @@ -use mysql::Mysql; -use query_builder::locking_clause::{ForShare, ForUpdate, NoModifier, NoWait, SkipLocked}; -use query_builder::{AstPass, QueryFragment}; -use result::QueryResult; - -impl QueryFragment for ForUpdate { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql(" FOR UPDATE"); - Ok(()) - } -} - -impl QueryFragment for ForShare { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql(" FOR SHARE"); - Ok(()) - } -} - -impl QueryFragment for NoModifier { - fn walk_ast(&self, _out: AstPass) -> QueryResult<()> { - Ok(()) - } -} - -impl QueryFragment for SkipLocked { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql(" SKIP LOCKED"); - Ok(()) - } -} - -impl QueryFragment for NoWait { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql(" NOWAIT"); - Ok(()) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/types/date_and_time.rs b/collector/compile-benchmarks/diesel-1.4.8/src/mysql/types/date_and_time.rs deleted file mode 100644 index 20f5a0539..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/mysql/types/date_and_time.rs +++ /dev/null @@ -1,291 +0,0 @@ -extern crate chrono; -extern crate mysqlclient_sys as ffi; - -use self::chrono::*; -use std::io::Write; -use std::os::raw as libc; -use std::{mem, ptr, slice}; - -use super::MYSQL_TIME; -use deserialize::{self, FromSql}; -use mysql::Mysql; -use serialize::{self, IsNull, Output, ToSql}; -use sql_types::{Date, Datetime, Time, Timestamp}; - -macro_rules! mysql_time_impls { - ($ty:ty) => { - impl ToSql<$ty, Mysql> for MYSQL_TIME { - fn to_sql(&self, out: &mut Output) -> serialize::Result { - let bytes = unsafe { - let bytes_ptr = self as *const MYSQL_TIME as *const u8; - slice::from_raw_parts(bytes_ptr, mem::size_of::()) - }; - out.write_all(bytes)?; - Ok(IsNull::No) - } - } - - impl FromSql<$ty, Mysql> for MYSQL_TIME { - // ptr::copy_nonoverlapping does not require aligned pointers - #[allow(clippy::cast_ptr_alignment)] - fn from_sql(bytes: Option<&[u8]>) -> deserialize::Result { - let bytes = not_none!(bytes); - let bytes_ptr = bytes.as_ptr() as *const MYSQL_TIME; - - unsafe { - let mut result = mem::zeroed(); - ptr::copy_nonoverlapping(bytes_ptr, &mut result, 1); - if result.neg { - Err("Negative dates/times are not yet supported".into()) - } else { - Ok(result) - } - } - } - } - - impl ToSql<$ty, Mysql> for ffi::MYSQL_TIME { - fn to_sql(&self, out: &mut Output) -> serialize::Result { - >::to_sql(&MYSQL_TIME::from(*self), out) - } - } - - impl FromSql<$ty, Mysql> for ffi::MYSQL_TIME { - fn from_sql(bytes: Option<&[u8]>) -> deserialize::Result { - >::from_sql(bytes).map(|r| r.into()) - } - } - }; -} - -mysql_time_impls!(Datetime); -mysql_time_impls!(Timestamp); -mysql_time_impls!(Time); -mysql_time_impls!(Date); - -impl ToSql for NaiveDateTime { - fn to_sql(&self, out: &mut Output) -> serialize::Result { - >::to_sql(self, out) - } -} - -impl FromSql for NaiveDateTime { - fn from_sql(bytes: Option<&[u8]>) -> deserialize::Result { - >::from_sql(bytes) - } -} - -impl ToSql for NaiveDateTime { - fn to_sql(&self, out: &mut Output) -> serialize::Result { - let mut mysql_time: MYSQL_TIME = unsafe { mem::zeroed() }; - - mysql_time.year = self.year() as libc::c_uint; - mysql_time.month = self.month() as libc::c_uint; - mysql_time.day = self.day() as libc::c_uint; - mysql_time.hour = self.hour() as libc::c_uint; - mysql_time.minute = self.minute() as libc::c_uint; - mysql_time.second = self.second() as libc::c_uint; - mysql_time.second_part = libc::c_ulong::from(self.timestamp_subsec_micros()); - - >::to_sql(&mysql_time, out) - } -} - -impl FromSql for NaiveDateTime { - fn from_sql(bytes: Option<&[u8]>) -> deserialize::Result { - let mysql_time = >::from_sql(bytes)?; - - NaiveDate::from_ymd_opt( - mysql_time.year as i32, - mysql_time.month as u32, - mysql_time.day as u32, - ) - .and_then(|v| { - v.and_hms_micro_opt( - mysql_time.hour as u32, - mysql_time.minute as u32, - mysql_time.second as u32, - mysql_time.second_part as u32, - ) - }) - .ok_or_else(|| format!("Cannot parse this date: {:?}", mysql_time).into()) - } -} - -impl ToSql for NaiveTime { - fn to_sql(&self, out: &mut Output) -> serialize::Result { - let mut mysql_time: MYSQL_TIME = unsafe { mem::zeroed() }; - - mysql_time.hour = self.hour() as libc::c_uint; - mysql_time.minute = self.minute() as libc::c_uint; - mysql_time.second = self.second() as libc::c_uint; - - >::to_sql(&mysql_time, out) - } -} - -impl FromSql for NaiveTime { - fn from_sql(bytes: Option<&[u8]>) -> deserialize::Result { - let mysql_time = >::from_sql(bytes)?; - NaiveTime::from_hms_opt( - mysql_time.hour as u32, - mysql_time.minute as u32, - mysql_time.second as u32, - ) - .ok_or_else(|| format!("Unable to convert {:?} to chrono", mysql_time).into()) - } -} - -impl ToSql for NaiveDate { - fn to_sql(&self, out: &mut Output) -> serialize::Result { - let mut mysql_time: MYSQL_TIME = unsafe { mem::zeroed() }; - - mysql_time.year = self.year() as libc::c_uint; - mysql_time.month = self.month() as libc::c_uint; - mysql_time.day = self.day() as libc::c_uint; - - >::to_sql(&mysql_time, out) - } -} - -impl FromSql for NaiveDate { - fn from_sql(bytes: Option<&[u8]>) -> deserialize::Result { - let mysql_time = >::from_sql(bytes)?; - NaiveDate::from_ymd_opt( - mysql_time.year as i32, - mysql_time.month as u32, - mysql_time.day as u32, - ) - .ok_or_else(|| format!("Unable to convert {:?} to chrono", mysql_time).into()) - } -} - -#[cfg(test)] -mod tests { - extern crate chrono; - extern crate dotenv; - - use self::chrono::{Duration, NaiveDate, NaiveTime, Utc}; - use self::dotenv::dotenv; - - use dsl::{now, sql}; - use prelude::*; - use select; - use sql_types::{Date, Datetime, Time, Timestamp}; - - fn connection() -> MysqlConnection { - dotenv().ok(); - - let connection_url = ::std::env::var("MYSQL_UNIT_TEST_DATABASE_URL") - .or_else(|_| ::std::env::var("MYSQL_DATABASE_URL")) - .or_else(|_| ::std::env::var("DATABASE_URL")) - .expect("DATABASE_URL must be set in order to run tests"); - MysqlConnection::establish(&connection_url).unwrap() - } - - #[test] - fn unix_epoch_encodes_correctly() { - let connection = connection(); - let time = NaiveDate::from_ymd(1970, 1, 1).and_hms(0, 0, 0); - let query = select(sql::("CAST('1970-01-01' AS DATETIME)").eq(time)); - assert!(query.get_result::(&connection).unwrap()); - let query = select(sql::("CAST('1970-01-01' AS DATETIME)").eq(time)); - assert!(query.get_result::(&connection).unwrap()); - } - - #[test] - fn unix_epoch_decodes_correctly() { - let connection = connection(); - let time = NaiveDate::from_ymd(1970, 1, 1).and_hms(0, 0, 0); - let epoch_from_sql = - select(sql::("CAST('1970-01-01' AS DATETIME)")).get_result(&connection); - assert_eq!(Ok(time), epoch_from_sql); - let epoch_from_sql = - select(sql::("CAST('1970-01-01' AS DATETIME)")).get_result(&connection); - assert_eq!(Ok(time), epoch_from_sql); - } - - #[test] - fn times_relative_to_now_encode_correctly() { - let connection = connection(); - let time = Utc::now().naive_utc() + Duration::days(1); - let query = select(now.lt(time)); - assert!(query.get_result::(&connection).unwrap()); - - let time = Utc::now().naive_utc() - Duration::days(1); - let query = select(now.gt(time)); - assert!(query.get_result::(&connection).unwrap()); - } - - #[test] - fn times_of_day_encode_correctly() { - let connection = connection(); - - let midnight = NaiveTime::from_hms(0, 0, 0); - let query = select(sql::
: QueryFragment {} - -#[doc(hidden)] -#[derive(Debug, Clone, Copy)] -pub struct NoConflictTarget; - -impl QueryFragment for NoConflictTarget { - fn walk_ast(&self, _: AstPass) -> QueryResult<()> { - Ok(()) - } -} - -impl
OnConflictTarget
for NoConflictTarget {} - -#[doc(hidden)] -#[derive(Debug, Clone, Copy)] -pub struct ConflictTarget(pub T); - -impl QueryFragment for ConflictTarget { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql(" ("); - out.push_identifier(T::NAME)?; - out.push_sql(")"); - Ok(()) - } -} - -impl OnConflictTarget for ConflictTarget {} - -impl QueryFragment for ConflictTarget> -where - SqlLiteral: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql(" "); - self.0.walk_ast(out.reborrow())?; - Ok(()) - } -} - -impl OnConflictTarget for ConflictTarget> where - ConflictTarget>: QueryFragment -{ -} - -impl<'a> QueryFragment for ConflictTarget> { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql(" ON CONSTRAINT "); - out.push_identifier(self.0.constraint_name)?; - Ok(()) - } -} - -impl<'a, Table> OnConflictTarget
for ConflictTarget> {} - -macro_rules! on_conflict_tuples { - ($($col:ident),+) => { - impl QueryFragment for ConflictTarget<(T, $($col),+)> where - T: Column, - $($col: Column,)+ - { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql(" ("); - out.push_identifier(T::NAME)?; - $( - out.push_sql(", "); - out.push_identifier($col::NAME)?; - )+ - out.push_sql(")"); - Ok(()) - } - } - - impl OnConflictTarget for ConflictTarget<(T, $($col),+)> where - T: Column, - $($col: Column,)+ - { - } - } -} - -on_conflict_tuples!(U); -on_conflict_tuples!(U, V); -on_conflict_tuples!(U, V, W); -on_conflict_tuples!(U, V, W, X); -on_conflict_tuples!(U, V, W, X, Y); -on_conflict_tuples!(U, V, W, X, Y, Z); diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/ast_pass.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/ast_pass.rs deleted file mode 100644 index 9a1ad9108..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/ast_pass.rs +++ /dev/null @@ -1,249 +0,0 @@ -use std::{fmt, mem}; - -use backend::Backend; -use query_builder::{BindCollector, QueryBuilder}; -use result::QueryResult; -use serialize::ToSql; -use sql_types::HasSqlType; - -#[allow(missing_debug_implementations)] -/// The primary type used when walking a Diesel AST during query execution. -/// -/// Executing a query is generally done in multiple passes. This list includes, -/// but is not limited to: -/// -/// - Generating the SQL -/// - Collecting and serializing bound values (sent separately from the SQL) -/// - Determining if a query is safe to store in the prepared statement cache -/// -/// When adding a new type that is used in a Diesel AST, you don't need to care -/// about which specific passes are being performed, nor is there any way for -/// you to find out what the current pass is. You should simply call the -/// relevant methods and trust that they will be a no-op if they're not relevant -/// to the current pass. -pub struct AstPass<'a, DB> -where - DB: Backend, - DB::QueryBuilder: 'a, - DB::BindCollector: 'a, - DB::MetadataLookup: 'a, -{ - internals: AstPassInternals<'a, DB>, -} - -impl<'a, DB> AstPass<'a, DB> -where - DB: Backend, -{ - #[doc(hidden)] - #[allow(clippy::wrong_self_convention)] - pub fn to_sql(query_builder: &'a mut DB::QueryBuilder) -> Self { - AstPass { - internals: AstPassInternals::ToSql(query_builder), - } - } - - #[doc(hidden)] - pub fn collect_binds( - collector: &'a mut DB::BindCollector, - metadata_lookup: &'a DB::MetadataLookup, - ) -> Self { - AstPass { - internals: AstPassInternals::CollectBinds { - collector, - metadata_lookup, - }, - } - } - - #[doc(hidden)] - pub fn is_safe_to_cache_prepared(result: &'a mut bool) -> Self { - AstPass { - internals: AstPassInternals::IsSafeToCachePrepared(result), - } - } - - #[doc(hidden)] - pub fn debug_binds(formatter: &'a mut fmt::DebugList<'a, 'a>) -> Self { - AstPass { - internals: AstPassInternals::DebugBinds(formatter), - } - } - - /// Does running this AST pass have any effect? - /// - /// The result will be set to `false` if any method that generates SQL - /// is called. - pub(crate) fn is_noop(result: &'a mut bool) -> Self { - AstPass { - internals: AstPassInternals::IsNoop(result), - } - } - - /// Call this method whenever you pass an instance of `AstPass` by value. - /// - /// Effectively copies `self`, with a narrower lifetime. When passing a - /// reference or a mutable reference, this is normally done by rust - /// implicitly. This is why you can pass `&mut Foo` to multiple functions, - /// even though mutable references are not `Copy`. However, this is only - /// done implicitly for references. For structs with lifetimes it must be - /// done explicitly. This method matches the semantics of what Rust would do - /// implicitly if you were passing a mutable reference - // Clippy is wrong, this cannot be expressed with pointer casting - #[allow(clippy::transmute_ptr_to_ptr)] - pub fn reborrow(&mut self) -> AstPass { - use self::AstPassInternals::*; - let internals = match self.internals { - ToSql(ref mut builder) => ToSql(&mut **builder), - CollectBinds { - ref mut collector, - metadata_lookup, - } => CollectBinds { - collector: &mut **collector, - metadata_lookup: &*metadata_lookup, - }, - IsSafeToCachePrepared(ref mut result) => IsSafeToCachePrepared(&mut **result), - DebugBinds(ref mut f) => { - // Safe because the lifetime is always being shortened. - let f_with_shorter_lifetime = unsafe { mem::transmute(&mut **f) }; - DebugBinds(f_with_shorter_lifetime) - } - IsNoop(ref mut result) => IsNoop(&mut **result), - }; - AstPass { internals } - } - - /// Mark the current query being constructed as unsafe to store in the - /// prepared statement cache. - /// - /// Diesel caches prepared statements as much as possible. However, it is - /// important to ensure that this doesn't result in unbounded memory usage - /// on the database server. To ensure this is the case, any logical query - /// which could generate a potentially unbounded number of prepared - /// statements *must* call this method. Examples of AST nodes which do this - /// are: - /// - /// - `SqlLiteral`. We have no way of knowing if the SQL string was - /// constructed dynamically or not, so we must assume it was dynamic. - /// - `EqAny` when passed a Rust `Vec`. The `IN` operator requires one bind - /// parameter per element, meaning that the query could generate up to - /// `usize` unique prepared statements. - /// - `InsertStatement`. Unbounded due to the variable number of records - /// being inserted generating unique SQL. - /// - `UpdateStatement`. The number of potential queries is actually - /// technically bounded, but the upper bound is the number of columns on - /// the table factorial which is too large to be safe. - pub fn unsafe_to_cache_prepared(&mut self) { - if let AstPassInternals::IsSafeToCachePrepared(ref mut result) = self.internals { - **result = false - } - } - - /// Push the given SQL string on the end of the query being constructed. - /// - /// # Example - /// - /// ```rust - /// # extern crate diesel; - /// # use diesel::query_builder::{QueryFragment, AstPass}; - /// # use diesel::backend::Backend; - /// # use diesel::QueryResult; - /// # struct And { left: Left, right: Right } - /// impl QueryFragment for And - /// where - /// DB: Backend, - /// Left: QueryFragment, - /// Right: QueryFragment, - /// { - /// fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - /// self.left.walk_ast(out.reborrow())?; - /// out.push_sql(" AND "); - /// self.right.walk_ast(out.reborrow())?; - /// Ok(()) - /// } - /// } - /// # fn main() {} - /// ``` - pub fn push_sql(&mut self, sql: &str) { - match self.internals { - AstPassInternals::ToSql(ref mut builder) => builder.push_sql(sql), - AstPassInternals::IsNoop(ref mut result) => **result = false, - _ => {} - } - } - - /// Push the given SQL identifier on the end of the query being constructed. - /// - /// The identifier will be quoted using the rules specific to the backend - /// the query is being constructed for. - pub fn push_identifier(&mut self, identifier: &str) -> QueryResult<()> { - match self.internals { - AstPassInternals::ToSql(ref mut builder) => builder.push_identifier(identifier)?, - AstPassInternals::IsNoop(ref mut result) => **result = false, - _ => {} - } - Ok(()) - } - - /// Push a value onto the given query to be sent separate from the SQL - /// - /// This method affects multiple AST passes. It should be called at the - /// point in the query where you'd want the parameter placeholder (`$1` on - /// PG, `?` on other backends) to be inserted. - pub fn push_bind_param(&mut self, bind: &U) -> QueryResult<()> - where - DB: HasSqlType, - U: ToSql, - { - use self::AstPassInternals::*; - match self.internals { - ToSql(ref mut out) => out.push_bind_param(), - CollectBinds { - ref mut collector, - metadata_lookup, - } => collector.push_bound_value(bind, metadata_lookup)?, - DebugBinds(ref mut f) => { - f.entry(bind); - } - IsNoop(ref mut result) => **result = false, - _ => {} - } - Ok(()) - } - - #[doc(hidden)] - pub fn push_bind_param_value_only(&mut self, bind: &U) -> QueryResult<()> - where - DB: HasSqlType, - U: ToSql, - { - use self::AstPassInternals::*; - match self.internals { - CollectBinds { .. } | DebugBinds(..) => self.push_bind_param(bind)?, - _ => {} - } - Ok(()) - } -} - -#[allow(missing_debug_implementations)] -/// This is separate from the struct to cause the enum to be opaque, forcing -/// usage of the methods provided rather than matching on the enum directly. -/// This essentially mimics the capabilities that would be available if -/// `AstPass` were a trait. -enum AstPassInternals<'a, DB> -where - DB: Backend, - DB::QueryBuilder: 'a, - DB::BindCollector: 'a, - DB::MetadataLookup: 'a, -{ - ToSql(&'a mut DB::QueryBuilder), - CollectBinds { - collector: &'a mut DB::BindCollector, - metadata_lookup: &'a DB::MetadataLookup, - }, - IsSafeToCachePrepared(&'a mut bool), - DebugBinds(&'a mut fmt::DebugList<'a, 'a>), - IsNoop(&'a mut bool), -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/bind_collector.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/bind_collector.rs deleted file mode 100644 index 0d2d63377..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/bind_collector.rs +++ /dev/null @@ -1,79 +0,0 @@ -//! Types related to managing bind parameters during query construction. - -use backend::Backend; -use result::Error::SerializationError; -use result::QueryResult; -use serialize::{IsNull, Output, ToSql}; -use sql_types::{HasSqlType, TypeMetadata}; - -/// A type which manages serializing bind parameters during query construction. -/// -/// The only reason you would ever need to interact with this trait is if you -/// are adding support for a new backend to Diesel. Plugins which are extending -/// the query builder will use [`AstPass::push_bind_param`] instead. -/// -/// [`AstPass::push_bind_param`]: ../struct.AstPass.html#method.push_bind_param -pub trait BindCollector { - /// Serializes the given bind value, and collects the result. - fn push_bound_value( - &mut self, - bind: &U, - metadata_lookup: &DB::MetadataLookup, - ) -> QueryResult<()> - where - DB: HasSqlType, - U: ToSql; -} - -#[derive(Debug)] -/// A bind collector used by backends which transmit bind parameters as an -/// opaque blob of bytes. -/// -/// For most backends, this is the concrete implementation of `BindCollector` -/// that should be used. -pub struct RawBytesBindCollector { - /// The metadata associated with each bind parameter. - /// - /// This vec is guaranteed to be the same length as `binds`. - pub metadata: Vec, - /// The serialized bytes for each bind parameter. - /// - /// This vec is guaranteed to be the same length as `metadata`. - pub binds: Vec>>, -} - -#[allow(clippy::new_without_default_derive)] -impl RawBytesBindCollector { - /// Construct an empty `RawBytesBindCollector` - pub fn new() -> Self { - RawBytesBindCollector { - metadata: Vec::new(), - binds: Vec::new(), - } - } -} - -impl BindCollector for RawBytesBindCollector { - fn push_bound_value( - &mut self, - bind: &U, - metadata_lookup: &DB::MetadataLookup, - ) -> QueryResult<()> - where - DB: HasSqlType, - U: ToSql, - { - let mut to_sql_output = Output::new(Vec::new(), metadata_lookup); - let is_null = bind - .to_sql(&mut to_sql_output) - .map_err(SerializationError)?; - let bytes = to_sql_output.into_inner(); - let metadata = >::metadata(metadata_lookup); - match is_null { - IsNull::No => self.binds.push(Some(bytes)), - IsNull::Yes => self.binds.push(None), - } - self.metadata.push(metadata); - Ok(()) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/clause_macro.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/clause_macro.rs deleted file mode 100644 index a7ec57ebe..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/clause_macro.rs +++ /dev/null @@ -1,34 +0,0 @@ -macro_rules! simple_clause { - ($no_clause:ident, $clause:ident, $sql:expr) => { - simple_clause!($no_clause, $clause, $sql, backend_bounds = ); - }; - - ($no_clause:ident, $clause:ident, $sql:expr, backend_bounds = $($backend_bounds:ident),*) => { - use backend::Backend; - use result::QueryResult; - use super::{QueryFragment, AstPass}; - - #[derive(Debug, Clone, Copy, QueryId)] - pub struct $no_clause; - - impl QueryFragment for $no_clause { - fn walk_ast(&self, _: AstPass) -> QueryResult<()> { - Ok(()) - } - } - - #[derive(Debug, Clone, Copy, QueryId)] - pub struct $clause(pub Expr); - - impl QueryFragment for $clause where - DB: Backend $(+ $backend_bounds)*, - Expr: QueryFragment, - { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql($sql); - self.0.walk_ast(out.reborrow())?; - Ok(()) - } - } - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/debug_query.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/debug_query.rs deleted file mode 100644 index b3a78368f..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/debug_query.rs +++ /dev/null @@ -1,98 +0,0 @@ -use std::fmt::{self, Debug, Display}; -use std::marker::PhantomData; -use std::mem; - -use super::{AstPass, QueryBuilder, QueryFragment}; -use backend::Backend; - -/// A struct that implements `fmt::Display` and `fmt::Debug` to show the SQL -/// representation of a query. -/// -/// The `Display` implementation will be the exact query sent to the server, -/// plus a comment with the values of the bind parameters. The `Debug` -/// implementation is more structured, and able to be pretty printed. -/// -/// See [`debug_query`] for usage examples. -/// -/// [`debug_query`]: ../fn.debug_query.html -pub struct DebugQuery<'a, T: 'a, DB> { - query: &'a T, - _marker: PhantomData, -} - -impl<'a, T, DB> DebugQuery<'a, T, DB> { - pub(crate) fn new(query: &'a T) -> Self { - DebugQuery { - query, - _marker: PhantomData, - } - } -} - -impl<'a, T, DB> Display for DebugQuery<'a, T, DB> -where - DB: Backend, - DB::QueryBuilder: Default, - T: QueryFragment, -{ - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let mut query_builder = DB::QueryBuilder::default(); - QueryFragment::::to_sql(self.query, &mut query_builder).map_err(|_| fmt::Error)?; - let debug_binds = DebugBinds::<_, DB>::new(self.query); - write!(f, "{} -- binds: {:?}", query_builder.finish(), debug_binds) - } -} - -impl<'a, T, DB> Debug for DebugQuery<'a, T, DB> -where - DB: Backend, - DB::QueryBuilder: Default, - T: QueryFragment, -{ - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let mut query_builder = DB::QueryBuilder::default(); - QueryFragment::::to_sql(self.query, &mut query_builder).map_err(|_| fmt::Error)?; - let debug_binds = DebugBinds::<_, DB>::new(self.query); - f.debug_struct("Query") - .field("sql", &query_builder.finish()) - .field("binds", &debug_binds) - .finish() - } -} - -/// A struct that implements `fmt::Debug` by walking the given AST and writing -/// the `fmt::Debug` implementation of each bind parameter. -pub struct DebugBinds<'a, T: 'a, DB> { - query: &'a T, - _marker: PhantomData, -} - -impl<'a, T, DB> DebugBinds<'a, T, DB> { - fn new(query: &'a T) -> Self { - DebugBinds { - query, - _marker: PhantomData, - } - } -} - -impl<'a, T, DB> Debug for DebugBinds<'a, T, DB> -where - DB: Backend, - T: QueryFragment, -{ - // Clippy is wrong, this cannot be expressed with pointer casting - #[allow(clippy::transmute_ptr_to_ptr)] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let mut list = f.debug_list(); - { - // Safe because the lifetime is shortened to one smaller - // than the lifetime of the formatter. - let list_with_shorter_lifetime = unsafe { mem::transmute(&mut list) }; - let ast_pass = AstPass::debug_binds(list_with_shorter_lifetime); - self.query.walk_ast(ast_pass).map_err(|_| fmt::Error)?; - } - list.finish()?; - Ok(()) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/delete_statement/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/delete_statement/mod.rs deleted file mode 100644 index 4d98c5658..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/delete_statement/mod.rs +++ /dev/null @@ -1,236 +0,0 @@ -use backend::Backend; -use dsl::{Filter, IntoBoxed}; -use expression::{AppearsOnTable, SelectableExpression}; -use query_builder::returning_clause::*; -use query_builder::where_clause::*; -use query_builder::*; -use query_dsl::methods::{BoxedDsl, FilterDsl}; -use query_dsl::RunQueryDsl; -use query_source::Table; -use result::QueryResult; - -#[derive(Debug, Clone, Copy, QueryId)] -#[must_use = "Queries are only executed when calling `load`, `get_result` or similar."] -/// Represents a SQL `DELETE` statement. -/// -/// The type parameters on this struct represent: -/// -/// - `T`: The table we are deleting from. -/// - `U`: The `WHERE` clause of this query. The exact types used to represent -/// this are private, and you should not make any assumptions about them. -/// - `Ret`: The `RETURNING` clause of this query. The exact types used to -/// represent this are private. You can safely rely on the default type -/// representing the lack of a `RETURNING` clause. -pub struct DeleteStatement { - table: T, - where_clause: U, - returning: Ret, -} - -/// A `DELETE` statement with a boxed `WHERE` clause -pub type BoxedDeleteStatement<'a, DB, T, Ret = NoReturningClause> = - DeleteStatement, Ret>; - -impl DeleteStatement { - pub(crate) fn new(table: T, where_clause: U) -> Self { - DeleteStatement { - table: table, - where_clause: where_clause, - returning: NoReturningClause, - } - } - - /// Adds the given predicate to the `WHERE` clause of the statement being - /// constructed. - /// - /// If there is already a `WHERE` clause, the predicate will be appended - /// with `AND`. There is no difference in behavior between - /// `delete(table.filter(x))` and `delete(table).filter(x)`. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../../doctest_setup.rs"); - /// # - /// # fn main() { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// let deleted_rows = diesel::delete(users) - /// .filter(name.eq("Sean")) - /// .execute(&connection); - /// assert_eq!(Ok(1), deleted_rows); - /// - /// let expected_names = vec!["Tess".to_string()]; - /// let names = users.select(name).load(&connection); - /// - /// assert_eq!(Ok(expected_names), names); - /// # } - /// ``` - pub fn filter(self, predicate: Predicate) -> Filter - where - Self: FilterDsl, - { - FilterDsl::filter(self, predicate) - } - - /// Boxes the `WHERE` clause of this delete statement. - /// - /// This is useful for cases where you want to conditionally modify a query, - /// but need the type to remain the same. The backend must be specified as - /// part of this. It is not possible to box a query and have it be useable - /// on multiple backends. - /// - /// A boxed query will incur a minor performance penalty, as the query builder - /// can no longer be inlined by the compiler. For most applications this cost - /// will be minimal. - /// - /// ### Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use std::collections::HashMap; - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// # let mut params = HashMap::new(); - /// # params.insert("sean_has_been_a_jerk", true); - /// let mut query = diesel::delete(users) - /// .into_boxed(); - /// - /// if params["sean_has_been_a_jerk"] { - /// query = query.filter(name.eq("Sean")); - /// } - /// - /// let deleted_rows = query.execute(&connection)?; - /// assert_eq!(1, deleted_rows); - /// - /// let expected_names = vec!["Tess"]; - /// let names = users.select(name).load::(&connection)?; - /// - /// assert_eq!(expected_names, names); - /// # Ok(()) - /// # } - /// ``` - pub fn into_boxed<'a, DB>(self) -> IntoBoxed<'a, Self, DB> - where - DB: Backend, - Self: BoxedDsl<'a, DB>, - { - BoxedDsl::internal_into_boxed(self) - } -} - -impl FilterDsl for DeleteStatement -where - U: WhereAnd, - Predicate: AppearsOnTable, -{ - type Output = DeleteStatement; - - fn filter(self, predicate: Predicate) -> Self::Output { - DeleteStatement { - table: self.table, - where_clause: self.where_clause.and(predicate), - returning: self.returning, - } - } -} - -impl<'a, T, U, Ret, DB> BoxedDsl<'a, DB> for DeleteStatement -where - U: Into>, -{ - type Output = BoxedDeleteStatement<'a, DB, T, Ret>; - - fn internal_into_boxed(self) -> Self::Output { - DeleteStatement { - table: self.table, - where_clause: self.where_clause.into(), - returning: self.returning, - } - } -} - -impl QueryFragment for DeleteStatement -where - DB: Backend, - T: Table, - T::FromClause: QueryFragment, - U: QueryFragment, - Ret: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql("DELETE FROM "); - self.table.from_clause().walk_ast(out.reborrow())?; - self.where_clause.walk_ast(out.reborrow())?; - self.returning.walk_ast(out.reborrow())?; - Ok(()) - } -} - -impl AsQuery for DeleteStatement -where - T: Table, - T::AllColumns: SelectableExpression, - DeleteStatement>: Query, -{ - type SqlType = ::SqlType; - type Query = DeleteStatement>; - - fn as_query(self) -> Self::Query { - self.returning(T::all_columns()) - } -} - -impl Query for DeleteStatement> -where - T: Table, - Ret: SelectableExpression, -{ - type SqlType = Ret::SqlType; -} - -impl RunQueryDsl for DeleteStatement {} - -impl DeleteStatement { - /// Specify what expression is returned after execution of the `delete`. - /// - /// # Examples - /// - /// ### Deleting a record: - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../../doctest_setup.rs"); - /// # - /// # #[cfg(feature = "postgres")] - /// # fn main() { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// let deleted_name = diesel::delete(users.filter(name.eq("Sean"))) - /// .returning(name) - /// .get_result(&connection); - /// assert_eq!(Ok("Sean".to_string()), deleted_name); - /// # } - /// # #[cfg(not(feature = "postgres"))] - /// # fn main() {} - /// ``` - pub fn returning(self, returns: E) -> DeleteStatement> - where - E: SelectableExpression, - DeleteStatement>: Query, - { - DeleteStatement { - table: self.table, - where_clause: self.where_clause, - returning: ReturningClause(returns), - } - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/distinct_clause.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/distinct_clause.rs deleted file mode 100644 index 6aabf0edc..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/distinct_clause.rs +++ /dev/null @@ -1,24 +0,0 @@ -use backend::Backend; -use query_builder::*; -use result::QueryResult; - -#[derive(Debug, Clone, Copy, QueryId)] -pub struct NoDistinctClause; -#[derive(Debug, Clone, Copy, QueryId)] -pub struct DistinctClause; - -impl QueryFragment for NoDistinctClause { - fn walk_ast(&self, _: AstPass) -> QueryResult<()> { - Ok(()) - } -} - -impl QueryFragment for DistinctClause { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql("DISTINCT "); - Ok(()) - } -} - -#[cfg(feature = "postgres")] -pub use pg::DistinctOnClause; diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/functions.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/functions.rs deleted file mode 100644 index 172adb4aa..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/functions.rs +++ /dev/null @@ -1,466 +0,0 @@ -use super::delete_statement::DeleteStatement; -use super::insert_statement::{Insert, InsertOrIgnore, Replace}; -use super::{ - IncompleteInsertStatement, IntoUpdateTarget, SelectStatement, SqlQuery, UpdateStatement, -}; -use dsl::Select; -use expression::Expression; -use query_dsl::methods::SelectDsl; - -/// Creates an `UPDATE` statement. -/// -/// When a table is passed to `update`, every row in the table will be updated. -/// You can narrow this scope by calling [`filter`] on the table before passing it in, -/// which will result in `UPDATE your_table SET ... WHERE args_to_filter`. -/// -/// Passing a type which implements `Identifiable` is the same as passing -/// `some_table.find(some_struct.id())`. -/// -/// [`filter`]: query_builder/struct.UpdateStatement.html#method.filter -/// -/// # Examples -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # -/// # #[cfg(feature = "postgres")] -/// # fn main() { -/// # use schema::users::dsl::*; -/// # let connection = establish_connection(); -/// let updated_row = diesel::update(users.filter(id.eq(1))) -/// .set(name.eq("James")) -/// .get_result(&connection); -/// // On backends that support it, you can call `get_result` instead of `execute` -/// // to have `RETURNING *` automatically appended to the query. Alternatively, you -/// // can explicitly return an expression by using the `returning` method before -/// // getting the result. -/// assert_eq!(Ok((1, "James".to_string())), updated_row); -/// # } -/// # #[cfg(not(feature = "postgres"))] -/// # fn main() {} -/// ``` -/// -/// To update multiple columns, give [`set`] a tuple argument: -/// -/// [`set`]: query_builder/struct.UpdateStatement.html#method.set -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # -/// # table! { -/// # users { -/// # id -> Integer, -/// # name -> VarChar, -/// # surname -> VarChar, -/// # } -/// # } -/// # -/// # #[cfg(feature = "postgres")] -/// # fn main() { -/// # use users::dsl::*; -/// # let connection = establish_connection(); -/// # connection.execute("DROP TABLE users").unwrap(); -/// # connection.execute("CREATE TABLE users ( -/// # id SERIAL PRIMARY KEY, -/// # name VARCHAR, -/// # surname VARCHAR)").unwrap(); -/// # connection.execute("INSERT INTO users(name, surname) VALUES('Sean', 'Griffin')").unwrap(); -/// -/// let updated_row = diesel::update(users.filter(id.eq(1))) -/// .set((name.eq("James"), surname.eq("Bond"))) -/// .get_result(&connection); -/// -/// assert_eq!(Ok((1, "James".to_string(), "Bond".to_string())), updated_row); -/// # } -/// # #[cfg(not(feature = "postgres"))] -/// # fn main() {} -/// ``` -pub fn update(source: T) -> UpdateStatement { - UpdateStatement::new(source.into_update_target()) -} - -/// Creates a `DELETE` statement. -/// -/// When a table is passed to `delete`, -/// every row in the table will be deleted. -/// This scope can be narrowed by calling [`filter`] -/// on the table before it is passed in. -/// -/// [`filter`]: query_builder/struct.DeleteStatement.html#method.filter -/// -/// # Examples -/// -/// ### Deleting a single record: -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # -/// # fn main() { -/// # delete(); -/// # } -/// # -/// # fn delete() -> QueryResult<()> { -/// # use schema::users::dsl::*; -/// # let connection = establish_connection(); -/// # let get_count = || users.count().first::(&connection); -/// let old_count = get_count(); -/// diesel::delete(users.filter(id.eq(1))).execute(&connection)?; -/// assert_eq!(old_count.map(|count| count - 1), get_count()); -/// # Ok(()) -/// # } -/// ``` -/// -/// ### Deleting a whole table: -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # -/// # fn main() { -/// # delete(); -/// # } -/// # -/// # fn delete() -> QueryResult<()> { -/// # use schema::users::dsl::*; -/// # let connection = establish_connection(); -/// # let get_count = || users.count().first::(&connection); -/// diesel::delete(users).execute(&connection)?; -/// assert_eq!(Ok(0), get_count()); -/// # Ok(()) -/// # } -/// ``` -pub fn delete(source: T) -> DeleteStatement { - let target = source.into_update_target(); - DeleteStatement::new(target.table, target.where_clause) -} - -/// Creates an `INSERT` statement for the target table. -/// -/// You may add data by calling [`values()`] or [`default_values()`] -/// as shown in the examples. -/// -/// [`values()`]: query_builder/struct.IncompleteInsertStatement.html#method.values -/// [`default_values()`]: query_builder/struct.IncompleteInsertStatement.html#method.default_values -/// -/// Backends that support the `RETURNING` clause, such as PostgreSQL, -/// can return the inserted rows by calling [`.get_results`] instead of [`.execute`]. -/// -/// [`.get_results`]: query_dsl/trait.RunQueryDsl.html#method.get_results -/// [`.execute`]: query_dsl/trait.RunQueryDsl.html#tymethod.execute -/// -/// # Examples -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # -/// # fn main() { -/// # use schema::users::dsl::*; -/// # let connection = establish_connection(); -/// let rows_inserted = diesel::insert_into(users) -/// .values(&name.eq("Sean")) -/// .execute(&connection); -/// -/// assert_eq!(Ok(1), rows_inserted); -/// -/// let new_users = vec![ -/// name.eq("Tess"), -/// name.eq("Jim"), -/// ]; -/// -/// let rows_inserted = diesel::insert_into(users) -/// .values(&new_users) -/// .execute(&connection); -/// -/// assert_eq!(Ok(2), rows_inserted); -/// # } -/// ``` -/// -/// ### Using a tuple for values -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # -/// # fn main() { -/// # use schema::users::dsl::*; -/// # let connection = establish_connection(); -/// # diesel::delete(users).execute(&connection).unwrap(); -/// let new_user = (id.eq(1), name.eq("Sean")); -/// let rows_inserted = diesel::insert_into(users) -/// .values(&new_user) -/// .execute(&connection); -/// -/// assert_eq!(Ok(1), rows_inserted); -/// -/// let new_users = vec![ -/// (id.eq(2), name.eq("Tess")), -/// (id.eq(3), name.eq("Jim")), -/// ]; -/// -/// let rows_inserted = diesel::insert_into(users) -/// .values(&new_users) -/// .execute(&connection); -/// -/// assert_eq!(Ok(2), rows_inserted); -/// # } -/// ``` -/// -/// ### Using struct for values -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # use schema::users; -/// # -/// #[derive(Insertable)] -/// #[table_name = "users"] -/// struct NewUser<'a> { -/// name: &'a str, -/// } -/// -/// # fn main() { -/// # use schema::users::dsl::*; -/// # let connection = establish_connection(); -/// // Insert one record at a time -/// -/// let new_user = NewUser { name: "Ruby Rhod" }; -/// -/// diesel::insert_into(users) -/// .values(&new_user) -/// .execute(&connection) -/// .unwrap(); -/// -/// // Insert many records -/// -/// let new_users = vec![ -/// NewUser { name: "Leeloo Multipass", }, -/// NewUser { name: "Korben Dallas", }, -/// ]; -/// -/// let inserted_names = diesel::insert_into(users) -/// .values(&new_users) -/// .execute(&connection) -/// .unwrap(); -/// # } -/// ``` -/// -/// ### Insert from select -/// -/// When inserting from a select statement, -/// the column list can be specified with [`.into_columns`]. -/// (See also [`SelectStatement::insert_into`], which generally -/// reads better for select statements) -/// -/// [`SelectStatement::insert_into`]: prelude/trait.Insertable.html#method.insert_into -/// [`.into_columns`]: query_builder/struct.InsertStatement.html#method.into_columns -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # -/// # fn main() { -/// # run_test().unwrap(); -/// # } -/// # -/// # fn run_test() -> QueryResult<()> { -/// # use schema::{posts, users}; -/// # let conn = establish_connection(); -/// # diesel::delete(posts::table).execute(&conn)?; -/// let new_posts = users::table -/// .select(( -/// users::name.concat("'s First Post"), -/// users::id, -/// )); -/// diesel::insert_into(posts::table) -/// .values(new_posts) -/// .into_columns((posts::title, posts::user_id)) -/// .execute(&conn)?; -/// -/// let inserted_posts = posts::table -/// .select(posts::title) -/// .load::(&conn)?; -/// let expected = vec!["Sean's First Post", "Tess's First Post"]; -/// assert_eq!(expected, inserted_posts); -/// # Ok(()) -/// # } -/// ``` -/// -/// ### With return value -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # -/// # #[cfg(feature = "postgres")] -/// # fn main() { -/// # use schema::users::dsl::*; -/// # let connection = establish_connection(); -/// let inserted_names = diesel::insert_into(users) -/// .values(&vec![ -/// name.eq("Diva Plavalaguna"), -/// name.eq("Father Vito Cornelius"), -/// ]) -/// .returning(name) -/// .get_results(&connection); -/// assert_eq!(Ok(vec!["Diva Plavalaguna".to_string(), "Father Vito Cornelius".to_string()]), inserted_names); -/// # } -/// # #[cfg(not(feature = "postgres"))] -/// # fn main() {} -/// ``` -pub fn insert_into(target: T) -> IncompleteInsertStatement { - IncompleteInsertStatement::new(target, Insert) -} - -/// Creates an `INSERT [OR] IGNORE` statement. -/// -/// If a constraint violation fails, the database will ignore the offending -/// row and continue processing any subsequent rows. This function is only -/// available with MySQL and SQLite. -/// -/// With PostgreSQL, similar functionality is provided by [`on_conflict_do_nothing`]. -/// -/// [`on_conflict_do_nothing`]: query_builder/insert_statement/struct.InsertStatement.html#method.on_conflict_do_nothing -/// -/// # Example -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # -/// # fn main() { -/// # run_test().unwrap(); -/// # } -/// # -/// # #[cfg(not(feature = "postgres"))] -/// # fn run_test() -> QueryResult<()> { -/// # use schema::users::dsl::*; -/// # use diesel::{delete, insert_or_ignore_into}; -/// # -/// # let connection = establish_connection(); -/// # diesel::delete(users).execute(&connection)?; -/// insert_or_ignore_into(users) -/// .values((id.eq(1), name.eq("Jim"))) -/// .execute(&connection)?; -/// -/// insert_or_ignore_into(users) -/// .values(&vec![ -/// (id.eq(1), name.eq("Sean")), -/// (id.eq(2), name.eq("Tess")), -/// ]) -/// .execute(&connection)?; -/// -/// let names = users.select(name).order(id).load::(&connection)?; -/// assert_eq!(vec![String::from("Jim"), String::from("Tess")], names); -/// # Ok(()) -/// # } -/// # -/// # #[cfg(feature = "postgres")] -/// # fn run_test() -> QueryResult<()> { -/// # Ok(()) -/// # } -/// ``` -pub fn insert_or_ignore_into(target: T) -> IncompleteInsertStatement { - IncompleteInsertStatement::new(target, InsertOrIgnore) -} - -/// Creates a bare select statement, with no from clause. Primarily used for -/// testing diesel itself, but likely useful for third party crates as well. The -/// given expressions must be selectable from anywhere. -pub fn select(expression: T) -> Select, T> -where - T: Expression, - SelectStatement<()>: SelectDsl, -{ - SelectStatement::simple(()).select(expression) -} - -/// Creates a `REPLACE` statement. -/// -/// If a constraint violation fails, the database will attempt to replace the -/// offending row instead. This function is only available with MySQL and -/// SQLite. -/// -/// # Example -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # -/// # #[cfg(not(feature = "postgres"))] -/// # fn main() { -/// # use schema::users::dsl::*; -/// # use diesel::{insert_into, replace_into}; -/// # -/// # let conn = establish_connection(); -/// # conn.execute("DELETE FROM users").unwrap(); -/// replace_into(users) -/// .values(&vec![ -/// (id.eq(1), name.eq("Sean")), -/// (id.eq(2), name.eq("Tess")), -/// ]) -/// .execute(&conn) -/// .unwrap(); -/// -/// replace_into(users) -/// .values((id.eq(1), name.eq("Jim"))) -/// .execute(&conn) -/// .unwrap(); -/// -/// let names = users.select(name).order(id).load::(&conn); -/// assert_eq!(Ok(vec!["Jim".into(), "Tess".into()]), names); -/// # } -/// # #[cfg(feature = "postgres")] fn main() {} -pub fn replace_into(target: T) -> IncompleteInsertStatement { - IncompleteInsertStatement::new(target, Replace) -} - -/// Construct a full SQL query using raw SQL. -/// -/// This function exists for cases where a query needs to be written that is not -/// supported by the query builder. Unlike most queries in Diesel, `sql_query` -/// will deserialize its data by name, not by index. That means that you cannot -/// deserialize into a tuple, and structs which you deserialize from this -/// function will need to have `#[derive(QueryableByName)]` -/// -/// # Safety -/// -/// The implementation of `QueryableByName` will assume that columns with a -/// given name will have a certain type. The compiler will be unable to verify -/// that the given type is correct. If your query returns a column of an -/// unexpected type, the result may have the wrong value, or return an error. -/// -/// # Example -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # -/// # use schema::users; -/// # -/// # #[derive(QueryableByName, Debug, PartialEq)] -/// # #[table_name="users"] -/// # struct User { -/// # id: i32, -/// # name: String, -/// # } -/// # -/// # fn main() { -/// # use diesel::sql_query; -/// # -/// # let connection = establish_connection(); -/// let users = sql_query("SELECT * FROM users ORDER BY id") -/// .load(&connection); -/// let expected_users = vec![ -/// User { id: 1, name: "Sean".into() }, -/// User { id: 2, name: "Tess".into() }, -/// ]; -/// assert_eq!(Ok(expected_users), users); -/// # } -/// ``` -pub fn sql_query>(query: T) -> SqlQuery { - SqlQuery::new(query.into()) -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/group_by_clause.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/group_by_clause.rs deleted file mode 100644 index b2cf9362d..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/group_by_clause.rs +++ /dev/null @@ -1 +0,0 @@ -simple_clause!(NoGroupByClause, GroupByClause, " GROUP BY "); diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/insert_statement/column_list.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/insert_statement/column_list.rs deleted file mode 100644 index d25f41969..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/insert_statement/column_list.rs +++ /dev/null @@ -1,29 +0,0 @@ -use backend::Backend; -use query_builder::*; -use query_source::Column; -use result::QueryResult; - -/// Represents the column list for use in an insert statement. -/// -/// This trait is implemented by columns and tuples of columns. -pub trait ColumnList { - /// The table these columns belong to - type Table; - - /// Generate the SQL for this column list. - /// - /// Column names must *not* be qualified. - fn walk_ast(&self, out: AstPass) -> QueryResult<()>; -} - -impl ColumnList for C -where - C: Column, -{ - type Table = ::Table; - - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_identifier(C::NAME)?; - Ok(()) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/insert_statement/insert_from_select.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/insert_statement/insert_from_select.rs deleted file mode 100644 index e3db2fd12..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/insert_statement/insert_from_select.rs +++ /dev/null @@ -1,66 +0,0 @@ -use backend::Backend; -use expression::{Expression, NonAggregate, SelectableExpression}; -use insertable::*; -use query_builder::*; -use query_source::Table; - -/// Represents `(Columns) SELECT FROM ...` for use in an `INSERT` statement -#[derive(Debug, Clone, Copy)] -pub struct InsertFromSelect { - query: Select, - columns: Columns, -} - -impl InsertFromSelect { - /// Construct a new `InsertFromSelect` where the target column list is - /// `T::AllColumns`. - pub fn new(query: Select) -> Self - where - T: Table, - Columns: SelectableExpression + NonAggregate, - { - Self { - query, - columns: T::all_columns(), - } - } - - /// Replace the target column list - pub fn with_columns(self, columns: C) -> InsertFromSelect { - InsertFromSelect { - query: self.query, - columns, - } - } -} - -impl CanInsertInSingleQuery for InsertFromSelect -where - DB: Backend, -{ - fn rows_to_insert(&self) -> Option { - None - } -} - -impl QueryFragment for InsertFromSelect -where - DB: Backend, - Columns: ColumnList + Expression, - Select: Query + QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql("("); - self.columns.walk_ast(out.reborrow())?; - out.push_sql(") "); - self.query.walk_ast(out.reborrow())?; - Ok(()) - } -} - -impl UndecoratedInsertRecord for InsertFromSelect -where - Columns: ColumnList + Expression, - Select: Query, -{ -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/insert_statement/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/insert_statement/mod.rs deleted file mode 100644 index 6548ea519..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/insert_statement/mod.rs +++ /dev/null @@ -1,515 +0,0 @@ -mod column_list; -mod insert_from_select; - -pub(crate) use self::column_list::ColumnList; -pub(crate) use self::insert_from_select::InsertFromSelect; - -use std::any::*; -use std::marker::PhantomData; - -use super::returning_clause::*; -use backend::Backend; -use expression::operators::Eq; -use expression::{Expression, NonAggregate, SelectableExpression}; -use insertable::*; -#[cfg(feature = "mysql")] -use mysql::Mysql; -use query_builder::*; -#[cfg(feature = "sqlite")] -use query_dsl::methods::ExecuteDsl; -use query_dsl::RunQueryDsl; -use query_source::{Column, Table}; -use result::QueryResult; -#[cfg(feature = "sqlite")] -use sqlite::{Sqlite, SqliteConnection}; - -/// The structure returned by [`insert_into`]. -/// -/// The provided methods [`values`] and [`default_values`] will insert -/// data into the targeted table. -/// -/// [`insert_into`]: ../fn.insert_into.html -/// [`values`]: #method.values -/// [`default_values`]: #method.default_values -#[derive(Debug, Clone, Copy)] -#[must_use = "Queries are only executed when calling `load`, `get_result` or similar."] -pub struct IncompleteInsertStatement { - target: T, - operator: Op, -} - -impl IncompleteInsertStatement { - pub(crate) fn new(target: T, operator: Op) -> Self { - IncompleteInsertStatement { target, operator } - } - - /// Inserts `DEFAULT VALUES` into the targeted table. - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../../doctest_setup.rs"); - /// # - /// # table! { - /// # users (name) { - /// # name -> Text, - /// # hair_color -> Text, - /// # } - /// # } - /// # - /// # fn main() { - /// # run_test(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use diesel::insert_into; - /// # use users::dsl::*; - /// # let connection = connection_no_data(); - /// connection.execute("CREATE TABLE users ( - /// name VARCHAR(255) NOT NULL DEFAULT 'Sean', - /// hair_color VARCHAR(255) NOT NULL DEFAULT 'Green' - /// )")?; - /// - /// insert_into(users) - /// .default_values() - /// .execute(&connection) - /// .unwrap(); - /// let inserted_user = users.first(&connection)?; - /// let expected_data = (String::from("Sean"), String::from("Green")); - /// - /// assert_eq!(expected_data, inserted_user); - /// # Ok(()) - /// # } - /// ``` - pub fn default_values(self) -> InsertStatement { - static STATIC_DEFAULT_VALUES: &DefaultValues = &DefaultValues; - self.values(STATIC_DEFAULT_VALUES) - } - - /// Inserts the given values into the table passed to `insert_into`. - /// - /// See the documentation of [`insert_into`] for - /// usage examples. - /// - /// This method can sometimes produce extremely opaque error messages due to - /// limitations of the Rust language. If you receive an error about - /// "overflow evaluating requirement" as a result of calling this method, - /// you may need an `&` in front of the argument to this method. - /// - /// [`insert_into`]: ../fn.insert_into.html - pub fn values(self, records: U) -> InsertStatement - where - U: Insertable, - { - InsertStatement::new( - self.target, - records.values(), - self.operator, - NoReturningClause, - ) - } -} - -#[derive(Debug, Copy, Clone)] -#[must_use = "Queries are only executed when calling `load`, `get_result` or similar."] -/// A fully constructed insert statement. -/// -/// The parameters of this struct represent: -/// -/// - `T`: The table we are inserting into -/// - `U`: The data being inserted -/// - `Op`: The operation being performed. The specific types used to represent -/// this are private, but correspond to SQL such as `INSERT` or `REPLACE`. -/// You can safely rely on the default type representing `INSERT` -/// - `Ret`: The `RETURNING` clause of the query. The specific types used to -/// represent this are private. You can safely rely on the default type -/// representing a query without a `RETURNING` clause. -pub struct InsertStatement { - operator: Op, - target: T, - records: U, - returning: Ret, -} - -impl InsertStatement { - fn new(target: T, records: U, operator: Op, returning: Ret) -> Self { - InsertStatement { - operator: operator, - target: target, - records: records, - returning: returning, - } - } - - #[cfg(feature = "postgres")] - pub(crate) fn replace_values(self, f: F) -> InsertStatement - where - F: FnOnce(U) -> V, - { - InsertStatement::new(self.target, f(self.records), self.operator, self.returning) - } -} - -impl InsertStatement, Op, Ret> { - /// Set the column list when inserting from a select statement - /// - /// See the documentation for [`insert_into`] for usage examples. - /// - /// [`insert_into`]: ../fn.insert_into.html - pub fn into_columns( - self, - columns: C2, - ) -> InsertStatement, Op, Ret> - where - C2: ColumnList
+ Expression, - U: Query, - { - InsertStatement::new( - self.target, - self.records.with_columns(columns), - self.operator, - self.returning, - ) - } -} - -impl QueryFragment for InsertStatement -where - DB: Backend, - T: Table, - T::FromClause: QueryFragment, - U: QueryFragment + CanInsertInSingleQuery, - Op: QueryFragment, - Ret: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.unsafe_to_cache_prepared(); - - if self.records.rows_to_insert() == Some(0) { - out.push_sql("SELECT 1 FROM "); - self.target.from_clause().walk_ast(out.reborrow())?; - out.push_sql(" WHERE 1=0"); - return Ok(()); - } - - self.operator.walk_ast(out.reborrow())?; - out.push_sql(" INTO "); - self.target.from_clause().walk_ast(out.reborrow())?; - out.push_sql(" "); - self.records.walk_ast(out.reborrow())?; - self.returning.walk_ast(out.reborrow())?; - Ok(()) - } -} - -#[cfg(feature = "sqlite")] -impl<'a, T, U, Op> ExecuteDsl for InsertStatement -where - &'a U: Insertable, - InsertStatement>::Values, Op>: QueryFragment, - T: Copy, - Op: Copy, -{ - fn execute(query: Self, conn: &SqliteConnection) -> QueryResult { - use connection::Connection; - conn.transaction(|| { - let mut result = 0; - for record in query.records { - result += InsertStatement::new( - query.target, - record.values(), - query.operator, - query.returning, - ) - .execute(conn)?; - } - Ok(result) - }) - } -} - -#[cfg(feature = "sqlite")] -impl<'a, T, U, Op> ExecuteDsl for InsertStatement, Op> -where - InsertStatement: ExecuteDsl, -{ - fn execute(query: Self, conn: &SqliteConnection) -> QueryResult { - InsertStatement::new( - query.target, - query.records.records, - query.operator, - query.returning, - ) - .execute(conn) - } -} - -#[cfg(feature = "sqlite")] -impl ExecuteDsl - for InsertStatement, T>, Op> -where - InsertStatement, Op>: QueryFragment, - T: Copy, - Op: Copy, -{ - fn execute(query: Self, conn: &SqliteConnection) -> QueryResult { - use connection::Connection; - conn.transaction(|| { - let mut result = 0; - for value in query.records.values { - result += - InsertStatement::new(query.target, value, query.operator, query.returning) - .execute(conn)?; - } - Ok(result) - }) - } -} - -impl QueryId for InsertStatement { - type QueryId = (); - - const HAS_STATIC_QUERY_ID: bool = false; -} - -impl AsQuery for InsertStatement -where - T: Table, - InsertStatement>: Query, -{ - type SqlType = ::SqlType; - type Query = InsertStatement>; - - fn as_query(self) -> Self::Query { - self.returning(T::all_columns()) - } -} - -impl Query for InsertStatement> -where - Ret: Expression + SelectableExpression + NonAggregate, -{ - type SqlType = Ret::SqlType; -} - -impl RunQueryDsl for InsertStatement {} - -impl InsertStatement { - /// Specify what expression is returned after execution of the `insert`. - /// # Examples - /// - /// ### Inserting records: - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../../doctest_setup.rs"); - /// # - /// # #[cfg(feature = "postgres")] - /// # fn main() { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// let inserted_names = diesel::insert_into(users) - /// .values(&vec![name.eq("Timmy"), name.eq("Jimmy")]) - /// .returning(name) - /// .get_results(&connection); - /// assert_eq!(Ok(vec!["Timmy".to_string(), "Jimmy".to_string()]), inserted_names); - /// # } - /// # #[cfg(not(feature = "postgres"))] - /// # fn main() {} - /// ``` - pub fn returning(self, returns: E) -> InsertStatement> - where - InsertStatement>: Query, - { - InsertStatement::new( - self.target, - self.records, - self.operator, - ReturningClause(returns), - ) - } -} - -#[derive(Debug, Copy, Clone, QueryId)] -#[doc(hidden)] -pub struct Insert; - -impl QueryFragment for Insert { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql("INSERT"); - Ok(()) - } -} - -#[derive(Debug, Copy, Clone, QueryId)] -#[doc(hidden)] -pub struct InsertOrIgnore; - -#[cfg(feature = "sqlite")] -impl QueryFragment for InsertOrIgnore { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql("INSERT OR IGNORE"); - Ok(()) - } -} - -#[cfg(feature = "mysql")] -impl QueryFragment for InsertOrIgnore { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql("INSERT IGNORE"); - Ok(()) - } -} - -#[derive(Debug, Copy, Clone)] -#[doc(hidden)] -pub struct Replace; - -#[cfg(feature = "sqlite")] -impl QueryFragment for Replace { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql("REPLACE"); - Ok(()) - } -} - -#[cfg(feature = "mysql")] -impl QueryFragment for Replace { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql("REPLACE"); - Ok(()) - } -} - -/// Marker trait to indicate that no additional operations have been added -/// to a record for insert. -/// -/// This is used to prevent things like -/// `.on_conflict_do_nothing().on_conflict_do_nothing()` -/// from compiling. -pub trait UndecoratedInsertRecord
{} - -impl<'a, T, Tab> UndecoratedInsertRecord for &'a T where - T: ?Sized + UndecoratedInsertRecord -{ -} - -impl UndecoratedInsertRecord for ColumnInsertValue where T: Column {} - -impl UndecoratedInsertRecord
for [T] where T: UndecoratedInsertRecord
{} - -impl<'a, T, Table> UndecoratedInsertRecord
for BatchInsert<'a, T, Table> where - T: UndecoratedInsertRecord
-{ -} - -impl UndecoratedInsertRecord
for OwnedBatchInsert where - T: UndecoratedInsertRecord
-{ -} - -impl UndecoratedInsertRecord
for Vec where [T]: UndecoratedInsertRecord
{} - -impl UndecoratedInsertRecord for Eq where Lhs: Column {} - -impl UndecoratedInsertRecord for Option> where - Eq: UndecoratedInsertRecord -{ -} - -impl UndecoratedInsertRecord
for ValuesClause where - T: UndecoratedInsertRecord
-{ -} - -#[derive(Debug, Clone, Copy)] -#[doc(hidden)] -pub struct DefaultValues; - -impl CanInsertInSingleQuery for DefaultValues { - fn rows_to_insert(&self) -> Option { - Some(1) - } -} - -impl<'a, Tab> Insertable for &'a DefaultValues { - type Values = DefaultValues; - - fn values(self) -> Self::Values { - *self - } -} - -impl QueryFragment for DefaultValues -where - DB: Backend + Any, -{ - #[cfg(feature = "mysql")] - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - // This can be less hacky once stabilization lands - if TypeId::of::() == TypeId::of::<::mysql::Mysql>() { - out.push_sql("() VALUES ()"); - } else { - out.push_sql("DEFAULT VALUES"); - } - Ok(()) - } - - #[cfg(not(feature = "mysql"))] - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql("DEFAULT VALUES"); - Ok(()) - } -} - -#[doc(hidden)] -#[derive(Debug, Clone, Copy)] -pub struct ValuesClause { - pub(crate) values: T, - _marker: PhantomData, -} - -impl Default for ValuesClause { - fn default() -> Self { - Self::new(T::default()) - } -} - -impl ValuesClause { - pub(crate) fn new(values: T) -> Self { - Self { - values, - _marker: PhantomData, - } - } -} - -impl CanInsertInSingleQuery for ValuesClause -where - DB: Backend, - T: CanInsertInSingleQuery, -{ - fn rows_to_insert(&self) -> Option { - self.values.rows_to_insert() - } -} - -impl QueryFragment for ValuesClause -where - DB: Backend, - Tab: Table, - T: InsertValues, - DefaultValues: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - if self.values.is_noop()? { - DefaultValues.walk_ast(out)?; - } else { - out.push_sql("("); - self.values.column_names(out.reborrow())?; - out.push_sql(") VALUES ("); - self.values.walk_ast(out.reborrow())?; - out.push_sql(")"); - } - Ok(()) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/limit_clause.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/limit_clause.rs deleted file mode 100644 index 9c67ecccb..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/limit_clause.rs +++ /dev/null @@ -1 +0,0 @@ -simple_clause!(NoLimitClause, LimitClause, " LIMIT "); diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/locking_clause.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/locking_clause.rs deleted file mode 100644 index 99afdfe7a..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/locking_clause.rs +++ /dev/null @@ -1,61 +0,0 @@ -use backend::Backend; -use query_builder::{AstPass, QueryFragment}; -use result::QueryResult; - -#[derive(Debug, Clone, Copy, QueryId)] -pub struct NoLockingClause; - -impl QueryFragment for NoLockingClause { - fn walk_ast(&self, _: AstPass) -> QueryResult<()> { - Ok(()) - } -} - -#[derive(Debug, Clone, Copy, QueryId)] -pub struct LockingClause { - pub(crate) lock_mode: LockMode, - modifier: Modifier, -} - -impl LockingClause { - pub(crate) fn new(lock_mode: LockMode, modifier: Modifier) -> Self { - LockingClause { - lock_mode, - modifier, - } - } -} - -impl, M: QueryFragment> QueryFragment - for LockingClause -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - self.lock_mode.walk_ast(out.reborrow())?; - self.modifier.walk_ast(out.reborrow()) - } -} - -// `LockMode` parameters -// All the different types of row locks that can be acquired. -#[derive(Debug, Clone, Copy, QueryId)] -pub struct ForUpdate; - -#[derive(Debug, Clone, Copy, QueryId)] -pub struct ForNoKeyUpdate; - -#[derive(Debug, Clone, Copy, QueryId)] -pub struct ForShare; - -#[derive(Debug, Clone, Copy, QueryId)] -pub struct ForKeyShare; - -// Modifiers -// To be used in conjunction with a lock mode. -#[derive(Debug, Clone, Copy, QueryId)] -pub struct NoModifier; - -#[derive(Debug, Clone, Copy, QueryId)] -pub struct SkipLocked; - -#[derive(Debug, Clone, Copy, QueryId)] -pub struct NoWait; diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/mod.rs deleted file mode 100644 index 6a1fbb124..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/mod.rs +++ /dev/null @@ -1,314 +0,0 @@ -//! Contains traits responsible for the actual construction of SQL statements -//! -//! The types in this module are part of Diesel's public API, but are generally -//! only useful for implementing Diesel plugins. Applications should generally -//! not need to care about the types inside of this module. - -#[macro_use] -mod query_id; -#[macro_use] -mod clause_macro; - -mod ast_pass; -pub mod bind_collector; -mod debug_query; -mod delete_statement; -mod distinct_clause; -#[doc(hidden)] -pub mod functions; -mod group_by_clause; -mod insert_statement; -mod limit_clause; -pub(crate) mod locking_clause; -#[doc(hidden)] -pub mod nodes; -mod offset_clause; -mod order_clause; -mod returning_clause; -mod select_clause; -mod select_statement; -mod sql_query; -mod update_statement; -mod where_clause; - -pub use self::ast_pass::AstPass; -pub use self::bind_collector::BindCollector; -pub use self::debug_query::DebugQuery; -pub use self::delete_statement::{BoxedDeleteStatement, DeleteStatement}; -#[doc(inline)] -pub use self::insert_statement::{ - IncompleteInsertStatement, InsertStatement, UndecoratedInsertRecord, ValuesClause, -}; -pub use self::query_id::QueryId; -#[doc(hidden)] -pub use self::select_statement::{BoxedSelectStatement, SelectStatement}; -pub use self::sql_query::SqlQuery; -#[cfg(feature = "with-deprecated")] -#[allow(deprecated)] -pub use self::update_statement::IncompleteUpdateStatement; -#[doc(inline)] -pub use self::update_statement::{ - AsChangeset, BoxedUpdateStatement, IntoUpdateTarget, UpdateStatement, UpdateTarget, -}; - -pub(crate) use self::insert_statement::ColumnList; - -use std::error::Error; - -use backend::Backend; -use result::QueryResult; - -#[doc(hidden)] -pub type Binds = Vec>>; -/// A specialized Result type used with the query builder. -pub type BuildQueryResult = Result<(), Box>; - -/// Constructs a SQL query from a Diesel AST. -/// -/// The only reason you should ever need to interact with this trait is if you -/// are extending Diesel with support for a new backend. Plugins which extend -/// the query builder with new capabilities will interact with [`AstPass`] -/// instead. -/// -/// [`AstPass`]: struct.AstPass.html -pub trait QueryBuilder { - /// Add `sql` to the end of the query being constructed. - fn push_sql(&mut self, sql: &str); - - /// Quote `identifier`, and add it to the end of the query being - /// constructed. - fn push_identifier(&mut self, identifier: &str) -> QueryResult<()>; - - /// Add a placeholder for a bind parameter to the end of the query being - /// constructed. - fn push_bind_param(&mut self); - - /// Returns the constructed SQL query. - fn finish(self) -> String; -} - -/// A complete SQL query with a return type. -/// -/// This can be a select statement, or a command such as `update` or `insert` -/// with a `RETURNING` clause. Unlike [`Expression`], types implementing this -/// trait are guaranteed to be executable on their own. -/// -/// A type which doesn't implement this trait may still represent a complete SQL -/// query. For example, an `INSERT` statement without a `RETURNING` clause will -/// not implement this trait, but can still be executed. -/// -/// [`Expression`]: ../expression/trait.Expression.html -pub trait Query { - /// The SQL type that this query represents. - /// - /// This is the SQL type of the `SELECT` clause for select statements, and - /// the SQL type of the `RETURNING` clause for insert, update, or delete - /// statements. - type SqlType; -} - -impl<'a, T: Query> Query for &'a T { - type SqlType = T::SqlType; -} - -/// Indicates that a type is a `SELECT` statement. -/// -/// This trait differs from `Query` in two ways: -/// - It is implemented only for select statements, rather than all queries -/// which return a value. -/// - It has looser constraints. A type implementing `SelectQuery` is known to -/// be potentially valid if used as a subselect, but it is not necessarily -/// able to be executed. -pub trait SelectQuery { - /// The SQL type of the `SELECT` clause - type SqlType; -} - -/// An untyped fragment of SQL. -/// -/// This may be a complete SQL command (such as an update statement without a -/// `RETURNING` clause), or a subsection (such as our internal types used to -/// represent a `WHERE` clause). Implementations of [`ExecuteDsl`] and -/// [`LoadQuery`] will generally require that this trait be implemented. -/// -/// [`ExecuteDsl`]: ../query_dsl/methods/trait.ExecuteDsl.html -/// [`LoadQuery`]: ../query_dsl/methods/trait.LoadQuery.html -pub trait QueryFragment { - /// Walk over this `QueryFragment` for all passes. - /// - /// This method is where the actual behavior of an AST node is implemented. - /// This method will contain the behavior required for all possible AST - /// passes. See [`AstPass`] for more details. - /// - /// [`AstPass`]: struct.AstPass.html - fn walk_ast(&self, pass: AstPass) -> QueryResult<()>; - - /// Converts this `QueryFragment` to its SQL representation. - /// - /// This method should only be called by implementations of `Connection`. - fn to_sql(&self, out: &mut DB::QueryBuilder) -> QueryResult<()> { - self.walk_ast(AstPass::to_sql(out)) - } - - /// Serializes all bind parameters in this query. - /// - /// A bind parameter is a value which is sent separately from the query - /// itself. It is represented in SQL with a placeholder such as `?` or `$1`. - /// - /// This method should only be called by implementations of `Connection`. - fn collect_binds( - &self, - out: &mut DB::BindCollector, - metadata_lookup: &DB::MetadataLookup, - ) -> QueryResult<()> { - self.walk_ast(AstPass::collect_binds(out, metadata_lookup)) - } - - /// Is this query safe to store in the prepared statement cache? - /// - /// In order to keep our prepared statement cache at a reasonable size, we - /// avoid caching any queries which represent a potentially unbounded number - /// of SQL queries. Generally this will only return `true` for queries for - /// which `to_sql` will always construct exactly identical SQL. - /// - /// Some examples of where this method will return `false` are: - /// - /// - `SqlLiteral` (We don't know if the SQL was constructed dynamically, so - /// we must assume that it was) - /// - `In` and `NotIn` (Each value requires a separate bind param - /// placeholder) - /// - /// This method should only be called by implementations of `Connection`. - fn is_safe_to_cache_prepared(&self) -> QueryResult { - let mut result = true; - self.walk_ast(AstPass::is_safe_to_cache_prepared(&mut result))?; - Ok(result) - } - - #[doc(hidden)] - /// Does walking this AST have any effect? - fn is_noop(&self) -> QueryResult { - let mut result = true; - self.walk_ast(AstPass::is_noop(&mut result))?; - Ok(result) - } -} - -impl QueryFragment for Box -where - DB: Backend, - T: QueryFragment, -{ - fn walk_ast(&self, pass: AstPass) -> QueryResult<()> { - QueryFragment::walk_ast(&**self, pass) - } -} - -impl<'a, T: ?Sized, DB> QueryFragment for &'a T -where - DB: Backend, - T: QueryFragment, -{ - fn walk_ast(&self, pass: AstPass) -> QueryResult<()> { - QueryFragment::walk_ast(&**self, pass) - } -} - -impl QueryFragment for () { - fn walk_ast(&self, _: AstPass) -> QueryResult<()> { - Ok(()) - } -} - -impl QueryFragment for Option -where - DB: Backend, - T: QueryFragment, -{ - fn walk_ast(&self, out: AstPass) -> QueryResult<()> { - match *self { - Some(ref c) => c.walk_ast(out), - None => Ok(()), - } - } -} - -/// Types that can be converted into a complete, typed SQL query. -/// -/// This is used internally to automatically add the right select clause when -/// none is specified, or to automatically add `RETURNING *` in certain contexts. -/// -/// A type which implements this trait is guaranteed to be valid for execution. -pub trait AsQuery { - /// The SQL type of `Self::Query` - type SqlType; - - /// What kind of query does this type represent? - type Query: Query; - - /// Converts a type which semantically represents a SQL query into the - /// actual query being executed. See the trait level docs for more. - fn as_query(self) -> Self::Query; -} - -impl AsQuery for T { - type SqlType = ::SqlType; - type Query = Self; - - fn as_query(self) -> Self::Query { - self - } -} - -/// Takes a query `QueryFragment` expression as an argument and returns a type -/// that implements `fmt::Display` and `fmt::Debug` to show the query. -/// -/// The `Display` implementation will show the exact query being sent to the -/// server, with a comment showing the values of the bind parameters. The -/// `Debug` implementation will include the same information in a more -/// structured form, and respects pretty printing. -/// -/// # Example -/// -/// ### Returning SQL from a count statement: -/// -/// ```rust -/// # include!("../doctest_setup.rs"); -/// # -/// # #[macro_use] extern crate diesel; -/// # use diesel::*; -/// # use schema::*; -/// # -/// # fn main() { -/// # use schema::users::dsl::*; -/// let sql = debug_query::(&users.count()).to_string(); -/// # if cfg!(feature = "postgres") { -/// # assert_eq!(sql, r#"SELECT COUNT(*) FROM "users" -- binds: []"#); -/// # } else { -/// assert_eq!(sql, "SELECT COUNT(*) FROM `users` -- binds: []"); -/// # } -/// -/// let query = users.find(1); -/// let debug = debug_query::(&query); -/// # if cfg!(feature = "postgres") { -/// # assert_eq!(debug.to_string(), "SELECT \"users\".\"id\", \"users\".\"name\" \ -/// # FROM \"users\" WHERE \"users\".\"id\" = $1 -- binds: [1]"); -/// # } else { -/// assert_eq!(debug.to_string(), "SELECT `users`.`id`, `users`.`name` FROM `users` \ -/// WHERE `users`.`id` = ? -- binds: [1]"); -/// # } -/// -/// let debug = format!("{:?}", debug); -/// # if !cfg!(feature = "postgres") { // Escaping that string is a pain -/// let expected = "Query { \ -/// sql: \"SELECT `users`.`id`, `users`.`name` FROM `users` WHERE \ -/// `users`.`id` = ?\", \ -/// binds: [1] \ -/// }"; -/// assert_eq!(debug, expected); -/// # } -/// # } -/// ``` -pub fn debug_query(query: &T) -> DebugQuery { - DebugQuery::new(query) -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/nodes/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/nodes/mod.rs deleted file mode 100644 index 09c0215dd..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/nodes/mod.rs +++ /dev/null @@ -1,43 +0,0 @@ -use backend::Backend; -use query_builder::*; -use result::QueryResult; - -#[derive(Debug, Copy, Clone)] -pub struct Identifier<'a>(pub &'a str); - -impl<'a, DB: Backend> QueryFragment for Identifier<'a> { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_identifier(self.0) - } -} - -#[derive(Debug, Copy, Clone)] -pub struct InfixNode<'a, T, U> { - lhs: T, - rhs: U, - middle: &'a str, -} - -impl<'a, T, U> InfixNode<'a, T, U> { - pub fn new(lhs: T, rhs: U, middle: &'a str) -> Self { - InfixNode { - lhs: lhs, - rhs: rhs, - middle: middle, - } - } -} - -impl<'a, T, U, DB> QueryFragment for InfixNode<'a, T, U> -where - DB: Backend, - T: QueryFragment, - U: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - self.lhs.walk_ast(out.reborrow())?; - out.push_sql(self.middle); - self.rhs.walk_ast(out.reborrow())?; - Ok(()) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/offset_clause.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/offset_clause.rs deleted file mode 100644 index cf0dde8f1..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/offset_clause.rs +++ /dev/null @@ -1 +0,0 @@ -simple_clause!(NoOffsetClause, OffsetClause, " OFFSET "); diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/order_clause.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/order_clause.rs deleted file mode 100644 index a6b298096..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/order_clause.rs +++ /dev/null @@ -1,20 +0,0 @@ -simple_clause!(NoOrderClause, OrderClause, " ORDER BY "); - -impl<'a, DB, Expr> Into + 'a>>> for OrderClause -where - DB: Backend, - Expr: QueryFragment + 'a, -{ - fn into(self) -> Option + 'a>> { - Some(Box::new(self.0)) - } -} - -impl<'a, DB> Into + 'a>>> for NoOrderClause -where - DB: Backend, -{ - fn into(self) -> Option + 'a>> { - None - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/query_id.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/query_id.rs deleted file mode 100644 index aa7c761ed..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/query_id.rs +++ /dev/null @@ -1,163 +0,0 @@ -use super::QueryFragment; -use std::any::{Any, TypeId}; - -/// Uniquely identifies queries by their type for the purpose of prepared -/// statement caching. -/// -/// All types which implement `QueryFragment` should also implement this trait -/// (It is not an actual supertrait of `QueryFragment` for boxing purposes). -/// -/// See the documentation of [the `QueryId` type] and [`HAS_STATIC_QUERY_ID`] -/// for more details. -/// -/// [the `QueryId` type]: #associatedtype.QueryId -/// [`HAS_STATIC_QUERY_ID`]: #associatedconstant.HAS_STATIC_QUERY_ID -/// -/// ### Deriving -/// -/// This trait can be automatically derived by Diesel. -/// For example, given this struct: -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// #[derive(QueryId)] -/// pub struct And { -/// left: Left, -/// right: Right, -/// } -/// # fn main() {} -/// ``` -/// -/// the following implementation will be generated -/// -/// ```rust,ignore -/// impl QueryId for And -/// where -/// Left: QueryId, -/// Right: QueryId, -/// { -/// type QueryId = And; -/// -/// const HAS_STATIC_QUERY_ID: bool = Left::HAS_STATIC_QUERY_ID && Right::HAS_STATIC_QUERY_ID; -/// } -/// ``` -/// -/// If the SQL generated by a struct is not uniquely identifiable by its type, -/// meaning that `HAS_STATIC_QUERY_ID` should always be false, -/// you should not derive this trait. -/// In that case you should manually implement it instead. -pub trait QueryId { - /// A type which uniquely represents `Self` in a SQL query. - /// - /// Typically this will be a re-construction of `Self` using the `QueryId` - /// type of each of your type parameters. For example, the type `And` would have `type QueryId = And`. - /// - /// The exception to this is when one of your type parameters does not - /// affect whether the same prepared statement can be used or not. For - /// example, a bind parameter is represented as `Bound`. - /// The actual Rust type we are serializing does not matter for the purposes - /// of prepared statement reuse, but a query which has identical SQL but - /// different types for its bind parameters requires a new prepared - /// statement. For this reason, `Bound` would have `type QueryId = - /// Bound`. - /// - /// If `HAS_STATIC_QUERY_ID` is `false`, you can put any type here - /// (typically `()`). - type QueryId: Any; - - /// Can the SQL generated by `Self` be uniquely identified by its type? - /// - /// Typically this question can be answered by looking at whether - /// `unsafe_to_cache_prepared` is called in your implementation of - /// `QueryFragment::walk_ast`. In Diesel itself, the only type which has - /// `false` here, but is potentially safe to store in the prepared statement - /// cache is a boxed query. - const HAS_STATIC_QUERY_ID: bool = true; - - /// Returns the type id of `Self::QueryId` if `Self::HAS_STATIC_QUERY_ID`. - /// Returns `None` otherwise. - /// - /// You should never need to override this method. - fn query_id() -> Option { - if Self::HAS_STATIC_QUERY_ID { - Some(TypeId::of::()) - } else { - None - } - } -} - -impl QueryId for () { - type QueryId = (); - - const HAS_STATIC_QUERY_ID: bool = true; -} - -impl QueryId for Box { - type QueryId = T::QueryId; - - const HAS_STATIC_QUERY_ID: bool = T::HAS_STATIC_QUERY_ID; -} - -impl<'a, T: QueryId + ?Sized> QueryId for &'a T { - type QueryId = T::QueryId; - - const HAS_STATIC_QUERY_ID: bool = T::HAS_STATIC_QUERY_ID; -} - -impl QueryId for dyn QueryFragment { - type QueryId = (); - - const HAS_STATIC_QUERY_ID: bool = false; -} - -#[cfg(test)] -mod tests { - use std::any::TypeId; - - use super::QueryId; - use prelude::*; - - table! { - users { - id -> Integer, - name -> VarChar, - } - } - - fn query_id(_: T) -> Option { - T::query_id() - } - - #[test] - fn queries_with_no_dynamic_elements_have_a_static_id() { - use self::users::dsl::*; - assert!(query_id(users).is_some()); - assert!(query_id(users.select(name)).is_some()); - assert!(query_id(users.filter(name.eq("Sean"))).is_some()); - } - - #[test] - fn queries_with_different_types_have_different_ids() { - let id1 = query_id(users::table.select(users::name)); - let id2 = query_id(users::table.select(users::id)); - assert_ne!(id1, id2); - } - - #[test] - fn bind_params_use_only_sql_type_for_query_id() { - use self::users::dsl::*; - let id1 = query_id(users.filter(name.eq("Sean"))); - let id2 = query_id(users.filter(name.eq("Tess".to_string()))); - - assert_eq!(id1, id2); - } - - #[test] - #[cfg(features = "postgres")] - fn boxed_queries_do_not_have_static_query_id() { - use pg::Pg; - assert!(query_id(users::table.into_boxed::()).is_none()); - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/returning_clause.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/returning_clause.rs deleted file mode 100644 index 66db1fc2a..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/returning_clause.rs +++ /dev/null @@ -1,8 +0,0 @@ -use backend::SupportsReturningClause; - -simple_clause!( - NoReturningClause, - ReturningClause, - " RETURNING ", - backend_bounds = SupportsReturningClause -); diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/select_clause.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/select_clause.rs deleted file mode 100644 index 08a714e69..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/select_clause.rs +++ /dev/null @@ -1,52 +0,0 @@ -use backend::Backend; -use expression::{Expression, SelectableExpression}; -use query_builder::*; -use query_source::QuerySource; - -#[derive(Debug, Clone, Copy, QueryId)] -pub struct DefaultSelectClause; -#[derive(Debug, Clone, Copy, QueryId)] -pub struct SelectClause(pub T); - -pub trait SelectClauseExpression { - type SelectClauseSqlType; -} - -impl SelectClauseExpression for SelectClause -where - T: SelectableExpression, -{ - type SelectClauseSqlType = T::SqlType; -} - -impl SelectClauseExpression for DefaultSelectClause -where - QS: QuerySource, -{ - type SelectClauseSqlType = ::SqlType; -} - -pub trait SelectClauseQueryFragment { - fn walk_ast(&self, source: &QS, pass: AstPass) -> QueryResult<()>; -} - -impl SelectClauseQueryFragment for SelectClause -where - DB: Backend, - T: QueryFragment, -{ - fn walk_ast(&self, _: &QS, pass: AstPass) -> QueryResult<()> { - self.0.walk_ast(pass) - } -} - -impl SelectClauseQueryFragment for DefaultSelectClause -where - DB: Backend, - QS: QuerySource, - QS::DefaultSelection: QueryFragment, -{ - fn walk_ast(&self, source: &QS, pass: AstPass) -> QueryResult<()> { - source.default_selection().walk_ast(pass) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/select_statement/boxed.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/select_statement/boxed.rs deleted file mode 100644 index 58cd5bd97..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/select_statement/boxed.rs +++ /dev/null @@ -1,342 +0,0 @@ -use std::marker::PhantomData; - -use backend::Backend; -use dsl::AsExprOf; -use expression::subselect::ValidSubselect; -use expression::*; -use insertable::Insertable; -use query_builder::distinct_clause::DistinctClause; -use query_builder::group_by_clause::GroupByClause; -use query_builder::insert_statement::InsertFromSelect; -use query_builder::limit_clause::LimitClause; -use query_builder::offset_clause::OffsetClause; -use query_builder::order_clause::OrderClause; -use query_builder::where_clause::*; -use query_builder::*; -use query_dsl::methods::*; -use query_dsl::*; -use query_source::joins::*; -use query_source::{QuerySource, Table}; -use result::QueryResult; -use sql_types::{BigInt, Bool, NotNull, Nullable}; - -#[allow(missing_debug_implementations)] -pub struct BoxedSelectStatement<'a, ST, QS, DB> { - select: Box + 'a>, - from: QS, - distinct: Box + 'a>, - where_clause: BoxedWhereClause<'a, DB>, - order: Option + 'a>>, - limit: Box + 'a>, - offset: Box + 'a>, - group_by: Box + 'a>, - _marker: PhantomData, -} - -impl<'a, ST, QS, DB> BoxedSelectStatement<'a, ST, QS, DB> { - #[allow(clippy::too_many_arguments)] - pub fn new( - select: Box + 'a>, - from: QS, - distinct: Box + 'a>, - where_clause: BoxedWhereClause<'a, DB>, - order: Option + 'a>>, - limit: Box + 'a>, - offset: Box + 'a>, - group_by: Box + 'a>, - ) -> Self { - BoxedSelectStatement { - select: select, - from: from, - distinct: distinct, - where_clause: where_clause, - order: order, - limit: limit, - offset: offset, - group_by: group_by, - _marker: PhantomData, - } - } -} - -impl<'a, ST, QS, DB> Query for BoxedSelectStatement<'a, ST, QS, DB> -where - DB: Backend, -{ - type SqlType = ST; -} - -impl<'a, ST, QS, DB> SelectQuery for BoxedSelectStatement<'a, ST, QS, DB> -where - DB: Backend, -{ - type SqlType = ST; -} - -impl<'a, ST, QS, QS2, DB> ValidSubselect for BoxedSelectStatement<'a, ST, QS, DB> where - Self: Query -{ -} - -impl<'a, ST, QS, DB> QueryFragment for BoxedSelectStatement<'a, ST, QS, DB> -where - DB: Backend, - QS: QuerySource, - QS::FromClause: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql("SELECT "); - self.distinct.walk_ast(out.reborrow())?; - self.select.walk_ast(out.reborrow())?; - out.push_sql(" FROM "); - self.from.from_clause().walk_ast(out.reborrow())?; - self.where_clause.walk_ast(out.reborrow())?; - self.group_by.walk_ast(out.reborrow())?; - - if let Some(ref order) = self.order { - out.push_sql(" ORDER BY "); - order.walk_ast(out.reborrow())?; - } - - self.limit.walk_ast(out.reborrow())?; - self.offset.walk_ast(out.reborrow())?; - Ok(()) - } -} - -impl<'a, ST, DB> QueryFragment for BoxedSelectStatement<'a, ST, (), DB> -where - DB: Backend, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql("SELECT "); - self.distinct.walk_ast(out.reborrow())?; - self.select.walk_ast(out.reborrow())?; - self.where_clause.walk_ast(out.reborrow())?; - self.group_by.walk_ast(out.reborrow())?; - self.order.walk_ast(out.reborrow())?; - self.limit.walk_ast(out.reborrow())?; - self.offset.walk_ast(out.reborrow())?; - Ok(()) - } -} - -impl<'a, ST, QS, DB> QueryId for BoxedSelectStatement<'a, ST, QS, DB> { - type QueryId = (); - - const HAS_STATIC_QUERY_ID: bool = false; -} - -impl<'a, ST, QS, DB, Rhs, Kind, On> InternalJoinDsl - for BoxedSelectStatement<'a, ST, QS, DB> -where - BoxedSelectStatement<'a, ST, JoinOn, On>, DB>: AsQuery, -{ - type Output = BoxedSelectStatement<'a, ST, JoinOn, On>, DB>; - - fn join(self, rhs: Rhs, kind: Kind, on: On) -> Self::Output { - BoxedSelectStatement::new( - self.select, - Join::new(self.from, rhs, kind).on(on), - self.distinct, - self.where_clause, - self.order, - self.limit, - self.offset, - self.group_by, - ) - } -} - -impl<'a, ST, QS, DB> DistinctDsl for BoxedSelectStatement<'a, ST, QS, DB> -where - DB: Backend, - DistinctClause: QueryFragment, -{ - type Output = Self; - - fn distinct(mut self) -> Self::Output { - self.distinct = Box::new(DistinctClause); - self - } -} - -impl<'a, ST, QS, DB, Selection> SelectDsl for BoxedSelectStatement<'a, ST, QS, DB> -where - DB: Backend, - Selection: SelectableExpression + QueryFragment + 'a, -{ - type Output = BoxedSelectStatement<'a, Selection::SqlType, QS, DB>; - - fn select(self, selection: Selection) -> Self::Output { - BoxedSelectStatement::new( - Box::new(selection), - self.from, - self.distinct, - self.where_clause, - self.order, - self.limit, - self.offset, - self.group_by, - ) - } -} - -impl<'a, ST, QS, DB, Predicate> FilterDsl for BoxedSelectStatement<'a, ST, QS, DB> -where - BoxedWhereClause<'a, DB>: WhereAnd>, - Predicate: AppearsOnTable + NonAggregate, -{ - type Output = Self; - - fn filter(mut self, predicate: Predicate) -> Self::Output { - self.where_clause = self.where_clause.and(predicate); - self - } -} - -impl<'a, ST, QS, DB, Predicate> OrFilterDsl for BoxedSelectStatement<'a, ST, QS, DB> -where - BoxedWhereClause<'a, DB>: WhereOr>, - Predicate: AppearsOnTable + NonAggregate, -{ - type Output = Self; - - fn or_filter(mut self, predicate: Predicate) -> Self::Output { - self.where_clause = self.where_clause.or(predicate); - self - } -} - -impl<'a, ST, QS, DB> LimitDsl for BoxedSelectStatement<'a, ST, QS, DB> -where - DB: Backend, - LimitClause>: QueryFragment, -{ - type Output = Self; - - fn limit(mut self, limit: i64) -> Self::Output { - self.limit = Box::new(LimitClause(limit.into_sql::())); - self - } -} - -impl<'a, ST, QS, DB> OffsetDsl for BoxedSelectStatement<'a, ST, QS, DB> -where - DB: Backend, - OffsetClause>: QueryFragment, -{ - type Output = Self; - - fn offset(mut self, offset: i64) -> Self::Output { - self.offset = Box::new(OffsetClause(offset.into_sql::())); - self - } -} - -impl<'a, ST, QS, DB, Order> OrderDsl for BoxedSelectStatement<'a, ST, QS, DB> -where - DB: Backend, - Order: QueryFragment + AppearsOnTable + 'a, -{ - type Output = Self; - - fn order(mut self, order: Order) -> Self::Output { - self.order = OrderClause(order).into(); - self - } -} - -impl<'a, ST, QS, DB, Order> ThenOrderDsl for BoxedSelectStatement<'a, ST, QS, DB> -where - DB: Backend + 'a, - Order: QueryFragment + AppearsOnTable + 'a, -{ - type Output = Self; - - fn then_order_by(mut self, order: Order) -> Self::Output { - self.order = match self.order { - Some(old) => Some(Box::new((old, order))), - None => Some(Box::new(order)), - }; - self - } -} - -impl<'a, ST, QS, DB, Expr> GroupByDsl for BoxedSelectStatement<'a, ST, QS, DB> -where - DB: Backend, - Expr: QueryFragment + AppearsOnTable + 'a, - Self: Query, -{ - type Output = Self; - - fn group_by(mut self, group_by: Expr) -> Self::Output { - self.group_by = Box::new(GroupByClause(group_by)); - self - } -} - -// FIXME: Should we disable joining when `.group_by` has been called? Are there -// any other query methods where a join no longer has the same semantics as -// joining on just the table? -impl<'a, ST, QS, DB, Rhs> JoinTo for BoxedSelectStatement<'a, ST, QS, DB> -where - QS: JoinTo, -{ - type FromClause = QS::FromClause; - type OnClause = QS::OnClause; - - fn join_target(rhs: Rhs) -> (Self::FromClause, Self::OnClause) { - QS::join_target(rhs) - } -} - -impl<'a, ST, QS, DB> QueryDsl for BoxedSelectStatement<'a, ST, QS, DB> {} - -impl<'a, ST, QS, DB, Conn> RunQueryDsl for BoxedSelectStatement<'a, ST, QS, DB> {} - -impl<'a, ST, QS, DB, T> Insertable for BoxedSelectStatement<'a, ST, QS, DB> -where - T: Table, - Self: Query, -{ - type Values = InsertFromSelect; - - fn values(self) -> Self::Values { - InsertFromSelect::new(self) - } -} - -impl<'a, 'b, ST, QS, DB, T> Insertable for &'b BoxedSelectStatement<'a, ST, QS, DB> -where - T: Table, - Self: Query, -{ - type Values = InsertFromSelect; - - fn values(self) -> Self::Values { - InsertFromSelect::new(self) - } -} - -impl<'a, ST, QS, DB> SelectNullableDsl for BoxedSelectStatement<'a, ST, QS, DB> -where - ST: NotNull, -{ - type Output = BoxedSelectStatement<'a, Nullable, QS, DB>; - - fn nullable(self) -> Self::Output { - BoxedSelectStatement { - select: self.select, - from: self.from, - distinct: self.distinct, - where_clause: self.where_clause, - order: self.order, - limit: self.limit, - offset: self.offset, - group_by: self.group_by, - _marker: PhantomData, - } - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/select_statement/dsl_impls.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/select_statement/dsl_impls.rs deleted file mode 100644 index 2c14ea0f9..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/select_statement/dsl_impls.rs +++ /dev/null @@ -1,515 +0,0 @@ -use super::BoxedSelectStatement; -use associations::HasTable; -use backend::Backend; -use dsl::AsExprOf; -use expression::nullable::Nullable; -use expression::*; -use insertable::Insertable; -use query_builder::distinct_clause::*; -use query_builder::group_by_clause::*; -use query_builder::insert_statement::InsertFromSelect; -use query_builder::limit_clause::*; -use query_builder::locking_clause::*; -use query_builder::offset_clause::*; -use query_builder::order_clause::*; -use query_builder::select_clause::*; -use query_builder::update_statement::*; -use query_builder::where_clause::*; -use query_builder::{AsQuery, Query, QueryFragment, SelectQuery, SelectStatement}; -use query_dsl::boxed_dsl::BoxedDsl; -use query_dsl::methods::*; -use query_dsl::*; -use query_source::joins::{Join, JoinOn, JoinTo}; -use query_source::QuerySource; -use sql_types::{BigInt, Bool}; - -impl InternalJoinDsl - for SelectStatement -where - SelectStatement, On>, S, D, W, O, L, Of, G, LC>: AsQuery, -{ - type Output = SelectStatement, On>, S, D, W, O, L, Of, G, LC>; - - fn join(self, rhs: Rhs, kind: Kind, on: On) -> Self::Output { - SelectStatement::new( - self.select, - Join::new(self.from, rhs, kind).on(on), - self.distinct, - self.where_clause, - self.order, - self.limit, - self.offset, - self.group_by, - self.locking, - ) - } -} - -impl SelectDsl - for SelectStatement -where - Selection: SelectableExpression, - SelectStatement, D, W, O, L, Of, G, LC>: SelectQuery, -{ - type Output = SelectStatement, D, W, O, L, Of, G, LC>; - - fn select(self, selection: Selection) -> Self::Output { - SelectStatement::new( - SelectClause(selection), - self.from, - self.distinct, - self.where_clause, - self.order, - self.limit, - self.offset, - self.group_by, - self.locking, - ) - } -} - -impl DistinctDsl for SelectStatement -where - Self: SelectQuery, - SelectStatement: SelectQuery, -{ - type Output = SelectStatement; - - fn distinct(self) -> Self::Output { - SelectStatement::new( - self.select, - self.from, - DistinctClause, - self.where_clause, - self.order, - self.limit, - self.offset, - self.group_by, - self.locking, - ) - } -} - -impl FilterDsl - for SelectStatement -where - Predicate: Expression + NonAggregate, - W: WhereAnd, -{ - type Output = SelectStatement; - - fn filter(self, predicate: Predicate) -> Self::Output { - SelectStatement::new( - self.select, - self.from, - self.distinct, - self.where_clause.and(predicate), - self.order, - self.limit, - self.offset, - self.group_by, - self.locking, - ) - } -} - -impl OrFilterDsl - for SelectStatement -where - Predicate: Expression + NonAggregate, - W: WhereOr, -{ - type Output = SelectStatement; - - fn or_filter(self, predicate: Predicate) -> Self::Output { - SelectStatement::new( - self.select, - self.from, - self.distinct, - self.where_clause.or(predicate), - self.order, - self.limit, - self.offset, - self.group_by, - self.locking, - ) - } -} - -use dsl::Filter; -use expression_methods::EqAll; -use query_source::Table; - -impl FindDsl for SelectStatement -where - F: Table, - F::PrimaryKey: EqAll, - Self: FilterDsl<>::Output>, -{ - type Output = Filter>::Output>; - - fn find(self, id: PK) -> Self::Output { - let primary_key = self.from.primary_key(); - FilterDsl::filter(self, primary_key.eq_all(id)) - } -} - -impl OrderDsl - for SelectStatement -where - Expr: AppearsOnTable, - Self: SelectQuery, - SelectStatement, L, Of, G, LC>: SelectQuery, -{ - type Output = SelectStatement, L, Of, G, LC>; - - fn order(self, expr: Expr) -> Self::Output { - let order = OrderClause(expr); - SelectStatement::new( - self.select, - self.from, - self.distinct, - self.where_clause, - order, - self.limit, - self.offset, - self.group_by, - self.locking, - ) - } -} - -impl ThenOrderDsl - for SelectStatement, L, Of, G, LC> -where - Expr: AppearsOnTable, -{ - type Output = SelectStatement, L, Of, G, LC>; - - fn then_order_by(self, expr: Expr) -> Self::Output { - SelectStatement::new( - self.select, - self.from, - self.distinct, - self.where_clause, - OrderClause((self.order.0, expr)), - self.limit, - self.offset, - self.group_by, - self.locking, - ) - } -} - -impl ThenOrderDsl - for SelectStatement -where - Expr: Expression, - Self: OrderDsl, -{ - type Output = ::dsl::Order; - - fn then_order_by(self, expr: Expr) -> Self::Output { - self.order_by(expr) - } -} - -#[doc(hidden)] -pub type Limit = AsExprOf; - -impl LimitDsl for SelectStatement -where - Self: SelectQuery, - SelectStatement, Of, G, LC>: SelectQuery, -{ - type Output = SelectStatement, Of, G, LC>; - - fn limit(self, limit: i64) -> Self::Output { - let limit_clause = LimitClause(limit.into_sql::()); - SelectStatement::new( - self.select, - self.from, - self.distinct, - self.where_clause, - self.order, - limit_clause, - self.offset, - self.group_by, - self.locking, - ) - } -} - -#[doc(hidden)] -pub type Offset = Limit; - -impl OffsetDsl for SelectStatement -where - Self: SelectQuery, - SelectStatement, G, LC>: SelectQuery, -{ - type Output = SelectStatement, G, LC>; - - fn offset(self, offset: i64) -> Self::Output { - let offset_clause = OffsetClause(offset.into_sql::()); - SelectStatement::new( - self.select, - self.from, - self.distinct, - self.where_clause, - self.order, - self.limit, - offset_clause, - self.group_by, - self.locking, - ) - } -} - -impl GroupByDsl for SelectStatement -where - SelectStatement>: Query, - Expr: Expression, -{ - type Output = SelectStatement>; - - fn group_by(self, expr: Expr) -> Self::Output { - let group_by = GroupByClause(expr); - SelectStatement::new( - self.select, - self.from, - self.distinct, - self.where_clause, - self.order, - self.limit, - self.offset, - group_by, - self.locking, - ) - } -} - -impl LockingDsl - for SelectStatement -{ - type Output = SelectStatement< - F, - S, - NoDistinctClause, - W, - O, - L, - Of, - NoGroupByClause, - LockingClause, - >; - - fn with_lock(self, lock: Lock) -> Self::Output { - SelectStatement::new( - self.select, - self.from, - self.distinct, - self.where_clause, - self.order, - self.limit, - self.offset, - self.group_by, - LockingClause::new(lock, NoModifier), - ) - } -} - -impl ModifyLockDsl - for SelectStatement> -{ - type Output = SelectStatement>; - - fn modify_lock(self, modifier: Modifier) -> Self::Output { - SelectStatement::new( - self.select, - self.from, - self.distinct, - self.where_clause, - self.order, - self.limit, - self.offset, - self.group_by, - LockingClause::new(self.locking.lock_mode, modifier), - ) - } -} - -impl<'a, F, S, D, W, O, L, Of, G, DB> BoxedDsl<'a, DB> - for SelectStatement, D, W, O, L, Of, G> -where - Self: AsQuery, - DB: Backend, - S: QueryFragment + SelectableExpression + 'a, - D: QueryFragment + 'a, - W: Into>, - O: Into + 'a>>>, - L: QueryFragment + 'a, - Of: QueryFragment + 'a, - G: QueryFragment + 'a, -{ - type Output = BoxedSelectStatement<'a, S::SqlType, F, DB>; - - fn internal_into_boxed(self) -> Self::Output { - BoxedSelectStatement::new( - Box::new(self.select.0), - self.from, - Box::new(self.distinct), - self.where_clause.into(), - self.order.into(), - Box::new(self.limit), - Box::new(self.offset), - Box::new(self.group_by), - ) - } -} - -impl<'a, F, D, W, O, L, Of, G, DB> BoxedDsl<'a, DB> - for SelectStatement -where - Self: AsQuery, - DB: Backend, - F: QuerySource, - F::DefaultSelection: QueryFragment + 'a, - D: QueryFragment + 'a, - W: Into>, - O: Into + 'a>>>, - L: QueryFragment + 'a, - Of: QueryFragment + 'a, - G: QueryFragment + 'a, -{ - type Output = BoxedSelectStatement<'a, ::SqlType, F, DB>; - fn internal_into_boxed(self) -> Self::Output { - BoxedSelectStatement::new( - Box::new(self.from.default_selection()), - self.from, - Box::new(self.distinct), - self.where_clause.into(), - self.order.into(), - Box::new(self.limit), - Box::new(self.offset), - Box::new(self.group_by), - ) - } -} - -impl HasTable for SelectStatement -where - F: HasTable, -{ - type Table = F::Table; - - fn table() -> Self::Table { - F::table() - } -} - -impl IntoUpdateTarget for SelectStatement -where - SelectStatement: HasTable, - W: ValidWhereClause, -{ - type WhereClause = W; - - fn into_update_target(self) -> UpdateTarget { - UpdateTarget { - table: Self::table(), - where_clause: self.where_clause, - } - } -} - -// FIXME: Should we disable joining when `.group_by` has been called? Are there -// any other query methods where a join no longer has the same semantics as -// joining on just the table? -impl JoinTo for SelectStatement -where - F: JoinTo, -{ - type FromClause = F::FromClause; - type OnClause = F::OnClause; - - fn join_target(rhs: Rhs) -> (Self::FromClause, Self::OnClause) { - F::join_target(rhs) - } -} - -impl QueryDsl for SelectStatement {} - -impl RunQueryDsl - for SelectStatement -{ -} - -impl Insertable - for SelectStatement -where - Tab: Table, - Self: Query, -{ - type Values = InsertFromSelect; - - fn values(self) -> Self::Values { - InsertFromSelect::new(self) - } -} - -impl<'a, F, S, D, W, O, L, Of, G, LC, Tab> Insertable - for &'a SelectStatement -where - Tab: Table, - Self: Query, -{ - type Values = InsertFromSelect; - - fn values(self) -> Self::Values { - InsertFromSelect::new(self) - } -} - -impl<'a, F, S, D, W, O, L, Of, G> SelectNullableDsl - for SelectStatement, D, W, O, L, Of, G> -{ - type Output = SelectStatement>, D, W, O, L, Of, G>; - - fn nullable(self) -> Self::Output { - SelectStatement::new( - SelectClause(Nullable::new(self.select.0)), - self.from, - self.distinct, - self.where_clause, - self.order, - self.limit, - self.offset, - self.group_by, - self.locking, - ) - } -} - -impl<'a, F, D, W, O, L, Of, G> SelectNullableDsl - for SelectStatement -where - F: QuerySource, -{ - type Output = - SelectStatement>, D, W, O, L, Of, G>; - - fn nullable(self) -> Self::Output { - SelectStatement::new( - SelectClause(Nullable::new(self.from.default_selection())), - self.from, - self.distinct, - self.where_clause, - self.order, - self.limit, - self.offset, - self.group_by, - self.locking, - ) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/select_statement/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/select_statement/mod.rs deleted file mode 100644 index 7982c11e4..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/select_statement/mod.rs +++ /dev/null @@ -1,220 +0,0 @@ -//! Within this module, types commonly use the following abbreviations: -//! -//! F: From Clause -//! S: Select Clause -//! D: Distinct Clause -//! W: Where Clause -//! O: Order By Clause -//! L: Limit Clause -//! Of: Offset Clause -//! G: Group By Clause -//! LC: For Update Clause -#![allow(missing_docs)] // The missing_docs lint triggers even though this is hidden - -mod boxed; -mod dsl_impls; - -pub use self::boxed::BoxedSelectStatement; - -use super::distinct_clause::NoDistinctClause; -use super::group_by_clause::NoGroupByClause; -use super::limit_clause::NoLimitClause; -use super::locking_clause::NoLockingClause; -use super::offset_clause::NoOffsetClause; -use super::order_clause::NoOrderClause; -use super::select_clause::*; -use super::where_clause::*; -use super::{AstPass, Query, QueryFragment}; -use backend::Backend; -use expression::subselect::ValidSubselect; -use expression::*; -use query_builder::SelectQuery; -use query_source::joins::{AppendSelection, Inner, Join}; -use query_source::*; -use result::QueryResult; - -#[derive(Debug, Clone, Copy, QueryId)] -#[doc(hidden)] -#[must_use = "Queries are only executed when calling `load`, `get_result` or similar."] -pub struct SelectStatement< - From, - Select = DefaultSelectClause, - Distinct = NoDistinctClause, - Where = NoWhereClause, - Order = NoOrderClause, - Limit = NoLimitClause, - Offset = NoOffsetClause, - GroupBy = NoGroupByClause, - Locking = NoLockingClause, -> { - pub(crate) select: Select, - pub(crate) from: From, - pub(crate) distinct: Distinct, - pub(crate) where_clause: Where, - pub(crate) order: Order, - pub(crate) limit: Limit, - pub(crate) offset: Offset, - pub(crate) group_by: GroupBy, - pub(crate) locking: Locking, -} - -impl SelectStatement { - #[allow(clippy::too_many_arguments)] - pub fn new( - select: S, - from: F, - distinct: D, - where_clause: W, - order: O, - limit: L, - offset: Of, - group_by: G, - locking: LC, - ) -> Self { - SelectStatement { - select: select, - from: from, - distinct: distinct, - where_clause: where_clause, - order: order, - limit: limit, - offset: offset, - group_by: group_by, - locking: locking, - } - } -} - -impl SelectStatement { - pub fn simple(from: F) -> Self { - SelectStatement::new( - DefaultSelectClause, - from, - NoDistinctClause, - NoWhereClause, - NoOrderClause, - NoLimitClause, - NoOffsetClause, - NoGroupByClause, - NoLockingClause, - ) - } -} - -impl Query for SelectStatement -where - S: SelectClauseExpression, - W: ValidWhereClause, -{ - type SqlType = S::SelectClauseSqlType; -} - -impl SelectQuery for SelectStatement -where - S: SelectClauseExpression, -{ - type SqlType = S::SelectClauseSqlType; -} - -impl QueryFragment - for SelectStatement -where - DB: Backend, - S: SelectClauseQueryFragment, - F: QuerySource, - F::FromClause: QueryFragment, - D: QueryFragment, - W: QueryFragment, - O: QueryFragment, - L: QueryFragment, - Of: QueryFragment, - G: QueryFragment, - LC: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql("SELECT "); - self.distinct.walk_ast(out.reborrow())?; - self.select.walk_ast(&self.from, out.reborrow())?; - out.push_sql(" FROM "); - self.from.from_clause().walk_ast(out.reborrow())?; - self.where_clause.walk_ast(out.reborrow())?; - self.group_by.walk_ast(out.reborrow())?; - self.order.walk_ast(out.reborrow())?; - self.limit.walk_ast(out.reborrow())?; - self.offset.walk_ast(out.reborrow())?; - self.locking.walk_ast(out.reborrow())?; - Ok(()) - } -} - -impl QueryFragment - for SelectStatement<(), S, D, W, O, L, Of, G, LC> -where - DB: Backend, - S: SelectClauseQueryFragment<(), DB>, - D: QueryFragment, - W: QueryFragment, - O: QueryFragment, - L: QueryFragment, - Of: QueryFragment, - G: QueryFragment, - LC: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql("SELECT "); - self.distinct.walk_ast(out.reborrow())?; - self.select.walk_ast(&(), out.reborrow())?; - self.where_clause.walk_ast(out.reborrow())?; - self.group_by.walk_ast(out.reborrow())?; - self.order.walk_ast(out.reborrow())?; - self.limit.walk_ast(out.reborrow())?; - self.offset.walk_ast(out.reborrow())?; - self.locking.walk_ast(out.reborrow())?; - Ok(()) - } -} - -impl ValidSubselect - for SelectStatement -where - Self: SelectQuery, - W: ValidWhereClause>, -{ -} - -/// Allow `SelectStatement` to act as if it were `From` as long as -/// no other query methods have been called on it -impl AppearsInFromClause for SelectStatement -where - From: AppearsInFromClause, -{ - type Count = From::Count; -} - -impl QuerySource for SelectStatement -where - From: QuerySource, - From::DefaultSelection: SelectableExpression, -{ - type FromClause = From::FromClause; - type DefaultSelection = From::DefaultSelection; - - fn from_clause(&self) -> Self::FromClause { - self.from.from_clause() - } - - fn default_selection(&self) -> Self::DefaultSelection { - self.from.default_selection() - } -} - -impl AppendSelection for SelectStatement -where - From: AppendSelection, -{ - type Output = From::Output; - - fn append_selection(&self, selection: Selection) -> Self::Output { - self.from.append_selection(selection) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/sql_query.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/sql_query.rs deleted file mode 100644 index 8faf08509..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/sql_query.rs +++ /dev/null @@ -1,166 +0,0 @@ -use std::marker::PhantomData; - -use backend::Backend; -use connection::Connection; -use deserialize::QueryableByName; -use query_builder::{AstPass, QueryFragment, QueryId}; -use query_dsl::{LoadQuery, RunQueryDsl}; -use result::QueryResult; -use serialize::ToSql; -use sql_types::HasSqlType; - -#[derive(Debug, Clone)] -#[must_use = "Queries are only executed when calling `load`, `get_result` or similar."] -/// The return value of `sql_query`. -/// -/// Unlike most queries in Diesel, `SqlQuery` loads its data by column name, -/// rather than by index. This means that you cannot deserialize this query into -/// a tuple, and any structs used must implement `QueryableByName`. -/// -/// See [`sql_query`](../fn.sql_query.html) for examples. -pub struct SqlQuery { - query: String, -} - -impl SqlQuery { - pub(crate) fn new(query: String) -> Self { - SqlQuery { query } - } - - /// Bind a value for use with this SQL query. - /// - /// # Safety - /// - /// This function should be used with care, as Diesel cannot validate that - /// the value is of the right type nor can it validate that you have passed - /// the correct number of parameters. - /// - /// # Example - /// - /// ``` - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # use schema::users; - /// # - /// # #[derive(QueryableByName, Debug, PartialEq)] - /// # #[table_name="users"] - /// # struct User { - /// # id: i32, - /// # name: String, - /// # } - /// # - /// # fn main() { - /// # use diesel::sql_query; - /// # use diesel::sql_types::{Integer, Text}; - /// # - /// # let connection = establish_connection(); - /// # diesel::insert_into(users::table) - /// # .values(users::name.eq("Jim")) - /// # .execute(&connection).unwrap(); - /// # #[cfg(feature = "postgres")] - /// # let users = sql_query("SELECT * FROM users WHERE id > $1 AND name != $2"); - /// # #[cfg(not(feature = "postgres"))] - /// let users = sql_query("SELECT * FROM users WHERE id > ? AND name <> ?") - /// # ; - /// # let users = users - /// .bind::(1) - /// .bind::("Tess") - /// .get_results(&connection); - /// let expected_users = vec![ - /// User { id: 3, name: "Jim".into() }, - /// ]; - /// assert_eq!(Ok(expected_users), users); - /// # } - /// ``` - pub fn bind(self, value: Value) -> UncheckedBind { - UncheckedBind::new(self, value) - } -} - -impl QueryFragment for SqlQuery -where - DB: Backend, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.unsafe_to_cache_prepared(); - out.push_sql(&self.query); - Ok(()) - } -} - -impl QueryId for SqlQuery { - type QueryId = (); - - const HAS_STATIC_QUERY_ID: bool = false; -} - -impl LoadQuery for SqlQuery -where - Conn: Connection, - T: QueryableByName, -{ - fn internal_load(self, conn: &Conn) -> QueryResult> { - conn.query_by_name(&self) - } -} - -impl RunQueryDsl for SqlQuery {} - -#[derive(Debug, Clone, Copy)] -#[must_use = "Queries are only executed when calling `load`, `get_result` or similar."] -pub struct UncheckedBind { - query: Query, - value: Value, - _marker: PhantomData, -} - -impl UncheckedBind { - pub fn new(query: Query, value: Value) -> Self { - UncheckedBind { - query, - value, - _marker: PhantomData, - } - } - - pub fn bind(self, value: Value2) -> UncheckedBind { - UncheckedBind::new(self, value) - } -} - -impl QueryId for UncheckedBind -where - Query: QueryId, - ST: QueryId, -{ - type QueryId = UncheckedBind; - - const HAS_STATIC_QUERY_ID: bool = Query::HAS_STATIC_QUERY_ID && ST::HAS_STATIC_QUERY_ID; -} - -impl QueryFragment for UncheckedBind -where - DB: Backend + HasSqlType, - Query: QueryFragment, - Value: ToSql, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - self.query.walk_ast(out.reborrow())?; - out.push_bind_param_value_only(&self.value)?; - Ok(()) - } -} - -impl LoadQuery for UncheckedBind -where - Conn: Connection, - T: QueryableByName, - Self: QueryFragment + QueryId, -{ - fn internal_load(self, conn: &Conn) -> QueryResult> { - conn.query_by_name(&self) - } -} - -impl RunQueryDsl for UncheckedBind {} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/update_statement/changeset.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/update_statement/changeset.rs deleted file mode 100644 index a1621f7fa..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/update_statement/changeset.rs +++ /dev/null @@ -1,76 +0,0 @@ -use backend::Backend; -use expression::operators::Eq; -use expression::AppearsOnTable; -use query_builder::*; -use query_source::{Column, QuerySource}; -use result::QueryResult; - -/// Types which can be passed to -/// [`update.set`](struct.UpdateStatement.html#method.set). -/// -/// ### Deriving -/// -/// This trait can be automatically derived using by adding `#[derive(AsChangeset)]` -/// to your struct. Structs which derive this trait must be annotated with -/// `#[table_name = "something"]`. If the field name of your struct differs -/// from the name of the column, you can annotate the field with -/// `#[column_name = "some_column_name"]`. -/// -/// By default, any `Option` fields on the struct are skipped if their value is -/// `None`. If you would like to assign `NULL` to the field instead, you can -/// annotate your struct with `#[changeset_options(treat_none_as_null = -/// "true")]`. -pub trait AsChangeset { - /// The table which `Self::Changeset` will be updating - type Target: QuerySource; - - /// The update statement this type represents - type Changeset; - - /// Convert `self` into the actual update statement being executed - fn as_changeset(self) -> Self::Changeset; -} - -impl AsChangeset for Option { - type Target = T::Target; - type Changeset = Option; - - fn as_changeset(self) -> Self::Changeset { - self.map(|v| v.as_changeset()) - } -} - -impl AsChangeset for Eq -where - Left: Column, - Right: AppearsOnTable, -{ - type Target = Left::Table; - type Changeset = Assign; - - fn as_changeset(self) -> Self::Changeset { - Assign { - _column: self.left, - expr: self.right, - } - } -} - -#[derive(Debug, Clone, Copy)] -pub struct Assign { - _column: Col, - expr: Expr, -} - -impl QueryFragment for Assign -where - DB: Backend, - T: Column, - U: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_identifier(T::NAME)?; - out.push_sql(" = "); - QueryFragment::walk_ast(&self.expr, out) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/update_statement/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/update_statement/mod.rs deleted file mode 100644 index f68455522..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/update_statement/mod.rs +++ /dev/null @@ -1,291 +0,0 @@ -pub mod changeset; -pub mod target; - -pub use self::changeset::AsChangeset; -pub use self::target::{IntoUpdateTarget, UpdateTarget}; - -use backend::Backend; -use dsl::{Filter, IntoBoxed}; -use expression::{AppearsOnTable, Expression, NonAggregate, SelectableExpression}; -use query_builder::returning_clause::*; -use query_builder::where_clause::*; -use query_builder::*; -use query_dsl::methods::{BoxedDsl, FilterDsl}; -use query_dsl::RunQueryDsl; -use query_source::Table; -use result::Error::QueryBuilderError; -use result::QueryResult; - -/// The type returned by [`update`](../fn.update.html). The only thing you can do -/// with this type is call `set` on it. -#[deprecated(since = "1.2.0", note = "Use `UpdateStatement` instead")] -#[cfg(feature = "with-deprecated")] -pub type IncompleteUpdateStatement = UpdateStatement; - -impl UpdateStatement { - pub(crate) fn new(target: UpdateTarget) -> Self { - UpdateStatement { - table: target.table, - where_clause: target.where_clause, - values: SetNotCalled, - returning: NoReturningClause, - } - } - - /// Provides the `SET` clause of the `UPDATE` statement. - /// - /// See [`update`](../fn.update.html) for usage examples, or [the update - /// guide](https://diesel.rs/guides/all-about-updates/) for a more exhaustive - /// set of examples. - pub fn set(self, values: V) -> UpdateStatement - where - T: Table, - V: changeset::AsChangeset, - UpdateStatement: AsQuery, - { - UpdateStatement { - table: self.table, - where_clause: self.where_clause, - values: values.as_changeset(), - returning: self.returning, - } - } -} - -#[derive(Debug, Copy, Clone)] -#[must_use = "Queries are only executed when calling `load`, `get_result` or similar."] -/// Represents a complete `UPDATE` statement. -/// -/// See [`update`](../fn.update.html) for usage examples, or [the update -/// guide](https://diesel.rs/guides/all-about-updates/) for a more exhaustive -/// set of examples. -pub struct UpdateStatement { - table: T, - where_clause: U, - values: V, - returning: Ret, -} - -/// An `UPDATE` statement with a boxed `WHERE` clause. -pub type BoxedUpdateStatement<'a, DB, T, V = SetNotCalled, Ret = NoReturningClause> = - UpdateStatement, V, Ret>; - -impl UpdateStatement { - /// Adds the given predicate to the `WHERE` clause of the statement being - /// constructed. - /// - /// If there is already a `WHERE` clause, the predicate will be appended - /// with `AND`. There is no difference in behavior between - /// `update(table.filter(x))` and `update(table).filter(x)`. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../../doctest_setup.rs"); - /// # - /// # fn main() { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// let updated_rows = diesel::update(users) - /// .set(name.eq("Jim")) - /// .filter(name.eq("Sean")) - /// .execute(&connection); - /// assert_eq!(Ok(1), updated_rows); - /// - /// let expected_names = vec!["Jim".to_string(), "Tess".to_string()]; - /// let names = users.select(name).order(id).load(&connection); - /// - /// assert_eq!(Ok(expected_names), names); - /// # } - /// ``` - pub fn filter(self, predicate: Predicate) -> Filter - where - Self: FilterDsl, - { - FilterDsl::filter(self, predicate) - } - - /// Boxes the `WHERE` clause of this update statement. - /// - /// This is useful for cases where you want to conditionally modify a query, - /// but need the type to remain the same. The backend must be specified as - /// part of this. It is not possible to box a query and have it be useable - /// on multiple backends. - /// - /// A boxed query will incur a minor performance penalty, as the query builder - /// can no longer be inlined by the compiler. For most applications this cost - /// will be minimal. - /// - /// ### Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use std::collections::HashMap; - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// # let mut params = HashMap::new(); - /// # params.insert("tess_has_been_a_jerk", false); - /// let mut query = diesel::update(users) - /// .set(name.eq("Jerk")) - /// .into_boxed(); - /// - /// if !params["tess_has_been_a_jerk"] { - /// query = query.filter(name.ne("Tess")); - /// } - /// - /// let updated_rows = query.execute(&connection)?; - /// assert_eq!(1, updated_rows); - /// - /// let expected_names = vec!["Jerk", "Tess"]; - /// let names = users.select(name).order(id).load::(&connection)?; - /// - /// assert_eq!(expected_names, names); - /// # Ok(()) - /// # } - /// ``` - pub fn into_boxed<'a, DB>(self) -> IntoBoxed<'a, Self, DB> - where - DB: Backend, - Self: BoxedDsl<'a, DB>, - { - BoxedDsl::internal_into_boxed(self) - } -} - -impl FilterDsl for UpdateStatement -where - U: WhereAnd, - Predicate: AppearsOnTable, -{ - type Output = UpdateStatement; - - fn filter(self, predicate: Predicate) -> Self::Output { - UpdateStatement { - table: self.table, - where_clause: self.where_clause.and(predicate), - values: self.values, - returning: self.returning, - } - } -} - -impl<'a, T, U, V, Ret, DB> BoxedDsl<'a, DB> for UpdateStatement -where - U: Into>, -{ - type Output = BoxedUpdateStatement<'a, DB, T, V, Ret>; - - fn internal_into_boxed(self) -> Self::Output { - UpdateStatement { - table: self.table, - where_clause: self.where_clause.into(), - values: self.values, - returning: self.returning, - } - } -} - -impl QueryFragment for UpdateStatement -where - DB: Backend, - T: Table, - T::FromClause: QueryFragment, - U: QueryFragment, - V: QueryFragment, - Ret: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - if self.values.is_noop()? { - return Err(QueryBuilderError( - "There are no changes to save. This query cannot be built".into(), - )); - } - - out.unsafe_to_cache_prepared(); - out.push_sql("UPDATE "); - self.table.from_clause().walk_ast(out.reborrow())?; - out.push_sql(" SET "); - self.values.walk_ast(out.reborrow())?; - self.where_clause.walk_ast(out.reborrow())?; - self.returning.walk_ast(out.reborrow())?; - Ok(()) - } -} - -impl QueryId for UpdateStatement { - type QueryId = (); - - const HAS_STATIC_QUERY_ID: bool = false; -} - -impl AsQuery for UpdateStatement -where - T: Table, - UpdateStatement>: Query, -{ - type SqlType = ::SqlType; - type Query = UpdateStatement>; - - fn as_query(self) -> Self::Query { - self.returning(T::all_columns()) - } -} - -impl Query for UpdateStatement> -where - T: Table, - Ret: Expression + SelectableExpression + NonAggregate, -{ - type SqlType = Ret::SqlType; -} - -impl RunQueryDsl for UpdateStatement {} - -impl UpdateStatement { - /// Specify what expression is returned after execution of the `update`. - /// # Examples - /// - /// ### Updating a single record: - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../../doctest_setup.rs"); - /// # - /// # #[cfg(feature = "postgres")] - /// # fn main() { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// let updated_name = diesel::update(users.filter(id.eq(1))) - /// .set(name.eq("Dean")) - /// .returning(name) - /// .get_result(&connection); - /// assert_eq!(Ok("Dean".to_string()), updated_name); - /// # } - /// # #[cfg(not(feature = "postgres"))] - /// # fn main() {} - /// ``` - pub fn returning(self, returns: E) -> UpdateStatement> - where - T: Table, - UpdateStatement>: Query, - { - UpdateStatement { - table: self.table, - where_clause: self.where_clause, - values: self.values, - returning: ReturningClause(returns), - } - } -} - -/// Indicates that you have not yet called `.set` on an update statement -#[derive(Debug, Clone, Copy)] -pub struct SetNotCalled; diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/update_statement/target.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/update_statement/target.rs deleted file mode 100644 index a9cd0aba7..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/update_statement/target.rs +++ /dev/null @@ -1,47 +0,0 @@ -use associations::{HasTable, Identifiable}; -use dsl::Find; -use query_dsl::methods::FindDsl; -use query_source::Table; - -#[doc(hidden)] -#[derive(Debug)] -pub struct UpdateTarget { - pub table: Table, - pub where_clause: WhereClause, -} - -/// A type which can be passed to [`update`] or [`delete`]. -/// -/// Apps will never need to implement this type directly. There are three kinds -/// which implement this trait. Tables, queries which have only had `filter` -/// called on them, and types which implement `Identifiable`. -/// -/// When a table is passed to `update`, every row in the table will be updated. -/// You can scope this down by calling [`filter`] which will -/// result in `UPDATE your_table SET ... WHERE args_to_filter`. Passing a type -/// which implements `Identifiable` is the same as passing -/// `SomeStruct::table().find(some_struct)`. -/// -/// [`update`]: ../fn.update.html -/// [`delete`]: ../fn.delete.html -/// [`filter`]: struct.UpdateStatement.html#method.filter -pub trait IntoUpdateTarget: HasTable { - /// What is the `WHERE` clause of this target? - type WhereClause; - - /// Decomposes `self` into the table and where clause. - fn into_update_target(self) -> UpdateTarget; -} - -impl IntoUpdateTarget for T -where - T: Identifiable
, - Tab: Table + FindDsl, - Find: IntoUpdateTarget
, -{ - type WhereClause = V; - - fn into_update_target(self) -> UpdateTarget { - T::table().find(self.id()).into_update_target() - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/where_clause.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/where_clause.rs deleted file mode 100644 index 0f89c90f3..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_builder/where_clause.rs +++ /dev/null @@ -1,187 +0,0 @@ -use super::*; -use backend::Backend; -use dsl::Or; -use expression::operators::And; -use expression::*; -use expression_methods::*; -use result::QueryResult; -use sql_types::Bool; - -/// Add `Predicate` to the current `WHERE` clause, joining with `AND` if -/// applicable. -pub trait WhereAnd { - /// What is the type of the resulting `WHERE` clause? - type Output; - - /// See the trait-level docs. - fn and(self, predicate: Predicate) -> Self::Output; -} - -/// Add `Predicate` to the current `WHERE` clause, joining with `OR` if -/// applicable. -pub trait WhereOr { - /// What is the type of the resulting `WHERE` clause? - type Output; - - /// See the trait-level docs. - fn or(self, predicate: Predicate) -> Self::Output; -} - -/// Represents that a query has no `WHERE` clause. -#[derive(Debug, Clone, Copy, QueryId)] -pub struct NoWhereClause; - -impl QueryFragment for NoWhereClause { - fn walk_ast(&self, _: AstPass) -> QueryResult<()> { - Ok(()) - } -} - -impl WhereAnd for NoWhereClause -where - Predicate: Expression, -{ - type Output = WhereClause; - - fn and(self, predicate: Predicate) -> Self::Output { - WhereClause(predicate) - } -} - -impl WhereOr for NoWhereClause -where - Predicate: Expression, -{ - type Output = WhereClause; - - fn or(self, predicate: Predicate) -> Self::Output { - WhereClause(predicate) - } -} - -impl Into> for NoWhereClause { - fn into(self) -> BoxedWhereClause<'static, DB> { - BoxedWhereClause::None - } -} - -/// The `WHERE` clause of a query. -#[derive(Debug, Clone, Copy, QueryId)] -pub struct WhereClause(Expr); - -impl QueryFragment for WhereClause -where - DB: Backend, - Expr: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql(" WHERE "); - self.0.walk_ast(out.reborrow())?; - Ok(()) - } -} - -impl WhereAnd for WhereClause -where - Expr: Expression, - Predicate: Expression, -{ - type Output = WhereClause>; - - fn and(self, predicate: Predicate) -> Self::Output { - WhereClause(self.0.and(predicate)) - } -} - -impl WhereOr for WhereClause -where - Expr: Expression, - Predicate: Expression, -{ - type Output = WhereClause>; - - fn or(self, predicate: Predicate) -> Self::Output { - WhereClause(self.0.or(predicate)) - } -} - -impl<'a, DB, Predicate> Into> for WhereClause -where - DB: Backend, - Predicate: QueryFragment + 'a, -{ - fn into(self) -> BoxedWhereClause<'a, DB> { - BoxedWhereClause::Where(Box::new(self.0)) - } -} - -/// Marker trait indicating that a `WHERE` clause is valid for a given query -/// source. -pub trait ValidWhereClause {} - -impl ValidWhereClause for NoWhereClause {} - -impl ValidWhereClause for WhereClause where Expr: AppearsOnTable {} - -#[allow(missing_debug_implementations)] // We can't... -pub enum BoxedWhereClause<'a, DB> { - Where(Box + 'a>), - None, -} - -impl<'a, DB> QueryFragment for BoxedWhereClause<'a, DB> -where - DB: Backend, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - match *self { - BoxedWhereClause::Where(ref where_clause) => { - out.push_sql(" WHERE "); - where_clause.walk_ast(out) - } - BoxedWhereClause::None => Ok(()), - } - } -} - -impl<'a, DB> QueryId for BoxedWhereClause<'a, DB> { - type QueryId = (); - - const HAS_STATIC_QUERY_ID: bool = false; -} - -impl<'a, DB, Predicate> WhereAnd for BoxedWhereClause<'a, DB> -where - DB: Backend + 'a, - Predicate: QueryFragment + 'a, -{ - type Output = Self; - - fn and(self, predicate: Predicate) -> Self::Output { - use self::BoxedWhereClause::Where; - - match self { - Where(where_clause) => Where(Box::new(And::new(where_clause, predicate))), - BoxedWhereClause::None => Where(Box::new(predicate)), - } - } -} - -impl<'a, DB, Predicate> WhereOr for BoxedWhereClause<'a, DB> -where - DB: Backend + 'a, - Predicate: QueryFragment + 'a, -{ - type Output = Self; - - fn or(self, predicate: Predicate) -> Self::Output { - use self::BoxedWhereClause::Where; - use expression::grouped::Grouped; - use expression::operators::Or; - - match self { - Where(where_clause) => Where(Box::new(Grouped(Or::new(where_clause, predicate)))), - BoxedWhereClause::None => Where(Box::new(predicate)), - } - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/belonging_to_dsl.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/belonging_to_dsl.rs deleted file mode 100644 index a64ef2b59..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/belonging_to_dsl.rs +++ /dev/null @@ -1,55 +0,0 @@ -/// Constructs a query that finds record(s) based on directional association with other record(s). -/// -/// # Example -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # use schema::{posts, users}; -/// # -/// # #[derive(Identifiable, Queryable)] -/// # pub struct User { -/// # id: i32, -/// # name: String, -/// # } -/// # -/// # #[derive(Debug, PartialEq)] -/// # #[derive(Identifiable, Queryable, Associations)] -/// # #[belongs_to(User)] -/// # pub struct Post { -/// # id: i32, -/// # user_id: i32, -/// # title: String, -/// # } -/// # -/// # fn main() { -/// # run_test(); -/// # } -/// # -/// # fn run_test() -> QueryResult<()> { -/// # let connection = establish_connection(); -/// # use users::dsl::*; -/// # use posts::dsl::{posts, title}; -/// let sean = users.filter(name.eq("Sean")).first::(&connection)?; -/// let tess = users.filter(name.eq("Tess")).first::(&connection)?; -/// -/// let seans_posts = Post::belonging_to(&sean) -/// .select(title) -/// .load::(&connection)?; -/// assert_eq!(vec!["My first post", "About Rust"], seans_posts); -/// -/// // A vec or slice can be passed as well -/// let more_posts = Post::belonging_to(&vec![sean, tess]) -/// .select(title) -/// .load::(&connection)?; -/// assert_eq!(vec!["My first post", "About Rust", "My first post too"], more_posts); -/// # Ok(()) -/// # } -/// ``` -pub trait BelongingToDsl { - /// The query returned by `belonging_to` - type Output; - - /// Get the record(s) belonging to record(s) `other` - fn belonging_to(other: T) -> Self::Output; -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/boxed_dsl.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/boxed_dsl.rs deleted file mode 100644 index 4c15ff03f..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/boxed_dsl.rs +++ /dev/null @@ -1,29 +0,0 @@ -use query_builder::AsQuery; -use query_source::Table; - -/// The `into_boxed` method -/// -/// This trait should not be relied on directly by most apps. Its behavior is -/// provided by [`QueryDsl`]. However, you may need a where clause on this trait -/// to call `into_boxed` from generic code. -/// -/// [`QueryDsl`]: ../trait.QueryDsl.html -pub trait BoxedDsl<'a, DB> { - /// The return type of `internal_into_boxed` - type Output; - - /// See the trait documentation. - fn internal_into_boxed(self) -> Self::Output; -} - -impl<'a, T, DB> BoxedDsl<'a, DB> for T -where - T: Table + AsQuery, - T::Query: BoxedDsl<'a, DB>, -{ - type Output = >::Output; - - fn internal_into_boxed(self) -> Self::Output { - self.as_query().internal_into_boxed() - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/distinct_dsl.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/distinct_dsl.rs deleted file mode 100644 index 0ca091b6e..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/distinct_dsl.rs +++ /dev/null @@ -1,60 +0,0 @@ -#[cfg(feature = "postgres")] -use expression::SelectableExpression; -use query_source::Table; - -/// The `distinct` method -/// -/// This trait should not be relied on directly by most apps. Its behavior is -/// provided by [`QueryDsl`]. However, you may need a where clause on this trait -/// to call `distinct` from generic code. -/// -/// [`QueryDsl`]: ../trait.QueryDsl.html -pub trait DistinctDsl { - /// The type returned by `.distinct` - type Output; - - /// See the trait documentation. - fn distinct(self) -> Self::Output; -} - -impl DistinctDsl for T -where - T: Table, - T::Query: DistinctDsl, -{ - type Output = ::Output; - - fn distinct(self) -> Self::Output { - self.as_query().distinct() - } -} - -/// The `distinct_on` method -/// -/// This trait should not be relied on directly by most apps. Its behavior is -/// provided by [`QueryDsl`]. However, you may need a where clause on this trait -/// to call `distinct_on` from generic code. -/// -/// [`QueryDsl`]: ../trait.QueryDsl.html -#[cfg(feature = "postgres")] -pub trait DistinctOnDsl { - /// The type returned by `.distinct_on` - type Output; - - /// See the trait documentation - fn distinct_on(self, selection: Selection) -> Self::Output; -} - -#[cfg(feature = "postgres")] -impl DistinctOnDsl for T -where - Selection: SelectableExpression, - T: Table, - T::Query: DistinctOnDsl, -{ - type Output = >::Output; - - fn distinct_on(self, selection: Selection) -> Self::Output { - self.as_query().distinct_on(selection) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/filter_dsl.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/filter_dsl.rs deleted file mode 100644 index e5e3cab9e..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/filter_dsl.rs +++ /dev/null @@ -1,85 +0,0 @@ -use dsl::{Filter, OrFilter}; -use expression_methods::*; -use query_source::*; - -/// The `filter` method -/// -/// This trait should not be relied on directly by most apps. Its behavior is -/// provided by [`QueryDsl`]. However, you may need a where clause on this trait -/// to call `filter` from generic code. -/// -/// [`QueryDsl`]: ../trait.QueryDsl.html -pub trait FilterDsl { - /// The type returned by `.filter`. - type Output; - - /// See the trait documentation. - fn filter(self, predicate: Predicate) -> Self::Output; -} - -impl FilterDsl for T -where - T: Table, - T::Query: FilterDsl, -{ - type Output = Filter; - - fn filter(self, predicate: Predicate) -> Self::Output { - self.as_query().filter(predicate) - } -} - -/// The `find` method -/// -/// This trait should not be relied on directly by most apps. Its behavior is -/// provided by [`QueryDsl`]. However, you may need a where clause on this trait -/// to call `find` from generic code. -/// -/// [`QueryDsl`]: ../trait.QueryDsl.html -pub trait FindDsl { - /// The type returned by `.find`. - type Output; - - /// See the trait documentation. - fn find(self, id: PK) -> Self::Output; -} - -impl FindDsl for T -where - T: Table + FilterDsl<<::PrimaryKey as EqAll>::Output>, - T::PrimaryKey: EqAll, -{ - type Output = Filter>::Output>; - - fn find(self, id: PK) -> Self::Output { - let primary_key = self.primary_key(); - self.filter(primary_key.eq_all(id)) - } -} - -/// The `or_filter` method -/// -/// This trait should not be relied on directly by most apps. Its behavior is -/// provided by [`QueryDsl`]. However, you may need a where clause on this trait -/// to call `or_filter` from generic code. -/// -/// [`QueryDsl`]: ../trait.QueryDsl.html -pub trait OrFilterDsl { - /// The type returned by `.filter`. - type Output; - - /// See the trait documentation. - fn or_filter(self, predicate: Predicate) -> Self::Output; -} - -impl OrFilterDsl for T -where - T: Table, - T::Query: OrFilterDsl, -{ - type Output = OrFilter; - - fn or_filter(self, predicate: Predicate) -> Self::Output { - self.as_query().or_filter(predicate) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/group_by_dsl.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/group_by_dsl.rs deleted file mode 100644 index 00826d010..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/group_by_dsl.rs +++ /dev/null @@ -1,35 +0,0 @@ -use expression::Expression; -use query_builder::{AsQuery, Query}; -use query_source::Table; - -/// This trait is not yet part of Diesel's public API. It may change in the -/// future without a major version bump. -/// -/// This trait exists as a stop-gap for users who need to use `GROUP BY` in -/// their queries, so that they are not forced to drop entirely to raw SQL. The -/// arguments to `group_by` are not checked, nor is the select statement -/// forced to be valid. -/// -/// Since Diesel otherwise assumes that you have no `GROUP BY` clause (which -/// would mean that mixing an aggregate and non aggregate expression in the same -/// query is an error), you may need to use `sql` for your select clause. -pub trait GroupByDsl { - /// The type returned by `.group_by` - type Output: Query; - - /// See the trait documentation. - fn group_by(self, expr: Expr) -> Self::Output; -} - -impl GroupByDsl for T -where - Expr: Expression, - T: Table + AsQuery, - T::Query: GroupByDsl, -{ - type Output = >::Output; - - fn group_by(self, expr: Expr) -> Self::Output { - self.as_query().group_by(expr) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/join_dsl.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/join_dsl.rs deleted file mode 100644 index 503285291..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/join_dsl.rs +++ /dev/null @@ -1,81 +0,0 @@ -use query_builder::AsQuery; -use query_source::joins::OnClauseWrapper; -use query_source::{JoinTo, QuerySource, Table}; - -#[doc(hidden)] -/// `JoinDsl` support trait to emulate associated type constructors -pub trait InternalJoinDsl { - type Output: AsQuery; - - fn join(self, rhs: Rhs, kind: Kind, on: On) -> Self::Output; -} - -impl InternalJoinDsl for T -where - T: Table + AsQuery, - T::Query: InternalJoinDsl, -{ - type Output = >::Output; - - fn join(self, rhs: Rhs, kind: Kind, on: On) -> Self::Output { - self.as_query().join(rhs, kind, on) - } -} - -#[doc(hidden)] -/// `JoinDsl` support trait to emulate associated type constructors and grab -/// the known on clause from the associations API -pub trait JoinWithImplicitOnClause { - type Output: AsQuery; - - fn join_with_implicit_on_clause(self, rhs: Rhs, kind: Kind) -> Self::Output; -} - -impl JoinWithImplicitOnClause for Lhs -where - Lhs: JoinTo, - Lhs: InternalJoinDsl<>::FromClause, Kind, >::OnClause>, -{ - type Output = >::Output; - - fn join_with_implicit_on_clause(self, rhs: Rhs, kind: Kind) -> Self::Output { - let (from, on) = Lhs::join_target(rhs); - self.join(from, kind, on) - } -} - -/// Specify the `ON` clause for a join statement. This will override -/// any implicit `ON` clause that would come from [`joinable!`] -/// -/// [`joinable!`]: ../macro.joinable.html -/// -/// # Example -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # use schema::{users, posts}; -/// # -/// # fn main() { -/// # let connection = establish_connection(); -/// let data = users::table -/// .left_join(posts::table.on( -/// users::id.eq(posts::user_id).and( -/// posts::title.eq("My first post")) -/// )) -/// .select((users::name, posts::title.nullable())) -/// .load(&connection); -/// let expected = vec![ -/// ("Sean".to_string(), Some("My first post".to_string())), -/// ("Tess".to_string(), None), -/// ]; -/// assert_eq!(Ok(expected), data); -/// # } -pub trait JoinOnDsl: Sized { - /// See the trait documentation. - fn on(self, on: On) -> OnClauseWrapper { - OnClauseWrapper::new(self, on) - } -} - -impl JoinOnDsl for T {} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/limit_dsl.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/limit_dsl.rs deleted file mode 100644 index 81876e2d0..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/limit_dsl.rs +++ /dev/null @@ -1,28 +0,0 @@ -use query_source::Table; - -/// The `limit` method -/// -/// This trait should not be relied on directly by most apps. Its behavior is -/// provided by [`QueryDsl`]. However, you may need a where clause on this trait -/// to call `limit` from generic code. -/// -/// [`QueryDsl`]: ../trait.QueryDsl.html -pub trait LimitDsl { - /// The type returned by `.limit` - type Output; - - /// See the trait documentation - fn limit(self, limit: i64) -> Self::Output; -} - -impl LimitDsl for T -where - T: Table, - T::Query: LimitDsl, -{ - type Output = ::Output; - - fn limit(self, limit: i64) -> Self::Output { - self.as_query().limit(limit) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/load_dsl.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/load_dsl.rs deleted file mode 100644 index c6bb4e10b..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/load_dsl.rs +++ /dev/null @@ -1,57 +0,0 @@ -use super::RunQueryDsl; -use backend::Backend; -use connection::Connection; -use deserialize::Queryable; -use query_builder::{AsQuery, QueryFragment, QueryId}; -use result::QueryResult; -use sql_types::HasSqlType; - -/// The `load` method -/// -/// This trait should not be relied on directly by most apps. Its behavior is -/// provided by [`RunQueryDsl`]. However, you may need a where clause on this trait -/// to call `load` from generic code. -/// -/// [`RunQueryDsl`]: ../trait.RunQueryDsl.html -pub trait LoadQuery: RunQueryDsl { - /// Load this query - fn internal_load(self, conn: &Conn) -> QueryResult>; -} - -impl LoadQuery for T -where - Conn: Connection, - Conn::Backend: HasSqlType, - T: AsQuery + RunQueryDsl, - T::Query: QueryFragment + QueryId, - U: Queryable, -{ - fn internal_load(self, conn: &Conn) -> QueryResult> { - conn.query_by_index(self) - } -} - -/// The `execute` method -/// -/// This trait should not be relied on directly by most apps. Its behavior is -/// provided by [`RunQueryDsl`]. However, you may need a where clause on this trait -/// to call `execute` from generic code. -/// -/// [`RunQueryDsl`]: ../trait.RunQueryDsl.html -pub trait ExecuteDsl, DB: Backend = ::Backend>: - Sized -{ - /// Execute this command - fn execute(query: Self, conn: &Conn) -> QueryResult; -} - -impl ExecuteDsl for T -where - Conn: Connection, - DB: Backend, - T: QueryFragment + QueryId, -{ - fn execute(query: Self, conn: &Conn) -> QueryResult { - conn.execute_returning_count(&query) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/locking_dsl.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/locking_dsl.rs deleted file mode 100644 index eb22088c8..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/locking_dsl.rs +++ /dev/null @@ -1,85 +0,0 @@ -#[cfg(feature = "with-deprecated")] -use query_builder::locking_clause::ForUpdate; -use query_builder::AsQuery; -use query_source::Table; - -/// The `for_update` method -/// -/// This trait should not be relied on directly by most apps. Its behavior is -/// provided by [`QueryDsl`]. However, you may need a where clause on this trait -/// to call `for_update` from generic code. -/// -/// [`QueryDsl`]: ../trait.QueryDsl.html -#[cfg(feature = "with-deprecated")] -#[deprecated(since = "1.3.0", note = "use `LockingDsl` instead")] -pub trait ForUpdateDsl { - /// The type returned by `for_update`. See [`dsl::ForUpdate`] for - /// convenient access to this type. - /// - /// [`dsl::ForUpdate`]: ../../dsl/type.ForUpdate.html - type Output; - - /// See the trait level documentation - fn for_update(self) -> Self::Output; -} - -#[cfg(feature = "with-deprecated")] -#[allow(deprecated)] -impl ForUpdateDsl for T -where - T: LockingDsl, -{ - type Output = >::Output; - - fn for_update(self) -> Self::Output { - self.with_lock(ForUpdate) - } -} - -/// Methods related to locking select statements -/// -/// This trait should not be relied on directly by most apps. Its behavior is -/// provided by [`QueryDsl`]. However, you may need a where clause on this trait -/// to call `for_update` from generic code. -/// -/// [`QueryDsl`]: ../trait.QueryDsl.html -pub trait LockingDsl { - /// The type returned by `set_lock`. See [`dsl::ForUpdate`] and friends for - /// convenient access to this type. - /// - /// [`dsl::ForUpdate`]: ../../dsl/type.ForUpdate.html - type Output; - - /// See the trait level documentation - fn with_lock(self, lock: Lock) -> Self::Output; -} - -impl LockingDsl for T -where - T: Table + AsQuery, - T::Query: LockingDsl, -{ - type Output = >::Output; - - fn with_lock(self, lock: Lock) -> Self::Output { - self.as_query().with_lock(lock) - } -} - -/// Methods related to modifiers on locking select statements -/// -/// This trait should not be relied on directly by most apps. Its behavior is -/// provided by [`QueryDsl`]. However, you may need a where clause on this trait -/// to call `skip_locked` from generic code. -/// -/// [`QueryDsl`]: ../trait.QueryDsl.html -pub trait ModifyLockDsl { - /// The type returned by `modify_lock`. See [`dsl::SkipLocked`] and friends - /// for convenient access to this type. - /// - /// [`dsl::SkipLocked`]: ../../dsl/type.SkipLocked.html - type Output; - - /// See the trait level documentation - fn modify_lock(self, modifier: Modifier) -> Self::Output; -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/mod.rs deleted file mode 100644 index 68c1cf74e..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/mod.rs +++ /dev/null @@ -1,1355 +0,0 @@ -//! Traits that construct SELECT statements -//! -//! Traits in this module have methods that generally map to the keyword for the corresponding clause in SQL, -//! unless it conflicts with a Rust keyword (such as `WHERE`/`where`). -//! -//! Methods for constructing queries lives on the [`QueryDsl`] trait. -//! Methods for executing queries live on [`RunQueryDsl`]. -//! -//! See also [`expression_methods`][expression_methods] and [`dsl`][dsl]. -//! -//! [expression_methods]: ../expression_methods/index.html -//! [dsl]: ../dsl/index.html -//! [`QueryDsl`]: trait.QueryDsl.html -//! [`RunQueryDsl`]: trait.RunQueryDsl.html - -use backend::Backend; -use connection::Connection; -use expression::count::CountStar; -use expression::Expression; -use helper_types::*; -use query_builder::locking_clause as lock; -use query_source::{joins, Table}; -use result::{first_or_not_found, QueryResult}; - -mod belonging_to_dsl; -#[doc(hidden)] -pub mod boxed_dsl; -mod distinct_dsl; -#[doc(hidden)] -pub mod filter_dsl; -mod group_by_dsl; -mod join_dsl; -#[doc(hidden)] -pub mod limit_dsl; -#[doc(hidden)] -pub mod load_dsl; -mod locking_dsl; -mod nullable_select_dsl; -mod offset_dsl; -mod order_dsl; -mod save_changes_dsl; -#[doc(hidden)] -pub mod select_dsl; -mod single_value_dsl; - -pub use self::belonging_to_dsl::BelongingToDsl; -#[doc(hidden)] -pub use self::group_by_dsl::GroupByDsl; -pub use self::join_dsl::{InternalJoinDsl, JoinOnDsl, JoinWithImplicitOnClause}; -#[doc(hidden)] -pub use self::load_dsl::LoadQuery; -pub use self::save_changes_dsl::{SaveChangesDsl, UpdateAndFetchResults}; - -/// The traits used by `QueryDsl`. -/// -/// Each trait in this module represents exactly one method from `QueryDsl`. -/// Apps should general rely on `QueryDsl` directly, rather than these traits. -/// However, generic code may need to include a where clause that references -/// these traits. -pub mod methods { - pub use super::boxed_dsl::BoxedDsl; - pub use super::distinct_dsl::*; - #[doc(inline)] - pub use super::filter_dsl::*; - pub use super::limit_dsl::LimitDsl; - pub use super::load_dsl::{ExecuteDsl, LoadQuery}; - #[cfg(feature = "with-deprecated")] - #[allow(deprecated)] - pub use super::locking_dsl::ForUpdateDsl; - pub use super::locking_dsl::{LockingDsl, ModifyLockDsl}; - pub use super::nullable_select_dsl::SelectNullableDsl; - pub use super::offset_dsl::OffsetDsl; - pub use super::order_dsl::{OrderDsl, ThenOrderDsl}; - pub use super::select_dsl::SelectDsl; - pub use super::single_value_dsl::SingleValueDsl; -} - -/// Methods used to construct select statements. -pub trait QueryDsl: Sized { - /// Adds the `DISTINCT` keyword to a query. - /// - /// This method will override any previous distinct clause that was present. - /// For example, on PostgreSQL, `foo.distinct_on(bar).distinct()` will - /// create the same query as `foo.distinct()`. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// # connection.execute("DELETE FROM users").unwrap(); - /// diesel::insert_into(users) - /// .values(&vec![name.eq("Sean"); 3]) - /// .execute(&connection)?; - /// let names = users.select(name).load::(&connection)?; - /// let distinct_names = users.select(name).distinct().load::(&connection)?; - /// - /// assert_eq!(vec!["Sean"; 3], names); - /// assert_eq!(vec!["Sean"; 1], distinct_names); - /// # Ok(()) - /// # } - /// ``` - fn distinct(self) -> Distinct - where - Self: methods::DistinctDsl, - { - methods::DistinctDsl::distinct(self) - } - - /// Adds the `DISTINCT ON` clause to a query. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # use schema::animals; - /// # - /// # #[derive(Queryable, Debug, PartialEq)] - /// # struct Animal { - /// # species: String, - /// # name: Option, - /// # legs: i32, - /// # } - /// # - /// # impl Animal { - /// # fn new>(species: S, name: Option<&str>, legs: i32) -> Self { - /// # Animal { - /// # species: species.into(), - /// # name: name.map(Into::into), - /// # legs - /// # } - /// # } - /// # } - /// # - /// # fn main() { - /// # use self::animals::dsl::*; - /// # let connection = establish_connection(); - /// # connection.execute("DELETE FROM animals").unwrap(); - /// diesel::insert_into(animals) - /// .values(&vec![ - /// (species.eq("dog"), name.eq(Some("Jack")), legs.eq(4)), - /// (species.eq("dog"), name.eq(None), legs.eq(4)), - /// (species.eq("spider"), name.eq(None), legs.eq(8)), - /// ]) - /// .execute(&connection) - /// .unwrap(); - /// let all_animals = animals.select((species, name, legs)).load(&connection); - /// let distinct_animals = animals.select((species, name, legs)).distinct_on(species).load(&connection); - /// - /// assert_eq!(Ok(vec![Animal::new("dog", Some("Jack"), 4), - /// Animal::new("dog", None, 4), - /// Animal::new("spider", None, 8)]), all_animals); - /// assert_eq!(Ok(vec![Animal::new("dog", Some("Jack"), 4), - /// Animal::new("spider", None, 8)]), distinct_animals); - /// # } - /// ``` - #[cfg(feature = "postgres")] - fn distinct_on(self, expr: Expr) -> DistinctOn - where - Self: methods::DistinctOnDsl, - { - methods::DistinctOnDsl::distinct_on(self, expr) - } - - // FIXME: Needs usage example and doc rewrite - /// Adds a `SELECT` clause to the query. - /// - /// If there was already a select clause present, it will be overridden. - /// For example, `foo.select(bar).select(baz)` will produce the same - /// query as `foo.select(baz)`. - /// - /// By default, the select clause will be roughly equivalent to `SELECT *` - /// (however, Diesel will list all columns to ensure that they are in the - /// order we expect). - /// - /// `select` has slightly stricter bounds on its arguments than other - /// methods. In particular, when used with a left outer join, `.nullable` - /// must be called on columns that come from the right side of a join. It - /// can be called on the column itself, or on an expression containing that - /// column. `title.nullable()`, `lower(title).nullable()`, and `(id, - /// title).nullable()` would all be valid. - /// - /// # Examples - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # use schema::users; - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use self::users::dsl::*; - /// # let connection = establish_connection(); - /// // By default, all columns will be selected - /// let all_users = users.load::<(i32, String)>(&connection)?; - /// assert_eq!(vec![(1, String::from("Sean")), (2, String::from("Tess"))], all_users); - /// - /// let all_names = users.select(name).load::(&connection)?; - /// assert_eq!(vec!["Sean", "Tess"], all_names); - /// # Ok(()) - /// # } - /// ``` - /// - /// ### When used with a left join - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # use schema::{users, posts}; - /// # - /// # #[derive(Queryable, PartialEq, Eq, Debug)] - /// # struct User { - /// # id: i32, - /// # name: String, - /// # } - /// # - /// # impl User { - /// # fn new(id: i32, name: &str) -> Self { - /// # User { - /// # id, - /// # name: name.into(), - /// # } - /// # } - /// # } - /// # - /// # #[derive(Queryable, PartialEq, Eq, Debug)] - /// # struct Post { - /// # id: i32, - /// # user_id: i32, - /// # title: String, - /// # } - /// # - /// # impl Post { - /// # fn new(id: i32, user_id: i32, title: &str) -> Self { - /// # Post { - /// # id, - /// # user_id, - /// # title: title.into(), - /// # } - /// # } - /// # } - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # let connection = establish_connection(); - /// # connection.execute("DELETE FROM posts")?; - /// # diesel::insert_into(posts::table) - /// # .values((posts::user_id.eq(1), posts::title.eq("Sean's Post"))) - /// # .execute(&connection)?; - /// # let post_id = posts::table.select(posts::id) - /// # .first::(&connection)?; - /// let join = users::table.left_join(posts::table); - /// - /// // By default, all columns from both tables are selected - /// let all_data = join.load::<(User, Option)>(&connection)?; - /// let expected_data = vec![ - /// (User::new(1, "Sean"), Some(Post::new(post_id, 1, "Sean's Post"))), - /// (User::new(2, "Tess"), None), - /// ]; - /// assert_eq!(expected_data, all_data); - /// - /// // Since `posts` is on the right side of a left join, `.nullable` is - /// // needed. - /// let names_and_titles = join.select((users::name, posts::title.nullable())) - /// .load::<(String, Option)>(&connection)?; - /// let expected_data = vec![ - /// (String::from("Sean"), Some(String::from("Sean's Post"))), - /// (String::from("Tess"), None), - /// ]; - /// assert_eq!(expected_data, names_and_titles); - /// # Ok(()) - /// # } - /// ``` - fn select(self, selection: Selection) -> Select - where - Selection: Expression, - Self: methods::SelectDsl, - { - methods::SelectDsl::select(self, selection) - } - - /// Get the count of a query. This is equivalent to `.select(count_star())` - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// let count = users.count().get_result(&connection); - /// assert_eq!(Ok(2), count); - /// # } - /// ``` - fn count(self) -> Select - where - Self: methods::SelectDsl, - { - use dsl::count_star; - - QueryDsl::select(self, count_star()) - } - - /// Join two tables using a SQL `INNER JOIN`. - /// - /// If you have invoked [`joinable!`] for the two tables, you can pass that - /// table directly. Otherwise you will need to use [`.on`] to specify the `ON` - /// clause. - /// - /// [`joinable!`]: ../macro.joinable.html - /// [`.on`]: trait.JoinOnDsl.html#method.on - /// - /// You can join to as many tables as you'd like in a query, with the - /// restriction that no table can appear in the query more than once. The reason - /// for this restriction is that one of the appearances would require aliasing, - /// and we do not currently have a fleshed out story for dealing with table - /// aliases. - /// - /// You will also need to call [`allow_tables_to_appear_in_same_query!`]. - /// If you are using `infer_schema!` or `diesel print-schema`, this will - /// have been generated for you. - /// See the documentation for [`allow_tables_to_appear_in_same_query!`] for - /// details. - /// - /// Diesel expects multi-table joins to be semantically grouped based on the - /// relationships. For example, `users.inner_join(posts.inner_join(comments))` - /// is not the same as `users.inner_join(posts).inner_join(comments)`. The first - /// would deserialize into `(User, (Post, Comment))` and generate the following - /// SQL: - /// - /// ```sql - /// SELECT * FROM users - /// INNER JOIN posts ON posts.user_id = users.id - /// INNER JOIN comments ON comments.post_id = posts.id - /// ``` - /// - /// While the second query would deserialize into `(User, Post, Comment)` and - /// generate the following SQL: - /// - /// ```sql - /// SELECT * FROM users - /// INNER JOIN posts ON posts.user_id = users.id - /// INNER JOIN comments ON comments.user_id = users.id - /// ``` - /// - /// [associations]: ../associations/index.html - /// [`allow_tables_to_appear_in_same_query!`]: ../macro.allow_tables_to_appear_in_same_query.html - /// - /// # Examples - /// - /// ### With implicit `ON` clause - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # use schema::{users, posts}; - /// # /* - /// joinable!(posts -> users (user_id)); - /// allow_tables_to_appear_in_same_query!(users, posts); - /// # */ - /// - /// # fn main() { - /// # use self::users::dsl::{users, name}; - /// # use self::posts::dsl::{posts, user_id, title}; - /// # let connection = establish_connection(); - /// let data = users.inner_join(posts) - /// .select((name, title)) - /// .load(&connection); - /// - /// let expected_data = vec![ - /// (String::from("Sean"), String::from("My first post")), - /// (String::from("Sean"), String::from("About Rust")), - /// (String::from("Tess"), String::from("My first post too")), - /// ]; - /// assert_eq!(Ok(expected_data), data); - /// # } - /// ``` - /// - /// ### With explicit `ON` clause - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # use schema::{users, posts}; - /// # - /// # /* - /// allow_tables_to_appear_in_same_query!(users, posts); - /// # */ - /// - /// # fn main() { - /// # use self::users::dsl::{users, name}; - /// # use self::posts::dsl::{posts, user_id, title}; - /// # let connection = establish_connection(); - /// diesel::insert_into(posts) - /// .values(&vec![ - /// (user_id.eq(1), title.eq("Sean's post")), - /// (user_id.eq(2), title.eq("Sean is a jerk")), - /// ]) - /// .execute(&connection) - /// .unwrap(); - /// - /// let data = users - /// .inner_join(posts.on(title.like(name.concat("%")))) - /// .select((name, title)) - /// .load(&connection); - /// let expected_data = vec![ - /// (String::from("Sean"), String::from("Sean's post")), - /// (String::from("Sean"), String::from("Sean is a jerk")), - /// ]; - /// assert_eq!(Ok(expected_data), data); - /// # } - /// ``` - fn inner_join(self, rhs: Rhs) -> Self::Output - where - Self: JoinWithImplicitOnClause, - { - self.join_with_implicit_on_clause(rhs, joins::Inner) - } - - /// Join two tables using a SQL `LEFT OUTER JOIN`. - /// - /// Behaves similarly to [`inner_join`], but will produce a left join - /// instead. See [`inner_join`] for usage examples. - /// - /// [`inner_join`]: #method.inner_join - fn left_outer_join(self, rhs: Rhs) -> Self::Output - where - Self: JoinWithImplicitOnClause, - { - self.join_with_implicit_on_clause(rhs, joins::LeftOuter) - } - - /// Alias for [`left_outer_join`]. - /// - /// [`left_outer_join`]: #method.left_outer_join - fn left_join(self, rhs: Rhs) -> Self::Output - where - Self: JoinWithImplicitOnClause, - { - self.left_outer_join(rhs) - } - - /// Adds to the `WHERE` clause of a query. - /// - /// If there is already a `WHERE` clause, the result will be `old AND new`. - /// - /// # Example: - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// let seans_id = users.filter(name.eq("Sean")).select(id) - /// .first(&connection); - /// assert_eq!(Ok(1), seans_id); - /// let tess_id = users.filter(name.eq("Tess")).select(id) - /// .first(&connection); - /// assert_eq!(Ok(2), tess_id); - /// # } - /// ``` - fn filter(self, predicate: Predicate) -> Filter - where - Self: methods::FilterDsl, - { - methods::FilterDsl::filter(self, predicate) - } - - /// Adds to the `WHERE` clause of a query using `OR` - /// - /// If there is already a `WHERE` clause, the result will be `(old OR new)`. - /// Calling `foo.filter(bar).or_filter(baz)` - /// is identical to `foo.filter(bar.or(baz))`. - /// However, the second form is much harder to do dynamically. - /// - /// # Example: - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::animals::dsl::*; - /// # let connection = establish_connection(); - /// # diesel::delete(animals).execute(&connection)?; - /// diesel::insert_into(animals) - /// .values(&vec![ - /// (species.eq("cat"), legs.eq(4), name.eq("Sinatra")), - /// (species.eq("dog"), legs.eq(3), name.eq("Fido")), - /// (species.eq("spider"), legs.eq(8), name.eq("Charlotte")), - /// ]) - /// .execute(&connection)?; - /// - /// let good_animals = animals - /// .filter(name.eq("Fido")) - /// .or_filter(legs.eq(4)) - /// .select(name) - /// .get_results::>(&connection)?; - /// let expected = vec![ - /// Some(String::from("Sinatra")), - /// Some(String::from("Fido")), - /// ]; - /// assert_eq!(expected, good_animals); - /// # Ok(()) - /// # } - /// ``` - fn or_filter(self, predicate: Predicate) -> OrFilter - where - Self: methods::OrFilterDsl, - { - methods::OrFilterDsl::or_filter(self, predicate) - } - - /// Attempts to find a single record from the given table by primary key. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # use schema::users::dsl::*; - /// # use diesel::result::Error::NotFound; - /// # let connection = establish_connection(); - /// let sean = (1, "Sean".to_string()); - /// let tess = (2, "Tess".to_string()); - /// assert_eq!(Ok(sean), users.find(1).first(&connection)); - /// assert_eq!(Ok(tess), users.find(2).first(&connection)); - /// assert_eq!(Err::<(i32, String), _>(NotFound), users.find(3).first(&connection)); - /// # } - /// ``` - fn find(self, id: PK) -> Find - where - Self: methods::FindDsl, - { - methods::FindDsl::find(self, id) - } - - /// Sets the order clause of a query. - /// - /// If there was already a order clause, it will be overridden. See - /// also: - /// [`.desc()`](../expression_methods/trait.ExpressionMethods.html#method.desc) - /// and - /// [`.asc()`](../expression_methods/trait.ExpressionMethods.html#method.asc) - /// - /// Ordering by multiple columns can be achieved by passing a tuple of those - /// columns. - /// To construct an order clause of an unknown number of columns, - /// see [`QueryDsl::then_order_by`](#method.then_order_by) - /// - /// # Examples - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// # connection.execute("DELETE FROM users")?; - /// diesel::insert_into(users) - /// .values(&vec![ - /// name.eq("Saul"), - /// name.eq("Steve"), - /// name.eq("Stan"), - /// ]) - /// .execute(&connection)?; - /// - /// let ordered_names = users.select(name) - /// .order(name.desc()) - /// .load::(&connection)?; - /// assert_eq!(vec!["Steve", "Stan", "Saul"], ordered_names); - /// - /// diesel::insert_into(users).values(name.eq("Stan")).execute(&connection)?; - /// - /// let data = users.select((name, id)) - /// .order((name.asc(), id.desc())) - /// .load(&connection)?; - /// let expected_data = vec![ - /// (String::from("Saul"), 3), - /// (String::from("Stan"), 6), - /// (String::from("Stan"), 5), - /// (String::from("Steve"), 4), - /// ]; - /// assert_eq!(expected_data, data); - /// # Ok(()) - /// # } - /// ``` - fn order(self, expr: Expr) -> Order - where - Expr: Expression, - Self: methods::OrderDsl, - { - methods::OrderDsl::order(self, expr) - } - - /// Alias for `order` - fn order_by(self, expr: Expr) -> Order - where - Expr: Expression, - Self: methods::OrderDsl, - { - QueryDsl::order(self, expr) - } - - /// Appends to the `ORDER BY` clause of this SQL query. - /// - /// Unlike `.order`, this method will append rather than replace. - /// In other words, - /// `.order_by(foo).order_by(bar)` is equivalent to `.order_by(bar)`. - /// In contrast, - /// `.order_by(foo).then_order_by(bar)` is equivalent to `.order((foo, bar))`. - /// This method is only present on boxed queries. - /// - /// # Examples - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// # connection.execute("DELETE FROM users")?; - /// diesel::insert_into(users) - /// .values(&vec![ - /// name.eq("Saul"), - /// name.eq("Steve"), - /// name.eq("Stan"), - /// name.eq("Stan"), - /// ]) - /// .execute(&connection)?; - /// - /// let data = users.select((name, id)) - /// .order_by(name.asc()) - /// .then_order_by(id.desc()) - /// .load(&connection)?; - /// let expected_data = vec![ - /// (String::from("Saul"), 3), - /// (String::from("Stan"), 6), - /// (String::from("Stan"), 5), - /// (String::from("Steve"), 4), - /// ]; - /// assert_eq!(expected_data, data); - /// # Ok(()) - /// # } - /// ``` - fn then_order_by(self, order: Order) -> ThenOrderBy - where - Self: methods::ThenOrderDsl, - { - methods::ThenOrderDsl::then_order_by(self, order) - } - - /// Sets the limit clause of the query. - /// - /// If there was already a limit clause, it will be overridden. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # use schema::users; - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use users::dsl::*; - /// # let connection = establish_connection(); - /// # diesel::delete(users).execute(&connection)?; - /// # diesel::insert_into(users) - /// # .values(&vec![ - /// # name.eq("Sean"), - /// # name.eq("Bastien"), - /// # name.eq("Pascal"), - /// # ]) - /// # .execute(&connection)?; - /// # - /// // Using a limit - /// let limited = users.select(name) - /// .order(id) - /// .limit(1) - /// .load::(&connection)?; - /// - /// // Without a limit - /// let no_limit = users.select(name) - /// .order(id) - /// .load::(&connection)?; - /// - /// assert_eq!(vec!["Sean"], limited); - /// assert_eq!(vec!["Sean", "Bastien", "Pascal"], no_limit); - /// # Ok(()) - /// # } - /// ``` - fn limit(self, limit: i64) -> Limit - where - Self: methods::LimitDsl, - { - methods::LimitDsl::limit(self, limit) - } - - /// Sets the offset clause of the query. - /// - /// If there was already a offset clause, it will be overridden. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # use schema::users; - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use users::dsl::*; - /// # let connection = establish_connection(); - /// # diesel::delete(users).execute(&connection)?; - /// # diesel::insert_into(users) - /// # .values(&vec![ - /// # name.eq("Sean"), - /// # name.eq("Bastien"), - /// # name.eq("Pascal"), - /// # ]) - /// # .execute(&connection)?; - /// # - /// // Using an offset - /// let offset = users.select(name) - /// .order(id) - /// .limit(2) - /// .offset(1) - /// .load::(&connection)?; - /// - /// // No Offset - /// let no_offset = users.select(name) - /// .order(id) - /// .limit(2) - /// .load::(&connection)?; - /// - /// assert_eq!(vec!["Bastien", "Pascal"], offset); - /// assert_eq!(vec!["Sean", "Bastien"], no_offset); - /// # Ok(()) - /// # } - /// ``` - fn offset(self, offset: i64) -> Offset - where - Self: methods::OffsetDsl, - { - methods::OffsetDsl::offset(self, offset) - } - - /// Adds `FOR UPDATE` to the end of the select statement. - /// - /// This method is only available for MySQL and PostgreSQL. SQLite does not - /// provide any form of row locking. - /// - /// Additionally, `.for_update` cannot be used on queries with a distinct - /// clause, group by clause, having clause, or any unions. Queries with - /// a `FOR UPDATE` clause cannot be boxed. - /// - /// # Example - /// - /// ```ignore - /// // Executes `SELECT * FROM users FOR UPDATE` - /// users.for_update().load(&connection) - /// ``` - #[cfg(feature = "with-deprecated")] - #[allow(deprecated)] - fn for_update(self) -> ForUpdate - where - Self: methods::ForUpdateDsl, - { - methods::ForUpdateDsl::for_update(self) - } - - /// Adds `FOR UPDATE` to the end of the select statement. - /// - /// This method is only available for MySQL and PostgreSQL. SQLite does not - /// provide any form of row locking. - /// - /// Additionally, `.for_update` cannot be used on queries with a distinct - /// clause, group by clause, having clause, or any unions. Queries with - /// a `FOR UPDATE` clause cannot be boxed. - /// - /// # Example - /// - /// ```ignore - /// // Executes `SELECT * FROM users FOR UPDATE` - /// users.for_update().load(&connection) - /// ``` - #[cfg(not(feature = "with-deprecated"))] - fn for_update(self) -> ForUpdate - where - Self: methods::LockingDsl, - { - methods::LockingDsl::with_lock(self, lock::ForUpdate) - } - - /// Adds `FOR NO KEY UPDATE` to the end of the select statement. - /// - /// This method is only available for PostgreSQL. SQLite does not - /// provide any form of row locking, and MySQL does not support anything - /// finer than row-level locking. - /// - /// Additionally, `.for_no_key_update` cannot be used on queries with a distinct - /// clause, group by clause, having clause, or any unions. Queries with - /// a `FOR NO KEY UPDATE` clause cannot be boxed. - /// - /// # Example - /// - /// ```ignore - /// // Executes `SELECT * FROM users FOR NO KEY UPDATE` - /// users.for_no_key_update().load(&connection) - /// ``` - fn for_no_key_update(self) -> ForNoKeyUpdate - where - Self: methods::LockingDsl, - { - methods::LockingDsl::with_lock(self, lock::ForNoKeyUpdate) - } - - /// Adds `FOR SHARE` to the end of the select statement. - /// - /// This method is only available for MySQL and PostgreSQL. SQLite does not - /// provide any form of row locking. - /// - /// Additionally, `.for_share` cannot be used on queries with a distinct - /// clause, group by clause, having clause, or any unions. Queries with - /// a `FOR SHARE` clause cannot be boxed. - /// - /// # Example - /// - /// ```ignore - /// // Executes `SELECT * FROM users FOR SHARE` - /// users.for_share().load(&connection) - /// ``` - fn for_share(self) -> ForShare - where - Self: methods::LockingDsl, - { - methods::LockingDsl::with_lock(self, lock::ForShare) - } - - /// Adds `FOR KEY SHARE` to the end of the select statement. - /// - /// This method is only available for PostgreSQL. SQLite does not - /// provide any form of row locking, and MySQL does not support anything - /// finer than row-level locking. - /// - /// Additionally, `.for_key_share` cannot be used on queries with a distinct - /// clause, group by clause, having clause, or any unions. Queries with - /// a `FOR KEY SHARE` clause cannot be boxed. - /// - /// # Example - /// - /// ```ignore - /// // Executes `SELECT * FROM users FOR KEY SHARE` - /// users.for_key_share().load(&connection) - /// ``` - fn for_key_share(self) -> ForKeyShare - where - Self: methods::LockingDsl, - { - methods::LockingDsl::with_lock(self, lock::ForKeyShare) - } - - /// Adds `SKIP LOCKED` to the end of a `FOR UPDATE` clause. - /// - /// This modifier is only supported in PostgreSQL 9.5+ and MySQL 8+. - /// - /// # Example - /// - /// ```ignore - /// // Executes `SELECT * FROM users FOR UPDATE SKIP LOCKED` - /// users.for_update().skip_locked().load(&connection) - /// ``` - fn skip_locked(self) -> SkipLocked - where - Self: methods::ModifyLockDsl, - { - methods::ModifyLockDsl::modify_lock(self, lock::SkipLocked) - } - - /// Adds `NOWAIT` to the end of a `FOR UPDATE` clause. - /// - /// This modifier is only supported in PostgreSQL 9.5+ and MySQL 8+. - /// - /// # Example - /// - /// ```ignore - /// // Executes `SELECT * FROM users FOR UPDATE NOWAIT` - /// users.for_update().no_wait().load(&connection) - /// ``` - fn no_wait(self) -> NoWait - where - Self: methods::ModifyLockDsl, - { - methods::ModifyLockDsl::modify_lock(self, lock::NoWait) - } - - /// Boxes the pieces of a query into a single type. - /// - /// This is useful for cases where you want to conditionally modify a query, - /// but need the type to remain the same. The backend must be specified as - /// part of this. It is not possible to box a query and have it be useable - /// on multiple backends. - /// - /// A boxed query will incur a minor performance penalty, as the query builder - /// can no longer be inlined by the compiler. For most applications this cost - /// will be minimal. - /// - /// ### Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # use schema::users; - /// # - /// # fn main() { - /// # use std::collections::HashMap; - /// # let connection = establish_connection(); - /// # let mut params = HashMap::new(); - /// # params.insert("name", "Sean"); - /// let mut query = users::table.into_boxed(); - /// if let Some(name) = params.get("name") { - /// query = query.filter(users::name.eq(name)); - /// } - /// let users = query.load(&connection); - /// # let expected = vec![(1, String::from("Sean"))]; - /// # assert_eq!(Ok(expected), users); - /// # } - /// ``` - /// - /// Diesel queries also have a similar problem to [`Iterator`][iterator], where - /// returning them from a function requires exposing the implementation of that - /// function. The [`helper_types`][helper_types] module exists to help with this, - /// but you might want to hide the return type or have it conditionally change. - /// Boxing can achieve both. - /// - /// [iterator]: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html - /// [helper_types]: ../helper_types/index.html - /// - /// ### Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # use schema::users; - /// # - /// # fn main() { - /// # let connection = establish_connection(); - /// fn users_by_name<'a>(name: &'a str) -> users::BoxedQuery<'a, DB> { - /// users::table.filter(users::name.eq(name)).into_boxed() - /// } - /// - /// assert_eq!(Ok(1), users_by_name("Sean").select(users::id).first(&connection)); - /// assert_eq!(Ok(2), users_by_name("Tess").select(users::id).first(&connection)); - /// # } - /// ``` - fn into_boxed<'a, DB>(self) -> IntoBoxed<'a, Self, DB> - where - DB: Backend, - Self: methods::BoxedDsl<'a, DB>, - { - methods::BoxedDsl::internal_into_boxed(self) - } - - /// Wraps this select statement in parenthesis, allowing it to be used - /// as an expression. - /// - /// SQL allows queries such as `foo = (SELECT ...)`, as long as the - /// subselect returns only a single column, and 0 or 1 rows. This method - /// indicates that you expect the query to only return a single value (this - /// will be enforced by adding `LIMIT 1`). - /// - /// The SQL type of this will always be `Nullable`, as the query returns - /// `NULL` if the table is empty or it otherwise returns 0 rows. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use diesel::insert_into; - /// # use schema::users::dsl::*; - /// # use schema::posts; - /// # let connection = establish_connection(); - /// insert_into(posts::table) - /// .values(posts::user_id.eq(1)) - /// .execute(&connection)?; - /// let last_post = posts::table - /// .order(posts::id.desc()); - /// let most_recently_active_user = users.select(name) - /// .filter(id.nullable().eq(last_post.select(posts::user_id).single_value())) - /// .first::(&connection)?; - /// assert_eq!("Sean", most_recently_active_user); - /// # Ok(()) - /// # } - /// ``` - fn single_value(self) -> SingleValue - where - Self: methods::SingleValueDsl, - { - methods::SingleValueDsl::single_value(self) - } - - /// Coerce the SQL type of the select clause to it's nullable equivalent. - /// - /// This is use full for writing queries that contain subselects on non null - /// fields comparing them to nullable fields. - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # let connection = establish_connection(); - /// table! { - /// users { - /// id -> Integer, - /// name -> Text, - /// } - /// } - /// - /// table! { - /// posts { - /// id -> Integer, - /// by_user -> Nullable, - /// } - /// } - /// - /// # let _: Vec<(i32, Option)> = - /// posts::table.filter( - /// posts::by_user.eq_any(users::table.select(users::name).nullable()) - /// ).load(&connection)?; - /// # Ok(()) - /// # } - fn nullable(self) -> NullableSelect - where - Self: methods::SelectNullableDsl, - { - methods::SelectNullableDsl::nullable(self) - } -} - -impl QueryDsl for T {} - -/// Methods used to execute queries. -pub trait RunQueryDsl: Sized { - /// Executes the given command, returning the number of rows affected. - /// - /// `execute` is usually used in conjunction with [`insert_into`](../fn.insert_into.html), - /// [`update`](../fn.update.html) and [`delete`](../fn.delete.html) where the number of - /// affected rows is often enough information. - /// - /// When asking the database to return data from a query, [`load`](#method.load) should - /// probably be used instead. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use diesel::insert_into; - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// let inserted_rows = insert_into(users) - /// .values(name.eq("Ruby")) - /// .execute(&connection)?; - /// assert_eq!(1, inserted_rows); - /// - /// let inserted_rows = insert_into(users) - /// .values(&vec![name.eq("Jim"), name.eq("James")]) - /// .execute(&connection)?; - /// assert_eq!(2, inserted_rows); - /// # Ok(()) - /// # } - /// ``` - fn execute(self, conn: &Conn) -> QueryResult - where - Conn: Connection, - Self: methods::ExecuteDsl, - { - methods::ExecuteDsl::execute(self, conn) - } - - /// Executes the given query, returning a `Vec` with the returned rows. - /// - /// When using the query builder, - /// the return type can be - /// a tuple of the values, - /// or a struct which implements [`Queryable`]. - /// - /// When this method is called on [`sql_query`], - /// the return type can only be a struct which implements [`QueryableByName`] - /// - /// For insert, update, and delete operations where only a count of affected is needed, - /// [`execute`] should be used instead. - /// - /// [`Queryable`]: ../deserialize/trait.Queryable.html - /// [`QueryableByName`]: ../deserialize/trait.QueryableByName.html - /// [`execute`]: fn.execute.html - /// [`sql_query`]: ../fn.sql_query.html - /// - /// # Examples - /// - /// ## Returning a single field - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use diesel::insert_into; - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// let data = users.select(name) - /// .load::(&connection)?; - /// assert_eq!(vec!["Sean", "Tess"], data); - /// # Ok(()) - /// # } - /// ``` - /// - /// ## Returning a tuple - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use diesel::insert_into; - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// let data = users - /// .load::<(i32, String)>(&connection)?; - /// let expected_data = vec![ - /// (1, String::from("Sean")), - /// (2, String::from("Tess")), - /// ]; - /// assert_eq!(expected_data, data); - /// # Ok(()) - /// # } - /// ``` - /// - /// ## Returning a struct - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// #[derive(Queryable, PartialEq, Debug)] - /// struct User { - /// id: i32, - /// name: String, - /// } - /// - /// # fn main() { - /// # run_test(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use diesel::insert_into; - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// let data = users - /// .load::(&connection)?; - /// let expected_data = vec![ - /// User { id: 1, name: String::from("Sean"), }, - /// User { id: 2, name: String::from("Tess"), }, - /// ]; - /// assert_eq!(expected_data, data); - /// # Ok(()) - /// # } - /// ``` - fn load(self, conn: &Conn) -> QueryResult> - where - Self: LoadQuery, - { - self.internal_load(conn) - } - - /// Runs the command, and returns the affected row. - /// - /// `Err(NotFound)` will be returned if the query affected 0 rows. You can - /// call `.optional()` on the result of this if the command was optional to - /// get back a `Result>` - /// - /// When this method is called on an insert, update, or delete statement, - /// it will implicitly add a `RETURNING *` to the query, - /// unless a returning clause was already specified. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test(); - /// # } - /// # - /// # #[cfg(feature = "postgres")] - /// # fn run_test() -> QueryResult<()> { - /// # use diesel::{insert_into, update}; - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// let inserted_row = insert_into(users) - /// .values(name.eq("Ruby")) - /// .get_result(&connection)?; - /// assert_eq!((3, String::from("Ruby")), inserted_row); - /// - /// // This will return `NotFound`, as there is no user with ID 4 - /// let update_result = update(users.find(4)) - /// .set(name.eq("Jim")) - /// .get_result::<(i32, String)>(&connection); - /// assert_eq!(Err(diesel::NotFound), update_result); - /// # Ok(()) - /// # } - /// # - /// # #[cfg(not(feature = "postgres"))] - /// # fn run_test() -> QueryResult<()> { - /// # Ok(()) - /// # } - /// ``` - fn get_result(self, conn: &Conn) -> QueryResult - where - Self: LoadQuery, - { - first_or_not_found(self.load(conn)) - } - - /// Runs the command, returning an `Vec` with the affected rows. - /// - /// This method is an alias for [`load`], but with a name that makes more - /// sense for insert, update, and delete statements. - /// - /// [`load`]: #method.load - fn get_results(self, conn: &Conn) -> QueryResult> - where - Self: LoadQuery, - { - self.load(conn) - } - - /// Attempts to load a single record. - /// - /// This method is equivalent to `.limit(1).get_result()` - /// - /// Returns `Ok(record)` if found, and `Err(NotFound)` if no results are - /// returned. If the query truly is optional, you can call `.optional()` on - /// the result of this to get a `Result>`. - /// - /// # Example: - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../doctest_setup.rs"); - /// # fn main() { - /// # run_test(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # use schema::users::dsl::*; - /// # let connection = establish_connection(); - /// diesel::insert_into(users) - /// .values(&vec![name.eq("Sean"), name.eq("Pascal")]) - /// .execute(&connection)?; - /// - /// let first_name = users.order(id).select(name).first(&connection); - /// assert_eq!(Ok(String::from("Sean")), first_name); - /// - /// let not_found = users - /// .filter(name.eq("Foo")) - /// .first::<(i32, String)>(&connection); - /// assert_eq!(Err(diesel::NotFound), not_found); - /// # Ok(()) - /// # } - /// ``` - fn first(self, conn: &Conn) -> QueryResult - where - Self: methods::LimitDsl, - Limit: LoadQuery, - { - methods::LimitDsl::limit(self, 1).get_result(conn) - } -} - -// Note: We could have a blanket `AsQuery` impl here, which would apply to -// everything we want it to. However, when a query is invalid, we specifically -// want the error to happen on the where clause of the method instead of trait -// resolution. Otherwise our users will get an error saying `<3 page long type>: -// ExecuteDsl is not satisfied` instead of a specific error telling them what -// part of their query is wrong. -impl RunQueryDsl for T where T: Table {} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/nullable_select_dsl.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/nullable_select_dsl.rs deleted file mode 100644 index be8e4d413..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/nullable_select_dsl.rs +++ /dev/null @@ -1,14 +0,0 @@ -/// The `nullable` method -/// -/// This trait should not be relied on directly by most apps. Its behavior is -/// provided by [`QueryDsl`]. However you may need a where clause on this trait -/// to call `nullable` from generic code. -/// -/// [`QueryDsl`]: ../trait.QueryDsl.html#method.nullable -pub trait SelectNullableDsl { - /// The return type of `nullable` - type Output; - - /// See the trait documentation - fn nullable(self) -> Self::Output; -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/offset_dsl.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/offset_dsl.rs deleted file mode 100644 index 4998be844..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/offset_dsl.rs +++ /dev/null @@ -1,28 +0,0 @@ -use query_source::Table; - -/// The `offset` method -/// -/// This trait should not be relied on directly by most apps. Its behavior is -/// provided by [`QueryDsl`]. However, you may need a where clause on this trait -/// to call `offset` from generic code. -/// -/// [`QueryDsl`]: ../trait.QueryDsl.html -pub trait OffsetDsl { - /// The type returned by `.offset`. - type Output; - - /// See the trait documentation - fn offset(self, offset: i64) -> Self::Output; -} - -impl OffsetDsl for T -where - T: Table, - T::Query: OffsetDsl, -{ - type Output = ::Output; - - fn offset(self, offset: i64) -> Self::Output { - self.as_query().offset(offset) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/order_dsl.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/order_dsl.rs deleted file mode 100644 index 439a859bf..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/order_dsl.rs +++ /dev/null @@ -1,58 +0,0 @@ -use expression::Expression; -use query_source::Table; - -/// The `order` method -/// -/// This trait should not be relied on directly by most apps. Its behavior is -/// provided by [`QueryDsl`]. However, you may need a where clause on this trait -/// to call `order` from generic code. -/// -/// [`QueryDsl`]: ../trait.QueryDsl.html -pub trait OrderDsl { - /// The type returned by `.order`. - type Output; - - /// See the trait documentation. - fn order(self, expr: Expr) -> Self::Output; -} - -impl OrderDsl for T -where - Expr: Expression, - T: Table, - T::Query: OrderDsl, -{ - type Output = >::Output; - - fn order(self, expr: Expr) -> Self::Output { - self.as_query().order(expr) - } -} - -/// The `then_order_by` method -/// -/// This trait should not be relied on directly by most apps. Its behavior is -/// provided by [`QueryDsl`]. However, you may need a where clause on this trait -/// to call `then_order_by` from generic code. -/// -/// [`QueryDsl`]: ../trait.QueryDsl.html -pub trait ThenOrderDsl { - /// The type returned by `.then_order_by`. - type Output; - - /// See the trait documentation. - fn then_order_by(self, expr: Expr) -> Self::Output; -} - -impl ThenOrderDsl for T -where - Expr: Expression, - T: Table, - T::Query: ThenOrderDsl, -{ - type Output = >::Output; - - fn then_order_by(self, expr: Expr) -> Self::Output { - self.as_query().then_order_by(expr) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/save_changes_dsl.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/save_changes_dsl.rs deleted file mode 100644 index 4e3248009..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/save_changes_dsl.rs +++ /dev/null @@ -1,143 +0,0 @@ -use associations::HasTable; -#[cfg(any(feature = "sqlite", feature = "mysql"))] -use associations::Identifiable; -use connection::Connection; -#[cfg(any(feature = "sqlite", feature = "mysql"))] -use dsl::Find; -#[cfg(any(feature = "sqlite", feature = "postgres", feature = "mysql"))] -use dsl::Update; -use query_builder::{AsChangeset, IntoUpdateTarget}; -#[cfg(any(feature = "sqlite", feature = "mysql"))] -use query_dsl::methods::{ExecuteDsl, FindDsl}; -#[cfg(any(feature = "sqlite", feature = "postgres", feature = "mysql"))] -use query_dsl::{LoadQuery, RunQueryDsl}; -use result::QueryResult; - -/// A trait defining how to update a record and fetch the updated entry -/// on a certain backend. -/// -/// The only case where it is required to work with this trait is while -/// implementing a new connection type. -/// Otherwise use [`SaveChangesDsl`](trait.SaveChangesDsl.html) -/// -/// For implementing this trait for a custom backend: -/// * The `Changes` generic parameter represents the changeset that should be stored -/// * The `Output` generic parameter represents the type of the response. -pub trait UpdateAndFetchResults: Connection { - /// See the traits documentation. - fn update_and_fetch(&self, changeset: Changes) -> QueryResult; -} - -#[cfg(feature = "postgres")] -use pg::PgConnection; - -#[cfg(feature = "postgres")] -impl UpdateAndFetchResults for PgConnection -where - Changes: Copy + AsChangeset::Table> + IntoUpdateTarget, - Update: LoadQuery, -{ - fn update_and_fetch(&self, changeset: Changes) -> QueryResult { - ::update(changeset).set(changeset).get_result(self) - } -} - -#[cfg(feature = "sqlite")] -use sqlite::SqliteConnection; - -#[cfg(feature = "sqlite")] -impl UpdateAndFetchResults for SqliteConnection -where - Changes: Copy + Identifiable, - Changes: AsChangeset::Table> + IntoUpdateTarget, - Changes::Table: FindDsl, - Update: ExecuteDsl, - Find: LoadQuery, -{ - fn update_and_fetch(&self, changeset: Changes) -> QueryResult { - ::update(changeset).set(changeset).execute(self)?; - Changes::table().find(changeset.id()).get_result(self) - } -} - -#[cfg(feature = "mysql")] -use mysql::MysqlConnection; - -#[cfg(feature = "mysql")] -impl UpdateAndFetchResults for MysqlConnection -where - Changes: Copy + Identifiable, - Changes: AsChangeset::Table> + IntoUpdateTarget, - Changes::Table: FindDsl, - Update: ExecuteDsl, - Find: LoadQuery, -{ - fn update_and_fetch(&self, changeset: Changes) -> QueryResult { - ::update(changeset).set(changeset).execute(self)?; - Changes::table().find(changeset.id()).get_result(self) - } -} - -/// Sugar for types which implement both `AsChangeset` and `Identifiable` -/// -/// On backends which support the `RETURNING` keyword, -/// `foo.save_changes(&conn)` is equivalent to -/// `update(&foo).set(&foo).get_result(&conn)`. -/// On other backends, two queries will be executed. -/// -/// # Example -/// -/// ```rust -/// # #[macro_use] extern crate diesel; -/// # include!("../doctest_setup.rs"); -/// # use schema::animals; -/// # -/// #[derive(Queryable, Debug, PartialEq)] -/// struct Animal { -/// id: i32, -/// species: String, -/// legs: i32, -/// name: Option, -/// } -/// -/// #[derive(AsChangeset, Identifiable)] -/// #[table_name = "animals"] -/// struct AnimalForm<'a> { -/// id: i32, -/// name: &'a str, -/// } -/// -/// # fn main() { -/// # run_test(); -/// # } -/// # -/// # fn run_test() -> QueryResult<()> { -/// # use animals::dsl::*; -/// # let connection = establish_connection(); -/// let form = AnimalForm { id: 2, name: "Super scary" }; -/// let changed_animal = form.save_changes(&connection)?; -/// let expected_animal = Animal { -/// id: 2, -/// species: String::from("spider"), -/// legs: 8, -/// name: Some(String::from("Super scary")), -/// }; -/// assert_eq!(expected_animal, changed_animal); -/// # Ok(()) -/// # } -/// ``` -pub trait SaveChangesDsl { - /// See the trait documentation. - fn save_changes(self, connection: &Conn) -> QueryResult - where - Self: Sized, - Conn: UpdateAndFetchResults, - { - connection.update_and_fetch(self) - } -} - -impl SaveChangesDsl for T where - T: Copy + AsChangeset::Table> + IntoUpdateTarget -{ -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/select_dsl.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/select_dsl.rs deleted file mode 100644 index e979daf99..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/select_dsl.rs +++ /dev/null @@ -1,33 +0,0 @@ -use expression::Expression; -use query_source::Table; - -/// The `select` method -/// -/// This trait should not be relied on directly by most apps. Its behavior is -/// provided by [`QueryDsl`]. However, you may need a where clause on this trait -/// to call `select` from generic code. -/// -/// [`QueryDsl`]: ../trait.QueryDsl.html -pub trait SelectDsl { - // FIXME: Once we've refactored the `impl Expression` on `SelectStatement` - // to not conditionally be `sql_types::Array`, it is probably worthwhile to - // add a `: Expression` bound here. - /// The type returned by `.select` - type Output; - - /// See the trait documentation - fn select(self, selection: Selection) -> Self::Output; -} - -impl SelectDsl for T -where - Selection: Expression, - T: Table, - T::Query: SelectDsl, -{ - type Output = >::Output; - - fn select(self, selection: Selection) -> Self::Output { - self.as_query().select(selection) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/single_value_dsl.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/single_value_dsl.rs deleted file mode 100644 index 635559bda..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_dsl/single_value_dsl.rs +++ /dev/null @@ -1,34 +0,0 @@ -use super::methods::LimitDsl; -use dsl::Limit; -use expression::grouped::Grouped; -use expression::subselect::Subselect; -use query_builder::SelectQuery; -use sql_types::{IntoNullable, SingleValue}; - -/// The `single_value` method -/// -/// This trait should not be relied on directly by most apps. Its behavior is -/// provided by [`QueryDsl`]. However, you may need a where clause on this trait -/// to call `single_value` from generic code. -/// -/// [`QueryDsl`]: ../trait.QueryDsl.html -pub trait SingleValueDsl { - /// The type returned by `.single_value`. - type Output; - - /// See the trait documentation. - fn single_value(self) -> Self::Output; -} - -impl SingleValueDsl for T -where - Self: SelectQuery + LimitDsl, - ST: IntoNullable, - ST::Nullable: SingleValue, -{ - type Output = Grouped, ST::Nullable>>; - - fn single_value(self) -> Self::Output { - Grouped(Subselect::new(self.limit(1))) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_source/joins.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_source/joins.rs deleted file mode 100644 index 728a91a35..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_source/joins.rs +++ /dev/null @@ -1,302 +0,0 @@ -use super::{AppearsInFromClause, Plus, QuerySource}; -use backend::Backend; -use expression::grouped::Grouped; -use expression::nullable::Nullable; -use expression::SelectableExpression; -use prelude::*; -use query_builder::*; -use result::QueryResult; -use sql_types::Bool; -use util::TupleAppend; - -#[derive(Debug, Clone, Copy, QueryId)] -/// A query source representing the join between two tables -pub struct Join { - left: Left, - right: Right, - kind: Kind, -} - -#[derive(Debug, Clone, Copy, QueryId)] -#[doc(hidden)] -/// A query source representing the join between two tables with an explicit -/// `ON` given. `Join` should usually be referenced instead, as all "type -/// safety" traits are implemented in terms of `Join` implementing them. -pub struct JoinOn { - join: Join, - on: On, -} - -impl Join { - pub fn new(left: Left, right: Right, kind: Kind) -> Self { - Join { - left: left, - right: right, - kind: kind, - } - } - - #[doc(hidden)] - pub fn on(self, on: On) -> JoinOn { - JoinOn { join: self, on: on } - } -} - -impl QuerySource for Join -where - Left: QuerySource + AppendSelection, - Right: QuerySource, - Left::Output: SelectableExpression, - Self: Clone, -{ - type FromClause = Self; - type DefaultSelection = Left::Output; - - fn from_clause(&self) -> Self::FromClause { - self.clone() - } - - fn default_selection(&self) -> Self::DefaultSelection { - self.left.append_selection(self.right.default_selection()) - } -} - -impl QuerySource for Join -where - Left: QuerySource + AppendSelection>, - Right: QuerySource, - Left::Output: SelectableExpression, - Self: Clone, -{ - type FromClause = Self; - type DefaultSelection = Left::Output; - - fn from_clause(&self) -> Self::FromClause { - self.clone() - } - - fn default_selection(&self) -> Self::DefaultSelection { - self.left - .append_selection(self.right.default_selection().nullable()) - } -} - -impl QuerySource for JoinOn -where - Join: QuerySource, - On: AppearsOnTable + Clone, - Join::DefaultSelection: SelectableExpression, -{ - type FromClause = Grouped>; - type DefaultSelection = Join::DefaultSelection; - - fn from_clause(&self) -> Self::FromClause { - Grouped(nodes::InfixNode::new( - self.join.from_clause(), - self.on.clone(), - " ON ", - )) - } - - fn default_selection(&self) -> Self::DefaultSelection { - self.join.default_selection() - } -} - -impl QueryFragment for Join -where - DB: Backend, - Left: QuerySource, - Left::FromClause: QueryFragment, - Right: QuerySource, - Right::FromClause: QueryFragment, - Kind: QueryFragment, -{ - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - self.left.from_clause().walk_ast(out.reborrow())?; - self.kind.walk_ast(out.reborrow())?; - out.push_sql(" JOIN "); - self.right.from_clause().walk_ast(out.reborrow())?; - Ok(()) - } -} - -impl SelectableExpression> for Nullable -where - T: SelectableExpression>, - Nullable: AppearsOnTable>, -{ -} - -// FIXME: Remove this when overlapping marker traits are stable -impl SelectableExpression> for Nullable -where - Nullable: SelectableExpression, - Nullable: AppearsOnTable>, -{ -} - -// FIXME: Remove this when overlapping marker traits are stable -impl SelectableExpression> for Nullable -where - Nullable: SelectableExpression, - Nullable: AppearsOnTable>, -{ -} - -// FIXME: We want these blanket impls when overlapping marker traits are stable -// impl SelectableExpression> for T where -// T: SelectableExpression + AppearsOnTable>, -// { -// } - -/// Indicates that two tables can be joined without an explicit `ON` clause. -/// -/// Implementations of this trait are generated by invoking [`joinable!`]. -/// Implementing this trait means that you can call -/// `left_table.inner_join(right_table)`, without supplying the `ON` clause -/// explicitly. To join two tables which do not implement this trait, you will -/// need to call [`.on`]. -/// -/// See [`joinable!`] and [`inner_join`] for usage examples. -/// -/// [`joinable!`]: ../macro.joinable.html -/// [`.on`]: ../query_dsl/trait.JoinOnDsl.html#method.on -/// [`inner_join`]: ../query_dsl/trait.QueryDsl.html#method.inner_join -pub trait JoinTo { - #[doc(hidden)] - type FromClause; - #[doc(hidden)] - type OnClause; - #[doc(hidden)] - fn join_target(rhs: T) -> (Self::FromClause, Self::OnClause); -} - -#[doc(hidden)] -/// Used to ensure the sql type of `left.join(mid).join(right)` is -/// `(Left, Mid, Right)` and not `((Left, Mid), Right)`. This needs -/// to be separate from `TupleAppend` because we still want to keep -/// the column lists (which are tuples) separate. -pub trait AppendSelection { - type Output; - - fn append_selection(&self, selection: Selection) -> Self::Output; -} - -impl AppendSelection for T { - type Output = (T::AllColumns, Selection); - - fn append_selection(&self, selection: Selection) -> Self::Output { - (T::all_columns(), selection) - } -} - -impl AppendSelection for Join -where - Self: QuerySource, - ::DefaultSelection: TupleAppend, -{ - type Output = <::DefaultSelection as TupleAppend>::Output; - - fn append_selection(&self, selection: Selection) -> Self::Output { - self.default_selection().tuple_append(selection) - } -} - -impl AppendSelection for JoinOn -where - Join: AppendSelection, -{ - type Output = Join::Output; - - fn append_selection(&self, selection: Selection) -> Self::Output { - self.join.append_selection(selection) - } -} - -#[doc(hidden)] -#[derive(Debug, Clone, Copy, Default, QueryId)] -pub struct Inner; - -impl QueryFragment for Inner { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql(" INNER"); - Ok(()) - } -} - -#[doc(hidden)] -#[derive(Debug, Clone, Copy, Default, QueryId)] -pub struct LeftOuter; - -impl QueryFragment for LeftOuter { - fn walk_ast(&self, mut out: AstPass) -> QueryResult<()> { - out.push_sql(" LEFT OUTER"); - Ok(()) - } -} - -impl JoinTo for Join -where - Left: JoinTo, -{ - type FromClause = Left::FromClause; - type OnClause = Left::OnClause; - - fn join_target(rhs: Right) -> (Self::FromClause, Self::OnClause) { - Left::join_target(rhs) - } -} - -impl JoinTo for JoinOn -where - Join: JoinTo, -{ - type FromClause = Join::FromClause; - type OnClause = Join::OnClause; - - fn join_target(rhs: Right) -> (Self::FromClause, Self::OnClause) { - Join::join_target(rhs) - } -} - -impl AppearsInFromClause for Join -where - Left: AppearsInFromClause, - Right: AppearsInFromClause, - Left::Count: Plus, -{ - type Count = >::Output; -} - -impl AppearsInFromClause for JoinOn -where - Join: AppearsInFromClause, -{ - type Count = Join::Count; -} - -#[doc(hidden)] -#[derive(Debug, Clone, Copy)] -pub struct OnClauseWrapper { - source: Source, - on: On, -} - -impl OnClauseWrapper { - pub fn new(source: Source, on: On) -> Self { - OnClauseWrapper { source, on } - } -} - -impl JoinTo> for Lhs -where - Lhs: Table, -{ - type FromClause = Rhs; - type OnClause = On; - - fn join_target(rhs: OnClauseWrapper) -> (Self::FromClause, Self::OnClause) { - (rhs.source, rhs.on) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_source/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_source/mod.rs deleted file mode 100644 index dd5b68a15..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_source/mod.rs +++ /dev/null @@ -1,85 +0,0 @@ -//! Types related to describing schema, and interactions between tables. -//! -//! Most traits in this module are derived or generated by [`table!`]. -//! -//! [`table!`]: ../macro.table.html -#[doc(hidden)] -pub mod joins; -mod peano_numbers; - -use expression::{Expression, NonAggregate, SelectableExpression}; -use query_builder::*; - -pub use self::joins::JoinTo; -pub use self::peano_numbers::*; - -#[cfg(feature = "with-deprecated")] -#[deprecated(since = "1.1.0", note = "Use `deserialize::Queryable` instead")] -pub use deserialize::Queryable; -#[cfg(feature = "with-deprecated")] -#[deprecated(since = "1.1.0", note = "Use `deserialize::QueryableByName` instead")] -pub use deserialize::QueryableByName; - -/// Represents a type which can appear in the `FROM` clause. Apps should not -/// need to concern themselves with this trait. -/// -/// Types which implement this trait include: -/// - Tables generated by the `table!` macro -/// - Internal structs which represent joins -/// - A select statement which has had no query builder methods called on it, -/// other than those which can affect the from clause. -pub trait QuerySource { - /// The type returned by `from_clause` - type FromClause; - /// The type returned by `default_selection` - type DefaultSelection: SelectableExpression; - - /// The actual `FROM` clause of this type. This is typically only called in - /// `QueryFragment` implementations. - fn from_clause(&self) -> Self::FromClause; - /// The default select clause of this type, which should be used if no - /// select clause was explicitly specified. This should always be a tuple of - /// all the desired columns, not `star` - fn default_selection(&self) -> Self::DefaultSelection; -} - -/// A column on a database table. Types which implement this trait should have -/// been generated by the [`table!` macro](../macro.table.html). -pub trait Column: Expression { - /// The table which this column belongs to - type Table: Table; - - /// The name of this column - const NAME: &'static str; -} - -/// A SQL database table. Types which implement this trait should have been -/// generated by the [`table!` macro](../macro.table.html). -pub trait Table: QuerySource + AsQuery + Sized { - /// The type returned by `primary_key` - type PrimaryKey: SelectableExpression + NonAggregate; - /// The type returned by `all_columns` - type AllColumns: SelectableExpression + NonAggregate; - - /// Returns the primary key of this table. - /// - /// If the table has a composite primary key, this will be a tuple. - fn primary_key(&self) -> Self::PrimaryKey; - /// Returns a tuple of all columns belonging to this table. - fn all_columns() -> Self::AllColumns; -} - -/// Determines how many times `Self` appears in `QS` -/// -/// This trait is primarily used to determine whether or not a column is -/// selectable from a given from clause. A column can be selected if its table -/// appears in the from clause *exactly once*. -/// -/// We do not allow the same table to appear in a query multiple times in any -/// context where referencing that table would be ambiguous (depending on the -/// context and backend being used, this may or may not be something that would -/// otherwise result in a runtime error). -pub trait AppearsInFromClause { - /// How many times does `Self` appear in `QS`? - type Count; -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/query_source/peano_numbers.rs b/collector/compile-benchmarks/diesel-1.4.8/src/query_source/peano_numbers.rs deleted file mode 100644 index 0b9cd0686..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/query_source/peano_numbers.rs +++ /dev/null @@ -1,45 +0,0 @@ -//! A simple implementation of peano numbers. -//! -//! This is used to enforce that columns can only be selected from a given from -//! clause if their table appears exactly one time. - -/// A table never appears in the from clause. -#[allow(missing_debug_implementations, missing_copy_implementations)] -pub struct Never; - -/// A table appears in the from clause exactly one time. -#[allow(missing_debug_implementations, missing_copy_implementations)] -pub struct Once; - -/// A table appears in the from clause two or more times. -#[allow(missing_debug_implementations, missing_copy_implementations)] -pub struct MoreThanOnce; - -/// Add two peano numbers together. -/// -/// This is used to determine the number of times a table appears in a from -/// clause when the from clause contains a join. -pub trait Plus { - /// The result of adding these numbers together - type Output; -} - -impl Plus for Never { - type Output = T; -} - -impl Plus for MoreThanOnce { - type Output = Self; -} - -impl Plus for Once { - type Output = Self; -} - -impl Plus for Once { - type Output = MoreThanOnce; -} - -impl Plus for Once { - type Output = MoreThanOnce; -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/r2d2.rs b/collector/compile-benchmarks/diesel-1.4.8/src/r2d2.rs deleted file mode 100644 index 5aa8b6c16..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/r2d2.rs +++ /dev/null @@ -1,224 +0,0 @@ -//! Connection pooling via r2d2. -//! -//! Note: This module requires enabling the `r2d2` feature - -extern crate r2d2; - -pub use self::r2d2::*; - -/// A re-export of [`r2d2::Error`], which is only used by methods on [`r2d2::Pool`]. -/// -/// [`r2d2::Error`]: ../../r2d2/struct.Error.html -/// [`r2d2::Pool`]: ../../r2d2/struct.Pool.html -pub type PoolError = self::r2d2::Error; - -use std::convert::Into; -use std::fmt; -use std::marker::PhantomData; - -use backend::UsesAnsiSavepointSyntax; -use connection::{AnsiTransactionManager, SimpleConnection}; -use deserialize::QueryableByName; -use prelude::*; -use query_builder::{AsQuery, QueryFragment, QueryId}; -use sql_types::HasSqlType; - -/// An r2d2 connection manager for use with Diesel. -/// -/// See the [r2d2 documentation] for usage examples. -/// -/// [r2d2 documentation]: ../../r2d2 -#[derive(Debug, Clone)] -pub struct ConnectionManager { - database_url: String, - _marker: PhantomData, -} - -unsafe impl Sync for ConnectionManager {} - -impl ConnectionManager { - /// Returns a new connection manager, - /// which establishes connections to the given database URL. - pub fn new>(database_url: S) -> Self { - ConnectionManager { - database_url: database_url.into(), - _marker: PhantomData, - } - } -} - -/// The error used when managing connections with `r2d2`. -#[derive(Debug)] -pub enum Error { - /// An error occurred establishing the connection - ConnectionError(ConnectionError), - - /// An error occurred pinging the database - QueryError(::result::Error), -} - -impl fmt::Display for Error { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - Error::ConnectionError(ref e) => e.fmt(f), - Error::QueryError(ref e) => e.fmt(f), - } - } -} - -impl ::std::error::Error for Error { - fn description(&self) -> &str { - match *self { - Error::ConnectionError(ref e) => e.description(), - Error::QueryError(ref e) => e.description(), - } - } -} - -impl ManageConnection for ConnectionManager -where - T: Connection + Send + 'static, -{ - type Connection = T; - type Error = Error; - - fn connect(&self) -> Result { - T::establish(&self.database_url).map_err(Error::ConnectionError) - } - - fn is_valid(&self, conn: &mut T) -> Result<(), Error> { - conn.execute("SELECT 1") - .map(|_| ()) - .map_err(Error::QueryError) - } - - fn has_broken(&self, _conn: &mut T) -> bool { - false - } -} - -impl SimpleConnection for PooledConnection> -where - T: Connection + Send + 'static, -{ - fn batch_execute(&self, query: &str) -> QueryResult<()> { - (&**self).batch_execute(query) - } -} - -impl Connection for PooledConnection> -where - C: Connection + Send + 'static, - C::Backend: UsesAnsiSavepointSyntax, -{ - type Backend = C::Backend; - type TransactionManager = C::TransactionManager; - - fn establish(_: &str) -> ConnectionResult { - Err(ConnectionError::BadConnection(String::from( - "Cannot directly establish a pooled connection", - ))) - } - - fn execute(&self, query: &str) -> QueryResult { - (&**self).execute(query) - } - - fn query_by_index(&self, source: T) -> QueryResult> - where - T: AsQuery, - T::Query: QueryFragment + QueryId, - Self::Backend: HasSqlType, - U: Queryable, - { - (&**self).query_by_index(source) - } - - fn query_by_name(&self, source: &T) -> QueryResult> - where - T: QueryFragment + QueryId, - U: QueryableByName, - { - (&**self).query_by_name(source) - } - - fn execute_returning_count(&self, source: &T) -> QueryResult - where - T: QueryFragment + QueryId, - { - (&**self).execute_returning_count(source) - } - - fn transaction_manager(&self) -> &Self::TransactionManager { - (&**self).transaction_manager() - } -} - -#[cfg(test)] -mod tests { - use std::sync::mpsc; - use std::sync::Arc; - use std::thread; - - use r2d2::*; - use test_helpers::*; - - #[test] - fn establish_basic_connection() { - let manager = ConnectionManager::::new(database_url()); - let pool = Arc::new(Pool::builder().max_size(2).build(manager).unwrap()); - - let (s1, r1) = mpsc::channel(); - let (s2, r2) = mpsc::channel(); - - let pool1 = Arc::clone(&pool); - let t1 = thread::spawn(move || { - let conn = pool1.get().unwrap(); - s1.send(()).unwrap(); - r2.recv().unwrap(); - drop(conn); - }); - - let pool2 = Arc::clone(&pool); - let t2 = thread::spawn(move || { - let conn = pool2.get().unwrap(); - s2.send(()).unwrap(); - r1.recv().unwrap(); - drop(conn); - }); - - t1.join().unwrap(); - t2.join().unwrap(); - - pool.get().unwrap(); - } - - #[test] - fn is_valid() { - let manager = ConnectionManager::::new(database_url()); - let pool = Pool::builder() - .max_size(1) - .test_on_check_out(true) - .build(manager) - .unwrap(); - - pool.get().unwrap(); - } - - #[test] - fn pooled_connection_impls_connection() { - use select; - use sql_types::Text; - - let manager = ConnectionManager::::new(database_url()); - let pool = Pool::builder() - .max_size(1) - .test_on_check_out(true) - .build(manager) - .unwrap(); - let conn = pool.get().unwrap(); - - let query = select("foo".into_sql::()); - assert_eq!("foo", query.get_result::(&conn).unwrap()); - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/result.rs b/collector/compile-benchmarks/diesel-1.4.8/src/result.rs deleted file mode 100644 index 6d16ce7a3..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/result.rs +++ /dev/null @@ -1,376 +0,0 @@ -//! Errors, type aliases, and functions related to working with `Result`. - -use std::convert::From; -use std::error::Error as StdError; -use std::ffi::NulError; -use std::fmt::{self, Display}; - -#[derive(Debug)] -#[allow(clippy::enum_variant_names)] -/// Represents all the ways that a query can fail. -/// -/// This type is not intended to be exhaustively matched, and new variants may -/// be added in the future without a major version bump. -pub enum Error { - /// The query contained a nul byte. - /// - /// This should never occur in normal usage. - InvalidCString(NulError), - - /// The database returned an error. - /// - /// While Diesel prevents almost all sources of runtime errors at compile - /// time, it does not attempt to prevent 100% of them. Typically this error - /// will occur from insert or update statements due to a constraint - /// violation. - DatabaseError( - DatabaseErrorKind, - Box, - ), - - /// No rows were returned by a query expected to return at least one row. - /// - /// This variant is only returned by [`get_result`] and [`first`]. [`load`] - /// does not treat 0 rows as an error. If you would like to allow either 0 - /// or 1 rows, call [`optional`] on the result. - /// - /// [`get_result`]: ../query_dsl/trait.RunQueryDsl.html#method.get_result - /// [`first`]: ../query_dsl/trait.RunQueryDsl.html#method.first - /// [`load`]: ../query_dsl/trait.RunQueryDsl.html#method.load - /// [`optional`]: trait.OptionalExtension.html#tymethod.optional - NotFound, - - /// The query could not be constructed - /// - /// An example of when this error could occur is if you are attempting to - /// construct an update statement with no changes (e.g. all fields on the - /// struct are `None`). - QueryBuilderError(Box), - - /// An error occurred deserializing the data being sent to the database. - /// - /// Typically this error means that the stated type of the query is - /// incorrect. An example of when this error might occur in normal usage is - /// attempting to deserialize an infinite date into chrono. - DeserializationError(Box), - - /// An error occurred serializing the data being sent to the database. - /// - /// An example of when this error would be returned is if you attempted to - /// serialize a `chrono::NaiveDate` earlier than the earliest date supported - /// by PostgreSQL. - SerializationError(Box), - - /// Roll back the current transaction. - /// - /// You can return this variant inside of a transaction when you want to - /// roll it back, but have no actual error to return. Diesel will never - /// return this variant unless you gave it to us, and it can be safely - /// ignored in error handling. - RollbackTransaction, - - /// Attempted to perform an operation that cannot be done inside a transaction - /// when a transaction was already open. - AlreadyInTransaction, - - #[doc(hidden)] - __Nonexhaustive, -} - -#[derive(Debug, Clone, Copy)] -/// The kind of database error that occurred. -/// -/// This is not meant to exhaustively cover all possible errors, but is used to -/// identify errors which are commonly recovered from programmatically. This enum -/// is not intended to be exhaustively matched, and new variants may be added in -/// the future without a major version bump. -pub enum DatabaseErrorKind { - /// A unique constraint was violated. - UniqueViolation, - - /// A foreign key constraint was violated. - ForeignKeyViolation, - - /// The query could not be sent to the database due to a protocol violation. - /// - /// An example of a case where this would occur is if you attempted to send - /// a query with more than 65000 bind parameters using PostgreSQL. - UnableToSendCommand, - - /// A serializable transaction failed to commit due to a read/write - /// dependency on a concurrent transaction. - /// - /// Corresponds to SQLSTATE code 40001 - /// - /// This error is only detected for PostgreSQL, as we do not yet support - /// transaction isolation levels for other backends. - SerializationFailure, - - #[doc(hidden)] - __Unknown, // Match against _ instead, more variants may be added in the future -} - -/// Information about an error that was returned by the database. -pub trait DatabaseErrorInformation { - /// The primary human-readable error message. Typically one line. - fn message(&self) -> &str; - - /// An optional secondary error message providing more details about the - /// problem, if it was provided by the database. Might span multiple lines. - fn details(&self) -> Option<&str>; - - /// An optional suggestion of what to do about the problem, if one was - /// provided by the database. - fn hint(&self) -> Option<&str>; - - /// The name of the table the error was associated with, if the error was - /// associated with a specific table and the backend supports retrieving - /// that information. - /// - /// Currently this method will return `None` for all backends other than - /// PostgreSQL. - fn table_name(&self) -> Option<&str>; - - /// The name of the column the error was associated with, if the error was - /// associated with a specific column and the backend supports retrieving - /// that information. - /// - /// Currently this method will return `None` for all backends other than - /// PostgreSQL. - fn column_name(&self) -> Option<&str>; - - /// The constraint that was violated if this error is a constraint violation - /// and the backend supports retrieving that information. - /// - /// Currently this method will return `None` for all backends other than - /// PostgreSQL. - fn constraint_name(&self) -> Option<&str>; -} - -impl fmt::Debug for dyn DatabaseErrorInformation + Send + Sync { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Debug::fmt(&self.message(), f) - } -} - -impl DatabaseErrorInformation for String { - fn message(&self) -> &str { - self - } - - fn details(&self) -> Option<&str> { - None - } - fn hint(&self) -> Option<&str> { - None - } - fn table_name(&self) -> Option<&str> { - None - } - fn column_name(&self) -> Option<&str> { - None - } - fn constraint_name(&self) -> Option<&str> { - None - } -} - -/// Errors which can occur during [`Connection::establish`] -/// -/// [`Connection::establish`]: ../connection/trait.Connection.html#tymethod.establish -#[derive(Debug, PartialEq)] -pub enum ConnectionError { - /// The connection URL contained a `NUL` byte. - InvalidCString(NulError), - /// The database returned an error. - BadConnection(String), - /// The connection URL could not be parsed. - InvalidConnectionUrl(String), - /// Diesel could not configure the database connection. - /// - /// Diesel may try to automatically set session specific configuration - /// values, such as UTF8 encoding, or enabling the `||` operator on MySQL. - /// This variant is returned if an error occurred executing the query to set - /// those options. Diesel will never affect global configuration. - CouldntSetupConfiguration(Error), - #[doc(hidden)] - __Nonexhaustive, // Match against _ instead, more variants may be added in the future -} - -/// A specialized result type for queries. -/// -/// This type is exported by `diesel::prelude`, and is generally used by any -/// code which is interacting with Diesel. This type exists to avoid writing out -/// `diesel::result::Error`, and is otherwise a direct mapping to `Result`. -pub type QueryResult = Result; - -/// A specialized result type for establishing connections. -/// -/// This type exists to avoid writing out `diesel::result::ConnectionError`, and -/// is otherwise a direct mapping to `Result`. -pub type ConnectionResult = Result; - -/// See the [method documentation](#tymethod.optional). -pub trait OptionalExtension { - /// Converts a `QueryResult` into a `QueryResult>`. - /// - /// By default, Diesel treats 0 rows being returned from a query that is expected to return 1 - /// row as an error (e.g. the return value of [`get_result`] or [`first`]). This method will - /// handle that error, and give you back an `Option` instead. - /// - /// [`get_result`]: ../query_dsl/trait.RunQueryDsl.html#method.get_result - /// [`first`]: ../query_dsl/trait.RunQueryDsl.html#method.first - /// - /// # Example - /// - /// ```rust - /// use diesel::{QueryResult, NotFound, OptionalExtension}; - /// - /// let result: QueryResult = Ok(1); - /// assert_eq!(Ok(Some(1)), result.optional()); - /// - /// let result: QueryResult = Err(NotFound); - /// assert_eq!(Ok(None), result.optional()); - /// ``` - fn optional(self) -> Result, Error>; -} - -impl OptionalExtension for QueryResult { - fn optional(self) -> Result, Error> { - match self { - Ok(value) => Ok(Some(value)), - Err(Error::NotFound) => Ok(None), - Err(e) => Err(e), - } - } -} - -impl From for ConnectionError { - fn from(e: NulError) -> Self { - ConnectionError::InvalidCString(e) - } -} - -impl From for Error { - fn from(e: NulError) -> Self { - Error::InvalidCString(e) - } -} - -impl Display for Error { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - Error::InvalidCString(ref nul_err) => nul_err.fmt(f), - Error::DatabaseError(_, ref e) => write!(f, "{}", e.message()), - Error::NotFound => f.write_str("NotFound"), - Error::QueryBuilderError(ref e) => e.fmt(f), - Error::DeserializationError(ref e) => e.fmt(f), - Error::SerializationError(ref e) => e.fmt(f), - Error::RollbackTransaction => write!(f, "{}", self.description()), - Error::AlreadyInTransaction => write!(f, "{}", self.description()), - Error::__Nonexhaustive => unreachable!(), - } - } -} - -impl StdError for Error { - fn description(&self) -> &str { - match *self { - Error::InvalidCString(ref nul_err) => nul_err.description(), - Error::DatabaseError(_, ref e) => e.message(), - Error::NotFound => "Record not found", - Error::QueryBuilderError(ref e) => e.description(), - Error::DeserializationError(ref e) => e.description(), - Error::SerializationError(ref e) => e.description(), - Error::RollbackTransaction => "The current transaction was aborted", - Error::AlreadyInTransaction => { - "Cannot perform this operation while a transaction is open" - } - Error::__Nonexhaustive => unreachable!(), - } - } - - fn cause(&self) -> Option<&dyn StdError> { - match *self { - Error::InvalidCString(ref e) => Some(e), - Error::QueryBuilderError(ref e) => Some(&**e), - Error::DeserializationError(ref e) => Some(&**e), - Error::SerializationError(ref e) => Some(&**e), - _ => None, - } - } -} - -impl Display for ConnectionError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - ConnectionError::InvalidCString(ref nul_err) => nul_err.fmt(f), - ConnectionError::BadConnection(ref s) => write!(f, "{}", s), - ConnectionError::InvalidConnectionUrl(ref s) => write!(f, "{}", s), - ConnectionError::CouldntSetupConfiguration(ref e) => e.fmt(f), - ConnectionError::__Nonexhaustive => unreachable!(), - } - } -} - -impl StdError for ConnectionError { - fn description(&self) -> &str { - match *self { - ConnectionError::InvalidCString(ref nul_err) => nul_err.description(), - ConnectionError::BadConnection(ref s) => s, - ConnectionError::InvalidConnectionUrl(ref s) => s, - ConnectionError::CouldntSetupConfiguration(ref e) => e.description(), - ConnectionError::__Nonexhaustive => unreachable!(), - } - } - - fn cause(&self) -> Option<&dyn StdError> { - match *self { - ConnectionError::InvalidCString(ref e) => Some(e), - ConnectionError::CouldntSetupConfiguration(ref e) => Some(e), - _ => None, - } - } -} - -impl PartialEq for Error { - fn eq(&self, other: &Error) -> bool { - match (self, other) { - (&Error::InvalidCString(ref a), &Error::InvalidCString(ref b)) => a == b, - (&Error::DatabaseError(_, ref a), &Error::DatabaseError(_, ref b)) => { - a.message() == b.message() - } - (&Error::NotFound, &Error::NotFound) => true, - (&Error::RollbackTransaction, &Error::RollbackTransaction) => true, - (&Error::AlreadyInTransaction, &Error::AlreadyInTransaction) => true, - _ => false, - } - } -} - -#[cfg(test)] -#[allow(warnings)] -fn error_impls_send() { - let err: Error = unimplemented!(); - let x: &Send = &err; -} - -pub(crate) fn first_or_not_found(records: QueryResult>) -> QueryResult { - records?.into_iter().next().ok_or(Error::NotFound) -} - -/// An unexpected `NULL` was encountered during deserialization -#[derive(Debug, Clone, Copy)] -pub struct UnexpectedNullError; - -impl fmt::Display for UnexpectedNullError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", self.description()) - } -} - -impl StdError for UnexpectedNullError { - fn description(&self) -> &str { - "Unexpected null for non-null column" - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/row.rs b/collector/compile-benchmarks/diesel-1.4.8/src/row.rs deleted file mode 100644 index a4fca770f..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/row.rs +++ /dev/null @@ -1,66 +0,0 @@ -//! Contains the `Row` trait - -use backend::Backend; -use deserialize::{self, FromSql}; - -/// Represents a single database row. -/// Apps should not need to concern themselves with this trait. -/// -/// This trait is only used as an argument to [`FromSqlRow`]. -/// -/// [`FromSqlRow`]: ../deserialize/trait.FromSqlRow.html -pub trait Row { - /// Returns the value of the next column in the row. - fn take(&mut self) -> Option<&DB::RawValue>; - - /// Returns whether the next `count` columns are all `NULL`. - /// - /// If this method returns `true`, then the next `count` calls to `take` - /// would all return `None`. - fn next_is_null(&self, count: usize) -> bool; - - /// Skips the next `count` columns. This method must be called if you are - /// choosing not to call `take` as a result of `next_is_null` returning - /// `true`. - fn advance(&mut self, count: usize) { - for _ in 0..count { - self.take(); - } - } -} - -/// Represents a row of a SQL query, where the values are accessed by name -/// rather than by index. -/// -/// This trait is used by implementations of -/// [`QueryableByName`](../deserialize/trait.QueryableByName.html) -pub trait NamedRow { - /// Retrieve and deserialize a single value from the query - /// - /// Note that `ST` *must* be the exact type of the value with that name in - /// the query. The compiler will not be able to verify that you have - /// provided the correct type. If there is a mismatch, you may receive an - /// incorrect value, or a runtime error. - /// - /// If two or more fields in the query have the given name, the result of - /// this function is undefined. - fn get(&self, column_name: &str) -> deserialize::Result - where - T: FromSql, - { - let idx = self - .index_of(column_name) - .ok_or_else(|| format!("Column `{}` was not present in query", column_name).into()); - let idx = match idx { - Ok(x) => x, - Err(e) => return Err(e), - }; - let raw_value = self.get_raw_value(idx); - T::from_sql(raw_value) - } - - #[doc(hidden)] - fn index_of(&self, column_name: &str) -> Option; - #[doc(hidden)] - fn get_raw_value(&self, index: usize) -> Option<&DB::RawValue>; -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/serialize.rs b/collector/compile-benchmarks/diesel-1.4.8/src/serialize.rs deleted file mode 100644 index bd7749862..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/serialize.rs +++ /dev/null @@ -1,202 +0,0 @@ -//! Types and traits related to serializing values for the database - -use std::error::Error; -use std::fmt; -use std::io::{self, Write}; -use std::ops::{Deref, DerefMut}; -use std::result; - -use backend::Backend; -use sql_types::TypeMetadata; - -#[cfg(feature = "postgres")] -pub use pg::serialize::*; - -/// A specialized result type representing the result of serializing -/// a value for the database. -pub type Result = result::Result>; - -#[derive(Debug, Copy, Clone, PartialEq, Eq)] -/// Tiny enum to make the return type of `ToSql` more descriptive -pub enum IsNull { - /// No data was written, as this type is null - Yes, - /// The value is not null - /// - /// This does not necessarily mean that any data was written to the buffer. - /// For example, an empty string has no data to be sent over the wire, but - /// also is not null. - No, -} - -/// Wraps a buffer to be written by `ToSql` with additional backend specific -/// utilities. -#[derive(Clone, Copy)] -pub struct Output<'a, T, DB> -where - DB: TypeMetadata, - DB::MetadataLookup: 'a, -{ - out: T, - metadata_lookup: Option<&'a DB::MetadataLookup>, -} - -impl<'a, T, DB: TypeMetadata> Output<'a, T, DB> { - /// Construct a new `Output` - pub fn new(out: T, metadata_lookup: &'a DB::MetadataLookup) -> Self { - Output { - out, - metadata_lookup: Some(metadata_lookup), - } - } - - /// Create a new `Output` with the given buffer - pub fn with_buffer(&self, new_out: U) -> Output<'a, U, DB> { - Output { - out: new_out, - metadata_lookup: self.metadata_lookup, - } - } - - /// Return the raw buffer this type is wrapping - pub fn into_inner(self) -> T { - self.out - } - - /// Returns the backend's mechanism for dynamically looking up type - /// metadata at runtime, if relevant for the given backend. - pub fn metadata_lookup(&self) -> &'a DB::MetadataLookup { - self.metadata_lookup.expect("Lookup is there") - } -} - -#[cfg(test)] -impl Output<'static, Vec, DB> { - /// Returns a `Output` suitable for testing `ToSql` implementations. - /// Unsafe to use for testing types which perform dynamic metadata lookup. - pub fn test() -> Self { - Self { - out: Vec::new(), - metadata_lookup: None, - } - } -} - -impl<'a, T: Write, DB: TypeMetadata> Write for Output<'a, T, DB> { - fn write(&mut self, buf: &[u8]) -> io::Result { - self.out.write(buf) - } - - fn flush(&mut self) -> io::Result<()> { - self.out.flush() - } - - fn write_all(&mut self, buf: &[u8]) -> io::Result<()> { - self.out.write_all(buf) - } - - fn write_fmt(&mut self, fmt: fmt::Arguments) -> io::Result<()> { - self.out.write_fmt(fmt) - } -} - -impl<'a, T, DB: TypeMetadata> Deref for Output<'a, T, DB> { - type Target = T; - - fn deref(&self) -> &Self::Target { - &self.out - } -} - -impl<'a, T, DB: TypeMetadata> DerefMut for Output<'a, T, DB> { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.out - } -} - -impl<'a, T, U, DB> PartialEq for Output<'a, T, DB> -where - DB: TypeMetadata, - T: PartialEq, -{ - fn eq(&self, rhs: &U) -> bool { - self.out == *rhs - } -} - -impl<'a, T, DB> fmt::Debug for Output<'a, T, DB> -where - T: fmt::Debug, - DB: TypeMetadata, -{ - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - self.out.fmt(f) - } -} - -/// Serializes a single value to be sent to the database. -/// -/// The output is sent as a bind parameter, and the data must be written in the -/// expected format for the given backend. -/// -/// When possible, implementations of this trait should prefer using an existing -/// implementation, rather than writing to `out` directly. (For example, if you -/// are implementing this for an enum, which is represented as an integer in the -/// database, you should use `i32::to_sql(x, out)` instead of writing to `out` -/// yourself. -/// -/// Any types which implement this trait should also `#[derive(AsExpression)]`. -/// -/// ### Backend specific details -/// -/// - For PostgreSQL, the bytes will be sent using the binary protocol, not text. -/// - For SQLite, all implementations should be written in terms of an existing -/// `ToSql` implementation. -/// - For MySQL, the expected bytes will depend on the return value of -/// `type_metadata` for the given SQL type. See [`MysqlType`] for details. -/// - For third party backends, consult that backend's documentation. -/// -/// [`MysqlType`]: ../mysql/enum.MysqlType.html -/// -/// ### Examples -/// -/// Most implementations of this trait will be defined in terms of an existing -/// implementation. -/// -/// ```rust -/// # use diesel::backend::Backend; -/// # use diesel::sql_types::*; -/// # use diesel::serialize::{self, ToSql, Output}; -/// # use std::io::Write; -/// # -/// #[repr(i32)] -/// #[derive(Debug, Clone, Copy)] -/// pub enum MyEnum { -/// A = 1, -/// B = 2, -/// } -/// -/// impl ToSql for MyEnum -/// where -/// DB: Backend, -/// i32: ToSql, -/// { -/// fn to_sql(&self, out: &mut Output) -> serialize::Result { -/// (*self as i32).to_sql(out) -/// } -/// } -/// ``` -pub trait ToSql: fmt::Debug { - /// See the trait documentation. - fn to_sql(&self, out: &mut Output) -> Result; -} - -impl<'a, A, T, DB> ToSql for &'a T -where - DB: Backend, - T: ToSql + ?Sized, -{ - fn to_sql(&self, out: &mut Output) -> Result { - (*self).to_sql(out) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/sql_types/fold.rs b/collector/compile-benchmarks/diesel-1.4.8/src/sql_types/fold.rs deleted file mode 100644 index 27823539e..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/sql_types/fold.rs +++ /dev/null @@ -1,47 +0,0 @@ -use sql_types::{self, NotNull}; - -/// Represents SQL types which can be used with `SUM` and `AVG` -pub trait Foldable { - /// The SQL type of `sum(this_type)` - type Sum; - /// The SQL type of `avg(this_type)` - type Avg; -} - -impl Foldable for sql_types::Nullable -where - T: Foldable + NotNull, -{ - type Sum = T::Sum; - type Avg = T::Avg; -} - -macro_rules! foldable_impls { - ($($Source:ty => ($SumType:ty, $AvgType:ty)),+,) => { - $( - impl Foldable for $Source { - type Sum = sql_types::Nullable<$SumType>; - type Avg = sql_types::Nullable<$AvgType>; - } - )+ - } -} - -foldable_impls! { - sql_types::SmallInt => (sql_types::BigInt, sql_types::Numeric), - sql_types::Integer => (sql_types::BigInt, sql_types::Numeric), - sql_types::BigInt => (sql_types::Numeric, sql_types::Numeric), - - sql_types::Float => (sql_types::Float, sql_types::Double), - sql_types::Double => (sql_types::Double, sql_types::Double), - sql_types::Numeric => (sql_types::Numeric, sql_types::Numeric), - - sql_types::Interval => (sql_types::Interval, sql_types::Interval), -} - -#[cfg(feature = "mysql")] -foldable_impls! { - sql_types::Unsigned => (sql_types::Unsigned, sql_types::Numeric), - sql_types::Unsigned => (sql_types::Unsigned, sql_types::Numeric), - sql_types::Unsigned => (sql_types::Numeric, sql_types::Numeric), -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/sql_types/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/sql_types/mod.rs deleted file mode 100644 index 12cf5747e..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/sql_types/mod.rs +++ /dev/null @@ -1,499 +0,0 @@ -//! Types which represent a SQL data type. -//! -//! The structs in this module are *only* used as markers to represent a SQL type. -//! They should never be used in your structs. -//! If you'd like to know the rust types which can be used for a given SQL type, -//! see the documentation for that SQL type. -//! Additional types may be provided by other crates. -//! -//! To see which SQL type can be used with a given Rust type, -//! see the "Implementors" section of [`FromSql`]. -//! -//! [`FromSql`]: ../deserialize/trait.FromSql.html -//! -//! Any backend specific types are re-exported through this module - -mod fold; -pub mod ops; -mod ord; - -pub use self::fold::Foldable; -pub use self::ord::SqlOrd; - -/// The boolean SQL type. -/// -/// On backends without a native boolean type, -/// this is emulated with the smallest supported integer. -/// -/// ### [`ToSql`](../serialize/trait.ToSql.html) impls -/// -/// - [`bool`][bool] -/// -/// ### [`FromSql`](../deserialize/trait.FromSql.html) impls -/// -/// - [`bool`][bool] -/// -/// [bool]: https://doc.rust-lang.org/nightly/std/primitive.bool.html -#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)] -#[cfg_attr(feature = "postgres", postgres(oid = "16", array_oid = "1000"))] -#[cfg_attr(feature = "sqlite", sqlite_type = "Integer")] -#[cfg_attr(feature = "mysql", mysql_type = "Tiny")] -pub struct Bool; - -/// The tiny integer SQL type. -/// -/// This is only available on MySQL. -/// Keep in mind that `infer_schema!` will see `TINYINT(1)` as `Bool`, -/// not `TinyInt`. -/// -/// ### [`ToSql`](../serialize/trait.ToSql.html) impls -/// -/// - [`i8`][i8] -/// -/// ### [`FromSql`](../deserialize/trait.FromSql.html) impls -/// -/// - [`i8`][i8] -/// -/// [i8]: https://doc.rust-lang.org/nightly/std/primitive.i8.html -#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)] -#[cfg_attr(feature = "mysql", mysql_type = "Tiny")] -pub struct TinyInt; -#[doc(hidden)] -pub type Tinyint = TinyInt; - -/// The small integer SQL type. -/// -/// ### [`ToSql`](../serialize/trait.ToSql.html) impls -/// -/// - [`i16`][i16] -/// -/// ### [`FromSql`](../deserialize/trait.FromSql.html) impls -/// -/// - [`i16`][i16] -/// -/// [i16]: https://doc.rust-lang.org/nightly/std/primitive.i16.html -#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)] -#[cfg_attr(feature = "postgres", postgres(oid = "21", array_oid = "1005"))] -#[cfg_attr(feature = "sqlite", sqlite_type = "SmallInt")] -#[cfg_attr(feature = "mysql", mysql_type = "Short")] -pub struct SmallInt; -#[doc(hidden)] -pub type Int2 = SmallInt; -#[doc(hidden)] -pub type Smallint = SmallInt; - -/// The integer SQL type. -/// -/// ### [`ToSql`](../serialize/trait.ToSql.html) impls -/// -/// - [`i32`][i32] -/// -/// ### [`FromSql`](../deserialize/trait.FromSql.html) impls -/// -/// - [`i32`][i32] -/// -/// [i32]: https://doc.rust-lang.org/nightly/std/primitive.i32.html -#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)] -#[cfg_attr(feature = "postgres", postgres(oid = "23", array_oid = "1007"))] -#[cfg_attr(feature = "sqlite", sqlite_type = "Integer")] -#[cfg_attr(feature = "mysql", mysql_type = "Long")] -pub struct Integer; -#[doc(hidden)] -pub type Int4 = Integer; - -/// The big integer SQL type. -/// -/// ### [`ToSql`](../serialize/trait.ToSql.html) impls -/// -/// - [`i64`][i64] -/// -/// ### [`FromSql`](../deserialize/trait.FromSql.html) impls -/// -/// - [`i64`][i64] -/// -/// [i64]: https://doc.rust-lang.org/nightly/std/primitive.i64.html -#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)] -#[cfg_attr(feature = "postgres", postgres(oid = "20", array_oid = "1016"))] -#[cfg_attr(feature = "sqlite", sqlite_type = "Long")] -#[cfg_attr(feature = "mysql", mysql_type = "LongLong")] -pub struct BigInt; -#[doc(hidden)] -pub type Int8 = BigInt; -#[doc(hidden)] -pub type Bigint = BigInt; - -/// The float SQL type. -/// -/// ### [`ToSql`](../serialize/trait.ToSql.html) impls -/// -/// - [`f32`][f32] -/// -/// ### [`FromSql`](../deserialize/trait.FromSql.html) impls -/// -/// - [`f32`][f32] -/// -/// [f32]: https://doc.rust-lang.org/nightly/std/primitive.f32.html -#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)] -#[cfg_attr(feature = "postgres", postgres(oid = "700", array_oid = "1021"))] -#[cfg_attr(feature = "sqlite", sqlite_type = "Float")] -#[cfg_attr(feature = "mysql", mysql_type = "Float")] -pub struct Float; -#[doc(hidden)] -pub type Float4 = Float; - -/// The double precision float SQL type. -/// -/// ### [`ToSql`](../serialize/trait.ToSql.html) impls -/// -/// - [`f64`][f64] -/// -/// ### [`FromSql`](../deserialize/trait.FromSql.html) impls -/// -/// - [`f64`][f64] -/// -/// [f64]: https://doc.rust-lang.org/nightly/std/primitive.f64.html -#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)] -#[cfg_attr(feature = "postgres", postgres(oid = "701", array_oid = "1022"))] -#[cfg_attr(feature = "sqlite", sqlite_type = "Double")] -#[cfg_attr(feature = "mysql", mysql_type = "Double")] -pub struct Double; -#[doc(hidden)] -pub type Float8 = Double; - -/// The arbitrary precision numeric SQL type. -/// -/// This type is only supported on PostgreSQL and MySQL. -/// On SQLite, [`Double`](struct.Double.html) should be used instead. -/// -/// ### [`ToSql`](../serialize/trait.ToSql.html) impls -/// -/// - [`bigdecimal::BigDecimal`] with `feature = ["numeric"]` -/// -/// ### [`FromSql`](../deserialize/trait.FromSql.html) impls -/// -/// - [`bigdecimal::BigDecimal`] with `feature = ["numeric"]` -/// -/// [`bigdecimal::BigDecimal`]: /bigdecimal/struct.BigDecimal.html -#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)] -#[cfg_attr(feature = "postgres", postgres(oid = "1700", array_oid = "1231"))] -#[cfg_attr(feature = "mysql", mysql_type = "String")] -#[cfg_attr(feature = "sqlite", sqlite_type = "Double")] -pub struct Numeric; - -/// Alias for `Numeric` -pub type Decimal = Numeric; - -/// The text SQL type. -/// -/// On all backends strings must be valid UTF-8. -/// On PostgreSQL strings must not include nul bytes. -/// -/// Schema inference will treat all variants of `TEXT` as this type (e.g. -/// `VARCHAR`, `MEDIUMTEXT`, etc). -/// -/// ### [`ToSql`](../serialize/trait.ToSql.html) impls -/// -/// - [`String`][String] -/// - [`&str`][str] -/// -/// ### [`FromSql`](../deserialize/trait.FromSql.html) impls -/// -/// - [`String`][String] -/// -/// [String]: https://doc.rust-lang.org/nightly/std/string/struct.String.html -/// [str]: https://doc.rust-lang.org/nightly/std/primitive.str.html -#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)] -#[cfg_attr(feature = "postgres", postgres(oid = "25", array_oid = "1009"))] -#[cfg_attr(feature = "sqlite", sqlite_type = "Text")] -#[cfg_attr(feature = "mysql", mysql_type = "String")] -pub struct Text; - -/// The SQL `VARCHAR` type -/// -/// This type is generally interchangeable with `TEXT`, so Diesel has this as an -/// alias rather than a separate type (Diesel does not currently support -/// implicit coercions). -/// -/// One notable exception to this is with arrays on PG. `TEXT[]` cannot be -/// coerced to `VARCHAR[]`. It is recommended that you always use `TEXT[]` if -/// you need a string array on PG. -pub type VarChar = Text; -#[doc(hidden)] -pub type Varchar = VarChar; -#[doc(hidden)] -pub type Char = Text; -#[doc(hidden)] -pub type Tinytext = Text; -#[doc(hidden)] -pub type Mediumtext = Text; -#[doc(hidden)] -pub type Longtext = Text; - -/// The binary SQL type. -/// -/// Schema inference will treat all variants of `BLOB` as this type (e.g. -/// `VARBINARY`, `MEDIUMBLOB`, etc). -/// -/// ### [`ToSql`](../serialize/trait.ToSql.html) impls -/// -/// - [`Vec`][Vec] -/// - [`&[u8]`][slice] -/// -/// ### [`FromSql`](../deserialize/trait.FromSql.html) impls -/// -/// - [`Vec`][Vec] -/// -/// [Vec]: https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html -/// [slice]: https://doc.rust-lang.org/nightly/std/primitive.slice.html -#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)] -#[cfg_attr(feature = "postgres", postgres(oid = "17", array_oid = "1001"))] -#[cfg_attr(feature = "sqlite", sqlite_type = "Binary")] -#[cfg_attr(feature = "mysql", mysql_type = "Blob")] -pub struct Binary; - -#[doc(hidden)] -pub type Tinyblob = Binary; -#[doc(hidden)] -pub type Blob = Binary; -#[doc(hidden)] -pub type Mediumblob = Binary; -#[doc(hidden)] -pub type Longblob = Binary; -#[doc(hidden)] -pub type Varbinary = Binary; -#[doc(hidden)] -pub type Bit = Binary; - -/// The date SQL type. -/// -/// ### [`ToSql`](../serialize/trait.ToSql.html) impls -/// -/// - [`chrono::NaiveDate`][NaiveDate] with `feature = "chrono"` -/// -/// ### [`FromSql`](../deserialize/trait.FromSql.html) impls -/// -/// - [`chrono::NaiveDate`][NaiveDate] with `feature = "chrono"` -/// -/// [NaiveDate]: /chrono/naive/date/struct.NaiveDate.html -#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)] -#[cfg_attr(feature = "postgres", postgres(oid = "1082", array_oid = "1182"))] -#[cfg_attr(feature = "sqlite", sqlite_type = "Text")] -#[cfg_attr(feature = "mysql", mysql_type = "Date")] -pub struct Date; - -/// The interval SQL type. -/// -/// This type is currently only implemented for PostgreSQL. -/// -/// ### [`ToSql`](../serialize/trait.ToSql.html) impls -/// -/// - [`PgInterval`] which can be constructed using [`IntervalDsl`] -/// -/// ### [`FromSql`](../deserialize/trait.FromSql.html) impls -/// -/// - [`PgInterval`] which can be constructed using [`IntervalDsl`] -/// -/// [`PgInterval`]: ../pg/data_types/struct.PgInterval.html -/// [`IntervalDsl`]: ../pg/expression/extensions/trait.IntervalDsl.html -#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)] -#[cfg_attr(feature = "postgres", postgres(oid = "1186", array_oid = "1187"))] -pub struct Interval; - -/// The time SQL type. -/// -/// ### [`ToSql`](../serialize/trait.ToSql.html) impls -/// -/// - [`chrono::NaiveTime`][NaiveTime] with `feature = "chrono"` -/// -/// ### [`FromSql`](../deserialize/trait.FromSql.html) impls -/// -/// - [`chrono::NaiveTime`][NaiveTime] with `feature = "chrono"` -/// -/// [NaiveTime]: /chrono/naive/time/struct.NaiveTime.html -#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)] -#[cfg_attr(feature = "postgres", postgres(oid = "1083", array_oid = "1183"))] -#[cfg_attr(feature = "sqlite", sqlite_type = "Text")] -#[cfg_attr(feature = "mysql", mysql_type = "Time")] -pub struct Time; - -/// The timestamp SQL type. -/// -/// ### [`ToSql`](../serialize/trait.ToSql.html) impls -/// -/// - [`std::time::SystemTime`][SystemTime] (PG only) -/// - [`chrono::NaiveDateTime`][NaiveDateTime] with `feature = "chrono"` -/// - [`time::Timespec`][Timespec] with `feature = "deprecated-time"` (PG only) -/// -/// ### [`FromSql`](../deserialize/trait.FromSql.html) impls -/// -/// - [`std::time::SystemTime`][SystemTime] (PG only) -/// - [`chrono::NaiveDateTime`][NaiveDateTime] with `feature = "chrono"` -/// - [`time::Timespec`][Timespec] with `feature = "deprecated-time"` (PG only) -/// -/// [SystemTime]: https://doc.rust-lang.org/nightly/std/time/struct.SystemTime.html -/// [NaiveDateTime]: /chrono/naive/datetime/struct.NaiveDateTime.html -/// [Timespec]: /time/struct.Timespec.html -#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)] -#[cfg_attr(feature = "postgres", postgres(oid = "1114", array_oid = "1115"))] -#[cfg_attr(feature = "sqlite", sqlite_type = "Text")] -#[cfg_attr(feature = "mysql", mysql_type = "Timestamp")] -pub struct Timestamp; - -/// The nullable SQL type. -/// -/// This wraps another SQL type to indicate that it can be null. -/// By default all values are assumed to be `NOT NULL`. -/// -/// ### [`ToSql`](../serialize/trait.ToSql.html) impls -/// -/// - Any `T` which implements `ToSql` -/// - `Option` for any `T` which implements `ToSql` -/// -/// ### [`FromSql`](../deserialize/trait.FromSql.html) impls -/// -/// - `Option` for any `T` which implements `FromSql` -#[derive(Debug, Clone, Copy, Default)] -pub struct Nullable(ST); - -#[cfg(feature = "postgres")] -pub use pg::types::sql_types::*; - -#[cfg(feature = "mysql")] -pub use mysql::types::*; - -/// Indicates that a SQL type exists for a backend. -/// -/// # Deriving -/// -/// This trait can be automatically derived by `#[derive(SqlType)]`. -/// This derive will also implement [`NotNull`] and [`SingleValue`]. -/// When deriving this trait, -/// you need to specify how the type is represented on various backends. -/// You don't need to specify every backend, -/// only the ones supported by your type. -/// -/// For PostgreSQL, add `#[postgres(oid = "some_oid", array_oid = "some_oid")]` -/// or `#[postgres(type_name = "pg_type_name")]` if the OID is not stable. -/// For MySQL, specify which variant of [`MysqlType`] should be used -/// by adding `#[mysql_type = "Variant"]`. -/// For SQLite, specify which variant of [`SqliteType`] should be used -/// by adding `#[sqlite_type = "Variant"]`. -/// -/// [`NotNull`]: trait.NotNull.html -/// [`SingleValue`]: trait.SingleValue.html -/// [`MysqlType`]: ../mysql/enum.MysqlType.html -/// [`SqliteType`]: ../sqlite/enum.SqliteType.html -/// -/// # Example -/// -/// ```rust -/// # #[macro_use] -/// # extern crate diesel; -/// #[derive(SqlType)] -/// #[postgres(oid = "23", array_oid = "1007")] -/// #[sqlite_type = "Integer"] -/// #[mysql_type = "Long"] -/// pub struct Integer; -/// # fn main() {} -/// ``` -pub trait HasSqlType: TypeMetadata { - /// Fetch the metadata for the given type - /// - /// This method may use `lookup` to do dynamic runtime lookup. Implementors - /// of this method should not do dynamic lookup unless absolutely necessary - fn metadata(lookup: &Self::MetadataLookup) -> Self::TypeMetadata; - - #[doc(hidden)] - #[cfg(feature = "with-deprecated")] - #[deprecated( - since = "1.4.0", - note = "This method is no longer used, and has been deprecated without replacement" - )] - fn row_metadata(out: &mut Vec, lookup: &Self::MetadataLookup) { - out.push(Self::metadata(lookup)) - } - - #[doc(hidden)] - #[cfg(feature = "mysql")] - fn is_signed() -> IsSigned { - IsSigned::Signed - } - - #[doc(hidden)] - #[cfg(feature = "mysql")] - fn mysql_metadata(lookup: &Self::MetadataLookup) -> (Self::TypeMetadata, IsSigned) { - (Self::metadata(lookup), Self::is_signed()) - } - - #[doc(hidden)] - #[cfg(feature = "mysql")] - fn mysql_row_metadata( - out: &mut Vec<(Self::TypeMetadata, IsSigned)>, - lookup: &Self::MetadataLookup, - ) { - out.push(Self::mysql_metadata(lookup)) - } -} - -#[doc(hidden)] -#[cfg(feature = "mysql")] -#[derive(Debug, Clone, Copy)] -pub enum IsSigned { - Signed, - Unsigned, -} - -/// Information about how a backend stores metadata about given SQL types -pub trait TypeMetadata { - /// The actual type used to represent metadata. - /// - /// On PostgreSQL, this is the type's OID. - /// On MySQL and SQLite, this is an enum representing all storage classes - /// they support. - type TypeMetadata; - /// The type used for runtime lookup of metadata. - /// - /// For most backends, which don't support user defined types, this will - /// be `()`. - type MetadataLookup; -} - -/// A marker trait indicating that a SQL type is not null. -/// -/// All SQL types must implement this trait. -/// -/// # Deriving -/// -/// This trait is automatically implemented by `#[derive(SqlType)]` -pub trait NotNull {} - -/// Converts a type which may or may not be nullable into its nullable -/// representation. -pub trait IntoNullable { - /// The nullable representation of this type. - /// - /// For all types except `Nullable`, this will be `Nullable`. - type Nullable; -} - -impl IntoNullable for T { - type Nullable = Nullable; -} - -impl IntoNullable for Nullable { - type Nullable = Nullable; -} - -/// A marker trait indicating that a SQL type represents a single value, as -/// opposed to a list of values. -/// -/// This trait should generally be implemented for all SQL types with the -/// exception of Rust tuples. If a column could have this as its type, this -/// trait should be implemented. -/// -/// # Deriving -/// -/// This trait is automatically implemented by `#[derive(SqlType)]` -pub trait SingleValue {} - -impl SingleValue for Nullable {} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/sql_types/ops.rs b/collector/compile-benchmarks/diesel-1.4.8/src/sql_types/ops.rs deleted file mode 100644 index ad8a66681..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/sql_types/ops.rs +++ /dev/null @@ -1,184 +0,0 @@ -//! Represents the output of numeric operators in SQL -//! -//! Apps should not need to concern themselves with this module. -//! If you are looking for where the actual implementation of `std::ops::Add` -//! and friends are generated for columns, see -//! [`numeric_expr!`](../../macro.numeric_expr.html). -//! -//! Crates which add new types which allow numeric operators should implement -//! these traits to specify what the output is for a given right hand side. -//! -//! Unlike the traits in `std::ops`, the right hand side is an associated type -//! rather than a type parameter. The biggest drawback of this is that any type -//! can only have one right hand type which can be added/subtracted, etc. The -//! most immediately noticeable effect of this is that you cannot add a nullable -//! number to one that is not nullable. -//! -//! The reason for this is because of the impl of `std::ops::Add` that we need -//! to be able to write. We want the right hand side to allow Rust values which -//! should be sent as bind parameters, not just other Diesel expressions. That -//! means the impl would look like this: -//! -//! ```ignore -//! impl std::ops::Add for my_column -//! where -//! T: AsExpression, -//! my_column::SqlType: diesel::ops::Add, -//! ``` -//! -//! This impl is not valid in Rust, as `ST` is not constrained by the trait or -//! the implementing type. If there were two valid types for `ST` which -//! satisfied all constraints, Rust would not know which one to use, and there -//! would be no way for the user to specify which one should be used. - -use super::*; - -/// Represents SQL types which can be added. -pub trait Add { - /// The SQL type which can be added to this one - type Rhs; - /// The SQL type of the result of adding `Rhs` to `Self` - type Output; -} - -/// Represents SQL types which can be subtracted. -pub trait Sub { - /// The SQL type which can be subtracted from this one - type Rhs; - /// The SQL type of the result of subtracting `Rhs` from `Self` - type Output; -} - -/// Represents SQL types which can be multiplied. -pub trait Mul { - /// The SQL type which this can be multiplied by - type Rhs; - /// The SQL type of the result of multiplying `Self` by `Rhs` - type Output; -} - -/// Represents SQL types which can be divided. -pub trait Div { - /// The SQL type which this one can be divided by - type Rhs; - /// The SQL type of the result of dividing `Self` by `Rhs` - type Output; -} - -macro_rules! numeric_type { - ($($tpe: ident),*) => { - $( - impl Add for $tpe { - type Rhs = $tpe; - type Output = $tpe; - } - - impl Sub for $tpe { - type Rhs = $tpe; - type Output = $tpe; - } - - impl Mul for $tpe { - type Rhs = $tpe; - type Output = $tpe; - } - - impl Div for $tpe { - type Rhs = $tpe; - type Output = $tpe; - } - )* - } -} - -numeric_type!(SmallInt, Integer, BigInt, Float, Double, Numeric); - -impl Add for Time { - type Rhs = Interval; - type Output = Time; -} - -impl Sub for Time { - type Rhs = Interval; - type Output = Time; -} - -impl Add for Date { - type Rhs = Interval; - type Output = Timestamp; -} - -impl Sub for Date { - type Rhs = Interval; - type Output = Timestamp; -} - -impl Add for Timestamp { - type Rhs = Interval; - type Output = Timestamp; -} - -impl Sub for Timestamp { - type Rhs = Interval; - type Output = Timestamp; -} - -impl Add for Interval { - type Rhs = Interval; - type Output = Interval; -} - -impl Sub for Interval { - type Rhs = Interval; - type Output = Interval; -} - -impl Mul for Interval { - type Rhs = Integer; - type Output = Interval; -} - -impl Div for Interval { - type Rhs = Integer; - type Output = Interval; -} - -impl Add for Nullable -where - T: Add + NotNull, - T::Rhs: NotNull, - T::Output: NotNull, -{ - type Rhs = Nullable; - type Output = Nullable; -} - -impl Sub for Nullable -where - T: Sub + NotNull, - T::Rhs: NotNull, - T::Output: NotNull, -{ - type Rhs = Nullable; - type Output = Nullable; -} - -impl Mul for Nullable -where - T: Mul + NotNull, - T::Rhs: NotNull, - T::Output: NotNull, -{ - type Rhs = Nullable; - type Output = Nullable; -} - -impl Div for Nullable -where - T: Div + NotNull, - T::Rhs: NotNull, - T::Output: NotNull, -{ - type Rhs = Nullable; - type Output = Nullable; -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/sql_types/ord.rs b/collector/compile-benchmarks/diesel-1.4.8/src/sql_types/ord.rs deleted file mode 100644 index d1a6b2371..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/sql_types/ord.rs +++ /dev/null @@ -1,28 +0,0 @@ -use sql_types::{self, NotNull}; - -/// Marker trait for types which can be used with `MAX` and `MIN` -pub trait SqlOrd {} - -impl SqlOrd for sql_types::SmallInt {} -impl SqlOrd for sql_types::Integer {} -impl SqlOrd for sql_types::BigInt {} -impl SqlOrd for sql_types::Float {} -impl SqlOrd for sql_types::Double {} -impl SqlOrd for sql_types::Text {} -impl SqlOrd for sql_types::Date {} -impl SqlOrd for sql_types::Interval {} -impl SqlOrd for sql_types::Time {} -impl SqlOrd for sql_types::Timestamp {} -impl SqlOrd for sql_types::Nullable {} - -#[cfg(feature = "postgres")] -impl SqlOrd for sql_types::Timestamptz {} -#[cfg(feature = "postgres")] -impl SqlOrd for sql_types::Array {} - -#[cfg(feature = "mysql")] -impl SqlOrd for sql_types::Unsigned {} -#[cfg(feature = "mysql")] -impl SqlOrd for sql_types::Unsigned {} -#[cfg(feature = "mysql")] -impl SqlOrd for sql_types::Unsigned {} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/backend.rs b/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/backend.rs deleted file mode 100644 index 8e68662dc..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/backend.rs +++ /dev/null @@ -1,53 +0,0 @@ -//! The SQLite backend -use byteorder::NativeEndian; - -use super::connection::SqliteValue; -use super::query_builder::SqliteQueryBuilder; -use backend::*; -use query_builder::bind_collector::RawBytesBindCollector; -use sql_types::TypeMetadata; - -/// The SQLite backend -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct Sqlite; - -/// Determines how a bind parameter is given to SQLite -/// -/// Diesel deals with bind parameters after serialization as opaque blobs of -/// bytes. However, SQLite instead has several functions where it expects the -/// relevant C types. -/// -/// The variants of this struct determine what bytes are expected from -/// `ToSql` impls. -#[allow(missing_debug_implementations)] -#[derive(Hash, PartialEq, Eq, Clone, Copy)] -pub enum SqliteType { - /// Bind using `sqlite3_bind_blob` - Binary, - /// Bind using `sqlite3_bind_text` - Text, - /// `bytes` should contain an `f32` - Float, - /// `bytes` should contain an `f64` - Double, - /// `bytes` should contain an `i16` - SmallInt, - /// `bytes` should contain an `i32` - Integer, - /// `bytes` should contain an `i64` - Long, -} - -impl Backend for Sqlite { - type QueryBuilder = SqliteQueryBuilder; - type BindCollector = RawBytesBindCollector; - type RawValue = SqliteValue; - type ByteOrder = NativeEndian; -} - -impl TypeMetadata for Sqlite { - type TypeMetadata = SqliteType; - type MetadataLookup = (); -} - -impl UsesAnsiSavepointSyntax for Sqlite {} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/diesel_manage_updated_at.sql b/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/diesel_manage_updated_at.sql deleted file mode 100644 index 83c3d33d4..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/diesel_manage_updated_at.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TRIGGER __diesel_manage_updated_at_{table_name} -AFTER UPDATE ON {table_name} -FOR EACH ROW WHEN - old.updated_at IS NULL AND - new.updated_at IS NULL OR - old.updated_at == new.updated_at -BEGIN - UPDATE {table_name} - SET updated_at = CURRENT_TIMESTAMP - WHERE ROWID = new.ROWID; -END diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/functions.rs b/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/functions.rs deleted file mode 100644 index 20c82f0da..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/functions.rs +++ /dev/null @@ -1,73 +0,0 @@ -extern crate libsqlite3_sys as ffi; - -use super::raw::RawConnection; -use super::serialized_value::SerializedValue; -use super::{Sqlite, SqliteValue}; -use deserialize::{FromSqlRow, Queryable}; -use result::{DatabaseErrorKind, Error, QueryResult}; -use row::Row; -use serialize::{IsNull, Output, ToSql}; -use sql_types::HasSqlType; - -pub fn register( - conn: &RawConnection, - fn_name: &str, - deterministic: bool, - mut f: F, -) -> QueryResult<()> -where - F: FnMut(&RawConnection, Args) -> Ret + Send + 'static, - Args: Queryable, - Ret: ToSql, - Sqlite: HasSqlType, -{ - let fields_needed = Args::Row::FIELDS_NEEDED; - if fields_needed > 127 { - return Err(Error::DatabaseError( - DatabaseErrorKind::UnableToSendCommand, - Box::new("SQLite functions cannot take more than 127 parameters".to_string()), - )); - } - - conn.register_sql_function(fn_name, fields_needed, deterministic, move |conn, args| { - let mut row = FunctionRow { args }; - let args_row = Args::Row::build_from_row(&mut row).map_err(Error::DeserializationError)?; - let args = Args::build(args_row); - - let result = f(conn, args); - - let mut buf = Output::new(Vec::new(), &()); - let is_null = result.to_sql(&mut buf).map_err(Error::SerializationError)?; - - let bytes = if let IsNull::Yes = is_null { - None - } else { - Some(buf.into_inner()) - }; - - Ok(SerializedValue { - ty: Sqlite::metadata(&()), - data: bytes, - }) - })?; - Ok(()) -} - -struct FunctionRow<'a> { - args: &'a [*mut ffi::sqlite3_value], -} - -impl<'a> Row for FunctionRow<'a> { - fn take(&mut self) -> Option<&SqliteValue> { - self.args.split_first().and_then(|(&first, rest)| { - self.args = rest; - unsafe { SqliteValue::new(first) } - }) - } - - fn next_is_null(&self, count: usize) -> bool { - self.args[..count] - .iter() - .all(|&p| unsafe { SqliteValue::new(p) }.is_none()) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/mod.rs deleted file mode 100644 index ed2fc7e16..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/mod.rs +++ /dev/null @@ -1,375 +0,0 @@ -extern crate libsqlite3_sys as ffi; - -mod functions; -#[doc(hidden)] -pub mod raw; -mod serialized_value; -mod sqlite_value; -mod statement_iterator; -mod stmt; - -pub use self::sqlite_value::SqliteValue; - -use std::os::raw as libc; - -use self::raw::RawConnection; -use self::statement_iterator::*; -use self::stmt::{Statement, StatementUse}; -use connection::*; -use deserialize::{Queryable, QueryableByName}; -use query_builder::bind_collector::RawBytesBindCollector; -use query_builder::*; -use result::*; -use serialize::ToSql; -use sql_types::HasSqlType; -use sqlite::Sqlite; - -/// Connections for the SQLite backend. Unlike other backends, "connection URLs" -/// for SQLite are file paths, [URIs](https://sqlite.org/uri.html), or special -/// identifiers like `:memory:`. -#[allow(missing_debug_implementations)] -pub struct SqliteConnection { - statement_cache: StatementCache, - raw_connection: RawConnection, - transaction_manager: AnsiTransactionManager, -} - -// This relies on the invariant that RawConnection or Statement are never -// leaked. If a reference to one of those was held on a different thread, this -// would not be thread safe. -unsafe impl Send for SqliteConnection {} - -impl SimpleConnection for SqliteConnection { - fn batch_execute(&self, query: &str) -> QueryResult<()> { - self.raw_connection.exec(query) - } -} - -impl Connection for SqliteConnection { - type Backend = Sqlite; - type TransactionManager = AnsiTransactionManager; - - fn establish(database_url: &str) -> ConnectionResult { - use result::ConnectionError::CouldntSetupConfiguration; - - let raw_connection = RawConnection::establish(database_url)?; - let conn = Self { - statement_cache: StatementCache::new(), - raw_connection, - transaction_manager: AnsiTransactionManager::new(), - }; - conn.register_diesel_sql_functions() - .map_err(CouldntSetupConfiguration)?; - Ok(conn) - } - - #[doc(hidden)] - fn execute(&self, query: &str) -> QueryResult { - self.batch_execute(query)?; - Ok(self.raw_connection.rows_affected_by_last_query()) - } - - #[doc(hidden)] - fn query_by_index(&self, source: T) -> QueryResult> - where - T: AsQuery, - T::Query: QueryFragment + QueryId, - Self::Backend: HasSqlType, - U: Queryable, - { - let mut statement = self.prepare_query(&source.as_query())?; - let statement_use = StatementUse::new(&mut statement); - let iter = StatementIterator::new(statement_use); - iter.collect() - } - - #[doc(hidden)] - fn query_by_name(&self, source: &T) -> QueryResult> - where - T: QueryFragment + QueryId, - U: QueryableByName, - { - let mut statement = self.prepare_query(source)?; - let statement_use = StatementUse::new(&mut statement); - let iter = NamedStatementIterator::new(statement_use)?; - iter.collect() - } - - #[doc(hidden)] - fn execute_returning_count(&self, source: &T) -> QueryResult - where - T: QueryFragment + QueryId, - { - let mut statement = self.prepare_query(source)?; - let mut statement_use = StatementUse::new(&mut statement); - statement_use.run()?; - Ok(self.raw_connection.rows_affected_by_last_query()) - } - - #[doc(hidden)] - fn transaction_manager(&self) -> &Self::TransactionManager { - &self.transaction_manager - } -} - -impl SqliteConnection { - /// Run a transaction with `BEGIN IMMEDIATE` - /// - /// This method will return an error if a transaction is already open. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # let conn = SqliteConnection::establish(":memory:").unwrap(); - /// conn.immediate_transaction(|| { - /// // Do stuff in a transaction - /// Ok(()) - /// }) - /// # } - /// ``` - pub fn immediate_transaction(&self, f: F) -> Result - where - F: FnOnce() -> Result, - E: From, - { - self.transaction_sql(f, "BEGIN IMMEDIATE") - } - - /// Run a transaction with `BEGIN EXCLUSIVE` - /// - /// This method will return an error if a transaction is already open. - /// - /// # Example - /// - /// ```rust - /// # #[macro_use] extern crate diesel; - /// # include!("../../doctest_setup.rs"); - /// # - /// # fn main() { - /// # run_test().unwrap(); - /// # } - /// # - /// # fn run_test() -> QueryResult<()> { - /// # let conn = SqliteConnection::establish(":memory:").unwrap(); - /// conn.exclusive_transaction(|| { - /// // Do stuff in a transaction - /// Ok(()) - /// }) - /// # } - /// ``` - pub fn exclusive_transaction(&self, f: F) -> Result - where - F: FnOnce() -> Result, - E: From, - { - self.transaction_sql(f, "BEGIN EXCLUSIVE") - } - - fn transaction_sql(&self, f: F, sql: &str) -> Result - where - F: FnOnce() -> Result, - E: From, - { - let transaction_manager = self.transaction_manager(); - - transaction_manager.begin_transaction_sql(self, sql)?; - match f() { - Ok(value) => { - transaction_manager.commit_transaction(self)?; - Ok(value) - } - Err(e) => { - transaction_manager.rollback_transaction(self)?; - Err(e) - } - } - } - - fn prepare_query + QueryId>( - &self, - source: &T, - ) -> QueryResult> { - let mut statement = self.cached_prepared_statement(source)?; - - let mut bind_collector = RawBytesBindCollector::::new(); - source.collect_binds(&mut bind_collector, &())?; - let metadata = bind_collector.metadata; - let binds = bind_collector.binds; - for (tpe, value) in metadata.into_iter().zip(binds) { - statement.bind(tpe, value)?; - } - - Ok(statement) - } - - fn cached_prepared_statement + QueryId>( - &self, - source: &T, - ) -> QueryResult> { - self.statement_cache.cached_statement(source, &[], |sql| { - Statement::prepare(&self.raw_connection, sql) - }) - } - - #[doc(hidden)] - pub fn register_sql_function( - &self, - fn_name: &str, - deterministic: bool, - mut f: F, - ) -> QueryResult<()> - where - F: FnMut(Args) -> Ret + Send + 'static, - Args: Queryable, - Ret: ToSql, - Sqlite: HasSqlType, - { - functions::register( - &self.raw_connection, - fn_name, - deterministic, - move |_, args| f(args), - ) - } - - fn register_diesel_sql_functions(&self) -> QueryResult<()> { - use sql_types::{Integer, Text}; - - functions::register::( - &self.raw_connection, - "diesel_manage_updated_at", - false, - |conn, table_name: String| { - conn.exec(&format!( - include_str!("diesel_manage_updated_at.sql"), - table_name = table_name - )) - .expect("Failed to create trigger"); - 0 // have to return *something* - }, - ) - } -} - -fn error_message(err_code: libc::c_int) -> &'static str { - ffi::code_to_str(err_code) -} - -#[cfg(test)] -mod tests { - use super::*; - use dsl::sql; - use prelude::*; - use sql_types::Integer; - - #[test] - fn prepared_statements_are_cached_when_run() { - let connection = SqliteConnection::establish(":memory:").unwrap(); - let query = ::select(1.into_sql::()); - - assert_eq!(Ok(1), query.get_result(&connection)); - assert_eq!(Ok(1), query.get_result(&connection)); - assert_eq!(1, connection.statement_cache.len()); - } - - #[test] - fn sql_literal_nodes_are_not_cached() { - let connection = SqliteConnection::establish(":memory:").unwrap(); - let query = ::select(sql::("1")); - - assert_eq!(Ok(1), query.get_result(&connection)); - assert_eq!(0, connection.statement_cache.len()); - } - - #[test] - fn queries_containing_sql_literal_nodes_are_not_cached() { - let connection = SqliteConnection::establish(":memory:").unwrap(); - let one_as_expr = 1.into_sql::(); - let query = ::select(one_as_expr.eq(sql::("1"))); - - assert_eq!(Ok(true), query.get_result(&connection)); - assert_eq!(0, connection.statement_cache.len()); - } - - #[test] - fn queries_containing_in_with_vec_are_not_cached() { - let connection = SqliteConnection::establish(":memory:").unwrap(); - let one_as_expr = 1.into_sql::(); - let query = ::select(one_as_expr.eq_any(vec![1, 2, 3])); - - assert_eq!(Ok(true), query.get_result(&connection)); - assert_eq!(0, connection.statement_cache.len()); - } - - #[test] - fn queries_containing_in_with_subselect_are_cached() { - let connection = SqliteConnection::establish(":memory:").unwrap(); - let one_as_expr = 1.into_sql::(); - let query = ::select(one_as_expr.eq_any(::select(one_as_expr))); - - assert_eq!(Ok(true), query.get_result(&connection)); - assert_eq!(1, connection.statement_cache.len()); - } - - use sql_types::Text; - sql_function!(fn fun_case(x: Text) -> Text); - - #[test] - fn register_custom_function() { - let connection = SqliteConnection::establish(":memory:").unwrap(); - fun_case::register_impl(&connection, |x: String| { - x.chars() - .enumerate() - .map(|(i, c)| { - if i % 2 == 0 { - c.to_lowercase().to_string() - } else { - c.to_uppercase().to_string() - } - }) - .collect::() - }) - .unwrap(); - - let mapped_string = ::select(fun_case("foobar")) - .get_result::(&connection) - .unwrap(); - assert_eq!("fOoBaR", mapped_string); - } - - sql_function!(fn my_add(x: Integer, y: Integer) -> Integer); - - #[test] - fn register_multiarg_function() { - let connection = SqliteConnection::establish(":memory:").unwrap(); - my_add::register_impl(&connection, |x: i32, y: i32| x + y).unwrap(); - - let added = ::select(my_add(1, 2)).get_result::(&connection); - assert_eq!(Ok(3), added); - } - - sql_function!(fn add_counter(x: Integer) -> Integer); - - #[test] - fn register_nondeterministic_function() { - let connection = SqliteConnection::establish(":memory:").unwrap(); - let mut y = 0; - add_counter::register_nondeterministic_impl(&connection, move |x: i32| { - y += 1; - x + y - }) - .unwrap(); - - let added = ::select((add_counter(1), add_counter(1), add_counter(1))) - .get_result::<(i32, i32, i32)>(&connection); - assert_eq!(Ok((2, 3, 4)), added); - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/raw.rs b/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/raw.rs deleted file mode 100644 index 820a51ec7..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/raw.rs +++ /dev/null @@ -1,205 +0,0 @@ -extern crate libsqlite3_sys as ffi; - -use std::ffi::{CStr, CString}; -use std::io::{stderr, Write}; -use std::os::raw as libc; -use std::ptr::NonNull; -use std::{mem, ptr, slice, str}; - -use super::serialized_value::SerializedValue; -use result::Error::DatabaseError; -use result::*; - -#[allow(missing_debug_implementations, missing_copy_implementations)] -pub struct RawConnection { - pub(crate) internal_connection: NonNull, -} - -impl RawConnection { - pub fn establish(database_url: &str) -> ConnectionResult { - let mut conn_pointer = ptr::null_mut(); - let database_url = CString::new(database_url)?; - let connection_status = - unsafe { ffi::sqlite3_open(database_url.as_ptr(), &mut conn_pointer) }; - - match connection_status { - ffi::SQLITE_OK => { - let conn_pointer = unsafe { NonNull::new_unchecked(conn_pointer) }; - Ok(RawConnection { - internal_connection: conn_pointer, - }) - } - err_code => { - let message = super::error_message(err_code); - Err(ConnectionError::BadConnection(message.into())) - } - } - } - - pub fn exec(&self, query: &str) -> QueryResult<()> { - let mut err_msg = ptr::null_mut(); - let query = CString::new(query)?; - let callback_fn = None; - let callback_arg = ptr::null_mut(); - unsafe { - ffi::sqlite3_exec( - self.internal_connection.as_ptr(), - query.as_ptr(), - callback_fn, - callback_arg, - &mut err_msg, - ); - } - - if err_msg.is_null() { - Ok(()) - } else { - let msg = convert_to_string_and_free(err_msg); - let error_kind = DatabaseErrorKind::__Unknown; - Err(DatabaseError(error_kind, Box::new(msg))) - } - } - - pub fn rows_affected_by_last_query(&self) -> usize { - unsafe { ffi::sqlite3_changes(self.internal_connection.as_ptr()) as usize } - } - - pub fn register_sql_function( - &self, - fn_name: &str, - num_args: usize, - deterministic: bool, - f: F, - ) -> QueryResult<()> - where - F: FnMut(&Self, &[*mut ffi::sqlite3_value]) -> QueryResult - + Send - + 'static, - { - let fn_name = CString::new(fn_name)?; - let mut flags = ffi::SQLITE_UTF8; - if deterministic { - flags |= ffi::SQLITE_DETERMINISTIC; - } - let callback_fn = Box::into_raw(Box::new(f)); - - let result = unsafe { - ffi::sqlite3_create_function_v2( - self.internal_connection.as_ptr(), - fn_name.as_ptr(), - num_args as _, - flags, - callback_fn as *mut _, - Some(run_custom_function::), - None, - None, - Some(destroy_boxed_fn::), - ) - }; - - if result == ffi::SQLITE_OK { - Ok(()) - } else { - let error_message = super::error_message(result); - Err(DatabaseError( - DatabaseErrorKind::__Unknown, - Box::new(error_message.to_string()), - )) - } - } -} - -impl Drop for RawConnection { - fn drop(&mut self) { - use std::thread::panicking; - - let close_result = unsafe { ffi::sqlite3_close(self.internal_connection.as_ptr()) }; - if close_result != ffi::SQLITE_OK { - let error_message = super::error_message(close_result); - if panicking() { - write!( - stderr(), - "Error closing SQLite connection: {}", - error_message - ) - .expect("Error writing to `stderr`"); - } else { - panic!("Error closing SQLite connection: {}", error_message); - } - } - } -} - -fn convert_to_string_and_free(err_msg: *const libc::c_char) -> String { - let msg = unsafe { - let bytes = CStr::from_ptr(err_msg).to_bytes(); - // sqlite is documented to return utf8 strings here - str::from_utf8_unchecked(bytes).into() - }; - unsafe { ffi::sqlite3_free(err_msg as *mut libc::c_void) }; - msg -} - -#[allow(warnings)] -extern "C" fn run_custom_function( - ctx: *mut ffi::sqlite3_context, - num_args: libc::c_int, - value_ptr: *mut *mut ffi::sqlite3_value, -) where - F: FnMut(&RawConnection, &[*mut ffi::sqlite3_value]) -> QueryResult - + Send - + 'static, -{ - static NULL_DATA_ERR: &str = "An unknown error occurred. sqlite3_user_data returned a null pointer. This should never happen."; - static NULL_CONN_ERR: &str = "An unknown error occurred. sqlite3_context_db_handle returned a null pointer. This should never happen."; - - unsafe { - let data_ptr = ffi::sqlite3_user_data(ctx); - let data_ptr = data_ptr as *mut F; - let f = match data_ptr.as_mut() { - Some(f) => f, - None => { - ffi::sqlite3_result_error( - ctx, - NULL_DATA_ERR.as_ptr() as *const _ as *const _, - NULL_DATA_ERR.len() as _, - ); - return; - } - }; - - let args = slice::from_raw_parts(value_ptr, num_args as _); - let conn = match NonNull::new(ffi::sqlite3_context_db_handle(ctx)) { - Some(conn) => RawConnection { - internal_connection: conn, - }, - None => { - ffi::sqlite3_result_error( - ctx, - NULL_DATA_ERR.as_ptr() as *const _ as *const _, - NULL_DATA_ERR.len() as _, - ); - return; - } - }; - match f(&conn, args) { - Ok(value) => value.result_of(ctx), - Err(e) => { - let msg = e.to_string(); - ffi::sqlite3_result_error(ctx, msg.as_ptr() as *const _, msg.len() as _); - } - } - - mem::forget(conn); - } -} - -extern "C" fn destroy_boxed_fn(data: *mut libc::c_void) -where - F: FnMut(&RawConnection, &[*mut ffi::sqlite3_value]) -> QueryResult - + Send - + 'static, -{ - let ptr = data as *mut F; - unsafe { Box::from_raw(ptr) }; -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/serialized_value.rs b/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/serialized_value.rs deleted file mode 100644 index 3356f1a69..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/serialized_value.rs +++ /dev/null @@ -1,113 +0,0 @@ -extern crate libsqlite3_sys as ffi; - -use std::os::raw as libc; -use std::ptr::{self, NonNull}; - -use sqlite::SqliteType; - -pub struct SerializedValue { - pub ty: SqliteType, - pub data: Option>, -} - -impl SerializedValue { - // We are always reading potentially misaligned pointers with - // `ptr::read_unaligned` - #[allow(clippy::cast_ptr_alignment)] - pub(crate) fn bind_to(self, stmt: NonNull, idx: libc::c_int) -> libc::c_int { - // This unsafe block assumes the following invariants: - // - // - `stmt` points to valid memory - // - If `self.ty` is anything other than `Binary` or `Text`, the appropriate - // number of bytes were written to `value` for an integer of the - // corresponding size. - unsafe { - match (self.ty, self.data) { - (_, None) => ffi::sqlite3_bind_null(stmt.as_ptr(), idx), - (SqliteType::Binary, Some(bytes)) => ffi::sqlite3_bind_blob( - stmt.as_ptr(), - idx, - bytes.as_ptr() as *const libc::c_void, - bytes.len() as libc::c_int, - ffi::SQLITE_TRANSIENT(), - ), - (SqliteType::Text, Some(bytes)) => ffi::sqlite3_bind_text( - stmt.as_ptr(), - idx, - bytes.as_ptr() as *const libc::c_char, - bytes.len() as libc::c_int, - ffi::SQLITE_TRANSIENT(), - ), - (SqliteType::Float, Some(bytes)) => { - let value = ptr::read_unaligned(bytes.as_ptr() as *const f32); - ffi::sqlite3_bind_double(stmt.as_ptr(), idx, libc::c_double::from(value)) - } - (SqliteType::Double, Some(bytes)) => { - let value = ptr::read_unaligned(bytes.as_ptr() as *const f64); - ffi::sqlite3_bind_double(stmt.as_ptr(), idx, value as libc::c_double) - } - (SqliteType::SmallInt, Some(bytes)) => { - let value = ptr::read_unaligned(bytes.as_ptr() as *const i16); - ffi::sqlite3_bind_int(stmt.as_ptr(), idx, libc::c_int::from(value)) - } - (SqliteType::Integer, Some(bytes)) => { - let value = ptr::read_unaligned(bytes.as_ptr() as *const i32); - ffi::sqlite3_bind_int(stmt.as_ptr(), idx, value as libc::c_int) - } - (SqliteType::Long, Some(bytes)) => { - let value = ptr::read_unaligned(bytes.as_ptr() as *const i64); - ffi::sqlite3_bind_int64(stmt.as_ptr(), idx, value) - } - } - } - } - - // We are always reading potentially misaligned pointers with - // `ptr::read_unaligned` - #[allow(clippy::cast_ptr_alignment)] - pub fn result_of(self, ctx: *mut ffi::sqlite3_context) { - // This unsafe block assumes the following invariants: - // - // - `ctx` points to valid memory - // - If `self.ty` is anything other than `Binary` or `Text`, the appropriate - // number of bytes were written to `self.data` for an integer of the - // corresponding size. - unsafe { - match (self.ty, self.data) { - (_, None) => ffi::sqlite3_result_null(ctx), - (SqliteType::Binary, Some(bytes)) => ffi::sqlite3_result_blob( - ctx, - bytes.as_ptr() as *const libc::c_void, - bytes.len() as libc::c_int, - ffi::SQLITE_TRANSIENT(), - ), - (SqliteType::Text, Some(bytes)) => ffi::sqlite3_result_text( - ctx, - bytes.as_ptr() as *const libc::c_char, - bytes.len() as libc::c_int, - ffi::SQLITE_TRANSIENT(), - ), - (SqliteType::Float, Some(bytes)) => { - let value = ptr::read_unaligned(bytes.as_ptr() as *const f32); - ffi::sqlite3_result_double(ctx, libc::c_double::from(value)) - } - (SqliteType::Double, Some(bytes)) => { - let value = ptr::read_unaligned(bytes.as_ptr() as *const f64); - ffi::sqlite3_result_double(ctx, value as libc::c_double) - } - (SqliteType::SmallInt, Some(bytes)) => { - let value = ptr::read_unaligned(bytes.as_ptr() as *const i16); - ffi::sqlite3_result_int(ctx, libc::c_int::from(value)) - } - (SqliteType::Integer, Some(bytes)) => { - let value = ptr::read_unaligned(bytes.as_ptr() as *const i32); - ffi::sqlite3_result_int(ctx, value as libc::c_int) - } - (SqliteType::Long, Some(bytes)) => { - let value = ptr::read_unaligned(bytes.as_ptr() as *const i64); - ffi::sqlite3_result_int64(ctx, value) - } - } - } - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/sqlite_value.rs b/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/sqlite_value.rs deleted file mode 100644 index c29a18f5e..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/sqlite_value.rs +++ /dev/null @@ -1,126 +0,0 @@ -extern crate libsqlite3_sys as ffi; - -use std::collections::HashMap; -use std::os::raw as libc; -use std::ptr::NonNull; -use std::{slice, str}; - -use row::*; -use sqlite::Sqlite; - -#[allow(missing_debug_implementations, missing_copy_implementations)] -pub struct SqliteValue { - value: ffi::sqlite3_value, -} - -pub struct SqliteRow { - stmt: NonNull, - next_col_index: libc::c_int, -} - -impl SqliteValue { - #[allow(clippy::new_ret_no_self)] - pub(crate) unsafe fn new<'a>(inner: *mut ffi::sqlite3_value) -> Option<&'a Self> { - (inner as *const _ as *const Self).as_ref().and_then(|v| { - if v.is_null() { - None - } else { - Some(v) - } - }) - } - - pub fn read_text(&self) -> &str { - unsafe { - let ptr = ffi::sqlite3_value_text(self.value()); - let len = ffi::sqlite3_value_bytes(self.value()); - let bytes = slice::from_raw_parts(ptr as *const u8, len as usize); - // The string is guaranteed to be utf8 according to - // https://www.sqlite.org/c3ref/value_blob.html - str::from_utf8_unchecked(bytes) - } - } - - pub fn read_blob(&self) -> &[u8] { - unsafe { - let ptr = ffi::sqlite3_value_blob(self.value()); - let len = ffi::sqlite3_value_bytes(self.value()); - slice::from_raw_parts(ptr as *const u8, len as usize) - } - } - - pub fn read_integer(&self) -> i32 { - unsafe { ffi::sqlite3_value_int(self.value()) as i32 } - } - - pub fn read_long(&self) -> i64 { - unsafe { ffi::sqlite3_value_int64(self.value()) as i64 } - } - - pub fn read_double(&self) -> f64 { - unsafe { ffi::sqlite3_value_double(self.value()) as f64 } - } - - pub fn is_null(&self) -> bool { - let tpe = unsafe { ffi::sqlite3_value_type(self.value()) }; - tpe == ffi::SQLITE_NULL - } - - fn value(&self) -> *mut ffi::sqlite3_value { - &self.value as *const _ as _ - } -} - -impl SqliteRow { - pub(crate) fn new(inner_statement: NonNull) -> Self { - SqliteRow { - stmt: inner_statement, - next_col_index: 0, - } - } - - pub fn into_named<'a>(self, indices: &'a HashMap<&'a str, usize>) -> SqliteNamedRow<'a> { - SqliteNamedRow { - stmt: self.stmt, - column_indices: indices, - } - } -} - -impl Row for SqliteRow { - fn take(&mut self) -> Option<&SqliteValue> { - let col_index = self.next_col_index; - self.next_col_index += 1; - - unsafe { - let ptr = ffi::sqlite3_column_value(self.stmt.as_ptr(), col_index); - SqliteValue::new(ptr) - } - } - - fn next_is_null(&self, count: usize) -> bool { - (0..count).all(|i| { - let idx = self.next_col_index + i as libc::c_int; - let tpe = unsafe { ffi::sqlite3_column_type(self.stmt.as_ptr(), idx) }; - tpe == ffi::SQLITE_NULL - }) - } -} - -pub struct SqliteNamedRow<'a> { - stmt: NonNull, - column_indices: &'a HashMap<&'a str, usize>, -} - -impl<'a> NamedRow for SqliteNamedRow<'a> { - fn index_of(&self, column_name: &str) -> Option { - self.column_indices.get(column_name).cloned() - } - - fn get_raw_value(&self, idx: usize) -> Option<&SqliteValue> { - unsafe { - let ptr = ffi::sqlite3_column_value(self.stmt.as_ptr(), idx as libc::c_int); - SqliteValue::new(ptr) - } - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/statement_iterator.rs b/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/statement_iterator.rs deleted file mode 100644 index 0073a679c..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/statement_iterator.rs +++ /dev/null @@ -1,106 +0,0 @@ -use std::collections::HashMap; -use std::marker::PhantomData; - -use super::stmt::StatementUse; -use deserialize::{FromSqlRow, Queryable, QueryableByName}; -use result::Error::DeserializationError; -use result::QueryResult; -use sqlite::Sqlite; - -pub struct StatementIterator<'a, ST, T> { - stmt: StatementUse<'a>, - _marker: PhantomData<(ST, T)>, -} - -impl<'a, ST, T> StatementIterator<'a, ST, T> { - pub fn new(stmt: StatementUse<'a>) -> Self { - StatementIterator { - stmt: stmt, - _marker: PhantomData, - } - } -} - -impl<'a, ST, T> Iterator for StatementIterator<'a, ST, T> -where - T: Queryable, -{ - type Item = QueryResult; - - fn next(&mut self) -> Option { - let row = match self.stmt.step() { - Ok(row) => row, - Err(e) => return Some(Err(e)), - }; - row.map(|mut row| { - T::Row::build_from_row(&mut row) - .map(T::build) - .map_err(DeserializationError) - }) - } -} - -pub struct NamedStatementIterator<'a, T> { - stmt: StatementUse<'a>, - // The actual lifetime of the stored column name is - // not really `'a`, but it's impossible to have a better - // fitting lifetime here. - // See the `Statement::field_name` method for details - // how long the underlying livetime is valid - column_indices: Option>, - _marker: PhantomData, -} - -impl<'a, T> NamedStatementIterator<'a, T> { - #[allow(clippy::new_ret_no_self)] - pub fn new(stmt: StatementUse<'a>) -> QueryResult { - Ok(NamedStatementIterator { - stmt, - column_indices: None, - _marker: PhantomData, - }) - } - - fn populate_column_indices(&mut self) -> QueryResult<()> { - let column_indices = (0..self.stmt.num_fields()) - .filter_map(|i| { - self.stmt.field_name(i).map(|column| { - let column = column - .to_str() - .map_err(|e| DeserializationError(e.into()))?; - Ok((column, i)) - }) - }) - .collect::>()?; - - self.column_indices = Some(column_indices); - Ok(()) - } -} - -impl<'a, T> Iterator for NamedStatementIterator<'a, T> -where - T: QueryableByName, -{ - type Item = QueryResult; - - fn next(&mut self) -> Option { - let row = match self.stmt.step() { - Ok(row) => row, - Err(e) => return Some(Err(e)), - }; - if self.column_indices.is_none() { - if let Err(e) = self.populate_column_indices() { - return Some(Err(e)); - } - } - row.map(|row| { - let row = row.into_named( - self.column_indices - .as_ref() - .expect("it's there because we populated it above"), - ); - T::build(&row).map_err(DeserializationError) - }) - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/stmt.rs b/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/stmt.rs deleted file mode 100644 index 206bad766..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/connection/stmt.rs +++ /dev/null @@ -1,180 +0,0 @@ -extern crate libsqlite3_sys as ffi; - -use std::ffi::{CStr, CString}; -use std::io::{stderr, Write}; -use std::os::raw as libc; -use std::ptr::{self, NonNull}; - -use super::raw::RawConnection; -use super::serialized_value::SerializedValue; -use super::sqlite_value::SqliteRow; -use result::Error::DatabaseError; -use result::*; -use sqlite::SqliteType; - -pub struct Statement { - inner_statement: NonNull, - bind_index: libc::c_int, -} - -impl Statement { - pub fn prepare(raw_connection: &RawConnection, sql: &str) -> QueryResult { - let mut stmt = ptr::null_mut(); - let mut unused_portion = ptr::null(); - let prepare_result = unsafe { - ffi::sqlite3_prepare_v2( - raw_connection.internal_connection.as_ptr(), - CString::new(sql)?.as_ptr(), - sql.len() as libc::c_int, - &mut stmt, - &mut unused_portion, - ) - }; - - ensure_sqlite_ok(prepare_result, raw_connection.internal_connection.as_ptr()).map(|_| { - Statement { - inner_statement: unsafe { NonNull::new_unchecked(stmt) }, - bind_index: 0, - } - }) - } - - fn run(&mut self) -> QueryResult<()> { - self.step().map(|_| ()) - } - - pub fn bind(&mut self, tpe: SqliteType, value: Option>) -> QueryResult<()> { - self.bind_index += 1; - let value = SerializedValue { - ty: tpe, - data: value, - }; - let result = value.bind_to(self.inner_statement, self.bind_index); - - ensure_sqlite_ok(result, self.raw_connection()) - } - - fn num_fields(&self) -> usize { - unsafe { ffi::sqlite3_column_count(self.inner_statement.as_ptr()) as usize } - } - - /// The lifetime of the returned CStr is shorter than self. - /// - /// > The returned string pointer is valid until either the prepared statement - /// > is destroyed by sqlite3_finalize() or until the statement is automatically - /// > reprepared by the first call to sqlite3_step() for a particular - /// > run or until the next call to sqlite3_column_name() - /// > or sqlite3_column_name16() on the same column. - /// - /// https://www.sqlite.org/c3ref/column_name.html - unsafe fn field_name<'a, 'b: 'a>(&'a self, idx: usize) -> Option<&'b CStr> { - let ptr = ffi::sqlite3_column_name(self.inner_statement.as_ptr(), idx as libc::c_int); - if ptr.is_null() { - None - } else { - Some(CStr::from_ptr(ptr)) - } - } - - fn step(&mut self) -> QueryResult> { - match unsafe { ffi::sqlite3_step(self.inner_statement.as_ptr()) } { - ffi::SQLITE_DONE => Ok(None), - ffi::SQLITE_ROW => Ok(Some(SqliteRow::new(self.inner_statement))), - _ => Err(last_error(self.raw_connection())), - } - } - - fn reset(&mut self) { - self.bind_index = 0; - unsafe { ffi::sqlite3_reset(self.inner_statement.as_ptr()) }; - } - - fn raw_connection(&self) -> *mut ffi::sqlite3 { - unsafe { ffi::sqlite3_db_handle(self.inner_statement.as_ptr()) } - } -} - -fn ensure_sqlite_ok(code: libc::c_int, raw_connection: *mut ffi::sqlite3) -> QueryResult<()> { - if code == ffi::SQLITE_OK { - Ok(()) - } else { - Err(last_error(raw_connection)) - } -} - -fn last_error(raw_connection: *mut ffi::sqlite3) -> Error { - let error_message = last_error_message(raw_connection); - let error_information = Box::new(error_message); - let error_kind = match last_error_code(raw_connection) { - ffi::SQLITE_CONSTRAINT_UNIQUE | ffi::SQLITE_CONSTRAINT_PRIMARYKEY => { - DatabaseErrorKind::UniqueViolation - } - ffi::SQLITE_CONSTRAINT_FOREIGNKEY => DatabaseErrorKind::ForeignKeyViolation, - _ => DatabaseErrorKind::__Unknown, - }; - DatabaseError(error_kind, error_information) -} - -fn last_error_message(conn: *mut ffi::sqlite3) -> String { - let c_str = unsafe { CStr::from_ptr(ffi::sqlite3_errmsg(conn)) }; - c_str.to_string_lossy().into_owned() -} - -fn last_error_code(conn: *mut ffi::sqlite3) -> libc::c_int { - unsafe { ffi::sqlite3_extended_errcode(conn) } -} - -impl Drop for Statement { - fn drop(&mut self) { - use std::thread::panicking; - - let raw_connection = self.raw_connection(); - let finalize_result = unsafe { ffi::sqlite3_finalize(self.inner_statement.as_ptr()) }; - if let Err(e) = ensure_sqlite_ok(finalize_result, raw_connection) { - if panicking() { - write!( - stderr(), - "Error finalizing SQLite prepared statement: {:?}", - e - ) - .expect("Error writing to `stderr`"); - } else { - panic!("Error finalizing SQLite prepared statement: {:?}", e); - } - } - } -} - -pub struct StatementUse<'a> { - statement: &'a mut Statement, -} - -impl<'a> StatementUse<'a> { - pub fn new(statement: &'a mut Statement) -> Self { - StatementUse { - statement: statement, - } - } - - pub fn run(&mut self) -> QueryResult<()> { - self.statement.run() - } - - pub fn step(&mut self) -> QueryResult> { - self.statement.step() - } - - pub fn num_fields(&self) -> usize { - self.statement.num_fields() - } - - pub fn field_name(&self, idx: usize) -> Option<&'a CStr> { - unsafe { self.statement.field_name(idx) } - } -} - -impl<'a> Drop for StatementUse<'a> { - fn drop(&mut self) { - self.statement.reset(); - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/mod.rs deleted file mode 100644 index 80b52999d..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/mod.rs +++ /dev/null @@ -1,15 +0,0 @@ -//! Provides types and functions related to working with SQLite -//! -//! Much of this module is re-exported from database agnostic locations. -//! However, if you are writing code specifically to extend Diesel on -//! SQLite, you may need to work with this module directly. - -mod backend; -mod connection; -mod types; - -pub mod query_builder; - -pub use self::backend::{Sqlite, SqliteType}; -pub use self::connection::SqliteConnection; -pub use self::query_builder::SqliteQueryBuilder; diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/query_builder/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/query_builder/mod.rs deleted file mode 100644 index 6c0caf594..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/query_builder/mod.rs +++ /dev/null @@ -1,40 +0,0 @@ -//! The SQLite query builder - -use super::backend::Sqlite; -use query_builder::QueryBuilder; -use result::QueryResult; - -/// Constructs SQL queries for use with the SQLite backend -#[allow(missing_debug_implementations)] -#[derive(Default)] -pub struct SqliteQueryBuilder { - sql: String, -} - -impl SqliteQueryBuilder { - /// Construct a new query builder with an empty query - pub fn new() -> Self { - SqliteQueryBuilder::default() - } -} - -impl QueryBuilder for SqliteQueryBuilder { - fn push_sql(&mut self, sql: &str) { - self.sql.push_str(sql); - } - - fn push_identifier(&mut self, identifier: &str) -> QueryResult<()> { - self.push_sql("`"); - self.push_sql(&identifier.replace("`", "``")); - self.push_sql("`"); - Ok(()) - } - - fn push_bind_param(&mut self) { - self.push_sql("?"); - } - - fn finish(self) -> String { - self.sql - } -} diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/types/date_and_time/chrono.rs b/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/types/date_and_time/chrono.rs deleted file mode 100644 index ecef954c1..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/sqlite/types/date_and_time/chrono.rs +++ /dev/null @@ -1,378 +0,0 @@ -extern crate chrono; - -use self::chrono::{NaiveDate, NaiveDateTime, NaiveTime}; -use std::io::Write; - -use backend::Backend; -use deserialize::{self, FromSql}; -use serialize::{self, Output, ToSql}; -use sql_types::{Date, Text, Time, Timestamp}; -use sqlite::Sqlite; - -const SQLITE_DATE_FORMAT: &str = "%F"; - -impl FromSql for NaiveDate { - fn from_sql(value: Option<&::RawValue>) -> deserialize::Result { - let text_ptr = <*const str as FromSql>::from_sql(value)?; - let text = unsafe { &*text_ptr }; - Self::parse_from_str(text, SQLITE_DATE_FORMAT).map_err(Into::into) - } -} - -impl ToSql for NaiveDate { - fn to_sql(&self, out: &mut Output) -> serialize::Result { - let s = self.format(SQLITE_DATE_FORMAT).to_string(); - ToSql::::to_sql(&s, out) - } -} - -impl FromSql for NaiveTime { - fn from_sql(value: Option<&::RawValue>) -> deserialize::Result { - let text_ptr = <*const str as FromSql>::from_sql(value)?; - let text = unsafe { &*text_ptr }; - let valid_time_formats = &[ - // Most likely - "%T%.f", // All other valid formats in order of documentation - "%R", "%RZ", "%T%.fZ", "%R%:z", "%T%.f%:z", - ]; - - for format in valid_time_formats { - if let Ok(time) = Self::parse_from_str(text, format) { - return Ok(time); - } - } - - Err(format!("Invalid time {}", text).into()) - } -} - -impl ToSql for NaiveTime { - fn to_sql(&self, out: &mut Output) -> serialize::Result { - let s = self.format("%T%.f").to_string(); - ToSql::::to_sql(&s, out) - } -} - -impl FromSql for NaiveDateTime { - fn from_sql(value: Option<&::RawValue>) -> deserialize::Result { - let text_ptr = <*const str as FromSql>::from_sql(value)?; - let text = unsafe { &*text_ptr }; - - let sqlite_datetime_formats = &[ - // Most likely format - "%F %T%.f", - // Other formats in order of appearance in docs - "%F %R", - "%F %RZ", - "%F %R%:z", - "%F %T%.fZ", - "%F %T%.f%:z", - "%FT%R", - "%FT%RZ", - "%FT%R%:z", - "%FT%T%.f", - "%FT%T%.fZ", - "%FT%T%.f%:z", - ]; - - for format in sqlite_datetime_formats { - if let Ok(dt) = Self::parse_from_str(text, format) { - return Ok(dt); - } - } - - if let Ok(julian_days) = text.parse::() { - let epoch_in_julian_days = 2_440_587.5; - let seconds_in_day = 86400.0; - let timestamp = (julian_days - epoch_in_julian_days) * seconds_in_day; - let seconds = timestamp as i64; - let nanos = (timestamp.fract() * 1E9) as u32; - if let Some(timestamp) = Self::from_timestamp_opt(seconds, nanos) { - return Ok(timestamp); - } - } - - Err(format!("Invalid datetime {}", text).into()) - } -} - -impl ToSql for NaiveDateTime { - fn to_sql(&self, out: &mut Output) -> serialize::Result { - let s = self.format("%F %T%.f").to_string(); - ToSql::::to_sql(&s, out) - } -} - -#[cfg(test)] -mod tests { - extern crate chrono; - extern crate dotenv; - - use self::chrono::{Duration, NaiveDate, NaiveDateTime, NaiveTime, Timelike, Utc}; - use self::dotenv::dotenv; - - use dsl::{now, sql}; - use prelude::*; - use select; - use sql_types::{Date, Text, Time, Timestamp}; - - sql_function!(fn datetime(x: Text) -> Timestamp); - sql_function!(fn time(x: Text) -> Time); - sql_function!(fn date(x: Text) -> Date); - - fn connection() -> SqliteConnection { - dotenv().ok(); - - let connection_url = ::std::env::var("SQLITE_DATABASE_URL") - .or_else(|_| ::std::env::var("DATABASE_URL")) - .expect("DATABASE_URL must be set in order to run tests"); - SqliteConnection::establish(&connection_url).unwrap() - } - - #[test] - fn unix_epoch_encodes_correctly() { - let connection = connection(); - let time = NaiveDate::from_ymd(1970, 1, 1).and_hms(0, 0, 0); - let query = select(datetime("1970-01-01 00:00:00.000000").eq(time)); - assert_eq!(Ok(true), query.get_result(&connection)); - } - - #[test] - fn unix_epoch_decodes_correctly_in_all_possible_formats() { - let connection = connection(); - let time = NaiveDate::from_ymd(1970, 1, 1).and_hms(0, 0, 0); - let valid_epoch_formats = vec![ - "1970-01-01 00:00", - "1970-01-01 00:00:00", - "1970-01-01 00:00:00.000", - "1970-01-01 00:00:00.000000", - "1970-01-01T00:00", - "1970-01-01T00:00:00", - "1970-01-01T00:00:00.000", - "1970-01-01T00:00:00.000000", - "1970-01-01 00:00Z", - "1970-01-01 00:00:00Z", - "1970-01-01 00:00:00.000Z", - "1970-01-01 00:00:00.000000Z", - "1970-01-01T00:00Z", - "1970-01-01T00:00:00Z", - "1970-01-01T00:00:00.000Z", - "1970-01-01T00:00:00.000000Z", - "1970-01-01 00:00+00:00", - "1970-01-01 00:00:00+00:00", - "1970-01-01 00:00:00.000+00:00", - "1970-01-01 00:00:00.000000+00:00", - "1970-01-01T00:00+00:00", - "1970-01-01T00:00:00+00:00", - "1970-01-01T00:00:00.000+00:00", - "1970-01-01T00:00:00.000000+00:00", - "1970-01-01 00:00+01:00", - "1970-01-01 00:00:00+01:00", - "1970-01-01 00:00:00.000+01:00", - "1970-01-01 00:00:00.000000+01:00", - "1970-01-01T00:00+01:00", - "1970-01-01T00:00:00+01:00", - "1970-01-01T00:00:00.000+01:00", - "1970-01-01T00:00:00.000000+01:00", - "1970-01-01T00:00-01:00", - "1970-01-01T00:00:00-01:00", - "1970-01-01T00:00:00.000-01:00", - "1970-01-01T00:00:00.000000-01:00", - "1970-01-01T00:00-01:00", - "1970-01-01T00:00:00-01:00", - "1970-01-01T00:00:00.000-01:00", - "1970-01-01T00:00:00.000000-01:00", - "2440587.5", - ]; - - for s in valid_epoch_formats { - let epoch_from_sql = - select(sql::(&format!("'{}'", s))).get_result(&connection); - assert_eq!(Ok(time), epoch_from_sql, "format {} failed", s); - } - } - - #[test] - fn times_relative_to_now_encode_correctly() { - let connection = connection(); - let time = Utc::now().naive_utc() + Duration::seconds(60); - let query = select(now.lt(time)); - assert_eq!(Ok(true), query.get_result(&connection)); - - let time = Utc::now().naive_utc() - Duration::seconds(600); - let query = select(now.gt(time)); - assert_eq!(Ok(true), query.get_result(&connection)); - } - - #[test] - fn times_of_day_encode_correctly() { - let connection = connection(); - - let midnight = NaiveTime::from_hms(0, 0, 0); - let query = select(time("00:00:00.000000").eq(midnight)); - assert!(query.get_result::(&connection).unwrap()); - - let noon = NaiveTime::from_hms(12, 0, 0); - let query = select(time("12:00:00.000000").eq(noon)); - assert!(query.get_result::(&connection).unwrap()); - - let roughly_half_past_eleven = NaiveTime::from_hms_micro(23, 37, 4, 2200); - let query = select(sql::
,)+ - { - type Table = Tab; - - fn walk_ast<__DB: Backend>(&self, mut out: AstPass<__DB>) -> QueryResult<()> { - $( - if $idx != 0 { - out.push_sql(", "); - } - self.$idx.walk_ast(out.reborrow())?; - )+ - Ok(()) - } - } - - impl<$($T: QueryId),+> QueryId for ($($T,)+) { - type QueryId = ($($T::QueryId,)+); - - const HAS_STATIC_QUERY_ID: bool = $($T::HAS_STATIC_QUERY_ID &&)+ true; - } - - impl<$($T: Expression + NonAggregate),+> NonAggregate for ($($T,)+) { - } - - impl<$($T,)+ Tab> UndecoratedInsertRecord for ($($T,)+) - where - $($T: UndecoratedInsertRecord,)+ - { - } - - impl<$($T,)+ __DB> CanInsertInSingleQuery<__DB> for ($($T,)+) - where - __DB: Backend, - $($T: CanInsertInSingleQuery<__DB>,)+ - { - fn rows_to_insert(&self) -> Option { - $(debug_assert_eq!(self.$idx.rows_to_insert(), Some(1));)+ - Some(1) - } - } - - impl<$($T,)+ $($ST,)+ Tab> Insertable for ($($T,)+) - where - $($T: Insertable>,)+ - { - type Values = ValuesClause<($($ST,)+), Tab>; - - fn values(self) -> Self::Values { - ValuesClause::new(($(self.$idx.values().values,)+)) - } - } - - impl<'a, $($T,)+ Tab> Insertable for &'a ($($T,)+) - where - ($(&'a $T,)+): Insertable, - { - type Values = <($(&'a $T,)+) as Insertable>::Values; - - fn values(self) -> Self::Values { - ($(&self.$idx,)+).values() - } - } - - #[allow(unused_assignments)] - impl<$($T,)+ Tab, __DB> InsertValues for ($($T,)+) - where - Tab: Table, - __DB: Backend, - $($T: InsertValues,)+ - { - fn column_names(&self, mut out: AstPass<__DB>) -> QueryResult<()> { - let mut needs_comma = false; - $( - let noop_element = self.$idx.is_noop()?; - if !noop_element { - if needs_comma { - out.push_sql(", "); - } - self.$idx.column_names(out.reborrow())?; - needs_comma = true; - } - )+ - Ok(()) - } - } - - impl<$($T,)+ QS> SelectableExpression for ($($T,)+) where - $($T: SelectableExpression,)+ - ($($T,)+): AppearsOnTable, - { - } - - impl<$($T,)+ QS> AppearsOnTable for ($($T,)+) where - $($T: AppearsOnTable,)+ - ($($T,)+): Expression, - { - } - - impl AsChangeset for ($($T,)+) where - $($T: AsChangeset,)+ - Target: QuerySource, - { - type Target = Target; - type Changeset = ($($T::Changeset,)+); - - fn as_changeset(self) -> Self::Changeset { - ($(self.$idx.as_changeset(),)+) - } - } - - impl<$($T,)+ Parent> BelongsTo for ($($T,)+) where - A: BelongsTo, - { - type ForeignKey = A::ForeignKey; - type ForeignKeyColumn = A::ForeignKeyColumn; - - fn foreign_key(&self) -> Option<&Self::ForeignKey> { - self.0.foreign_key() - } - - fn foreign_key_column() -> Self::ForeignKeyColumn { - A::foreign_key_column() - } - } - - impl<$($T,)+ Next> TupleAppend for ($($T,)+) { - type Output = ($($T,)+ Next); - - #[allow(non_snake_case)] - fn tuple_append(self, next: Next) -> Self::Output { - let ($($T,)+) = self; - ($($T,)+ next) - } - } - - impl<$($T,)+ ST> AsExpressionList for ($($T,)+) where - $($T: AsExpression,)+ - { - type Expression = ($($T::Expression,)+); - - fn as_expression_list(self) -> Self::Expression { - ($(self.$idx.as_expression(),)+) - } - } - )+ - } -} - -__diesel_for_each_tuple!(tuple_impls); diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/types/mod.rs b/collector/compile-benchmarks/diesel-1.4.8/src/types/mod.rs deleted file mode 100644 index 10b267145..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/types/mod.rs +++ /dev/null @@ -1,112 +0,0 @@ -// All items in this module are deprecated. They are rendered in docs. -#![allow(missing_docs)] -#![cfg(feature = "with-deprecated")] -#![deprecated(since = "1.1.0", note = "Use `sql_types`, `serialize`, or `deserialize` instead")] - -#[deprecated(since = "1.1.0", note = "Use `sql_types` instead")] -pub use sql_types::*; - -#[deprecated(since = "1.1.0", note = "Use `deserialize` instead")] -pub use deserialize::{FromSql, FromSqlRow}; - -#[deprecated(since = "1.1.0", note = "Use `serialize` instead")] -pub use serialize::{IsNull, ToSql}; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Bool` instead")] -pub type Bool = ::sql_types::Bool; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::TinyInt` instead")] -pub type TinyInt = ::sql_types::TinyInt; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::SmallInt` instead")] -pub type SmallInt = ::sql_types::SmallInt; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Integer` instead")] -pub type Integer = ::sql_types::Integer; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::BigInt` instead")] -pub type BigInt = ::sql_types::BigInt; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Float` instead")] -pub type Float = ::sql_types::Float; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Double` instead")] -pub type Double = ::sql_types::Double; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Numeric` instead")] -pub type Numeric = ::sql_types::Numeric; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Text` instead")] -pub type Text = ::sql_types::Text; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Binary` instead")] -pub type Binary = ::sql_types::Binary; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Date` instead")] -pub type Date = ::sql_types::Date; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Interval` instead")] -pub type Interval = ::sql_types::Interval; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Time` instead")] -pub type Time = ::sql_types::Time; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Timestamp` instead")] -pub type Timestamp = ::sql_types::Timestamp; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Datetime` instead")] -#[cfg(feature = "mysql")] -pub type Datetime = ::sql_types::Datetime; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Oid` instead")] -#[cfg(feature = "postgres")] -pub type Oid = ::sql_types::Oid; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Timestamptz` instead")] -#[cfg(feature = "postgres")] -pub type Timestamptz = ::sql_types::Timestamptz; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Array(ST)` instead")] -#[cfg(feature = "postgres")] -pub type Array = ::sql_types::Array; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Range(ST)` instead")] -#[cfg(feature = "postgres")] -pub type Range = ::sql_types::Range; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Uuid` instead")] -#[cfg(feature = "postgres")] -pub type Uuid = ::sql_types::Uuid; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Json` instead")] -#[cfg(feature = "postgres")] -pub type Json = ::sql_types::Json; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Jsonb` instead")] -#[cfg(feature = "postgres")] -pub type Jsonb = ::sql_types::Jsonb; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Money` instead")] -#[cfg(feature = "postgres")] -pub type Money = ::sql_types::Money; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::MacAddr` instead")] -#[cfg(feature = "postgres")] -pub type MacAddr = ::sql_types::MacAddr; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Inet` instead")] -#[cfg(feature = "postgres")] -pub type Inet = ::sql_types::Inet; - -#[deprecated(since = "1.1.0", note = "Use `sql_types::Cidr` instead")] -#[cfg(feature = "postgres")] -pub type Cidr = ::sql_types::Cidr; - -#[deprecated( - since = "1.1.0", - note = "Use `sql_types::Nullable(ST)` instead" -)] -pub type Nullable = ::sql_types::Nullable; - -#[deprecated(since = "1.1.0", note = "Use `serialize::Output` instead")] -pub type ToSqlOutput<'a, T, DB> = ::serialize::Output<'a, T, DB>; diff --git a/collector/compile-benchmarks/diesel-1.4.8/src/util.rs b/collector/compile-benchmarks/diesel-1.4.8/src/util.rs deleted file mode 100644 index 70e8d6b07..000000000 --- a/collector/compile-benchmarks/diesel-1.4.8/src/util.rs +++ /dev/null @@ -1,7 +0,0 @@ -/// Treats tuples as a list which can be appended to. e.g. -/// `(a,).tuple_append(b) == (a, b)` -pub trait TupleAppend { - type Output; - - fn tuple_append(self, right: T) -> Self::Output; -}