File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -1018,10 +1018,7 @@ func (rc *SQLiteRows) Columns() []string {
1018
1018
return rc .cols
1019
1019
}
1020
1020
1021
- // DeclTypes return column types.
1022
- func (rc * SQLiteRows ) DeclTypes () []string {
1023
- rc .s .mu .Lock ()
1024
- defer rc .s .mu .Unlock ()
1021
+ func (rc * SQLiteRows ) declTypes () []string {
1025
1022
if rc .s .s != nil && rc .decltype == nil {
1026
1023
rc .decltype = make ([]string , rc .nc )
1027
1024
for i := 0 ; i < rc .nc ; i ++ {
@@ -1031,30 +1028,33 @@ func (rc *SQLiteRows) DeclTypes() []string {
1031
1028
return rc .decltype
1032
1029
}
1033
1030
1031
+ // DeclTypes return column types.
1032
+ func (rc * SQLiteRows ) DeclTypes () []string {
1033
+ rc .s .mu .Lock ()
1034
+ defer rc .s .mu .Unlock ()
1035
+ return rc .declTypes ()
1036
+ }
1037
+
1034
1038
// Next move cursor to next.
1035
1039
func (rc * SQLiteRows ) Next (dest []driver.Value ) error {
1036
1040
if rc .s .closed {
1037
1041
return io .EOF
1038
1042
}
1039
1043
rc .s .mu .Lock ()
1044
+ defer rc .s .mu .Unlock ()
1040
1045
rv := C .sqlite3_step (rc .s .s )
1041
1046
if rv == C .SQLITE_DONE {
1042
- rc .s .mu .Unlock ()
1043
1047
return io .EOF
1044
1048
}
1045
1049
if rv != C .SQLITE_ROW {
1046
- defer rc .s .mu .Unlock ()
1047
1050
rv = C .sqlite3_reset (rc .s .s )
1048
1051
if rv != C .SQLITE_OK {
1049
1052
return rc .s .c .lastError ()
1050
1053
}
1051
1054
return nil
1052
1055
}
1053
1056
1054
- rc .DeclTypes ()
1055
-
1056
- rc .s .mu .Lock ()
1057
- defer rc .s .mu .Unlock ()
1057
+ rc .declTypes ()
1058
1058
1059
1059
for i := range dest {
1060
1060
switch C .sqlite3_column_type (rc .s .s , C .int (i )) {
You can’t perform that action at this time.
0 commit comments