Skip to content

Commit

Permalink
Updates Demo project
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvaroFranco committed Jul 6, 2014
1 parent 88bccfd commit b961a74
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 4 deletions.
Binary file modified Demo/.DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions Demo/AFSQLManager-Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
3840A73019661A1500AADB8C /* caja.sql in Resources */ = {isa = PBXBuildFile; fileRef = 3840A72F19661A1500AADB8C /* caja.sql */; };
A73B900E18FFF55E009CECF0 /* test.sqlite in Resources */ = {isa = PBXBuildFile; fileRef = A77919F418FFECBA008FFC3A /* test.sqlite */; };
A74038AB18FFC523001D71DD /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A74038AA18FFC523001D71DD /* Foundation.framework */; };
A74038AD18FFC523001D71DD /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A74038AC18FFC523001D71DD /* CoreGraphics.framework */; };
Expand Down Expand Up @@ -38,6 +39,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
3840A72F19661A1500AADB8C /* caja.sql */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = caja.sql; sourceTree = "<group>"; };
A74038A718FFC523001D71DD /* AFSQLManager-Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "AFSQLManager-Demo.app"; sourceTree = BUILT_PRODUCTS_DIR; };
A74038AA18FFC523001D71DD /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
A74038AC18FFC523001D71DD /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -94,6 +96,7 @@
isa = PBXGroup;
children = (
A77919F418FFECBA008FFC3A /* test.sqlite */,
3840A72F19661A1500AADB8C /* caja.sql */,
);
name = Resources;
sourceTree = "<group>";
Expand Down Expand Up @@ -263,6 +266,7 @@
files = (
A74038C318FFC523001D71DD /* Images.xcassets in Resources */,
A74038B518FFC523001D71DD /* InfoPlist.strings in Resources */,
3840A73019661A1500AADB8C /* caja.sql in Resources */,
A74038BE18FFC523001D71DD /* Main.storyboard in Resources */,
A73B900E18FFF55E009CECF0 /* test.sqlite in Resources */,
);
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>A74038A618FFC522001D71DD</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>A74038C718FFC523001D71DD</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
Binary file modified Demo/AFSQLManager-Demo/.DS_Store
Binary file not shown.
10 changes: 6 additions & 4 deletions Demo/AFSQLManager-Demo/AFSQLManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,21 @@ -(void)performQuery:(NSString *)query withBlock:(completionBlock)completion {
NSString *fixedQuery = [query stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];

sqlite3_stmt *statement;

if (sqlite3_prepare_v2(_database, [fixedQuery UTF8String], -1, &statement, nil) == SQLITE_OK) {

while (sqlite3_step(statement) == SQLITE_ROW) {

NSMutableArray *row = [NSMutableArray array];

for (int i = 0; i < sqlite3_column_count(statement); i++) {
[row addObject:((char *)sqlite3_column_text(statement, i)) ? [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, i)] : @""];

[row addObject:((char *)sqlite3_column_text(statement, i)) ? [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, i)] : [NSNull null]];
}

completion(row, nil, NO);
if (completion) {
completion(row, nil, NO);
}
}

sqlite3_finalize(statement);
Expand Down

0 comments on commit b961a74

Please sign in to comment.