1 (edited by CDB 2021-01-17 01:37:48)

Topic: Inserting file paths into a mySQL table

I'm playing around converting my SQLite database into a mySQL one.

I've hit a problem where in SQLite I store the file path to some text documents in a field, to be recovered later in a tablegrid and then can be double clicked to pen the document. This works.


However, mySql strips the back slashes from the text (probably because \ is a reserved character in mySql).

I assume I'm going to have to use  ReplaceStr(filePath, \, smile along with code   along the lines of


var

fPath : string;
delimPath : string
begin
     fPath:=ExtractFilePath(ArrayOfFiles[0]);
     fPath:= fPath + ExtractFileName(ArrayOfFiles[0]);
     
     frmAddDatasheet.DBFile1.dbFileName := ReplaceStr(fPath, '\',':');
end;

My main question is, will using Save Record set to DBFile1  contain the altered path, and when loading the tablegrid  how do I intercept the value in the field - would I use a calculated field and use the REPLACE statement or somehow perhaps combine ReplaceString with a dbSQL statement?


Has anyone needed to do this with a mySQL/Maria database already?

I should mention, I've tried using a stored procedure in the DB, but I'm not sure how to call it from within MVD and while it works in mySQL Workbench to store the the file path, I'm unsure how to persuade MySQl to perform the opposite function.

On a clear disk you can seek forever