@@ -35,6 +35,7 @@ static FLOAT4OID: Oid = 700;
3535static FLOAT8OID : Oid = 701 ;
3636static INT4ARRAYOID : Oid = 1007 ;
3737static INT8ARRAYOID : Oid = 1016 ;
38+ static FLOAT4ARRAYOID : Oid = 1021 ;
3839static BPCHAROID : Oid = 1042 ;
3940static VARCHAROID : Oid = 1043 ;
4041static TIMESTAMPOID : Oid = 1114 ;
@@ -84,6 +85,8 @@ pub enum PostgresType {
8485 PgInt4Array ,
8586 /// INT8[]
8687 PgInt8Array ,
88+ /// FLOAT4[]
89+ PgFloat4Array ,
8790 /// TIMESTAMP
8891 PgTimestamp ,
8992 /// TIMESTAMP WITH TIME ZONE
@@ -127,6 +130,7 @@ impl PostgresType {
127130 FLOAT8OID => PgFloat8 ,
128131 INT4ARRAYOID => PgInt4Array ,
129132 INT8ARRAYOID => PgInt8Array ,
133+ FLOAT4ARRAYOID => PgFloat4Array ,
130134 TIMESTAMPOID => PgTimestamp ,
131135 TIMESTAMPZOID => PgTimestampZ ,
132136 BPCHAROID => PgCharN ,
@@ -196,6 +200,7 @@ macro_rules! raw_from_impl(
196200
197201raw_from_impl ! ( i32 , read_be_i32)
198202raw_from_impl ! ( i64 , read_be_i64)
203+ raw_from_impl ! ( f32 , read_be_f32)
199204
200205impl RawFromSql for Timespec {
201206 fn raw_from_sql < R : Reader > ( raw : & mut R ) -> Timespec {
@@ -260,13 +265,13 @@ from_raw_from_impl!(PgInt4, i32)
260265from_option_impl ! ( i32 )
261266from_raw_from_impl ! ( PgInt8 , i64 )
262267from_option_impl ! ( i64 )
268+ from_raw_from_impl ! ( PgFloat4 , f32 )
269+ from_option_impl ! ( f32 )
263270
264271from_conversions_impl ! ( PgChar , i8 , read_i8)
265272from_option_impl ! ( i8 )
266273from_conversions_impl ! ( PgInt2 , i16 , read_be_i16)
267274from_option_impl ! ( i16 )
268- from_conversions_impl ! ( PgFloat4 , f32 , read_be_f32)
269- from_option_impl ! ( f32 )
270275from_conversions_impl ! ( PgFloat8 , f64 , read_be_f64)
271276from_option_impl ! ( f64 )
272277
@@ -381,6 +386,9 @@ from_option_impl!(ArrayBase<Option<i32>>)
381386from_array_impl ! ( PgInt8Array , i64 )
382387from_option_impl ! ( ArrayBase <Option <i64 >>)
383388
389+ from_array_impl ! ( PgFloat4Array , f32 )
390+ from_option_impl ! ( ArrayBase <Option <f32 >>)
391+
384392from_map_impl ! ( PgUnknownType { name: ~"hstore", .. },
385393 HashMap<~str, Option<~str>>, |buf| {
386394 let mut rdr = BufReader::new(buf.as_slice());
@@ -440,6 +448,7 @@ macro_rules! raw_to_impl(
440448
441449raw_to_impl!(i32, write_be_i32)
442450raw_to_impl!(i64, write_be_i64)
451+ raw_to_impl!(f32, write_be_f32)
443452
444453impl RawToSql for Timespec {
445454 fn raw_to_sql<W: Writer>(&self, w: &mut W) {
@@ -523,13 +532,13 @@ to_raw_to_impl!(PgInt4, i32)
523532to_option_impl!(PgInt4, i32)
524533to_raw_to_impl!(PgInt8, i64)
525534to_option_impl!(PgInt8, i64)
535+ to_raw_to_impl!(PgFloat4, f32)
536+ to_option_impl!(PgFloat4, f32)
526537
527538to_conversions_impl!(PgChar, i8, write_i8)
528539to_option_impl!(PgChar, i8)
529540to_conversions_impl!(PgInt2, i16, write_be_i16)
530541to_option_impl!(PgInt2, i16)
531- to_conversions_impl!(PgFloat4, f32, write_be_f32)
532- to_option_impl!(PgFloat4, f32)
533542to_conversions_impl!(PgFloat8, f64, write_be_f64)
534543to_option_impl!(PgFloat8, f64)
535544
@@ -683,6 +692,9 @@ to_option_impl!(PgInt4Array, ArrayBase<Option<i32>>)
683692to_array_impl!(PgInt8Array, INT8OID, i64)
684693to_option_impl!(PgInt8Array, ArrayBase<Option<i64>>)
685694
695+ to_array_impl!(PgFloat4Array, FLOAT4OID, f32)
696+ to_option_impl!(PgFloat4Array, ArrayBase<Option<f32>>)
697+
686698impl<'self> ToSql for HashMap<~str, Option<~str>> {
687699 fn to_sql(&self, ty: &PostgresType) -> (Format, Option<~[u8]>) {
688700 check_types!(PgUnknownType { name: ~" hstore", .. }, ty)
0 commit comments