Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mini tutorial #23

Merged
merged 9 commits into from
Feb 26, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
do not check for if columnCount is zero before adding columns
  • Loading branch information
mekjaer committed Feb 24, 2014
commit 592fd1c72ced2209a423b9fb4e6dcf490cde287d
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
4D54FC6E18B77D56002AD81E /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D54FC4D18B77D56002AD81E /* UIKit.framework */; };
4D54FC7618B77D56002AD81E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4D54FC7418B77D56002AD81E /* InfoPlist.strings */; };
4D54FC7818B77D56002AD81E /* iPhoneMiniTutorialTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D54FC7718B77D56002AD81E /* iPhoneMiniTutorialTests.m */; };
4D54FC8218B77E0E002AD81E /* Tightdb.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D54FC8118B77E0E002AD81E /* Tightdb.framework */; };
4D54FC8418B77E1E002AD81E /* libstdc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D54FC8318B77E1E002AD81E /* libstdc++.dylib */; };
4DFB5DE018BB544500A8CC9E /* Tightdb.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DFB5DDF18BB544500A8CC9E /* Tightdb.framework */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -57,8 +57,8 @@
4D54FC7318B77D56002AD81E /* iPhoneMiniTutorialTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "iPhoneMiniTutorialTests-Info.plist"; sourceTree = "<group>"; };
4D54FC7518B77D56002AD81E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
4D54FC7718B77D56002AD81E /* iPhoneMiniTutorialTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = iPhoneMiniTutorialTests.m; sourceTree = "<group>"; };
4D54FC8118B77E0E002AD81E /* Tightdb.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Tightdb.framework; sourceTree = "<group>"; };
4D54FC8318B77E1E002AD81E /* libstdc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.dylib"; path = "usr/lib/libstdc++.dylib"; sourceTree = SDKROOT; };
4DFB5DDF18BB544500A8CC9E /* Tightdb.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Tightdb.framework; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -68,9 +68,9 @@
files = (
4D54FC8418B77E1E002AD81E /* libstdc++.dylib in Frameworks */,
4D54FC4C18B77D56002AD81E /* CoreGraphics.framework in Frameworks */,
4DFB5DE018BB544500A8CC9E /* Tightdb.framework in Frameworks */,
4D54FC4E18B77D56002AD81E /* UIKit.framework in Frameworks */,
4D54FC4A18B77D56002AD81E /* Foundation.framework in Frameworks */,
4D54FC8218B77E0E002AD81E /* Tightdb.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -109,8 +109,8 @@
4D54FC4818B77D56002AD81E /* Frameworks */ = {
isa = PBXGroup;
children = (
4DFB5DDF18BB544500A8CC9E /* Tightdb.framework */,
4D54FC8318B77E1E002AD81E /* libstdc++.dylib */,
4D54FC8118B77E0E002AD81E /* Tightdb.framework */,
4D54FC4918B77D56002AD81E /* Foundation.framework */,
4D54FC4B18B77D56002AD81E /* CoreGraphics.framework */,
4D54FC4D18B77D56002AD81E /* UIKit.framework */,
Expand Down Expand Up @@ -491,6 +491,7 @@
4D54FC7D18B77D56002AD81E /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
4D54FC7E18B77D56002AD81E /* Build configuration list for PBXNativeTarget "iPhoneMiniTutorialTests" */ = {
isa = XCConfigurationList;
Expand All @@ -499,6 +500,7 @@
4D54FC8018B77D56002AD81E /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down
17 changes: 4 additions & 13 deletions tutorial/iPhoneMiniTutorial/iPhoneMiniTutorial/TViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,11 @@ - (void)viewDidLoad
// Create a free-standing table
TightdbTable *table = [[TightdbTable alloc] init];

// Add columns to the table if not already there
if ([table getColumnCount] == 0) {
[table addColumnWithType:tightdb_String andName:@"Name"];
[table addColumnWithType:tightdb_Int andName:@"Age"];
[table addColumnWithType:tightdb_Bool andName:@"Hired"];
}

// Get the column indexes of the added columns
size_t const NAME = [table getColumnIndex:@"Name"];
size_t const AGE = [table getColumnIndex:@"Age"];
size_t const HIRED = [table getColumnIndex:@"Hired"];
// Add columns to the table
size_t const NAME = [table addColumnWithType:tightdb_String andName:@"Name"];
size_t const AGE = [table addColumnWithType:tightdb_Int andName:@"Age"];
size_t const HIRED = [table addColumnWithType:tightdb_Bool andName:@"Hired"];


// Add new row to the table and set values
TightdbCursor *cursor0 = [table addRow];
[cursor0 setString:@"Jill" inColumn:NAME];
Expand All @@ -39,7 +31,6 @@ - (void)viewDidLoad
[cursor1 setInt: 40 inColumn:AGE];
[cursor1 setBool:NO inColumn:HIRED];


// Change value in row
[cursor1 setBool:YES inColumn:HIRED];

Expand Down