@@ -415,7 +415,7 @@ pub enum PostgresErrorPosition {
415415 /// The byte position
416416 pub position : uint ,
417417 /// A query generated by the Postgres server
418- pub query : ~ str
418+ pub query : StrBuf
419419 }
420420}
421421
@@ -424,71 +424,71 @@ pub struct PostgresDbError {
424424 /// The field contents are ERROR, FATAL, or PANIC (in an error message),
425425 /// or WARNING, NOTICE, DEBUG, INFO, or LOG (in a notice message), or a
426426 /// localized translation of one of these.
427- pub severity : ~ str ,
427+ pub severity : StrBuf ,
428428 /// The SQLSTATE code for the error.
429429 pub code : PostgresSqlState ,
430430 /// The primary human-readable error message. This should be accurate but
431431 /// terse (typically one line).
432- pub message : ~ str ,
432+ pub message : StrBuf ,
433433 /// An optional secondary error message carrying more detail about the
434434 /// problem. Might run to multiple lines.
435- pub detail : Option < ~ str > ,
435+ pub detail : Option < StrBuf > ,
436436 /// An optional suggestion what to do about the problem. This is intended
437437 /// to differ from Detail in that it offers advice (potentially
438438 /// inappropriate) rather than hard facts. Might run to multiple lines.
439- pub hint : Option < ~ str > ,
439+ pub hint : Option < StrBuf > ,
440440 /// An optional error cursor position into either the original query string
441441 /// or an internally generated query.
442442 pub position : Option < PostgresErrorPosition > ,
443443 /// An indication of the context in which the error occurred. Presently
444444 /// this includes a call stack traceback of active procedural language
445445 /// functions and internally-generated queries. The trace is one entry per
446446 /// line, most recent first.
447- pub where : Option < ~ str > ,
447+ pub where : Option < StrBuf > ,
448448 /// If the error was associated with a specific database object, the name
449449 /// of the schema containing that object, if any. (PostgreSQL 9.3+)
450- pub schema : Option < ~ str > ,
450+ pub schema : Option < StrBuf > ,
451451 /// If the error was associated with a specific table, the name of the
452452 /// table. (Refer to the schema name field for the name of the table's
453453 /// schema.) (PostgreSQL 9.3+)
454- pub table : Option < ~ str > ,
454+ pub table : Option < StrBuf > ,
455455 /// If the error was associated with a specific table column, the name of
456456 /// the column. (Refer to the schema and table name fields to identify the
457457 /// table.) (PostgreSQL 9.3+)
458- pub column : Option < ~ str > ,
458+ pub column : Option < StrBuf > ,
459459 /// If the error was associated with a specific data type, the name of the
460460 /// data type. (Refer to the schema name field for the name of the data
461461 /// type's schema.) (PostgreSQL 9.3+)
462- pub datatype : Option < ~ str > ,
462+ pub datatype : Option < StrBuf > ,
463463 /// If the error was associated with a specific constraint, the name of the
464464 /// constraint. Refer to fields listed above for the associated table or
465465 /// domain. (For this purpose, indexes are treated as constraints, even if
466466 /// they weren't created with constraint syntax.) (PostgreSQL 9.3+)
467- pub constraint : Option < ~ str > ,
467+ pub constraint : Option < StrBuf > ,
468468 /// The file name of the source-code location where the error was reported.
469- pub file : ~ str ,
469+ pub file : StrBuf ,
470470 /// The line number of the source-code location where the error was
471471 /// reported.
472472 pub line : uint ,
473473 /// The name of the source-code routine reporting the error.
474- pub routine : ~ str
474+ pub routine : StrBuf
475475}
476476
477477impl PostgresDbError {
478478 #[ doc( hidden) ]
479- pub fn new ( fields : Vec < ( u8 , ~ str ) > ) -> PostgresDbError {
480- let mut map: HashMap < u8 , ~ str > = fields. move_iter ( ) . collect ( ) ;
479+ pub fn new ( fields : Vec < ( u8 , StrBuf ) > ) -> PostgresDbError {
480+ let mut map: HashMap < _ , _ > = fields. move_iter ( ) . collect ( ) ;
481481 PostgresDbError {
482482 severity : map. pop ( & ( 'S' as u8 ) ) . unwrap ( ) ,
483- code : PostgresSqlState :: from_code ( map. pop ( & ( 'C' as u8 ) ) . unwrap ( ) ) ,
483+ code : PostgresSqlState :: from_code ( map. pop ( & ( 'C' as u8 ) ) . unwrap ( ) . as_slice ( ) ) ,
484484 message : map. pop ( & ( 'M' as u8 ) ) . unwrap ( ) ,
485485 detail : map. pop ( & ( 'D' as u8 ) ) ,
486486 hint : map. pop ( & ( 'H' as u8 ) ) ,
487487 position : match map. pop ( & ( 'P' as u8 ) ) {
488- Some ( pos) => Some ( Position ( FromStr :: from_str ( pos) . unwrap ( ) ) ) ,
488+ Some ( pos) => Some ( Position ( FromStr :: from_str ( pos. as_slice ( ) ) . unwrap ( ) ) ) ,
489489 None => match map. pop ( & ( 'p' as u8 ) ) {
490490 Some ( pos) => Some ( InternalPosition {
491- position : FromStr :: from_str ( pos) . unwrap ( ) ,
491+ position : FromStr :: from_str ( pos. as_slice ( ) ) . unwrap ( ) ,
492492 query : map. pop ( & ( 'q' as u8 ) ) . unwrap ( )
493493 } ) ,
494494 None => None
@@ -501,7 +501,7 @@ impl PostgresDbError {
501501 datatype : map. pop ( & ( 'd' as u8 ) ) ,
502502 constraint : map. pop ( & ( 'n' as u8 ) ) ,
503503 file : map. pop ( & ( 'F' as u8 ) ) . unwrap ( ) ,
504- line : FromStr :: from_str ( map. pop ( & ( 'L' as u8 ) ) . unwrap ( ) ) . unwrap ( ) ,
504+ line : FromStr :: from_str ( map. pop ( & ( 'L' as u8 ) ) . unwrap ( ) . as_slice ( ) ) . unwrap ( ) ,
505505 routine : map. pop ( & ( 'R' as u8 ) ) . unwrap ( )
506506 }
507507 }
0 commit comments