Skip to content

Commit

Permalink
Unified argument names of Query methods (#1848)
Browse files Browse the repository at this point in the history
Just a tiny cleanup.
  • Loading branch information
YohDeadfall authored Sep 10, 2024
1 parent f50f6bb commit b4c4441
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions pgrx/src/spi/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub trait Query<'conn>: Sized {
self,
client: &SpiClient<'conn>,
limit: Option<libc::c_long>,
arguments: Self::Arguments,
args: Self::Arguments,
) -> SpiResult<SpiTupleTable<'conn>>;

/// Open a cursor for the query.
Expand All @@ -48,9 +48,9 @@ impl<'conn> Query<'conn> for &String {
self,
client: &SpiClient<'conn>,
limit: Option<libc::c_long>,
arguments: Self::Arguments,
args: Self::Arguments,
) -> SpiResult<SpiTupleTable<'conn>> {
self.as_str().execute(client, limit, arguments)
self.as_str().execute(client, limit, args)
}

fn try_open_cursor(
Expand Down Expand Up @@ -97,15 +97,15 @@ impl<'conn> Query<'conn> for &str {
self,
_client: &SpiClient<'conn>,
limit: Option<libc::c_long>,
arguments: Self::Arguments,
args: Self::Arguments,
) -> SpiResult<SpiTupleTable<'conn>> {
// SAFETY: no concurrent access
unsafe {
pg_sys::SPI_tuptable = std::ptr::null_mut();
}

let src = CString::new(self).expect("query contained a null byte");
let status_code = match arguments {
let status_code = match args {
Some(args) => {
let nargs = args.len();
let (mut argtypes, mut datums, nulls) = args_to_datums(args);
Expand Down Expand Up @@ -198,9 +198,9 @@ impl<'conn> Query<'conn> for &OwnedPreparedStatement {
self,
client: &SpiClient<'conn>,
limit: Option<libc::c_long>,
arguments: Self::Arguments,
args: Self::Arguments,
) -> SpiResult<SpiTupleTable<'conn>> {
(&self.0).execute(client, limit, arguments)
(&self.0).execute(client, limit, args)
}

fn try_open_cursor(
Expand All @@ -219,9 +219,9 @@ impl<'conn> Query<'conn> for OwnedPreparedStatement {
self,
client: &SpiClient<'conn>,
limit: Option<libc::c_long>,
arguments: Self::Arguments,
args: Self::Arguments,
) -> SpiResult<SpiTupleTable<'conn>> {
(&self.0).execute(client, limit, arguments)
(&self.0).execute(client, limit, args)
}

fn try_open_cursor(
Expand Down Expand Up @@ -275,14 +275,14 @@ impl<'conn: 'stmt, 'stmt> Query<'conn> for &'stmt PreparedStatement<'conn> {
self,
_client: &SpiClient<'conn>,
limit: Option<libc::c_long>,
arguments: Self::Arguments,
args: Self::Arguments,
) -> SpiResult<SpiTupleTable<'conn>> {
// SAFETY: no concurrent access
unsafe {
pg_sys::SPI_tuptable = std::ptr::null_mut();
}

let (mut datums, mut nulls) = self.args_to_datums(arguments)?;
let (mut datums, mut nulls) = self.args_to_datums(args)?;

// SAFETY: all arguments are prepared above
let status_code = unsafe {
Expand Down Expand Up @@ -327,9 +327,9 @@ impl<'conn> Query<'conn> for PreparedStatement<'conn> {
self,
client: &SpiClient<'conn>,
limit: Option<libc::c_long>,
arguments: Self::Arguments,
args: Self::Arguments,
) -> SpiResult<SpiTupleTable<'conn>> {
(&self).execute(client, limit, arguments)
(&self).execute(client, limit, args)
}

fn try_open_cursor(
Expand Down

0 comments on commit b4c4441

Please sign in to comment.