Delphi source for Error procedure.
Copy to MySQL bin folder. Then execute command:
create function Error returns integer soname 'LibError.dll';
//LibError.dpr:
library LibError;
uses
SysUtils;
//mysql.h definitions - begin
const
STRING_RESULT = 0;
REAL_RESULT = 1;
INT_RESULT = 2;
ROW_RESULT = 3;
DECIMAL_RESULT= 4;
type
my_bool = byte;
uint = LongWord;
ulong = int64;
ppChar = ^pChar;
puint = ^uint;
pUlong = ^ulong;
ItemResult = STRING_RESULT..DECIMAL_RESULT;
pItemResult = ^ItemResult;
pByte = ^byte;
pDouble = ^Double;
ItemResultArr = array [1..1000] of integer;
CharArr = array [1..1000] of pChar;
uintArr = array [1..1000] of uint;
ByteArr = array [1..1000] of byte;
Int64Arr = array [1..1000] of int64;
pItemResultArr = ^ItemResultArr;
pCharArr = ^CharArr;
puintArr = ^uintArr;
pByteArr = ^ByteArr;
pInt64Arr= ^Int64Arr;
pUDF_ARGS = ^UDF_ARGS;
UDF_ARGS = packed record
arg_count:uint;
arg_type:pItemResultArr;
args:pCharArr;
lengths:puintArr;
maybe_null:pByteArr;
attributes:pCharArr;
attribute_lengths:puintArr;
end;
pUDF_INIT = ^UDF_INIT;
UDF_INIT = packed record
maybe_null: my_bool;
decimals : uint;
max_length: uint;
ptr : pChar;
const_item: my_bool;
end;
//mysql.h definitions - end
//Main function definition start
function Error_init(initid: pUDF_INIT; _args: pUDF_ARGS; _message: PChar): ulong; cdecl;
begin
Result := 1;
if _args^.arg_count = 1 then
if _args^.arg_type^[1] = STRING_RESULT then
StrCopy(_message, _args^.args^[1]);
end;
procedure Error_deinit(initid: pUDF_INIT); cdecl;
begin
end;
function Error(initid: pUDF_INIT; _args: pUDF_ARGS; is_null, error: PChar): ulong; cdecl;
begin
end;
//end of main function definition
exports
Error_init,
Error_deinit,
Error;
begin
end.
You can also check for some info at
http://gurudelphi.googlepages.com
Edited 1 time(s). Last edit at 03/10/2008 03:14AM by Zigmund Bulinsh.