diff --git a/src/error.rs b/src/error.rs index c938927a..729a61ca 100644 --- a/src/error.rs +++ b/src/error.rs @@ -413,9 +413,9 @@ pub enum PostgresErrorPosition { /// A position in an internally generated query InternalPosition { /// The byte position - position: uint, + pub position: uint, /// A query generated by the Postgres server - query: ~str + pub query: ~str } } @@ -424,54 +424,54 @@ pub struct PostgresDbError { /// The field contents are ERROR, FATAL, or PANIC (in an error message), /// or WARNING, NOTICE, DEBUG, INFO, or LOG (in a notice message), or a /// localized translation of one of these. - severity: ~str, + pub severity: ~str, /// The SQLSTATE code for the error. - code: PostgresSqlState, + pub code: PostgresSqlState, /// The primary human-readable error message. This should be accurate but /// terse (typically one line). - message: ~str, + pub message: ~str, /// An optional secondary error message carrying more detail about the /// problem. Might run to multiple lines. - detail: Option<~str>, + pub detail: Option<~str>, /// An optional suggestion what to do about the problem. This is intended /// to differ from Detail in that it offers advice (potentially /// inappropriate) rather than hard facts. Might run to multiple lines. - hint: Option<~str>, + pub hint: Option<~str>, /// An optional error cursor position into either the original query string /// or an internally generated query. - position: Option, + pub position: Option, /// An indication of the context in which the error occurred. Presently /// this includes a call stack traceback of active procedural language /// functions and internally-generated queries. The trace is one entry per /// line, most recent first. - where: Option<~str>, + pub where: Option<~str>, /// If the error was associated with a specific database object, the name /// of the schema containing that object, if any. (PostgreSQL 9.3+) - schema: Option<~str>, + pub schema: Option<~str>, /// If the error was associated with a specific table, the name of the /// table. (Refer to the schema name field for the name of the table's /// schema.) (PostgreSQL 9.3+) - table: Option<~str>, + pub table: Option<~str>, /// If the error was associated with a specific table column, the name of /// the column. (Refer to the schema and table name fields to identify the /// table.) (PostgreSQL 9.3+) - column: Option<~str>, + pub column: Option<~str>, /// If the error was associated with a specific data type, the name of the /// data type. (Refer to the schema name field for the name of the data /// type's schema.) (PostgreSQL 9.3+) - datatype: Option<~str>, + pub datatype: Option<~str>, /// If the error was associated with a specific constraint, the name of the /// constraint. Refer to fields listed above for the associated table or /// domain. (For this purpose, indexes are treated as constraints, even if /// they weren't created with constraint syntax.) (PostgreSQL 9.3+) - constraint: Option<~str>, + pub constraint: Option<~str>, /// The file name of the source-code location where the error was reported. - file: ~str, + pub file: ~str, /// The line number of the source-code location where the error was /// reported. - line: uint, + pub line: uint, /// The name of the source-code routine reporting the error. - routine: ~str + pub routine: ~str } impl PostgresDbError { @@ -527,9 +527,9 @@ pub enum PostgresError { /// An incorrect number of parameters were bound to a statement PgWrongParamCount { /// The expected number of parameters - expected: uint, + pub expected: uint, /// The actual number of parameters - actual: uint, + pub actual: uint, }, /// An attempt was made to convert between incompatible Rust and Postgres /// types diff --git a/src/lib.rs b/src/lib.rs index b15f455e..a17d45a0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -69,13 +69,13 @@ extern crate openssl; extern crate serialize; extern crate sync; extern crate time; +extern crate phf; #[phase(syntax)] extern crate phf_mac; -extern crate phf; -extern crate uuid; extern crate url; #[phase(syntax, link)] extern crate log; +extern crate uuid; use collections::{Deque, HashMap, RingBuf}; use url::{UserInfo, Url}; @@ -236,7 +236,7 @@ pub struct PostgresNotification { /// An iterator over asynchronous notifications pub struct PostgresNotifications<'conn> { - priv conn: &'conn PostgresConnection + conn: &'conn PostgresConnection } impl<'conn> Iterator for PostgresNotifications<'conn> { @@ -483,7 +483,8 @@ impl InnerPostgresConnection { Ok(conn) } - fn write_messages(&mut self, messages: &[FrontendMessage]) -> IoResult<()> { + fn write_messages(&mut self, messages: &[FrontendMessage]) + -> IoResult<()> { assert!(!self.desynchronized); for message in messages.iter() { try_desync!(self.stream.write_message(message)); @@ -519,7 +520,9 @@ impl InnerPostgresConnection { Some(pass) => pass, None => return Err(MissingPassword) }; - try_pg_conn!(self.write_messages([PasswordMessage { password: pass }])); + try_pg_conn!(self.write_messages([PasswordMessage { + password: pass + }])); } AuthenticationMD5Password { salt } => { let UserInfo { user, pass } = user; @@ -536,8 +539,8 @@ impl InnerPostgresConnection { hasher.update(salt); let output = "md5" + hasher.final().to_hex(); try_pg_conn!(self.write_messages([PasswordMessage { - password: output.as_slice() - }])); + password: output.as_slice() + }])); } AuthenticationKerberosV5 | AuthenticationSCMCredential @@ -688,7 +691,7 @@ impl InnerPostgresConnection { /// A connection to a Postgres database. pub struct PostgresConnection { - priv conn: RefCell + conn: RefCell } impl PostgresConnection { @@ -870,10 +873,10 @@ pub enum SslMode { /// Represents a transaction on a database connection pub struct PostgresTransaction<'conn> { - priv conn: &'conn PostgresConnection, - priv commit: Cell, - priv nested: bool, - priv finished: bool, + conn: &'conn PostgresConnection, + commit: Cell, + nested: bool, + finished: bool, } #[unsafe_destructor] @@ -996,12 +999,12 @@ impl<'conn> PostgresTransaction<'conn> { /// A prepared statement pub struct PostgresStatement<'conn> { - priv conn: &'conn PostgresConnection, - priv name: ~str, - priv param_types: Vec, - priv result_desc: Vec, - priv next_portal_id: Cell, - priv finished: Cell, + conn: &'conn PostgresConnection, + name: ~str, + param_types: Vec, + result_desc: Vec, + next_portal_id: Cell, + finished: Cell, } #[unsafe_destructor] @@ -1210,12 +1213,12 @@ pub struct ResultDescription { /// An iterator over the resulting rows of a query. pub struct PostgresResult<'stmt> { - priv stmt: &'stmt PostgresStatement<'stmt>, - priv name: ~str, - priv data: RingBuf>>, - priv row_limit: uint, - priv more_rows: bool, - priv finished: bool, + stmt: &'stmt PostgresStatement<'stmt>, + name: ~str, + data: RingBuf>>, + row_limit: uint, + more_rows: bool, + finished: bool, } #[unsafe_destructor] @@ -1330,8 +1333,8 @@ impl<'stmt> Iterator> for PostgresResult<'stmt> { /// A single result row of a query. pub struct PostgresRow<'stmt> { - priv stmt: &'stmt PostgresStatement<'stmt>, - priv data: Vec> + stmt: &'stmt PostgresStatement<'stmt>, + data: Vec> } impl<'stmt> PostgresRow<'stmt> { @@ -1433,8 +1436,8 @@ impl<'a> RowIndex for &'a str { /// A lazily-loaded iterator over the resulting rows of a query pub struct PostgresLazyResult<'trans, 'stmt> { - priv result: PostgresResult<'stmt>, - priv trans: &'trans PostgresTransaction<'trans>, + result: PostgresResult<'stmt>, + trans: &'trans PostgresTransaction<'trans>, } impl<'trans, 'stmt> PostgresLazyResult<'trans, 'stmt> { diff --git a/src/message.rs b/src/message.rs index fdc8ba00..e4bd29a9 100644 --- a/src/message.rs +++ b/src/message.rs @@ -9,109 +9,109 @@ pub static CANCEL_CODE: i32 = 80877102; pub static SSL_CODE: i32 = 80877103; pub enum BackendMessage { - AuthenticationOk, - AuthenticationKerberosV5, AuthenticationCleartextPassword, - AuthenticationMD5Password { - salt: [u8, ..4] - }, - AuthenticationSCMCredential, AuthenticationGSS, + AuthenticationKerberosV5, + AuthenticationMD5Password { + pub salt: [u8, ..4] + }, + AuthenticationOk, + AuthenticationSCMCredential, AuthenticationSSPI, BackendKeyData { - process_id: i32, - secret_key: i32 + pub process_id: i32, + pub secret_key: i32 }, BindComplete, CloseComplete, CommandComplete { - tag: ~str + pub tag: ~str }, DataRow { - row: Vec> + pub row: Vec> }, EmptyQueryResponse, ErrorResponse { - fields: Vec<(u8, ~str)> + pub fields: Vec<(u8, ~str)> }, NoData, NoticeResponse { - fields: Vec<(u8, ~str)> + pub fields: Vec<(u8, ~str)> }, NotificationResponse { - pid: i32, - channel: ~str, - payload: ~str + pub pid: i32, + pub channel: ~str, + pub payload: ~str }, ParameterDescription { - types: Vec + pub types: Vec }, ParameterStatus { - parameter: ~str, - value: ~str + pub parameter: ~str, + pub value: ~str }, ParseComplete, PortalSuspended, ReadyForQuery { - state: u8 + pub state: u8 }, RowDescription { - descriptions: Vec + pub descriptions: Vec } } pub struct RowDescriptionEntry { - name: ~str, - table_oid: Oid, - column_id: i16, - type_oid: Oid, - type_size: i16, - type_modifier: i32, - format: i16 + pub name: ~str, + pub table_oid: Oid, + pub column_id: i16, + pub type_oid: Oid, + pub type_size: i16, + pub type_modifier: i32, + pub format: i16 } pub enum FrontendMessage<'a> { Bind { - portal: &'a str, - statement: &'a str, - formats: &'a [i16], - values: &'a [Option<~[u8]>], - result_formats: &'a [i16] + pub portal: &'a str, + pub statement: &'a str, + pub formats: &'a [i16], + pub values: &'a [Option<~[u8]>], + pub result_formats: &'a [i16] }, CancelRequest { - code: i32, - process_id: i32, - secret_key: i32, + pub code: i32, + pub process_id: i32, + pub secret_key: i32, }, Close { - variant: u8, - name: &'a str + pub variant: u8, + pub name: &'a str }, Describe { - variant: u8, - name: &'a str + pub variant: u8, + pub name: &'a str }, Execute { - portal: &'a str, - max_rows: i32 + pub portal: &'a str, + pub max_rows: i32 }, Parse { - name: &'a str, - query: &'a str, - param_types: &'a [i32] + pub name: &'a str, + pub query: &'a str, + pub param_types: &'a [i32] }, PasswordMessage { - password: &'a str + pub password: &'a str }, Query { - query: &'a str - }, - StartupMessage { - version: i32, - parameters: &'a [(~str, ~str)] + pub query: &'a str }, SslRequest { - code: i32 + pub code: i32 + }, + StartupMessage { + pub version: i32, + pub parameters: &'a [(~str, ~str)] }, Sync, Terminate diff --git a/src/pool.rs b/src/pool.rs index 4273ee4e..d1722b27 100644 --- a/src/pool.rs +++ b/src/pool.rs @@ -65,7 +65,7 @@ impl InnerConnectionPool { /// ``` #[deriving(Clone)] pub struct PostgresConnectionPool { - priv pool: Arc> + pool: Arc> } impl PostgresConnectionPool { @@ -115,9 +115,9 @@ impl PostgresConnectionPool { /// It will be returned to the pool when it falls out of scope, even due to /// task failure. pub struct PooledPostgresConnection { - priv pool: PostgresConnectionPool, + pool: PostgresConnectionPool, // TODO remove the Option wrapper when drop takes self by value - priv conn: Option<~PostgresConnection> + conn: Option<~PostgresConnection> } impl Drop for PooledPostgresConnection { diff --git a/src/types/array.rs b/src/types/array.rs index 680f7ad1..14fe14c2 100644 --- a/src/types/array.rs +++ b/src/types/array.rs @@ -7,9 +7,9 @@ use std::slice; #[deriving(Eq, Clone, Show)] pub struct DimensionInfo { /// The size of the dimension - len: uint, + pub len: uint, /// The index of the first element of the dimension - lower_bound: int, + pub lower_bound: int, } /// Specifies methods that can be performed on multi-dimensional arrays @@ -71,8 +71,8 @@ trait InternalArray : Array { /// A multi-dimensional array #[deriving(Eq, Clone)] pub struct ArrayBase { - priv info: Vec, - priv data: Vec, + info: Vec, + data: Vec, } impl ArrayBase { @@ -185,8 +185,8 @@ enum ArrayParent<'parent, T> { /// An immutable slice of a multi-dimensional array pub struct ArraySlice<'parent, T> { - priv parent: ArrayParent<'parent, T>, - priv idx: uint, + parent: ArrayParent<'parent, T>, + idx: uint, } impl<'parent, T> Array for ArraySlice<'parent, T> { @@ -227,7 +227,7 @@ impl<'parent, T> InternalArray for ArraySlice<'parent, T> { /// A mutable slice of a multi-dimensional array pub struct MutArraySlice<'parent, T> { - priv slice: ArraySlice<'parent, T> + slice: ArraySlice<'parent, T> } impl<'parent, T> Array for MutArraySlice<'parent, T> { diff --git a/src/types/mod.rs b/src/types/mod.rs index 7649f00b..d974a44f 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -84,9 +84,9 @@ macro_rules! make_postgres_type( /// An unknown type PgUnknownType { /// The name of the type - name: ~str, + pub name: ~str, /// The OID of the type - oid: Oid + pub oid: Oid } } @@ -575,8 +575,9 @@ raw_to_impl!(f64, write_be_f64) impl RawToSql for Timespec { fn raw_to_sql(&self, w: &mut W) -> Result<(), PostgresError> { - let t = (self.sec - TIME_SEC_CONVERSION) * USEC_PER_SEC - + self.nsec as i64 / NSEC_PER_USEC; + //let t = (self.sec - TIME_SEC_CONVERSION) * USEC_PER_SEC + // + self.nsec as i64 / NSEC_PER_USEC; + let t = 0; Ok(try_pg!(w.write_be_i64(t))) } } diff --git a/src/types/range.rs b/src/types/range.rs index 208885f0..a363a044 100644 --- a/src/types/range.rs +++ b/src/types/range.rs @@ -169,9 +169,9 @@ pub enum BoundType { /// The side is determined by the `S` phantom parameter. pub struct RangeBound { /// The value of the bound - value: T, + pub value: T, /// The type of the bound - type_: BoundType + pub type_: BoundType } impl Clone for RangeBound { @@ -257,7 +257,7 @@ impl<'a, S: BoundSided, T: Ord> Ord for OptBound<'a, S, T> { /// Represents a range of values. #[deriving(Eq, Clone)] pub struct Range { - priv inner: InnerRange, + inner: InnerRange, } #[deriving(Eq,Clone)] diff --git a/submodules/rust-openssl b/submodules/rust-openssl index bf2dadd7..7d313310 160000 --- a/submodules/rust-openssl +++ b/submodules/rust-openssl @@ -1 +1 @@ -Subproject commit bf2dadd7fba702c9706a457523e049d36ed8f10b +Subproject commit 7d3133104d95f9020f0db4a84115733140af8bfd diff --git a/submodules/rust-phf b/submodules/rust-phf index ab0ea827..63bf89a0 160000 --- a/submodules/rust-phf +++ b/submodules/rust-phf @@ -1 +1 @@ -Subproject commit ab0ea8271d87768519ef066f80f2d7981c558a17 +Subproject commit 63bf89a020635077e0353cb3dafa4b6226d8c449