aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableData.m
Commit message (Collapse)AuthorAgeFilesLines
* Before attempting to parse the create syntax of a table or view, check that ↵stuconnolly2010-03-261-0/+4
| | | | it's not nil. This accommodates cases where the SHOW CREATE SYNTAX query caused the connection reconnect dialog to appear and the user chose the close the connection.
* - Make [MCPConnection getLastErrorMessage] more consistent by always ↵rowanbeentje2010-03-251-7/+7
| | | | | | | 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
* General tidy up, with a focus on consolidating more constants in ↵stuconnolly2010-03-241-14/+13
| | | | SPConstants.h/m.
* • fixed issue for new data representation of the key @"default" in [ ↵Bibiko2010-03-231-1/+1
| | | | informationForView:] since it can be [NSNull null]
* • CSV ImportBibiko2010-03-221-8/+6
| | | | | | | | - if a parsed row in the csv file doesn't have the same number of columns as the first row fill the missing columns with SPNotLoaded to allow while importing that these missing data can be replaced by the table column's DEFAULT value - fixed tiny issue for field mapper sheet to display the correct tooltip for default values • SPTableData - ATTENTION: changed the object for returned key 'default': if its value is NULL now it returns a [NSNull null] object - changed instances to handle this [NSNull null] object (must be checked)
* - Make a number of changes to attempt to improve disconnection/quit ↵rowanbeentje2010-03-161-1/+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.
* Fix some potential issues found during static analysis.stuconnolly2010-03-151-1/+1
|
* Following a manual code review, fix some local variables overriding global ↵rowanbeentje2010-03-151-12/+10
| | | | variables, a few leaks, and additional nil setting/checking to prevent overreleases or releases of random areas of memory.
* • added to method informationForTable: Bibiko2010-02-201-12/+37
| | | | | | - the root dict key "primarykeyfield" = <field name> - the key "isprimarykey" for corresponding table field - the key "unique" = 1 if corresponding table field has a UNIQUE KEY
* Fix a number of memory leaks, and over-releases, as both a result of manual ↵rowanbeentje2010-02-101-1/+3
| | | | inspection of leaks and Clang static analysis.
* Complete the implementation of the management of table triggers (accessible ↵stuconnolly2010-02-061-1/+1
| | | | via Cmd+6). Note, that better support for entering the trigger statement in terms of escaping and delimiter support most likely needs to be added.
* • fixed endless loop if user selects a table whose name contains chars ↵Bibiko2010-02-051-1/+2
| | | | | | which are not support by the current set encoding • added DataMigrationDialog.xib to Xcode project
* - Rework SPSQLParser, extending DELIMITER support into all the original ↵rowanbeentje2010-02-051-2/+2
| | | | | | | | | | | functions (off by default). Remove the forked "...Sql..." functions, as they're now duplicates, and switch CustomQuery to using the original methods. - TableDump imports can now process DELIMITERs correctly as a result. - Alter the TableDump display of tables etc to use TablesList as the source of information, and used cached lists where appropriate for a small speedup. Also means we gain consistent sorting. - Display procedures and functions in the toggleable list when exporting as SQL - Tweak the procedure and function export to only export selected items, and also to respect the "export drop syntax" and "export create syntax" checkboxes - Fix a crash when removing items from the TablesList resulted in an errorneous selection by deselecting all rows before deleting (and preemptively applying the same fix to TableContent)
* • improved error handling in Structure View for adding/renaming/removing a ↵Bibiko2010-02-031-0/+4
| | | | | | | field if the actual underlying table doesn't exit anymore; now it informs the user, clean the view, and reloads the Table List • improved error handling in Content View for refreshing data for the current table if the table doesn't exist anymore - this fix and the fix in [TableContent setCompareTypes:] to check for valid table data removes some NSPlaceholderString and NSScanner warnings
* • field mapping sheet is now document-modal instead of blocking SP entirelyBibiko2010-02-031-2/+2
| | | | | | | • if an error occurred while retrieving column or index data in Structure pane reset Structure pane to a stable status, display the error message, and reload Tables List table due to the fact the it's very likely that SP tries to retrieve data from a table which doesn't exist anymore • fixed spelling of "occurred" Note: NOT YET DONE: if in Structure view the actual underlying table was deleted or renamed by an other mysql event and the user tries to add/change a field do suppress this attempt safely
* Added preliminary support for triggers. You can access the tab via the bamse162010-01-311-0/+33
| | | | | | | | | | | | | | | | | | | | menu item View > Table Triggers (apple-6). Heavily copied from Relations tab, lots of functionality missing. Just lists the triggers for the table now. M Source/SPTableData.m M Source/SPConstants.h M Source/SPConstants.m A Source/SPTableTriggers.h A Source/SPTableTriggers.m M Source/TableDocument.h M Source/TableDocument.m M Source/SPTableData.h M Interfaces/English.lproj/MainMenu.xib M Interfaces/English.lproj/DBView.xib M sequel-pro.xcodeproj/project.pbxproj
* Address Issue #546 (format string bugs):rowanbeentje2010-01-201-4/+5
| | | | | | - Fix incorrect uses of [NSString stringWithFormat:] with preconstructed strings and no arguments in SPUserManager - To fix display issues, replace NSBeginAlertSheet (which includes automatic sprintf expansion of the message) with a safely-escaped SPBeginAlertSheet in many files
* Replace COUNT(*) with COUNT(1) which is usually faster, and much faster in ↵bamse162010-01-141-2/+2
| | | | certain conditions
* - Upgrade Sequel Pro to be compiled as a 3-way PPC/i386/x86_64 binary for ↵rowanbeentje2010-01-091-9/+9
| | | | | | | release builds, including a large number of 64bit compatibility upgrades and tweaks - Upgrade RegexKitLite to 3.3
* - Ensure all results for server variable requests are returned as strings, ↵rowanbeentje2010-01-031-15/+8
| | | | | | | 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
* - Work through static analysis of the source, fixing a number of small ↵rowanbeentje2009-12-141-2/+2
| | | | memory leaks and fixing a couple of over-releases
* Delay the releasing of the createTableSyntax variable in SPTableData until ↵stuconnolly2009-11-201-15/+14
| | | | we are about the replace it to prevent threading issues. Also, in fieldListForQuery check that dataColumns array is not empty before constructing the field list as well as only obtaining the table's columns if the field list is going to be built in the first place.
* When attempting to delete a field that is part of a foreign key ↵stuconnolly2009-11-181-3/+11
| | | | | | | | | relationship, remove the key before the field to prevent an error. Obviously warn the user that the key is being dropped as well. Fixes issue #462. This check also needs to be implemented when removing indexes as foreign keys depend on the presence of indexes to prevent table scans. Something to be discussed, the display of foreign keys that are made up of multiple fields in the relations table and link arrows in the content table.
* • added basic PROCEDURE and FUNCTION INFORMATION Bibiko2009-11-021-19/+36
| | | | • change "multiple tables" to "multiple selection" and header to "INFORMATION" if a multiple selection is given
* Replace the use of hard coded preference keys with constants to prevent ↵stuconnolly2009-10-171-1/+2
| | | | issues such as the one fixed in revision 1419. All future preference usage should be done so using these constants.
* • fixed SPArrayAdditions method 'componentsJoinedByCommas' to use a ↵Bibiko2009-10-161-0/+38
| | | | | | | | | | | | | mutable string to avoid crashes if array has a very large number of items (malloc error due to reassigning a NSString pointer) • added to SPTableData method - (NSArray *) primaryKeyColumnNames - returns all column names which are set as PRIMARY KEYs - return nil if no PRIMARY KEY is set • improved the deletion of rows - if current table has only one PRIMARY KEY field delete all rows via DELETE FROM table WHERE pri_key IN (…) whereby the deletion query will be splitted into 256k chunks Note: line 1790ff It has to be implemented a workaround for tables with more than one PRIMARY KEY – maybe via DELETE FROM table WHERE ( (pri_key1='…' AND pri_key2='…') OR (… AND …) OR … ) splitted in 256k chunks as well
* • fixed bug while parsing the CREATE TABLE syntax if a column name ↵Bibiko2009-10-091-0/+14
| | | | | | | | contains a '#' or '/*' - this fixes issue 431 - furthermore if the parsing process fails for some other reasons, i.e. a table name is NULL or empty SP alerts the user about it instead of stalling
* - When moving or editing table columns, preserve comments and any column ↵rowanbeentje2009-10-031-3/+16
| | | | | | | details which are currently unhandled (column formats, storage, references). This addresses the data loss part of Issue #180. - Parse out column comments in SPTableData to allow displaying or editing comments in future
* If the SSH tunnel is unable to bind to the local port because there is ↵stuconnolly2009-08-281-6/+1
| | | | already an existing tunnel, give the user the option of using a standard connection to localhost on the port that is in use in order to use the existing tunnel. Fixes issue #371.
* - Rework TableContent row count fetching, loading it in the correct ↵rowanbeentje2009-08-131-2/+9
| | | | | | | | locations, and correcting the logic for fetching the count of rows so that the query is not used where not necessary. - Update the Table Info pane and tab with a new row count if one is known - this addresses Issue #141 - This reverts r1090, and so needs to be discussed with stuart02 - the rest of the row logic changes may have fixed the 'larger issue' described there?
* Disable updating the number of rows in the selected table in the table data ↵stuconnolly2009-07-211-1/+1
| | | | cache within getNumberOfRows after the discovery of much larger issue.
* Merge framework integration branch back to trunk. Summary of changes:stuconnolly2009-07-211-8/+6
| | | | | | | | | | | | | | | - 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.
* • bug fixed for the case that table status returns NULL for number of rows:Bibiko2009-07-211-1/+1
| | | | - object for key 'Rows' should be a NSString not a NSNumber
* Improvements to reporting the correct row count for tables. See issue #141.stuconnolly2009-07-211-0/+9
|
* • fixed: if SPTableData returns for dict: tableStatus key:Rows = NULL (as ↵Bibiko2009-07-201-0/+9
| | | | for information_schema for instance) then try to get the number of rows via "SELECT COUNT(*) FROM table" in order to be able to load the Content Tab
* - Update r1003 to also work with views (fixes Issue #335)rowanbeentje2009-07-151-1/+2
|
* - Make the DBView window the document window. This allows the document to ↵rowanbeentje2009-07-151-2/+3
| | | | | | | | | | be closed when the window is closed, freeing the document's memory - Update a number of dealloc methods to include more retained memory, and to avoid releasing non-retained memory - Remove notification observers and delegates where appropriate to avoid issues after document closing - Fix a couple of memory leaks - Support window cascading for all windows past the first, using the first window as the autosave window
* Rework data storage and retrieval in TableContent and CustomQuery backing ↵rowanbeentje2009-07-131-0/+1
| | | | | | | | | | | | arrays, and make some editable CustomQuery improvements: - Switch to using arrays for row storage rather than dictionaries. Use the data column index for table column identifiers. - This fixes Issue #316 and also allows sorting by all custom query result columns using a column index rather than the name - Offers significant speed and memory advantages: result building is now 2x-3x faster, memory used for results storage is 30-40% lower, and result access is slightly faster. (Note full 2x-3x speed results won't be seen - result fetching and mysql binary work isn't included in the timing) - No longer need to fetch the first column of data for tables containing only blob types - Correctly escape strings when editing CustomQuery results - Rewrite NSArrayObjectAtIndex to use the native CFArrayGetValueAtIndex rather than cached selectors - neater code and I think slightly faster
* Issue 333: Problems with single quotes in table name by escaping the single ↵bamse162009-07-111-1/+3
| | | | quotes in queries like SHOW TABLE STATUS LIKE 'I\'m';
* - Make changes to the table structure flush the appropriate table data cachesrowanbeentje2009-06-241-0/+7
| | | | | | - SPTableData's columnWithName: now updates caches as necessary to avoid issues - Mark the extended table info view (particularly the CREATE TABLE syntax) as requiring update following table structure changes
* - We have always allowed setting "on update CURRENT_TIMESTAMP" for ↵rowanbeentje2009-06-241-0/+9
| | | | timestamp columns - parse out this information, and now also show if it's set in the structure view. Fixes the setting not appearing to work.
* • tried to unify the displaying of error messages (mainly converted them ↵Bibiko2009-06-241-4/+16
| | | | | | | | into sheets) • changed the alert for "Truncate table" - "Are you sure you want to delete ALL table records in the..." • added BWToolkitFramework copyright notice to credits.rtf
* - Improve support for MySQL running in ANSI mode (or ANSI_QUOTES), fixing a ↵rowanbeentje2009-06-221-39/+41
| | | | cause of the content tab not loading for some users
* • added to SPArrayAdditions.h: NSArrayObjectAtIndex() inline functionBibiko2009-06-181-25/+29
| | | | | | | | | - id o = NSArrayObjectAtIndex(anArray, index) :== id o = [anArray objectAtIndex:index] - this speed up it ~3µs per call - replaced that inline function for such calls within loops to speed up them • used IMP function pointers for keepAlive calls within queryString: • set -O3 (Fastest) compiler option • allow in preference pane "Tables" to set the Limit up to 50000
* updated dot generator to handle multi-col fk's with a different arrow type ↵mtvee2009-06-111-0/+3
| | | | and views as a different header color
* • cleaned code for the case that the user selects a view which causes a ↵Bibiko2009-06-101-1/+1
| | | | | | | | | MySQL error while retrieving data - [SPTableData tableEncoding] returns nil if no encoding can be found - [TableList tableViewSelectionDidChange:] checks in beforehand for a valid table encoding; this avoids to get the same MySQL error message twice and cleaned the structure view • if a MySQL error occurred while retrieving table data for the content view set the content view to a defined and clean status • bound TableContent's filterButton to DBView.xib to disable it if an error occurred (otherwise the status bar shows unexplainable results )
* update dot file genertor to use SPTableData instead of a v5 style query for ↵mtvee2009-06-101-0/+1
| | | | fk relations
* Fixed some memory leaks found using llvm/clang. There are still some to fixbamse162009-06-051-4/+1
|
* • added: the "Show Create Syntax" window now follows the selection in the ↵Bibiko2009-06-041-1/+1
| | | | | | table list if it was already opened • commented out the NSLog "not parsed" in SPTableData.m
* • Table InfoBibiko2009-05-281-1/+24
| | | | | - show create syntax for views - fixed editing behaviour of the Comments field (esp. for views)