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

Commit c15bdff

Browse files
author
Simone Mosciatti
committed
make it compatible with 32 bit architecture and reworks the non-working replication mechanism
1 parent a45fe4f commit c15bdff

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

src/community_statement.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ impl<'a> StatementTrait<'a> for Statement<'a> {
222222

223223
#[cfg(feature = "pro")]
224224
fn to_replicate(&self) -> bool {
225-
replication::to_replicate(self)
225+
let v = replication::to_replicate(self);
226+
v
226227
}
227228
}
228229

@@ -302,6 +303,17 @@ impl<'a> StatementTrait<'a> for MultiStatement<'a> {
302303
fn get_raw_stmt(&self) -> *mut ffi::sqlite3_stmt {
303304
self.stmts[0].stmt
304305
}
306+
307+
#[cfg(feature="pro")]
308+
fn to_replicate(&self) -> bool {
309+
for stmt in &self.stmts {
310+
let v = stmt.to_replicate();
311+
if v {
312+
return true;
313+
}
314+
}
315+
return false;
316+
}
305317
}
306318

307319
fn count_parameters<'a>

src/sqlite.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use std::ffi::{CString, CStr};
55
use std::error;
66
use std::iter::FromIterator;
77

8+
use std::os::raw::c_char;
9+
810
use redisql_error as err;
911

1012
pub use community_statement;
@@ -197,13 +199,13 @@ impl<'a> FromIterator<Cursor<'a>> for Cursor<'a> {
197199
for cursor in cursors {
198200
match cursor {
199201
Cursor::OKCursor { to_replicate } => {
200-
to_replicate_acc &= to_replicate;
202+
to_replicate_acc |= to_replicate;
201203
}
202204
Cursor::DONECursor { to_replicate, .. } => {
203-
to_replicate_acc &= to_replicate;
205+
to_replicate_acc |= to_replicate;
204206
}
205207
Cursor::RowsCursor { to_replicate, .. } => {
206-
to_replicate_acc &= to_replicate;
208+
to_replicate_acc |= to_replicate;
207209
result = Some(cursor);
208210
}
209211
}
@@ -282,14 +284,14 @@ impl<'a> Iterator for Cursor<'a> {
282284
}
283285
EntityType::Text => {
284286
let value = unsafe {
285-
CStr::from_ptr(ffi::sqlite3_column_text(stmt.get_raw_stmt(), i) as *const i8).to_string_lossy().into_owned()
287+
CStr::from_ptr(ffi::sqlite3_column_text(stmt.get_raw_stmt(), i) as *const c_char).to_string_lossy().into_owned()
286288
};
287289
debug!("Got text: {:?}", value);
288290
Entity::Text { text: value }
289291
}
290292
EntityType::Blob => {
291293
let value = unsafe {
292-
CStr::from_ptr(ffi::sqlite3_column_blob(stmt.get_raw_stmt(), i) as *const i8).to_string_lossy().into_owned()
294+
CStr::from_ptr(ffi::sqlite3_column_blob(stmt.get_raw_stmt(), i) as *const c_char).to_string_lossy().into_owned()
293295
};
294296
debug!("Got blob: {:?}", value);
295297
Entity::Blob { blob: value }

0 commit comments

Comments
 (0)