Skip to content

Commit

Permalink
Merge pull request ccgus#651 from PaxLabs/schema-nullability
Browse files Browse the repository at this point in the history
Update nullability annotations for `-[FMDatabase getSchema]` and `-[FMDatabase getTableSchema]`
  • Loading branch information
ccgus authored Mar 1, 2018
2 parents 240667c + d0fbec4 commit fa03304
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/fmdb/FMDatabaseAdditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ NS_ASSUME_NONNULL_BEGIN
@see [SQLite File Format](http://www.sqlite.org/fileformat.html)
*/

- (FMResultSet *)getSchema;
- (FMResultSet * _Nullable)getSchema;

/** The schema of the database.
Expand All @@ -166,7 +166,7 @@ NS_ASSUME_NONNULL_BEGIN
@see [table_info](http://www.sqlite.org/pragma.html#pragma_table_info)
*/

- (FMResultSet*)getTableSchema:(NSString*)tableName;
- (FMResultSet * _Nullable)getTableSchema:(NSString*)tableName;

/** Test to see if particular column exists for particular table in database
Expand Down
4 changes: 2 additions & 2 deletions src/fmdb/FMDatabaseAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ - (BOOL)tableExists:(NSString*)tableName {
get table with list of tables: result colums: type[STRING], name[STRING],tbl_name[STRING],rootpage[INTEGER],sql[STRING]
check if table exist in database (patch from OZLB)
*/
- (FMResultSet*)getSchema {
- (FMResultSet * _Nullable)getSchema {

//result colums: type[STRING], name[STRING],tbl_name[STRING],rootpage[INTEGER],sql[STRING]
FMResultSet *rs = [self executeQuery:@"SELECT type, name, tbl_name, rootpage, sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type != 'meta' AND name NOT LIKE 'sqlite_%' ORDER BY tbl_name, type DESC, name"];
Expand All @@ -93,7 +93,7 @@ - (FMResultSet*)getSchema {
/*
get table schema: result colums: cid[INTEGER], name,type [STRING], notnull[INTEGER], dflt_value[],pk[INTEGER]
*/
- (FMResultSet*)getTableSchema:(NSString*)tableName {
- (FMResultSet * _Nullable)getTableSchema:(NSString*)tableName {

//result colums: cid[INTEGER], name,type [STRING], notnull[INTEGER], dflt_value[],pk[INTEGER]
FMResultSet *rs = [self executeQuery:[NSString stringWithFormat: @"pragma table_info('%@')", tableName]];
Expand Down

0 comments on commit fa03304

Please sign in to comment.