This commit is contained in:
Paul Reeves 2023-01-20 21:53:23 +01:00
parent 25db2003ae
commit c6a8712150

View File

@ -106,6 +106,61 @@ FB_UDR_BEGIN_FUNCTION(MFK_flagged)
FB_UDR_END_FUNCTION
/*** DDL
create function Blob_Save (
afilename varchar(8191),
ablobcallback BLOB
) returns bigint
external name 'my_first_udr_kit!MFK_Blob_Save'
engine udr;
***/
FB_UDR_BEGIN_FUNCTION(MFK_Blob_Save)
FB_UDR_MESSAGE(InMessage,
(FB_VARCHAR, afilename)
(FB_BLOB, ablobcallback)
);
FB_UDR_MESSAGE(OutMessage,
(FB_BIGINT, result)
);
FB_UDR_EXECUTE_FUNCTION
{
// // Test Input
// if (!s || !b || !b->blob_handle) {
// return NULL;
// }
// // open for write & as a binary...
// FILE* file_ = fopen(s, "wb");
// if (file_ == NULL) {
// ISC_INT64* res = MALLOC(sizeof(ISC_INT64));
// *res = -2;
// return res;
// }
// // allocate buffer size to equal with max segment size
// ISC_UCHAR* buffer = malloc(b->blob_max_segment);
// if (!buffer) {
// ISC_INT64* res = MALLOC(sizeof(ISC_INT64));
// *res = -1;
// return res;
// }
// /* see BLOBCALLBACK in ibase.h */
// ISC_INT64* res = MALLOC(sizeof(ISC_INT64));
// *res = 0;
// ISC_USHORT len;
// while (b->blob_get_segment(b->blob_handle, buffer, b->blob_max_segment, &len)) {
// *res += fwrite(buffer, 1, len, file_); // write buffer into given file.. (size as per 1 Byte for an element)
// }
// free(buffer);
// fclose(file_);
// return res;
}
FB_UDR_END_FUNCTION
/*** DDL
create function BillDate (
@ -115,18 +170,18 @@ FB_UDR_END_FUNCTION
external name 'my_first_udr_kit!MFK_BillDate'
engine udr;
***/
FB_UDR_BEGIN_FUNCTION(MFK_BillDate)
FB_UDR_MESSAGE(InMessage,
(FB_INTEGER, d)
(FB_INTEGER, date)
);
FB_UDR_MESSAGE(OutMessage,
(FB_DATE, result)
);
FB_UDR_END_FUNCTION
// FB_UDR_BEGIN_FUNCTION(MFK_BillDate)
//
// FB_UDR_MESSAGE(InMessage,
// (FB_INTEGER, d)
// (FB_INTEGER, date)
// );
// FB_UDR_MESSAGE(OutMessage,
// (FB_DATE, result)
// );
//
//
// FB_UDR_END_FUNCTION