Skip to content

Commit

Permalink
重新整理文件路径
Browse files Browse the repository at this point in the history
重新整理文件路径
  • Loading branch information
huangzhibiao committed Mar 10, 2017
1 parent 7df5eca commit 366264d
Show file tree
Hide file tree
Showing 27 changed files with 398 additions and 209 deletions.
Binary file modified .DS_Store
Binary file not shown.
6 changes: 3 additions & 3 deletions BGFMDB.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ Pod::Spec.new do |s|
# Not including the public_header_files will make all headers public.
#

s.source_files = "BGFMDB/BGFMDB/*.{h,m}"
s.source_files = "BGFMDB/BGFMDB/libs/FMDB/*.{h,m}","BGFMDB/BGFMDB/*.{h,m}"
#s.exclude_files = "BGFMDB/BGFMDB/libs"

#s.public_header_files = "BGFMDB/BGFMDB/*.h"
#s.public_header_files = "BGFMDB/BGFMDB/libs/FMDB/FMDB.h"


# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
Expand Down Expand Up @@ -132,7 +132,7 @@ Pod::Spec.new do |s|

s.requires_arc = true

# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/lib/libsqlite3.dylib" }
# s.dependency "JSONKit", "~> 1.4"

end
148 changes: 73 additions & 75 deletions BGFMDB.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Binary file not shown.
Binary file modified BGFMDB/.DS_Store
Binary file not shown.
Binary file removed BGFMDB/BGFMDB/.DS_Store
Binary file not shown.
5 changes: 0 additions & 5 deletions BGFMDB/BGFMDB/libs/FMDB/FMDB.h

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion BGFMDB/BGFMDB/BGTool.h → BGFMDB/libs/BGTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#import <Foundation/Foundation.h>
#import "BGModelInfo.h"
#import "./libs/FMDB/FMDB.h"
#import "FMDB.h"

#define SQLITE_NAME @"BGFMDB.sqlite"

Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions BGFMDB/libs/FMDB.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#import <Foundation/Foundation.h>

FOUNDATION_EXPORT double FMDBVersionNumber;
FOUNDATION_EXPORT const unsigned char FMDBVersionString[];

#import "FMDatabase.h"
#import "FMResultSet.h"
#import "FMDatabaseAdditions.h"
#import "FMDatabaseQueue.h"
#import "FMDatabasePool.h"
125 changes: 102 additions & 23 deletions BGFMDB/BGFMDB/libs/FMDB/FMDatabase.h → BGFMDB/libs/FMDatabase.h
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#import <Foundation/Foundation.h>
#import "sqlite3.h"
#import "FMResultSet.h"
#import "FMDatabasePool.h"

Expand Down Expand Up @@ -73,7 +72,7 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary

@interface FMDatabase : NSObject {

sqlite3* _db;
void* _db;
NSString* _databasePath;
BOOL _logsErrors;
BOOL _crashOnErrors;
Expand Down Expand Up @@ -194,7 +193,7 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary

- (BOOL)open;

/** Opening a new database connection with flags
/** Opening a new database connection with flags and an optional virtual file system (VFS)
@param flags one of the following three values, optionally combined with the `SQLITE_OPEN_NOMUTEX`, `SQLITE_OPEN_FULLMUTEX`, `SQLITE_OPEN_SHAREDCACHE`, `SQLITE_OPEN_PRIVATECACHE`, and/or `SQLITE_OPEN_URI` flags:
Expand All @@ -209,17 +208,42 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary
`SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE`
The database is opened for reading and writing, and is created if it does not already exist. This is the behavior that is always used for `open` method.
@return `YES` if successful, `NO` on error.
@see [sqlite3_open_v2()](http://sqlite.org/c3ref/open.html)
@see open
@see close
*/

#if SQLITE_VERSION_NUMBER >= 3005000
- (BOOL)openWithFlags:(int)flags;
#endif

/** Opening a new database connection with flags and an optional virtual file system (VFS)
@param flags one of the following three values, optionally combined with the `SQLITE_OPEN_NOMUTEX`, `SQLITE_OPEN_FULLMUTEX`, `SQLITE_OPEN_SHAREDCACHE`, `SQLITE_OPEN_PRIVATECACHE`, and/or `SQLITE_OPEN_URI` flags:
`SQLITE_OPEN_READONLY`
The database is opened in read-only mode. If the database does not already exist, an error is returned.
`SQLITE_OPEN_READWRITE`
The database is opened for reading and writing if possible, or reading only if the file is write protected by the operating system. In either case the database must already exist, otherwise an error is returned.
`SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE`
The database is opened for reading and writing, and is created if it does not already exist. This is the behavior that is always used for `open` method.
@param vfsName If vfs is given the value is passed to the vfs parameter of sqlite3_open_v2.
@return `YES` if successful, `NO` on error.
@see [sqlite3_open_v2()](http://sqlite.org/c3ref/open.html)
@see open
@see close
*/

- (BOOL)openWithFlags:(int)flags vfs:(NSString *)vfsName;

/** Closing a database connection
Expand Down Expand Up @@ -333,23 +357,52 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary
- (BOOL)executeUpdateWithFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2);

/** Execute single update statement
This method executes a single SQL update statement (i.e. any SQL that does not return results, such as `UPDATE`, `INSERT`, or `DELETE`. This method employs [`sqlite3_prepare_v2`](http://sqlite.org/c3ref/prepare.html) and [`sqlite3_bind`](http://sqlite.org/c3ref/bind_blob.html) binding any `?` placeholders in the SQL with the optional list of parameters.
The optional values provided to this method should be objects (e.g. `NSString`, `NSNumber`, `NSNull`, `NSDate`, and `NSData` objects), not fundamental data types (e.g. `int`, `long`, `NSInteger`, etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's `description` method.
@param sql The SQL to be performed, with optional `?` placeholders.
@param arguments A `NSArray` of objects to be used when binding values to the `?` placeholders in the SQL statement.
@return `YES` upon success; `NO` upon failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
@see executeUpdate:values:error:
@see lastError
@see lastErrorCode
@see lastErrorMessage
*/

- (BOOL)executeUpdate:(NSString*)sql withArgumentsInArray:(NSArray *)arguments;

/** Execute single update statement
This method executes a single SQL update statement (i.e. any SQL that does not return results, such as `UPDATE`, `INSERT`, or `DELETE`. This method employs [`sqlite3_prepare_v2`](http://sqlite.org/c3ref/prepare.html) and [`sqlite3_bind`](http://sqlite.org/c3ref/bind_blob.html) binding any `?` placeholders in the SQL with the optional list of parameters.
The optional values provided to this method should be objects (e.g. `NSString`, `NSNumber`, `NSNull`, `NSDate`, and `NSData` objects), not fundamental data types (e.g. `int`, `long`, `NSInteger`, etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's `description` method.
This is similar to `<executeUpdate:withArgumentsInArray:>`, except that this also accepts a pointer to a `NSError` pointer, so that errors can be returned.
In Swift 2, this throws errors, as if it were defined as follows:
`func executeUpdate(sql: String!, values: [AnyObject]!) throws -> Bool`
@param sql The SQL to be performed, with optional `?` placeholders.
@param values A `NSArray` of objects to be used when binding values to the `?` placeholders in the SQL statement.
@param arguments A `NSArray` of objects to be used when binding values to the `?` placeholders in the SQL statement.
@param error A `NSError` object to receive any error object (if any).
@return `YES` upon success; `NO` upon failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
@see lastError
@see lastErrorCode
@see lastErrorMessage
*/

- (BOOL)executeUpdate:(NSString*)sql withArgumentsInArray:(NSArray *)arguments;
- (BOOL)executeUpdate:(NSString*)sql values:(NSArray *)values error:(NSError * __autoreleasing *)error;

/** Execute single update statement
Expand Down Expand Up @@ -437,7 +490,7 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary
*/

- (sqlite_int64)lastInsertRowId;
- (int64_t)lastInsertRowId;

/** The number of rows changed by prior SQL statement.
Expand Down Expand Up @@ -521,12 +574,42 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary
@return A `<FMResultSet>` for the result set upon success; `nil` upon failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
@see -executeQuery:values:error:
@see FMResultSet
@see [`FMResultSet next`](<[FMResultSet next]>)
*/

- (FMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray *)arguments;

/** Execute select statement
Executing queries returns an `<FMResultSet>` object if successful, and `nil` upon failure. Like executing updates, there is a variant that accepts an `NSError **` parameter. Otherwise you should use the `<lastErrorMessage>` and `<lastErrorMessage>` methods to determine why a query failed.
In order to iterate through the results of your query, you use a `while()` loop. You also need to "step" (via `<[FMResultSet next]>`) from one record to the other.
This is similar to `<executeQuery:withArgumentsInArray:>`, except that this also accepts a pointer to a `NSError` pointer, so that errors can be returned.
In Swift 2, this throws errors, as if it were defined as follows:
`func executeQuery(sql: String!, values: [AnyObject]!) throws -> FMResultSet!`
@param sql The SELECT statement to be performed, with optional `?` placeholders.
@param values A `NSArray` of objects to be used when binding values to the `?` placeholders in the SQL statement.
@param error A `NSError` object to receive any error object (if any).
@return A `<FMResultSet>` for the result set upon success; `nil` upon failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
@see FMResultSet
@see [`FMResultSet next`](<[FMResultSet next]>)
@note When called from Swift, only use the first two parameters, `sql` and `values`. This but throws the error.
*/

- (FMResultSet *)executeQuery:(NSString *)sql values:(NSArray *)values error:(NSError * __autoreleasing *)error;

/** Execute select statement
Executing queries returns an `<FMResultSet>` object if successful, and `nil` upon failure. Like executing updates, there is a variant that accepts an `NSError **` parameter. Otherwise you should use the `<lastErrorMessage>` and `<lastErrorMessage>` methods to determine why a query failed.
Expand Down Expand Up @@ -662,7 +745,7 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary
@return `YES` if success, `NO` on error.
@see http://www.sqlite-encrypt.com/develop-guide.htm
@see https://www.zetetic.net/sqlcipher/
@warning You need to have purchased the sqlite encryption extensions for this method to work.
*/
Expand All @@ -675,7 +758,7 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary
@return `YES` if success, `NO` on error.
@see http://www.sqlite-encrypt.com/develop-guide.htm
@see https://www.zetetic.net/sqlcipher/
@warning You need to have purchased the sqlite encryption extensions for this method to work.
*/
Expand All @@ -688,7 +771,7 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary
@return `YES` if success, `NO` on error.
@see http://www.sqlite-encrypt.com/develop-guide.htm
@see https://www.zetetic.net/sqlcipher/
@warning You need to have purchased the sqlite encryption extensions for this method to work.
*/
Expand All @@ -701,7 +784,7 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary
@return `YES` if success, `NO` on error.
@see http://www.sqlite-encrypt.com/develop-guide.htm
@see https://www.zetetic.net/sqlcipher/
@warning You need to have purchased the sqlite encryption extensions for this method to work.
*/
Expand All @@ -727,7 +810,7 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary
*/

- (sqlite3*)sqliteHandle;
- (void*)sqliteHandle;


///-----------------------------
Expand Down Expand Up @@ -791,8 +874,6 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary
- (NSTimeInterval)maxBusyRetryTimeInterval;


#if SQLITE_VERSION_NUMBER >= 3007000

///------------------
/// @name Save points
///------------------
Expand Down Expand Up @@ -854,8 +935,6 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary

- (NSError*)inSavePoint:(void (^)(BOOL *rollback))block;

#endif

///----------------------------
/// @name SQLite library status
///----------------------------
Expand Down Expand Up @@ -932,7 +1011,7 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary
@see [sqlite3_create_function()](http://sqlite.org/c3ref/create_function.html)
*/

- (void)makeFunctionNamed:(NSString*)name maximumArguments:(int)count withBlock:(void (^)(sqlite3_context *context, int argc, sqlite3_value **argv))block;
- (void)makeFunctionNamed:(NSString*)name maximumArguments:(int)count withBlock:(void (^)(void *context, int argc, void **argv))block;


///---------------------
Expand Down Expand Up @@ -1036,7 +1115,7 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary
*/

@interface FMStatement : NSObject {
sqlite3_stmt *_statement;
void *_statement;
NSString *_query;
long _useCount;
BOOL _inUse;
Expand All @@ -1059,7 +1138,7 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary
@see [`sqlite3_stmt`](http://www.sqlite.org/c3ref/stmt.html)
*/

@property (atomic, assign) sqlite3_stmt *statement;
@property (atomic, assign) void *statement;

/** Indication of whether the statement is in use */

Expand Down
Loading

0 comments on commit 366264d

Please sign in to comment.