aboutsummaryrefslogtreecommitdiffstats
path: root/TableContent.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2008-12-06 22:34:18 +0000
committerrowanbeentje <rowan@beent.je>2008-12-06 22:34:18 +0000
commitf4ba50508f2c89b3ca5df46a7ec09e0002f7e2e5 (patch)
tree1231d2377cde94c021d34394620a0dbbc3e185bd /TableContent.m
parent1a7130fea502cf627897984fc5a8453e9df9ab00 (diff)
downloadsequelpro-f4ba50508f2c89b3ca5df46a7ec09e0002f7e2e5.tar.gz
sequelpro-f4ba50508f2c89b3ca5df46a7ec09e0002f7e2e5.tar.bz2
sequelpro-f4ba50508f2c89b3ca5df46a7ec09e0002f7e2e5.zip
- Identified and corrected a major n^2 bottleneck in working with all query result sets - when iterating through a mysql result set, all the data up to each row was seeked through again. With this fixed SP can work with very large result sets at much, much higher speeds.
- Fixed incorrect query splitting in splitQueries - improves custom queries and imports. - CSV export now exports NULLs as an empty cell (eg "1,,3"). This resolved Issue #67. Correspondingly, CSV import now also accepts this syntax. - CSV and SQL exports no longer quote numeric values for file size and neatness improvements. - Multi-table exports now show progress through the tables in the text description, and use the progress bar for export of each table, for improved feedback. - The old "Export Table Content" menu has been split into two - "Current Browse View" which matches the old behaviour, and a new "Current Table" entry. This addresses Issue #97. - Exports now write data to a file stream as data is processed for export, and also parse data from the database as a stream where possible. This leads to lower memory usage, speed improvements, and much more accurate and constant feedback. - The export processes have been restructured and rewritten for further speed and memory improvements. - SQL exports now correctly export BLOB and TEXT contents ready for re-import into all systems. - SQL exports now group multiple VALUES for each INSERT INTO command for much, much faster imports of exported data.
Diffstat (limited to 'TableContent.m')
-rw-r--r--TableContent.m10
1 files changed, 5 insertions, 5 deletions
diff --git a/TableContent.m b/TableContent.m
index 7fda874c..1e5e898a 100644
--- a/TableContent.m
+++ b/TableContent.m
@@ -624,8 +624,8 @@
isEditingNewRow = YES;
//set autoincrement fields to NULL
queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM `%@`", selectedTable]];
+ if ([queryResult numOfRows]) [queryResult dataSeek:0];
for ( i = 0 ; i < [queryResult numOfRows] ; i++ ) {
- [queryResult dataSeek:i];
row = [queryResult fetchRowAsDictionary];
if ( [[row objectForKey:@"Extra"] isEqualToString:@"auto_increment"] ) {
[tempRow setObject:[prefs stringForKey:@"nullValue"] forKey:[row objectForKey:@"Field"]];
@@ -1013,8 +1013,8 @@
id key;
int i,j;
+ if ([theResult numOfRows]) [theResult dataSeek:0];
for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
- [theResult dataSeek:i];
tempRow = [theResult fetchRowAsDictionary];
enumerator = [tempRow keyEnumerator];
while ( key = [enumerator nextObject] ) {
@@ -1153,8 +1153,8 @@
} else {
//set insertId for fields with auto_increment
queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM `%@`", selectedTable]];
+ if ([queryResult numOfRows]) [queryResult dataSeek:0];
for ( i = 0 ; i < [queryResult numOfRows] ; i++ ) {
- [queryResult dataSeek:i];
rowObject = [queryResult fetchRowAsDictionary];
if ( [[rowObject objectForKey:@"Extra"] isEqualToString:@"auto_increment"] ) {
[[filteredResult objectAtIndex:rowIndex] setObject:[NSNumber numberWithLong:[mySQLConnection insertId]]
@@ -1225,8 +1225,8 @@
//get primary key if there is one
/*
theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW INDEX FROM `%@`", selectedTable]];
+ if ([theResult numOfRows]) [theResult dataSeek:0];
for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
- [theResult dataSeek:i];
theRow = [theResult fetchRowAsDictionary];
if ( [[theRow objectForKey:@"Key_name"] isEqualToString:@"PRIMARY"] ) {
[keys addObject:[theRow objectForKey:@"Column_name"]];
@@ -1237,8 +1237,8 @@
setLimit = NO;
keys = [[NSMutableArray alloc] init];
theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM `%@`", selectedTable]];
+ if ([theResult numOfRows]) [theResult dataSeek:0];
for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
- [theResult dataSeek:i];
theRow = [theResult fetchRowAsDictionary];
if ( [[theRow objectForKey:@"Key"] isEqualToString:@"PRI"] ) {
[keys addObject:[theRow objectForKey:@"Field"]];