Compare commits

...

5 commits

Author SHA1 Message Date
6d3c787830
Update copyright & URL 2025-06-24 18:40:09 +02:00
562f20aca7
Set version to 1.0.1 2025-06-23 23:37:17 +02:00
1fb20d5791 Use ARC functions for RR
FossilOrigin-Name: d80ebb2ce13b075e0e67dfb391cd120f2bf99f6ad5492c50d4e71e59dcbd1ac1
2025-04-18 21:29:58 +00:00
34c0d626d4 Include includedir in .oc file
FossilOrigin-Name: 86f27a3ae3ccf895cacdc3043559bc27f7cb08feb6bd7f8b96e688dc71ebab73
2024-08-17 00:32:22 +00:00
04ce960a67 Minor documentation improvement
FossilOrigin-Name: 4a11efb8df34bdea06109bdcfe411c32a7eaa482e886ec8ead3e89056df0ea70
2024-08-11 18:16:17 +00:00
23 changed files with 108 additions and 103 deletions

View file

@ -1,5 +1,5 @@
package_format 1 package_format 1
CPPFLAGS="$CPPFLAGS @SQLITE3_CPPFLAGS@" CPPFLAGS="$CPPFLAGS -I@includedir@ @SQLITE3_CPPFLAGS@"
LIBS="-L@libdir@ -lobjsqlite3 @SQLITE3_LIBS@ $LIBS" LIBS="-L@libdir@ -lobjsqlite3 @SQLITE3_LIBS@ $LIBS"
FRAMEWORK_LIBS="-L@libdir@ -lobjsqlite3 @SQLITE3_LIBS@ $FRAMEWORK_LIBS" FRAMEWORK_LIBS="-L@libdir@ -lobjsqlite3 @SQLITE3_LIBS@ $FRAMEWORK_LIBS"
STATIC_LIBS="@libdir@/libobjsqlite3.a @SQLITE3_LIBS@ $STATIC_LIBS" STATIC_LIBS="@libdir@/libobjsqlite3.a @SQLITE3_LIBS@ $STATIC_LIBS"

View file

