here is a sample code that work normal on windows but on ubuntu its inserts question marks
Code: Select all
procedure TConnection.Registerdatadb(const usernamereg: String; const passwordreg: string);
var
dbconnect: TMyConnection;
begin
  TThread.Synchronize(nil,
    procedure
    var
      List: TList; // or TIdContextList if using a modern Indy version
      I: integer;
      Connection: TConnection;
    begin
      try
  dbconnect := TMyConnection.Create(nil);
  dbconnect.Pooling := true;
  dbconnect.PoolingOptions.Validate := true;
  dbconnect.Server := DATABASESERVERLOGIN;
  dbconnect.username := Databaseuserlogin;
  dbconnect.Password := Databasepassword;
  dbconnect.ConnectionTimeout := 0;
  connectionmo.userslq.Connection := dbconnect;
  dbconnect.Database := Dbname;
  dbconnect.Connect;
        if usernamereg <> '' then
        begin
          connectionmo.userslq.Close;
          connectionmo.userslq.SQL.Clear;
          connectionmo.userslq.SQL.Add
            ('SELECT * FROM `users` WHERE `username` = "' +
            trim(usernamereg) + '"');
          connectionmo.userslq.Open;
          if not connectionmo.userslq.IsEmpty then
          begin
            Exit;
          end
          else
          begin
            connectionmo.userslq.Close;
            connectionmo.userslq.SQL.Clear;
            connectionmo.userslq.SQL.Add
              ('INSERT INTO `users` (`username`, `password`) VALUES (:uname, :pass);');
            connectionmo.userslq.ParamByName('uname').AsString := trim(usernamereg);
            connectionmo.userslq.ParamByName('pass').AsString := trim(passwordreg);
            connectionmo.userslq.ExecSQL;
            connectionmo.userslq.Close;
          end;
        end;
      finally
        dbconnect.Disconnect;
        dbconnect.Free;
      end;
    end);
end;mydac version 8.4.11