Skip to content

Commit

Permalink
Merge pull request #293 from taosdata/main
Browse files Browse the repository at this point in the history
chore: merge main to 3.0
  • Loading branch information
AdamEECS authored Dec 8, 2023
2 parents d25a29d + e6e4de4 commit 6b43db8
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ resolver = "2"

[workspace.package]
edition = "2021"
version = "0.10.22"
version = "0.10.23"

authors = ["Linhe Huo <linhe.huo@gmail.com>"]
categories = ["database", "api-bindings", "asynchronous"]
Expand Down
14 changes: 7 additions & 7 deletions taos-error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ impl Error {
#[inline(always)]
pub fn new_with_context(
code: impl Into<Code>,
err: impl Display,
context: impl Display,
err: impl Into<String>,
context: impl Into<String>,
) -> Self {
Self {
code: code.into(),
context: Some(context.to_string()),
source: err.to_string().into(),
context: Some(context.into()),
source: err.into().into(),
}
}
#[inline]
Expand All @@ -187,10 +187,10 @@ impl Error {
}

#[inline]
pub fn context(mut self, context: impl Display) -> Self {
pub fn context(mut self, context: impl Into<String>) -> Self {
self.context = Some(match self.context {
Some(pre) => format!("{}: {}", context, pre),
None => format!("{}", context),
Some(pre) => format!("{}: {}", context.into(), pre),
None => context.into(),
});
self
}
Expand Down
2 changes: 1 addition & 1 deletion taos-optin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ serde_repr = { version = "0.1.7", optional = true }
tracing = { version = "0.1", features = ["log"] }
# taos-error = { version = "0.2.0", path = "../taos-error" }
taos-macros = { version = "0.*", path = "../taos-macros" }
taos-query = { version = "0.10.22", path = "../taos-query" }
taos-query = { version = "0.10.23", path = "../taos-query" }

# time_this = "0.2.4"
fun_time = "0.2.1"
Expand Down
56 changes: 28 additions & 28 deletions taos-optin/src/raw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,10 +786,10 @@ impl RawTaos {
let ptr = unsafe { (self.c.taos_query)(self.as_ptr(), sql.as_ptr()) };
if ptr.is_null() {
let code = self.c.errno(std::ptr::null_mut());
let str = self.c.errno(std::ptr::null_mut());
let str = self.c.err_str(std::ptr::null_mut());
return Err(RawError::new_with_context(
code,
str,
str.to_string(),
format!("Query with sql: {:?}", sql),
));
}
Expand Down Expand Up @@ -1313,42 +1313,42 @@ impl RawRes {
Poll::Ready(item)
} else {
current.in_use = true;
let param = Box::new((Arc::downgrade(state), self.c.clone(), cx.waker().clone()));
let param = Box::new((state.clone(), self.c.clone(), cx.waker().clone()));
#[no_mangle]
unsafe extern "C" fn taos_optin_fetch_rows_callback(
param: *mut c_void,
res: *mut TAOS_RES,
num_of_rows: c_int,
) {
let param = param as *mut (Weak<UnsafeCell<BlockState>>, Arc<ApiEntry>, Waker);
let param = param as *mut (Arc<UnsafeCell<BlockState>>, Arc<ApiEntry>, Waker);
let param = Box::from_raw(param);
if let Some(state) = param.0.upgrade() {
let state = &mut *state.get();
let api = &*param.1;
// state.done = true;
state.in_use = false;
if num_of_rows < 0 {
// error
state.result.replace(Err(RawError::new_with_context(
num_of_rows,
api.err_str(res),
"fetch_rows_a",
)));
let state = param.0;
let state = &mut *state.get();
let api = &*param.1;
// state.done = true;
state.in_use = false;
if num_of_rows < 0 {
// error
let old = state.result.replace(Err(RawError::new_with_context(
num_of_rows,
api.err_str(res),
"fetch_rows_a",
)));
drop(old);
} else {
// success
if num_of_rows > 0 {
// has a block
let block = (param.1.taos_result_block.unwrap())(res).read() as _;
state
.result
.replace(Ok(Some((block, num_of_rows as usize))));
} else {
// success
if num_of_rows > 0 {
// has a block
let block = (param.1.taos_result_block.unwrap())(res).read() as _;
state
.result
.replace(Ok(Some((block, num_of_rows as usize))));
} else {
// retrieving completed
state.result.replace(Ok(None));
}
// retrieving completed
state.result.replace(Ok(None));
}
param.2.wake()
}
param.2.wake()
}
unsafe {
(self.c.taos_fetch_rows_a)(
Expand Down
2 changes: 1 addition & 1 deletion taos-query/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ parse_duration = "2.1"
prettytable = "0.10.0"
rust_decimal = { version = "1", features = ["c-repr"] }
rustversion = "1.0.6"
taos-error = { path = "../taos-error", version = "0.10.22" }
taos-error = { path = "../taos-error", version = "0.10.23" }
thiserror = "1.0.47"
url = "2.2.2"

Expand Down
2 changes: 1 addition & 1 deletion taos-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ serde_json = "1.0"
serde_repr = { version = "0.1.7", optional = true }
# taos-error = { path = "../taos-error", version = "0.2.9" }
taos-macros = { path = "../taos-macros", version = "0.*" }
taos-query = { path = "../taos-query", version = "0.10.22" }
taos-query = { path = "../taos-query", version = "0.10.23" }

[build-dependencies]
dotenv = "0.15.0"
Expand Down
2 changes: 1 addition & 1 deletion taos-ws/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ serde = { version = "1", features = ["derive"] }
serde_json = { version = "1" }
serde_repr = "0.1.8"
serde_with = "3.0.0"
taos-query = { path = "../taos-query", version = "0.10.22" }
taos-query = { path = "../taos-query", version = "0.10.23" }
thiserror = "1.0.47"
tokio = { version = "1", features = ["sync", "rt-multi-thread", "macros", "io-util", "time"] }
tokio-tungstenite = { version = "0.20.1" }
Expand Down
8 changes: 4 additions & 4 deletions taos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ no-default-features = true
[dependencies]
async-trait = "0.1"
log = "0.4.17"
taos-optin = { path = "../taos-optin", version = "0.10.22", optional = true }
taos-query = { path = "../taos-query", version = "0.10.22", default-features = false }
taos-sys = { path = "../taos-sys", version = "0.10.22", optional = true }
taos-ws = { path = "../taos-ws", version = "0.10.22", optional = true }
taos-optin = { path = "../taos-optin", version = "0.10.23", optional = true }
taos-query = { path = "../taos-query", version = "0.10.23", default-features = false }
taos-sys = { path = "../taos-sys", version = "0.10.23", optional = true }
taos-ws = { path = "../taos-ws", version = "0.10.23", optional = true }
futures = { version = "0.3", features = ["executor"] }

[dev-dependencies]
Expand Down

0 comments on commit 6b43db8

Please sign in to comment.