Skip to content

Commit

Permalink
New 2.0 release, lots of changes, see CHANGELOG for more
Browse files Browse the repository at this point in the history
  • Loading branch information
shnhrrsn authored and tvgeng committed Feb 4, 2014
1 parent 8bbeede commit 93b4de5
Show file tree
Hide file tree
Showing 18 changed files with 596 additions and 492 deletions.
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Xcode
.DS_Store
*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap

#CocoaPods
Pods
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EGODatabase CHANGELOG

## 1.0 (2009)

Initial release.

## 2.0 (Feb 2, 2014)

* Updated code to Modern Objective-C (ARC, auto-synthesize, auto-boxing, etc.)
* Added new -[EGODatabase execute:] method to easily run low level sqlite calls
* Added -[EGODatabaseResult firstRow] and -[EGODatabaseResult lastRow]
* Replaced NSLock usage with dispatch_semaphor, which gives us a free performance boost
* Removed EGODatabaseRequestDelegate in favor of new completion property on EGODatabaseRequest
* Renamed all -[EGODatabaseRow xxForColumnIndex:] methdos to -[EGODatabaseRow xxForColumnAtIndex:]
* Moved internal methods out of public headers
* Minor other improvements
32 changes: 12 additions & 20 deletions EGODatabase.h → Classes/EGODatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// EGODatabase.h
// EGODatabase
//
// Created by Shaun Harrison on 3/6/09.
// Copyright (c) 2009 enormego
// Copyright (c) 2009-2014 Enormego, Shaun Harrison
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand All @@ -25,35 +24,29 @@
//

#import <Foundation/Foundation.h>
#import <sqlite3.h>

#import "EGODatabaseRequest.h"
#import "EGODatabaseResult.h"
#import "EGODatabaseRow.h"
#import <sqlite3.h>

@interface EGODatabase : NSObject

@interface EGODatabase : NSObject {
@protected
NSString* databasePath;
NSLock* executeLock;

@private
sqlite3* handle;
BOOL opened;
}

+ (id)databaseWithPath:(NSString*)aPath;
- (id)initWithPath:(NSString*)aPath;
+ (instancetype)databaseWithPath:(NSString*)aPath;
- (instancetype)initWithPath:(NSString*)aPath;

- (BOOL)open;
- (void)close;

@property(nonatomic,readonly) sqlite3* sqliteHandle;

// Execute Updates
- (BOOL)executeUpdateWithParameters:(NSString*)sql, ... NS_REQUIRES_NIL_TERMINATION;

- (BOOL)executeUpdate:(NSString*)sql;
- (BOOL)executeUpdate:(NSString*)sql parameters:(NSArray*)parameters;

- (sqlite3_int64)last_insert_rowid;
- (sqlite3_int64)lastInsertRowId;

// Execute Query
- (EGODatabaseResult*)executeQueryWithParameters:(NSString*)sql, ... NS_REQUIRES_NIL_TERMINATION;
Expand All @@ -62,24 +55,23 @@
- (EGODatabaseResult*)executeQuery:(NSString*)sql parameters:(NSArray*)parameters;

// Query request operation

- (EGODatabaseRequest*)requestWithQueryAndParameters:(NSString*)sql, ... NS_REQUIRES_NIL_TERMINATION;

- (EGODatabaseRequest*)requestWithQuery:(NSString*)sql;
- (EGODatabaseRequest*)requestWithQuery:(NSString*)sql parameters:(NSArray*)parameters;

// Update request operation

- (EGODatabaseRequest*)requestWithUpdateAndParameters:(NSString*)sql, ... NS_REQUIRES_NIL_TERMINATION;

- (EGODatabaseRequest*)requestWithUpdate:(NSString*)sql;
- (EGODatabaseRequest*)requestWithUpdate:(NSString*)sql parameters:(NSArray*)parameters;

// Error methods
// Execute raw sqlite calls, with thread safe lock protection. Do not nest, as it will cause a deadlock.
- (void)execute:(void(^)(sqlite3*))block;

// Error methods
- (NSString*)lastErrorMessage;
- (BOOL)hadError;
- (int)lastErrorCode;

@property(nonatomic,readonly) sqlite3* sqliteHandle;
@end
Loading

1 comment on commit 93b4de5

@johndpope
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Shaun,

Thanks for your efforts and updates on this library.
I'm trying to work out why one of my batch inserts isn't working and thought I'd enable the logging.
EGODBLockLog 1
but when I do - it kicks back a lot errors around use of undeclared identifier sql.
You also have an md5 value on nsstring which I don't think is referenced in this library anywhere.

Please sign in to comment.