@@ -9,8 +9,11 @@ pub const c = @cImport({
9
9
@cInclude ("sqlite3.h" );
10
10
});
11
11
12
- usingnamespace @import ("query.zig" );
13
- usingnamespace @import ("error.zig" );
12
+ const Text = @import ("query.zig" ).Text ;
13
+ const ParsedQuery = @import ("query.zig" ).ParsedQuery ;
14
+
15
+ const errors = @import ("errors.zig" );
16
+ const Error = errors .Error ;
14
17
15
18
const logger = std .log .scoped (.sqlite );
16
19
@@ -72,11 +75,11 @@ pub const Blob = struct {
72
75
pub fn close (self : * Self ) ! void {
73
76
const result = c .sqlite3_blob_close (self .handle );
74
77
if (result != c .SQLITE_OK ) {
75
- return errorFromResultCode (result );
78
+ return errors . errorFromResultCode (result );
76
79
}
77
80
}
78
81
79
- pub const Reader = io .Reader (* Self , Error , read );
82
+ pub const Reader = io .Reader (* Self , errors . Error , read );
80
83
81
84
/// reader returns a io.Reader.
82
85
pub fn reader (self : * Self ) Reader {
@@ -100,7 +103,7 @@ pub const Blob = struct {
100
103
self .offset ,
101
104
);
102
105
if (result != c .SQLITE_OK ) {
103
- return errorFromResultCode (result );
106
+ return errors . errorFromResultCode (result );
104
107
}
105
108
106
109
self .offset += @intCast (c_int , tmp_buffer .len );
@@ -123,7 +126,7 @@ pub const Blob = struct {
123
126
self .offset ,
124
127
);
125
128
if (result != c .SQLITE_OK ) {
126
- return errorFromResultCode (result );
129
+ return errors . errorFromResultCode (result );
127
130
}
128
131
129
132
self .offset += @intCast (c_int , data .len );
@@ -352,7 +355,7 @@ pub const Db = struct {
352
355
} else {
353
356
diags .err = getDetailedErrorFromResultCode (result );
354
357
}
355
- return errorFromResultCode (result );
358
+ return errors . errorFromResultCode (result );
356
359
}
357
360
358
361
return Self { .db = db .? };
@@ -370,7 +373,7 @@ pub const Db = struct {
370
373
} else {
371
374
diags .err = getDetailedErrorFromResultCode (result );
372
375
}
373
- return errorFromResultCode (result );
376
+ return errors . errorFromResultCode (result );
374
377
}
375
378
376
379
return Self { .db = db .? };
@@ -579,7 +582,7 @@ pub fn Iterator(comptime Type: type) type {
579
582
}
580
583
if (result != c .SQLITE_ROW ) {
581
584
diags .err = getLastDetailedErrorFromDb (self .db );
582
- return errorFromResultCode (result );
585
+ return errors . errorFromResultCode (result );
583
586
}
584
587
585
588
const columns = c .sqlite3_column_count (self .stmt );
@@ -637,7 +640,7 @@ pub fn Iterator(comptime Type: type) type {
637
640
}
638
641
if (result != c .SQLITE_ROW ) {
639
642
diags .err = getLastDetailedErrorFromDb (self .db );
640
- return errorFromResultCode (result );
643
+ return errors . errorFromResultCode (result );
641
644
}
642
645
643
646
const columns = c .sqlite3_column_count (self .stmt );
@@ -1022,7 +1025,7 @@ pub fn Statement(comptime opts: StatementOptions, comptime query: ParsedQuery) t
1022
1025
);
1023
1026
if (result != c .SQLITE_OK ) {
1024
1027
diags .err = getLastDetailedErrorFromDb (db .db );
1025
- return errorFromResultCode (result );
1028
+ return errors . errorFromResultCode (result );
1026
1029
}
1027
1030
break :blk tmp .? ;
1028
1031
};
@@ -1181,7 +1184,7 @@ pub fn Statement(comptime opts: StatementOptions, comptime query: ParsedQuery) t
1181
1184
c .SQLITE_DONE = > {},
1182
1185
else = > {
1183
1186
diags .err = getLastDetailedErrorFromDb (self .db );
1184
- return errorFromResultCode (result );
1187
+ return errors . errorFromResultCode (result );
1185
1188
},
1186
1189
}
1187
1190
}
0 commit comments