Permalink
Browse files

Cast result from LOAD_FILE() command as utf8 string, to fix encoding …

…errors in view editor. Closes #61.
  • Loading branch information...
ansgarbecker committed Dec 30, 2017
1 parent ac1a3cb commit d057f27a4f9dd059cd8d13c508139e4949d1c332
Showing with 5 additions and 1 deletion.
  1. +5 −1 source/dbconnection.pas
View
@@ -2691,7 +2691,11 @@ function TMySQLConnection.GetCreateViewCode(Database, Name: String): String;
end;
try
// Try to fetch original VIEW code from .frm file
AlternativeSelectCode := GetVar('SELECT LOAD_FILE(CONCAT(IFNULL(@@GLOBAL.datadir, CONCAT(@@GLOBAL.basedir, '+EscapeString('data/')+')), '+EscapeString(Database+'/'+Name+'.frm')+'))');
AlternativeSelectCode := GetVar('SELECT CAST(LOAD_FILE('+
'CONCAT('+
'IFNULL(@@GLOBAL.datadir, CONCAT(@@GLOBAL.basedir, '+EscapeString('data/')+')), '+
EscapeString(Database+'/'+Name+'.frm')+')'+
') AS CHAR CHARACTER SET utf8)');
rx := TRegExpr.Create;
rx.ModifierI := True;
rx.ModifierG := False;

0 comments on commit d057f27

Please sign in to comment.