SL3Connection: Add -[executeStatement:]
FossilOrigin-Name: 02992f86b3c02a7784a12c4b9a7ffa7b70614999a07b799c567755bde3d24cea
This commit is contained in:
parent
6c2ddfe254
commit
68eee4790f
5 changed files with 18 additions and 21 deletions
|
@ -23,6 +23,7 @@
|
|||
#import "SL3Connection.h"
|
||||
#import "SL3PreparedStatement.h"
|
||||
|
||||
#import "SL3ExecuteStatementFailedException.h"
|
||||
#import "SL3OpenFailedException.h"
|
||||
|
||||
@implementation SL3Connection
|
||||
|
@ -50,7 +51,8 @@
|
|||
self = [super init];
|
||||
|
||||
@try {
|
||||
int code = sqlite3_open_v2(path.UTF8String, &_db, flags, NULL);
|
||||
int code = sqlite3_open_v2(path.UTF8String, &_conn, flags,
|
||||
NULL);
|
||||
|
||||
if (code != SQLITE_OK)
|
||||
@throw [SL3OpenFailedException exceptionWithPath: path
|
||||
|
@ -66,7 +68,7 @@
|
|||
|
||||
- (void)dealloc
|
||||
{
|
||||
sqlite3_close(_db);
|
||||
sqlite3_close(_conn);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -77,4 +79,14 @@
|
|||
sl3_initWithConnection: self
|
||||
SQLStatement: SQL] autorelease];
|
||||
}
|
||||
|
||||
- (void)executeStatement: (OFConstantString *)SQL
|
||||
{
|
||||
int code = sqlite3_exec(_conn, SQL.UTF8String, NULL, NULL, NULL);
|
||||
|
||||
if (code != SQLITE_OK)
|
||||
@throw [SL3ExecuteStatementFailedException
|
||||
exceptionWithConnection: self
|
||||
errorCode: code];
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue