MyFirstUDRKit/sql/MyFirstUDRKitPackage.sql

65 lines
1.1 KiB
MySQL
Raw Normal View History

2023-01-23 15:31:22 +01:00
/*
* This demonstrates how to declare the IDRs as part of a package
*/
2023-01-23 13:42:02 +01:00
set term ^;
2023-01-25 15:58:51 +01:00
create or alter package MyFirstUDRKit
2023-01-23 13:42:02 +01:00
-- optional - declare sql security as DEFINER to give access rights of owner to all users
-- sql security definer
as
begin
function div (
anumerator bigint, adenominator bigint
2023-01-23 13:42:02 +01:00
)
returns bigint;
2023-01-23 13:42:02 +01:00
function flagged (
flags integer, flag integer
)
returns integer;
2023-01-25 15:58:51 +01:00
-- function LoadBlobFromFile (
-- afilename varchar(8191),
-- ablob BLOB
-- )
-- returns bigint;
2023-01-23 13:42:02 +01:00
end ^
2023-01-25 15:58:51 +01:00
recreate package body MyFirstUDRKit
2023-01-23 13:42:02 +01:00
as
begin
function div (
anumerator bigint, adenominator bigint
)
returns bigint
2023-01-25 15:58:51 +01:00
external name 'MyFirstUDRKit!MFK_div!Divide anumerator by adenominator' engine udr;
2023-01-23 13:42:02 +01:00
function flagged (
flags integer, flag integer
2023-01-25 09:53:53 +01:00
)
returns integer
2023-01-25 15:58:51 +01:00
external name 'MyFirstUDRKit!MFK_flagged!How is this function used?' engine udr;
2023-01-25 09:53:53 +01:00
2023-01-25 15:58:51 +01:00
-- function LoadBlobFromFile (
-- afilename varchar(8191),
-- ablob BLOB
-- )
-- returns bigint
-- external name 'MyFirstUDRKit!MFK_Load_Blob_From_File!Load file and save to Blob' engine udr;
2023-01-25 09:53:53 +01:00
2023-01-23 13:42:02 +01:00
end ^
set term ;^
2023-01-23 15:43:39 +01:00
2023-01-25 15:58:51 +01:00
grant execute on package MyFirstUDRKit to public;