Add SL3Statement
FossilOrigin-Name: cc03d24ff3ef295e0a9769b20587ac48cf5172996c09b5420e59eb4407765d63
This commit is contained in:
parent
f9bc4936e4
commit
182bd2136b
16 changed files with 774 additions and 17 deletions
|
@ -3,11 +3,17 @@ include ../../extra.mk
|
|||
STATIC_PIC_LIB_NOINST = ${EXCEPTIONS_LIB_A}
|
||||
STATIC_LIB_NOINST = ${EXCEPTIONS_A}
|
||||
|
||||
SRCS = SL3Exception.m \
|
||||
SL3OpenFailedException.m
|
||||
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..
|
||||
CPPFLAGS += -I. -I.. -DSL3_PUBLIC_IVARS
|
||||
|
||||
|
|
54
src/exceptions/SL3BindObjectFailedException.h
Normal file
54
src/exceptions/SL3BindObjectFailedException.h
Normal file
|
@ -0,0 +1,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
|
77
src/exceptions/SL3BindObjectFailedException.m
Normal file
77
src/exceptions/SL3BindObjectFailedException.m
Normal file
|
@ -0,0 +1,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
|
46
src/exceptions/SL3ClearBindingsFailedException.h
Normal file
46
src/exceptions/SL3ClearBindingsFailedException.h
Normal file
|
@ -0,0 +1,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
|
69
src/exceptions/SL3ClearBindingsFailedException.m
Normal file
69
src/exceptions/SL3ClearBindingsFailedException.m
Normal file
|
@ -0,0 +1,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
|
|
@ -23,10 +23,10 @@
|
|||
#import "SL3OpenFailedException.h"
|
||||
|
||||
@implementation SL3OpenFailedException
|
||||
@synthesize path = _Path, flags = _flags;
|
||||
@synthesize path = _path, flags = _flags;
|
||||
|
||||
+ (instancetype)exceptionWithConnection: (SL3Connection *)connection
|
||||
errorCode: (int)errorCode OF_UNAVAILABLE
|
||||
errorCode: (int)errorCode
|
||||
{
|
||||
OF_UNRECOGNIZED_SELECTOR
|
||||
}
|
||||
|
@ -41,7 +41,7 @@
|
|||
}
|
||||
|
||||
- (instancetype)initWithConnection: (SL3Connection *)connection
|
||||
errorCode: (int)errorCode OF_UNAVAILABLE
|
||||
errorCode: (int)errorCode
|
||||
{
|
||||
OF_INVALID_INIT_METHOD
|
||||
}
|
||||
|
@ -63,4 +63,11 @@
|
|||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[_path release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
@end
|
||||
|
|
46
src/exceptions/SL3PrepareStatementFailedException.h
Normal file
46
src/exceptions/SL3PrepareStatementFailedException.h
Normal file
|
@ -0,0 +1,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
|
72
src/exceptions/SL3PrepareStatementFailedException.m
Normal file
72
src/exceptions/SL3PrepareStatementFailedException.m
Normal file
|
@ -0,0 +1,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
|
46
src/exceptions/SL3ResetStatementFailedException.h
Normal file
46
src/exceptions/SL3ResetStatementFailedException.h
Normal file
|
@ -0,0 +1,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
|
69
src/exceptions/SL3ResetStatementFailedException.m
Normal file
69
src/exceptions/SL3ResetStatementFailedException.m
Normal file
|
@ -0,0 +1,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
|
Loading…
Add table
Add a link
Reference in a new issue