Marshmallow EscapeChar causes SQL Script error (Tested using FireDAC)

Issue #335 closed
Eduardo P Figueiredo created an issue

when trying to get entities from database, raises a Sql script error. I Fixed it local making the follow change.



function TAnsiSQLGenerator.GetEscapeChar: Char;

(-) Result := '"';

(+) Result := '`';

Comments (10)

  1. Stefan Glienke repo owner

    I cannot simply change that without knowing what DBMS you are using this with and if that DBMS possibly has its own query language with an appropriate quote char.

    Please specify

  2. Stefan Glienke repo owner

    I was guessing MySQL - and there is a proper generator for that using the backtick quote char - you need to set the correct QueryLanguage (qlMySQL from Spring.Persistence.SQL.Interfaces.pas) to your TFireDACConnectionAdapter instance as there is no logic to automatically detect what DBMS it is connecting to (it might be possible looking at the DriverName property of the TFDConnection or something like that but that was beyond the scope of implementing the FD adapters at the time).

  3. Eduardo P Figueiredo reporter

    Stefan, thanks for help, I tryied set my FireDacAdapter.QueryLanguage to ‘qlMysql' but got an error “Item not Found”, so looking the disponible options where system was looking for, there was a “QUERY_LANGUAGE_MYSQL”, then setting it up

    mFDAdapter               := TFireDACConnectionAdapter.Create(FDbHelper.Conexao);
    mFDAdapter.QueryLanguage := 'QUERY_LANGUAGE_MYSQL';
    FSession                 := TSession.Create(mFDAdapter);

    it worked very fine!

  4. Log in to comment