aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/SPCopyTable.m4
-rw-r--r--Source/SPCustomQuery.m28
-rw-r--r--Source/SPGeometryDataView.h33
-rw-r--r--Source/SPGeometryDataView.m50
-rw-r--r--Source/SPTableContent.m31
-rw-r--r--sequel-pro.xcodeproj/project.pbxproj7
6 files changed, 132 insertions, 21 deletions
diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m
index 9d014839..736052dc 100644
--- a/Source/SPCopyTable.m
+++ b/Source/SPCopyTable.m
@@ -669,9 +669,9 @@ NSInteger MENU_EDIT_COPY_AS_SQL = 2003;
// Retrieve the cell's content
contentString = [tableStorage cellDataAtRow:i column:columnIndex];
- // TODO it's temporarily
+ // Get WKT string out of the MCPGeometryData for calculation
if ([contentString isKindOfClass:[MCPGeometryData class]])
- contentString = [contentString description];
+ contentString = [contentString wktString];
// Replace NULLs with their placeholder string
else if ([contentString isNSNull]) {
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m
index 5184edf7..74505e23 100644
--- a/Source/SPCustomQuery.m
+++ b/Source/SPCustomQuery.m
@@ -2193,16 +2193,25 @@
NSPoint pos = [NSEvent mouseLocation];
pos.y -= 20;
- // Try to get the original data. If not possible return nil.
- // @try clause is used due to the multifarious cases of
- // possible exceptions (eg for reloading tables etc.)
- id theValue;
- @try{
+ id theValue = nil;
+
+ // While the table is being loaded, additional validation is required - data
+ // locks must be used to avoid crashes, and indexes higher than the available
+ // rows or columns may be requested. Return "..." to indicate loading in these
+ // cases.
+ if (isWorking) {
+ pthread_mutex_lock(&resultDataLock);
+ if (row < resultDataCount && [[aTableColumn identifier] integerValue] < [resultData columnCount]) {
+ theValue = [[SPDataStorageObjectAtRowAndColumn(resultData, row, [[aTableColumn identifier] integerValue]) copy] autorelease];
+ }
+ pthread_mutex_unlock(&resultDataLock);
+
+ if (!theValue) theValue = @"...";
+ } else {
theValue = SPDataStorageObjectAtRowAndColumn(resultData, row, [[aTableColumn identifier] integerValue]);
}
- @catch(id ae) {
- return nil;
- }
+
+ if(theValue == nil) return nil;
// Get the original data for trying to display the blob data as an image
if ([theValue isKindOfClass:[NSData class]]) {
@@ -2212,6 +2221,9 @@
return nil;
}
}
+ else if ([theValue isKindOfClass:[MCPGeometryData class]]) {
+ ; // TODO
+ }
// Show the cell string value as tooltip (including line breaks and tabs)
// by using the cell's font
diff --git a/Source/SPGeometryDataView.h b/Source/SPGeometryDataView.h
new file mode 100644
index 00000000..a2a620bb
--- /dev/null
+++ b/Source/SPGeometryDataView.h
@@ -0,0 +1,33 @@
+//
+// $Id$
+//
+// SPGeometryDataView.m
+// sequel-pro
+//
+// Created by Hans-Jörg Bibiko on October 08, 2010
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// More info at <http://code.google.com/p/sequel-pro/>
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface SPGeometryDataView : NSView
+{
+
+}
+
+@end
diff --git a/Source/SPGeometryDataView.m b/Source/SPGeometryDataView.m
new file mode 100644
index 00000000..8cfaf767
--- /dev/null
+++ b/Source/SPGeometryDataView.m
@@ -0,0 +1,50 @@
+//
+// $Id$
+//
+// SPGeometryDataView.h
+// sequel-pro
+//
+// Created by Hans-Jörg Bibiko on October 08, 2010
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// More info at <http://code.google.com/p/sequel-pro/>
+
+#import "SPGeometryDataView.h"
+
+
+@implementation SPGeometryDataView
+
+/**
+ * Initialize SPGeometryDataView object
+ */
+- (id)initWithFrame:(NSRect)frame
+{
+ if ( self = [super initWithFrame:frame] )
+ {
+ ;
+ }
+ return self;
+}
+
+/**
+ * dealloc
+ */
+- (void)dealloc
+{
+ [super dealloc];
+}
+
+@end
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index a69ad5e2..50ce0617 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -3321,18 +3321,26 @@
NSPoint pos = [NSEvent mouseLocation];
pos.y -= 20;
- // Try to get the original data. If not possible return nil.
- // @try clause is used due to the multifarious cases of
- // possible exceptions (eg for reloading tables etc.)
- id theValue;
- @try{
- theValue = [tableValues cellDataAtRow:row column:[[aTableColumn identifier] integerValue]];
- }
- @catch(id ae) {
- return nil;
+ id theValue = nil;
+
+ // While the table is being loaded, additional validation is required - data
+ // locks must be used to avoid crashes, and indexes higher than the available
+ // rows or columns may be requested. Return "..." to indicate loading in these
+ // cases.
+ if (isWorking) {
+ pthread_mutex_lock(&tableValuesLock);
+ if (row < tableRowsCount && [[aTableColumn identifier] integerValue] < [tableValues columnCount]) {
+ theValue = [[SPDataStorageObjectAtRowAndColumn(tableValues, row, [[aTableColumn identifier] integerValue]) copy] autorelease];
+ }
+ pthread_mutex_unlock(&tableValuesLock);
+
+ if (!theValue) theValue = @"...";
+ } else {
+ theValue = SPDataStorageObjectAtRowAndColumn(tableValues, row, [[aTableColumn identifier] integerValue]);
}
- // Get the original data for trying to display the blob data as an image
+ if(theValue == nil) return nil;
+
if ([theValue isKindOfClass:[NSData class]]) {
image = [[[NSImage alloc] initWithData:theValue] autorelease];
if(image) {
@@ -3340,6 +3348,9 @@
return nil;
}
}
+ else if ([theValue isKindOfClass:[MCPGeometryData class]]) {
+ ; // TODO
+ }
// Show the cell string value as tooltip (including line breaks and tabs)
// by using the cell's font
diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj
index a7b30e04..07e13c85 100644
--- a/sequel-pro.xcodeproj/project.pbxproj
+++ b/sequel-pro.xcodeproj/project.pbxproj
@@ -343,6 +343,7 @@
BC1847EA0FE6EC8400094BFB /* SPEditSheetTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC1847E90FE6EC8400094BFB /* SPEditSheetTextView.m */; };
BC1E55C4100DC92200AAE9F0 /* table-view-small-square.tiff in Resources */ = {isa = PBXBuildFile; fileRef = BC1E55C3100DC92200AAE9F0 /* table-view-small-square.tiff */; };
BC2777A011514B940034DF6A /* SPNavigatorController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC27779F11514B940034DF6A /* SPNavigatorController.m */; };
+ BC2898F3125F4488001B50E1 /* SPGeometryDataView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC2898F2125F4488001B50E1 /* SPGeometryDataView.m */; };
BC29C37F10501EFD00DD6C6E /* SPQueryController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC29C37E10501EFD00DD6C6E /* SPQueryController.m */; };
BC2C16D40FEBEDF10003993B /* SPDataAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = BC2C16D30FEBEDF10003993B /* SPDataAdditions.m */; };
BC2C8E220FA8C2DB008468C7 /* sequel-pro-mysql-help-template.html in Resources */ = {isa = PBXBuildFile; fileRef = BC2C8E210FA8C2DB008468C7 /* sequel-pro-mysql-help-template.html */; };
@@ -980,6 +981,8 @@
BC1E55C3100DC92200AAE9F0 /* table-view-small-square.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "table-view-small-square.tiff"; sourceTree = "<group>"; };
BC27779E11514B940034DF6A /* SPNavigatorController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPNavigatorController.h; sourceTree = "<group>"; };
BC27779F11514B940034DF6A /* SPNavigatorController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPNavigatorController.m; sourceTree = "<group>"; };
+ BC2898F1125F4488001B50E1 /* SPGeometryDataView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPGeometryDataView.h; sourceTree = "<group>"; };
+ BC2898F2125F4488001B50E1 /* SPGeometryDataView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPGeometryDataView.m; sourceTree = "<group>"; };
BC29C37D10501EFD00DD6C6E /* SPQueryController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPQueryController.h; sourceTree = "<group>"; };
BC29C37E10501EFD00DD6C6E /* SPQueryController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPQueryController.m; sourceTree = "<group>"; };
BC2C16D20FEBEDF10003993B /* SPDataAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPDataAdditions.h; sourceTree = "<group>"; };
@@ -1720,6 +1723,8 @@
584095181107CB6600260CFD /* SPAlertSheets.m */,
BC878A6F121A836F00AE5066 /* SPColorWellCell.h */,
BC878A70121A836F00AE5066 /* SPColorWellCell.m */,
+ BC2898F1125F4488001B50E1 /* SPGeometryDataView.h */,
+ BC2898F2125F4488001B50E1 /* SPGeometryDataView.m */,
);
name = GUI;
sourceTree = "<group>";
@@ -2363,7 +2368,6 @@
isa = PBXProject;
buildConfigurationList = C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "sequel-pro" */;
compatibilityVersion = "Xcode 3.1";
- developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
@@ -2786,6 +2790,7 @@
BC398A2D121D526200BE3EF4 /* SPCopyTable.m in Sources */,
BC32F242121D66260067305E /* SPFileManagerAdditions.m in Sources */,
17A20AC6124F9B110095CEFB /* SPServerSupport.m in Sources */,
+ BC2898F3125F4488001B50E1 /* SPGeometryDataView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};