Skip to content
This repository was archived by the owner on Jul 11, 2021. It is now read-only.

Commit 6acd96f

Browse files
authored
Merge pull request #81 from RedBeardLab/cleaning_up
Cleaning up
2 parents d51ea3e + bfe285a commit 6acd96f

File tree

13 files changed

+1382
-1157
lines changed

13 files changed

+1382
-1157
lines changed

.travis.yml

Lines changed: 29 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,45 @@
1-
21
services: docker
3-
42
git:
53
submodules: false
6-
74
sudo: required
8-
95
language: rust
106
rust:
11-
- stable
12-
- beta
13-
- nightly
14-
7+
- stable
8+
- beta
9+
- nightly
1510
env:
1611
global:
17-
- CRATE_NAME=rediSQL
12+
- CRATE_NAME=rediSQL
13+
script:
14+
- cargo build --verbose --all
15+
- cargo test --verbose --all
16+
- cargo build --verbose --all --release
1817

1918
matrix:
2019
include:
21-
22-
# Linux
23-
- env: TARGET=aarch64-unknown-linux-gnu
24-
- env: TARGET=arm-unknown-linux-gnueabi
25-
- env: TARGET=armv7-unknown-linux-gnueabihf
26-
- env: TARGET=i686-unknown-linux-gnu
27-
- env: TARGET=i686-unknown-linux-musl
28-
- env: TARGET=mips-unknown-linux-gnu
29-
- env: TARGET=mips64-unknown-linux-gnuabi64
30-
- env: TARGET=mips64el-unknown-linux-gnuabi64
31-
- env: TARGET=mipsel-unknown-linux-gnu
32-
- env: TARGET=powerpc-unknown-linux-gnu
33-
- env: TARGET=powerpc64-unknown-linux-gnu
34-
- env: TARGET=powerpc64le-unknown-linux-gnu
35-
- env: TARGET=s390x-unknown-linux-gnu DISABLE_TESTS=1
36-
- env: TARGET=x86_64-unknown-linux-gnu
37-
dist: trusty
38-
- env: TARGET=x86_64-unknown-linux-musl
39-
40-
# OSX
41-
- env: TARGET=i686-apple-darwin
42-
os: osx
43-
- env: TARGET=x86_64-apple-darwin
44-
os: osx
45-
46-
# *BSD
47-
- env: TARGET=i686-unknown-freebsd DISABLE_TESTS=1
48-
- env: TARGET=x86_64-unknown-freebsd DISABLE_TESTS=1
49-
- env: TARGET=x86_64-unknown-netbsd DISABLE_TESTS=1
50-
51-
# Windows
52-
- env: TARGET=x86_64-pc-windows-gnu
53-
54-
# Testing other channels
55-
- env: TARGET=x86_64-unknown-linux-gnu
56-
rust: nightly
20+
- env: TARGET=arm-unknown-linux-gnueabi
21+
- env: TARGET=armv7-unknown-linux-gnueabihf
22+
- env: TARGET=x86_64-unknown-linux-gnu
5723

5824
cache: cargo
59-
6025
notifications:
6126
email:
6227
on_success: never
28+
before_deploy:
29+
- ls $TRAVIS_BUILD_DIR/target/release
30+
- echo "${TRAVIS_BUILD_DIR}/target/release/RediSQL_${TRAVIS_TAG}_${TRAVIS_COMMIT:0:6}_${TARGET}_(release|debug).so"
31+
- cp --verbose $TRAVIS_BUILD_DIR/target/release/libredis_sql.so "${TRAVIS_BUILD_DIR}/target/release/RediSQL_${TRAVIS_TAG}_${TRAVIS_COMMIT:0:6}_${TARGET}_release.so"
32+
- cp --verbose $TRAVIS_BUILD_DIR/target/debug/libredis_sql.so "${TRAVIS_BUILD_DIR}/target/release/RediSQL_${TRAVIS_TAG}_${TRAVIS_COMMIT:0:6}_${TARGET}_debug.so"
33+
- ls $TRAVIS_BUILD_DIR/target/release
34+
35+
deploy:
36+
skip_cleanup: true
37+
provider: releases
38+
api_key:
39+
secure: IFiEcn4ln1fJEKfEUfXtGlq3dV4cl/1r36vMtGnUoOqoSR7yioCsWHszkIM0+KnvD08fC7hMiZSY7K2B5QKbirnbNZ7ha4hEESe+YTQlGETJsrN6EcVTSRJ/jMyY7LE3kHo565R2do5XsFhTz5KymJ562woaAGtYP+qmqj1DBFsDjoxLNzON23o5nnREjKyjDBu4Ie6PNuVm/pMUgjt0Erwhklac2tKvAJUUeT4PTEZ1FEJi3ubYoz0XLbR9wp8Ih3I9YEIOXpaLmoBmo7u8g/wCStSbZSvorssZfIP9uI9Q+VmQj7agMeI4nrm7uOas8uPf/UFFsY41dqKoWhO06XXLAot/PUw3saSpdpIobAtyX9x1SUb2BPs1hPwcoU6Pz/yBntr5xx0yLqdppcWof28t9S4dUeFstAtrkQB0iIjPa7J0JywWVcBQ1iPY1e87QeZKN9GJSf1Gk0B4AhR4ORLskvS8u29w2ZA1ca8PWJ9fokH3JYoYJGE8GtXqMFCW3ENTu953uX2B9f2JntqqYtFX8bk+YxpO/uBY+aAFS59ApCWhQDshx1zMzFLwqSxIpz5Qkgddso50L8Az39Kx1Due0V0FnO4G72q6rzSQayrAhxLdDF3z5xcvbjbsYrSAue5Ly5Y814D5ywKJMsjlGzz4JTNJjSvfChWihHwW61w=
40+
file_glob: true
41+
file: $TRAVIS_BUILD_DIR/target/release/RediSQL_*.so
42+
on:
43+
repo: RedBeardLab/rediSQL
44+
branch: timeout_honor
45+
tags: true

