Дарю код для указания произвольной библиотеки У меня работает на IBX 17.17
реализация IGDSLibrary 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. 164. 165. 166. 167. 168. 169. 170. 171. 172. 173. 174. 175. 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. 193. 194. 195. 196. 197. 198. 199. 200. 201. 202. 203. 204. 205. 206. 207. 208. 209. 210. 211. 212. 213. 214. 215. 216. 217. 218. 219. 220. 221. 222. 223. 224. 225. 226. 227. 228. 229. 230. 231. 232. 233. 234. 235. 236. 237. 238. 239. 240. 241. 242. 243. 244. 245. 246. 247. 248. 249. 250. 251. 252. 253. 254. 255. 256. 257. 258. 259. 260. 261. 262. 263. 264. 265. 266. 267. 268. 269. 270. 271. 272. 273. 274. 275. 276. 277. 278. 279. 280. 281. 282. 283. 284. 285. 286. 287. 288. 289. 290. 291. 292. 293. 294. 295. 296. 297. 298. 299. 300. 301. 302. 303. 304. 305. 306. 307. 308. 309. 310. 311. 312. 313. 314. 315. 316. 317. 318. 319. 320. 321. 322. 323. 324. 325. 326. 327. 328. 329. 330. 331. 332. 333. 334. 335. 336. 337. 338. 339. 340. 341. 342. 343. 344. 345. 346. 347. 348. 349. 350. 351. 352. 353. 354. 355. 356. 357. 358. 359. 360. 361. 362. 363. 364. 365. 366. 367. 368. 369. 370. 371. 372. 373. 374. 375. 376. 377. 378. 379. 380. 381. 382. 383. 384. 385. 386. 387. 388. 389. 390. 391. 392. 393. 394. 395. 396. 397. 398. 399. 400. 401. 402. 403. 404. 405. 406. 407. 408. 409. 410. 411. 412. 413. 414. 415. 416. 417. 418. 419. 420. 421. 422. 423. 424. 425. 426. 427. 428. 429. 430. 431. 432. 433. 434. 435. 436. 437. 438. 439. 440. 441. 442. 443. 444. 445. 446. 447. 448. 449. 450. 451. 452. 453. 454. 455. 456. 457. 458. 459. 460. 461. 462. 463. 464. 465. 466. 467. 468. 469. 470. 471. 472. 473. 474. 475. 476. 477. 478. 479. 480. 481. 482. 483. 484. 485. 486. 487. 488. 489. 490. 491. 492. 493. 494. 495. 496. 497. 498. 499. 500. 501. 502. 503. 504. 505. 506. 507. 508. 509. 510. 511. 512. 513. 514. 515. 516. 517. 518. 519. 520. 521. 522. 523. 524. 525. 526. 527. 528. 529. 530. 531. 532. 533. 534. 535. 536. 537. 538. 539. 540. 541. 542. 543. 544. 545. 546. 547. 548. 549. 550. 551. 552. 553. 554. 555. 556. 557. 558. 559. 560. 561. 562. 563. 564. 565. 566. 567. 568. 569. 570. 571. 572. 573. 574. 575. 576. 577. 578. 579. 580. 581. 582. 583. 584. 585. 586. 587. 588. 589. 590. 591. 592. 593. 594. 595. 596. 597. 598. 599. 600. 601. 602. 603. 604. 605. 606. 607. 608. 609. 610. 611. 612. 613. 614. 615. 616. 617. 618. 619. 620. 621. 622. 623. 624. 625. 626. 627. 628. 629. 630. 631. 632. 633. 634. 635. 636. 637. 638. 639. 640. 641. 642. 643. 644. 645. 646. 647. 648. 649. 650. 651. 652. 653. 654. 655. 656. 657. 658. 659. 660. 661. 662. 663. 664. 665. 666. 667. 668. 669. 670. 671. 672. 673. 674. 675. 676. 677. 678. 679. 680. 681. 682. 683. 684. 685. 686. 687. 688. 689. 690. 691. 692. 693. 694. 695. 696. 697. 698. 699. 700. 701. 702. 703. 704. 705. 706. 707. 708. 709. 710. 711. 712. 713. 714. 715. 716. 717. 718. 719. 720. 721. 722. 723. 724. 725. 726. 727. 728. 729. 730. 731. 732. 733. 734. 735. 736. 737. 738. 739. 740. 741. 742. 743. 744. 745. 746. 747. 748. 749. 750. 751. 752. 753. 754. 755. 756. 757. 758. 759. 760. 761. 762. 763. 764. 765. 766. 767. 768. 769. 770. 771. 772. 773. 774. 775. 776. 777. 778. 779. 780. 781. 782. 783. 784. 785. 786. 787. 788. 789. 790. 791. 792. 793. 794. 795. 796. 797. 798. 799. 800. 801. 802. 803. 804. 805. 806. 807. 808. 809. 810. 811. 812. 813. 814. 815. 816. 817. 818. 819. 820. 821. 822. 823. 824. 825. 826. 827. 828. 829. 830. 831. 832. 833. 834. 835. 836. 837. 838. 839. 840. 841. 842. 843. 844. 845. 846. 847. 848. 849. 850. 851. 852. 853. 854. 855. 856. 857. 858. 859. 860. 861. 862. 863. 864. 865. 866. 867. 868. 869. 870. 871. 872. 873. 874. 875. 876. 877. 878. 879. 880. 881. 882. 883. 884. 885. 886. 887. 888. 889. 890. 891. 892. 893. 894. 895. 896. 897. 898. 899. 900. 901. 902. 903. 904. 905. 906. 907. 908. 909. 910. 911. 912. 913. 914. 915. 916. 917. 918. 919. 920. 921. 922. 923. 924. 925. 926. 927. 928. 929. 930. 931. 932. 933. 934. 935. 936. 937. 938. 939. 940. 941. 942. 943. 944. 945. 946. 947. 948. 949. 950. 951. 952. 953. 954. 955. 956. 957. 958. 959. 960. 961. 962. 963. 964. 965. 966. 967. 968. 969. 970. 971. 972. 973. 974. 975. 976. 977. 978. 979. 980. 981. 982. 983. 984. 985. 986. 987. 988. 989. 990. 991. 992. 993. 994. 995. 996. 997. 998. 999. 1000. 1001. 1002. 1003. 1004. 1005. 1006. 1007. 1008. 1009. 1010. 1011. 1012. 1013. 1014. 1015. 1016. 1017. 1018. 1019. 1020. 1021. 1022. 1023. 1024. 1025. 1026. 1027. 1028. 1029. 1030. 1031. 1032. 1033. 1034. 1035. 1036. 1037. 1038. 1039. 1040. 1041. 1042. 1043. 1044. 1045. 1046. 1047. 1048. 1049. 1050. 1051. 1052. 1053. 1054. 1055. 1056. 1057. 1058. 1059. 1060. 1061. 1062. 1063. 1064. 1065. 1066. 1067. 1068. 1069. 1070. 1071. 1072. 1073. 1074. 1075. 1076. 1077. 1078. 1079. 1080. 1081. 1082. 1083. 1084. 1085. 1086. 1087. 1088. 1089. 1090. 1091. 1092. 1093. 1094. 1095. 1096. 1097. 1098. 1099. 1100. 1101. 1102. 1103. 1104. 1105. 1106. 1107. 1108. 1109. 1110. 1111. 1112. 1113. 1114. 1115. 1116. 1117. 1118. 1119. 1120. 1121. 1122. 1123. 1124. 1125. 1126. 1127. 1128. 1129. 1130. 1131. 1132. 1133. 1134. 1135. 1136. 1137. 1138. 1139. 1140. 1141. 1142. 1143. 1144. 1145. 1146. 1147. 1148. 1149. 1150. 1151. 1152. 1153. 1154. 1155. 1156. 1157. 1158. 1159. 1160. 1161. 1162. 1163. 1164. 1165. 1166. 1167. 1168. 1169. 1170. 1171. 1172. 1173. 1174. 1175. 1176. 1177. 1178. 1179. 1180. 1181. 1182. 1183. 1184. 1185. 1186. 1187. 1188. 1189. 1190. 1191. 1192. 1193. 1194. 1195. 1196. 1197. 1198. 1199. 1200. 1201. 1202. 1203. 1204. 1205. 1206. 1207. 1208. 1209. 1210. 1211. 1212.
unit UrsFBIntf;
interface
uses
IBIntf;
const
CFBServerType = 'Firebird';
CFBEmpeddedServerType = 'FB Embedded';
type
IGDSCustomLibrary = interface(IGDSLibrary)
['{59FD0A60-E504-4841-86E7-DF39CD72F3BC}']
procedure SetLibraryName(const AName: string);
end;
function CreateCustomGDSLibrary: IGDSCustomLibrary;
implementation
uses
Winapi.Windows, System.SysUtils,
IB, IBHeader, IBExternals;
type
TFBServerLibrary = class(TInterfacedObject, IGDSLibrary)
strict private
FIBLibrary: HMODULE;
FIBClientVersion: Currency;
{$IFDEF MACOS}
FIBCrypt : HMODULE;
{$ENDIF}
FBLOB_get: TBLOB_get;
FBLOB_put: TBLOB_put;
Fisc_sqlcode: Tisc_sqlcode;
Fisc_sql_interprete: Tisc_sql_interprete;
Fisc_interprete: Tisc_interprete;
Fisc_vax_integer: Tisc_vax_integer;
Fisc_blob_info: Tisc_blob_info;
Fisc_open_blob2: Tisc_open_blob2;
Fisc_close_blob: Tisc_close_blob;
Fisc_get_segment: Tisc_get_segment;
Fisc_put_segment: Tisc_put_segment;
Fisc_create_blob2: Tisc_create_blob2;
Fisc_array_gen_sdl : Tisc_array_gen_sdl;
Fisc_array_get_slice : Tisc_array_get_slice;
Fisc_array_lookup_bounds : Tisc_array_lookup_bounds;
Fisc_array_lookup_desc : Tisc_array_lookup_desc;
Fisc_array_set_desc : Tisc_array_set_desc;
Fisc_array_put_slice : Tisc_array_put_slice;
Fisc_blob_default_desc : Tisc_blob_default_desc;
Fisc_blob_gen_bpb : Tisc_blob_gen_bpb;
Fisc_blob_lookup_desc : Tisc_blob_lookup_desc;
Fisc_blob_set_desc : Tisc_blob_set_desc;
Fisc_cancel_blob : Tisc_cancel_blob;
Fisc_service_attach: Tisc_service_attach;
Fisc_service_detach: Tisc_service_detach;
Fisc_service_query: Tisc_service_query;
Fisc_service_start: Tisc_service_start;
Fisc_decode_date: Tisc_decode_date;
Fisc_decode_sql_date: Tisc_decode_sql_date;
Fisc_decode_sql_time: Tisc_decode_sql_time;
Fisc_decode_timestamp: Tisc_decode_timestamp;
Fisc_encode_date: Tisc_encode_date;
Fisc_encode_sql_date: Tisc_encode_sql_date;
Fisc_encode_sql_time: Tisc_encode_sql_time;
Fisc_encode_timestamp: Tisc_encode_timestamp;
Fisc_dsql_free_statement: Tisc_dsql_free_statement;
Fisc_dsql_execute2: Tisc_dsql_execute2;
Fisc_dsql_execute: Tisc_dsql_execute;
Fisc_dsql_set_cursor_name: Tisc_dsql_set_cursor_name;
Fisc_dsql_fetch: Tisc_dsql_fetch;
Fisc_dsql_sql_info: Tisc_dsql_sql_info;
Fisc_dsql_alloc_statement2: Tisc_dsql_alloc_statement2;
Fisc_dsql_prepare: Tisc_dsql_prepare;
Fisc_dsql_describe_bind: Tisc_dsql_describe_bind;
Fisc_dsql_describe: Tisc_dsql_describe;
Fisc_dsql_execute_immediate: Tisc_dsql_execute_immediate;
Fisc_drop_database: Tisc_drop_database;
Fisc_detach_database: Tisc_detach_database;
Fisc_attach_database: Tisc_attach_database;
Fisc_database_info: Tisc_database_info;
Fisc_start_multiple: Tisc_start_multiple;
Fisc_commit_transaction: Tisc_commit_transaction;
Fisc_commit_retaining: Tisc_commit_retaining;
Fisc_rollback_transaction: Tisc_rollback_transaction;
Fisc_rollback_retaining: Tisc_rollback_retaining;
Fisc_cancel_events: Tisc_cancel_events;
Fisc_que_events: Tisc_que_events;
Fisc_event_counts: Tisc_event_counts;
Fisc_event_block: Tisc_event_block;
Fisc_free: Tisc_free;
Fisc_add_user : Tisc_add_user;
Fisc_delete_user: Tisc_delete_user;
Fisc_modify_user: Tisc_modify_user;
Fisc_prepare_transaction : Tisc_prepare_transaction;
Fisc_prepare_transaction2 : Tisc_prepare_transaction2;
{ IB 7.0 functions only}
Fisc_get_client_version : Tisc_get_client_version;
Fisc_get_client_major_version : Tisc_get_client_major_version;
Fisc_get_client_minor_version : Tisc_get_client_minor_version;
Fisc_array_gen_sdl2 : Tisc_array_gen_sdl2;
Fisc_array_get_slice2 : Tisc_array_get_slice2;
Fisc_array_lookup_bounds2 : Tisc_array_lookup_bounds2;
Fisc_array_lookup_desc2 : Tisc_array_lookup_desc2;
Fisc_array_set_desc2 : Tisc_array_set_desc2;
Fisc_array_put_slice2 : Tisc_array_put_slice2;
Fisc_blob_default_desc2 : Tisc_blob_default_desc2;
Fisc_blob_gen_bpb2 : Tisc_blob_gen_bpb2;
Fisc_blob_lookup_desc2 : Tisc_blob_lookup_desc2;
Fisc_blob_set_desc2 : Tisc_blob_set_desc2;
{IB 7.1 functions only}
Fisc_release_savepoint : Tisc_release_savepoint;
Fisc_rollback_savepoint : Tisc_rollback_savepoint;
Fisc_start_savepoint : Tisc_start_savepoint;
Fisc_transaction_info : Tisc_transaction_info;
{IB 8.0 functions only}
Fisc_dsql_batch_execute_immed : Tisc_dsql_batch_execute_immed;
Fisc_dsql_batch_execute: Tisc_dsql_batch_execute;
public
destructor Destroy; override;
function LibraryName: string; virtual;
procedure LoadIBLibrary;
procedure FreeIBLibrary;
function TryIBLoad: Boolean;
procedure CheckIBLoaded;
function GetIBClientVersion: Currency;
function isc_attach_database(status_vector : PISC_STATUS; db_name_length : Short;
db_name : PAnsiChar; db_handle : PISC_DB_HANDLE;
parm_buffer_length : Short; parm_buffer : PByte): ISC_STATUS;
function isc_array_gen_sdl2(status_vector : PISC_STATUS; isc_array_desc : PISC_ARRAY_DESC_V2;
isc_arg3 : PShort; isc_arg4 : PByte; isc_arg5 : PShort): ISC_STATUS;
function isc_array_get_slice(status_vector : PISC_STATUS; db_handle : PISC_DB_HANDLE;
trans_handle : PISC_TR_HANDLE; array_id : PISC_QUAD;
descriptor : PISC_ARRAY_DESC; dest_array : PVoid;
slice_length : ISC_LONG): ISC_STATUS;
function isc_array_get_slice2(status_vector : PISC_STATUS;
db_handle : PISC_DB_HANDLE; trans_handle : PISC_TR_HANDLE;
array_id : PISC_QUAD; descriptor : PISC_ARRAY_DESC_V2;
dest_array : PVoid; slice_length : ISC_LONG): ISC_STATUS;
function isc_array_lookup_bounds(status_vector : PISC_STATUS; db_handle : PISC_DB_HANDLE;
trans_handle : PISC_TR_HANDLE; table_name, column_name : PByte;
descriptor : PISC_ARRAY_DESC): ISC_STATUS;
function isc_array_lookup_bounds2(status_vector : PISC_STATUS; db_handle : PISC_DB_HANDLE;
trans_handle : PISC_TR_HANDLE; table_name, column_name : PByte;
descriptor : PISC_ARRAY_DESC_V2): ISC_STATUS;
function isc_array_lookup_desc(status_vector : PISC_STATUS; db_handle : PISC_DB_HANDLE;
trans_handle : PISC_TR_HANDLE; table_name, column_name : PByte;
descriptor : PISC_ARRAY_DESC): ISC_STATUS;
function isc_array_lookup_desc2(status_vector : PISC_STATUS; db_handle : PISC_DB_HANDLE;
trans_handle : PISC_TR_HANDLE; table_name, column_name : PByte;
descriptor : PISC_ARRAY_DESC_V2): ISC_STATUS;
function isc_array_set_desc(status_vector : PISC_STATUS; table_name : PByte;
column_name : PByte; sql_dtype, sql_length, sql_dimensions : PShort;
descriptor : PISC_ARRAY_DESC): ISC_STATUS;
function isc_array_set_desc2(status_vector : PISC_STATUS; table_name : PByte;
column_name : PByte; sql_dtype, sql_length, sql_dimensions : PShort;
descriptor : PISC_ARRAY_DESC_V2): ISC_STATUS;
function isc_array_put_slice(status_vector : PISC_STATUS; db_handle : PISC_DB_HANDLE;
trans_handle : PISC_TR_HANDLE; array_id : PISC_QUAD;
descriptor : PISC_ARRAY_DESC; source_array : PVoid;
slice_length : PISC_LONG): ISC_STATUS;
function isc_array_put_slice2(status_vector : PISC_STATUS; db_handle : PISC_DB_HANDLE;
trans_handle : PISC_TR_HANDLE; array_id : PISC_QUAD;
descriptor : PISC_ARRAY_DESC_V2; source_array : PVoid;
slice_length : PISC_LONG): ISC_STATUS;
procedure isc_blob_default_desc(descriptor : PISC_BLOB_DESC; table_name : PUChar;
column_name : PUChar);
procedure isc_blob_default_desc2(descriptor : PISC_BLOB_DESC_V2; table_name : PUChar;
column_name : PUChar);
function isc_blob_gen_bpb(status_vector : PISC_STATUS; to_descriptor, from_descriptor : PISC_BLOB_DESC;
bpb_buffer_length : UShort; bpb_buffer : PUChar;
bpb_length : PUShort): ISC_STATUS;
function isc_blob_gen_bpb2(status_vector : PISC_STATUS; to_descriptor, from_descriptor : PISC_BLOB_DESC_V2;
bpb_buffer_length : UShort; bpb_buffer : PUChar;
bpb_length : PUShort): ISC_STATUS;
function isc_blob_info(status_vector : PISC_STATUS; blob_handle : PISC_BLOB_HANDLE;
item_list_buffer_length : Short; item_list_buffer : PByte;
result_buffer_length : Short; result_buffer : PByte): ISC_STATUS;
function isc_blob_lookup_desc(status_vector : PISC_STATUS; db_handle : PISC_DB_HANDLE;
trans_handle : PISC_TR_HANDLE; table_name, column_name : PByte;
descriptor : PISC_BLOB_DESC; global : PUChar): ISC_STATUS;
function isc_blob_lookup_desc2(status_vector : PISC_STATUS; db_handle : PISC_DB_HANDLE;
trans_handle : PISC_TR_HANDLE; table_name, column_name : PByte;
descriptor : PISC_BLOB_DESC_v2; global : PUChar): ISC_STATUS;
function isc_blob_set_desc(status_vector : PISC_STATUS; table_name, column_name : PByte;
subtype, charset, segment_size : Short; descriptor : PISC_BLOB_DESC): ISC_STATUS;
function isc_blob_set_desc2(status_vector : PISC_STATUS; table_name, column_name : PByte;
subtype, charset, segment_size : Short;
descriptor : PISC_BLOB_DESC_V2): ISC_STATUS;
function isc_cancel_blob(status_vector : PISC_STATUS; blob_handle : PISC_BLOB_HANDLE): ISC_STATUS;
function isc_cancel_events(status_vector : PISC_STATUS; db_handle : PISC_DB_HANDLE;
event_id : PISC_LONG): ISC_STATUS;
function isc_close_blob(status_vector : PISC_STATUS; blob_handle : PISC_BLOB_HANDLE): ISC_STATUS;
function isc_commit_retaining(status_vector : PISC_STATUS; tran_handle : PISC_TR_HANDLE): ISC_STATUS;
function isc_commit_transaction(status_vector : PISC_STATUS; tran_handle : PISC_TR_HANDLE): ISC_STATUS;
function isc_create_blob2(status_vector : PISC_STATUS; db_handle : PISC_DB_HANDLE;
tran_handle : PISC_TR_HANDLE; blob_handle : PISC_BLOB_HANDLE;
blob_id : PISC_QUAD; bpb_length : Short; bpb_address : PByte): ISC_STATUS;
function isc_database_info(status_vector : PISC_STATUS; db_handle : PISC_DB_HANDLE;
item_list_buffer_length : Short; item_list_buffer : PByte;
result_buffer_length : Short; result_buffer : PAnsiChar): ISC_STATUS;
procedure isc_decode_date(ib_date: PISC_QUAD; tm_date: PCTimeStructure);
procedure isc_decode_sql_date(ib_date: PISC_DATE; tm_date: PCTimeStructure);
procedure isc_decode_sql_time(ib_time: PISC_TIME; tm_date: PCTimeStructure);
procedure isc_decode_timestamp(ib_timestamp: PISC_TIMESTAMP; tm_date: PCTimeStructure);
function isc_detach_database(status_vector : PISC_STATUS; db_handle : PISC_DB_HANDLE): ISC_STATUS;
function isc_drop_database(status_vector : PISC_STATUS; db_handle : PISC_DB_HANDLE): ISC_STATUS;
function isc_dsql_alloc_statement2(status_vector : PISC_STATUS; db_handle : PISC_DB_HANDLE;
stmt_handle : PISC_STMT_HANDLE): ISC_STATUS;
function isc_dsql_describe(status_vector : PISC_STATUS; stmt_handle : PISC_STMT_HANDLE;
dialect : UShort; xsqlda : PXSQLDA): ISC_STATUS;
function isc_dsql_describe_bind(status_vector : PISC_STATUS; stmt_handle : PISC_STMT_HANDLE;
dialect : UShort; xsqlda : PXSQLDA): ISC_STATUS;
function isc_dsql_execute(status_vector : PISC_STATUS; tran_handle : PISC_TR_HANDLE;
stmt_handle : PISC_STMT_HANDLE; dialect : UShort;
xsqlda : PXSQLDA): ISC_STATUS;
function isc_dsql_execute2(status_vector : PISC_STATUS; tran_handle : PISC_TR_HANDLE;
stmt_handle : PISC_STMT_HANDLE; dialect : UShort;
in_xsqlda, out_xsqlda : PXSQLDA): ISC_STATUS;
function isc_dsql_execute_immediate(status_vector : PISC_STATUS; db_handle : PISC_DB_HANDLE;
tran_handle : PISC_TR_HANDLE; length : UShort;
statement : PAnsiChar; dialect : UShort;
xsqlda : PXSQLDA): ISC_STATUS;
function isc_dsql_fetch(status_vector : PISC_STATUS; stmt_handle : PISC_STMT_HANDLE;
dialect : UShort; xsqlda : PXSQLDA): ISC_STATUS;
function isc_dsql_free_statement(status_vector : PISC_STATUS; stmt_handle : PISC_STMT_HANDLE;
options : UShort): ISC_STATUS;
function isc_dsql_prepare(status_vector : PISC_STATUS; tran_handle : PISC_TR_HANDLE;
stmt_handle : PISC_STMT_HANDLE; length : UShort;
statement : PByte; dialect : UShort;
xsqlda : PXSQLDA): ISC_STATUS;
function isc_dsql_set_cursor_name(status_vector : PISC_STATUS; stmt_handle : PISC_STMT_HANDLE;
cursor_name : PByte; _type : UShort): ISC_STATUS;
function isc_dsql_sql_info(status_vector : PISC_STATUS; stmt_handle : PISC_STMT_HANDLE;
item_length : Short; items : PByte; buffer_length : Short;
buffer : PByte): ISC_STATUS;
procedure isc_encode_date(tm_date : PCTimeStructure; ib_date : PISC_QUAD);
procedure isc_encode_sql_date(tm_date: PCTimeStructure; ib_date : PISC_DATE);
procedure isc_encode_sql_time(tm_date : PCTimeStructure; ib_time : PISC_TIME);
procedure isc_encode_timestamp(tm_date : PCTimeStructure; ib_timestamp : PISC_TIMESTAMP);
function isc_event_block(event_buffer : PPAnsiChar; result_buffer : PPAnsiChar;
id_count : UShort; event_list : array of PAnsiChar): ISC_LONG;
procedure isc_event_counts(status_vector : PISC_STATUS; buffer_length : Short;
event_buffer : PAnsiChar; result_buffer : PAnsiChar);
function isc_free(isc_arg1 : PAnsiChar): ISC_LONG;
function isc_get_segment(status_vector : PISC_STATUS; blob_handle : PISC_BLOB_HANDLE;
actual_seg_length : PUShort; seg_buffer_length : UShort;
seg_buffer : PByte): ISC_STATUS;
function isc_interprete(buffer : PByte; status_vector : PPISC_STATUS): ISC_STATUS;
function isc_open_blob2(status_vector : PISC_STATUS; db_handle : PISC_DB_HANDLE;
tran_handle : PISC_TR_HANDLE; blob_handle : PISC_BLOB_HANDLE;
blob_id : PISC_QUAD; bpb_length : Short; bpb_buffer : PByte): ISC_STATUS;
function isc_prepare_transaction2(status_vector : PISC_STATUS; tran_handle : PISC_TR_HANDLE;
msg_length : Short; msg : PByte): ISC_STATUS;
function isc_put_segment(status_vector : PISC_STATUS; blob_handle : PISC_BLOB_HANDLE;
seg_buffer_len : UShort; seg_buffer : PByte): ISC_STATUS;
function isc_que_events(status_vector : PISC_STATUS; db_handle : PISC_DB_HANDLE;
event_id : PISC_LONG; length : Short; event_buffer : PAnsiChar;
event_function : TISC_CALLBACK; event_function_arg : PVoid): ISC_STATUS;
function isc_release_savepoint(status_vector : PISC_STATUS; tran_handle : PISC_TR_HANDLE;
tran_name : PAnsiChar) : ISC_STATUS;
function isc_rollback_retaining(status_vector : PISC_STATUS; tran_handle : PISC_TR_HANDLE): ISC_STATUS;
function isc_rollback_savepoint(status_vector : PISC_STATUS; tran_handle : PISC_TR_HANDLE;
tran_name : PAnsiChar; Option : UShort) : ISC_STATUS;
function isc_rollback_transaction(status_vector : PISC_STATUS; tran_handle : PISC_TR_HANDLE): ISC_STATUS;
function isc_start_multiple(status_vector : PISC_STATUS; tran_handle : PISC_TR_HANDLE;
db_handle_count : Short; teb_vector_address : PISC_TEB): ISC_STATUS;
function isc_start_savepoint(status_vector : PISC_STATUS; tran_handle : PISC_TR_HANDLE;
tran_name : PAnsiChar): ISC_STATUS;
function isc_sqlcode(status_vector : PISC_STATUS): ISC_LONG;
procedure isc_sql_interprete(sqlcode : Short; buffer : PByte;
buffer_length : Short);
function isc_vax_integer(buffer : PByte; length : Short): ISC_LONG;
{IB 8.0 functions}
function isc_dsql_batch_execute_immed(status_vector : PISC_STATUS;
db_handle : PISC_DB_HANDLE; tran_handle : PISC_TR_HANDLE;
Dialect : UShort; no_of_sql : ULong; statement : PPByte;
rows_affected : PULong) : ISC_STATUS;
function isc_dsql_batch_execute(status_vector : PISC_STATUS; tran_handle : PISC_TR_HANDLE;
stmt_handle : PISC_STMT_HANDLE; Dialect : UShort;
insqlda : PXSQLDA; no_of_rows : UShort;
batch_vars : PXSQLVAR; rows_affected : PULong) : ISC_STATUS;
// Security Functions
function isc_add_user(status_vector : PISC_STATUS; user_sec_data : PUserSecData): ISC_STATUS;
function isc_delete_user(status_vector : PISC_STATUS; user_sec_data : PUserSecData): ISC_STATUS;
function isc_modify_user(status_vector : PISC_STATUS; user_sec_data : PUserSecData): ISC_STATUS;
// Other OSRI functions
function isc_prepare_transaction(status_vector : PISC_STATUS;
tran_handle : PISC_TR_HANDLE): ISC_STATUS;
// Other Blob functions
function BLOB_put(isc_arg1 : AnsiChar;
isc_arg2 : PBSTREAM): Int;
function BLOB_get(isc_arg1 : PBSTREAM): Int;
// Service manager functions
function isc_service_attach (status_vector : PISC_STATUS;
isc_arg2 : UShort;
isc_arg3 : PByte;
service_handle : PISC_SVC_HANDLE;
isc_arg5 : UShort;
isc_arg6 : PByte): ISC_STATUS;
function isc_service_detach(status_vector : PISC_STATUS;
service_handle : PISC_SVC_HANDLE): ISC_STATUS;
function isc_service_query (status_vector : PISC_STATUS;
service_handle : PISC_SVC_HANDLE;
recv_handle : PISC_SVC_HANDLE;
isc_arg4 : UShort;
isc_arg5 : PByte;
isc_arg6 : UShort;
isc_arg7 : PByte;
isc_arg8 : UShort;
isc_arg9 : PByte): ISC_STATUS;
function isc_service_start (status_vector : PISC_STATUS;
service_handle : PISC_SVC_HANDLE;
recv_handle : PISC_SVC_HANDLE;
isc_arg4 : UShort;
isc_arg5 : PByte): ISC_STATUS;
// Client information functions
procedure isc_get_client_version(buffer : PByte);
function isc_get_client_major_version: Integer;
function isc_get_client_minor_version: Integer;
function isc_transaction_info(status_vector : PISC_STATUS;
tran_handle : PISC_TR_HANDLE;
item_list_buffer_length : Short;
item_list_buffer : PByte;
result_buffer_length : Short;
result_buffer : PByte): ISC_STATUS;
end;
TFBEmbeddedLibrary = class(TFBServerLibrary)
public
function LibraryName: string; override;
end;
TGDSCustomLibrary = class(TFBServerLibrary, IGDSCustomLibrary)
strict private
FLibraryName: string;
strict protected
procedure SetLibraryName(const AName: string);
public
function LibraryName: string; override;
end;
function CreateCustomGDSLibrary: IGDSCustomLibrary;
begin
Result := TGDSCustomLibrary.Create;
end;
{ TFBServerLibrary }
destructor TFBServerLibrary.Destroy;
begin
FreeIBLibrary;
inherited Destroy;
end;
function TFBServerLibrary.LibraryName: string;
begin
Result := 'fbclient.dll';
end;
procedure TFBServerLibrary.LoadIBLibrary;
var
CurLibrary : THandle;
sLibName : String;
function TryGetProcAddr(const ProcName: String): Pointer;
begin
Result := GetProcAddress(CurLibrary, PChar(ProcName));
end;
function GetProcAddr(const ProcName: String): Pointer;
begin
Result := GetProcAddress(CurLibrary, PChar(ProcName));
if not Assigned(Result) then
RaiseLastOSError;
end;
begin
sLibName := LibraryName;
FIBLibrary := LoadLibrary(PChar(sLibName));
{$IFDEF MSWINDOWS}
if FIBLibrary <> 0 then
{$ENDIF}
{$IFDEF MACOS}
if (FIBCrypt = 0) then
FIBCrypt := LoadLibrary('libcrypt.dylib'); {do not localize}
if (FIBLibrary <> 0) then
{$ENDIF}
begin
CurLibrary := FIBLibrary;
FBLOB_get := GetProcAddr('BLOB_get'); {do not localize}
FBLOB_put := GetProcAddr('BLOB_put'); {do not localize}
Fisc_sqlcode := GetProcAddr('isc_sqlcode'); {do not localize}
Fisc_sql_interprete := GetProcAddr('isc_sql_interprete'); {do not localize}
Fisc_interprete := GetProcAddr('isc_interprete'); {do not localize}
Fisc_vax_integer := GetProcAddr('isc_vax_integer'); {do not localize}
Fisc_blob_info := GetProcAddr('isc_blob_info'); {do not localize}
Fisc_open_blob2 := GetProcAddr('isc_open_blob2'); {do not localize}
Fisc_close_blob := GetProcAddr('isc_close_blob'); {do not localize}
Fisc_get_segment := GetProcAddr('isc_get_segment'); {do not localize}
Fisc_put_segment := GetProcAddr('isc_put_segment'); {do not localize}
Fisc_create_blob2 := GetProcAddr('isc_create_blob2'); {do not localize}
Fisc_cancel_blob := GetProcAddr('isc_cancel_blob'); {do not localize}
Fisc_array_gen_sdl := GetProcAddr('isc_array_gen_sdl'); {do not localize}
Fisc_array_get_slice := GetProcAddr('isc_array_get_slice'); {do not localize}
Fisc_array_lookup_bounds := GetProcAddr('isc_array_lookup_bounds'); {do not localize}
Fisc_array_lookup_desc := GetProcAddr('isc_array_lookup_desc'); {do not localize}
Fisc_array_set_desc := GetProcAddr('isc_array_set_desc'); {do not localize}
Fisc_array_put_slice := GetProcAddr('isc_array_put_slice'); {do not localize}
Fisc_blob_default_desc := GetProcAddr('isc_blob_default_desc'); {do not localize}
Fisc_blob_gen_bpb := GetProcAddr('isc_blob_gen_bpb'); {do not localize}
Fisc_blob_lookup_desc := GetProcAddr('isc_blob_lookup_desc'); {do not localize}
Fisc_blob_set_desc := GetProcAddr('isc_blob_set_desc'); {do not localize}
Fisc_decode_date := GetProcAddr('isc_decode_date'); {do not localize}
Fisc_encode_date := GetProcAddr('isc_encode_date'); {do not localize}
Fisc_dsql_free_statement := GetProcAddr('isc_dsql_free_statement'); {do not localize}
Fisc_dsql_execute2 := GetProcAddr('isc_dsql_execute2'); {do not localize}
Fisc_dsql_execute := GetProcAddr('isc_dsql_execute'); {do not localize}
Fisc_dsql_set_cursor_name := GetProcAddr('isc_dsql_set_cursor_name'); {do not localize}
Fisc_dsql_fetch := GetProcAddr('isc_dsql_fetch'); {do not localize}
Fisc_dsql_sql_info := GetProcAddr('isc_dsql_sql_info'); {do not localize}
Fisc_dsql_alloc_statement2 := GetProcAddr('isc_dsql_alloc_statement2'); {do not localize}
Fisc_dsql_prepare := GetProcAddr('isc_dsql_prepare'); {do not localize}
Fisc_dsql_describe_bind := GetProcAddr('isc_dsql_describe_bind'); {do not localize}
Fisc_dsql_describe := GetProcAddr('isc_dsql_describe'); {do not localize}
Fisc_dsql_execute_immediate := GetProcAddr('isc_dsql_execute_immediate'); {do not localize}
Fisc_drop_database := GetProcAddr('isc_drop_database'); {do not localize}
Fisc_detach_database := GetProcAddr('isc_detach_database'); {do not localize}
Fisc_attach_database := GetProcAddr('isc_attach_database'); {do not localize}
Fisc_database_info := GetProcAddr('isc_database_info'); {do not localize}
Fisc_start_multiple := GetProcAddr('isc_start_multiple'); {do not localize}
Fisc_commit_transaction := GetProcAddr('isc_commit_transaction'); {do not localize}
Fisc_commit_retaining := GetProcAddr('isc_commit_retaining'); {do not localize}
Fisc_rollback_transaction := GetProcAddr('isc_rollback_transaction'); {do not localize}
Fisc_cancel_events := GetProcAddr('isc_cancel_events'); {do not localize}
Fisc_que_events := GetProcAddr('isc_que_events'); {do not localize}
Fisc_event_counts := GetProcAddr('isc_event_counts'); {do not localize}
Fisc_event_block := GetProcAddr('isc_event_block'); {do not localize}
Fisc_free := GetProcAddr('isc_free'); {do not localize}
Fisc_add_user := GetProcAddr('isc_add_user'); {do not localize}
Fisc_delete_user := GetProcAddr('isc_delete_user'); {do not localize}
Fisc_modify_user := GetProcAddr('isc_modify_user'); {do not localize}
Fisc_prepare_transaction := GetProcAddr('isc_prepare_transaction'); {do not localize}
Fisc_prepare_transaction2 := GetProcAddr('isc_prepare_transaction2'); {do not localize}
Fisc_transaction_info := GetProcAddr('isc_transaction_info'); {do not localize}
Fisc_rollback_retaining := TryGetProcAddr('isc_rollback_retaining'); {do not localize}
if Assigned(Fisc_rollback_retaining) then
begin
FIBClientVersion := 6;
Fisc_service_attach := GetProcAddr('isc_service_attach'); {do not localize}
Fisc_service_detach := GetProcAddr('isc_service_detach'); {do not localize}
Fisc_service_query := GetProcAddr('isc_service_query'); {do not localize}
Fisc_service_start := GetProcAddr('isc_service_start'); {do not localize}
Fisc_decode_sql_date := GetProcAddr('isc_decode_sql_date'); {do not localize}
Fisc_decode_sql_time := GetProcAddr('isc_decode_sql_time'); {do not localize}
Fisc_decode_timestamp := GetProcAddr('isc_decode_timestamp'); {do not localize}
Fisc_encode_sql_date := GetProcAddr('isc_encode_sql_date'); {do not localize}
Fisc_encode_sql_time := GetProcAddr('isc_encode_sql_time'); {do not localize}
Fisc_encode_timestamp := GetProcAddr('isc_encode_timestamp'); {do not localize}
end;
Fisc_get_client_version := TryGetProcAddr('isc_get_client_version'); {do not localize}
if Assigned(Fisc_get_client_version) then
begin
Fisc_get_client_major_version := GetProcAddr('isc_get_client_major_version'); {do not localize}
Fisc_get_client_minor_version := GetProcAddr('isc_get_client_minor_version'); {do not localize}
FIBClientVersion := isc_get_client_major_version + (isc_get_client_minor_version / 10);
end;
if FIBClientVersion >= 7 then
begin
Fisc_array_gen_sdl2 := GetProcAddr('isc_array_gen_sdl2');
Fisc_array_get_slice2 := GetProcAddr('isc_array_get_slice2');
Fisc_array_lookup_bounds2 := GetProcAddr('isc_array_lookup_bounds2');
Fisc_array_lookup_desc2 := GetProcAddr('isc_array_lookup_desc2');
Fisc_array_set_desc2 := GetProcAddr('isc_array_set_desc2');
Fisc_array_put_slice2 := GetProcAddr('isc_array_put_slice2');
Fisc_blob_default_desc2 := GetProcAddr('isc_blob_default_desc2');
Fisc_blob_gen_bpb2 := GetProcAddr('isc_blob_gen_bpb2');
Fisc_blob_lookup_desc2 := GetProcAddr('isc_blob_lookup_desc2');
Fisc_blob_set_desc2 := GetProcAddr('isc_blob_set_desc2');
if FIBClientVersion >= 7.1 then
begin
Fisc_release_savepoint := GetProcAddr('isc_release_savepoint');
Fisc_rollback_savepoint := GetProcAddr('isc_rollback_savepoint');
Fisc_start_savepoint := GetProcAddr('isc_start_savepoint');
end;
if FIBClientVersion >= 8.0 then
begin
Fisc_dsql_batch_execute_immed := GetProcAddr('isc_dsql_batch_execute_immed');
Fisc_dsql_batch_execute := GetProcAddr('isc_dsql_batch_execute');
end;
end;
end;
end;
procedure TFBServerLibrary.FreeIBLibrary;
begin
{$IFDEF MSWINDOWS}
if (FIBLibrary > HINSTANCE_ERROR) then
{$ENDIF}
{$IFDEF MACOS}
if (FIBLibrary <> 0) then
{$ENDIF}
begin
FreeLibrary(FIBLibrary);
FIBLibrary := 0;
end;
{$IFDEF MACOS}
if FIBCrypt <> 0 then
begin
FreeLibrary(FIBCrypt);
FIBCrypt := 0;
end;
{$ENDIF}
end;
function TFBServerLibrary.TryIBLoad: Boolean;
begin
{$IFDEF MSWINDOWS}
if (FIBLibrary <= HINSTANCE_ERROR) then
{$ENDIF}
{$IFDEF MACOS}
if (FIBLibrary = 0) then
{$ENDIF}
LoadIBLibrary;
{$IFDEF MSWINDOWS}
if (FIBLibrary <= HINSTANCE_ERROR) then
{$ENDIF}
{$IFDEF MACOS}
if (FIBLibrary = 0) then
{$ENDIF}
result := False
else
result := True;
end;
procedure TFBServerLibrary.CheckIBLoaded;
begin
if not TryIBLoad then
IBError(ibxeInterBaseMissing, [LibraryName]);
end;
function TFBServerLibrary.GetIBClientVersion: Currency;
begin
CheckIBLoaded;
result := FIBClientVersion;
end;
function TFBServerLibrary.BLOB_put(isc_arg1: AnsiChar; isc_arg2: PBSTREAM): Int;
begin
Result := FBLOB_put(isc_arg1, isc_arg2);
end;
function TFBServerLibrary.isc_add_user(status_vector: PISC_STATUS;
user_sec_data: PUserSecData): ISC_STATUS;
begin
Result := Fisc_add_user(status_vector, user_sec_data);
end;
function TFBServerLibrary.isc_array_gen_sdl2(status_vector: PISC_STATUS;
isc_array_desc: PISC_ARRAY_DESC_V2; isc_arg3: PShort; isc_arg4: PByte;
isc_arg5: PShort): ISC_STATUS;
begin
Result := Fisc_array_gen_sdl2(status_vector, isc_array_desc, isc_arg3, isc_arg4, isc_arg5);
end;
function TFBServerLibrary.isc_array_get_slice(status_vector: PISC_STATUS;
db_handle: PISC_DB_HANDLE; trans_handle: PISC_TR_HANDLE;
array_id: PISC_QUAD; descriptor: PISC_ARRAY_DESC; dest_array: PVoid;
slice_length: ISC_LONG): ISC_STATUS;
begin
Result := Fisc_array_get_slice(status_vector, db_handle, trans_handle,
array_id, descriptor, dest_array, slice_length);
end;
function TFBServerLibrary.isc_array_get_slice2(status_vector: PISC_STATUS;
db_handle: PISC_DB_HANDLE; trans_handle: PISC_TR_HANDLE;
array_id: PISC_QUAD; descriptor: PISC_ARRAY_DESC_V2; dest_array: PVoid;
slice_length: ISC_LONG): ISC_STATUS;
begin
Result := Fisc_array_get_slice2(status_vector, db_handle, trans_handle,
array_id, descriptor, dest_array, slice_length);
end;
function TFBServerLibrary.isc_array_lookup_bounds(
status_vector: PISC_STATUS; db_handle: PISC_DB_HANDLE;
trans_handle: PISC_TR_HANDLE; table_name, column_name: PByte;
descriptor: PISC_ARRAY_DESC): ISC_STATUS;
begin
Result := Fisc_array_lookup_bounds(status_vector, db_handle,
trans_handle, table_name, column_name, descriptor);
end;
function TFBServerLibrary.isc_array_lookup_bounds2(
status_vector: PISC_STATUS; db_handle: PISC_DB_HANDLE;
trans_handle: PISC_TR_HANDLE; table_name, column_name: PByte;
descriptor: PISC_ARRAY_DESC_V2): ISC_STATUS;
begin
Result := Fisc_array_lookup_bounds2(status_vector, db_handle,
trans_handle, table_name, column_name, descriptor);
end;
function TFBServerLibrary.isc_array_lookup_desc(status_vector: PISC_STATUS;
db_handle: PISC_DB_HANDLE; trans_handle: PISC_TR_HANDLE; table_name,
column_name: PByte; descriptor: PISC_ARRAY_DESC): ISC_STATUS;
begin
Result := Fisc_array_lookup_desc(status_vector, db_handle, trans_handle,
table_name, column_name, descriptor);
end;
function TFBServerLibrary.isc_array_lookup_desc2(status_vector: PISC_STATUS;
db_handle: PISC_DB_HANDLE; trans_handle: PISC_TR_HANDLE; table_name,
column_name: PByte; descriptor: PISC_ARRAY_DESC_V2): ISC_STATUS;
begin
Result := Fisc_array_lookup_desc2(status_vector, db_handle, trans_handle,
table_name, column_name, descriptor);
end;
function TFBServerLibrary.isc_array_put_slice(status_vector: PISC_STATUS;
db_handle: PISC_DB_HANDLE; trans_handle: PISC_TR_HANDLE;
array_id: PISC_QUAD; descriptor: PISC_ARRAY_DESC; source_array: PVoid;
slice_length: PISC_LONG): ISC_STATUS;
begin
Result := Fisc_array_put_slice(status_vector, db_handle, trans_handle,
array_id, descriptor, source_array, slice_length);
end;
function TFBServerLibrary.isc_array_put_slice2(status_vector: PISC_STATUS;
db_handle: PISC_DB_HANDLE; trans_handle: PISC_TR_HANDLE;
array_id: PISC_QUAD; descriptor: PISC_ARRAY_DESC_V2; source_array: PVoid;
slice_length: PISC_LONG): ISC_STATUS;
begin
Result := Fisc_array_put_slice2(status_vector, db_handle, trans_handle,
array_id, descriptor, source_array, slice_length);
end;
function TFBServerLibrary.isc_array_set_desc(status_vector: PISC_STATUS;
table_name, column_name: PByte; sql_dtype, sql_length,
sql_dimensions: PShort; descriptor: PISC_ARRAY_DESC): ISC_STATUS;
begin
Result := Fisc_array_set_desc(status_vector, table_name, column_name,
sql_dtype, sql_length, sql_dimensions, descriptor);
end;
function TFBServerLibrary.isc_array_set_desc2(status_vector: PISC_STATUS;
table_name, column_name: PByte; sql_dtype, sql_length,
sql_dimensions: PShort; descriptor: PISC_ARRAY_DESC_V2): ISC_STATUS;
begin
Result := Fisc_array_set_desc2(status_vector, table_name, column_name,
sql_dtype, sql_length, sql_dimensions, descriptor);
end;
function TFBServerLibrary.isc_attach_database(status_vector: PISC_STATUS;
db_name_length: Short; db_name: PAnsiChar; db_handle: PISC_DB_HANDLE;
parm_buffer_length: Short; parm_buffer: PByte): ISC_STATUS;
begin
Result := Fisc_attach_database(status_vector, db_name_length, db_name,
db_handle, parm_buffer_length, parm_buffer);
end;
procedure TFBServerLibrary.isc_blob_default_desc(descriptor: PISC_BLOB_DESC;
table_name, column_name: PUChar);
begin
Fisc_blob_default_desc(descriptor, table_name, column_name);
end;
procedure TFBServerLibrary.isc_blob_default_desc2(
descriptor: PISC_BLOB_DESC_V2; table_name, column_name: PUChar);
begin
Fisc_blob_default_desc2(descriptor, table_name, column_name);
end;
function TFBServerLibrary.isc_blob_gen_bpb(status_vector: PISC_STATUS;
to_descriptor, from_descriptor: PISC_BLOB_DESC;
bpb_buffer_length: UShort; bpb_buffer: PUChar;
bpb_length: PUShort): ISC_STATUS;
begin
Result := Fisc_blob_gen_bpb(status_vector, to_descriptor, from_descriptor,
bpb_buffer_length, bpb_buffer, bpb_length);
end;
function TFBServerLibrary.isc_blob_gen_bpb2(status_vector: PISC_STATUS;
to_descriptor, from_descriptor: PISC_BLOB_DESC_V2;
bpb_buffer_length: UShort; bpb_buffer: PUChar;
bpb_length: PUShort): ISC_STATUS;
begin
Result := Fisc_blob_gen_bpb2(status_vector, to_descriptor, from_descriptor,
bpb_buffer_length, bpb_buffer, bpb_length);
end;
function TFBServerLibrary.isc_blob_info(status_vector: PISC_STATUS;
blob_handle: PISC_BLOB_HANDLE; item_list_buffer_length: Short;
item_list_buffer: PByte; result_buffer_length: Short;
result_buffer: PByte): ISC_STATUS;
begin
Result := Fisc_blob_info(status_vector, blob_handle, item_list_buffer_length,
item_list_buffer, result_buffer_length, result_buffer);
end;
function TFBServerLibrary.isc_blob_lookup_desc(status_vector: PISC_STATUS;
db_handle: PISC_DB_HANDLE; trans_handle: PISC_TR_HANDLE; table_name,
column_name: PByte; descriptor: PISC_BLOB_DESC;
global: PUChar): ISC_STATUS;
begin
Result := Fisc_blob_lookup_desc(status_vector, db_handle, trans_handle,
table_name, column_name, descriptor, global);
end;
function TFBServerLibrary.isc_blob_lookup_desc2(status_vector: PISC_STATUS;
db_handle: PISC_DB_HANDLE; trans_handle: PISC_TR_HANDLE; table_name,
column_name: PByte; descriptor: PISC_BLOB_DESC_v2;
global: PUChar): ISC_STATUS;
begin
Result := Fisc_blob_lookup_desc2(status_vector, db_handle, trans_handle,
table_name, column_name, descriptor, global);
end;
function TFBServerLibrary.isc_blob_set_desc(status_vector: PISC_STATUS;
table_name, column_name: PByte; subtype, charset, segment_size: Short;
descriptor: PISC_BLOB_DESC): ISC_STATUS;
begin
Result := Fisc_blob_set_desc(status_vector, table_name, column_name, subtype,
charset, segment_size, descriptor);
end;
function TFBServerLibrary.isc_blob_set_desc2(status_vector: PISC_STATUS;
table_name, column_name: PByte; subtype, charset, segment_size: Short;
descriptor: PISC_BLOB_DESC_V2): ISC_STATUS;
begin
Result := Fisc_blob_set_desc2(status_vector, table_name, column_name, subtype,
charset, segment_size, descriptor);
end;
function TFBServerLibrary.isc_cancel_blob(status_vector: PISC_STATUS;
blob_handle: PISC_BLOB_HANDLE): ISC_STATUS;
begin
Result := Fisc_cancel_blob(status_vector, blob_handle);
end;
function TFBServerLibrary.isc_cancel_events(status_vector: PISC_STATUS;
db_handle: PISC_DB_HANDLE; event_id: PISC_LONG): ISC_STATUS;
begin
Result := Fisc_cancel_events(status_vector, db_handle, event_id);
end;
function TFBServerLibrary.isc_close_blob(status_vector: PISC_STATUS;
blob_handle: PISC_BLOB_HANDLE): ISC_STATUS;
begin
Result := Fisc_close_blob(status_vector, blob_handle);
end;
function TFBServerLibrary.isc_commit_retaining(status_vector: PISC_STATUS;
tran_handle: PISC_TR_HANDLE): ISC_STATUS;
begin
Result := Fisc_commit_retaining(status_vector, tran_handle);
end;
function TFBServerLibrary.isc_commit_transaction(status_vector: PISC_STATUS;
tran_handle: PISC_TR_HANDLE): ISC_STATUS;
begin
Result := Fisc_commit_transaction(status_vector, tran_handle);
end;
function TFBServerLibrary.isc_create_blob2(status_vector: PISC_STATUS;
db_handle: PISC_DB_HANDLE; tran_handle: PISC_TR_HANDLE;
blob_handle: PISC_BLOB_HANDLE; blob_id: PISC_QUAD; bpb_length: Short;
bpb_address: PByte): ISC_STATUS;
begin
Result := Fisc_create_blob2(status_vector, db_handle, tran_handle,
blob_handle, blob_id, bpb_length, bpb_address);
end;
function TFBServerLibrary.isc_database_info(status_vector: PISC_STATUS;
db_handle: PISC_DB_HANDLE; item_list_buffer_length: Short;
item_list_buffer: PByte; result_buffer_length: Short;
result_buffer: PAnsiChar): ISC_STATUS;
begin
Result := Fisc_database_info(status_vector, db_handle, item_list_buffer_length,
item_list_buffer, result_buffer_length, result_buffer);
end;
procedure TFBServerLibrary.isc_decode_date(ib_date: PISC_QUAD;
tm_date: PCTimeStructure);
begin
Fisc_decode_date(ib_date, tm_date);
end;
procedure TFBServerLibrary.isc_decode_sql_date(ib_date: PISC_DATE;
tm_date: PCTimeStructure);
begin
Fisc_decode_sql_date(ib_date, tm_date);
end;
procedure TFBServerLibrary.isc_decode_sql_time(ib_time: PISC_TIME;
tm_date: PCTimeStructure);
begin
Fisc_decode_sql_time(ib_time, tm_date);
end;
procedure TFBServerLibrary.isc_decode_timestamp(
ib_timestamp: PISC_TIMESTAMP; tm_date: PCTimeStructure);
begin
Fisc_decode_timestamp(ib_timestamp, tm_date);
end;
function TFBServerLibrary.isc_delete_user(status_vector: PISC_STATUS;
user_sec_data: PUserSecData): ISC_STATUS;
begin
Result := Fisc_delete_user(status_vector, user_sec_data);
end;
function TFBServerLibrary.isc_detach_database(status_vector: PISC_STATUS;
db_handle: PISC_DB_HANDLE): ISC_STATUS;
begin
Result := Fisc_detach_database(status_vector, db_handle);
end;
function TFBServerLibrary.isc_drop_database(status_vector: PISC_STATUS;
db_handle: PISC_DB_HANDLE): ISC_STATUS;
begin
Result := Fisc_drop_database(status_vector, db_handle);
end;
function TFBServerLibrary.isc_dsql_alloc_statement2(
status_vector: PISC_STATUS; db_handle: PISC_DB_HANDLE;
stmt_handle: PISC_STMT_HANDLE): ISC_STATUS;
begin
Result := Fisc_dsql_alloc_statement2( status_vector, db_handle, stmt_handle);
end;
function TFBServerLibrary.isc_dsql_batch_execute(status_vector: PISC_STATUS;
tran_handle: PISC_TR_HANDLE; stmt_handle: PISC_STMT_HANDLE; Dialect: UShort;
insqlda: PXSQLDA; no_of_rows: UShort; batch_vars: PXSQLVAR;
rows_affected: PULong): ISC_STATUS;
begin
Result := Fisc_dsql_batch_execute(status_vector, tran_handle, stmt_handle, Dialect,
insqlda, no_of_rows, batch_vars, rows_affected);
end;
function TFBServerLibrary.isc_dsql_batch_execute_immed(status_vector : PISC_STATUS;
db_handle : PISC_DB_HANDLE; tran_handle : PISC_TR_HANDLE;
Dialect : UShort; no_of_sql : ULong; statement : PPByte;
rows_affected : PULong): ISC_STATUS;
begin
Result := Fisc_dsql_batch_execute_immed(status_vector, db_handle,
tran_handle, Dialect, no_of_sql, statement, rows_affected);
end;
function TFBServerLibrary.isc_dsql_describe(status_vector: PISC_STATUS;
stmt_handle: PISC_STMT_HANDLE; dialect: UShort;
xsqlda: PXSQLDA): ISC_STATUS;
begin
Result := Fisc_dsql_describe(status_vector, stmt_handle, dialect, xsqlda);
end;
function TFBServerLibrary.isc_dsql_describe_bind(status_vector: PISC_STATUS;
stmt_handle: PISC_STMT_HANDLE; dialect: UShort;
xsqlda: PXSQLDA): ISC_STATUS;
begin
Result := Fisc_dsql_describe_bind(status_vector, stmt_handle, dialect,
xsqlda);
end;
function TFBServerLibrary.isc_dsql_execute(status_vector: PISC_STATUS;
tran_handle: PISC_TR_HANDLE; stmt_handle: PISC_STMT_HANDLE;
dialect: UShort; xsqlda: PXSQLDA): ISC_STATUS;
begin
Result := Fisc_dsql_execute(status_vector, tran_handle, stmt_handle,
dialect, xsqlda);
end;
function TFBServerLibrary.isc_dsql_execute_immediate(
status_vector: PISC_STATUS; db_handle: PISC_DB_HANDLE;
tran_handle: PISC_TR_HANDLE; length: UShort; statement: PAnsiChar;
dialect: UShort; xsqlda: PXSQLDA): ISC_STATUS;
begin
Result := Fisc_dsql_execute_immediate(status_vector, db_handle,
tran_handle, length, statement, dialect, xsqlda);
end;
function TFBServerLibrary.isc_dsql_execute2(status_vector: PISC_STATUS;
tran_handle: PISC_TR_HANDLE; stmt_handle: PISC_STMT_HANDLE;
dialect: UShort; in_xsqlda, out_xsqlda: PXSQLDA): ISC_STATUS;
begin
Result := Fisc_dsql_execute2(status_vector, tran_handle, stmt_handle,
dialect, in_xsqlda, out_xsqlda);
end;
function TFBServerLibrary.isc_dsql_fetch(status_vector: PISC_STATUS;
stmt_handle: PISC_STMT_HANDLE; dialect: UShort;
xsqlda: PXSQLDA): ISC_STATUS;
begin
Result := Fisc_dsql_fetch(status_vector, stmt_handle, dialect, xsqlda);
end;
function TFBServerLibrary.isc_dsql_free_statement(
status_vector: PISC_STATUS; stmt_handle: PISC_STMT_HANDLE;
options: UShort): ISC_STATUS;
begin
Result := Fisc_dsql_free_statement(status_vector, stmt_handle, options);
end;
function TFBServerLibrary.isc_dsql_prepare(status_vector: PISC_STATUS;
tran_handle: PISC_TR_HANDLE; stmt_handle: PISC_STMT_HANDLE;
length: UShort; statement: PByte; dialect: UShort;
xsqlda: PXSQLDA): ISC_STATUS;
begin
Result := Fisc_dsql_prepare(status_vector, tran_handle, stmt_handle,
length, statement, dialect, xsqlda);
end;
function TFBServerLibrary.isc_dsql_set_cursor_name(
status_vector: PISC_STATUS; stmt_handle: PISC_STMT_HANDLE;
cursor_name: PByte; _type: UShort): ISC_STATUS;
begin
Result := Fisc_dsql_set_cursor_name(status_vector, stmt_handle, cursor_name,
_type);
end;
function TFBServerLibrary.isc_dsql_sql_info(status_vector: PISC_STATUS;
stmt_handle: PISC_STMT_HANDLE; item_length: Short; items: PByte;
buffer_length: Short; buffer: PByte): ISC_STATUS;
begin
Result := Fisc_dsql_sql_info(status_vector, stmt_handle, item_length, items,
buffer_length, buffer);
end;
procedure TFBServerLibrary.isc_encode_date(tm_date: PCTimeStructure;
ib_date: PISC_QUAD);
begin
Fisc_encode_date(tm_date, ib_date);
end;
procedure TFBServerLibrary.isc_encode_sql_date(tm_date: PCTimeStructure;
ib_date: PISC_DATE);
begin
Fisc_encode_sql_date(tm_date, ib_date);
end;
procedure TFBServerLibrary.isc_encode_sql_time(tm_date: PCTimeStructure;
ib_time: PISC_TIME);
begin
Fisc_encode_sql_time(tm_date, ib_time);
end;
procedure TFBServerLibrary.isc_encode_timestamp(tm_date: PCTimeStructure;
ib_timestamp: PISC_TIMESTAMP);
begin
Fisc_encode_timestamp(tm_date, ib_timestamp);
end;
type
Tsib_event_block = function (EventBuffer : PPAnsiChar; ResultBuffer: PPAnsiChar; IDCount: UShort;
Event1, Event2, Event3, Event4, Event5, Event6, Event7, Event8, Event9,
Event10, Event11, Event12, Event13, Event14, Event15: PAnsiChar): ISC_LONG; cdecl;
function TFBServerLibrary.isc_event_block(event_buffer : PPAnsiChar; result_buffer : PPAnsiChar;
id_count : UShort; event_list : array of PAnsiChar): ISC_LONG;
begin
Result := Tsib_event_block(Fisc_event_block)(event_buffer, result_buffer,
id_count, event_list[0], event_list[1], event_list[2], event_list[3],
event_list[4], event_list[5], event_list[6], event_list[7], event_list[8],
event_list[9], event_list[10], event_list[11], event_list[12],
event_list[13], event_list[14]);
end;
procedure TFBServerLibrary.isc_event_counts(status_vector: PISC_STATUS;
buffer_length: Short; event_buffer : PAnsiChar; result_buffer: PAnsiChar);
begin
Fisc_event_counts(status_vector, buffer_length, event_buffer, result_buffer);
end;
function TFBServerLibrary.isc_free(isc_arg1: PAnsiChar): ISC_LONG;
begin
Result := Fisc_free(isc_arg1);
end;
function TFBServerLibrary.isc_get_client_major_version: Integer;
begin
Result := Fisc_get_client_major_version
end;
function TFBServerLibrary.isc_get_client_minor_version: Integer;
begin
Result := Fisc_get_client_minor_version
end;
procedure TFBServerLibrary.isc_get_client_version(buffer: PByte);
begin
Fisc_get_client_version(buffer);
end;
function TFBServerLibrary.isc_get_segment(status_vector: PISC_STATUS;
blob_handle: PISC_BLOB_HANDLE; actual_seg_length: PUShort;
seg_buffer_length: UShort; seg_buffer: PByte): ISC_STATUS;
begin
Result := Fisc_get_segment(status_vector, blob_handle, actual_seg_length,
seg_buffer_length, seg_buffer);
end;
function TFBServerLibrary.isc_interprete(buffer: PByte;
status_vector: PPISC_STATUS): ISC_STATUS;
begin
Result := Fisc_interprete(buffer, status_vector);
end;
function TFBServerLibrary.isc_modify_user(status_vector: PISC_STATUS;
user_sec_data: PUserSecData): ISC_STATUS;
begin
Result := Fisc_modify_user(status_vector, user_sec_data);
end;
function TFBServerLibrary.isc_open_blob2(status_vector: PISC_STATUS;
db_handle: PISC_DB_HANDLE; tran_handle: PISC_TR_HANDLE;
blob_handle: PISC_BLOB_HANDLE; blob_id: PISC_QUAD; bpb_length: Short;
bpb_buffer: PByte): ISC_STATUS;
begin
Result := Fisc_open_blob2(status_vector, db_handle, tran_handle,
blob_handle, blob_id, bpb_length, bpb_buffer);
end;
function TFBServerLibrary.isc_prepare_transaction(
status_vector: PISC_STATUS; tran_handle: PISC_TR_HANDLE): ISC_STATUS;
begin
Result := Fisc_prepare_transaction(status_vector, tran_handle);
end;
function TFBServerLibrary.isc_prepare_transaction2(
status_vector: PISC_STATUS; tran_handle: PISC_TR_HANDLE;
msg_length: Short; msg: PByte): ISC_STATUS;
begin
Result := Fisc_prepare_transaction2(status_vector, tran_handle, msg_length, msg);
end;
function TFBServerLibrary.isc_put_segment(status_vector: PISC_STATUS;
blob_handle: PISC_BLOB_HANDLE; seg_buffer_len: UShort;
seg_buffer: PByte): ISC_STATUS;
begin
Result := Fisc_put_segment(status_vector, blob_handle, seg_buffer_len, seg_buffer);
end;
function TFBServerLibrary.isc_que_events(status_vector: PISC_STATUS;
db_handle: PISC_DB_HANDLE; event_id: PISC_LONG; length: Short;
event_buffer: PAnsiChar; event_function: TISC_CALLBACK;
event_function_arg: PVoid): ISC_STATUS;
begin
Result := Fisc_que_events(status_vector, db_handle, event_id, length,
event_buffer, event_function, event_function_arg);
end;
function TFBServerLibrary.isc_release_savepoint(status_vector: PISC_STATUS;
tran_handle: PISC_TR_HANDLE; tran_name: PAnsiChar): ISC_STATUS;
begin
Result := Fisc_release_savepoint(status_vector, tran_handle, tran_name);
end;
function TFBServerLibrary.isc_rollback_retaining(status_vector: PISC_STATUS;
tran_handle: PISC_TR_HANDLE): ISC_STATUS;
begin
Result := Fisc_rollback_retaining(status_vector, tran_handle);
end;
function TFBServerLibrary.isc_rollback_savepoint(status_vector : PISC_STATUS;
tran_handle : PISC_TR_HANDLE; tran_name : PAnsiChar;
Option : UShort): ISC_STATUS;
begin
Result := Fisc_rollback_savepoint(status_vector, tran_handle, tran_name,
Option);
end;
function TFBServerLibrary.isc_rollback_transaction(
status_vector: PISC_STATUS; tran_handle: PISC_TR_HANDLE): ISC_STATUS;
begin
Result := Fisc_rollback_transaction(status_vector, tran_handle);
end;
function TFBServerLibrary.isc_service_attach(status_vector: PISC_STATUS;
isc_arg2: UShort; isc_arg3: PByte; service_handle: PISC_SVC_HANDLE;
isc_arg5: UShort; isc_arg6: PByte): ISC_STATUS;
begin
Result := Fisc_service_attach(status_vector, isc_arg2, isc_arg3,
service_handle, isc_arg5, isc_arg6);
end;
function TFBServerLibrary.isc_service_detach(status_vector: PISC_STATUS;
service_handle: PISC_SVC_HANDLE): ISC_STATUS;
begin
Result := Fisc_service_detach(status_vector, service_handle);
end;
function TFBServerLibrary.isc_service_query(status_vector: PISC_STATUS;
service_handle, recv_handle: PISC_SVC_HANDLE; isc_arg4: UShort;
isc_arg5: PByte; isc_arg6: UShort; isc_arg7: PByte; isc_arg8: UShort;
isc_arg9: PByte): ISC_STATUS;
begin
Result := Fisc_service_query(status_vector, service_handle, recv_handle,
isc_arg4, isc_arg5, isc_arg6, isc_arg7, isc_arg8, isc_arg9);
end;
function TFBServerLibrary.isc_service_start(status_vector: PISC_STATUS;
service_handle, recv_handle: PISC_SVC_HANDLE; isc_arg4: UShort;
isc_arg5: PByte): ISC_STATUS;
begin
Result := Fisc_service_start(status_vector, service_handle, recv_handle,
isc_arg4, isc_arg5);
end;
procedure TFBServerLibrary.isc_sql_interprete(sqlcode: Short; buffer: PByte;
buffer_length: Short);
begin
Fisc_sql_interprete(sqlcode, buffer, buffer_length);
end;
function TFBServerLibrary.isc_sqlcode(status_vector: PISC_STATUS): ISC_LONG;
begin
Result := Fisc_sqlcode(status_vector);
end;
function TFBServerLibrary.isc_start_multiple(status_vector: PISC_STATUS;
tran_handle: PISC_TR_HANDLE; db_handle_count: Short;
teb_vector_address: PISC_TEB): ISC_STATUS;
begin
Result := Fisc_start_multiple(status_vector, tran_handle, db_handle_count,
teb_vector_address);
end;
function TFBServerLibrary.isc_start_savepoint(status_vector: PISC_STATUS;
tran_handle: PISC_TR_HANDLE; tran_name: PAnsiChar): ISC_STATUS;
begin
Result := Fisc_start_savepoint(status_vector, tran_handle, tran_name);
end;
function TFBServerLibrary.isc_vax_integer(buffer: PByte;
length: Short): ISC_LONG;
begin
Result := Fisc_vax_integer(buffer, length);
end;
function TFBServerLibrary.BLOB_get(isc_arg1: PBSTREAM): Int;
begin
Result := FBLOB_get(isc_arg1);
end;
function TFBServerLibrary.isc_transaction_info(status_vector: PISC_STATUS;
tran_handle: PISC_TR_HANDLE; item_list_buffer_length: Short;
item_list_buffer: PByte; result_buffer_length: Short;
result_buffer: PByte): ISC_STATUS;
begin
Result := Fisc_transaction_info(status_vector, tran_handle,
item_list_buffer_length, item_list_buffer,
result_buffer_length, result_buffer);
end;
{ TFBEmbeddedLibrary }
function TFBEmbeddedLibrary.LibraryName: string;
begin
Result := 'fbembed.dll';
end;
{ TGDSCustomLibrary }
procedure TGDSCustomLibrary.SetLibraryName(const AName: string);
begin
if FLibraryName <> AName then begin
FreeIBLibrary;
FLibraryName := AName;
end;
end;
function TGDSCustomLibrary.LibraryName: string;
begin
Result := FLibraryName;
end;
procedure AddLib;
var
LLib: IGDSLibrary;
begin
LLib := TFBServerLibrary.Create;
AddIBInterface(CFBServerType, LLib);
LLib := TFBEmbeddedLibrary.Create;
AddIBInterface(CFBEmpeddedServerType, LLib);
end;
initialization
AddLib;
finalization
IBClientInterface.Remove(CFBServerType);
IBClientInterface.Remove(CFBEmpeddedServerType);
end.
плюшка, для добавления модуля в дизайнтайме 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86.
unit UrsFBServerReg;
interface
procedure Register;
implementation
uses
DesignIntf, DesignEditors,
System.Classes,
Vcl.Dialogs,
IBDatabase, IB,
UrsFBIntf, UrsGDSLibrary;
type
TIBDatabaseSelectionEditor = class(TSelectionEditor)
public
procedure RequiresUnits(AProc: TGetStrProc); override;
end;
TDllNameProperty = class(TStringProperty)
public
function GetAttributes: TPropertyAttributes; override;
procedure Edit; override;
end;
{ TIBDatabaseSelectionEditor }
procedure TIBDatabaseSelectionEditor.RequiresUnits(AProc: TGetStrProc);
var
Li: Integer;
LDB: TIBDatabase;
begin
for Li := 0 to Designer.Root.ComponentCount - 1 do begin
if Designer.Root.Components[Li] is TIBDatabase then begin
LDB := TIBDatabase(Designer.Root.Components[Li]);
if (LDB.ServerType = CFBServerType) or (LDB.ServerType = CFBEmpeddedServerType) then begin
AProc('UrsFBIntf');
Exit;
end;
end;
end;
end;
{ TDllNameProperty }
function TDllNameProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paDialog];
end;
procedure TDllNameProperty.Edit;
const
{$IFDEF MSWINDOWS}
CDllExt = 'dll';
{$ELSE}
CDllExt = 'so;
{$ENDIF}
CDllMask = '*.' + CDllExt;
CFilter = 'Library files (' + CDllMask + ')|' + CDllMask + '|All Files (*.*)|*.*';
var
LDlg: TOpenDialog;
begin
LDlg := TOpenDialog.Create(nil);
try
LDlg.Title := GetName;
LDlg.Filename := GetValue;
LDlg.Filter := CFilter;
LDlg.DefaultExt := CDllExt;
LDlg.Options := LDlg.Options + [ofPathMustExist, ofFileMustExist];
if LDlg.Execute then
SetValue(LDlg.Filename);
finally
LDlg.Free;
end
end;
procedure Register;
begin
RegisterComponents(IBPalette1, [TGDSLibrary]);
RegisterSelectionEditor(TIBDatabase, TIBDatabaseSelectionEditor);
RegisterPropertyEditor(TypeInfo(TDllName), TGDSLibrary, 'LibraryName', TDllNameProperty)
end;
end.
Использование: перед коннектом установить
1.
IBDatabase1.ServerType := '......';
Если хочется полной динамики, то вызвать так
1. 2. 3. 4. 5. 6. 7. 8. 9. 10.
uses IBIntf, UrsFBIntf;
var
Lib: IGDSCustomLibrary;
begin
Lib := CreateCustomGDSLibrary;
Lib.SetLibraryName('C:\MyProgram\MyLib.dll');
AddIBInterface('CustomLib', Lib);
IBDatabase1.ServerType := 'CustomLib';
end;
|