diff options
author | stuconnolly <stuart02@gmail.com> | 2011-07-10 12:44:15 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2011-07-10 12:44:15 +0000 |
commit | 59527d9acd227a9a924fbd66ed29b85ea8b65a02 (patch) | |
tree | dca62602c88706a4d64ba6d1720a744cb269dd9c /Source/SPSQLExporter.m | |
parent | 4b071f5866460dbff1bce10a297f3b017dfea26b (diff) | |
download | sequelpro-59527d9acd227a9a924fbd66ed29b85ea8b65a02.tar.gz sequelpro-59527d9acd227a9a924fbd66ed29b85ea8b65a02.tar.bz2 sequelpro-59527d9acd227a9a924fbd66ed29b85ea8b65a02.zip |
Add the option to the SQL export view as to whether or not the AUTO_INCREMENT value on a table's structure is included. Defaults to not included. Implements issue #1064.
Diffstat (limited to 'Source/SPSQLExporter.m')
-rw-r--r-- | Source/SPSQLExporter.m | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Source/SPSQLExporter.m b/Source/SPSQLExporter.m index 4c7903fc..66411932 100644 --- a/Source/SPSQLExporter.m +++ b/Source/SPSQLExporter.m @@ -31,8 +31,9 @@ #import "SPExportUtilities.h" #import "SPExportFile.h" #import "SPTableData.h" +#import "RegexKitLite.h" -@interface SPSQLExporter (PrivateAPI) +@interface SPSQLExporter () - (NSString *)_createViewPlaceholderSyntaxForView:(NSString *)viewName; @@ -50,6 +51,7 @@ @synthesize sqlOutputIncludeUTF8BOM; @synthesize sqlOutputEncodeBLOBasHex; @synthesize sqlOutputIncludeErrors; +@synthesize sqlOutputIncludeAutoIncrement; @synthesize sqlCurrentTableExportIndex; @synthesize sqlInsertAfterNValue; @synthesize sqlInsertDivider; @@ -263,6 +265,11 @@ createTableSyntax = [[[NSString alloc] initWithData:createTableSyntax encoding:[self exportOutputEncoding]] autorelease]; } + // If necessary strip out the AUTO_INCREMENT from the table structure definition + if (![self sqlOutputIncludeAutoIncrement]) { + createTableSyntax = [createTableSyntax stringByReplacingOccurrencesOfRegex:[NSString stringWithFormat:@"AUTO_INCREMENT=[0-9]+ "] withString:@""]; + } + [[self exportOutputFile] writeData:[createTableSyntax dataUsingEncoding:NSUTF8StringEncoding]]; [[self exportOutputFile] writeData:[[NSString stringWithString:@";\n\n"] dataUsingEncoding:NSUTF8StringEncoding]]; } |