Cargo.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rediSQL"
3-
version = "1.0.3-rc02"
3+
version = "1.1.0"
44
authors = ["Simone Mosciatti <[email protected]>"]
55
edition = "2018"
66

redisql_lib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "redisql_lib"
3-
version = "0.5.5-rc02"
3+
version = "0.6.0"
44
authors = ["Simone Mosciatti <[email protected]>"]
55
edition = "2018"
66

redisql_lib/src/community_statement.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ enum Parameters {
1616
Named { index: i32 },
1717
}
1818

19+
#[derive(Clone)]
1920
pub struct MultiStatement {
2021
stmts: Vec<Statement>,
2122
db: Arc<Mutex<RawConnection>>,
@@ -38,12 +39,17 @@ impl<'a> fmt::Display for MultiStatement {
3839
}
3940
}
4041

42+
#[derive(Clone)]
4143
pub struct Statement {
44+
stmt: Arc<InternalStatement>,
45+
}
46+
47+
struct InternalStatement {
4248
stmt: ptr::NonNull<ffi::sqlite3_stmt>,
4349
}
4450

45-
unsafe impl Send for Statement {}
46-
unsafe impl Sync for Statement {}
51+
unsafe impl Send for InternalStatement {}
52+
unsafe impl Sync for InternalStatement {}
4753

4854
impl<'a> fmt::Display for Statement {
4955
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -56,10 +62,10 @@ impl<'a> fmt::Display for Statement {
5662
}
5763
}
5864

59-
impl<'a> Drop for Statement {
65+
impl<'a> Drop for InternalStatement {
6066
fn drop(&mut self) {
6167
unsafe {
62-
ffi::sqlite3_finalize(self.as_ptr());
68+
ffi::sqlite3_finalize(self.stmt.as_ptr());
6369
};
6470
}
6571
}
@@ -120,7 +126,9 @@ pub fn generate_statements(
120126
impl Statement {
121127
fn from_ptr(stmt: *mut ffi::sqlite3_stmt) -> Self {
122128
Statement {
123-
stmt: ptr::NonNull::new(stmt).unwrap(),
129+
stmt: Arc::new(InternalStatement {
130+
stmt: ptr::NonNull::new(stmt).unwrap(),
131+
}),
124132
}
125133
}
126134
fn execute(
@@ -139,7 +147,7 @@ impl Statement {
139147
ffi::sqlite3_column_count(self.as_ptr())
140148
} as i32;
141149
Ok(Cursor::RowsCursor {
142-
stmt: self,
150+
stmt: self.clone(),
143151
num_columns,
144152
previous_status: ffi::SQLITE_ROW,
145153
modified_rows: 0,
@@ -154,7 +162,7 @@ impl Statement {
154162
rc.get_last_error()
155163
}
156164
pub fn as_ptr(&self) -> *mut ffi::sqlite3_stmt {
157-
self.stmt.as_ptr()
165+
self.stmt.stmt.as_ptr()
158166
}
159167
}
160168

@@ -403,6 +411,7 @@ fn count_parameters(
403411
}
404412
}
405413
}
414+
406415
fn get_parameter_name(
407416
stmt: &Statement,
408417
index: i32,

0 commit comments

Comments
 (0)