We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 141e496 commit 9654125Copy full SHA for 9654125
crossdb
src/de.rs
@@ -90,6 +90,8 @@ impl<'de> Deserializer<'de> for ValueDeserializer<'de> {
90
Value::F32(v) => visitor.visit_f32(v),
91
Value::F64(v) => visitor.visit_f64(v),
92
Value::Char(v) => visitor.visit_str(v),
93
+ // TODO: Deserialize Binary to Vec<u8>
94
+ Value::Binary(_) => unimplemented!(),
95
}
96
97
src/lib.rs
@@ -68,6 +68,14 @@ impl Connection {
68
Self::open(":memory:")
69
70
71
+ pub fn current_database(&self) -> Result<&str> {
72
+ unsafe {
73
+ let ptr = xdb_curdb(self.ptr);
74
+ let db = CStr::from_ptr(ptr).to_str()?;
75
+ Ok(db)
76
+ }
77
78
+
79
pub fn query<S: AsRef<str>>(&self, sql: S) -> Result<Query> {
80
let sql = CString::new(sql.as_ref())?;
81
unsafe {
src/value.rs
@@ -10,6 +10,7 @@ pub enum Value<'a> {
10
F32(f32),
11
F64(f64),
12
Char(&'a str),
13
+ Binary(&'a [u8]),
14
15
16
impl Display for Value<'_> {
@@ -23,6 +24,7 @@ impl Display for Value<'_> {
23
24
Value::F32(v) => write!(f, "{}", v),
25
Value::F64(v) => write!(f, "{}", v),
26
Value::Char(v) => write!(f, "{}", v),
27
+ Value::Binary(v) => write!(f, "{:?}", v),
28
29
30
@@ -43,10 +45,14 @@ impl<'a> Value<'a> {
43
45
DataType::BigInt => Value::I64(xdb_column_int64(meta, row, col)),
44
46
DataType::Float => Value::F32(xdb_column_float(meta, row, col)),
47
DataType::Double => Value::F64(xdb_column_double(meta, row, col)),
- DataType::Char => {
48
+ DataType::Char | DataType::VChar => {
49
let s = CStr::from_ptr(xdb_column_str(meta, row, col));
50
Value::Char(s.to_str().unwrap())
51
52
+ DataType::Binary | DataType::VBinary => {
53
+ // xdb_column_blob(meta, row, col, pLen);
54
+ todo!()
55
56
_ => unimplemented!(),
57
58
0 commit comments