Commits

Anonymous committed 8557804

Dbi_pg: + timestamptz getters

Comments (0)

Files changed (1)

src/dbi/dbi_pg.ml

 ;
 
 
+type timestamptz = string
+;
+
+
 type sql_t =
   [= sql_u
 
   |  `Time of string
   |  `TimeTZ of string
   |  `Timestamp of string
-  |  `TimestampTZ of string
+  |  `TimestampTZ of timestamptz
   ]
 ;
 
     value string : comp_typer2 string;
     value number : comp_typer2 Decimal.t;
     value int64 : comp_typer2 int64;
+    value timestamptz : comp_typer2 timestamptz;
   end
  =
   struct
         }
     ;
 
+    value get_as_string pres ~row ~col =
+      pres#getvalue row col
+    ;
 
     value string = common
       ~want_ftype:"string"
-      (fun pres ~row ~col ->
-         pres#getvalue row col
-      )
+      get_as_string
     ;
 
     value number = common
       )
     ;
 
+    value timestamptz = common
+      ~want_ftype:"timestamp with time zone"
+      get_as_string
+    ;
+
   end
 ;
 
   common C.int64 ~check_ftype: ( (=) P.INT8 )
 ;
 
+value
+  { utn = ntimestamptz ; utno = ntimestamptz_opt
+  ; uti = itimestamptz ; utio = itimestamptz_opt
+  } =
+  common C.timestamptz ~check_ftype: ( (=) P.TIMESTAMPTZ )
+;
+
 
 
 (*