martinrybak / SQLClient

Native Microsoft SQL Server client for iOS
http://objcsharp.wordpress.com/2013/10/15/an-open-source-sql-server-library-for-ios/
MIT License
125 stars 51 forks source link

Update SQLClient.m #11

Closed nhgrif closed 10 years ago

nhgrif commented 10 years ago

Set query timeout

nhgrif commented 10 years ago

Without this change? Absolutely not. With this change, yes. Timing it from the time you initiate the query to the time the completion handler fires is not entirely reliable. The query timeout only cares about the time between sending the query to the server and receiving the raw query results back from the server. In almost all cases, this will be very quick. Even for very large queries, the database can return 10s or 100s of thousand of rows in well under the timeout time (though the total time in ObjC may be over the query time because of the time it takes to shove all the results into the dictionary, this part can be kind of slow). The surest way to test the query time out is to open a connection with management studio, begin a transaction on a table so the table is locked, now try executing a query on that locked table after calling dbsettime. Query should time out and executionFailure: should be called. It's working flawlessly in my OOP take on this library.

martinrybak commented 10 years ago

Thanks for all your help.