(oid) == 3927 ? 3926 : 0 \
)
#endif
+#ifndef PHP_PQ_DELIM_OF_ARRAY
+# define PHP_PQ_DELIM_OF_ARRAY(oid) (\
+ (oid) == 16 ? '\054' : \
+ (oid) == 17 ? '\054' : \
+ (oid) == 18 ? '\054' : \
+ (oid) == 19 ? '\054' : \
+ (oid) == 20 ? '\054' : \
+ (oid) == 21 ? '\054' : \
+ (oid) == 22 ? '\054' : \
+ (oid) == 23 ? '\054' : \
+ (oid) == 24 ? '\054' : \
+ (oid) == 25 ? '\054' : \
+ (oid) == 26 ? '\054' : \
+ (oid) == 27 ? '\054' : \
+ (oid) == 28 ? '\054' : \
+ (oid) == 29 ? '\054' : \
+ (oid) == 30 ? '\054' : \
+ (oid) == 71 ? '\054' : \
+ (oid) == 75 ? '\054' : \
+ (oid) == 81 ? '\054' : \
+ (oid) == 83 ? '\054' : \
+ (oid) == 114 ? '\054' : \
+ (oid) == 142 ? '\054' : \
+ (oid) == 143 ? '\054' : \
+ (oid) == 194 ? '\054' : \
+ (oid) == 199 ? '\054' : \
+ (oid) == 210 ? '\054' : \
+ (oid) == 600 ? '\054' : \
+ (oid) == 601 ? '\054' : \
+ (oid) == 602 ? '\054' : \
+ (oid) == 603 ? '\073' : \
+ (oid) == 604 ? '\054' : \
+ (oid) == 628 ? '\054' : \
+ (oid) == 629 ? '\054' : \
+ (oid) == 650 ? '\054' : \
+ (oid) == 651 ? '\054' : \
+ (oid) == 700 ? '\054' : \
+ (oid) == 701 ? '\054' : \
+ (oid) == 702 ? '\054' : \
+ (oid) == 703 ? '\054' : \
+ (oid) == 704 ? '\054' : \
+ (oid) == 705 ? '\054' : \
+ (oid) == 718 ? '\054' : \
+ (oid) == 719 ? '\054' : \
+ (oid) == 790 ? '\054' : \
+ (oid) == 791 ? '\054' : \
+ (oid) == 829 ? '\054' : \
+ (oid) == 869 ? '\054' : \
+ (oid) == 1000 ? '\054' : \
+ (oid) == 1001 ? '\054' : \
+ (oid) == 1002 ? '\054' : \
+ (oid) == 1003 ? '\054' : \
+ (oid) == 1005 ? '\054' : \
+ (oid) == 1006 ? '\054' : \
+ (oid) == 1007 ? '\054' : \
+ (oid) == 1008 ? '\054' : \
+ (oid) == 1009 ? '\054' : \
+ (oid) == 1010 ? '\054' : \
+ (oid) == 1011 ? '\054' : \
+ (oid) == 1012 ? '\054' : \
+ (oid) == 1013 ? '\054' : \
+ (oid) == 1014 ? '\054' : \
+ (oid) == 1015 ? '\054' : \
+ (oid) == 1016 ? '\054' : \
+ (oid) == 1017 ? '\054' : \
+ (oid) == 1018 ? '\054' : \
+ (oid) == 1019 ? '\054' : \
+ (oid) == 1020 ? '\073' : \
+ (oid) == 1021 ? '\054' : \
+ (oid) == 1022 ? '\054' : \
+ (oid) == 1023 ? '\054' : \
+ (oid) == 1024 ? '\054' : \
+ (oid) == 1025 ? '\054' : \
+ (oid) == 1027 ? '\054' : \
+ (oid) == 1028 ? '\054' : \
+ (oid) == 1033 ? '\054' : \
+ (oid) == 1034 ? '\054' : \
+ (oid) == 1040 ? '\054' : \
+ (oid) == 1041 ? '\054' : \
+ (oid) == 1042 ? '\054' : \
+ (oid) == 1043 ? '\054' : \
+ (oid) == 1082 ? '\054' : \
+ (oid) == 1083 ? '\054' : \
+ (oid) == 1114 ? '\054' : \
+ (oid) == 1115 ? '\054' : \
+ (oid) == 1182 ? '\054' : \
+ (oid) == 1183 ? '\054' : \
+ (oid) == 1184 ? '\054' : \
+ (oid) == 1185 ? '\054' : \
+ (oid) == 1186 ? '\054' : \
+ (oid) == 1187 ? '\054' : \
+ (oid) == 1231 ? '\054' : \
+ (oid) == 1263 ? '\054' : \
+ (oid) == 1266 ? '\054' : \
+ (oid) == 1270 ? '\054' : \
+ (oid) == 1560 ? '\054' : \
+ (oid) == 1561 ? '\054' : \
+ (oid) == 1562 ? '\054' : \
+ (oid) == 1563 ? '\054' : \
+ (oid) == 1700 ? '\054' : \
+ (oid) == 1790 ? '\054' : \
+ (oid) == 2201 ? '\054' : \
+ (oid) == 2202 ? '\054' : \
+ (oid) == 2203 ? '\054' : \
+ (oid) == 2204 ? '\054' : \
+ (oid) == 2205 ? '\054' : \
+ (oid) == 2206 ? '\054' : \
+ (oid) == 2207 ? '\054' : \
+ (oid) == 2208 ? '\054' : \
+ (oid) == 2209 ? '\054' : \
+ (oid) == 2210 ? '\054' : \
+ (oid) == 2211 ? '\054' : \
+ (oid) == 2249 ? '\054' : \
+ (oid) == 2275 ? '\054' : \
+ (oid) == 2276 ? '\054' : \
+ (oid) == 2277 ? '\054' : \
+ (oid) == 2278 ? '\054' : \
+ (oid) == 2279 ? '\054' : \
+ (oid) == 2280 ? '\054' : \
+ (oid) == 2281 ? '\054' : \
+ (oid) == 2282 ? '\054' : \
+ (oid) == 2283 ? '\054' : \
+ (oid) == 2287 ? '\054' : \
+ (oid) == 2776 ? '\054' : \
+ (oid) == 2949 ? '\054' : \
+ (oid) == 2950 ? '\054' : \
+ (oid) == 2951 ? '\054' : \
+ (oid) == 2970 ? '\054' : \
+ (oid) == 3115 ? '\054' : \
+ (oid) == 3220 ? '\054' : \
+ (oid) == 3221 ? '\054' : \
+ (oid) == 3500 ? '\054' : \
+ (oid) == 3614 ? '\054' : \
+ (oid) == 3615 ? '\054' : \
+ (oid) == 3642 ? '\054' : \
+ (oid) == 3643 ? '\054' : \
+ (oid) == 3644 ? '\054' : \
+ (oid) == 3645 ? '\054' : \
+ (oid) == 3734 ? '\054' : \
+ (oid) == 3735 ? '\054' : \
+ (oid) == 3769 ? '\054' : \
+ (oid) == 3770 ? '\054' : \
+ (oid) == 3802 ? '\054' : \
+ (oid) == 3807 ? '\054' : \
+ (oid) == 3831 ? '\054' : \
+ (oid) == 3838 ? '\054' : \
+ (oid) == 3904 ? '\054' : \
+ (oid) == 3905 ? '\054' : \
+ (oid) == 3906 ? '\054' : \
+ (oid) == 3907 ? '\054' : \
+ (oid) == 3908 ? '\054' : \
+ (oid) == 3909 ? '\054' : \
+ (oid) == 3910 ? '\054' : \
+ (oid) == 3911 ? '\054' : \
+ (oid) == 3912 ? '\054' : \
+ (oid) == 3913 ? '\054' : \
+ (oid) == 3926 ? '\054' : \
+ (oid) == 3927 ? '\054' : 0 \
+)
+#endif
}
}
+class Point {
+ public $x;
+ public $y;
+ function __construct($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+}
+
+class Box {
+ public $p1;
+ public $p2;
+ function __construct(Point $p1, Point $p2) {
+ $this->p1 = $p1;
+ $this->p2 = $p2;
+ }
+}
+
+class BoxConverter extends Converter
+{
+ function convertTypes() {
+ return [ $this->types["box"]->oid ];
+ }
+
+ function convertToString($box, $type) {
+ return sprintf("(%F,%F),(%F,%F)",
+ $box->p1->x, $box->p1->y,
+ $box->p2->x, $box->p2->y
+ );
+ }
+
+ function convertFromString($data, $type) {
+ list($p1x, $p1y, $p2x, $p2y) = sscanf($data, "(%f,%f),(%f,%f)");
+ return new Box(new Point($p1x, $p1y), new Point($p2x, $p2y));
+ }
+}
+
class Text {
private $data;
function __construct($data) {
if (!defined("pq\\Types::JSON")) {
$c->setConverter(new JSONConverter($t));
}
+$c->setConverter(new BoxConverter($t));
+
$r = $c->execParams("SELECT \$1 as hs, \$2 as iv, \$3 as oids, \$4 as js, \$5 as ia, \$6 as ta, \$7 as ba, \$8 as da, \$9 as dbl, \$10 as bln, ".
- "\$11 as dt1, \$12 as dt2, \$13 as dt3, \$14 as dt4, \$15 as dt5, \$16 as dt6, \$17 as dt7, \$18 as dt8, \$19 as txta ",
+ "\$11 as dt1, \$12 as dt2, \$13 as dt3, \$14 as dt4, \$15 as dt5, \$16 as dt6, \$17 as dt7, \$18 as dt8, \$19 as txta, \$20 as boxa",
array(
// hstore
array(
new pq\Datetime,
new pq\Datetime,
new pq\Datetime,
+ // text array
[new Text(0), new Text(" or "), new Text(true)],
+ // box array
+ [new Box(new Point(1,2), new Point(2,3)), new Box(new Point(3,4), new Point(4,5))],
),
array(
$t["hstore"]->oid,
$t["abstime"]->oid,
$t["timestamp"]->oid,
$t["timestamptz"]->oid,
- $t["_text"]->oid
+ $t["_text"]->oid,
+ $t["_box"]->oid
)
);
[2]=>
string(1) "1"
}
+ [19]=>
+ array(2) {
+ [0]=>
+ object(Box)#%d (2) {
+ ["p1"]=>
+ object(Point)#%d (2) {
+ ["x"]=>
+ float(2)
+ ["y"]=>
+ float(3)
+ }
+ ["p2"]=>
+ object(Point)#%d (2) {
+ ["x"]=>
+ float(1)
+ ["y"]=>
+ float(2)
+ }
+ }
+ [1]=>
+ object(Box)#%d (2) {
+ ["p1"]=>
+ object(Point)#%d (2) {
+ ["x"]=>
+ float(4)
+ ["y"]=>
+ float(5)
+ }
+ ["p2"]=>
+ object(Point)#%d (2) {
+ ["x"]=>
+ float(3)
+ ["y"]=>
+ float(4)
+ }
+ }
+ }
}
}
Done