Skip to content

Commit 637fef7

Browse files
committed
Diesel 2.3 compatiblity
This commit bumps all diesel dependencies to allow diesel-oci to be used with diesel 2.3. It also contains the minimal necessary fixes to work with the new features.
1 parent 5bcb96a commit 637fef7

File tree

4 files changed

+35
-9
lines changed

4 files changed

+35
-9
lines changed

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors = [
55
"Daniel Buse <daniel.buse@giga-infosystems.com>",
66
]
77
name = "diesel-oci"
8-
version = "0.3.1"
8+
version = "0.4.0"
99
license = "MIT OR Apache-2.0"
1010
description = "A oci database adapter for diesel"
1111
readme = "README.md"
@@ -29,15 +29,15 @@ package = "chrono"
2929
[dependencies.diesel]
3030
default-features = false
3131
features = ["i-implement-a-third-party-backend-and-opt-into-breaking-changes"]
32-
version = "~2.2.0"
32+
version = "~2.3.0"
3333

3434
[dependencies.diesel_derives]
35-
version = "~2.2.0"
35+
version = "~2.3.0"
3636

3737
[dependencies.diesel-dynamic-schema]
3838
optional = true
3939
default-features = false
40-
version = "0.2.1"
40+
version = "0.2.4"
4141

4242
[dev-dependencies]
4343
log = "0.4"

src/oracle/backend.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ impl SqlDialect for Oracle {
4040
type ArrayComparison = sql_dialect::array_comparison::AnsiSqlArrayComparison;
4141
type SelectStatementSyntax = sql_dialect::select_statement_syntax::AnsiSqlSelectStatement;
4242
type AliasSyntax = OracleAliasSyntax;
43+
44+
type WindowFrameClauseGroupSupport =
45+
sql_dialect::window_frame_clause_group_support::NoGroupWindowFrameUnit;
46+
47+
type WindowFrameExclusionSupport =
48+
sql_dialect::window_frame_exclusion_support::NoFrameFrameExclusionSupport;
49+
50+
type AggregateFunctionExpressions =
51+
sql_dialect::aggregate_function_expressions::NoAggregateFunctionExpressions;
52+
53+
type BuiltInWindowFunctionRequireOrder =
54+
sql_dialect::built_in_window_function_require_order::NoOrderRequired;
4355
}
4456

4557
pub struct OracleStyleBatchInsert;

src/oracle/connection/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,20 @@ impl Connection for OciConnection {
330330
fn set_instrumentation(&mut self, instrumentation: impl diesel::connection::Instrumentation) {
331331
self.instrumentation = Some(Box::new(instrumentation));
332332
}
333+
334+
fn set_prepared_statement_cache_size(&mut self, size: diesel::connection::CacheSize) {
335+
match size {
336+
diesel::connection::CacheSize::Unbounded => self
337+
.raw
338+
.set_stmt_cache_size(u32::MAX)
339+
.expect("Setting the cache size failed"),
340+
diesel::connection::CacheSize::Disabled => self
341+
.raw
342+
.set_stmt_cache_size(0)
343+
.expect("Setting the cache size failed"),
344+
_ => unreachable!("There are currently only these two variants defined in diesel"),
345+
}
346+
}
333347
}
334348

335349
impl LoadConnection for OciConnection {

src/test/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const DROP_INTERVALS_TABLE: &str = "DROP TABLE intervals";
6565

6666
const TEST_VARCHAR: &str = "'blabla'";
6767

68-
const CREATE_GST_TYPE_TABLE: &'static str = "CREATE TABLE gst_types (\
68+
const CREATE_GST_TYPE_TABLE: &str = "CREATE TABLE gst_types (\
6969
big NUMBER(19),
7070
big2 NUMBER(19),
7171
small NUMBER(5),
@@ -1226,15 +1226,15 @@ allow_tables_to_appear_in_same_query!(t1, t2);
12261226

12271227
#[test]
12281228
fn ambigious_col_names() {
1229-
const CREATE_T1: &'static str = "CREATE TABLE t1 (\
1229+
const CREATE_T1: &str = "CREATE TABLE t1 (\
12301230
id NUMBER(10),
12311231
name VARCHAR2(50),
12321232
bol NUMBER(5) DEFAULT 0 NOT NULL,
12331233
t2 VARCHAR2(50),
12341234
bin blob,
12351235
si NUMBER(5)
12361236
)";
1237-
const CREATE_T2: &'static str = "CREATE TABLE t2 (\
1237+
const CREATE_T2: &str = "CREATE TABLE t2 (\
12381238
id NUMBER(10),
12391239
name VARCHAR2(50)
12401240
)";
@@ -1309,7 +1309,7 @@ table! {
13091309

13101310
#[test]
13111311
fn timestamp() {
1312-
const CREATE_TS: &'static str = "CREATE TABLE TS (\
1312+
const CREATE_TS: &str = "CREATE TABLE TS (\
13131313
id NUMBER(10),
13141314
tis TIMESTAMP
13151315
)";
@@ -1468,7 +1468,7 @@ fn props() {
14681468

14691469
#[test]
14701470
fn props_orig() {
1471-
const CREATE_TESTT: &'static str = "CREATE TABLE PROPS (\
1471+
const CREATE_TESTT: &str = "CREATE TABLE PROPS (\
14721472
id NUMBER(10),
14731473
is_based NUMBER(5)
14741474
)";

0 commit comments

Comments
 (0)