Introduce Statement::columns

Return Columns name and type. (#494)
This commit is contained in:
gwenn
2019-03-19 20:33:36 +01:00
parent 1013571186
commit 38e92159fb
5 changed files with 150 additions and 46 deletions

View File

@@ -26,6 +26,17 @@ impl RawStatement {
unsafe { ffi::sqlite3_column_type(self.0, idx as c_int) }
}
pub fn column_decltype(&self, idx: usize) -> Option<&CStr> {
unsafe {
let decltype = ffi::sqlite3_column_decltype(self.0, idx as c_int);
if decltype.is_null() {
None
} else {
Some(CStr::from_ptr(decltype))
}
}
}
pub fn column_name(&self, idx: usize) -> &CStr {
unsafe { CStr::from_ptr(ffi::sqlite3_column_name(self.0, idx as c_int)) }
}