Skip to content

Commit d7b1faa

Browse files
committed
fix: support return data type of stored function containing white spaces
work around non-greedy expression when extracting the return data type of a stored function with a space in it. Todo: a better solution would be to create a tokenizer and iterate through the tokens, instead of parsing per regular expression Refs #768
1 parent 18a21ef commit d7b1faa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

source/dbconnection.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7933,7 +7933,7 @@ procedure TDBConnection.ParseRoutineStructure(Obj: TDBObject; Parameters: TRouti
79337933
// | SQL SECURITY { DEFINER | INVOKER }
79347934
// | COMMENT 'string'
79357935
rx.Expression := '^\s*('+
7936-
'RETURNS\s+(\S+(\s+UNSIGNED)?(\s+CHARSET\s+\S+)?(\s+COLLATE\s\S+)?)|'+
7936+
'RETURNS\s+((\S+\([^\)]+\)|\S+)(\s+UNSIGNED)?(\s+CHARSET\s+\S+)?(\s+COLLATE\s\S+)?)|'+
79377937
// MySQL function characteristics - see http://dev.mysql.com/doc/refman/5.1/de/create-procedure.html
79387938
'LANGUAGE\s+SQL|'+
79397939
'(NOT\s+)?DETERMINISTIC|'+
@@ -7961,7 +7961,7 @@ procedure TDBConnection.ParseRoutineStructure(Obj: TDBObject; Parameters: TRouti
79617961
else if (Pos('CONTAINS SQL', Match) = 1) or (Pos('NO SQL', Match) = 1) or (Pos('READS SQL DATA', Match) = 1) or (Pos('MODIFIES SQL DATA', Match) = 1) then
79627962
Obj.DataAccess := rx.Match[1]
79637963
else if Pos('SQL SECURITY', Match) = 1 then
7964-
Obj.Security := rx.Match[7];
7964+
Obj.Security := rx.Match[8];
79657965

79667966

79677967
Delete(Body, 1, rx.MatchLen[0]);

0 commit comments

Comments
 (0)