Fix some types to match the postgres implementation

This commit is contained in:
Steven Fackler 2014-06-07 16:01:50 -07:00
parent cb052398d6
commit 5e363204e1
2 changed files with 10 additions and 9 deletions

View File

@ -1022,11 +1022,12 @@ impl<'conn> PostgresTransaction<'conn> {
///
/// No more than `row_limit` rows will be stored in memory at a time. Rows
/// will be pulled from the database in batches of `row_limit` as needed.
/// If `row_limit` is 0, `lazy_query` is equivalent to `query`.
/// If `row_limit` is less than or equal to 0, `lazy_query` is equivalent
/// to `query`.
pub fn lazy_query<'trans, 'stmt>(&'trans self,
stmt: &'stmt PostgresStatement,
params: &[&ToSql],
row_limit: u32)
row_limit: i32)
-> PostgresResult<PostgresLazyRows
<'trans, 'stmt>> {
if self.conn as *_ != stmt.conn as *_ {
@ -1083,7 +1084,7 @@ impl<'conn> PostgresStatement<'conn> {
Ok(())
}
fn inner_execute(&self, portal_name: &str, row_limit: u32, params: &[&ToSql])
fn inner_execute(&self, portal_name: &str, row_limit: i32, params: &[&ToSql])
-> PostgresResult<()> {
if self.param_types.len() != params.len() {
return Err(PgWrongParamCount {
@ -1127,7 +1128,7 @@ impl<'conn> PostgresStatement<'conn> {
}
}
fn lazy_query<'a>(&'a self, row_limit: u32, params: &[&ToSql])
fn lazy_query<'a>(&'a self, row_limit: i32, params: &[&ToSql])
-> PostgresResult<PostgresRows<'a>> {
let id = self.next_portal_id.get();
self.next_portal_id.set(id + 1);
@ -1254,7 +1255,7 @@ pub struct PostgresRows<'stmt> {
stmt: &'stmt PostgresStatement<'stmt>,
name: String,
data: RingBuf<Vec<Option<Vec<u8>>>>,
row_limit: u32,
row_limit: i32,
more_rows: bool,
finished: bool,
}

View File

@ -92,12 +92,12 @@ pub enum FrontendMessage<'a> {
},
Execute {
pub portal: &'a str,
pub max_rows: u32
pub max_rows: i32
},
Parse {
pub name: &'a str,
pub query: &'a str,
pub param_types: &'a [i32]
pub param_types: &'a [Oid]
},
PasswordMessage {
pub password: &'a str
@ -185,7 +185,7 @@ impl<W: Writer> WriteMessage for W {
Execute { portal, max_rows } => {
ident = Some('E');
try!(buf.write_cstr(portal));
try!(buf.write_be_u32(max_rows));
try!(buf.write_be_i32(max_rows));
}
Parse { name, query, param_types } => {
ident = Some('P');
@ -193,7 +193,7 @@ impl<W: Writer> WriteMessage for W {
try!(buf.write_cstr(query));
try!(buf.write_be_i16(param_types.len() as i16));
for ty in param_types.iter() {
try!(buf.write_be_i32(*ty));
try!(buf.write_be_u32(*ty));
}
}
PasswordMessage { password } => {