Mercurial > forge
comparison main/database/src/converters.cc @ 12612:2257648e8ce1 octave-forge
avoid using const_cast, new release 2.3.2
* pq_connection.h/cc: octave_pq_connection now contains pointer to object
of new class octave_pq_connection_rep, containing the pq-specific members
formerly in octave_pq_connection.
* pq_exec.cc, pq_close.cc, pq_update_types.cc, pq_conninfo.cc, pq_lo.cc:
Remove const_cast, use octave_pq_connection_rep object instead.
* __pq_connect__.cc, converters.h/cc, converters_arr_comp.cc, command.h/cc:
Use octave_pq_connection_rep instead of octave_pq_connection.
author | i7tiol |
---|---|
date | Tue, 05 May 2015 07:31:33 +0000 |
parents | 67adec29dee0 |
children | 1af86934c14e |
comparison
equal
deleted
inserted
replaced
12611:4f35a79fa79a | 12612:2257648e8ce1 |
---|---|
52 printf ("\n"); | 52 printf ("\n"); |
53 } | 53 } |
54 | 54 |
55 /* type bool */ | 55 /* type bool */ |
56 | 56 |
57 int to_octave_str_bool (const octave_pq_connection &conn, | 57 int to_octave_str_bool (const octave_pq_connection_rep &conn, |
58 const char *c, octave_value &ov, int nb) | 58 const char *c, octave_value &ov, int nb) |
59 { | 59 { |
60 bool tp = (*c == 't' ? true : false); | 60 bool tp = (*c == 't' ? true : false); |
61 | 61 |
62 ov = octave_value (tp); | 62 ov = octave_value (tp); |
63 | 63 |
64 return 0; | 64 return 0; |
65 } | 65 } |
66 | 66 |
67 int to_octave_bin_bool (const octave_pq_connection &conn, | 67 int to_octave_bin_bool (const octave_pq_connection_rep &conn, |
68 const char *c, octave_value &ov, int nb) | 68 const char *c, octave_value &ov, int nb) |
69 { | 69 { |
70 ov = octave_value (bool (*c)); | 70 ov = octave_value (bool (*c)); |
71 | 71 |
72 return 0; | 72 return 0; |
73 } | 73 } |
74 | 74 |
75 int from_octave_str_bool (const octave_pq_connection &conn, | 75 int from_octave_str_bool (const octave_pq_connection_rep &conn, |
76 const octave_value &ov, oct_pq_dynvec_t &val) | 76 const octave_value &ov, oct_pq_dynvec_t &val) |
77 { | 77 { |
78 bool b = ov.bool_value (); | 78 bool b = ov.bool_value (); |
79 | 79 |
80 if (error_state) | 80 if (error_state) |
87 val.push_back ('\0'); | 87 val.push_back ('\0'); |
88 | 88 |
89 return 0; | 89 return 0; |
90 } | 90 } |
91 | 91 |
92 int from_octave_bin_bool (const octave_pq_connection &conn, | 92 int from_octave_bin_bool (const octave_pq_connection_rep &conn, |
93 const octave_value &ov, oct_pq_dynvec_t &val) | 93 const octave_value &ov, oct_pq_dynvec_t &val) |
94 { | 94 { |
95 bool b = ov.bool_value (); | 95 bool b = ov.bool_value (); |
96 | 96 |
97 if (error_state) | 97 if (error_state) |
120 | 120 |
121 /* end type bool */ | 121 /* end type bool */ |
122 | 122 |
123 /* type oid */ | 123 /* type oid */ |
124 | 124 |
125 int to_octave_str_oid (const octave_pq_connection &conn, | 125 int to_octave_str_oid (const octave_pq_connection_rep &conn, |
126 const char *c, octave_value &ov, int nb) | 126 const char *c, octave_value &ov, int nb) |
127 { | 127 { |
128 return 1; | 128 return 1; |
129 } | 129 } |
130 | 130 |
131 int to_octave_bin_oid (const octave_pq_connection &conn, | 131 int to_octave_bin_oid (const octave_pq_connection_rep &conn, |
132 const char *c, octave_value &ov, int nb) | 132 const char *c, octave_value &ov, int nb) |
133 { | 133 { |
134 ov = octave_value (octave_uint32 (be32toh (*((uint32_t *) c)))); | 134 ov = octave_value (octave_uint32 (be32toh (*((uint32_t *) c)))); |
135 | 135 |
136 return 0; | 136 return 0; |
137 } | 137 } |
138 | 138 |
139 int from_octave_str_oid (const octave_pq_connection &conn, | 139 int from_octave_str_oid (const octave_pq_connection_rep &conn, |
140 const octave_value &ov, oct_pq_dynvec_t &val) | 140 const octave_value &ov, oct_pq_dynvec_t &val) |
141 { | 141 { |
142 return 1; | 142 return 1; |
143 } | 143 } |
144 | 144 |
145 int from_octave_bin_oid (const octave_pq_connection &conn, | 145 int from_octave_bin_oid (const octave_pq_connection_rep &conn, |
146 const octave_value &ov, oct_pq_dynvec_t &val) | 146 const octave_value &ov, oct_pq_dynvec_t &val) |
147 { | 147 { |
148 uint32_t oid = ov.uint_value (); | 148 uint32_t oid = ov.uint_value (); |
149 | 149 |
150 if (error_state) | 150 if (error_state) |
173 | 173 |
174 /* end type oid */ | 174 /* end type oid */ |
175 | 175 |
176 /* type float8 */ | 176 /* type float8 */ |
177 | 177 |
178 int to_octave_str_float8 (const octave_pq_connection &conn, | 178 int to_octave_str_float8 (const octave_pq_connection_rep &conn, |
179 const char *c, octave_value &ov, int nb) | 179 const char *c, octave_value &ov, int nb) |
180 { | 180 { |
181 // not implemented | 181 // not implemented |
182 | 182 |
183 return 1; | 183 return 1; |
184 } | 184 } |
185 | 185 |
186 int to_octave_bin_float8 (const octave_pq_connection &conn, | 186 int to_octave_bin_float8 (const octave_pq_connection_rep &conn, |
187 const char *c, octave_value &ov, int nb) | 187 const char *c, octave_value &ov, int nb) |
188 { | 188 { |
189 union | 189 union |
190 { | 190 { |
191 double d; | 191 double d; |
198 ov = octave_value (swap.d); | 198 ov = octave_value (swap.d); |
199 | 199 |
200 return 0; | 200 return 0; |
201 } | 201 } |
202 | 202 |
203 int from_octave_str_float8 (const octave_pq_connection &conn, | 203 int from_octave_str_float8 (const octave_pq_connection_rep &conn, |
204 const octave_value &ov, oct_pq_dynvec_t &val) | 204 const octave_value &ov, oct_pq_dynvec_t &val) |
205 { | 205 { |
206 // not implemented | 206 // not implemented |
207 | 207 |
208 return 1; | 208 return 1; |
209 } | 209 } |
210 | 210 |
211 int from_octave_bin_float8 (const octave_pq_connection &conn, | 211 int from_octave_bin_float8 (const octave_pq_connection_rep &conn, |
212 const octave_value &ov, oct_pq_dynvec_t &val) | 212 const octave_value &ov, oct_pq_dynvec_t &val) |
213 { | 213 { |
214 union | 214 union |
215 { | 215 { |
216 double d; | 216 double d; |
246 | 246 |
247 /* end type float8 */ | 247 /* end type float8 */ |
248 | 248 |
249 /* type float4 */ | 249 /* type float4 */ |
250 | 250 |
251 int to_octave_str_float4 (const octave_pq_connection &conn, | 251 int to_octave_str_float4 (const octave_pq_connection_rep &conn, |
252 const char *c, octave_value &ov, int nb) | 252 const char *c, octave_value &ov, int nb) |
253 { | 253 { |
254 // not implemented | 254 // not implemented |
255 | 255 |
256 return 1; | 256 return 1; |
257 } | 257 } |
258 | 258 |
259 int to_octave_bin_float4 (const octave_pq_connection &conn, | 259 int to_octave_bin_float4 (const octave_pq_connection_rep &conn, |
260 const char *c, octave_value &ov, int nb) | 260 const char *c, octave_value &ov, int nb) |
261 { | 261 { |
262 union | 262 union |
263 { | 263 { |
264 float f; | 264 float f; |
271 ov = octave_value (swap.f); | 271 ov = octave_value (swap.f); |
272 | 272 |
273 return 0; | 273 return 0; |
274 } | 274 } |
275 | 275 |
276 int from_octave_str_float4 (const octave_pq_connection &conn, | 276 int from_octave_str_float4 (const octave_pq_connection_rep &conn, |
277 const octave_value &ov, oct_pq_dynvec_t &val) | 277 const octave_value &ov, oct_pq_dynvec_t &val) |
278 { | 278 { |
279 // not implemented | 279 // not implemented |
280 | 280 |
281 return 1; | 281 return 1; |
282 } | 282 } |
283 | 283 |
284 int from_octave_bin_float4 (const octave_pq_connection &conn, | 284 int from_octave_bin_float4 (const octave_pq_connection_rep &conn, |
285 const octave_value &ov, oct_pq_dynvec_t &val) | 285 const octave_value &ov, oct_pq_dynvec_t &val) |
286 { | 286 { |
287 union | 287 union |
288 { | 288 { |
289 float f; | 289 float f; |
319 | 319 |
320 /* end type float4 */ | 320 /* end type float4 */ |
321 | 321 |
322 /* type bytea */ | 322 /* type bytea */ |
323 | 323 |
324 int to_octave_str_bytea (const octave_pq_connection &conn, | 324 int to_octave_str_bytea (const octave_pq_connection_rep &conn, |
325 const char *c, octave_value &ov, int nb) | 325 const char *c, octave_value &ov, int nb) |
326 { | 326 { |
327 return 1; | 327 return 1; |
328 } | 328 } |
329 | 329 |
330 int to_octave_bin_bytea (const octave_pq_connection &conn, | 330 int to_octave_bin_bytea (const octave_pq_connection_rep &conn, |
331 const char *c, octave_value &ov, int nb) | 331 const char *c, octave_value &ov, int nb) |
332 { | 332 { |
333 uint8NDArray m (dim_vector (nb, 1)); | 333 uint8NDArray m (dim_vector (nb, 1)); |
334 | 334 |
335 uint8_t *p = (uint8_t *) m.fortran_vec (); | 335 uint8_t *p = (uint8_t *) m.fortran_vec (); |
339 ov = octave_value (m); | 339 ov = octave_value (m); |
340 | 340 |
341 return 0; | 341 return 0; |
342 } | 342 } |
343 | 343 |
344 int from_octave_str_bytea (const octave_pq_connection &conn, | 344 int from_octave_str_bytea (const octave_pq_connection_rep &conn, |
345 const octave_value &ov, oct_pq_dynvec_t &val) | 345 const octave_value &ov, oct_pq_dynvec_t &val) |
346 { | 346 { |
347 return 1; | 347 return 1; |
348 } | 348 } |
349 | 349 |
350 int from_octave_bin_bytea (const octave_pq_connection &conn, | 350 int from_octave_bin_bytea (const octave_pq_connection_rep &conn, |
351 const octave_value &ov, oct_pq_dynvec_t &val) | 351 const octave_value &ov, oct_pq_dynvec_t &val) |
352 { | 352 { |
353 uint8NDArray b = ov.uint8_array_value (); | 353 uint8NDArray b = ov.uint8_array_value (); |
354 | 354 |
355 if (error_state) | 355 if (error_state) |
381 | 381 |
382 /* end type bytea */ | 382 /* end type bytea */ |
383 | 383 |
384 /* type text */ | 384 /* type text */ |
385 | 385 |
386 int to_octave_str_text (const octave_pq_connection &conn, | 386 int to_octave_str_text (const octave_pq_connection_rep &conn, |
387 const char *c, octave_value &ov, int nb) | 387 const char *c, octave_value &ov, int nb) |
388 { | 388 { |
389 return 1; | 389 return 1; |
390 } | 390 } |
391 | 391 |
392 int to_octave_bin_text (const octave_pq_connection &conn, | 392 int to_octave_bin_text (const octave_pq_connection_rep &conn, |
393 const char *c, octave_value &ov, int nb) | 393 const char *c, octave_value &ov, int nb) |
394 { | 394 { |
395 std::string s (c, nb); | 395 std::string s (c, nb); |
396 | 396 |
397 ov = octave_value (s); | 397 ov = octave_value (s); |
398 | 398 |
399 return 0; | 399 return 0; |
400 } | 400 } |
401 | 401 |
402 int from_octave_str_text (const octave_pq_connection &conn, | 402 int from_octave_str_text (const octave_pq_connection_rep &conn, |
403 const octave_value &ov, oct_pq_dynvec_t &val) | 403 const octave_value &ov, oct_pq_dynvec_t &val) |
404 { | 404 { |
405 return 1; | 405 return 1; |
406 } | 406 } |
407 | 407 |
408 int from_octave_bin_text (const octave_pq_connection &conn, | 408 int from_octave_bin_text (const octave_pq_connection_rep &conn, |
409 const octave_value &ov, oct_pq_dynvec_t &val) | 409 const octave_value &ov, oct_pq_dynvec_t &val) |
410 { | 410 { |
411 std::string s = ov.string_value (); | 411 std::string s = ov.string_value (); |
412 | 412 |
413 if (error_state) | 413 if (error_state) |
490 | 490 |
491 /* end type name */ | 491 /* end type name */ |
492 | 492 |
493 /* type int2 */ | 493 /* type int2 */ |
494 | 494 |
495 int to_octave_str_int2 (const octave_pq_connection &conn, | 495 int to_octave_str_int2 (const octave_pq_connection_rep &conn, |
496 const char *c, octave_value &ov, int nb) | 496 const char *c, octave_value &ov, int nb) |
497 { | 497 { |
498 return 1; | 498 return 1; |
499 } | 499 } |
500 | 500 |
501 int to_octave_bin_int2 (const octave_pq_connection &conn, | 501 int to_octave_bin_int2 (const octave_pq_connection_rep &conn, |
502 const char *c, octave_value &ov, int nb) | 502 const char *c, octave_value &ov, int nb) |
503 { | 503 { |
504 ov = octave_value (octave_int16 (int16_t (be16toh (*((int16_t *) c))))); | 504 ov = octave_value (octave_int16 (int16_t (be16toh (*((int16_t *) c))))); |
505 | 505 |
506 return 0; | 506 return 0; |
507 } | 507 } |
508 | 508 |
509 int from_octave_str_int2 (const octave_pq_connection &conn, | 509 int from_octave_str_int2 (const octave_pq_connection_rep &conn, |
510 const octave_value &ov, oct_pq_dynvec_t &val) | 510 const octave_value &ov, oct_pq_dynvec_t &val) |
511 { | 511 { |
512 return 1; | 512 return 1; |
513 } | 513 } |
514 | 514 |
515 int from_octave_bin_int2 (const octave_pq_connection &conn, | 515 int from_octave_bin_int2 (const octave_pq_connection_rep &conn, |
516 const octave_value &ov, oct_pq_dynvec_t &val) | 516 const octave_value &ov, oct_pq_dynvec_t &val) |
517 { | 517 { |
518 int16_t i2 = ov.int_value (); | 518 int16_t i2 = ov.int_value (); |
519 | 519 |
520 if (error_state) | 520 if (error_state) |
544 | 544 |
545 /* end type int2 */ | 545 /* end type int2 */ |
546 | 546 |
547 /* type int4 */ | 547 /* type int4 */ |
548 | 548 |
549 int to_octave_str_int4 (const octave_pq_connection &conn, | 549 int to_octave_str_int4 (const octave_pq_connection_rep &conn, |
550 const char *c, octave_value &ov, int nb) | 550 const char *c, octave_value &ov, int nb) |
551 { | 551 { |
552 return 1; | 552 return 1; |
553 } | 553 } |
554 | 554 |
555 int to_octave_bin_int4 (const octave_pq_connection &conn, | 555 int to_octave_bin_int4 (const octave_pq_connection_rep &conn, |
556 const char *c, octave_value &ov, int nb) | 556 const char *c, octave_value &ov, int nb) |
557 { | 557 { |
558 ov = octave_value (octave_int32 (int32_t (be32toh (*((int32_t *) c))))); | 558 ov = octave_value (octave_int32 (int32_t (be32toh (*((int32_t *) c))))); |
559 | 559 |
560 return 0; | 560 return 0; |
561 } | 561 } |
562 | 562 |
563 int from_octave_str_int4 (const octave_pq_connection &conn, | 563 int from_octave_str_int4 (const octave_pq_connection_rep &conn, |
564 const octave_value &ov, oct_pq_dynvec_t &val) | 564 const octave_value &ov, oct_pq_dynvec_t &val) |
565 { | 565 { |
566 return 1; | 566 return 1; |
567 } | 567 } |
568 | 568 |
569 int from_octave_bin_int4 (const octave_pq_connection &conn, | 569 int from_octave_bin_int4 (const octave_pq_connection_rep &conn, |
570 const octave_value &ov, oct_pq_dynvec_t &val) | 570 const octave_value &ov, oct_pq_dynvec_t &val) |
571 { | 571 { |
572 int32_t i4 = ov.int_value (); | 572 int32_t i4 = ov.int_value (); |
573 | 573 |
574 if (error_state) | 574 if (error_state) |
598 | 598 |
599 /* end type int4 */ | 599 /* end type int4 */ |
600 | 600 |
601 /* type int8 */ | 601 /* type int8 */ |
602 | 602 |
603 int to_octave_str_int8 (const octave_pq_connection &conn, | 603 int to_octave_str_int8 (const octave_pq_connection_rep &conn, |
604 const char *c, octave_value &ov, int nb) | 604 const char *c, octave_value &ov, int nb) |
605 { | 605 { |
606 return 1; | 606 return 1; |
607 } | 607 } |
608 | 608 |
609 int to_octave_bin_int8 (const octave_pq_connection &conn, | 609 int to_octave_bin_int8 (const octave_pq_connection_rep &conn, |
610 const char *c, octave_value &ov, int nb) | 610 const char *c, octave_value &ov, int nb) |
611 { | 611 { |
612 ov = octave_value (octave_int64 (int64_t (be64toh (*((int64_t *) c))))); | 612 ov = octave_value (octave_int64 (int64_t (be64toh (*((int64_t *) c))))); |
613 | 613 |
614 return 0; | 614 return 0; |
615 } | 615 } |
616 | 616 |
617 int from_octave_str_int8 (const octave_pq_connection &conn, | 617 int from_octave_str_int8 (const octave_pq_connection_rep &conn, |
618 const octave_value &ov, oct_pq_dynvec_t &val) | 618 const octave_value &ov, oct_pq_dynvec_t &val) |
619 { | 619 { |
620 return 1; | 620 return 1; |
621 } | 621 } |
622 | 622 |
623 int from_octave_bin_int8 (const octave_pq_connection &conn, | 623 int from_octave_bin_int8 (const octave_pq_connection_rep &conn, |
624 const octave_value &ov, oct_pq_dynvec_t &val) | 624 const octave_value &ov, oct_pq_dynvec_t &val) |
625 { | 625 { |
626 int64_t i8 = ov.int64_scalar_value (); | 626 int64_t i8 = ov.int64_scalar_value (); |
627 | 627 |
628 if (error_state) | 628 if (error_state) |
750 | 750 |
751 // end helpers for time types | 751 // end helpers for time types |
752 | 752 |
753 /* type timestamp */ | 753 /* type timestamp */ |
754 | 754 |
755 int to_octave_str_timestamp (const octave_pq_connection &conn, | 755 int to_octave_str_timestamp (const octave_pq_connection_rep &conn, |
756 const char *c, octave_value &ov, int nb) | 756 const char *c, octave_value &ov, int nb) |
757 { | 757 { |
758 return 1; | 758 return 1; |
759 } | 759 } |
760 | 760 |
761 int to_octave_bin_timestamp (const octave_pq_connection &conn, | 761 int to_octave_bin_timestamp (const octave_pq_connection_rep &conn, |
762 const char *c, octave_value &ov, int nb) | 762 const char *c, octave_value &ov, int nb) |
763 { | 763 { |
764 ov = time_8byte_to_octave (c, conn.get_integer_datetimes ()); | 764 ov = time_8byte_to_octave (c, conn.get_integer_datetimes ()); |
765 | 765 |
766 return 0; | 766 return 0; |
767 } | 767 } |
768 | 768 |
769 int from_octave_str_timestamp (const octave_pq_connection &conn, | 769 int from_octave_str_timestamp (const octave_pq_connection_rep &conn, |
770 const octave_value &ov, oct_pq_dynvec_t &val) | 770 const octave_value &ov, oct_pq_dynvec_t &val) |
771 { | 771 { |
772 return 1; | 772 return 1; |
773 } | 773 } |
774 | 774 |
775 int from_octave_bin_timestamp (const octave_pq_connection &conn, | 775 int from_octave_bin_timestamp (const octave_pq_connection_rep &conn, |
776 const octave_value &ov, oct_pq_dynvec_t &val) | 776 const octave_value &ov, oct_pq_dynvec_t &val) |
777 { | 777 { |
778 return (time_8byte_from_octave (ov, val, conn.get_integer_datetimes ())); | 778 return (time_8byte_from_octave (ov, val, conn.get_integer_datetimes ())); |
779 } | 779 } |
780 | 780 |
810 | 810 |
811 /* end type timestamptz */ | 811 /* end type timestamptz */ |
812 | 812 |
813 /* type interval */ | 813 /* type interval */ |
814 | 814 |
815 int to_octave_str_interval (const octave_pq_connection &conn, | 815 int to_octave_str_interval (const octave_pq_connection_rep &conn, |
816 const char *c, octave_value &ov, int nb) | 816 const char *c, octave_value &ov, int nb) |
817 { | 817 { |
818 return 1; | 818 return 1; |
819 } | 819 } |
820 | 820 |
821 int to_octave_bin_interval (const octave_pq_connection &conn, | 821 int to_octave_bin_interval (const octave_pq_connection_rep &conn, |
822 const char *c, octave_value &ov, int nb) | 822 const char *c, octave_value &ov, int nb) |
823 { | 823 { |
824 Cell tp (dim_vector (3, 1)); | 824 Cell tp (dim_vector (3, 1)); |
825 | 825 |
826 tp(0) = time_8byte_to_octave (c, conn.get_integer_datetimes ()); | 826 tp(0) = time_8byte_to_octave (c, conn.get_integer_datetimes ()); |
836 ov = octave_value (tp); | 836 ov = octave_value (tp); |
837 | 837 |
838 return 0; | 838 return 0; |
839 } | 839 } |
840 | 840 |
841 int from_octave_str_interval (const octave_pq_connection &conn, | 841 int from_octave_str_interval (const octave_pq_connection_rep &conn, |
842 const octave_value &ov, oct_pq_dynvec_t &val) | 842 const octave_value &ov, oct_pq_dynvec_t &val) |
843 { | 843 { |
844 return 1; | 844 return 1; |
845 } | 845 } |
846 | 846 |
847 int from_octave_bin_interval (const octave_pq_connection &conn, | 847 int from_octave_bin_interval (const octave_pq_connection_rep &conn, |
848 const octave_value &ov, oct_pq_dynvec_t &val) | 848 const octave_value &ov, oct_pq_dynvec_t &val) |
849 { | 849 { |
850 Cell iv = ov.cell_value (); | 850 Cell iv = ov.cell_value (); |
851 if (error_state || iv.numel () != 3) | 851 if (error_state || iv.numel () != 3) |
852 { | 852 { |
888 | 888 |
889 /* end type interval */ | 889 /* end type interval */ |
890 | 890 |
891 /* type time */ | 891 /* type time */ |
892 | 892 |
893 int to_octave_str_time (const octave_pq_connection &conn, | 893 int to_octave_str_time (const octave_pq_connection_rep &conn, |
894 const char *c, octave_value &ov, int nb) | 894 const char *c, octave_value &ov, int nb) |
895 { | 895 { |
896 return 1; | 896 return 1; |
897 } | 897 } |
898 | 898 |
899 int to_octave_bin_time (const octave_pq_connection &conn, | 899 int to_octave_bin_time (const octave_pq_connection_rep &conn, |
900 const char *c, octave_value &ov, int nb) | 900 const char *c, octave_value &ov, int nb) |
901 { | 901 { |
902 ov = time_8byte_to_octave (c, conn.get_integer_datetimes ()); | 902 ov = time_8byte_to_octave (c, conn.get_integer_datetimes ()); |
903 | 903 |
904 return 0; | 904 return 0; |
905 } | 905 } |
906 | 906 |
907 int from_octave_str_time (const octave_pq_connection &conn, | 907 int from_octave_str_time (const octave_pq_connection_rep &conn, |
908 const octave_value &ov, oct_pq_dynvec_t &val) | 908 const octave_value &ov, oct_pq_dynvec_t &val) |
909 { | 909 { |
910 return 1; | 910 return 1; |
911 } | 911 } |
912 | 912 |
913 int from_octave_bin_time (const octave_pq_connection &conn, | 913 int from_octave_bin_time (const octave_pq_connection_rep &conn, |
914 const octave_value &ov, oct_pq_dynvec_t &val) | 914 const octave_value &ov, oct_pq_dynvec_t &val) |
915 { | 915 { |
916 return (time_8byte_from_octave (ov, val, conn.get_integer_datetimes ())); | 916 return (time_8byte_from_octave (ov, val, conn.get_integer_datetimes ())); |
917 } | 917 } |
918 | 918 |
931 | 931 |
932 /* end type time */ | 932 /* end type time */ |
933 | 933 |
934 /* type timetz */ | 934 /* type timetz */ |
935 | 935 |
936 int to_octave_str_timetz (const octave_pq_connection &conn, | 936 int to_octave_str_timetz (const octave_pq_connection_rep &conn, |
937 const char *c, octave_value &ov, int nb) | 937 const char *c, octave_value &ov, int nb) |
938 { | 938 { |
939 return 1; | 939 return 1; |
940 } | 940 } |
941 | 941 |
942 int to_octave_bin_timetz (const octave_pq_connection &conn, | 942 int to_octave_bin_timetz (const octave_pq_connection_rep &conn, |
943 const char *c, octave_value &ov, int nb) | 943 const char *c, octave_value &ov, int nb) |
944 { | 944 { |
945 Cell tp (dim_vector (2, 1)); | 945 Cell tp (dim_vector (2, 1)); |
946 | 946 |
947 tp(0) = time_8byte_to_octave (c, conn.get_integer_datetimes ()); | 947 tp(0) = time_8byte_to_octave (c, conn.get_integer_datetimes ()); |
953 ov = octave_value (tp); | 953 ov = octave_value (tp); |
954 | 954 |
955 return 0; | 955 return 0; |
956 } | 956 } |
957 | 957 |
958 int from_octave_str_timetz (const octave_pq_connection &conn, | 958 int from_octave_str_timetz (const octave_pq_connection_rep &conn, |
959 const octave_value &ov, oct_pq_dynvec_t &val) | 959 const octave_value &ov, oct_pq_dynvec_t &val) |
960 { | 960 { |
961 return 1; | 961 return 1; |
962 } | 962 } |
963 | 963 |
964 int from_octave_bin_timetz (const octave_pq_connection &conn, | 964 int from_octave_bin_timetz (const octave_pq_connection_rep &conn, |
965 const octave_value &ov, oct_pq_dynvec_t &val) | 965 const octave_value &ov, oct_pq_dynvec_t &val) |
966 { | 966 { |
967 Cell iv = ov.cell_value (); | 967 Cell iv = ov.cell_value (); |
968 if (error_state || iv.numel () != 2) | 968 if (error_state || iv.numel () != 2) |
969 { | 969 { |
1002 | 1002 |
1003 /* end type timetz */ | 1003 /* end type timetz */ |
1004 | 1004 |
1005 /* type date */ | 1005 /* type date */ |
1006 | 1006 |
1007 int to_octave_str_date (const octave_pq_connection &conn, | 1007 int to_octave_str_date (const octave_pq_connection_rep &conn, |
1008 const char *c, octave_value &ov, int nb) | 1008 const char *c, octave_value &ov, int nb) |
1009 { | 1009 { |
1010 return 1; | 1010 return 1; |
1011 } | 1011 } |
1012 | 1012 |
1013 int to_octave_bin_date (const octave_pq_connection &conn, | 1013 int to_octave_bin_date (const octave_pq_connection_rep &conn, |
1014 const char *c, octave_value &ov, int nb) | 1014 const char *c, octave_value &ov, int nb) |
1015 { | 1015 { |
1016 ov = octave_value (octave_int32 (int32_t (be32toh (*((int32_t *) c))))); | 1016 ov = octave_value (octave_int32 (int32_t (be32toh (*((int32_t *) c))))); |
1017 | 1017 |
1018 return 0; | 1018 return 0; |
1019 } | 1019 } |
1020 | 1020 |
1021 int from_octave_str_date (const octave_pq_connection &conn, | 1021 int from_octave_str_date (const octave_pq_connection_rep &conn, |
1022 const octave_value &ov, oct_pq_dynvec_t &val) | 1022 const octave_value &ov, oct_pq_dynvec_t &val) |
1023 { | 1023 { |
1024 return 1; | 1024 return 1; |
1025 } | 1025 } |
1026 | 1026 |
1027 int from_octave_bin_date (const octave_pq_connection &conn, | 1027 int from_octave_bin_date (const octave_pq_connection_rep &conn, |
1028 const octave_value &ov, oct_pq_dynvec_t &val) | 1028 const octave_value &ov, oct_pq_dynvec_t &val) |
1029 { | 1029 { |
1030 int32_t i4 = ov.int_value (); | 1030 int32_t i4 = ov.int_value (); |
1031 | 1031 |
1032 if (error_state) | 1032 if (error_state) |
1055 | 1055 |
1056 /* end type date */ | 1056 /* end type date */ |
1057 | 1057 |
1058 /* type point */ | 1058 /* type point */ |
1059 | 1059 |
1060 int to_octave_str_point (const octave_pq_connection &conn, | 1060 int to_octave_str_point (const octave_pq_connection_rep &conn, |
1061 const char *c, octave_value &ov, int nb) | 1061 const char *c, octave_value &ov, int nb) |
1062 { | 1062 { |
1063 return 1; | 1063 return 1; |
1064 } | 1064 } |
1065 | 1065 |
1066 int to_octave_bin_point (const octave_pq_connection &conn, | 1066 int to_octave_bin_point (const octave_pq_connection_rep &conn, |
1067 const char *c, octave_value &ov, int nb) | 1067 const char *c, octave_value &ov, int nb) |
1068 { | 1068 { |
1069 ColumnVector m (2); | 1069 ColumnVector m (2); |
1070 | 1070 |
1071 union | 1071 union |
1085 ov = octave_value (m); | 1085 ov = octave_value (m); |
1086 | 1086 |
1087 return 0; | 1087 return 0; |
1088 } | 1088 } |
1089 | 1089 |
1090 int from_octave_str_point (const octave_pq_connection &conn, | 1090 int from_octave_str_point (const octave_pq_connection_rep &conn, |
1091 const octave_value &ov, oct_pq_dynvec_t &val) | 1091 const octave_value &ov, oct_pq_dynvec_t &val) |
1092 { | 1092 { |
1093 return 1; | 1093 return 1; |
1094 } | 1094 } |
1095 | 1095 |
1096 int from_octave_bin_point (const octave_pq_connection &conn, | 1096 int from_octave_bin_point (const octave_pq_connection_rep &conn, |
1097 const octave_value &ov, oct_pq_dynvec_t &val) | 1097 const octave_value &ov, oct_pq_dynvec_t &val) |
1098 { | 1098 { |
1099 NDArray m = ov.array_value (); | 1099 NDArray m = ov.array_value (); |
1100 | 1100 |
1101 if (error_state || m.numel () != 2) | 1101 if (error_state || m.numel () != 2) |
1136 | 1136 |
1137 /* end type point */ | 1137 /* end type point */ |
1138 | 1138 |
1139 /* type lseg */ | 1139 /* type lseg */ |
1140 | 1140 |
1141 int to_octave_str_lseg (const octave_pq_connection &conn, | 1141 int to_octave_str_lseg (const octave_pq_connection_rep &conn, |
1142 const char *c, octave_value &ov, int nb) | 1142 const char *c, octave_value &ov, int nb) |
1143 { | 1143 { |
1144 return 1; | 1144 return 1; |
1145 } | 1145 } |
1146 | 1146 |
1147 int to_octave_bin_lseg (const octave_pq_connection &conn, | 1147 int to_octave_bin_lseg (const octave_pq_connection_rep &conn, |
1148 const char *c, octave_value &ov, int nb) | 1148 const char *c, octave_value &ov, int nb) |
1149 { | 1149 { |
1150 Matrix m (2, 2); | 1150 Matrix m (2, 2); |
1151 | 1151 |
1152 union | 1152 union |
1166 ov = octave_value (m); | 1166 ov = octave_value (m); |
1167 | 1167 |
1168 return 0; | 1168 return 0; |
1169 } | 1169 } |
1170 | 1170 |
1171 int from_octave_str_lseg (const octave_pq_connection &conn, | 1171 int from_octave_str_lseg (const octave_pq_connection_rep &conn, |
1172 const octave_value &ov, oct_pq_dynvec_t &val) | 1172 const octave_value &ov, oct_pq_dynvec_t &val) |
1173 { | 1173 { |
1174 return 1; | 1174 return 1; |
1175 } | 1175 } |
1176 | 1176 |
1177 int from_octave_bin_lseg (const octave_pq_connection &conn, | 1177 int from_octave_bin_lseg (const octave_pq_connection_rep &conn, |
1178 const octave_value &ov, oct_pq_dynvec_t &val) | 1178 const octave_value &ov, oct_pq_dynvec_t &val) |
1179 { | 1179 { |
1180 NDArray m = ov.array_value (); | 1180 NDArray m = ov.array_value (); |
1181 | 1181 |
1182 if (error_state || m.numel () != 4) | 1182 if (error_state || m.numel () != 4) |
1251 | 1251 |
1252 /* end type box */ | 1252 /* end type box */ |
1253 | 1253 |
1254 /* type circle */ | 1254 /* type circle */ |
1255 | 1255 |
1256 int to_octave_str_circle (const octave_pq_connection &conn, | 1256 int to_octave_str_circle (const octave_pq_connection_rep &conn, |
1257 const char *c, octave_value &ov, int nb) | 1257 const char *c, octave_value &ov, int nb) |
1258 { | 1258 { |
1259 return 1; | 1259 return 1; |
1260 } | 1260 } |
1261 | 1261 |
1262 int to_octave_bin_circle (const octave_pq_connection &conn, | 1262 int to_octave_bin_circle (const octave_pq_connection_rep &conn, |
1263 const char *c, octave_value &ov, int nb) | 1263 const char *c, octave_value &ov, int nb) |
1264 { | 1264 { |
1265 ColumnVector m (3); | 1265 ColumnVector m (3); |
1266 | 1266 |
1267 union | 1267 union |
1281 ov = octave_value (m); | 1281 ov = octave_value (m); |
1282 | 1282 |
1283 return 0; | 1283 return 0; |
1284 } | 1284 } |
1285 | 1285 |
1286 int from_octave_str_circle (const octave_pq_connection &conn, | 1286 int from_octave_str_circle (const octave_pq_connection_rep &conn, |
1287 const octave_value &ov, oct_pq_dynvec_t &val) | 1287 const octave_value &ov, oct_pq_dynvec_t &val) |
1288 { | 1288 { |
1289 return 1; | 1289 return 1; |
1290 } | 1290 } |
1291 | 1291 |
1292 int from_octave_bin_circle (const octave_pq_connection &conn, | 1292 int from_octave_bin_circle (const octave_pq_connection_rep &conn, |
1293 const octave_value &ov, oct_pq_dynvec_t &val) | 1293 const octave_value &ov, oct_pq_dynvec_t &val) |
1294 { | 1294 { |
1295 NDArray m = ov.array_value (); | 1295 NDArray m = ov.array_value (); |
1296 | 1296 |
1297 if (error_state || m.numel () != 3) | 1297 if (error_state || m.numel () != 3) |
1332 | 1332 |
1333 /* end type circle */ | 1333 /* end type circle */ |
1334 | 1334 |
1335 /* type polygon */ | 1335 /* type polygon */ |
1336 | 1336 |
1337 int to_octave_str_polygon (const octave_pq_connection &conn, | 1337 int to_octave_str_polygon (const octave_pq_connection_rep &conn, |
1338 const char *c, octave_value &ov, int nb) | 1338 const char *c, octave_value &ov, int nb) |
1339 { | 1339 { |
1340 return 1; | 1340 return 1; |
1341 } | 1341 } |
1342 | 1342 |
1343 int to_octave_bin_polygon (const octave_pq_connection &conn, | 1343 int to_octave_bin_polygon (const octave_pq_connection_rep &conn, |
1344 const char *c, octave_value &ov, int nb) | 1344 const char *c, octave_value &ov, int nb) |
1345 { | 1345 { |
1346 int32_t np = int32_t (be32toh (*((int32_t *) c))); | 1346 int32_t np = int32_t (be32toh (*((int32_t *) c))); |
1347 | 1347 |
1348 c += 4; | 1348 c += 4; |
1366 ov = octave_value (m); | 1366 ov = octave_value (m); |
1367 | 1367 |
1368 return 0; | 1368 return 0; |
1369 } | 1369 } |
1370 | 1370 |
1371 int from_octave_str_polygon (const octave_pq_connection &conn, | 1371 int from_octave_str_polygon (const octave_pq_connection_rep &conn, |
1372 const octave_value &ov, oct_pq_dynvec_t &val) | 1372 const octave_value &ov, oct_pq_dynvec_t &val) |
1373 { | 1373 { |
1374 return 1; | 1374 return 1; |
1375 } | 1375 } |
1376 | 1376 |
1377 int from_octave_bin_polygon (const octave_pq_connection &conn, | 1377 int from_octave_bin_polygon (const octave_pq_connection_rep &conn, |
1378 const octave_value &ov, oct_pq_dynvec_t &val) | 1378 const octave_value &ov, oct_pq_dynvec_t &val) |
1379 { | 1379 { |
1380 octave_idx_type nel; | 1380 octave_idx_type nel; |
1381 | 1381 |
1382 NDArray m = ov.array_value (); | 1382 NDArray m = ov.array_value (); |
1423 | 1423 |
1424 /* end type polygon */ | 1424 /* end type polygon */ |
1425 | 1425 |
1426 /* type path */ | 1426 /* type path */ |
1427 | 1427 |
1428 int to_octave_str_path (const octave_pq_connection &conn, | 1428 int to_octave_str_path (const octave_pq_connection_rep &conn, |
1429 const char *c, octave_value &ov, int nb) | 1429 const char *c, octave_value &ov, int nb) |
1430 { | 1430 { |
1431 return 1; | 1431 return 1; |
1432 } | 1432 } |
1433 | 1433 |
1434 int to_octave_bin_path (const octave_pq_connection &conn, | 1434 int to_octave_bin_path (const octave_pq_connection_rep &conn, |
1435 const char *c, octave_value &ov, int nb) | 1435 const char *c, octave_value &ov, int nb) |
1436 { | 1436 { |
1437 bool closed = bool (*(c++)); | 1437 bool closed = bool (*(c++)); |
1438 | 1438 |
1439 int32_t np = int32_t (be32toh (*((int32_t *) c))); | 1439 int32_t np = int32_t (be32toh (*((int32_t *) c))); |
1463 ov = octave_value (tp); | 1463 ov = octave_value (tp); |
1464 | 1464 |
1465 return 0; | 1465 return 0; |
1466 } | 1466 } |
1467 | 1467 |
1468 int from_octave_str_path (const octave_pq_connection &conn, | 1468 int from_octave_str_path (const octave_pq_connection_rep &conn, |
1469 const octave_value &ov, oct_pq_dynvec_t &val) | 1469 const octave_value &ov, oct_pq_dynvec_t &val) |
1470 { | 1470 { |
1471 return 1; | 1471 return 1; |
1472 } | 1472 } |
1473 | 1473 |
1474 int from_octave_bin_path (const octave_pq_connection &conn, | 1474 int from_octave_bin_path (const octave_pq_connection_rep &conn, |
1475 const octave_value &ov, oct_pq_dynvec_t &val) | 1475 const octave_value &ov, oct_pq_dynvec_t &val) |
1476 { | 1476 { |
1477 octave_scalar_map tp = ov.scalar_map_value (); | 1477 octave_scalar_map tp = ov.scalar_map_value (); |
1478 if (error_state || ! tp.isfield ("closed") || ! tp.isfield ("path")) | 1478 if (error_state || ! tp.isfield ("closed") || ! tp.isfield ("path")) |
1479 { | 1479 { |
1537 // nothing except signalling an error. The rationale is that the only | 1537 // nothing except signalling an error. The rationale is that the only |
1538 // values of type 'unknown' may be NULL, in which case the converter | 1538 // values of type 'unknown' may be NULL, in which case the converter |
1539 // will not be called, but because a converter exists there won't be a | 1539 // will not be called, but because a converter exists there won't be a |
1540 // "no converter found" error thrown. | 1540 // "no converter found" error thrown. |
1541 | 1541 |
1542 int to_octave_str_unknown (const octave_pq_connection &conn, | 1542 int to_octave_str_unknown (const octave_pq_connection_rep &conn, |
1543 const char *c, octave_value &ov, int nb) | 1543 const char *c, octave_value &ov, int nb) |
1544 { | 1544 { |
1545 error ("can not convert postgresql type 'unknown'"); | 1545 error ("can not convert postgresql type 'unknown'"); |
1546 | 1546 |
1547 return 1; | 1547 return 1; |
1548 } | 1548 } |
1549 | 1549 |
1550 int to_octave_bin_unknown (const octave_pq_connection &conn, | 1550 int to_octave_bin_unknown (const octave_pq_connection_rep &conn, |
1551 const char *c, octave_value &ov, int nb) | 1551 const char *c, octave_value &ov, int nb) |
1552 { | 1552 { |
1553 error ("can not convert postgresql type 'unknown'"); | 1553 error ("can not convert postgresql type 'unknown'"); |
1554 | 1554 |
1555 return 1; | 1555 return 1; |
1556 } | 1556 } |
1557 | 1557 |
1558 int from_octave_str_unknown (const octave_pq_connection &conn, | 1558 int from_octave_str_unknown (const octave_pq_connection_rep &conn, |
1559 const octave_value &ov, oct_pq_dynvec_t &val) | 1559 const octave_value &ov, oct_pq_dynvec_t &val) |
1560 { | 1560 { |
1561 error ("can not convert postgresql type 'unknown'"); | 1561 error ("can not convert postgresql type 'unknown'"); |
1562 | 1562 |
1563 return 1; | 1563 return 1; |
1564 } | 1564 } |
1565 | 1565 |
1566 int from_octave_bin_unknown (const octave_pq_connection &conn, | 1566 int from_octave_bin_unknown (const octave_pq_connection_rep &conn, |
1567 const octave_value &ov, oct_pq_dynvec_t &val) | 1567 const octave_value &ov, oct_pq_dynvec_t &val) |
1568 { | 1568 { |
1569 error ("can not convert postgresql type 'unknown'"); | 1569 error ("can not convert postgresql type 'unknown'"); |
1570 | 1570 |
1571 return 1; | 1571 return 1; |
1722 | 1722 |
1723 // end helpers for network types | 1723 // end helpers for network types |
1724 | 1724 |
1725 /* type cidr */ | 1725 /* type cidr */ |
1726 | 1726 |
1727 int to_octave_str_cidr (const octave_pq_connection &conn, | 1727 int to_octave_str_cidr (const octave_pq_connection_rep &conn, |
1728 const char *c, octave_value &ov, int nb) | 1728 const char *c, octave_value &ov, int nb) |
1729 { | 1729 { |
1730 return 1; | 1730 return 1; |
1731 } | 1731 } |
1732 | 1732 |
1733 int to_octave_bin_cidr (const octave_pq_connection &conn, | 1733 int to_octave_bin_cidr (const octave_pq_connection_rep &conn, |
1734 const char *c, octave_value &ov, int nb) | 1734 const char *c, octave_value &ov, int nb) |
1735 { | 1735 { |
1736 bool cidr = false; | 1736 bool cidr = false; |
1737 | 1737 |
1738 if (to_octave_bin_cidr_inet (c, ov, cidr)) | 1738 if (to_octave_bin_cidr_inet (c, ov, cidr)) |
1746 } | 1746 } |
1747 | 1747 |
1748 return 0; | 1748 return 0; |
1749 } | 1749 } |
1750 | 1750 |
1751 int from_octave_str_cidr (const octave_pq_connection &conn, | 1751 int from_octave_str_cidr (const octave_pq_connection_rep &conn, |
1752 const octave_value &ov, oct_pq_dynvec_t &val) | 1752 const octave_value &ov, oct_pq_dynvec_t &val) |
1753 { | 1753 { |
1754 return 1; | 1754 return 1; |
1755 } | 1755 } |
1756 | 1756 |
1757 int from_octave_bin_cidr (const octave_pq_connection &conn, | 1757 int from_octave_bin_cidr (const octave_pq_connection_rep &conn, |
1758 const octave_value &ov, oct_pq_dynvec_t &val) | 1758 const octave_value &ov, oct_pq_dynvec_t &val) |
1759 { | 1759 { |
1760 return from_octave_bin_cidr_inet (ov, val, true); | 1760 return from_octave_bin_cidr_inet (ov, val, true); |
1761 } | 1761 } |
1762 | 1762 |
1775 | 1775 |
1776 /* end type cidr */ | 1776 /* end type cidr */ |
1777 | 1777 |
1778 /* type inet */ | 1778 /* type inet */ |
1779 | 1779 |
1780 int to_octave_str_inet (const octave_pq_connection &conn, | 1780 int to_octave_str_inet (const octave_pq_connection_rep &conn, |
1781 const char *c, octave_value &ov, int nb) | 1781 const char *c, octave_value &ov, int nb) |
1782 { | 1782 { |
1783 return 1; | 1783 return 1; |
1784 } | 1784 } |
1785 | 1785 |
1786 int to_octave_bin_inet (const octave_pq_connection &conn, | 1786 int to_octave_bin_inet (const octave_pq_connection_rep &conn, |
1787 const char *c, octave_value &ov, int nb) | 1787 const char *c, octave_value &ov, int nb) |
1788 { | 1788 { |
1789 bool cidr = false; | 1789 bool cidr = false; |
1790 | 1790 |
1791 if (to_octave_bin_cidr_inet (c, ov, cidr)) | 1791 if (to_octave_bin_cidr_inet (c, ov, cidr)) |
1799 } | 1799 } |
1800 | 1800 |
1801 return 0; | 1801 return 0; |
1802 } | 1802 } |
1803 | 1803 |
1804 int from_octave_str_inet (const octave_pq_connection &conn, | 1804 int from_octave_str_inet (const octave_pq_connection_rep &conn, |
1805 const octave_value &ov, oct_pq_dynvec_t &val) | 1805 const octave_value &ov, oct_pq_dynvec_t &val) |
1806 { | 1806 { |
1807 return 1; | 1807 return 1; |
1808 } | 1808 } |
1809 | 1809 |
1810 int from_octave_bin_inet (const octave_pq_connection &conn, | 1810 int from_octave_bin_inet (const octave_pq_connection_rep &conn, |
1811 const octave_value &ov, oct_pq_dynvec_t &val) | 1811 const octave_value &ov, oct_pq_dynvec_t &val) |
1812 { | 1812 { |
1813 return from_octave_bin_cidr_inet (ov, val, false); | 1813 return from_octave_bin_cidr_inet (ov, val, false); |
1814 } | 1814 } |
1815 | 1815 |
1828 | 1828 |
1829 /* end type inet */ | 1829 /* end type inet */ |
1830 | 1830 |
1831 /* type macaddr */ | 1831 /* type macaddr */ |
1832 | 1832 |
1833 int to_octave_str_macaddr (const octave_pq_connection &conn, | 1833 int to_octave_str_macaddr (const octave_pq_connection_rep &conn, |
1834 const char *c, octave_value &ov, int nb) | 1834 const char *c, octave_value &ov, int nb) |
1835 { | 1835 { |
1836 return 1; | 1836 return 1; |
1837 } | 1837 } |
1838 | 1838 |
1839 int to_octave_bin_macaddr (const octave_pq_connection &conn, | 1839 int to_octave_bin_macaddr (const octave_pq_connection_rep &conn, |
1840 const char *c, octave_value &ov, int nb) | 1840 const char *c, octave_value &ov, int nb) |
1841 { | 1841 { |
1842 uint8NDArray a (dim_vector (6, 1)); | 1842 uint8NDArray a (dim_vector (6, 1)); |
1843 | 1843 |
1844 for (int i = 0; i < 6; i++, c++) | 1844 for (int i = 0; i < 6; i++, c++) |
1847 ov = octave_value (a); | 1847 ov = octave_value (a); |
1848 | 1848 |
1849 return 0; | 1849 return 0; |
1850 } | 1850 } |
1851 | 1851 |
1852 int from_octave_str_macaddr (const octave_pq_connection &conn, | 1852 int from_octave_str_macaddr (const octave_pq_connection_rep &conn, |
1853 const octave_value &ov, oct_pq_dynvec_t &val) | 1853 const octave_value &ov, oct_pq_dynvec_t &val) |
1854 { | 1854 { |
1855 return 1; | 1855 return 1; |
1856 } | 1856 } |
1857 | 1857 |
1858 int from_octave_bin_macaddr (const octave_pq_connection &conn, | 1858 int from_octave_bin_macaddr (const octave_pq_connection_rep &conn, |
1859 const octave_value &ov, oct_pq_dynvec_t &val) | 1859 const octave_value &ov, oct_pq_dynvec_t &val) |
1860 { | 1860 { |
1861 uint8NDArray a = ov.uint8_array_value (); | 1861 uint8NDArray a = ov.uint8_array_value (); |
1862 | 1862 |
1863 if (error_state) | 1863 if (error_state) |
1893 | 1893 |
1894 /* end type macaddr */ | 1894 /* end type macaddr */ |
1895 | 1895 |
1896 /* type bit */ | 1896 /* type bit */ |
1897 | 1897 |
1898 int to_octave_str_bit (const octave_pq_connection &conn, | 1898 int to_octave_str_bit (const octave_pq_connection_rep &conn, |
1899 const char *c, octave_value &ov, int nb) | 1899 const char *c, octave_value &ov, int nb) |
1900 { | 1900 { |
1901 return 1; | 1901 return 1; |
1902 } | 1902 } |
1903 | 1903 |
1904 int to_octave_bin_bit (const octave_pq_connection &conn, | 1904 int to_octave_bin_bit (const octave_pq_connection_rep &conn, |
1905 const char *c, octave_value &ov, int nb) | 1905 const char *c, octave_value &ov, int nb) |
1906 { | 1906 { |
1907 int32_t nbits = int32_t (be32toh (*((int32_t *) c))); | 1907 int32_t nbits = int32_t (be32toh (*((int32_t *) c))); |
1908 | 1908 |
1909 c += 4; | 1909 c += 4; |
1922 ov = octave_value (tp); | 1922 ov = octave_value (tp); |
1923 | 1923 |
1924 return 0; | 1924 return 0; |
1925 } | 1925 } |
1926 | 1926 |
1927 int from_octave_str_bit (const octave_pq_connection &conn, | 1927 int from_octave_str_bit (const octave_pq_connection_rep &conn, |
1928 const octave_value &ov, oct_pq_dynvec_t &val) | 1928 const octave_value &ov, oct_pq_dynvec_t &val) |
1929 { | 1929 { |
1930 return 1; | 1930 return 1; |
1931 } | 1931 } |
1932 | 1932 |
1933 int from_octave_bin_bit (const octave_pq_connection &conn, | 1933 int from_octave_bin_bit (const octave_pq_connection_rep &conn, |
1934 const octave_value &ov, oct_pq_dynvec_t &val) | 1934 const octave_value &ov, oct_pq_dynvec_t &val) |
1935 { | 1935 { |
1936 octave_scalar_map tp = ov.scalar_map_value (); | 1936 octave_scalar_map tp = ov.scalar_map_value (); |
1937 if (error_state || ! tp.isfield ("bitlen") || ! tp.isfield ("bits")) | 1937 if (error_state || ! tp.isfield ("bitlen") || ! tp.isfield ("bits")) |
1938 { | 1938 { |
1998 | 1998 |
1999 /* end type varbit */ | 1999 /* end type varbit */ |
2000 | 2000 |
2001 /* type uuid */ | 2001 /* type uuid */ |
2002 | 2002 |
2003 int to_octave_str_uuid (const octave_pq_connection &conn, | 2003 int to_octave_str_uuid (const octave_pq_connection_rep &conn, |
2004 const char *c, octave_value &ov, int nb) | 2004 const char *c, octave_value &ov, int nb) |
2005 { | 2005 { |
2006 return 1; | 2006 return 1; |
2007 } | 2007 } |
2008 | 2008 |
2009 int to_octave_bin_uuid (const octave_pq_connection &conn, | 2009 int to_octave_bin_uuid (const octave_pq_connection_rep &conn, |
2010 const char *c, octave_value &ov, int nb) | 2010 const char *c, octave_value &ov, int nb) |
2011 { | 2011 { |
2012 uint8NDArray m (dim_vector (16, 1)); | 2012 uint8NDArray m (dim_vector (16, 1)); |
2013 | 2013 |
2014 uint8_t *p = (uint8_t *) m.fortran_vec (); | 2014 uint8_t *p = (uint8_t *) m.fortran_vec (); |
2018 ov = octave_value (m); | 2018 ov = octave_value (m); |
2019 | 2019 |
2020 return 0; | 2020 return 0; |
2021 } | 2021 } |
2022 | 2022 |
2023 int from_octave_str_uuid (const octave_pq_connection &conn, | 2023 int from_octave_str_uuid (const octave_pq_connection_rep &conn, |
2024 const octave_value &ov, oct_pq_dynvec_t &val) | 2024 const octave_value &ov, oct_pq_dynvec_t &val) |
2025 { | 2025 { |
2026 return 1; | 2026 return 1; |
2027 } | 2027 } |
2028 | 2028 |
2029 int from_octave_bin_uuid (const octave_pq_connection &conn, | 2029 int from_octave_bin_uuid (const octave_pq_connection_rep &conn, |
2030 const octave_value &ov, oct_pq_dynvec_t &val) | 2030 const octave_value &ov, oct_pq_dynvec_t &val) |
2031 { | 2031 { |
2032 uint8NDArray b = ov.uint8_array_value (); | 2032 uint8NDArray b = ov.uint8_array_value (); |
2033 | 2033 |
2034 if (error_state) | 2034 if (error_state) |
2064 | 2064 |
2065 /* end type uuid */ | 2065 /* end type uuid */ |
2066 | 2066 |
2067 /* type xml */ | 2067 /* type xml */ |
2068 | 2068 |
2069 int to_octave_str_xml (const octave_pq_connection &conn, | 2069 int to_octave_str_xml (const octave_pq_connection_rep &conn, |
2070 const char *c, octave_value &ov, int nb) | 2070 const char *c, octave_value &ov, int nb) |
2071 { | 2071 { |
2072 return 1; | 2072 return 1; |
2073 } | 2073 } |
2074 | 2074 |
2075 int to_octave_bin_xml (const octave_pq_connection &conn, | 2075 int to_octave_bin_xml (const octave_pq_connection_rep &conn, |
2076 const char *c, octave_value &ov, int nb) | 2076 const char *c, octave_value &ov, int nb) |
2077 { | 2077 { |
2078 std::string s (c, nb); | 2078 std::string s (c, nb); |
2079 | 2079 |
2080 ov = octave_value (s); | 2080 ov = octave_value (s); |
2081 | 2081 |
2082 return 0; | 2082 return 0; |
2083 } | 2083 } |
2084 | 2084 |
2085 int from_octave_str_xml (const octave_pq_connection &conn, | 2085 int from_octave_str_xml (const octave_pq_connection_rep &conn, |
2086 const octave_value &ov, oct_pq_dynvec_t &val) | 2086 const octave_value &ov, oct_pq_dynvec_t &val) |
2087 { | 2087 { |
2088 return 1; | 2088 return 1; |
2089 } | 2089 } |
2090 | 2090 |
2091 int from_octave_bin_xml (const octave_pq_connection &conn, | 2091 int from_octave_bin_xml (const octave_pq_connection_rep &conn, |
2092 const octave_value &ov, oct_pq_dynvec_t &val) | 2092 const octave_value &ov, oct_pq_dynvec_t &val) |
2093 { | 2093 { |
2094 std::string s = ov.string_value (); | 2094 std::string s = ov.string_value (); |
2095 | 2095 |
2096 if (error_state) | 2096 if (error_state) |
2122 | 2122 |
2123 /* end type xml */ | 2123 /* end type xml */ |
2124 | 2124 |
2125 /* type record */ | 2125 /* type record */ |
2126 | 2126 |
2127 int to_octave_str_record (const octave_pq_connection &conn, | 2127 int to_octave_str_record (const octave_pq_connection_rep &conn, |
2128 const char *c, octave_value &ov, int nb) | 2128 const char *c, octave_value &ov, int nb) |
2129 { | 2129 { |
2130 return 1; | 2130 return 1; |
2131 } | 2131 } |
2132 | 2132 |
2133 int to_octave_bin_record (const octave_pq_connection &conn, | 2133 int to_octave_bin_record (const octave_pq_connection_rep &conn, |
2134 const char *v, octave_value &ov, int nb) | 2134 const char *v, octave_value &ov, int nb) |
2135 { | 2135 { |
2136 const char *p = v; | 2136 const char *p = v; |
2137 | 2137 |
2138 // ncols | 2138 // ncols |
2193 ov = octave_value (c); | 2193 ov = octave_value (c); |
2194 | 2194 |
2195 return 0; | 2195 return 0; |
2196 } | 2196 } |
2197 | 2197 |
2198 int from_octave_str_record (const octave_pq_connection &conn, | 2198 int from_octave_str_record (const octave_pq_connection_rep &conn, |
2199 const octave_value &ov, oct_pq_dynvec_t &val) | 2199 const octave_value &ov, oct_pq_dynvec_t &val) |
2200 { | 2200 { |
2201 return 1; | 2201 return 1; |
2202 } | 2202 } |
2203 | 2203 |
2204 int from_octave_bin_record (const octave_pq_connection &conn, | 2204 int from_octave_bin_record (const octave_pq_connection_rep &conn, |
2205 const octave_value &ov, oct_pq_dynvec_t &val) | 2205 const octave_value &ov, oct_pq_dynvec_t &val) |
2206 { | 2206 { |
2207 error ("Type 'record' can't be sent to postgresql."); | 2207 error ("Type 'record' can't be sent to postgresql."); |
2208 | 2208 |
2209 return 1; | 2209 return 1; |