From f677180feb31be7d3e06860047195d4d212ccd39 Mon Sep 17 00:00:00 2001 From: Kristian Spangsege Date: Thu, 7 Feb 2013 02:51:37 +0100 Subject: [PATCH 1/2] Tracking changes in core library --- src/tightdb/objc/Makefile | 2 +- src/tightdb/objc/column_type.h | 44 ------------------------ src/tightdb/objc/data_type.h | 34 ++++++++++++++++++ src/tightdb/objc/helper_macros.h | 14 ++++---- src/tightdb/objc/table.h | 14 ++++---- src/tightdb/objc/table_objc.mm | 40 ++++++++++----------- src/tightdb/objc/test/Makefile | 2 +- src/tightdb/objc/test/column_type.mm | 28 --------------- src/tightdb/objc/test/data_type.mm | 28 +++++++++++++++ src/tightdb/objc/test/get_subtable.m | 8 ++--- src/tightdb/objc/test/group_misc_2.m | 8 ++--- src/tightdb/objc/test/mixed.m | 6 ++-- src/tightdb/objc/test/table.m | 8 ++--- src/tightdb/objc/test/table_delete_all.m | 20 +++++------ 14 files changed, 123 insertions(+), 133 deletions(-) delete mode 100644 src/tightdb/objc/column_type.h create mode 100644 src/tightdb/objc/data_type.h delete mode 100644 src/tightdb/objc/test/column_type.mm create mode 100644 src/tightdb/objc/test/data_type.mm diff --git a/src/tightdb/objc/Makefile b/src/tightdb/objc/Makefile index 4f153823ac..8e391fde2f 100644 --- a/src/tightdb/objc/Makefile +++ b/src/tightdb/objc/Makefile @@ -5,7 +5,7 @@ TIGHTDB_H = tightdb.h GENERATED_SOURCES = $(TIGHTDB_H) -INST_HEADERS = column_type.h cursor.h group.h query.h table.h group_shared.h helper_macros.h $(TIGHTDB_H) +INST_HEADERS = data_type.h cursor.h group.h query.h table.h group_shared.h helper_macros.h $(TIGHTDB_H) lib_LIBRARIES = libtightdb-objc.a diff --git a/src/tightdb/objc/column_type.h b/src/tightdb/objc/column_type.h deleted file mode 100644 index 8414e536d2..0000000000 --- a/src/tightdb/objc/column_type.h +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************* - * - * TIGHTDB CONFIDENTIAL - * __________________ - * - * [2011] - [2012] TightDB Inc - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of TightDB Incorporated and its suppliers, - * if any. The intellectual and technical concepts contained - * herein are proprietary to TightDB Incorporated - * and its suppliers and may be covered by U.S. and Foreign Patents, - * patents in process, and are protected by trade secret or copyright law. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from TightDB Incorporated. - * - **************************************************************************/ -#ifndef TIGHTDB_OBJC_COLUMN_TYPE_H -#define TIGHTDB_OBJC_COLUMN_TYPE_H - -#include - -// FIXME: The namespace of all-upper-case names must be considered -// reserved for macros. Consider renaming 'TIGHTDB_COLUMN_TYPE_INT' to -// 'tightdb_type_Int', and so forth. That is, a qualifying prefix -// followed by the enumeration name in CamelCase. This is a reasonably -// common naming scheme for enumeration values. Note that I am also -// suggesting that we drop 'column' from the names, since these types -// a used much more generally than as just 'column types'. - -// Make sure numbers match those in -typedef enum { - TIGHTDB_COLUMN_TYPE_BOOL = 1, - TIGHTDB_COLUMN_TYPE_INT = 0, - TIGHTDB_COLUMN_TYPE_STRING = 2, - TIGHTDB_COLUMN_TYPE_BINARY = 4, - TIGHTDB_COLUMN_TYPE_DATE = 7, - TIGHTDB_COLUMN_TYPE_TABLE = 5, - TIGHTDB_COLUMN_TYPE_MIXED = 6, -} TightdbColumnType; - -#endif // TIGHTDB_OBJC_COLUMN_TYPE_H diff --git a/src/tightdb/objc/data_type.h b/src/tightdb/objc/data_type.h new file mode 100644 index 0000000000..e3c0aaab63 --- /dev/null +++ b/src/tightdb/objc/data_type.h @@ -0,0 +1,34 @@ +/************************************************************************* + * + * TIGHTDB CONFIDENTIAL + * __________________ + * + * [2011] - [2012] TightDB Inc + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of TightDB Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to TightDB Incorporated + * and its suppliers and may be covered by U.S. and Foreign Patents, + * patents in process, and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from TightDB Incorporated. + * + **************************************************************************/ +#ifndef TIGHTDB_OBJC_DATA_TYPE_H +#define TIGHTDB_OBJC_DATA_TYPE_H + +// Make sure numbers match those in +typedef enum { + tightdb_Bool = 1, + tightdb_Int = 0, + tightdb_String = 2, + tightdb_Binary = 4, + tightdb_Date = 7, + tightdb_Table = 5, + tightdb_Mixed = 6, +} TightdbDataType; + +#endif // TIGHTDB_OBJC_DATA_TYPE_H diff --git a/src/tightdb/objc/helper_macros.h b/src/tightdb/objc/helper_macros.h index e83c6e00f9..5f183da620 100644 --- a/src/tightdb/objc/helper_macros.h +++ b/src/tightdb/objc/helper_macros.h @@ -41,12 +41,12 @@ #define TIGHTDB_TYPE_Date OCDate * #define TIGHTDB_TYPE_Mixed OCMixed * -#define TIGHTDB_TYPE_ID_Bool TIGHTDB_COLUMN_TYPE_BOOL -#define TIGHTDB_TYPE_ID_Int TIGHTDB_COLUMN_TYPE_INT -#define TIGHTDB_TYPE_ID_String TIGHTDB_COLUMN_TYPE_STRING -#define TIGHTDB_TYPE_ID_Binary TIGHTDB_COLUMN_TYPE_BINARY -#define TIGHTDB_TYPE_ID_Date TIGHTDB_COLUMN_TYPE_DATE -#define TIGHTDB_TYPE_ID_Mixed TIGHTDB_COLUMN_TYPE_MIXED +#define TIGHTDB_TYPE_ID_Bool tightdb_Bool +#define TIGHTDB_TYPE_ID_Int tightdb_Int +#define TIGHTDB_TYPE_ID_String tightdb_String +#define TIGHTDB_TYPE_ID_Binary tightdb_Binary +#define TIGHTDB_TYPE_ID_Date tightdb_Date +#define TIGHTDB_TYPE_ID_Mixed tightdb_Mixed @@ -79,7 +79,7 @@ #define TIGHTDB_CHECK_COLUMN_TYPE_3(is_subtable, spec, col, name, type) TIGHTDB_CHECK_COLUMN_TYPE_4_##is_subtable(spec, col, name, type) #define TIGHTDB_CHECK_COLUMN_TYPE_4_Y(spec, col, name, type) \ { \ - if ([spec getColumnType:col] != TIGHTDB_COLUMN_TYPE_TABLE) return NO; \ + if ([spec getColumnType:col] != tightdb_Table) return NO; \ if (![[spec getColumnName:col] isEqualToString:@#name]) return NO; \ OCSpec *subspec = [spec getSpec:col]; \ if (!subspec) return NO; \ diff --git a/src/tightdb/objc/table.h b/src/tightdb/objc/table.h index 63112d8d89..85903b70c0 100644 --- a/src/tightdb/objc/table.h +++ b/src/tightdb/objc/table.h @@ -20,7 +20,7 @@ #import -#include +#include @class Table; @class TableView; @@ -49,7 +49,7 @@ +(OCMixed *)mixedWithDate:(OCDate *)date; +(OCMixed *)mixedWithTable:(Table *)table; -(BOOL)isEqual:(OCMixed *)other; --(TightdbColumnType)getType; +-(TightdbDataType)getType; -(int64_t)getInt; -(BOOL)getBool; -(OCDate *)getDate; @@ -61,12 +61,12 @@ @interface OCSpec : NSObject /// Returns NO on memory allocation error. --(BOOL)addColumn:(TightdbColumnType)type name:(NSString *)name; +-(BOOL)addColumn:(TightdbDataType)type name:(NSString *)name; /// Returns nil on memory allocation error. -(OCSpec *)addColumnTable:(NSString *)name; -(OCSpec *)getSpec:(size_t)columnId; -(size_t)getColumnCount; --(TightdbColumnType)getColumnType:(size_t)ndx; +-(TightdbDataType)getColumnType:(size_t)ndx; -(NSString *)getColumnName:(size_t)ndx; -(size_t)getColumnIndex:(NSString *)name; @end @@ -110,7 +110,7 @@ -(size_t)getColumnCount; -(NSString *)getColumnName:(size_t)ndx; -(size_t)getColumnIndex:(NSString *)name; --(TightdbColumnType)getColumnType:(size_t)ndx; +-(TightdbDataType)getColumnType:(size_t)ndx; -(OCSpec *)getSpec; -(BOOL)isEmpty; -(size_t)count; @@ -151,11 +151,11 @@ // Mixed -(OCMixed *)getMixed:(size_t)columnId ndx:(size_t)ndx; --(TightdbColumnType)getMixedType:(size_t)columnId ndx:(size_t)ndx; +-(TightdbDataType)getMixedType:(size_t)columnId ndx:(size_t)ndx; -(void)insertMixed:(size_t)columnId ndx:(size_t)ndx value:(OCMixed *)value; -(void)setMixed:(size_t)columnId ndx:(size_t)ndx value:(OCMixed *)value; --(size_t)addColumn:(TightdbColumnType)type name:(NSString *)name; +-(size_t)addColumn:(TightdbDataType)type name:(NSString *)name; // Searching -(size_t)findBool:(size_t)columnId value:(BOOL)value; diff --git a/src/tightdb/objc/table_objc.mm b/src/tightdb/objc/table_objc.mm index 7de7ae516d..50645e6db0 100644 --- a/src/tightdb/objc/table_objc.mm +++ b/src/tightdb/objc/table_objc.mm @@ -173,29 +173,29 @@ -(BOOL)isEqual:(OCMixed *)other const tightdb::ColumnType type = _mixed.get_type(); if (type != other->_mixed.get_type()) return NO; switch (type) { - case tightdb::COLUMN_TYPE_BOOL: + case tightdb::type_Bool: return _mixed.get_bool() == other->_mixed.get_bool(); - case tightdb::COLUMN_TYPE_INT: + case tightdb::type_Int: return _mixed.get_int() == other->_mixed.get_int(); - case tightdb::COLUMN_TYPE_STRING: + case tightdb::type_String: return std::strcmp(_mixed.get_string(), other->_mixed.get_string()) == 0; - case tightdb::COLUMN_TYPE_BINARY: + case tightdb::type_Binary: return _mixed.get_binary().compare_payload(other->_mixed.get_binary()); - case tightdb::COLUMN_TYPE_DATE: + case tightdb::type_Date: return _mixed.get_date() == other->_mixed.get_date(); - case tightdb::COLUMN_TYPE_TABLE: + case tightdb::type_Table: return [_table getTable] == [other->_table getTable]; // Compare table contents break; - default: + case tightdb::type_Mixed: TIGHTDB_ASSERT(false); break; } return NO; } --(TightdbColumnType)getType +-(TightdbDataType)getType { - return (TightdbColumnType)_mixed.get_type(); + return (TightdbDataType)_mixed.get_type(); } -(int64_t)getInt { @@ -255,7 +255,7 @@ +(OCSpec *)specWithSpec:(tightdb::Spec *)other isOwned:(BOOL)isOwned // FIXME: Provide a version of this method that takes a 'const char *'. This will simplify _addColumns of MyTable. // FIXME: Detect errors from core library --(BOOL)addColumn:(TightdbColumnType)type name:(NSString *)name +-(BOOL)addColumn:(TightdbDataType)type name:(NSString *)name { _spec->add_column((tightdb::ColumnType)type, [name UTF8String]); return YES; @@ -279,9 +279,9 @@ -(size_t)getColumnCount { return _spec->get_column_count(); } --(TightdbColumnType)getColumnType:(size_t)ndx +-(TightdbDataType)getColumnType:(size_t)ndx { - return (TightdbColumnType)_spec->get_column_type(ndx); + return (TightdbDataType)_spec->get_column_type(ndx); } -(NSString *)getColumnName:(size_t)ndx { @@ -507,7 +507,7 @@ -(void)setReadOnly:(BOOL)readOnly -(Table *)getSubtable:(size_t)columnId ndx:(size_t)ndx { const tightdb::ColumnType t = _table->get_column_type(columnId); - if (t != tightdb::COLUMN_TYPE_TABLE && t != tightdb::COLUMN_TYPE_MIXED) return nil; + if (t != tightdb::type_Table && t != tightdb::type_Mixed) return nil; tightdb::TableRef r = _table->get_subtable(columnId, ndx); if (!r) return nil; Table *table = [[Table alloc] _initRaw]; @@ -522,7 +522,7 @@ -(Table *)getSubtable:(size_t)columnId ndx:(size_t)ndx -(id)getSubtable:(size_t)columnId ndx:(size_t)ndx withClass:(__unsafe_unretained Class)classObj { const tightdb::ColumnType t = _table->get_column_type(columnId); - if (t != tightdb::COLUMN_TYPE_TABLE && t != tightdb::COLUMN_TYPE_MIXED) return nil; + if (t != tightdb::type_Table && t != tightdb::type_Mixed) return nil; tightdb::TableRef r = _table->get_subtable(columnId, ndx); if (!r) return nil; Table *table = [[classObj alloc] _initRaw]; @@ -580,9 +580,9 @@ -(size_t)getColumnIndex:(NSString *)name { return _table->get_column_index([name UTF8String]); } --(TightdbColumnType)getColumnType:(size_t)ndx +-(TightdbDataType)getColumnType:(size_t)ndx { - return (TightdbColumnType)_table->get_column_type(ndx); + return (TightdbDataType)_table->get_column_type(ndx); } -(OCSpec *)getSpec { @@ -739,15 +739,15 @@ -(OCMixed *)getMixed:(size_t)columnId ndx:(size_t)ndx { tightdb::Mixed tmp = _table->get_mixed(columnId, ndx); OCMixed *mixed = [OCMixed mixedWithMixed:tmp]; - if ([mixed getType] == TIGHTDB_COLUMN_TYPE_TABLE) { + if ([mixed getType] == tightdb_Table) { [mixed setTable:[self getSubtable:columnId ndx:ndx]]; } return mixed; } --(TightdbColumnType)getMixedType:(size_t)columnId ndx:(size_t)ndx +-(TightdbDataType)getMixedType:(size_t)columnId ndx:(size_t)ndx { - return (TightdbColumnType)_table->get_mixed_type(columnId, ndx); + return (TightdbDataType)_table->get_mixed_type(columnId, ndx); } -(void)insertMixed:(size_t)columnId ndx:(size_t)ndx value:(OCMixed *)value @@ -765,7 +765,7 @@ -(void)setMixed:(size_t)columnId ndx:(size_t)ndx value:(OCMixed *)value // FIXME: Insert copy of subtable if type is table } --(size_t)addColumn:(TightdbColumnType)type name:(NSString *)name +-(size_t)addColumn:(TightdbDataType)type name:(NSString *)name { return _table->add_column((tightdb::ColumnType)type, [name UTF8String]); } diff --git a/src/tightdb/objc/test/Makefile b/src/tightdb/objc/test/Makefile index c68c6f095a..6bcb4156fa 100644 --- a/src/tightdb/objc/test/Makefile +++ b/src/tightdb/objc/test/Makefile @@ -2,7 +2,7 @@ TEST_PROGRAMS = unit-tests XCODE_HOME = $(shell xcode-select --print-path) -unit_tests_SOURCES = column_type.mm table.m group.m group_misc_2.m table_delete_all.m tutorial.m enumerator.m get_subtable.m subtable.m mixed.m shared_group.m +unit_tests_SOURCES = data_type.mm table.m group.m group_misc_2.m table_delete_all.m tutorial.m enumerator.m get_subtable.m subtable.m mixed.m shared_group.m unit_tests_CFLAGS = -Wno-comment -fobjc-arc -fobjc-abi-version=2 -F$(XCODE_HOME)/Library/Frameworks unit_tests_LDFLAGS = -bundle -fobjc-link-runtime -F$(XCODE_HOME)/Library/Frameworks -framework Cocoa -framework SenTestingKit unit_tests_LIBS = ../libtightdb-objc.a diff --git a/src/tightdb/objc/test/column_type.mm b/src/tightdb/objc/test/column_type.mm deleted file mode 100644 index 9655c55e2d..0000000000 --- a/src/tightdb/objc/test/column_type.mm +++ /dev/null @@ -1,28 +0,0 @@ -// -// column_type.mm -// TightDB -// -// Check that column type enumeration values are in synch with the core library -// - -#import - -#import -#import - -@interface TestColumnType : SenTestCase -@end -@implementation TestColumnType - -- (void)testColumnType -{ - STAssertEquals((int)TIGHTDB_COLUMN_TYPE_BOOL, (int)tightdb::COLUMN_TYPE_BOOL, @"Bool"); - STAssertEquals((int)TIGHTDB_COLUMN_TYPE_INT, (int)tightdb::COLUMN_TYPE_INT, @"Int"); - STAssertEquals((int)TIGHTDB_COLUMN_TYPE_STRING, (int)tightdb::COLUMN_TYPE_STRING, @"String"); - STAssertEquals((int)TIGHTDB_COLUMN_TYPE_BINARY, (int)tightdb::COLUMN_TYPE_BINARY, @"Binary"); - STAssertEquals((int)TIGHTDB_COLUMN_TYPE_DATE, (int)tightdb::COLUMN_TYPE_DATE, @"Date"); - STAssertEquals((int)TIGHTDB_COLUMN_TYPE_TABLE, (int)tightdb::COLUMN_TYPE_TABLE, @"Table"); - STAssertEquals((int)TIGHTDB_COLUMN_TYPE_MIXED, (int)tightdb::COLUMN_TYPE_MIXED, @"Mixed"); -} - -@end diff --git a/src/tightdb/objc/test/data_type.mm b/src/tightdb/objc/test/data_type.mm new file mode 100644 index 0000000000..e4f3e2c0cb --- /dev/null +++ b/src/tightdb/objc/test/data_type.mm @@ -0,0 +1,28 @@ +// +// data_type.mm +// TightDB +// +// Check that data type enumeration values are in synch with the core library +// + +#import + +#import +#import + +@interface TestDataType : SenTestCase +@end +@implementation TestDataType + +- (void)testDataType +{ + STAssertEquals((int)tightdb_Bool, (int)tightdb::type_Bool, @"Bool"); + STAssertEquals((int)tightdb_Int, (int)tightdb::type_Int, @"Int"); + STAssertEquals((int)tightdb_String, (int)tightdb::type_String, @"String"); + STAssertEquals((int)tightdb_Binary, (int)tightdb::type_Binary, @"Binary"); + STAssertEquals((int)tightdb_Date, (int)tightdb::type_Date, @"Date"); + STAssertEquals((int)tightdb_Table, (int)tightdb::type_Table, @"Table"); + STAssertEquals((int)tightdb_Mixed, (int)tightdb::type_Mixed, @"Mixed"); +} + +@end diff --git a/src/tightdb/objc/test/get_subtable.m b/src/tightdb/objc/test/get_subtable.m index 6039375061..ab82a36e81 100644 --- a/src/tightdb/objc/test/get_subtable.m +++ b/src/tightdb/objc/test/get_subtable.m @@ -34,11 +34,11 @@ - (void)testGetSubtable // Create table with all column types Table *table = [[Table alloc] init]; OCSpec *s = [table getSpec]; - [s addColumn:TIGHTDB_COLUMN_TYPE_BOOL name:@"Outer"]; - [s addColumn:TIGHTDB_COLUMN_TYPE_INT name:@"Number"]; + [s addColumn:tightdb_Bool name:@"Outer"]; + [s addColumn:tightdb_Int name:@"Number"]; OCSpec *sub = [s addColumnTable:@"GetSubtable"]; - [sub addColumn:TIGHTDB_COLUMN_TYPE_BOOL name:@"Hired"]; - [sub addColumn:TIGHTDB_COLUMN_TYPE_INT name:@"Age"]; + [sub addColumn:tightdb_Bool name:@"Hired"]; + [sub addColumn:tightdb_Int name:@"Age"]; [table updateFromSpec]; [table insertBool:0 ndx:0 value:NO]; diff --git a/src/tightdb/objc/test/group_misc_2.m b/src/tightdb/objc/test/group_misc_2.m index c795db6fe0..c1208c7b19 100644 --- a/src/tightdb/objc/test/group_misc_2.m +++ b/src/tightdb/objc/test/group_misc_2.m @@ -198,12 +198,12 @@ - (void)testSubtables // Specify the table schema { OCSpec *s = [table getSpec]; - [s addColumn:TIGHTDB_COLUMN_TYPE_INT name:@"int"]; + [s addColumn:tightdb_Int name:@"int"]; { OCSpec *sub = [s addColumnTable:@"tab"]; - [sub addColumn:TIGHTDB_COLUMN_TYPE_INT name:@"int"]; + [sub addColumn:tightdb_Int name:@"int"]; } - [s addColumn:TIGHTDB_COLUMN_TYPE_MIXED name:@"mix"]; + [s addColumn:tightdb_Mixed name:@"mix"]; [table updateFromSpec]; } @@ -231,7 +231,7 @@ - (void)testSubtables OCTopLevelTable *subtable2 = [table getTopLevelTable:COL_TABLE_MIX ndx:0]; { OCSpec *s = [subtable2 getSpec]; - [s addColumn:TIGHTDB_COLUMN_TYPE_INT name:@"int"]; + [s addColumn:tightdb_Int name:@"int"]; [subtable2 updateFromSpec:[s getRef]]; } // Add a row to it diff --git a/src/tightdb/objc/test/mixed.m b/src/tightdb/objc/test/mixed.m index 0b18710e66..be75c8323b 100644 --- a/src/tightdb/objc/test/mixed.m +++ b/src/tightdb/objc/test/mixed.m @@ -180,13 +180,13 @@ - (void)testMixed NSLog(@"%zu: %@", i, cursor.Other); NSLog(@"Type: %i", [cursor.Other getType] ); sumType += [cursor.Other getType]; - if ([cursor.Other getType] == TIGHTDB_COLUMN_TYPE_STRING) + if ([cursor.Other getType] == tightdb_String) NSLog(@"StringMixed: %@", [cursor.Other getString]); - else if ([cursor.Other getType] == TIGHTDB_COLUMN_TYPE_DATE) { + else if ([cursor.Other getType] == tightdb_Date) { NSLog(@"DateMixed: %ld", [[cursor.Other getDate] getDate]); STAssertEquals(nowTime, [[cursor.Other getDate] getDate],@"Date should match what went in"); } - else if ([cursor.Other getType] == TIGHTDB_COLUMN_TYPE_TABLE) { + else if ([cursor.Other getType] == tightdb_Table) { NSLog(@"TableMixed: %@", [cursor.Other getTable]); } } diff --git a/src/tightdb/objc/test/table.m b/src/tightdb/objc/test/table.m index ef905e7795..a4975c2f0c 100644 --- a/src/tightdb/objc/test/table.m +++ b/src/tightdb/objc/test/table.m @@ -36,12 +36,12 @@ - (void)tearDown - (void)testTable { // 1. Add two columns - [_table addColumn:TIGHTDB_COLUMN_TYPE_INT name:@"first"]; - [_table addColumn:TIGHTDB_COLUMN_TYPE_INT name:@"second"]; + [_table addColumn:tightdb_Int name:@"first"]; + [_table addColumn:tightdb_Int name:@"second"]; // Verify - STAssertEquals(TIGHTDB_COLUMN_TYPE_INT, [_table getColumnType:0], @"First column not int"); - STAssertEquals(TIGHTDB_COLUMN_TYPE_INT, [_table getColumnType:1], @"Second column not int"); + STAssertEquals(tightdb_Int, [_table getColumnType:0], @"First column not int"); + STAssertEquals(tightdb_Int, [_table getColumnType:1], @"Second column not int"); if (![[_table getColumnName:0] isEqualToString:@"first"]) STFail(@"First not equal to first"); if (![[_table getColumnName:1] isEqualToString:@"second"]) diff --git a/src/tightdb/objc/test/table_delete_all.m b/src/tightdb/objc/test/table_delete_all.m index 84d667b6e7..1b79416989 100644 --- a/src/tightdb/objc/test/table_delete_all.m +++ b/src/tightdb/objc/test/table_delete_all.m @@ -16,17 +16,17 @@ -(void)testTableDeleteAll // Create table with all column types Table *table = [[Table alloc] init]; OCSpec *s = [table getSpec]; - [s addColumn:TIGHTDB_COLUMN_TYPE_INT name:@"int"]; - [s addColumn:TIGHTDB_COLUMN_TYPE_BOOL name:@"bool"]; - [s addColumn:TIGHTDB_COLUMN_TYPE_DATE name:@"date"]; - [s addColumn:TIGHTDB_COLUMN_TYPE_STRING name:@"string"]; - [s addColumn:TIGHTDB_COLUMN_TYPE_STRING name:@"string_long"]; - [s addColumn:TIGHTDB_COLUMN_TYPE_STRING name:@"string_enum"]; - [s addColumn:TIGHTDB_COLUMN_TYPE_BINARY name:@"binary"]; - [s addColumn:TIGHTDB_COLUMN_TYPE_MIXED name:@"mixed"]; + [s addColumn:tightdb_Int name:@"int"]; + [s addColumn:tightdb_Bool name:@"bool"]; + [s addColumn:tightdb_Date name:@"date"]; + [s addColumn:tightdb_String name:@"string"]; + [s addColumn:tightdb_String name:@"string_long"]; + [s addColumn:tightdb_String name:@"string_enum"]; + [s addColumn:tightdb_Binary name:@"binary"]; + [s addColumn:tightdb_Mixed name:@"mixed"]; OCSpec *sub = [s addColumnTable:@"tables"]; - [sub addColumn:TIGHTDB_COLUMN_TYPE_INT name:@"sub_first"]; - [sub addColumn:TIGHTDB_COLUMN_TYPE_STRING name:@"sub_second"]; + [sub addColumn:tightdb_Int name:@"sub_first"]; + [sub addColumn:tightdb_String name:@"sub_second"]; [table updateFromSpec]; // Add some rows From d0b91b0650d79ef3793a17ee74d6e90c016cc2b1 Mon Sep 17 00:00:00 2001 From: Kristian Spangsege Date: Thu, 7 Feb 2013 02:58:08 +0100 Subject: [PATCH 2/2] Fixes for: Tracking changes in core library --- src/tightdb/objc/table_objc.mm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tightdb/objc/table_objc.mm b/src/tightdb/objc/table_objc.mm index 50645e6db0..01b259c55a 100644 --- a/src/tightdb/objc/table_objc.mm +++ b/src/tightdb/objc/table_objc.mm @@ -170,7 +170,7 @@ +(OCMixed *)mixedWithBinary:(const char*)value length:(size_t)length -(BOOL)isEqual:(OCMixed *)other { - const tightdb::ColumnType type = _mixed.get_type(); + const tightdb::DataType type = _mixed.get_type(); if (type != other->_mixed.get_type()) return NO; switch (type) { case tightdb::type_Bool: @@ -257,7 +257,7 @@ +(OCSpec *)specWithSpec:(tightdb::Spec *)other isOwned:(BOOL)isOwned // FIXME: Detect errors from core library -(BOOL)addColumn:(TightdbDataType)type name:(NSString *)name { - _spec->add_column((tightdb::ColumnType)type, [name UTF8String]); + _spec->add_column((tightdb::DataType)type, [name UTF8String]); return YES; } @@ -506,7 +506,7 @@ -(void)setReadOnly:(BOOL)readOnly -(Table *)getSubtable:(size_t)columnId ndx:(size_t)ndx { - const tightdb::ColumnType t = _table->get_column_type(columnId); + const tightdb::DataType t = _table->get_column_type(columnId); if (t != tightdb::type_Table && t != tightdb::type_Mixed) return nil; tightdb::TableRef r = _table->get_subtable(columnId, ndx); if (!r) return nil; @@ -521,7 +521,7 @@ -(Table *)getSubtable:(size_t)columnId ndx:(size_t)ndx // FIXME: Check that the specified class derives from Table. -(id)getSubtable:(size_t)columnId ndx:(size_t)ndx withClass:(__unsafe_unretained Class)classObj { - const tightdb::ColumnType t = _table->get_column_type(columnId); + const tightdb::DataType t = _table->get_column_type(columnId); if (t != tightdb::type_Table && t != tightdb::type_Mixed) return nil; tightdb::TableRef r = _table->get_subtable(columnId, ndx); if (!r) return nil; @@ -767,7 +767,7 @@ -(void)setMixed:(size_t)columnId ndx:(size_t)ndx value:(OCMixed *)value -(size_t)addColumn:(TightdbDataType)type name:(NSString *)name { - return _table->add_column((tightdb::ColumnType)type, [name UTF8String]); + return _table->add_column((tightdb::DataType)type, [name UTF8String]); } -(size_t)findBool:(size_t)columnId value:(BOOL)value {