func rowsiFromStatement(si driver.Stmt, args ...interface{}) (driver.Rows, error) { // -1 means the driver doesn't know how to count the number of // placeholders, so we won't sanity check input here and instead let the // driver deal with errors. if want := si.NumInput(); want != -1 && len(args) != want { return nil, fmt.Errorf("sql: statement expects %d inputs; got %d", si.NumInput(), len(args)) } dargs, err := driverArgs(si, args) if err != nil { return nil, err } rowsi, err := si.Query(dargs) if err != nil { return nil, err } return rowsi, nil }
func resultFromStatement(si driver.Stmt, args ...interface{}) (Result, error) { // -1 means the driver doesn't know how to count the number of // placeholders, so we won't sanity check input here and instead let the // driver deal with errors. if want := si.NumInput(); want != -1 && len(args) != want { return nil, fmt.Errorf("sql: expected %d arguments, got %d", want, len(args)) } dargs, err := driverArgs(si, args) if err != nil { return nil, err } resi, err := si.Exec(dargs) if err != nil { return nil, err } return result{resi}, nil }