Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbbc0414

Browse files
committed
Update id types
1 parenteb3f595 commitbbc0414

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

‎tokio-postgres/src/prepare.rs‎

Lines changed: 2 additions & 3 deletions
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‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ use crate::codec::FrontendMessage;
33
usecrate::connection::RequestMessages;
44
usecrate::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
structStatementInner{
129
client:Weak<InnerClient>,
@@ -68,8 +65,8 @@ impl Statement {
6865
#[derive(Debug)]
6966
pubstructColumn{
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-
pubfntable_oid(&self) ->Option<NonZeroU32>{
80+
pubfntable_oid(&self) ->Option<u32>{
8481
self.table_oid
8582
}
8683

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp