PageRenderTime 43ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/fmdb/FMResultSet.h

http://github.com/petewarden/iPhoneTracker
C Header | 93 lines | 59 code | 28 blank | 6 comment | 0 complexity | d846649be502cc0aff0e4b8007c3498f MD5 | raw file
  1. #import <Foundation/Foundation.h>
  2. #import "sqlite3.h"
  3. #ifndef __has_feature // Optional.
  4. #define __has_feature(x) 0 // Compatibility with non-clang compilers.
  5. #endif
  6. #ifndef NS_RETURNS_NOT_RETAINED
  7. #if __has_feature(attribute_ns_returns_not_retained)
  8. #define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained))
  9. #else
  10. #define NS_RETURNS_NOT_RETAINED
  11. #endif
  12. #endif
  13. @class FMDatabase;
  14. @class FMStatement;
  15. @interface FMResultSet : NSObject {
  16. FMDatabase *parentDB;
  17. FMStatement *statement;
  18. NSString *query;
  19. NSMutableDictionary *columnNameToIndexMap;
  20. BOOL columnNamesSetup;
  21. }
  22. + (id)resultSetWithStatement:(FMStatement *)statement usingParentDatabase:(FMDatabase*)aDB;
  23. - (void)close;
  24. - (NSString *)query;
  25. - (void)setQuery:(NSString *)value;
  26. - (FMStatement *)statement;
  27. - (void)setStatement:(FMStatement *)value;
  28. - (void)setParentDB:(FMDatabase *)newDb;
  29. - (BOOL)next;
  30. - (BOOL)hasAnotherRow;
  31. - (int)columnIndexForName:(NSString*)columnName;
  32. - (NSString*)columnNameForIndex:(int)columnIdx;
  33. - (int)intForColumn:(NSString*)columnName;
  34. - (int)intForColumnIndex:(int)columnIdx;
  35. - (long)longForColumn:(NSString*)columnName;
  36. - (long)longForColumnIndex:(int)columnIdx;
  37. - (long long int)longLongIntForColumn:(NSString*)columnName;
  38. - (long long int)longLongIntForColumnIndex:(int)columnIdx;
  39. - (BOOL)boolForColumn:(NSString*)columnName;
  40. - (BOOL)boolForColumnIndex:(int)columnIdx;
  41. - (double)doubleForColumn:(NSString*)columnName;
  42. - (double)doubleForColumnIndex:(int)columnIdx;
  43. - (NSString*)stringForColumn:(NSString*)columnName;
  44. - (NSString*)stringForColumnIndex:(int)columnIdx;
  45. - (NSDate*)dateForColumn:(NSString*)columnName;
  46. - (NSDate*)dateForColumnIndex:(int)columnIdx;
  47. - (NSData*)dataForColumn:(NSString*)columnName;
  48. - (NSData*)dataForColumnIndex:(int)columnIdx;
  49. - (const unsigned char *)UTF8StringForColumnIndex:(int)columnIdx;
  50. - (const unsigned char *)UTF8StringForColumnName:(NSString*)columnName;
  51. // returns one of NSNumber, NSString, NSData, or NSNull
  52. - (id)objectForColumnIndex:(int)columnIdx;
  53. - (id)objectForColumnName:(NSString*)columnName;
  54. /*
  55. If you are going to use this data after you iterate over the next row, or after you close the
  56. result set, make sure to make a copy of the data first (or just use dataForColumn:/dataForColumnIndex:)
  57. If you don't, you're going to be in a world of hurt when you try and use the data.
  58. */
  59. - (NSData*)dataNoCopyForColumn:(NSString*)columnName NS_RETURNS_NOT_RETAINED;
  60. - (NSData*)dataNoCopyForColumnIndex:(int)columnIdx NS_RETURNS_NOT_RETAINED;
  61. - (BOOL)columnIndexIsNull:(int)columnIdx;
  62. - (BOOL)columnIsNull:(NSString*)columnName;
  63. - (void)kvcMagic:(id)object;
  64. - (NSDictionary *)resultDict;
  65. @end