Skip to content

Commit

Permalink
SQL representation modified
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDenisov committed Apr 11, 2012
1 parent 7359350 commit 21abad5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
5 changes: 3 additions & 2 deletions BindableTypes/BindableTypes/BTBaseNumber.m
Expand Up @@ -33,8 +33,9 @@ - (NSString *)toSql {
return [self.boundedNumber performSelector:@selector(toSql)];
}
+ (id)fromSql:(NSString *)sqlData {
return [NSDecimalNumber performSelector:@selector(fromSql:)
withObject:sqlData];
NSNumber *number = [NSDecimalNumber performSelector:@selector(fromSql:)
withObject:sqlData];
return [[[BTBaseNumber alloc] initWithNumber:number] autorelease];
}

@synthesize boundedNumber;
Expand Down
21 changes: 0 additions & 21 deletions BindableTypes/BindableTypes/BTBaseString.m
Expand Up @@ -8,29 +8,8 @@

#import "BTBaseString.h"

@interface BTBaseString ()
+ (const char *)sqlType;
- (NSString *)toSql;
+ (id)fromSql:(NSString *)sqlData;
@end

@implementation BTBaseString

/*
ActiveRecord Support
https://github.com/AlexDenisov/iActiveRecord
*/

+ (const char *)sqlType {
return (const char *)[NSString performSelector:@selector(sqlType)];
}
- (NSString *)toSql {
return [self.boundedString performSelector:@selector(toSql)];
}
+ (id)fromSql:(NSString *)sqlData {
return [NSString performSelector:@selector(fromSql:) withObject:sqlData];
}

@synthesize boundedString;
@synthesize boundedLabel;
@synthesize delegate;
Expand Down
21 changes: 19 additions & 2 deletions BindableTypes/BindableTypes/BTString.m
Expand Up @@ -11,13 +11,30 @@
#import "BTTextFieldString.h"
#import "BTTextViewString.h"

@interface BTString ()
+ (const char *)sqlType;
- (NSString *)toSql;
+ (id)fromSql:(NSString *)sqlData;
@end

@implementation BTString

/*
ActiveRecord Support
https://github.com/AlexDenisov/iActiveRecord
*/

+ (const char *)sqlType {
return (const char *)[BTBaseString performSelector:@selector(sqlType)];
return (const char *)[NSString performSelector:@selector(sqlType)];
}
- (NSString *)toSql {
return [[self stringValue] performSelector:@selector(toSql)];
}

+ (id)fromSql:(NSString *)sqlData {
NSString *string = [BTBaseString performSelector:@selector(fromSql:) withObject:sqlData];
NSLog(@"%@", sqlData);
NSString *string = [NSString performSelector:@selector(fromSql:) withObject:sqlData];
NSLog(@"%@", string);
return [[[BTBaseString alloc] initWithString:string] autorelease];
}

Expand Down

0 comments on commit 21abad5

Please sign in to comment.