Adjust to ObjSQLite3 changes

FossilOrigin-Name: f599dcefbe494390a5babff9fc664f2f0ce08dd5bd6319a220ced3d3b17cce45
This commit is contained in:
Jonathan Schleifer 2024-08-11 15:37:57 +00:00
parent 914089413c
commit c6c2c39856
3 changed files with 12 additions and 11 deletions

View file

@ -27,18 +27,18 @@ OF_ASSUME_NONNULL_BEGIN
/**
* @brief Creates a new SQLite3-based storage for @ref MTXClient.
*
* @param path The path for the SQLite3 database
* @param IRI The IRI for the SQLite3 database
* @return An autoreleased MTXSQLite3Storage
*/
+ (instancetype)storageWithPath: (OFString *)path;
+ (instancetype)storageWithIRI: (OFIRI *)IRI;
/**
* @brief Initializes an already allocated MTXSQLite3Storage.
*
* @param path The path for the SQLite3 database
* @param IRI The IRI for the SQLite3 database
* @return An initialized MTXSQLite3Storage
*/
- (instancetype)initWithPath: (OFString *)path OF_DESIGNATED_INITIALIZER;
- (instancetype)initWithIRI: (OFIRI *)IRI OF_DESIGNATED_INITIALIZER;
@end
OF_ASSUME_NONNULL_END

View file

@ -29,19 +29,19 @@
SL3PreparedStatement *_joinedRoomsGetStatement;
}
+ (instancetype)storageWithPath: (OFString *)path
+ (instancetype)storageWithIRI: (OFIRI *)IRI
{
return [[[self alloc] initWithPath: path] autorelease];
return [[[self alloc] initWithIRI: IRI] autorelease];
}
- (instancetype)initWithPath: (OFString *)path
- (instancetype)initWithIRI: (OFIRI *)IRI
{
self = [super init];
@try {
void *pool = objc_autoreleasePoolPush();
_conn = [[SL3Connection alloc] initWithPath: path];
_conn = [[SL3Connection alloc] initWithIRI: IRI];
[self createTables];
@ -134,7 +134,7 @@
return nil;
OFString *nextBatch =
[_nextBatchGetStatement.rowDictionary[@"next_batch"] retain];
[_nextBatchGetStatement.currentRowDictionary[@"next_batch"] retain];
objc_autoreleasePoolPop(pool);
@ -179,7 +179,7 @@
while ([_joinedRoomsGetStatement step])
[joinedRooms addObject:
_joinedRoomsGetStatement.rowDictionary[@"room_id"]];
_joinedRoomsGetStatement.currentRowDictionary[@"room_id"]];
objc_autoreleasePoolPop(pool);

View file

@ -45,8 +45,9 @@ OF_APPLICATION_DELEGATE(Tests)
}
OFIRI *homeserver = [OFIRI IRIWithString: environment[@"OBJMATRIX_HS"]];
OFIRI *storageIRI = [OFIRI fileIRIWithPath: @"tests.db"];
id <MTXStorage> storage =
[MTXSQLite3Storage storageWithPath: @"tests.db"];
[MTXSQLite3Storage storageWithIRI: storageIRI];
[MTXClient logInWithUser: environment[@"OBJMATRIX_USER"]
password: environment[@"OBJMATRIX_PASS"]
homeserver: homeserver