Minor cleanup
This commit is contained in:
parent
49bed84c81
commit
d6073039df
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*.so
|
||||
/postgres
|
@ -177,7 +177,7 @@ impl<'self> PostgresConnection<'self> {
|
||||
if ret.is_ok() {
|
||||
self.update("COMMIT", []);
|
||||
} else {
|
||||
self.update("ABORT", []);
|
||||
self.update("ROLLBACK", []);
|
||||
}
|
||||
|
||||
ret
|
||||
@ -370,7 +370,7 @@ impl<'self> PostgresRow<'self> {
|
||||
|
||||
fn as_c_str_array<T>(array: &[~str], blk: &fn(**c_char) -> T) -> T {
|
||||
let mut c_array: ~[*c_char] = vec::with_capacity(array.len() + 1);
|
||||
foreach s in array.iter() {
|
||||
for s in array.iter() {
|
||||
// DANGER, WILL ROBINSON
|
||||
do s.as_c_str |c_s| {
|
||||
c_array.push(c_s);
|
||||
|
@ -1,6 +1,6 @@
|
||||
extern mod postgres;
|
||||
|
||||
use postgres::{PostgresConnection, PostgresRow};
|
||||
use postgres::PostgresConnection;
|
||||
|
||||
macro_rules! chk(
|
||||
($e:expr) => (
|
||||
@ -21,10 +21,9 @@ fn test_basic() {
|
||||
|
||||
let res = chk!(conn.query("SELECT id from basic WHERE id = 101", []));
|
||||
assert_eq!(1, res.len());
|
||||
let rows: ~[PostgresRow] = res.iter().collect();
|
||||
assert_eq!(1, rows.len());
|
||||
assert_eq!(1, rows[0].len());
|
||||
assert_eq!(Some(101), rows[0][0]);
|
||||
assert_eq!(1, res.get(0).len());
|
||||
assert_eq!(1, res.get(0).len());
|
||||
assert_eq!(Some(101), res.get(0)[0]);
|
||||
|
||||
Err::<(), ~str>(~"")
|
||||
};
|
||||
@ -40,10 +39,8 @@ fn test_params() {
|
||||
|
||||
let res = chk!(conn.query("SELECT id from basic WHERE id = $1", [~"101"]));
|
||||
assert_eq!(1, res.len());
|
||||
let rows: ~[PostgresRow] = res.iter().collect();
|
||||
assert_eq!(1, rows.len());
|
||||
assert_eq!(1, rows[0].len());
|
||||
assert_eq!(Some(101), rows[0][0]);
|
||||
assert_eq!(1, res.get(0).len());
|
||||
assert_eq!(Some(101), res.get(0)[0]);
|
||||
|
||||
Err::<(), ~str>(~"")
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user