Skip to content

data base locked #4

Description

@yuqianliuli

In the line `/ SQLSelectAllRows
func (fds *_FieldsMap) SQLSelectAllRows(ctx context.Context, tx *sql.Tx,
db *sql.DB) ([]interface{}, error) {

stmt, err := fds.SQLSelectStmt(ctx, tx, db, "")
if err != nil {
	return nil, err
}
defer stmt.Close() // must close stmt after stmt used

rs, err := stmt.QueryContext(ctx)
if err != nil {
	return nil, err
}
**defer rs.Close()**// this should be added when use sqlite3 
var objs []interface{}
for rs.Next() {
	obj := reflect.New(fds.reftype).Interface()
	fieldsMap, err := NewFieldsMap(fds.table, obj)
	if err != nil {
		return nil, err
	}

	err = rs.Scan(fieldsMap.GetFieldSaveAddrs()...)
	if err != nil {
		return nil, err
	}
	fieldsMap.MapBackToObject()
	objs = append(objs, obj)
}

return objs, nil

}`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions