Methods
[src]
pub fn next(self): Row? throws SqlError {
let row = try (self as _sql.Rows).next();
if (let row = row) {
return row as Row;
} else {
return nil;
}
}
Return the next row of this result set.
Returns nil
if there are no more rows.
[src]
pub fn next(self): Row? throws SqlError {
let row = try (self as _sql.Rows).next();
if (let row = row) {
return row as Row;
} else {
return nil;
}
}
Return the next row of this result set.
Returns nil
if there are no more rows.
Return the next row of this result set.
Returns nil
if there are no more rows.
close
pub fn close(self)
[src]
pub fn close(self) {
(self as _sql.Rows).close();
}
Close the rows.
close
pub fn close(self)
[src]
pub fn close(self) {
(self as _sql.Rows).close();
}
Close the rows.
Close the rows.
[src]
pub fn scan<T>(self): T? throws SqlError {
let row = try self.next();
if (let row = row) {
return try row.scan::<T>();
} else {
return nil;
}
}
Get the next record and deserialize it.
[src]
pub fn scan<T>(self): T? throws SqlError {
let row = try self.next();
if (let row = row) {
return try row.scan::<T>();
} else {
return nil;
}
}
Get the next record and deserialize it.
Get the next record and deserialize it.
nv,
use sql.Connection;
struct User {
name: string,
city: string,
#[serde(rename = "id")]
stuff_no: int,
}
fn main() throws {
let conn = try Connection.connect("sqlite::memory:");
let rows = try conn.query("SELECT * FROM users");
let user = try rows.scan::<User>();
assert_eq user?.name, "Jason Lee";
assert_eq user?.city, "Chengdu";
assert_eq user?.stuff_no, 100;
}
[src]
pub fn scan_all<T>(self): [T] throws SqlError {
let items: [T] = [];
while (let item = try self.scan::<T>()) {
items.push(item);
}
return items;
}
Scan all rows and deserialize them into a [T]
.
[src]
pub fn scan_all<T>(self): [T] throws SqlError {
let items: [T] = [];
while (let item = try self.scan::<T>()) {
items.push(item);
}
return items;
}
Scan all rows and deserialize them into a [T]
.
Scan all rows and deserialize them into a [T]
.
This is a convenience method for rows.scan::<T>()
.
It will consume all rows in the result set.