ObjSQLite3  Check-in [c64a1aa6fa]

Overview
Comment:SL3Connection: Add a way to prepare statements
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c64a1aa6faddaa64012516ff343bdadd114618fb7e3164beafdd9a00e38333ea
User & Date: js 2020-10-01 21:26:27
Context
2020-10-01
21:58
Add skeleton for tests check-in: f9e1d909b8 user: js tags: trunk
21:26
SL3Connection: Add a way to prepare statements check-in: c64a1aa6fa user: js tags: trunk
21:21
SL3Connection: Add a convenience initializer check-in: e8a975fc72 user: js tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/SL3Connection.h.

20
21
22
23
24
25
26



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

43
44
45
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import <ObjFW/ObjFW.h>

#include <sqlite3.h>




OF_ASSUME_NONNULL_BEGIN

@interface SL3Connection: OFObject
{
#ifdef SL3_PUBLIC_IVARS
@public
#endif
	sqlite3 *_db;
}

+ (instancetype)connectionWithPath: (OFString *)path;
+ (instancetype)connectionWithPath: (OFString *)path
			     flags: (int)flags;
- (instancetype)initWithPath: (OFString *)path;
- (instancetype)initWithPath: (OFString *)path
		       flags: (int)flags OF_DESIGNATED_INITIALIZER;

@end

OF_ASSUME_NONNULL_END







>
>
>
















>



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import <ObjFW/ObjFW.h>

#include <sqlite3.h>

#import "SL3PreparedStatement.h"
#import "SL3PreparedStatement+Private.h"

OF_ASSUME_NONNULL_BEGIN

@interface SL3Connection: OFObject
{
#ifdef SL3_PUBLIC_IVARS
@public
#endif
	sqlite3 *_db;
}

+ (instancetype)connectionWithPath: (OFString *)path;
+ (instancetype)connectionWithPath: (OFString *)path
			     flags: (int)flags;
- (instancetype)initWithPath: (OFString *)path;
- (instancetype)initWithPath: (OFString *)path
		       flags: (int)flags OF_DESIGNATED_INITIALIZER;
- (SL3PreparedStatement *)prepareStatement: (OFConstantString *)SQL;
@end

OF_ASSUME_NONNULL_END

Changes to src/SL3Connection.m.

17
18
19
20
21
22
23

24
25
26
27
28
29
30
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import "SL3Connection.h"


#import "SL3OpenFailedException.h"

@implementation SL3Connection
+ (instancetype)connectionWithPath: (OFString *)path
{
	return [[[self alloc] initWithPath: path] autorelease];







>







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import "SL3Connection.h"
#import "SL3PreparedStatement.h"

#import "SL3OpenFailedException.h"

@implementation SL3Connection
+ (instancetype)connectionWithPath: (OFString *)path
{
	return [[[self alloc] initWithPath: path] autorelease];
65
66
67
68
69
70
71







72

- (void)dealloc
{
	sqlite3_close(_db);

	[super dealloc];
}







@end







>
>
>
>
>
>
>

66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

- (void)dealloc
{
	sqlite3_close(_db);

	[super dealloc];
}

- (SL3PreparedStatement *)prepareStatement: (OFConstantString *)SQL
{
	return [[[SL3PreparedStatement alloc]
	    sl3_initWithConnection: self
		      SQLStatement: SQL] autorelease];
}
@end