CommandTimeout

My FMX multi-device application has a TSQLConnection with TSQLQueries pointing to it. I set the CommandTimeout like this:

SQLConnection1->Params->Values["CommandTimeout"] = "1800";

This works great on my Windows laptop - commands time out when they should. However this does nothing on a Mac; commands still time out in about 10-15 seconds. I've tried changing the timeout to 0 (should equate to infinite or no timeout) as well as really low or really high numbers. All of these tests work as expected on Windows, but my Mac's commands all time out the same regardless.

Is there something different I have to set for Mac or is this a known bug in C++ Builder?

  • Here's the best solution for a multi-device application:

    #if defined(TARGET_OS_MAC)
    			SQLConnection1->Params->Values["Connection Timeout"] = "1800"; //Acts the same as "CommandTimeout" on Mac
    #else
    			SQLConnection1->Params->Values["CommandTimeout"] = "1800"; //Only works on Windows
    #endif
    			SQLConnection1->Connected = true;

    'CommandTimeout' is specific to Windows and doesn't work on Mac like it should. Meanwhile 'Connection Timeout' works* on Mac as a way of setting the command timeout.

    *Note that changing 'Connection Timeout' also changes how long the application will wait for a connection to start. So you'll probably want to set this to a low number when you're first attempting to connect to a new database, and then set it higher for querying.