@@ -103,8 +103,12 @@ type ftype =
103
103
| ANYELEMENT
104
104
| JSONB
105
105
106
- external ftype_of_oid : oid -> ftype = " ftype_of_oid_stub"
107
- external oid_of_ftype : ftype -> oid = " oid_of_ftype_stub"
106
+ external ftype_of_oid :
107
+ (int (* oid *) [@ untagged]) -> ftype
108
+ = " ftype_of_oid_stub_bc" " ftype_of_oid_stub"
109
+
110
+ external oid_of_ftype : ftype -> (int (* oid *) [@ untagged])
111
+ = " oid_of_ftype_stub_bc" " oid_of_ftype_stub" [@@ noalloc]
108
112
109
113
let string_of_ftype = function
110
114
| BOOL -> " BOOL"
@@ -351,10 +355,12 @@ module Stub = struct
351
355
connection -> connection_status = " PQstatus_stub" [@@ noalloc]
352
356
353
357
external error_message : connection -> string = " PQerrorMessage_stub"
354
- external backend_pid : connection -> int = " PQbackendPID_stub" [@@ noalloc]
355
358
356
- external server_version :
357
- connection -> int = " PQserverVersion_stub" [@@ noalloc]
359
+ external backend_pid : connection -> (int [@ untagged])
360
+ = " PQbackendPID_stub_bc" " PQbackendPID_stub" [@@ noalloc]
361
+
362
+ external server_version : connection -> (int [@ untagged])
363
+ = " PQserverVersion_stub_bc" " PQserverVersion_stub" [@@ noalloc]
358
364
359
365
(* Command Execution Functions *)
360
366
@@ -381,76 +387,111 @@ module Stub = struct
381
387
external make_empty_res :
382
388
connection -> result_status -> result = " PQmakeEmptyPGresult_stub"
383
389
384
- external ntuples : result -> int = " PQntuples_stub" [@@ noalloc]
385
- external nparams : result -> int = " PQnparams_stub"
390
+ external ntuples : result -> (int [@ untagged])
391
+ = " PQntuples_stub_bc" " PQntuples_stub" [@@ noalloc]
392
+
393
+ external nparams : result -> (int [@ untagged])
394
+ = " PQnparams_stub_bc" " PQnparams_stub"
395
+
396
+ external nfields : result -> (int [@ untagged])
397
+ = " PQnfields_stub_bc" " PQnfields_stub" [@@ noalloc]
398
+
399
+ external fname : result -> (int [@ untagged]) -> string
400
+ = " PQfname_stub_bc" " PQfname_stub"
401
+
402
+ external fnumber : result -> string -> (int [@ untagged])
403
+ = " PQfnumber_stub_bc" " PQfnumber_stub" [@@ noalloc]
386
404
387
- external nfields : result -> int = " PQnfields_stub" [@@ noalloc]
388
- external fname : result -> int -> string = " PQfname_stub"
389
- external fnumber : result -> string -> int = " PQfnumber_stub" [@@ noalloc]
390
- external fformat : result -> int -> FFormat .t = " PQfformat_stub" [@@ noalloc]
391
- external ftype : result -> int -> oid = " PQftype_stub" [@@ noalloc]
392
- external paramtype : result -> int -> oid = " PQparamtype_stub"
405
+ external fformat : result -> (int [@ untagged]) -> FFormat .t
406
+ = " PQfformat_stub_bc" " PQfformat_stub" [@@ noalloc]
407
+
408
+ external ftype :
409
+ result -> (int [@ untagged]) -> (int (* oid *) [@ untagged])
410
+ = " PQftype_stub_bc" " PQftype_stub" [@@ noalloc]
411
+
412
+ external paramtype :
413
+ result -> (int [@ untagged]) -> (int (* oid *) [@ untagged])
414
+ = " PQparamtype_stub_bc" " PQparamtype_stub"
415
+
416
+ external fmod : result -> (int [@ untagged]) -> (int [@ untagged])
417
+ = " PQfmod_stub_bc" " PQfmod_stub" [@@ noalloc]
418
+
419
+ external fsize : result -> (int [@ untagged]) -> (int [@ untagged])
420
+ = " PQfsize_stub_bc" " PQfsize_stub" [@@ noalloc]
393
421
394
- external fmod : result -> int -> int = " PQfmod_stub" [@@ noalloc]
395
- external fsize : result -> int -> int = " PQfsize_stub" [@@ noalloc]
396
422
external binary_tuples : result -> bool = " PQbinaryTuples_stub" [@@ noalloc]
397
423
398
- external getvalue : result -> int -> int -> string = " PQgetvalue_stub"
424
+ external getvalue : result -> (int [@ untagged]) -> (int [@ untagged]) -> string
425
+ = " PQgetvalue_stub_bc" " PQgetvalue_stub"
399
426
400
427
external get_escaped_value :
401
- result -> int -> int -> string = " PQgetescval_stub"
428
+ result -> (int [@ untagged]) -> (int [@ untagged]) -> string
429
+ = " PQgetescval_stub_bc" " PQgetescval_stub"
402
430
403
- external getisnull :
404
- result -> int -> int -> bool = " PQgetisnull_stub" [@@ noalloc]
431
+ external getisnull : result -> ( int [ @ untagged]) -> ( int [ @ untagged]) -> bool
432
+ = " PQgetisnull_stub_bc " " PQgetisnull_stub" [@@ noalloc]
405
433
406
434
external getlength :
407
- result -> int -> int -> int = " PQgetlength_stub" [@@ noalloc]
435
+ result -> (int [@ untagged]) -> (int [@ untagged]) -> (int [@ untagged])
436
+ = " PQgetlength_stub_bc" " PQgetlength_stub" [@@ noalloc]
408
437
409
438
external cmd_status : result -> string = " PQcmdStatus_stub"
410
439
external cmd_tuples : result -> string = " PQcmdTuples_stub"
411
- external oid_value : result -> oid = " PQoidValue_stub" [@@ noalloc]
440
+
441
+ external oid_value : result -> (int (* oid *) [@ untagged])
442
+ = " PQoidValue_stub_bc" " PQoidValue_stub" [@@ noalloc]
412
443
413
444
414
445
(* Asynchronous Query Processing *)
415
446
416
447
external connect_poll :
417
448
connection -> polling_status = " PQconnectPoll_stub" [@@ noalloc]
418
449
419
- external reset_start :
420
- connection -> bool = " PQresetStart_stub" [@@ noalloc]
450
+ external reset_start : connection -> bool = " PQresetStart_stub" [@@ noalloc]
421
451
422
452
external reset_poll :
423
453
connection -> polling_status = " PQresetPoll_stub" [@@ noalloc]
424
454
425
- external set_nonblocking :
426
- connection -> bool -> int = " PQsetnonblocking_stub" [@@ noalloc]
455
+ external set_nonblocking : connection -> bool -> ( int [ @ untagged])
456
+ = " PQsetnonblocking_stub_bc " " PQsetnonblocking_stub" [@@ noalloc]
427
457
428
458
external is_nonblocking :
429
459
connection -> bool = " PQisnonblocking_stub" [@@ noalloc]
430
460
431
461
external send_query_params :
432
- connection -> string -> string array -> bool array -> int
433
- = " PQsendQueryParams_stub"
462
+ connection -> string -> string array -> bool array -> ( int [ @ untagged])
463
+ = " PQsendQueryParams_stub_bc " " PQsendQueryParams_stub"
434
464
435
465
external send_prepare :
436
- connection -> string -> string -> int = " PQsendPrepare_stub" [@@ noalloc]
466
+ connection -> string -> string -> (int [@ untagged])
467
+ = " PQsendPrepare_stub_bc" " PQsendPrepare_stub" [@@ noalloc]
437
468
438
469
external send_query_prepared :
439
- connection -> string -> string array -> bool array -> int
440
- = " PQsendQueryPrepared_stub"
470
+ connection -> string -> string array -> bool array -> (int [@ untagged])
471
+ = " PQsendQueryPrepared_stub_bc" " PQsendQueryPrepared_stub"
472
+
473
+ external send_describe_prepared : connection -> string -> (int [@ untagged])
474
+ = " PQsendDescribePrepared_stub_bc" " PQsendDescribePrepared_stub"
441
475
442
- external send_describe_prepared : connection -> string -> int
443
- = " PQsendDescribePrepared_stub "
476
+ external send_describe_portal : connection -> string -> ( int [ @ untagged])
477
+ = " PQsendDescribePortal_stub_bc " " PQsendDescribePortal_stub "
444
478
445
- external send_describe_portal : connection -> string -> int
446
- = " PQsendDescribePortal_stub "
479
+ external set_single_row_mode : connection -> ( int [ @ untagged])
480
+ = " PQsetSingleRowMode_stub_bc " " PQsetSingleRowMode_stub "
447
481
448
- external set_single_row_mode : connection -> int = " PQsetSingleRowMode_stub"
449
482
external get_result : connection -> result = " PQgetResult_stub"
450
- external consume_input : connection -> int = " PQconsumeInput_stub" [@@ noalloc]
483
+
484
+ external consume_input : connection -> (int [@ untagged])
485
+ = " PQconsumeInput_stub_bc" " PQconsumeInput_stub" [@@ noalloc]
486
+
451
487
external is_busy : connection -> bool = " PQisBusy_stub" [@@ noalloc]
452
- external flush : connection -> int = " PQflush_stub" [@@ noalloc]
453
- external socket : connection -> int = " PQsocket_stub" [@@ noalloc]
488
+
489
+ external flush : connection -> (int [@ untagged])
490
+ = " PQflush_stub_bc" " PQflush_stub" [@@ noalloc]
491
+
492
+ external socket : connection -> (int [@ untagged])
493
+ = " PQsocket_stub_bc" " PQsocket_stub" [@@ noalloc]
494
+
454
495
external request_cancel : connection -> string option = " PQCancel_stub"
455
496
456
497
@@ -462,26 +503,35 @@ module Stub = struct
462
503
(* Functions Associated with the COPY Command *)
463
504
464
505
external getline :
465
- connection -> Bytes .t -> int -> int -> int = " PQgetline_stub"
506
+ connection -> Bytes .t ->
507
+ (int [@ untagged]) -> (int [@ untagged]) -> (int [@ untagged])
508
+ = " PQgetline_stub_bc" " PQgetline_stub"
466
509
467
510
external getline_async :
468
- connection -> Bytes .t -> int -> int -> int
469
- = " PQgetlineAsync_stub" [@@ noalloc]
511
+ connection -> Bytes .t ->
512
+ (int [@ untagged]) -> (int [@ untagged]) -> (int [@ untagged])
513
+ = " PQgetlineAsync_stub_bc" " PQgetlineAsync_stub" [@@ noalloc]
470
514
471
- external putline : connection -> string -> int = " PQputline_stub"
515
+ external putline : connection -> string -> (int [@ untagged])
516
+ = " PQputline_stub_bc" " PQputline_stub"
472
517
473
518
external putnbytes :
474
- connection -> string -> int -> int -> int = " PQputnbytes_stub"
519
+ connection -> string ->
520
+ (int [@ untagged]) -> (int [@ untagged]) -> (int [@ untagged])
521
+ = " PQputnbytes_stub_bc" " PQputnbytes_stub"
475
522
476
- external endcopy : connection -> int = " PQendcopy_stub"
523
+ external endcopy : connection -> (int [@ untagged])
524
+ = " PQendcopy_stub_bc" " PQendcopy_stub"
477
525
478
526
external escape_string_conn :
479
- connection -> string -> pos : int -> len : int -> string
480
- = " PQescapeStringConn_stub"
527
+ connection -> string ->
528
+ pos : (int [@ untagged]) -> len : (int [@ untagged]) -> string
529
+ = " PQescapeStringConn_stub_bc" " PQescapeStringConn_stub"
481
530
482
531
external escape_bytea_conn :
483
- connection -> string -> pos : int -> len : int -> string
484
- = " PQescapeByteaConn_stub"
532
+ connection -> string ->
533
+ pos : (int [@ untagged]) -> len : (int [@ untagged]) -> string
534
+ = " PQescapeByteaConn_stub_bc" " PQescapeByteaConn_stub"
485
535
486
536
487
537
(* Control Functions *)
@@ -492,32 +542,59 @@ module Stub = struct
492
542
493
543
(* Large objects *)
494
544
495
- external lo_creat : connection -> oid = " lo_creat_stub"
496
- external lo_import : connection -> string -> oid = " lo_import_stub"
497
- external lo_export : connection -> oid -> string -> int = " lo_export_stub"
498
- external lo_open : connection -> oid -> large_object = " lo_open_stub"
499
- external lo_close : connection -> large_object -> int = " lo_close_stub"
500
- external lo_tell : connection -> large_object -> int = " lo_tell_stub"
501
- external lo_unlink : connection -> oid -> oid = " lo_unlink_stub"
545
+ external lo_creat : connection -> (int (* oid *) [@ untagged])
546
+ = " lo_creat_stub_bc" " lo_creat_stub"
547
+
548
+ external lo_import : connection -> string -> (int (* oid *) [@ untagged])
549
+ = " lo_import_stub_bc" " lo_import_stub"
550
+
551
+ external lo_export :
552
+ connection -> (int (* oid *) [@ untagged]) -> string -> (int [@ untagged])
553
+ = " lo_export_stub_bc" " lo_export_stub"
554
+
555
+ external lo_open :
556
+ connection -> (int (* oid *) [@ untagged]) ->
557
+ (int (* large_object *) [@ untagged])
558
+ = " lo_open_stub_bc" " lo_open_stub"
559
+
560
+ external lo_close :
561
+ connection -> (int (* large_object *) [@ untagged]) -> (int [@ untagged])
562
+ = " lo_close_stub_bc" " lo_close_stub"
563
+
564
+ external lo_tell :
565
+ connection -> (int (* large_object *) [@ untagged]) -> (int [@ untagged])
566
+ = " lo_tell_stub_bc" " lo_tell_stub"
567
+
568
+ external lo_unlink :
569
+ connection -> (int (* oid *) [@ untagged]) -> (int (* oid *) [@ untagged])
570
+ = " lo_unlink_stub_bc" " lo_unlink_stub"
502
571
503
572
external lo_read :
504
- connection -> large_object -> Bytes .t -> int -> int -> int = " lo_read_stub"
573
+ connection -> (int (* large_object *) [@ untagged]) ->
574
+ Bytes .t -> (int [@ untagged]) -> (int [@ untagged]) -> (int [@ untagged])
575
+ = " lo_read_stub_bc" " lo_read_stub"
505
576
506
577
external lo_read_ba :
507
- connection -> large_object ->
578
+ connection -> ( int (* large_object *) [ @ untagged]) ->
508
579
(char , Bigarray .int8_unsigned_elt , Bigarray .c_layout ) Bigarray.Array1 .t ->
509
- int -> int -> int = " lo_read_ba_stub"
580
+ (int [@ untagged]) -> (int [@ untagged]) -> (int [@ untagged])
581
+ = " lo_read_ba_stub_bc" " lo_read_ba_stub"
510
582
511
583
external lo_write :
512
- connection -> large_object -> string -> int -> int -> int = " lo_write_stub"
584
+ connection -> (int (* large_object *) [@ untagged]) ->
585
+ string -> (int [@ untagged]) -> (int [@ untagged]) -> (int [@ untagged])
586
+ = " lo_write_stub_bc" " lo_write_stub"
513
587
514
588
external lo_write_ba :
515
- connection -> large_object ->
589
+ connection -> ( int (* large_object *) [ @ untagged]) ->
516
590
(char , Bigarray .int8_unsigned_elt , Bigarray .c_layout ) Bigarray.Array1 .t ->
517
- int -> int -> int = " lo_write_ba_stub"
591
+ (int [@ untagged]) -> (int [@ untagged]) -> (int [@ untagged])
592
+ = " lo_write_ba_stub_bc" " lo_write_ba_stub"
518
593
519
594
external lo_seek :
520
- connection -> large_object -> int -> seek_cmd -> int = " lo_lseek_stub"
595
+ connection -> (int (* large_object *) [@ untagged]) ->
596
+ (int [@ untagged]) -> seek_cmd -> (int [@ untagged])
597
+ = " lo_lseek_stub_bc" " lo_lseek_stub"
521
598
end
522
599
523
600
@@ -1091,5 +1168,4 @@ object (self)
1091
1168
method escape_bytea ?pos ?len str =
1092
1169
let pos, len = get_str_pos_len ~loc: " escape_bytea" ?pos ?len str in
1093
1170
wrap_conn (fun conn -> Stub. escape_bytea_conn conn str ~pos ~len )
1094
-
1095
1171
end
0 commit comments