Skip to content
Browse files
Merge pull request #2710 from abhibeckert/master
New URL for feedback reporter, and some other small things
  • Loading branch information
abhibeckert committed Mar 3, 2017
2 parents b87faac + cbf8095 commit 8b69a9e
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 8 deletions.
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="" version="3.0" toolsVersion="6751" systemVersion="13F1507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<?xml version="1.0" encoding="UTF-8"?>
<document type="" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<deployment identifier="macosx"/>
<development version="5100" identifier="xcode"/>
<plugIn identifier="" version="6751"/>
<plugIn identifier="" version="11762"/>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
@@ -12,7 +11,7 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application">
<customObject id="-3" userLabel="Application" customClass="NSObject">
<outlet property="delegate" destination="213" id="1001"/>
@@ -187,7 +187,7 @@
@@ -199,7 +199,6 @@

@@ -223,7 +222,6 @@

@@ -856,6 +856,71 @@ - (IBAction)alterDatabase:(id)sender

- (IBAction)compareDatabase:(id)sender

This method is a basic experiment to see how long it takes to read an string compare an entire database. It works,
well, good performance and very little memory usage.

Next we need to ask the user to select another connection (from the favourites list) and compare chunks of ~1000 rows
at a time, ordered by primary key, between the two databases, using three threads (one for each database and one for

We will the write to disk every difference that has been found and open the result in FileMerge.

In future, add the ability to write all difference to the current database.


SPMySQLResult *showTablesQuery = [mySQLConnection queryString:@"show tables"];

NSArray *tableRow;
while ((tableRow = [showTablesQuery getRowAsArray]) != nil) {
@autoreleasepool {
NSString *table = tableRow[0];

NSLog(@"Scanning %@", table);

NSDictionary *tableStatus = [[mySQLConnection queryString:[NSString stringWithFormat:@"SHOW TABLE STATUS LIKE %@", [table tickQuotedString]]] getRowAsDictionary];
NSInteger rowCountEstimate = [tableStatus[@"Rows"] integerValue];
NSLog(@"Estimated row count: %li", rowCountEstimate);

SPMySQLResult *tableContentsQuery = [mySQLConnection streamingQueryString:[NSString stringWithFormat:@"select * from %@", [table backtickQuotedString]] useLowMemoryBlockingStreaming:NO];
//NSDate *lastProgressUpdate = [NSDate date];
time_t lastProgressUpdate = time(NULL);
NSInteger rowCount = 0;
NSArray *row;
while (true) {
@autoreleasepool {
row = [tableContentsQuery getRowAsArray];
if (!row) {

[row isEqualToArray:row]; // TODO: compare to the other database, instead of the same one (just doing that to test performance)

if ((time(NULL) - lastProgressUpdate) > 0) {
NSLog(@"Progress: %.1f%%", (((float)rowCount) / ((float)rowCountEstimate)) * 100);
lastProgressUpdate = time(NULL);
NSLog(@"Done. Actual row count: %li", rowCount);


#ifndef SP_CODA /* operations on whole databases */
* opens the copy database sheet and copies the databsae

0 comments on commit 8b69a9e

Please sign in to comment.