Index: src/Makefile ================================================================== --- src/Makefile +++ src/Makefile @@ -6,12 +6,12 @@ STATIC_LIB = ${OBJSQLITE3_STATIC_LIB} FRAMEWORK = ${OBJSQLITE3_FRAMEWORK} LIB_MAJOR = 0 LIB_MINOR = 0 -SRCS = SL3Connection.m \ - SL3Statement.m +SRCS = SL3Connection.m \ + SL3PreparedStatement.m INCLUDES := ${SRCS:.m=.h} \ ObjSQLite3.h OBJS_EXTRA = ${EXCEPTIONS_EXCEPTIONS_A} LIB_OBJS_EXTRA = ${EXCEPTIONS_EXCEPTIONS_LIB_A} Index: src/ObjSQLite3.h ================================================================== --- src/ObjSQLite3.h +++ src/ObjSQLite3.h @@ -19,5 +19,6 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #import "SL3Connection.h" +#import "SL3PreparedStatement.h" ADDED src/SL3PreparedStatement+Private.h Index: src/SL3PreparedStatement+Private.h ================================================================== --- /dev/null +++ src/SL3PreparedStatement+Private.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2020, Jonathan Schleifer + * + * https://fossil.nil.im/objsqlite3 + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice is present in all copies. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#import "SL3PreparedStatement.h" + +OF_ASSUME_NONNULL_BEGIN + +@interface SL3PreparedStatement () +- (instancetype)sl3_initWithConnection: (SL3Connection *)connection + SQLStatement: (OFConstantString *)SQLStatement; +@end + +OF_ASSUME_NONNULL_END ADDED src/SL3PreparedStatement.h Index: src/SL3PreparedStatement.h ================================================================== --- /dev/null +++ src/SL3PreparedStatement.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2020, Jonathan Schleifer + * + * https://fossil.nil.im/objsqlite3 + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice is present in all copies. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#import + +#include + +OF_ASSUME_NONNULL_BEGIN + +@class SL3Connection; + +@interface SL3PreparedStatement: OFObject +{ +#ifdef SL3_PUBLIC_IVARS +@public +#endif + SL3Connection *_connection; + sqlite3_stmt *_stmt; +} + +- (void)bindWithArray: (OFArray *)array; +- (void)bindWithDictionary: + (OFDictionary OF_GENERIC(OFString *, id) *)dictionary; +- (void)clearBindings; +- (void)step; +- (void)reset; +@end + +OF_ASSUME_NONNULL_END ADDED src/SL3PreparedStatement.m Index: src/SL3PreparedStatement.m ================================================================== --- /dev/null +++ src/SL3PreparedStatement.m @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2020, Jonathan Schleifer + * + * https://fossil.nil.im/objsqlite3 + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice is present in all copies. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#import "SL3PreparedStatement.h" +#import "SL3PreparedStatement+Private.h" + +#import "SL3BindObjectFailedException.h" +#import "SL3ClearBindingsFailedException.h" +#import "SL3ExecuteStatementFailedException.h" +#import "SL3PrepareStatementFailedException.h" +#import "SL3ResetStatementFailedException.h" + +static void +releaseObject(void *object) +{ + [(id)object release]; +} + +@implementation SL3PreparedStatement +- (instancetype)sl3_initWithConnection: (SL3Connection *)connection + SQLStatement: (OFConstantString *)SQLStatement +{ + self = [super init]; + + @try { + int code = sqlite3_prepare_v2(connection->_db, + SQLStatement.UTF8String, SQLStatement.UTF8StringLength, + &_stmt, NULL); + + if (code != SQLITE_OK) + @throw [SL3PrepareStatementFailedException + exceptionWithConnection: connection + SQLStatement: SQLStatement + errorCode: code]; + + _connection = [connection retain]; + } @catch (id e) { + [self release]; + @throw e; + } + + return self; +} + +- (void)dealloc +{ + sqlite3_finalize(_stmt); + [_connection release]; + + [super dealloc]; +} + +static void +bindObject(SL3PreparedStatement *statement, int column, id object) +{ + int code; + + if ([object isKindOfClass: [OFNumber class]]) { + switch (*[object objCType]) { + case 'f': + case 'd': + code = sqlite3_bind_double(statement->_stmt, column, + [object doubleValue]); + break; + /* TODO: Check for range when converting to signed. */ + default: + code = sqlite3_bind_int64(statement->_stmt, column, + [object longLongValue]); + break; + } + } else if ([object isKindOfClass: [OFString class]]) { + OFString *copy = [object copy]; + + code = sqlite3_bind_text64(statement->_stmt, column, + copy.UTF8String, copy.UTF8StringLength, releaseObject, + SQLITE_UTF8); + } else if ([object isKindOfClass: [OFData class]]) { + OFData *copy = [object copy]; + + code = sqlite3_bind_blob64(statement->_stmt, column, copy.items, + copy.count * copy.itemSize, releaseObject); + } else if ([object isEqual: [OFNull null]]) + code = sqlite3_bind_null(statement->_stmt, column); + else + @throw [OFInvalidArgumentException exception]; + + if (code != SQLITE_OK) + @throw [SL3BindObjectFailedException + exceptionWithObject: object + column: column + statement: statement + errorCode: code]; +} + +- (void)bindWithArray: (OFArray *)array +{ + void *pool = objc_autoreleasePoolPush(); + int column = 0; + + if (array.count > sqlite3_bind_parameter_count(_stmt)) + @throw [OFOutOfRangeException exception]; + + for (id object in array) + bindObject(self, ++column, object); + + objc_autoreleasePoolPop(pool); +} + +- (void)bindWithDictionary: + (OFDictionary OF_GENERIC(OFString *, id) *)dictionary +{ + void *pool = objc_autoreleasePoolPush(); + OFEnumerator OF_GENERIC(OFString *) *keyEnumerator = + [dictionary keyEnumerator]; + OFEnumerator *objectEnumerator = [dictionary objectEnumerator]; + OFString *key; + id object; + + while ((key = [keyEnumerator nextObject]) != nil && + (object = [objectEnumerator nextObject]) != nil) { + int column = sqlite3_bind_parameter_index( + _stmt, key.UTF8String); + + if (column == 0) + @throw [OFUndefinedKeyException + exceptionWithObject: self + key: key]; + + bindObject(self, column, object); + } + + objc_autoreleasePoolPop(pool); +} + +- (void)clearBindings +{ + int code = sqlite3_clear_bindings(_stmt); + + if (code != SQLITE_OK) + @throw [SL3ClearBindingsFailedException + exceptionWithStatement: self + errorCode: code]; +} + +- (void)step +{ + int code = sqlite3_step(_stmt); + + if (code != SQLITE_DONE && code != SQLITE_ROW) + @throw [SL3ExecuteStatementFailedException + exceptionWithStatement: self + errorCode: code]; +} + +- (void)reset +{ + int code = sqlite3_reset(_stmt); + + if (code != SQLITE_OK) + @throw [SL3ResetStatementFailedException + exceptionWithStatement: self + errorCode: code]; +} +@end DELETED src/SL3Statement+Private.h Index: src/SL3Statement+Private.h ================================================================== --- src/SL3Statement+Private.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2020, Jonathan Schleifer - * - * https://fossil.nil.im/objsqlite3 - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice is present in all copies. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#import "SL3Statement.h" - -OF_ASSUME_NONNULL_BEGIN - -@interface SL3Statement () -- (instancetype)sl3_initWithConnection: (SL3Connection *)connection - SQLStatement: (OFConstantString *)SQLStatement; -@end - -OF_ASSUME_NONNULL_END DELETED src/SL3Statement.h Index: src/SL3Statement.h ================================================================== --- src/SL3Statement.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2020, Jonathan Schleifer - * - * https://fossil.nil.im/objsqlite3 - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice is present in all copies. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -#include - -OF_ASSUME_NONNULL_BEGIN - -@class SL3Connection; - -@interface SL3Statement: OFObject -{ -#ifdef SL3_PUBLIC_IVARS -@public -#endif - SL3Connection *_connection; - sqlite3_stmt *_stmt; -} - -- (void)bindWithArray: (OFArray *)array; -- (void)bindWithDictionary: - (OFDictionary OF_GENERIC(OFString *, id) *)dictionary; -- (void)clearBindings; -- (void)step; -- (void)reset; -@end - -OF_ASSUME_NONNULL_END DELETED src/SL3Statement.m Index: src/SL3Statement.m ================================================================== --- src/SL3Statement.m +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 2020, Jonathan Schleifer - * - * https://fossil.nil.im/objsqlite3 - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice is present in all copies. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#import "SL3Statement.h" -#import "SL3Statement+Private.h" - -#import "SL3BindObjectFailedException.h" -#import "SL3ClearBindingsFailedException.h" -#import "SL3ExecuteStatementFailedException.h" -#import "SL3PrepareStatementFailedException.h" -#import "SL3ResetStatementFailedException.h" - -static void -releaseObject(void *object) -{ - [(id)object release]; -} - -@implementation SL3Statement -- (instancetype)sl3_initWithConnection: (SL3Connection *)connection - SQLStatement: (OFConstantString *)SQLStatement -{ - self = [super init]; - - @try { - int code = sqlite3_prepare_v2(connection->_db, - SQLStatement.UTF8String, SQLStatement.UTF8StringLength, - &_stmt, NULL); - - if (code != SQLITE_OK) - @throw [SL3PrepareStatementFailedException - exceptionWithConnection: connection - SQLStatement: SQLStatement - errorCode: code]; - - _connection = [connection retain]; - } @catch (id e) { - [self release]; - @throw e; - } - - return self; -} - -- (void)dealloc -{ - sqlite3_finalize(_stmt); - [_connection release]; - - [super dealloc]; -} - -static void -bindObject(SL3Statement *statement, int column, id object) -{ - int code; - - if ([object isKindOfClass: [OFNumber class]]) { - switch (*[object objCType]) { - case 'f': - case 'd': - code = sqlite3_bind_double(statement->_stmt, column, - [object doubleValue]); - break; - /* TODO: Check for range when converting to signed. */ - default: - code = sqlite3_bind_int64(statement->_stmt, column, - [object longLongValue]); - break; - } - } else if ([object isKindOfClass: [OFString class]]) { - OFString *copy = [object copy]; - - code = sqlite3_bind_text64(statement->_stmt, column, - copy.UTF8String, copy.UTF8StringLength, releaseObject, - SQLITE_UTF8); - } else if ([object isKindOfClass: [OFData class]]) { - OFData *copy = [object copy]; - - code = sqlite3_bind_blob64(statement->_stmt, column, copy.items, - copy.count * copy.itemSize, releaseObject); - } else if ([object isEqual: [OFNull null]]) - code = sqlite3_bind_null(statement->_stmt, column); - else - @throw [OFInvalidArgumentException exception]; - - if (code != SQLITE_OK) - @throw [SL3BindObjectFailedException - exceptionWithObject: object - column: column - statement: statement - errorCode: code]; -} - -- (void)bindWithArray: (OFArray *)array -{ - void *pool = objc_autoreleasePoolPush(); - int column = 0; - - if (array.count > sqlite3_bind_parameter_count(_stmt)) - @throw [OFOutOfRangeException exception]; - - for (id object in array) - bindObject(self, ++column, object); - - objc_autoreleasePoolPop(pool); -} - -- (void)bindWithDictionary: - (OFDictionary OF_GENERIC(OFString *, id) *)dictionary -{ - void *pool = objc_autoreleasePoolPush(); - OFEnumerator OF_GENERIC(OFString *) *keyEnumerator = - [dictionary keyEnumerator]; - OFEnumerator *objectEnumerator = [dictionary objectEnumerator]; - OFString *key; - id object; - - while ((key = [keyEnumerator nextObject]) != nil && - (object = [objectEnumerator nextObject]) != nil) { - int column = sqlite3_bind_parameter_index( - _stmt, key.UTF8String); - - if (column == 0) - @throw [OFUndefinedKeyException - exceptionWithObject: self - key: key]; - - bindObject(self, column, object); - } - - objc_autoreleasePoolPop(pool); -} - -- (void)clearBindings -{ - int code = sqlite3_clear_bindings(_stmt); - - if (code != SQLITE_OK) - @throw [SL3ClearBindingsFailedException - exceptionWithStatement: self - errorCode: code]; -} - -- (void)step -{ - int code = sqlite3_step(_stmt); - - if (code != SQLITE_DONE && code != SQLITE_ROW) - @throw [SL3ExecuteStatementFailedException - exceptionWithStatement: self - errorCode: code]; -} - -- (void)reset -{ - int code = sqlite3_reset(_stmt); - - if (code != SQLITE_OK) - @throw [SL3ResetStatementFailedException - exceptionWithStatement: self - errorCode: code]; -} -@end Index: src/exceptions/SL3BindObjectFailedException.h ================================================================== --- src/exceptions/SL3BindObjectFailedException.h +++ src/exceptions/SL3BindObjectFailedException.h @@ -20,35 +20,35 @@ * POSSIBILITY OF SUCH DAMAGE. */ #import "SL3Exception.h" -#import "SL3Statement.h" +#import "SL3PreparedStatement.h" OF_ASSUME_NONNULL_BEGIN @interface SL3BindObjectFailedException: SL3Exception { id _object; int _column; - SL3Statement *_statement; + SL3PreparedStatement *_statement; } @property (readonly, nonatomic) id object; @property (readonly, nonatomic) int column; -@property (readonly, nonatomic) SL3Statement *statement; +@property (readonly, nonatomic) SL3PreparedStatement *statement; + (instancetype)exceptionWithConnection: (nullable SL3Connection *)connection errorCode: (int)errorCode OF_UNAVAILABLE; + (instancetype)exceptionWithObject: (id)object column: (int)column - statement: (SL3Statement *)statement + statement: (SL3PreparedStatement *)statement errorCode: (int)errorCode; - (instancetype)initWithConnection: (nullable SL3Connection *)connection errorCode: (int)errorCode OF_UNAVAILABLE; - (instancetype)initWithObject: (id)object column: (int)column - statement: (SL3Statement *)statement + statement: (SL3PreparedStatement *)statement errorCode: (int)errorCode OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/SL3BindObjectFailedException.m ================================================================== --- src/exceptions/SL3BindObjectFailedException.m +++ src/exceptions/SL3BindObjectFailedException.m @@ -31,11 +31,11 @@ OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithObject: (id)object column: (int)column - statement: (SL3Statement *)statement + statement: (SL3PreparedStatement *)statement errorCode: (int)errorCode { return [[[self alloc] initWithObject: object column: column statement: statement @@ -48,11 +48,11 @@ OF_INVALID_INIT_METHOD } - (instancetype)initWithObject: (id)object column: (int)column - statement: (SL3Statement *)statement + statement: (SL3PreparedStatement *)statement errorCode: (int)errorCode { self = [super initWithConnection: statement->_connection errorCode: errorCode]; Index: src/exceptions/SL3ClearBindingsFailedException.h ================================================================== --- src/exceptions/SL3ClearBindingsFailedException.h +++ src/exceptions/SL3ClearBindingsFailedException.h @@ -20,27 +20,27 @@ * POSSIBILITY OF SUCH DAMAGE. */ #import "SL3Exception.h" -#import "SL3Statement.h" +#import "SL3PreparedStatement.h" OF_ASSUME_NONNULL_BEGIN @interface SL3ClearBindingsFailedException: SL3Exception { - SL3Statement *_statement; + SL3PreparedStatement *_statement; } -@property (readonly, nonatomic) SL3Statement *statement; +@property (readonly, nonatomic) SL3PreparedStatement *statement; + (instancetype)exceptionWithConnection: (nullable SL3Connection *)connection errorCode: (int)errorCode OF_UNAVAILABLE; -+ (instancetype)exceptionWithStatement: (SL3Statement *)statement ++ (instancetype)exceptionWithStatement: (SL3PreparedStatement *)statement errorCode: (int)errorCode; - (instancetype)initWithConnection: (nullable SL3Connection *)connection errorCode: (int)errorCode OF_UNAVAILABLE; -- (instancetype)initWithStatement: (SL3Statement *)statement +- (instancetype)initWithStatement: (SL3PreparedStatement *)statement errorCode: (int)errorCode OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/SL3ClearBindingsFailedException.m ================================================================== --- src/exceptions/SL3ClearBindingsFailedException.m +++ src/exceptions/SL3ClearBindingsFailedException.m @@ -29,11 +29,11 @@ errorCode: (int)errorCode { OF_UNRECOGNIZED_SELECTOR } -+ (instancetype)exceptionWithStatement: (SL3Statement *)statement ++ (instancetype)exceptionWithStatement: (SL3PreparedStatement *)statement errorCode: (int)errorCode { return [[[self alloc] initWithStatement: statement errorCode: errorCode] autorelease]; } @@ -42,11 +42,11 @@ errorCode: (int)errorCode { OF_INVALID_INIT_METHOD } -- (instancetype)initWithStatement: (SL3Statement *)statement +- (instancetype)initWithStatement: (SL3PreparedStatement *)statement errorCode: (int)errorCode { self = [super initWithConnection: statement->_connection errorCode: errorCode]; Index: src/exceptions/SL3ExecuteStatementFailedException.h ================================================================== --- src/exceptions/SL3ExecuteStatementFailedException.h +++ src/exceptions/SL3ExecuteStatementFailedException.h @@ -20,27 +20,27 @@ * POSSIBILITY OF SUCH DAMAGE. */ #import "SL3Exception.h" -#import "SL3Statement.h" +#import "SL3PreparedStatement.h" OF_ASSUME_NONNULL_BEGIN @interface SL3ExecuteStatementFailedException: SL3Exception { - SL3Statement *_statement; + SL3PreparedStatement *_statement; } -@property (readonly, nonatomic) SL3Statement *statement; +@property (readonly, nonatomic) SL3PreparedStatement *statement; + (instancetype)exceptionWithConnection: (nullable SL3Connection *)connection errorCode: (int)errorCode OF_UNAVAILABLE; -+ (instancetype)exceptionWithStatement: (SL3Statement *)statement ++ (instancetype)exceptionWithStatement: (SL3PreparedStatement *)statement errorCode: (int)errorCode; - (instancetype)initWithConnection: (nullable SL3Connection *)connection errorCode: (int)errorCode OF_UNAVAILABLE; -- (instancetype)initWithStatement: (SL3Statement *)statement +- (instancetype)initWithStatement: (SL3PreparedStatement *)statement errorCode: (int)errorCode OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/SL3ExecuteStatementFailedException.m ================================================================== --- src/exceptions/SL3ExecuteStatementFailedException.m +++ src/exceptions/SL3ExecuteStatementFailedException.m @@ -29,11 +29,11 @@ errorCode: (int)errorCode { OF_UNRECOGNIZED_SELECTOR } -+ (instancetype)exceptionWithStatement: (SL3Statement *)statement ++ (instancetype)exceptionWithStatement: (SL3PreparedStatement *)statement errorCode: (int)errorCode { return [[[self alloc] initWithStatement: statement errorCode: errorCode] autorelease]; } @@ -42,11 +42,11 @@ errorCode: (int)errorCode { OF_INVALID_INIT_METHOD } -- (instancetype)initWithStatement: (SL3Statement *)statement +- (instancetype)initWithStatement: (SL3PreparedStatement *)statement errorCode: (int)errorCode { self = [super initWithConnection: statement->_connection errorCode: errorCode]; Index: src/exceptions/SL3ResetStatementFailedException.h ================================================================== --- src/exceptions/SL3ResetStatementFailedException.h +++ src/exceptions/SL3ResetStatementFailedException.h @@ -20,27 +20,27 @@ * POSSIBILITY OF SUCH DAMAGE. */ #import "SL3Exception.h" -#import "SL3Statement.h" +#import "SL3PreparedStatement.h" OF_ASSUME_NONNULL_BEGIN @interface SL3ResetStatementFailedException: SL3Exception { - SL3Statement *_statement; + SL3PreparedStatement *_statement; } -@property (readonly, nonatomic) SL3Statement *statement; +@property (readonly, nonatomic) SL3PreparedStatement *statement; + (instancetype)exceptionWithConnection: (nullable SL3Connection *)connection errorCode: (int)errorCode OF_UNAVAILABLE; -+ (instancetype)exceptionWithStatement: (SL3Statement *)statement ++ (instancetype)exceptionWithStatement: (SL3PreparedStatement *)statement errorCode: (int)errorCode; - (instancetype)initWithConnection: (nullable SL3Connection *)connection errorCode: (int)errorCode OF_UNAVAILABLE; -- (instancetype)initWithStatement: (SL3Statement *)statement +- (instancetype)initWithStatement: (SL3PreparedStatement *)statement errorCode: (int)errorCode OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/SL3ResetStatementFailedException.m ================================================================== --- src/exceptions/SL3ResetStatementFailedException.m +++ src/exceptions/SL3ResetStatementFailedException.m @@ -29,11 +29,11 @@ errorCode: (int)errorCode { OF_UNRECOGNIZED_SELECTOR } -+ (instancetype)exceptionWithStatement: (SL3Statement *)statement ++ (instancetype)exceptionWithStatement: (SL3PreparedStatement *)statement errorCode: (int)errorCode { return [[[self alloc] initWithStatement: statement errorCode: errorCode] autorelease]; } @@ -42,11 +42,11 @@ errorCode: (int)errorCode { OF_INVALID_INIT_METHOD } -- (instancetype)initWithStatement: (SL3Statement *)statement +- (instancetype)initWithStatement: (SL3PreparedStatement *)statement errorCode: (int)errorCode { self = [super initWithConnection: statement->_connection errorCode: errorCode];