Jump to content

Lars Fosdal

Administrators
  • Content Count

    3323
  • Joined

  • Last visited

  • Days Won

    110

Posts posted by Lars Fosdal


  1. 2 minutes ago, Attila Kovacs said:

    WITH (NOLOCK) ?

    Well, I've added that where it seems safe for the viewers, but it is a short way between being a viewer and being a requestor, so for certain lookups, the data needs to be accurate.

    The entire allocation part is a very heavy SQL statement with joins, functions, conditions and sorting - and the actual grabbing is totally void of transactions.

     


  2. The joys of inherited problems.


    I am looking for a pattern or advice on how to best allocate a set of records to a specific requestor when there are multiple parallel requests, and there are multiple parallel request viewers.

    In practice: Allocate a set of deliveries to a user, when there can be multiple users requesting deliveries in parallel, and multiple users viewing the deliveries in parallel.

     

    The current SQL can give deadlocks both on allocations and on viewing, so something is definitively not right, and I need to improve on it.

     

     

     

    There is SO, where it all is an exercise in asking the question right...

    Are there other good discussion sites?


  3. 1 hour ago, Khorkhe said:

    in 10.3.1, the compiler is ignoring changes I make to a regular unit (.pas) of a VCLexe.

     

    Every time this happens to me, there are duplicate source files on different paths.

    I believe I am editing ./myproject/thisversion/myfile.pas, while I actually am in ./myproject/thatversion/myfile .pas
    Sometimes this happens because I used find in files on the wrong path, or a file was included in the project from the wrong path.


  4. 16 hours ago, Primož Gabrijelčič said:

     

    Aaaaah, single READER! Sorry, folks. That is such a weird concept (although, I admit, useful in some situations) that my brain autocorrected it into single WRITER. 🙂 🙂 Silly brain!

    I use MWSR queues for stuff like logging. Multiple threads queue things for logging, and a single log thread does the actual work.

    Basically, it is a useable model for any kind of data that in the end needs to be serialized to storage.


  5. On 3/4/2019 at 10:58 AM, Der schöne Günther said:

    How many hours per week do you estimate developers at your company waste on maintenance (i.e. dealing with bad code / errors, debugging, refactoring, modifying)?

     

    It is waste if you spend time continuously fixing the same broken code, instead of buying or rebuilding something that can replace it and reduce "daily" maintenance chores?

    • Like 1

  6. EMBT placed the above constants in the implementation section of the FireDAC.Phys.MSSQL, which I guess is good for hiding implementation details, but not so good for doing overrides... hello, new literal.

     

    Initial benchmarks indicate that C_2016_ODBC = 'ODBC DRIVER 13 FOR SQL SERVER' is about the same speed as SQLNCLI 11, which is good news.

     

    class function TPSDFireDatabasePoolMSSQL.FindBestDriver(const Link: TFDPhysMSSQLDriverLink): String;
    const // Constants copied from implementation section of FireDAC.Phys.MSSQL
      C_2017_ODBC = 'ODBC DRIVER 17 FOR SQL SERVER';
      C_2016_ODBC = 'ODBC DRIVER 13 FOR SQL SERVER';
      C_2012_ODBC = 'ODBC DRIVER 11 FOR SQL SERVER';
    {$IFDEF POSIX}
      C_FreeTDS = 'FreeTDS';
    {$ENDIF}
    {$IFDEF MSWINDOWS}
      C_2012_NC = 'SQL SERVER NATIVE CLIENT 11.0';
    {$ENDIF}
    var
      DriverList TStringList;
      WantedList : TArray<String>;
    begin
      Result := '';
      WantedList := {$IFDEF MSWINDOWS} [C_2017_ODBC, C_2016_ODBC, C_2012_NC, C_2012_ODBC] {$ENDIF}
                   {$IFDEF POSIX} [C_2017_ODBC, C_2016_ODBC, C_2012_ODBC, C_FreeTDS] {$ENDIF};
    
      DriverList := TStringList.Create;
      try
        Link.GetDrivers(DriverList);
        for var Wanted in WantedList
         do for var Driver in DriverList
          do if CompareText(Wanted , Driver) = 0
           then Exit(Wanted);
      finally
        DriverList.Free;
      end;
    end;
    
    class function TPSDFireDatabasePoolMSSQL.CreateDriverLink(const aOwner: TComponent): TFDPhysDriverLink;
    var
      Res: TFDPhysMSSQLDriverLink;
    begin
      Res := TFDPhysMSSQLDriverLink.Create(aOwner);
      Res.ODBCDriver := FindBestDriver(Res);
      Result := Res;
    end;
    

     


  7. Oddly enough, FireDAC seems to prefer SQLNCLI over everything else, and I can't find a way to override that priority, apart from explicitly setting the ODBCDriver on Create, which makes it harder to handle it not being installed
     

    procedure TFDPhysMSSQLDriver.InternalLoad;
    begin
      inherited InternalLoad;
      if ODBCDriver = '' then
        ODBCDriver := FindBestDriver(
          {$IFDEF MSWINDOWS} [C_2012_NC, C_2016_ODBC, C_2012_ODBC, C_2017_ODBC, C_2008, C_2005, C_2000] {$ENDIF}
          {$IFDEF POSIX} [C_2016_ODBC, C_2012_ODBC, C_2017_ODBC, C_FreeTDS], C_FreeTDSLib {$ENDIF}
        );
    end;

     

×