aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPSQLExporter.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPSQLExporter.m')
-rw-r--r--Source/SPSQLExporter.m9
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]];
}