29
30
31
32
33
34
35
36
37
38
|
@end
OF_APPLICATION_DELEGATE(Tests)
@implementation Tests
- (void)applicationDidFinishLaunching
{
[OFApplication terminate];
}
@end
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
@end
OF_APPLICATION_DELEGATE(Tests)
@implementation Tests
- (void)applicationDidFinishLaunching
{
OFFileManager *fileManager = [OFFileManager defaultManager];
SL3Connection *conn;
SL3PreparedStatement *stmt;
if ([fileManager fileExistsAtPath: @"tests.db"])
[fileManager removeItemAtPath: @"tests.db"];
conn = [SL3Connection connectionWithPath: @"tests.db"];
[conn executeStatement: @"CREATE TABLE test (a INT, b TEXT, c BLOB)"];
stmt = [conn prepareStatement:
@"INSERT INTO test (a, b, c) VALUES ($a, $b, $c)"];
[stmt bindWithArray: [OFArray arrayWithObjects:
[OFNumber numberWithInt: 5],
@"String",
[OFData dataWithItems: "abc"
count: 3],
nil]];
[stmt step];
stmt = [conn prepareStatement:
@"INSERT INTO test (a, b, c) VALUES ($a, $b, $c)"];
[stmt bindWithDictionary: [OFDictionary dictionaryWithKeysAndObjects:
@"$a", [OFNumber numberWithInt: 7],
@"$b", @"Test",
@"$c", [OFData dataWithItems: "xyz"
count: 3],
nil]];
[stmt step];
[OFApplication terminate];
}
@end
|