Skip to content

Commit bbc0414

Browse files
committed
Update id types
1 parent eb3f595 commit bbc0414

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

tokio-postgres/src/prepare.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use log::debug;
1212
use postgres_protocol::message::backend::Message;
1313
use postgres_protocol::message::frontend;
1414
use std::future::Future;
15-
use std::num::{NonZeroI16, NonZeroU32};
1615
use std::pin::Pin;
1716
use std::sync::atomic::{AtomicUsize, Ordering};
1817
use std::sync::Arc;
@@ -98,8 +97,8 @@ pub async fn prepare(
9897
let type_ = get_type(client, field.type_oid()).await?;
9998
let column = Column {
10099
name: field.name().to_string(),
101-
table_oid: NonZeroU32::new(field.table_oid()),
102-
column_id: NonZeroI16::new(field.column_id()),
100+
table_oid: Some(field.table_oid()).filter(|n| *n != 0),
101+
column_id: Some(field.column_id()).filter(|n| *n != 0),
103102
r#type: type_,
104103
};
105104
columns.push(column);

tokio-postgres/src/statement.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ use crate::codec::FrontendMessage;
33
use crate::connection::RequestMessages;
44
use crate::types::Type;
55
use postgres_protocol::message::frontend;
6-
use std::{
7-
num::{NonZeroI16, NonZeroU32},
8-
sync::{Arc, Weak},
9-
};
6+
use std::sync::{Arc, Weak};
107

118
struct StatementInner {
129
client: Weak<InnerClient>,
@@ -68,8 +65,8 @@ impl Statement {
6865
#[derive(Debug)]
6966
pub struct Column {
7067
pub(crate) name: String,
71-
pub(crate) table_oid: Option<NonZeroU32>,
72-
pub(crate) column_id: Option<NonZeroI16>,
68+
pub(crate) table_oid: Option<u32>,
69+
pub(crate) column_id: Option<i16>,
7370
pub(crate) r#type: Type,
7471
}
7572

@@ -80,12 +77,12 @@ impl Column {
8077
}
8178

8279
/// Returns the OID of the underlying database table.
83-
pub fn table_oid(&self) -> Option<NonZeroU32> {
80+
pub fn table_oid(&self) -> Option<u32> {
8481
self.table_oid
8582
}
8683

8784
/// Return the column ID within the underlying database table.
88-
pub fn column_id(&self) -> Option<NonZeroI16> {
85+
pub fn column_id(&self) -> Option<i16> {
8986
self.column_id
9087
}
9188

0 commit comments

Comments
 (0)