Use IRIs instead of paths
FossilOrigin-Name: 91e2a5071199dc8d87735ad50ee74a6ce030c22f1bb0d70668bef172384dcde3
This commit is contained in:
parent
5c91e6f832
commit
bd3543537b
5 changed files with 53 additions and 55 deletions
|
@ -24,37 +24,35 @@
|
|||
#import "SL3OpenFailedException.h"
|
||||
|
||||
@implementation SL3Connection
|
||||
+ (instancetype)connectionWithPath: (OFString *)path
|
||||
+ (instancetype)connectionWithIRI: (OFIRI *)IRI
|
||||
{
|
||||
return [[[self alloc] initWithPath: path] autorelease];
|
||||
return [[[self alloc] initWithIRI: IRI] autorelease];
|
||||
}
|
||||
|
||||
+ (instancetype)connectionWithPath: (OFString *)path
|
||||
flags: (int)flags
|
||||
+ (instancetype)connectionWithIRI: (OFIRI *)IRI flags: (int)flags
|
||||
{
|
||||
return [[[self alloc] initWithPath: path
|
||||
flags: flags] autorelease];
|
||||
return [[[self alloc] initWithIRI: IRI flags: flags] autorelease];
|
||||
}
|
||||
|
||||
- (instancetype)initWithPath: (OFString *)path
|
||||
- (instancetype)initWithIRI: (OFIRI *)IRI
|
||||
{
|
||||
return [self initWithPath: path
|
||||
flags: SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE];
|
||||
return [self initWithIRI: IRI
|
||||
flags: SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE];
|
||||
}
|
||||
|
||||
- (instancetype)initWithPath: (OFString *)path
|
||||
flags: (int)flags
|
||||
- (instancetype)initWithIRI: (OFIRI *)IRI flags: (int)flags
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
@try {
|
||||
int code = sqlite3_open_v2(path.UTF8String, &_conn, flags,
|
||||
int code = sqlite3_open_v2(
|
||||
IRI.fileSystemRepresentation.UTF8String, &_conn, flags,
|
||||
NULL);
|
||||
|
||||
if (code != SQLITE_OK)
|
||||
@throw [SL3OpenFailedException exceptionWithPath: path
|
||||
flags: flags
|
||||
errorCode: code];
|
||||
@throw [SL3OpenFailedException exceptionWithIRI: IRI
|
||||
flags: flags
|
||||
errorCode: code];
|
||||
} @catch (id e) {
|
||||
[self release];
|
||||
@throw e;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue