mirror of
https://github.com/fluencelabs/sqlite-wasm-connector
synced 2025-04-24 16:32:12 +00:00
move to rust 2018
This commit is contained in:
parent
a3ec52bbb9
commit
bd42e1b313
@ -21,6 +21,7 @@ repository = "https://github.com/stainless-steel/sqlite"
|
||||
readme = "README.md"
|
||||
categories = ["api-bindings", "database"]
|
||||
keywords = ["database"]
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
name = "marine_sqlite_connector"
|
||||
|
@ -1,9 +1,9 @@
|
||||
use sqlite3_connector as ffi;
|
||||
use crate::sqlite3_connector as ffi;
|
||||
|
||||
use std::marker::PhantomData;
|
||||
use std::path::Path;
|
||||
|
||||
use {Result, Statement};
|
||||
use crate::{Result, Statement};
|
||||
|
||||
/// A database connection.
|
||||
pub struct Connection {
|
||||
@ -33,14 +33,14 @@ impl Connection {
|
||||
match result.ret_code {
|
||||
ffi::SQLITE_OK => {}
|
||||
code => {
|
||||
return match ::last_error(result.db_handle) {
|
||||
return match crate::last_error(result.db_handle) {
|
||||
Some(error) => {
|
||||
ffi::sqlite3_close(result.db_handle);
|
||||
Err(error)
|
||||
}
|
||||
_ => {
|
||||
ffi::sqlite3_close(result.db_handle);
|
||||
Err(::Error {
|
||||
Err(crate::Error {
|
||||
code: Some(code as isize),
|
||||
message: None,
|
||||
})
|
||||
@ -91,7 +91,7 @@ impl Connection {
|
||||
/// Create a prepared statement.
|
||||
#[inline]
|
||||
pub fn prepare<T: AsRef<str>>(&self, statement: T) -> Result<Statement> {
|
||||
::statement::new(self.raw, statement)
|
||||
crate::statement::new(self.raw, statement)
|
||||
}
|
||||
|
||||
/// Return the number of rows inserted, updated, or deleted by the most
|
||||
|
@ -1,6 +1,6 @@
|
||||
use sqlite3_connector as ffi;
|
||||
use statement::{State, Statement};
|
||||
use {Result, Value};
|
||||
use crate::sqlite3_connector as ffi;
|
||||
use crate::statement::{State, Statement};
|
||||
use crate::{Result, Value};
|
||||
|
||||
/// An iterator over rows.
|
||||
pub struct Cursor {
|
||||
|
@ -108,9 +108,9 @@ use std::{error, fmt};
|
||||
|
||||
macro_rules! error(
|
||||
($connection:expr, $code:expr) => (
|
||||
match ::last_error($connection) {
|
||||
match crate::last_error($connection) {
|
||||
Some(error) => return Err(error),
|
||||
_ => return Err(::Error {
|
||||
_ => return Err(crate::Error {
|
||||
code: Some($code as isize),
|
||||
message: None,
|
||||
}),
|
||||
@ -121,7 +121,7 @@ macro_rules! error(
|
||||
macro_rules! ok_descr(
|
||||
($connection:expr, $result:expr) => (
|
||||
match $result.ret_code {
|
||||
::ffi::SQLITE_OK => {}
|
||||
crate::ffi::SQLITE_OK => {}
|
||||
code => error!($connection, code),
|
||||
}
|
||||
);
|
||||
@ -139,7 +139,7 @@ macro_rules! ok_descr(
|
||||
macro_rules! ok_raw(
|
||||
($connection:expr, $result:expr) => (
|
||||
match $result {
|
||||
::ffi::SQLITE_OK => {}
|
||||
crate::ffi::SQLITE_OK => {}
|
||||
code => error!($connection, code),
|
||||
}
|
||||
);
|
||||
|
@ -1,7 +1,7 @@
|
||||
use sqlite3_connector as ffi;
|
||||
use crate::sqlite3_connector as ffi;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use {Cursor, Result, Type, Value};
|
||||
use crate::{Cursor, Result, Type, Value};
|
||||
|
||||
/// A prepared statement.
|
||||
pub struct Statement {
|
||||
@ -31,7 +31,7 @@ pub trait Readable: Sized {
|
||||
/// Read from a column.
|
||||
///
|
||||
/// The leftmost column has the index 0.
|
||||
fn read(&Statement, usize) -> Result<Self>;
|
||||
fn read(_: &Statement, _: usize) -> Result<Self>;
|
||||
}
|
||||
|
||||
impl Statement {
|
||||
@ -108,7 +108,7 @@ impl Statement {
|
||||
/// Upgrade to a cursor.
|
||||
#[inline]
|
||||
pub fn cursor(self) -> Cursor {
|
||||
::cursor::new(self)
|
||||
crate::cursor::new(self)
|
||||
}
|
||||
|
||||
/// Return the raw pointer.
|
||||
|
Loading…
x
Reference in New Issue
Block a user