Compare commits

..

No commits in common. "main" and "1.0-release" have entirely different histories.

23 changed files with 103 additions and 108 deletions

View file

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

View file

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

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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
@ -26,13 +26,12 @@
@implementation SL3Connection
+ (instancetype)connectionWithIRI: (OFIRI *)IRI
{
return objc_autoreleaseReturnValue([[self alloc] initWithIRI: IRI]);
return [[[self alloc] initWithIRI: IRI] autorelease];
}
+ (instancetype)connectionWithIRI: (OFIRI *)IRI flags: (int)flags
{
return objc_autoreleaseReturnValue([[self alloc] initWithIRI: IRI
flags: flags]);
return [[[self alloc] initWithIRI: IRI flags: flags] autorelease];
}
- (instancetype)initWithIRI: (OFIRI *)IRI
@ -55,7 +54,7 @@
flags: flags
errorCode: code];
} @catch (id e) {
objc_release(self);
[self release];
@throw e;
}
@ -71,9 +70,9 @@
- (SL3PreparedStatement *)prepareStatement: (OFConstantString *)SQLStatement
{
return objc_autoreleaseReturnValue([[SL3PreparedStatement alloc]
return [[[SL3PreparedStatement alloc]
sl3_initWithConnection: self
SQLStatement: SQLStatement]);
SQLStatement: SQLStatement] autorelease];
}
- (void)executeStatement: (OFConstantString *)SQLStatement

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2021, 2024, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020, 2021, 2024 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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
@ -25,6 +25,12 @@
#import "SL3PrepareStatementFailedException.h"
#import "SL3ResetStatementFailedException.h"
static void
releaseObject(void *object)
{
[(id)object release];
}
@implementation SL3PreparedStatement
- (instancetype)sl3_initWithConnection: (SL3Connection *)connection
SQLStatement: (OFConstantString *)SQLStatement
@ -42,9 +48,9 @@
SQLStatement: SQLStatement
errorCode: code];
_connection = objc_retain(connection);
_connection = [connection retain];
} @catch (id e) {
objc_release(self);
[self release];
@throw e;
}
@ -54,7 +60,7 @@
- (void)dealloc
{
sqlite3_finalize(_stmt);
objc_release(_connection);
[_connection release];
[super dealloc];
}
@ -81,15 +87,13 @@ bindObject(SL3PreparedStatement *statement, int column, id object)
OFString *copy = [object copy];
code = sqlite3_bind_text64(statement->_stmt, column,
copy.UTF8String, copy.UTF8StringLength,
(void (*)(void *))(void (*)(void))objc_release,
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,
(void (*)(void *))(void (*)(void))objc_release);
copy.count * copy.itemSize, releaseObject);
} else if ([object isEqual: [OFNull null]])
code = sqlite3_bind_null(statement->_stmt, column);
else

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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
@ -32,11 +32,10 @@
statement: (SL3PreparedStatement *)statement
errorCode: (int)errorCode
{
return objc_autoreleaseReturnValue(
[[self alloc] initWithObject: object
column: column
statement: statement
errorCode: errorCode]);
return [[[self alloc] initWithObject: object
column: column
statement: statement
errorCode: errorCode] autorelease];
}
- (instancetype)initWithConnection: (SL3Connection *)connection
@ -54,10 +53,10 @@
errorCode: errorCode];
@try {
_object = objc_retain(object);
_statement = objc_retain(statement);
_object = [object retain];
_statement = [statement retain];
} @catch (id e) {
objc_release(self);
[self release];
@throw e;
}
@ -66,8 +65,8 @@
- (void)dealloc
{
objc_release(_object);
objc_release(_statement);
[_object release];
[_statement release];
[super dealloc];
}

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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
@ -30,9 +30,8 @@
+ (instancetype)exceptionWithStatement: (SL3PreparedStatement *)statement
errorCode: (int)errorCode
{
return objc_autoreleaseReturnValue(
[[self alloc] initWithStatement: statement
errorCode: errorCode]);
return [[[self alloc] initWithStatement: statement
errorCode: errorCode] autorelease];
}
- (instancetype)initWithConnection: (SL3Connection *)connection
@ -48,9 +47,9 @@
errorCode: errorCode];
@try {
_statement = objc_retain(statement);
_statement = [statement retain];
} @catch (id e) {
objc_release(self);
[self release];
@throw e;
}
@ -59,7 +58,7 @@
- (void)dealloc
{
objc_release(_statement);
[_statement release];
[super dealloc];
}

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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
@ -48,8 +48,8 @@ OF_ASSUME_NONNULL_BEGIN
/**
* @brief Creates a new SQLite3 exception.
*
* @param connection The connection for which the exception occurred
* @param errorCode The SQLite3 error code
* @param connection The connection for which the exception occurred.
* @param errorCode The SQLite3 error code.
* @return A new, autoreleased SQLite3 exception
*/
+ (instancetype)exceptionWithConnection: (nullable SL3Connection *)connection
@ -60,8 +60,8 @@ OF_ASSUME_NONNULL_BEGIN
/**
* @brief Initializes an already allocated SQLite3 exception.
*
* @param connection The connection for which the exception occurred
* @param errorCode The SQLite3 error code
* @param connection The connection for which the exception occurred.
* @param errorCode The SQLite3 error code.
* @return An initialized SQLite3 exception
*/
- (instancetype)initWithConnection: (nullable SL3Connection *)connection

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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
@ -29,9 +29,8 @@
+ (instancetype)exceptionWithConnection: (SL3Connection *)connection
errorCode: (int)errorCode
{
return objc_autoreleaseReturnValue(
[[self alloc] initWithConnection: connection
errorCode: errorCode]);
return [[[self alloc] initWithConnection: connection
errorCode: errorCode] autorelease];
}
- (instancetype)init
@ -44,7 +43,7 @@
{
self = [super init];
_connection = objc_retain(connection);
_connection = [connection retain];
_errorCode = errorCode;
return self;
@ -52,7 +51,7 @@
- (void)dealloc
{
objc_release(_connection);
[_connection release];
[super dealloc];
}

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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
@ -24,9 +24,8 @@
+ (instancetype)exceptionWithStatement: (SL3PreparedStatement *)statement
errorCode: (int)errorCode
{
return objc_autoreleaseReturnValue(
[[self alloc] initWithStatement: statement
errorCode: errorCode]);
return [[[self alloc] initWithStatement: statement
errorCode: errorCode] autorelease];
}
- (instancetype)initWithStatement: (SL3PreparedStatement *)statement
@ -36,9 +35,9 @@
errorCode: errorCode];
@try {
_statement = objc_retain(statement);
_statement = [statement retain];
} @catch (id e) {
objc_release(self);
[self release];
@throw e;
}
@ -47,7 +46,7 @@
- (void)dealloc
{
objc_release(_statement);
[_statement release];
[super dealloc];
}

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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
@ -31,10 +31,9 @@
flags: (int)flags
errorCode: (int)errorCode
{
return objc_autoreleaseReturnValue(
[[self alloc] initWithIRI: IRI
flags: flags
errorCode: errorCode]);
return [[[self alloc] initWithIRI: IRI
flags: flags
errorCode: errorCode] autorelease];
}
- (instancetype)initWithConnection: (SL3Connection *)connection
@ -54,7 +53,7 @@
_IRI = [IRI copy];
_flags = flags;
} @catch (id e) {
objc_release(self);
[self release];
@throw e;
}
@ -63,7 +62,7 @@
- (void)dealloc
{
objc_release(_IRI);
[_IRI release];
[super dealloc];
}

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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
@ -31,10 +31,9 @@
SQLStatement: (OFConstantString *)SQLStatement
errorCode: (int)errorCode
{
return objc_autoreleaseReturnValue(
[[self alloc] initWithConnection: connection
SQLStatement: SQLStatement
errorCode: errorCode]);
return [[[self alloc] initWithConnection: connection
SQLStatement: SQLStatement
errorCode: errorCode] autorelease];
}
- (instancetype)initWithConnection: (SL3Connection *)connection
@ -51,9 +50,9 @@
errorCode: errorCode];
@try {
_SQLStatement = objc_retain(SQLStatement);
_SQLStatement = [SQLStatement retain];
} @catch (id e) {
objc_release(self);
[self release];
@throw e;
}
@ -62,7 +61,7 @@
- (void)dealloc
{
objc_release(_SQLStatement);
[_SQLStatement release];
[super dealloc];
}

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2024, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020, 2024 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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
@ -30,9 +30,8 @@
+ (instancetype)exceptionWithStatement: (SL3PreparedStatement *)statement
errorCode: (int)errorCode
{
return objc_autoreleaseReturnValue(
[[self alloc] initWithStatement: statement
errorCode: errorCode]);
return [[[self alloc] initWithStatement: statement
errorCode: errorCode] autorelease];
}
- (instancetype)initWithConnection: (SL3Connection *)connection
@ -48,9 +47,9 @@
errorCode: errorCode];
@try {
_statement = objc_retain(statement);
_statement = [statement retain];
} @catch (id e) {
objc_release(self);
[self release];
@throw e;
}
@ -59,7 +58,7 @@
- (void)dealloc
{
objc_release(_statement);
[_statement release];
[super dealloc];
}

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, 2021, 2023, 2024, 2025 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2020, 2021, 2023, 2024 Jonathan Schleifer <js@nil.im>
*
* https://git.nil.im/ObjFW/ObjSQLite3
* https://fl.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