Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
fix(mariadb): json gt/gte/lt/lte comparisons (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
Weakky committed Aug 23, 2021
1 parent d23b824 commit 9808b60
Show file tree
Hide file tree
Showing 11 changed files with 246 additions and 118 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
env:
TEST_MYSQL: "mysql://root:prisma@localhost:3306/prisma"
TEST_MYSQL8: "mysql://root:prisma@localhost:3307/prisma"
TEST_MYSQL_MARIADB: "mysql://root:prisma@localhost:3308/prisma"
TEST_PSQL: "postgres://postgres:prisma@localhost:5432/postgres"
TEST_MSSQL: "jdbc:sqlserver://localhost:1433;database=master;user=SA;password=<YourStrong@Passw0rd>;trustServerCertificate=true"
RUSTFLAGS: "-Dwarnings"
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ either = { version = "1.6", optional = true }
base64 = { version = "0.12.3", optional = true }
chrono = { version = "0.4", optional = true }
lru-cache = { version = "0.1", optional = true }
serde_json = { version = "1.0.48", optional = true }
serde_json = { version = "1.0.48", optional = true, features = ["float_roundtrip"] }
native-tls = { version = "0.2", optional = true }
bit-vec = { version = "0.6.1", optional = true }
bytes = { version = "1.0", optional = true }
Expand Down
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@ services:
- databases
tmpfs: /var/lib/mysql8

mariadb:
image: mariadb:10
restart: always
environment:
MYSQL_USER: root
MYSQL_ROOT_PASSWORD: prisma
MYSQL_DATABASE: prisma
ports:
- "3308:3306"
networks:
- databases
tmpfs: /var/lib/mariadb

mssql:
image: mcr.microsoft.com/mssql/server:2019-latest
restart: always
Expand Down
12 changes: 12 additions & 0 deletions src/ast/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ impl<'a> Expression<'a> {
}
}

#[allow(dead_code)]
#[cfg(feature = "json")]
pub(crate) fn into_json_value(self) -> Option<serde_json::Value> {
match self.kind {
#[cfg(feature = "json")]
ExpressionKind::Parameterized(Value::Json(json_val)) => json_val,
#[cfg(feature = "json")]
ExpressionKind::Value(expr) => expr.into_json_value(),
_ => None,
}
}

#[allow(dead_code)]
pub(crate) fn is_json_extract_fun(&self) -> bool {
match &self.kind {
Expand Down
2 changes: 1 addition & 1 deletion src/connector/result_set/result_row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::sync::Arc;

/// An owned version of a `Row` in a `ResultSet`. See
/// [ResultRowRef](struct.ResultRowRef.html) for documentation on data access.
#[derive(Debug)]
#[derive(Debug, PartialEq)]
pub struct ResultRow {
pub(crate) columns: Arc<Vec<String>>,
pub(crate) values: Vec<Value<'static>>,
Expand Down
Loading

0 comments on commit 9808b60

Please sign in to comment.