@ -1,5 +1,5 @@
project('ObjSQLite3', 'objc', project('ObjSQLite3', 'objc',
version: '1.0', version: '1.0.1',
meson_version: '>= 1.5.0', meson_version: '>= 1.5.0',
default_options: { default_options: {
'warning_level': '3', 'warning_level': '3',
@ -31,6 +31,7 @@ configure_file(
input: 'ObjSQLite3.oc.in', input: 'ObjSQLite3.oc.in',
output: 'ObjSQLite3.oc', output: 'ObjSQLite3.oc',
configuration: { configuration: {
'includedir': get_option('prefix') / get_option('includedir'),
'libdir': get_option('prefix') / get_option('libdir'), 'libdir': get_option('prefix') / get_option('libdir'),
'SQLITE3_CPPFLAGS': sqlite3_cflags, 'SQLITE3_CPPFLAGS': sqlite3_cflags,
'SQLITE3_LIBS': sqlite3_libs, 'SQLITE3_LIBS': sqlite3_libs,

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -26,12 +26,13 @@
@implementation SL3Connection @implementation SL3Connection
+ (instancetype)connectionWithIRI: (OFIRI *)IRI + (instancetype)connectionWithIRI: (OFIRI *)IRI
{ {
return [[[self alloc] initWithIRI: IRI] autorelease]; return objc_autoreleaseReturnValue([[self alloc] initWithIRI: IRI]);
} }
+ (instancetype)connectionWithIRI: (OFIRI *)IRI flags: (int)flags + (instancetype)connectionWithIRI: (OFIRI *)IRI flags: (int)flags
{ {
return [[[self alloc] initWithIRI: IRI flags: flags] autorelease]; return objc_autoreleaseReturnValue([[self alloc] initWithIRI: IRI
flags: flags]);
} }
- (instancetype)initWithIRI: (OFIRI *)IRI - (instancetype)initWithIRI: (OFIRI *)IRI
@ -54,7 +55,7 @@
flags: flags flags: flags
errorCode: code]; errorCode: code];
} @catch (id e) { } @catch (id e) {
[self release]; objc_release(self);
@throw e; @throw e;
} }
@ -70,9 +71,9 @@
- (SL3PreparedStatement *)prepareStatement: (OFConstantString *)SQLStatement - (SL3PreparedStatement *)prepareStatement: (OFConstantString *)SQLStatement
{ {
return [[[SL3PreparedStatement alloc] return objc_autoreleaseReturnValue([[SL3PreparedStatement alloc]
sl3_initWithConnection: self sl3_initWithConnection: self
SQLStatement: SQLStatement] autorelease]; SQLStatement: SQLStatement]);
} }
- (void)executeStatement: (OFConstantString *)SQLStatement - (void)executeStatement: (OFConstantString *)SQLStatement

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020, 2021, 2024 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2021, 2024, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -25,12 +25,6 @@
#import "SL3PrepareStatementFailedException.h" #import "SL3PrepareStatementFailedException.h"
#import "SL3ResetStatementFailedException.h" #import "SL3ResetStatementFailedException.h"
static void
releaseObject(void *object)
{
[(id)object release];
}
@implementation SL3PreparedStatement @implementation SL3PreparedStatement
- (instancetype)sl3_initWithConnection: (SL3Connection *)connection - (instancetype)sl3_initWithConnection: (SL3Connection *)connection
SQLStatement: (OFConstantString *)SQLStatement SQLStatement: (OFConstantString *)SQLStatement
@ -48,9 +42,9 @@ releaseObject(void *object)
SQLStatement: SQLStatement SQLStatement: SQLStatement
errorCode: code]; errorCode: code];
_connection = [connection retain]; _connection = objc_retain(connection);
} @catch (id e) { } @catch (id e) {
[self release]; objc_release(self);
@throw e; @throw e;
} }
@ -60,7 +54,7 @@ releaseObject(void *object)
- (void)dealloc - (void)dealloc
{ {
sqlite3_finalize(_stmt); sqlite3_finalize(_stmt);
[_connection release]; objc_release(_connection);
[super dealloc]; [super dealloc];
} }
@ -87,13 +81,15 @@ bindObject(SL3PreparedStatement *statement, int column, id object)
OFString *copy = [object copy]; OFString *copy = [object copy];
code = sqlite3_bind_text64(statement->_stmt, column, code = sqlite3_bind_text64(statement->_stmt, column,
copy.UTF8String, copy.UTF8StringLength, releaseObject, copy.UTF8String, copy.UTF8StringLength,
(void (*)(void *))(void (*)(void))objc_release,
SQLITE_UTF8); SQLITE_UTF8);
} else if ([object isKindOfClass: [OFData class]]) { } else if ([object isKindOfClass: [OFData class]]) {
OFData *copy = [object copy]; OFData *copy = [object copy];
code = sqlite3_bind_blob64(statement->_stmt, column, copy.items, code = sqlite3_bind_blob64(statement->_stmt, column, copy.items,
copy.count * copy.itemSize, releaseObject); copy.count * copy.itemSize,
(void (*)(void *))(void (*)(void))objc_release);
} else if ([object isEqual: [OFNull null]]) } else if ([object isEqual: [OFNull null]])
code = sqlite3_bind_null(statement->_stmt, column); code = sqlite3_bind_null(statement->_stmt, column);
else else

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -32,10 +32,11 @@
statement: (SL3PreparedStatement *)statement statement: (SL3PreparedStatement *)statement
errorCode: (int)errorCode errorCode: (int)errorCode
{ {
return [[[self alloc] initWithObject: object return objc_autoreleaseReturnValue(
column: column [[self alloc] initWithObject: object
statement: statement column: column
errorCode: errorCode] autorelease]; statement: statement
errorCode: errorCode]);
} }
- (instancetype)initWithConnection: (SL3Connection *)connection - (instancetype)initWithConnection: (SL3Connection *)connection
@ -53,10 +54,10 @@
errorCode: errorCode]; errorCode: errorCode];
@try { @try {
_object = [object retain]; _object = objc_retain(object);
_statement = [statement retain]; _statement = objc_retain(statement);
} @catch (id e) { } @catch (id e) {
[self release]; objc_release(self);
@throw e; @throw e;
} }
@ -65,8 +66,8 @@
- (void)dealloc - (void)dealloc
{ {
[_object release]; objc_release(_object);
[_statement release]; objc_release(_statement);
[super dealloc]; [super dealloc];
} }

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -30,8 +30,9 @@
+ (instancetype)exceptionWithStatement: (SL3PreparedStatement *)statement + (instancetype)exceptionWithStatement: (SL3PreparedStatement *)statement
errorCode: (int)errorCode errorCode: (int)errorCode
{ {
return [[[self alloc] initWithStatement: statement return objc_autoreleaseReturnValue(
errorCode: errorCode] autorelease]; [[self alloc] initWithStatement: statement
errorCode: errorCode]);
} }
- (instancetype)initWithConnection: (SL3Connection *)connection - (instancetype)initWithConnection: (SL3Connection *)connection
@ -47,9 +48,9 @@
errorCode: errorCode]; errorCode: errorCode];
@try { @try {
_statement = [statement retain]; _statement = objc_retain(statement);
} @catch (id e) { } @catch (id e) {
[self release]; objc_release(self);
@throw e; @throw e;
} }
@ -58,7 +59,7 @@
- (void)dealloc - (void)dealloc
{ {
[_statement release]; objc_release(_statement);
[super dealloc]; [super dealloc];
} }

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -48,8 +48,8 @@ OF_ASSUME_NONNULL_BEGIN
/** /**
* @brief Creates a new SQLite3 exception. * @brief Creates a new SQLite3 exception.
* *
* @param connection The connection for which the exception occurred. * @param connection The connection for which the exception occurred
* @param errorCode The SQLite3 error code. * @param errorCode The SQLite3 error code
* @return A new, autoreleased SQLite3 exception * @return A new, autoreleased SQLite3 exception
*/ */
+ (instancetype)exceptionWithConnection: (nullable SL3Connection *)connection + (instancetype)exceptionWithConnection: (nullable SL3Connection *)connection
@ -60,8 +60,8 @@ OF_ASSUME_NONNULL_BEGIN
/** /**
* @brief Initializes an already allocated SQLite3 exception. * @brief Initializes an already allocated SQLite3 exception.
* *
* @param connection The connection for which the exception occurred. * @param connection The connection for which the exception occurred
* @param errorCode The SQLite3 error code. * @param errorCode The SQLite3 error code
* @return An initialized SQLite3 exception * @return An initialized SQLite3 exception
*/ */
- (instancetype)initWithConnection: (nullable SL3Connection *)connection - (instancetype)initWithConnection: (nullable SL3Connection *)connection

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -29,8 +29,9 @@
+ (instancetype)exceptionWithConnection: (SL3Connection *)connection + (instancetype)exceptionWithConnection: (SL3Connection *)connection
errorCode: (int)errorCode errorCode: (int)errorCode
{ {
return [[[self alloc] initWithConnection: connection return objc_autoreleaseReturnValue(
errorCode: errorCode] autorelease]; [[self alloc] initWithConnection: connection
errorCode: errorCode]);
} }
- (instancetype)init - (instancetype)init
@ -43,7 +44,7 @@
{ {
self = [super init]; self = [super init];
_connection = [connection retain]; _connection = objc_retain(connection);
_errorCode = errorCode; _errorCode = errorCode;
return self; return self;
@ -51,7 +52,7 @@
- (void)dealloc - (void)dealloc
{ {
[_connection release]; objc_release(_connection);
[super dealloc]; [super dealloc];
} }

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -24,8 +24,9 @@
+ (instancetype)exceptionWithStatement: (SL3PreparedStatement *)statement + (instancetype)exceptionWithStatement: (SL3PreparedStatement *)statement
errorCode: (int)errorCode errorCode: (int)errorCode
{ {
return [[[self alloc] initWithStatement: statement return objc_autoreleaseReturnValue(
errorCode: errorCode] autorelease]; [[self alloc] initWithStatement: statement
errorCode: errorCode]);
} }
- (instancetype)initWithStatement: (SL3PreparedStatement *)statement - (instancetype)initWithStatement: (SL3PreparedStatement *)statement
@ -35,9 +36,9 @@
errorCode: errorCode]; errorCode: errorCode];
@try { @try {
_statement = [statement retain]; _statement = objc_retain(statement);
} @catch (id e) { } @catch (id e) {
[self release]; objc_release(self);
@throw e; @throw e;
} }
@ -46,7 +47,7 @@
- (void)dealloc - (void)dealloc
{ {
[_statement release]; objc_release(_statement);
[super dealloc]; [super dealloc];
} }

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -31,9 +31,10 @@
flags: (int)flags flags: (int)flags
errorCode: (int)errorCode errorCode: (int)errorCode
{ {
return [[[self alloc] initWithIRI: IRI return objc_autoreleaseReturnValue(
flags: flags [[self alloc] initWithIRI: IRI
errorCode: errorCode] autorelease]; flags: flags
errorCode: errorCode]);
} }
- (instancetype)initWithConnection: (SL3Connection *)connection - (instancetype)initWithConnection: (SL3Connection *)connection
@ -53,7 +54,7 @@
_IRI = [IRI copy]; _IRI = [IRI copy];
_flags = flags; _flags = flags;
} @catch (id e) { } @catch (id e) {
[self release]; objc_release(self);
@throw e; @throw e;
} }
@ -62,7 +63,7 @@
- (void)dealloc - (void)dealloc
{ {
[_IRI release]; objc_release(_IRI);
[super dealloc]; [super dealloc];
} }

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -31,9 +31,10 @@
SQLStatement: (OFConstantString *)SQLStatement SQLStatement: (OFConstantString *)SQLStatement
errorCode: (int)errorCode errorCode: (int)errorCode
{ {
return [[[self alloc] initWithConnection: connection return objc_autoreleaseReturnValue(
SQLStatement: SQLStatement [[self alloc] initWithConnection: connection
errorCode: errorCode] autorelease]; SQLStatement: SQLStatement
errorCode: errorCode]);
} }
- (instancetype)initWithConnection: (SL3Connection *)connection - (instancetype)initWithConnection: (SL3Connection *)connection
@ -50,9 +51,9 @@
errorCode: errorCode]; errorCode: errorCode];
@try { @try {
_SQLStatement = [SQLStatement retain]; _SQLStatement = objc_retain(SQLStatement);
} @catch (id e) { } @catch (id e) {
[self release]; objc_release(self);
@throw e; @throw e;
} }
@ -61,7 +62,7 @@
- (void)dealloc - (void)dealloc
{ {
[_SQLStatement release]; objc_release(_SQLStatement);
[super dealloc]; [super dealloc];
} }

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -30,8 +30,9 @@
+ (instancetype)exceptionWithStatement: (SL3PreparedStatement *)statement + (instancetype)exceptionWithStatement: (SL3PreparedStatement *)statement
errorCode: (int)errorCode errorCode: (int)errorCode
{ {
return [[[self alloc] initWithStatement: statement return objc_autoreleaseReturnValue(
errorCode: errorCode] autorelease]; [[self alloc] initWithStatement: statement
errorCode: errorCode]);
} }
- (instancetype)initWithConnection: (SL3Connection *)connection - (instancetype)initWithConnection: (SL3Connection *)connection
@ -47,9 +48,9 @@
errorCode: errorCode]; errorCode: errorCode];
@try { @try {
_statement = [statement retain]; _statement = objc_retain(statement);
} @catch (id e) { } @catch (id e) {
[self release]; objc_release(self);
@throw e; @throw e;
} }
@ -58,7 +59,7 @@
- (void)dealloc - (void)dealloc
{ {
[_statement release]; objc_release(_statement);
[super dealloc]; [super dealloc];
} }

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2020, 2021, 2023, 2024 Jonathan Schleifer <js@nil.im> * Copyright (c) 2020, 2021, 2023, 2024, 2025 Jonathan Schleifer <js@nil.im>
* *
* https://fl.nil.im/objsqlite3 * https://git.nil.im/ObjFW/ObjSQLite3
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above