cDBName = [[adaptor databaseName] UTF8String];
+#if 1
+# warning IMPLEMENT ME
+#else
rc = sqlite3_open(cDBName, (void *)&(self->_connection));
if (rc != SQLITE_OK) {
// could not login ..
sqlite3_close(self->_connection);
return NO;
}
+#endif
if (isDebuggingEnabled)
NSLog(@"MySQL4 connection established 0x%08X", self->_connection);
- (void)primaryCloseChannel {
if (self->statement != NULL) {
+#if 1
+# warning IMPLEMENT ME
+#else
sqlite3_finalize(self->statement);
+#endif
self->statement = NULL;
}
if (self->_connection != NULL) {
+#if 1
+# warning IMPLEMENT ME
+#else
sqlite3_close(self->_connection);
+#endif
#if 0
NSLog(@"---------- %s: %@ close channel count[%d]", __PRETTY_FUNCTION__,
self, openConnectionCount);
const char *em;
int rc;
+#if 1
+# warning IMPLEMENT ME
+#else
rc = sqlite3_step(self->statement);
+#endif
#if 0
NSLog(@"STEP: %i (row=%i, done=%i, mis=%i)", rc,
SQLITE_ROW, SQLITE_DONE, SQLITE_MISUSE);
#endif
+#if 1
+# warning IMPLEMENT ME
+#else
if (rc == SQLITE_ROW) {
self->hasPendingRow = YES;
self->isDone = NO;
if ((em = sqlite3_errmsg(self->_connection)) != NULL)
r = [r stringByAppendingFormat:@": %s", em];
+#endif
return [MySQL4Exception exceptionWithName:@"FetchFailed"
reason:r userInfo:nil];
- (void)cancelFetch {
if (self->statement != NULL) {
+#if 1
+# warning IMPLEMENT ME
+#else
sqlite3_finalize(self->statement);
+#endif
self->statement = NULL;
}
self->isDone = NO;
if (!self->hasPendingRow) /* no rows available */
return nil;
+#if 1
+# warning IMPLEMENT ME
+#else
fieldCount = sqlite3_column_count(self->statement);
+#endif
/* old code below */
NSString *columnName = nil;
NSString *attrName = nil;
+#if 1
+# warning IMPLEMENT ME
+#else
columnName = [NSString stringWithCString:
sqlite3_column_name(self->statement, cnt)];
- attrName = [columnName _sqlite3ModelMakeInstanceVarName];
+#endif
+ attrName = [columnName _mySQL4ModelMakeInstanceVarName];
if ([[usedNames objectForKey:attrName] boolValue]) {
int cnt2 = 0;
[attribute setName:attrName];
[attribute setColumnName:columnName];
+#if 1
+# warning IMPLEMENT ME
+#else
switch (sqlite3_column_type(self->statement, cnt)) {
case SQLITE_INTEGER:
[attribute setExternalType:@"INTEGER"];
__PRETTY_FUNCTION__, cnt);
break;
}
-
+#endif
[result addObject:attribute];
[attribute release];
}
continue;
}
+#if 1
+# warning IMPLEMENT ME
+#else
switch (sqlite3_column_type(self->statement, cnt)) {
case SQLITE_INTEGER:
value = [[valueClass alloc]
continue;
}
}
-
+#endif
if (value != nil) {
[row setObject:value forKey:attrName];
[value release];
self->hasPendingRow = NO;
s = [sql UTF8String];
+#if 1
+# warning IMPLEMENT ME
+#else
rc = sqlite3_prepare(self->_connection, s, strlen(s),
(void *)&(self->statement), &tails);
return [MySQL4Exception exceptionWithName:@"ExecutionFailed"
reason:r userInfo:nil];
}
+#endif
/* step to first row */
self->isFetchInProgress = self->hasPendingRow;
if (!self->isFetchInProgress) {
+#if 1
+# warning IMPLEMENT ME
+#else
sqlite3_finalize(self->statement);
+#endif
self->statement = NULL;
}
}
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-// $Id: NSString+MySQL4.m,v 1.1 2004/06/14 14:27:44 helge Exp $
#if LIB_FOUNDATION_BOEHM_GC
# include <objc/gc.h>
@implementation NSString(MySQL4MiscStrings)
-- (NSString *)_sqlite3ModelMakeInstanceVarName {
+- (NSString *)_mySQL4ModelMakeInstanceVarName {
+ unsigned clen = 0;
+ char *s = NULL;
+ int cnt, cnt2;
+
if ([self length] == 0)
return @"";
- else {
- unsigned clen = 0;
- char *s = NULL;
- int cnt, cnt2;
- clen = [self cStringLength];
- s = malloc(clen + 10);
+ clen = [self cStringLength];
+ s = malloc(clen + 10);
- [self getCString:s maxLength:clen];
+ [self getCString:s maxLength:clen];
- for (cnt = cnt2 = 0; cnt < clen; cnt++, cnt2++) {
- if ((s[cnt] == '_') && (s[cnt + 1] != '\0')) {
- s[cnt2] = toupper(s[cnt + 1]);
- cnt++;
- }
- else if ((s[cnt] == '2') && (s[cnt + 1] != '\0')) {
- s[cnt2] = s[cnt];
- cnt++;
- cnt2++;
- s[cnt2] = toupper(s[cnt]);
- }
- else
- s[cnt2] = tolower(s[cnt]);
+ for (cnt = cnt2 = 0; cnt < clen; cnt++, cnt2++) {
+ if ((s[cnt] == '_') && (s[cnt + 1] != '\0')) {
+ s[cnt2] = toupper(s[cnt + 1]);
+ cnt++;
}
- s[cnt2] = '\0';
-
- return [[[NSString alloc]
- initWithCStringNoCopy:s length:strlen(s) freeWhenDone:YES]
- autorelease];
+ else if ((s[cnt] == '2') && (s[cnt + 1] != '\0')) {
+ s[cnt2] = s[cnt];
+ cnt++;
+ cnt2++;
+ s[cnt2] = toupper(s[cnt]);
+ }
+ else
+ s[cnt2] = tolower(s[cnt]);
}
+ s[cnt2] = '\0';
+
+ return [[[NSString alloc]
+ initWithCStringNoCopy:s length:strlen(s) freeWhenDone:YES]
+ autorelease];
}
-- (NSString *)_sqlite3ModelMakeClassName {
+- (NSString *)_mySQL4ModelMakeClassName {
+ unsigned clen = 0;
+ char *s = NULL;
+ int cnt, cnt2;
+
if ([self length] == 0)
return @"";
- else {
- unsigned clen = 0;
- char *s = NULL;
- int cnt, cnt2;
- clen = [self cStringLength];
- s = malloc(clen + 10);
+ clen = [self cStringLength];
+ s = malloc(clen + 10);
- [self getCString:s maxLength:clen];
+ [self getCString:s maxLength:clen];
- for (cnt = cnt2 = 0; cnt < clen; cnt++, cnt2++) {
+ for (cnt = cnt2 = 0; cnt < clen; cnt++, cnt2++) {
if ((s[cnt] == '_') && (s[cnt + 1] != '\0')) {
s[cnt2] = toupper(s[cnt + 1]);
cnt++;
}
else
s[cnt2] = tolower(s[cnt]);
- }
- s[cnt2] = '\0';
+ }
+ s[cnt2] = '\0';
- s[0] = toupper(s[0]);
+ s[0] = toupper(s[0]);
- return [[[NSString alloc]
+ return [[[NSString alloc]
initWithCStringNoCopy:s length:strlen(s)
freeWhenDone:YES]
autorelease];
- }
}
-- (NSString *)_sqlite3StringWithCapitalizedFirstChar {
- NSCharacterSet *upperSet = [NSCharacterSet uppercaseLetterCharacterSet];
+- (NSString *)_mySQL4StringWithCapitalizedFirstChar {
+ NSCharacterSet *upperSet;
+ NSMutableString *str;
if ([self length] == 0)
return @"";
- else if ([upperSet characterIsMember:[self characterAtIndex:0]])
+
+ upperSet = [NSCharacterSet uppercaseLetterCharacterSet];
+ if ([upperSet characterIsMember:[self characterAtIndex:0]])
return [[self copy] autorelease];
- else {
- NSMutableString *str = [NSMutableString stringWithCapacity:[self length]];
-
- [str appendString:[[self substringToIndex:1] uppercaseString]];
- [str appendString:[self substringFromIndex:1]];
-
- return [[str copy] autorelease];
- }
+
+ str = [NSMutableString stringWithCapacity:[self length]];
+ [str appendString:[[self substringToIndex:1] uppercaseString]];
+ [str appendString:[self substringFromIndex:1]];
+ return [[str copy] autorelease];
}
-- (NSString *)_sqlite3StripEndSpaces {
- if ([self length] > 0) {
- NSCharacterSet *spaceSet = [NSCharacterSet whitespaceCharacterSet];
- NSMutableString *str = [NSMutableString stringWithCapacity:[self length]];
- IMP charAtIndex;
- NSRange range;
-
- charAtIndex = [self methodForSelector:@selector(characterAtIndex:)];
- range.length = 0;
+- (NSString *)_mySQL4StripEndSpaces {
+ NSCharacterSet *spaceSet;
+ NSMutableString *str;
+ IMP charAtIndex;
+ NSRange range;
+
+ if ([self length] == 0)
+ return [[self copy] autorelease];
+
+ spaceSet = [NSCharacterSet whitespaceCharacterSet];
+ str = [NSMutableString stringWithCapacity:[self length]];
+ charAtIndex = [self methodForSelector:@selector(characterAtIndex:)];
+ range.length = 0;
- for (range.location = ([self length] - 1);
+ for (range.location = ([self length] - 1);
range.location >= 0;
range.location++, range.length++) {
unichar c;
range.location);
if (![spaceSet characterIsMember:c])
break;
- }
+ }
- if (range.length > 0) {
+ if (range.length > 0) {
[str appendString:self];
[str deleteCharactersInRange:range];
- return AUTORELEASE([str copy]);
- }
+ return [[str copy] autorelease];
}
- return AUTORELEASE([self copy]);
+ return [[self copy] autorelease];
}
@end