Update for int/uint -> isize/usize

This commit is contained in:
John Gallagher 2015-01-10 20:39:59 -06:00
parent 60c9a04161
commit cc8a68ca83
3 changed files with 15 additions and 9 deletions

View File

@ -42,7 +42,7 @@ pub const SQLITE_NULL : c_int = 5;
pub type SqliteDestructor = extern "C" fn(*mut c_void);
pub fn SQLITE_TRANSIENT() -> SqliteDestructor {
unsafe { mem::transmute(-1i) }
unsafe { mem::transmute(-1is) }
}
pub fn code_to_str(code: c_int) -> &'static str {

View File

@ -210,7 +210,7 @@ impl SqliteConnection {
/// }
/// }
/// ```
pub fn execute(&self, sql: &str, params: &[&ToSql]) -> SqliteResult<uint> {
pub fn execute(&self, sql: &str, params: &[&ToSql]) -> SqliteResult<c_int> {
self.prepare(sql).and_then(|mut stmt| stmt.execute(params))
}
@ -280,7 +280,7 @@ impl SqliteConnection {
self.db.borrow_mut().decode_result(code)
}
fn changes(&self) -> uint {
fn changes(&self) -> c_int {
self.db.borrow_mut().changes()
}
}
@ -390,8 +390,8 @@ impl InnerSqliteConnection {
})
}
fn changes(&mut self) -> uint {
unsafe{ ffi::sqlite3_changes(self.db) as uint }
fn changes(&mut self) -> c_int {
unsafe{ ffi::sqlite3_changes(self.db) }
}
}
@ -432,7 +432,7 @@ impl<'conn> SqliteStatement<'conn> {
/// Ok(())
/// }
/// ```
pub fn execute(&mut self, params: &[&ToSql]) -> SqliteResult<uint> {
pub fn execute(&mut self, params: &[&ToSql]) -> SqliteResult<c_int> {
self.reset_if_needed();
unsafe {
@ -796,7 +796,7 @@ mod test {
assert_eq!(db.last_insert_rowid(), 1);
let mut stmt = db.prepare("INSERT INTO foo DEFAULT VALUES").unwrap();
for _ in range(0i, 9) {
for _ in range(0i32, 9) {
stmt.execute(&[]).unwrap();
}
assert_eq!(db.last_insert_rowid(), 10);

View File

@ -136,9 +136,15 @@ impl<T: ToSql> ToSql for Option<T> {
/// ## Example
///
/// ```rust,no_run
/// #![allow(unstable)]
/// # extern crate libc;
/// # extern crate rusqlite;
/// # use rusqlite::{SqliteConnection, SqliteResult};
/// # use rusqlite::types::{Null};
/// fn insert_null(conn: &SqliteConnection) -> SqliteResult<uint> {
/// # use libc::{c_int};
/// fn main() {
/// }
/// fn insert_null(conn: &SqliteConnection) -> SqliteResult<c_int> {
/// conn.execute("INSERT INTO people (name) VALUES (?)", &[&Null])
/// }
/// ```
@ -186,7 +192,7 @@ impl FromSql for Vec<u8> {
let c_blob = ffi::sqlite3_column_blob(stmt, col);
let len = ffi::sqlite3_column_bytes(stmt, col);
assert!(len >= 0); let len = len as uint;
assert!(len >= 0); let len = len as usize;
Ok(Vec::from_raw_buf(mem::transmute(c_blob), len))
}