Overview
Comment: | Add SL3Statement |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
cc03d24ff3ef295e0a9769b20587ac48 |
User & Date: | js 2020-09-01 01:43:07 |
Context
2020-09-14
| ||
23:40 | Add files I forgot to add in the last checkin check-in: 04c7dfdd12 user: js tags: trunk | |
2020-09-01
| ||
01:43 | Add SL3Statement check-in: cc03d24ff3 user: js tags: trunk | |
2020-08-31
| ||
22:19 | Add SL3OpenFailedException check-in: 26a83e91f0 user: js tags: trunk | |
Changes
Changes to src/Makefile.
1 2 3 4 5 6 7 8 9 10 | include ../extra.mk SUBDIRS = exceptions SHARED_LIB = ${OBJSQLITE3_SHARED_LIB} STATIC_LIB = ${OBJSQLITE3_STATIC_LIB} FRAMEWORK = ${OBJSQLITE3_FRAMEWORK} LIB_MAJOR = 0 LIB_MINOR = 0 | | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | include ../extra.mk SUBDIRS = exceptions SHARED_LIB = ${OBJSQLITE3_SHARED_LIB} STATIC_LIB = ${OBJSQLITE3_STATIC_LIB} FRAMEWORK = ${OBJSQLITE3_FRAMEWORK} LIB_MAJOR = 0 LIB_MINOR = 0 SRCS = SL3Connection.m \ SL3Statement.m INCLUDES := ${SRCS:.m=.h} \ ObjSQLite3.h OBJS_EXTRA = ${EXCEPTIONS_EXCEPTIONS_A} LIB_OBJS_EXTRA = ${EXCEPTIONS_EXCEPTIONS_LIB_A} include ../buildsys.mk CPPFLAGS += -I. -Iexceptions -DSL3_PUBLIC_IVARS LD = ${OBJC} FRAMEWORK_LIBS := ${OBJFW_FRAMEWORK_LIBS} ${LIBS} LIBS := ${OBJFW_LIBS} ${LIBS} |
Changes to src/SL3Connection.h.
︙ | ︙ | |||
24 25 26 27 28 29 30 | #include <sqlite3.h> OF_ASSUME_NONNULL_BEGIN @interface SL3Connection: OFObject { | > > > | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #include <sqlite3.h> OF_ASSUME_NONNULL_BEGIN @interface SL3Connection: OFObject { #ifdef SL3_PUBLIC_IVARS @public #endif sqlite3 *_db; } + (instancetype)connectionWithPath: (OFString *)path flags: (int)flags; - (instancetype)initWithPath: (OFString *)path flags: (int)flags; @end |
︙ | ︙ |
Changes to src/SL3Connection.m.
︙ | ︙ | |||
34 35 36 37 38 39 40 | - (instancetype)initWithPath: (OFString *)path flags: (int)flags { self = [super init]; @try { | | < | | < | | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | - (instancetype)initWithPath: (OFString *)path flags: (int)flags { self = [super init]; @try { int code = sqlite3_open_v2(path.UTF8String, &_db, flags, NULL); if (code != SQLITE_OK) @throw [SL3OpenFailedException exceptionWithPath: path flags: flags errorCode: code]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { sqlite3_close(_db); [super dealloc]; } @end |
Added src/SL3Statement+Private.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | /* * Copyright (c) 2020, Jonathan Schleifer <js@nil.im> * * 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 |
Added src/SL3Statement.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | /* * Copyright (c) 2020, Jonathan Schleifer <js@nil.im> * * 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 <ObjFW/ObjFW.h> #include <sqlite3.h> 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 |
Added src/SL3Statement.m.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | /* * Copyright (c) 2020, Jonathan Schleifer <js@nil.im> * * 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 |
Changes to src/exceptions/Makefile.
1 2 3 4 5 | include ../../extra.mk STATIC_PIC_LIB_NOINST = ${EXCEPTIONS_LIB_A} STATIC_LIB_NOINST = ${EXCEPTIONS_A} | > > | > | > > | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | include ../../extra.mk STATIC_PIC_LIB_NOINST = ${EXCEPTIONS_LIB_A} STATIC_LIB_NOINST = ${EXCEPTIONS_A} SRCS = SL3BindObjectFailedException.m \ SL3ClearBindingsFailedException.m \ SL3Exception.m \ SL3ExecuteStatementFailedException.m \ SL3OpenFailedException.m \ SL3PrepareStatementFailedException.m \ SL3ResetStatementFailedException.m INCLUDES = ${SRCS:.m=.h} include ../../buildsys.mk CPPFLAGS += -I. -I.. -DSL3_PUBLIC_IVARS |
Added src/exceptions/SL3BindObjectFailedException.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | /* * Copyright (c) 2020, Jonathan Schleifer <js@nil.im> * * 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 "SL3Exception.h" #import "SL3Statement.h" OF_ASSUME_NONNULL_BEGIN @interface SL3BindObjectFailedException: SL3Exception { id _object; int _column; SL3Statement *_statement; } @property (readonly, nonatomic) id object; @property (readonly, nonatomic) int column; @property (readonly, nonatomic) SL3Statement *statement; + (instancetype)exceptionWithConnection: (nullable SL3Connection *)connection errorCode: (int)errorCode OF_UNAVAILABLE; + (instancetype)exceptionWithObject: (id)object column: (int)column statement: (SL3Statement *)statement errorCode: (int)errorCode; - (instancetype)initWithConnection: (nullable SL3Connection *)connection errorCode: (int)errorCode OF_UNAVAILABLE; - (instancetype)initWithObject: (id)object column: (int)column statement: (SL3Statement *)statement errorCode: (int)errorCode OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END |
Added src/exceptions/SL3BindObjectFailedException.m.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | /* * Copyright (c) 2020, Jonathan Schleifer <js@nil.im> * * 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 "SL3BindObjectFailedException.h" @implementation SL3BindObjectFailedException @synthesize object = _object, column = _column, statement = _statement; + (instancetype)exceptionWithConnection: (SL3Connection *)connection errorCode: (int)errorCode { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithObject: (id)object column: (int)column statement: (SL3Statement *)statement errorCode: (int)errorCode { return [[[self alloc] initWithObject: object column: column statement: statement errorCode: errorCode] autorelease]; } - (instancetype)initWithConnection: (SL3Connection *)connection errorCode: (int)errorCode { OF_INVALID_INIT_METHOD } - (instancetype)initWithObject: (id)object column: (int)column statement: (SL3Statement *)statement errorCode: (int)errorCode { self = [super initWithConnection: statement->_connection errorCode: errorCode]; @try { _object = [object retain]; _statement = [statement retain]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_object release]; [_statement release]; [super dealloc]; } @end |
Added src/exceptions/SL3ClearBindingsFailedException.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | /* * Copyright (c) 2020, Jonathan Schleifer <js@nil.im> * * 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 "SL3Exception.h" #import "SL3Statement.h" OF_ASSUME_NONNULL_BEGIN @interface SL3ClearBindingsFailedException: SL3Exception { SL3Statement *_statement; } @property (readonly, nonatomic) SL3Statement *statement; + (instancetype)exceptionWithConnection: (nullable SL3Connection *)connection errorCode: (int)errorCode OF_UNAVAILABLE; + (instancetype)exceptionWithStatement: (SL3Statement *)statement errorCode: (int)errorCode; - (instancetype)initWithConnection: (nullable SL3Connection *)connection errorCode: (int)errorCode OF_UNAVAILABLE; - (instancetype)initWithStatement: (SL3Statement *)statement errorCode: (int)errorCode OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END |
Added src/exceptions/SL3ClearBindingsFailedException.m.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | /* * Copyright (c) 2020, Jonathan Schleifer <js@nil.im> * * 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 "SL3ClearBindingsFailedException.h" @implementation SL3ClearBindingsFailedException @synthesize statement = _statement; + (instancetype)exceptionWithConnection: (SL3Connection *)connection errorCode: (int)errorCode { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithStatement: (SL3Statement *)statement errorCode: (int)errorCode { return [[[self alloc] initWithStatement: statement errorCode: errorCode] autorelease]; } - (instancetype)initWithConnection: (SL3Connection *)connection errorCode: (int)errorCode { OF_INVALID_INIT_METHOD } - (instancetype)initWithStatement: (SL3Statement *)statement errorCode: (int)errorCode { self = [super initWithConnection: statement->_connection errorCode: errorCode]; @try { _statement = [statement retain]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_statement release]; [super dealloc]; } @end |
Changes to src/exceptions/SL3OpenFailedException.m.
︙ | ︙ | |||
19 20 21 22 23 24 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #import "SL3OpenFailedException.h" @implementation SL3OpenFailedException | | | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #import "SL3OpenFailedException.h" @implementation SL3OpenFailedException @synthesize path = _path, flags = _flags; + (instancetype)exceptionWithConnection: (SL3Connection *)connection errorCode: (int)errorCode { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithPath: (OFString *)path flags: (int)flags errorCode: (int)errorCode { return [[[self alloc] initWithPath: path flags: flags errorCode: errorCode] autorelease]; } - (instancetype)initWithConnection: (SL3Connection *)connection errorCode: (int)errorCode { OF_INVALID_INIT_METHOD } - (instancetype)initWithPath: (OFString *)path flags: (int)flags errorCode: (int)errorCode |
︙ | ︙ | |||
59 60 61 62 63 64 65 66 | } @catch (id e) { [self release]; @throw e; } return self; } @end | > > > > > > > | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_path release]; [super dealloc]; } @end |
Added src/exceptions/SL3PrepareStatementFailedException.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | /* * Copyright (c) 2020, Jonathan Schleifer <js@nil.im> * * 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 "SL3Exception.h" OF_ASSUME_NONNULL_BEGIN @interface SL3PrepareStatementFailedException: SL3Exception { OFConstantString *_SQLStatement; } @property (readonly, nonatomic) OFConstantString *SQLStatement; + (instancetype)exceptionWithConnection: (nullable SL3Connection *)connection errorCode: (int)errorCode OF_UNAVAILABLE; + (instancetype)exceptionWithConnection: (SL3Connection *)connection SQLStatement: (OFConstantString *)SQLStatement errorCode: (int)errorCode; - (instancetype)initWithConnection: (nullable SL3Connection *)connection errorCode: (int)errorCode OF_UNAVAILABLE; - (instancetype)initWithConnection: (SL3Connection *)connection SQLStatement: (OFConstantString *)SQLStatement errorCode: (int)errorCode OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END |
Added src/exceptions/SL3PrepareStatementFailedException.m.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | /* * Copyright (c) 2020, Jonathan Schleifer <js@nil.im> * * 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 "SL3PrepareStatementFailedException.h" @implementation SL3PrepareStatementFailedException @synthesize SQLStatement = _SQLStatement; + (instancetype)exceptionWithConnection: (SL3Connection *)connection errorCode: (int)errorCode { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithConnection: (SL3Connection *)connection SQLStatement: (OFConstantString *)SQLStatement errorCode: (int)errorCode; { return [[[self alloc] initWithConnection: connection SQLStatement: SQLStatement errorCode: errorCode] autorelease]; } - (instancetype)initWithConnection: (SL3Connection *)connection errorCode: (int)errorCode { OF_INVALID_INIT_METHOD } - (instancetype)initWithConnection: (SL3Connection *)connection SQLStatement: (OFConstantString *)SQLStatement errorCode: (int)errorCode { self = [super initWithConnection: connection errorCode: errorCode]; @try { _SQLStatement = [SQLStatement retain]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_SQLStatement release]; [super dealloc]; } @end |
Added src/exceptions/SL3ResetStatementFailedException.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | /* * Copyright (c) 2020, Jonathan Schleifer <js@nil.im> * * 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 "SL3Exception.h" #import "SL3Statement.h" OF_ASSUME_NONNULL_BEGIN @interface SL3ResetStatementFailedException: SL3Exception { SL3Statement *_statement; } @property (readonly, nonatomic) SL3Statement *statement; + (instancetype)exceptionWithConnection: (nullable SL3Connection *)connection errorCode: (int)errorCode OF_UNAVAILABLE; + (instancetype)exceptionWithStatement: (SL3Statement *)statement errorCode: (int)errorCode; - (instancetype)initWithConnection: (nullable SL3Connection *)connection errorCode: (int)errorCode OF_UNAVAILABLE; - (instancetype)initWithStatement: (SL3Statement *)statement errorCode: (int)errorCode OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END |
Added src/exceptions/SL3ResetStatementFailedException.m.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | /* * Copyright (c) 2020, Jonathan Schleifer <js@nil.im> * * 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 "SL3ResetStatementFailedException.h" @implementation SL3ResetStatementFailedException @synthesize statement = _statement; + (instancetype)exceptionWithConnection: (SL3Connection *)connection errorCode: (int)errorCode { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithStatement: (SL3Statement *)statement errorCode: (int)errorCode { return [[[self alloc] initWithStatement: statement errorCode: errorCode] autorelease]; } - (instancetype)initWithConnection: (SL3Connection *)connection errorCode: (int)errorCode { OF_INVALID_INIT_METHOD } - (instancetype)initWithStatement: (SL3Statement *)statement errorCode: (int)errorCode { self = [super initWithConnection: statement->_connection errorCode: errorCode]; @try { _statement = [statement retain]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_statement release]; [super dealloc]; } @end |