aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
Commit message (Collapse)AuthorAgeFilesLines
* Consolidate and improve ping code:rowanbeentje2010-09-251-7/+19
| | | | | | | | - Foreground and keepalive pings now use the same code, which has been tidied and improved - Global variables are no longer incorrectly shared across multiple instances - If a ping thread blocks in a state where pthread_cancel no longer functions, the connection is assumed to have failed (network issues etc) This should further improve MySQL crashes linked to pings, and will hopefully address Issue #830. Also update localizable strings
* - Clean up warnings when building with GCCrowanbeentje2010-09-181-2/+7
|
* - Implement support for MySQL over SSL for both TCP/IP and Socket ↵rowanbeentje2010-09-131-0/+7
| | | | | | | | | | connection modes. - Upgrade the MySQL binaries to version 5.1.50 (was 5.1.46) - Enable SSL support in the MySQL libraries (this leads to a large increase in library size, unfortunately) - Enable more optimisations in the MySQL libraries (especially --enable-assembler for faster in-library string processing and --with-mysqld-ldflags=-all-static) This completes support for Issue #27.
* Encoding changes and improvements, particularly to increase compatibility ↵rowanbeentje2010-08-251-18/+12
| | | | | | | | | | | with extended characters in MySQL identifiers (names of dbs/tables/cols): - Move encoding queries and control into MCPKit, with newly cleaned-up methods, and switch a number of locations to using the new code. - Use UTF8 connections for many identifier-based queries (selecting and listing databases, tables, stored procs, table information). This fixes selection and creation of table and database names containing extended characters, also fixing exceptions and errors. - Improve UTF8 over Latin1 to correctly set the client character set encoding as well, fixing custom queries and edits; remove custom code in SPTableContent achieving the same thing in a single location. - Fix database encoding detection routines - Update localisable strings
* - Clean up SPDataImport, removing unused methods and cleaning up order and ↵rowanbeentje2010-07-191-0/+2
| | | | | | | | | methods - Improve error handling when the connecting dies during import (previous the sheet would stay open) - Fix localised strings for error messages (label and text the wrong way round) - Improve comments
* - Clean up automatic reconnection coderowanbeentje2010-07-141-1/+1
| | | | | | - Allow keepalive pings to perform automatic reconnections after a few consecutive failures - Fix a number of keepalive ping bugs, including compatibility with the new threaded connection methods and reconnection timing issues causing keepalive pings to not fire correctly
* Improve handling of network drops, including a new automatic reconnection ↵rowanbeentje2010-07-131-0/+1
| | | | | | | | | | | | | attempt, as well as improved handling of networks not present. This addresses Issue #657. In MCPKit: - Disable MySQL automatic reconnection, and add our own reconnection code for greater consistency - If no network is available, delay reconnects by a short period to allow the network to come back up - Improved handling of proxy disconnects In SPSSHTunnel: - Improved handling of SSH tunnel disconnects, improving automatic reconnection via MCPKit and fixing potential memory/logic tramping. Also remove the "Retry" button from the Disconnected dialog, leaving only the choices "Reconnect" or "Disconnect".
* Improved calling of stored procedures:jakob2010-06-301-0/+1
| | | | | | | - added the CLIENT_MULTI_RESULTS flag to the connection flags - automatically discard all remaining results when unlocking the connection This is not a perfect solution, but will improve usability a lot for those who often call stored procedures. Sequel Pro still doesn't support multiple results -- it will show only the first and silently discard all the remaining ones.
* This changeset implements renaming and duplicating databases on a server. ↵drx7772010-04-281-1/+2
| | | | | | | | | | | | | | | | | | | Details as follows: * altered MCPConnection listTablesFromDB:like: to return NSArray * altered MCPConnection listFieldsFromTable:like: to use backtick quoted strings for table and fieldnames * added MCPConnection listTablesFromDB for a complete table list * added SPStringAdditions.h to various files to prevent warnings * added sheets for duplicate/rename DB in DBView.xib * added duplicate/rename menu items to MainMenu.xib * added outlets in TableDocument: databaseNewSheet databaseRenameSheet databaseCopyNameField databaseRenameNameField copyOnlyStructureButton copyDatabaseButton renameDatabaseButton * added methods in TableDocument: getConnection, copyDatabase, renameDatabase, _copyDatabase, _renameDatabase * added OCMock Framework for object mocking in tests * added group Others/DatabaseActions
* - changed the query locking mechanism for MCPConnection to be more thread ↵jakob2010-04-161-2/+5
| | | | | | | | safe. From now on, always use [self lockConnection] rather than [queryLock lock], independent of what thread you are running on - A warning is written to the console when the connection is unlocked multiple times (to identify potential race conditions) - modified MCPStreamingResult to ensure it only closes the connection once - added a check to prevent arrow key navigation past the last row
* • improved querying db structure handlingBibiko2010-04-071-0/+1
| | | | - distinguish between any update tables list invoked by SP which causes a weak and quick refresh if nothing was changed and if the user pressed Table List Refresh button explicitly which will cancel any current db querying and pending ones
* • query db structureBibiko2010-04-071-0/+6
| | | | | | - improved encoding handling while querying - if SET NAMES ... fails bail to avoid exceptions - this should fix http://log.sequelpro.com/view/101
* • querying for db structure is queued for the same connection to avoid ↵Bibiko2010-03-311-1/+8
| | | | | | | | | | | 'overlapping' access to global variables • after querying db structure write back data on main thread • completion list displays animated sync images if connection is just querying db structure data • fixed some minor issue for completion list • make sure that if last window of a connection is closed all relevant data will be removed from global variables Note: please test!
* • fixed several threading issues due to threadingBibiko2010-03-291-1/+1
| | | | | - collection classes as NSMutableSet are NOT thread safe! • further tiny speed improvements for navigator
* • fixed several issue for completion listsBibiko2010-03-291-1/+7
| | | | | | | • improved gathering and caching of structure data coming from connection windows with the same connection • made the structure querying more stable against threading issues • moved getUniqueDbIdentifierFor from MCPConnection to SPNavigatorController to be up-to-date in all connection windows • improved detection if db structure querying should be performed or not (not yet finished)
* - db structure for tables and views will now be queried by using SHOW… ↵Bibiko2010-03-281-0/+10
| | | | | | | | | | | statements - completion now works for server versions < 5 as well - proc/func info will be queried by using information_schema for mysql >= 5 - changed completion logic to handle new format - completion will get the info from SPNavigator since this controller caches all information about db structure - optimization and fine-tuning will follow very soon
* • navigatorBibiko2010-03-261-1/+1
| | | | | - fixed issue if different connection windows are connected to the same connection - prepared structure querying method to be able to add user info containing which table/db was changed if we know it to reduce the future parsing cost
* • Navigator and completion listBibiko2010-03-261-2/+6
| | | | | | - fixed issues for deletion of a db like remove all relevant items and refresh the navigator - simplified and minimized code and memory usage while querying the connection structure - whether a schema name is an unique db or table will be evaluated on run-time via allKeysofDbStructure
* • first steps to ease the structure querying for auto-completion and navigatorBibiko2010-03-261-2/+17
| | | | | | | - now it accumulates the data and caches them db by db, ie one has to select a db before using its structure for completion and navigator - next step is to avoid querying info_schema as much as possible - it will only query the structure if something was changed - next steps follows as soon as possible
* Minor MCPKit tidy up, including the resolution of potential issues raised ↵stuconnolly2010-03-261-27/+43
| | | | during static analysis.
* - Simplify connection keepalives, moving to a single repeating timer on the ↵rowanbeentje2010-03-261-6/+1
| | | | | | | | main thread. This cleans up calls, results in small speed improvements when making lots of queries (no more stopping/starting of keepalives), and ensures only the main thread handles the initial keepalives. - Move connection unlocking to a blocking call to fix http://log.sequelpro.com/view/73 - Fix memory leaks caused by non-detached pthreads
* • NavigatorBibiko2010-03-251-0/+2
| | | | | | | - first implementation of a search functionality, workable but tiny issues have to be improved - up to now the only search implemented is 'contains', regexp/fuzzy search will come soon - the search is only performed in the main outline view, the upper one is static - for the new search store all available schema paths uniquely in an array which will be set during queryDbStructure (this avoids re-parsing of a dict structure)
* • NavigatorBibiko2010-03-251-3/+1
| | | | | | - make usage of a notification sent by the [MCPConnection queryDbStructure] to update the navigator, and this decouples a doc window and MCPConnection from the navigator - minimized the tree update - now connectionID-based - any tree update will be now performed on main thread and waits until done to avoid 'overlapping' updates triggered by different notifications which normally ended up in an inchoate tree display
* - Make [MCPConnection getLastErrorMessage] more consistent by always ↵rowanbeentje2010-03-251-0/+1
| | | | | | | returning nil if no error occurred (previously a blank string was returned most of the time) - Add a new (BOOL)[MCPConnection queryErrored] method, changing all error message checks to use it for clarity
* • further work on Navigator (not yet active but workable -> unHide menu item)Bibiko2010-03-191-0/+2
|
* - Make a number of changes to attempt to improve disconnection/quit ↵rowanbeentje2010-03-161-0/+1
| | | | | | | | | crashes: prevent multiple disconnects, add more checks, cancel current queries, and add a tiny delay to allow mysql cleanup. - Alter MCPStreamingResult to no longer return a retained instance, setting up correct result disposal on autorelease but changing callers to retain as soon as they receive. - Review and change a number of local variables shadowing/shielding other local or global variables.
* Rework MCPConnection for greater thread safety:rowanbeentje2010-03-081-1/+6
| | | | | | | | - The delegate is now triggered for connectionLost: on the main thread, as this action will probably trigger a GUI update; this addresses http://log.sequelpro.com/view/10 . - Connection proxy disconnects are now triggered on the main thread - Connection checks are now made via a pthread'd ping in a loop, removing the reliance on SIGALRM which may hop thread execution back to the main thread when called on another thread. The new approach is cleaner but does rely on a loop with a sleep. This will hopefully improve the disconnect/retry/reconnect crashes.
* Fix a number of memory leaks, and over-releases, as both a result of manual ↵rowanbeentje2010-02-101-1/+1
| | | | inspection of leaks and Clang static analysis.
* • added method to get an info about unique database/tables names for ↵Bibiko2010-01-141-0/+2
| | | | completion
* • first preparations to improve the Custom Query database names/table ↵Bibiko2010-01-101-0/+5
| | | | | | | | | names/field names + type and encoding completion - after connecting and updating the table list a background task executed on a different connection will be performed to query the information_schema db (MySQL >= 5 only so far) - the MCPConnection object holds a NSDictionary with all structural data Note: not yet active
* - Ensure all results for server variable requests are returned as strings, ↵rowanbeentje2010-01-031-0/+1
| | | | | | | to avoid binary-mode result issues with certain versions of MySQL (including 4.1.14). This should address Issue #509. - TableDocument now requests the server version string from MCPConnection, aiding caching
* - Correctly report errors triggered *during* result download for streaming ↵rowanbeentje2009-11-161-0/+1
| | | | results. This improves partial content displays (using the new code as of r1530) and also improves custom query error reporting.
* Implement query cancellation support within MCPKit, and add it to the task ↵rowanbeentje2009-11-151-0/+5
| | | | | | | | | | functionality: - MCPKit now supports cancelling the active query; for MySQL servers >= 5.0.0 a query kill is attempted from a new connection, and if that fails or for MySQL < 5 a reconnect is triggered. - TableDocument now supports enabling a cancel task button on the task interface, including an optional callback - Implement query cancellation for custom queries. This addresses Issue #86. - Implement query cancellation for table content loads, filters, and sorts.
* The framework shouldn't be displaying dialogs, get the delegate to do it.stuconnolly2009-11-111-0/+1
|
* MCPConnection.[hm] refactoring.stuconnolly2009-11-101-2/+5
|
* - Tweak query locking with MCPStreamingResults to fix certain operations ↵rowanbeentje2009-10-131-0/+1
| | | | releasing locks on different threads from which they were locked (which generates a console message)
* - Rewrite keepalive pings to be performed within pthreads, enforcing ping ↵rowanbeentje2009-10-051-4/+6
| | | | timeouts and thus avoiding problems with network connections dropping and mysql_ping sticking and crashing as more keepalive pings kick in. This should address Issue #298.
* Make the MCPkit framework truly 64 bit compatible by using the appropriate ↵stuconnolly2009-08-261-25/+26
| | | | data types.
* - Change MCPStreamingResult to use a safer streaming mode by default - ↵rowanbeentje2009-08-201-1/+9
| | | | | | | download all results as fast as possible from the server, to avoid blocking, but do so in a background thread to allow results processing to start as soon as data is available. Many thanks to Hans-Jörg Bibiko for assistance with this. - Add an option to the SQL export dialog to allow selection of the full-streaming method, with a warning that it may block table UPDATES/INSERTS.
* Rework SQL export:rowanbeentje2009-08-171-2/+6
| | | | | | | - Added an MCPStreamingResult class to MCPKit, to allow streaming results from the server including fast array access of each row - Tweak SQL export to use the streaming result class and to keep memory usage lower End result is generally faster exports, more accurate progress bars, and much much lower (and consistent) memory usage.
* Missing SVN properties.stuconnolly2009-08-081-1/+1
|
* To fix query logging not working, initialize delegateQueryLogging to YES ↵stuconnolly2009-07-231-1/+4
| | | | upon connection initialization as well as setting the value based on the user's preferences during initiateMySQLConnection in SPConnectionController. Also, initialize delegateResponseToWillQueryString when the connection's delegate is set and revert back to simply calling the delegate method willQueryString:connection: as opposed to using the selector cache as its currently not working. Might need to look into restoring this if we incur a big performance hit after this revision.
* Remove delegate calls asking for SP specific TableDocument ivars, replacing ↵stuconnolly2009-07-221-0/+2
| | | | them with more generic delegate methods.
* Merge framework integration branch back to trunk. Summary of changes:stuconnolly2009-07-211-0/+226
- Includes all custom code from subclasses CMMCPConnection and CMMCPResult, meaning they have subsequently been removed from the project. - All previous Sequel Pro specific code in the above subclasses has been removed in favour of the delegate (currently set to TableDocumet) informing the framework of such information. - All references to CMMCPConnection and CMMCPResult have subsequently been changed to MCPConnection and MCPResult. - Framework includes MySQL 5.1.36 client libraries and source headers. - Framework is now built as a 4-way (32/64 bit, i386/PPC arch) binary. - All import references to <MCPKit_bundled/MCPKit_bundled.h> have been changed to <MCPKit/MCPKit.h>. - New script 'build-mysql-client.sh' can be used to build the MySQL client libraries from the MySQL source. See the script's header for a list of available options or run it with no arguments to display it's usage. Note that there are still a few changes to be made to the framework with regard to removing Sequel Pro specific calls to the delegate. These however can be made later on as they have no effect on functionality and are merely design changes. Also, note that any future development done on the framework should be made to be as 'generic' as possible, with no Sequel Pro specific references. This should allow the framework to be integrated into another project without the need for SP specific code.