aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableData.m
Commit message (Collapse)AuthorAgeFilesLines
* - 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)
* Redesigned table information pane.stuconnolly2009-05-271-0/+32
|
* More header updates for source files, including Subversion Id property.stuconnolly2009-05-191-0/+2
|
* fixed bug with SPTableData not clearing cache properlymtvee2009-05-151-9/+11
|
* fixed #254 and an unreported bug in the constraint parsermtvee2009-05-151-2/+2
|
* basic constraint editing working with db for add/deletemtvee2009-05-141-1/+3
|
* preliminary support for constraint editingmtvee2009-05-141-1/+113
|
* - added ability to view function and procedures and preliminary ability to ↵mtvee2009-05-131-2/+6
| | | | input same via the editor
* - picked wrong rev during mergeavenjamin2009-04-101-1/+1
| | | | - Changed "nullValue" to "NullValue"
* - Add a preference (currently with no UI) for connection timeoutrowanbeentje2009-03-281-4/+6
| | | | | | | - Improve connection error messages slightly. - Avoid reading prefs for every keepalive check - now sets connection timeout and keepalive interval on connection setup - Fix and extend connection checks to avoid showing extra errors when the connection has been closed
* - fixed issue #203 (backticks in identifiers not supported)jakob2009-03-241-5/+24
| | | | | | | | - added a backtickQuotedString: method to SPStringAdditions - created the file SPArrayAdditions for a componentsJoinedAndBacktickQuoted: method In the future, we should use backtickQuotedString: to quote identifiers like this: [NSString stringWithFormat:@"SELECT * FROM %@", [tableName backtickQuotedString]]
* Issue 202: NULL is prefilled in a non-NULL text fieldbamse162009-03-221-1/+6
| | | | | | | Now, if a field has NOT NULL, the default value is '' (empty string), unless the field is autoincrement, when we can keep the NULL value.
* Issue #201 Duplicating a row resets values of text/blob fields in the new rowbamse162009-03-221-0/+18
|
* SPSQLParser changes:rowanbeentje2009-03-191-23/+29
| | | | | | | | | | | | | | | | | | - Use method caches for oft-called functions, and support caching of chunks of the underlying string for string walking, resulting in an overall 1.3x-1.4x parsing speedup. - Improve handling of multi-character comment starts (eg / or -) at the very end of strings - When running splitString... methods return even empty strings for consistency. - Update TableDump and TableData to match new usage SPStringAddition changes: - Add a formatter for time intervals. CMMCPConnection changes: - Add support for timing queries CustomQuery and nib changes: - Change the "Run Queries" button to "Run All". - Add a "Run Current" button, which runs the query the text caret is currently positioned inside; if text is actually selected, this changes to "Run Selection". This addresses Issue #43. - Amend the "rows affected" string to better reflect the actual number of rows altered by several queries, show the query count if > 1, and display the overall execution time of the queries. This addresses Issue #142. - No longer execute blank strings as part of the custom query, preventing errors.
* More small bugfixesbamse162009-03-111-0/+2
|
* Cleaned up warnings when building against 10.5 SDKavenjamin2009-02-281-3/+4
|
* A patch to improve View support, addressing Issue #130. This patch undoes ↵rowanbeentje2009-02-231-158/+319
| | | | the damage caused by r333, making views viewable again, and extends support by preventing errors in the info pane, by drawing views with a different icon to easily differentiate them, by making all source/index information non-editable to match GUI to behaviour, and to tweak the interface slightly to match.
* Visible improvements in this build:rowanbeentje2009-02-181-0/+509
- Significantly reduce the queries that have to be performed, improving lag - especially over slow connections (Issue #118; see new controller info under headline code changes). - Fix Issue #117 properly (export numeric quoting - we now have access to column types and so can quote appropriately). - Fix Issue #145 (loss of unsigned/null/default attributes when reordering columns). - Fixes Issue #90 (support for filtering DECIMAL column types) - Improve table scrolling speed when the table contains long items. (Added a NSFormatter to automatically truncate strings > 150 chars for display purposes only) - Improved SQL compatibility - for example /* C style comments */ are now correctly ignored in imports and custom queries. - Add text and symbols emphasising that the table info pane / status view row count is an approximation (partially addresses Issue #141) - Fixes a major memory leak whenever opening or scrolling tables containing text/blob data. - SQL import is now faster (SQL parsing part is 3x faster). - Speed up SQL export (1.5x faster for numeric data; 1.1x faster for string data) and slightly speed up CSV export (~1.1x faster). - Display sizes on the status view using the byte size formatter, as per table info pane. Headline code changes: - Add a new NSMutableString subclass, SPSQLParser. See the header file for documentation and overview, but in short it's a centralised place for SQL parsing. Centralises and improves parsing, improves comment support, improves quoting support. Despite the improved featureset this is also faster than the previous distributed implementations - for example, when used to replace the old splitQueries:, > 3x speedup. - Implement a new controller which handles a structure and status cache for the current table, and provides structure parsing for specified tables. This cache is now used throughout the code, reducing the queries that have to be performed and providing additional information about the table structure for use; I think it also improves column type format slightly. - The table info pane and the status view now draw all their data from the cache. Tweaks: - Table encoding is now detected directly instead of being derived from the collation - increased accuracy and cope with the DEFAULT encoding. - Comments and formatting cleaned up in bits I was working on, obviously. - A couple of methods - particularly [tablesListInstance table] and [tableDocument encoding] - have been renamed to avoid conflicts and fix code warnings. Future improvements now possible: - As we now have access to column types and other information, we can provide per-type behaviour where desired. - The table parsing doesn't currently pull out comments or table indices, together with one or two other attributes. Some of this would be useful for display; some, such as indices, could be used to draw the table structure view as long as we're happy discarding a couple of columns (ie cardinality!)