@@ -436,6 +436,13 @@ to_option_impl!(PgFloat4, f32)
436
436
to_conversions_impl ! ( PgFloat8 , f64 , write_be_f64)
437
437
to_option_impl ! ( PgFloat8 , f64 )
438
438
439
+ impl ToSql for ~str {
440
+ fn to_sql ( & self , ty : PostgresType ) -> ( Format , Option < ~[ u8 ] > ) {
441
+ check_types ! ( PgVarchar | PgText | PgCharN , ty)
442
+ ( Text , Some ( self . as_bytes ( ) . to_owned ( ) ) )
443
+ }
444
+ }
445
+
439
446
impl < ' self > ToSql for & ' self str {
440
447
fn to_sql ( & self , ty : PostgresType ) -> ( Format , Option < ~[ u8 ] > ) {
441
448
check_types ! ( PgVarchar | PgText | PgCharN , ty)
@@ -446,6 +453,13 @@ impl<'self> ToSql for &'self str {
446
453
to_option_impl ! ( PgVarchar | PgText | PgCharN , ~str )
447
454
to_option_impl ! ( self , PgVarchar | PgText | PgCharN , & ' self str )
448
455
456
+ impl ToSql for ~[ u8 ] {
457
+ fn to_sql ( & self , ty : PostgresType ) -> ( Format , Option < ~[ u8 ] > ) {
458
+ check_types ! ( PgByteA , ty)
459
+ ( Binary , Some ( self . to_owned ( ) ) )
460
+ }
461
+ }
462
+
449
463
impl < ' self > ToSql for & ' self [ u8 ] {
450
464
fn to_sql ( & self , ty : PostgresType ) -> ( Format , Option < ~[ u8 ] > ) {
451
465
check_types ! ( PgByteA , ty)
0 commit comments