Commit c730f5f1 authored by Vladimir Barsukov's avatar Vladimir Barsukov
Browse files

fix sql prepare

parent 45bffcb4
......@@ -6,13 +6,13 @@ func (d *Pool) WExec(sql string, args ...any) error {
func (d *Pool) WExecNamed(sql string, args map[string]any) error {
newSql, newArgs := d.prepare(sql, args)
return d.qExec(d.SrvMaster, newSql, newArgs)
return d.qExec(d.SrvMaster, newSql, newArgs...)
}
func (d *Pool) WExecOpts(opts Opts) error {
sql, args := opts.Opts()
newSql, newArgs := d.prepare(sql, args)
return d.qExec(d.SrvMaster, newSql, newArgs)
return d.qExec(d.SrvMaster, newSql, newArgs...)
}
func (d *Pool) qExec(q *Conn, sql string, args ...any) error {
......
......@@ -10,13 +10,13 @@ func (d *Pool) WGet(dst any, sql string, args ...any) error {
func (d *Pool) WGetNamed(dst any, sql string, args map[string]any) error {
newSql, newArgs := d.prepare(sql, args)
return d.qGet(d.SrvMaster, dst, newSql, newArgs)
return d.qGet(d.SrvMaster, dst, newSql, newArgs...)
}
func (d *Pool) WGetOpts(dst any, opts Opts) error {
sql, args := opts.Opts()
newSql, newArgs := d.prepare(sql, args)
return d.qGet(d.SrvMaster, dst, newSql, newArgs)
return d.qGet(d.SrvMaster, dst, newSql, newArgs...)
}
func (d *Pool) Get(dst any, sql string, args ...any) error {
......@@ -36,7 +36,7 @@ func (d *Pool) GetOpts(dst any, opts Opts) error {
newSql, newArgs := d.prepare(sql, args)
return d.execWrapper(ConnModeSync, dst, func(q *Conn, dst1 any) error {
return d.qGet(q, dst1, newSql, newArgs)
return d.qGet(q, dst1, newSql, newArgs...)
})
}
......@@ -49,7 +49,7 @@ func (d *Pool) GetAsyncNamed(dst any, sql string, args map[string]any) error {
return d.execWrapper(ConnModeAsync, dst, func(q *Conn, dst1 any) error {
newSql, newArgs := d.prepare(sql, args)
return d.qGet(q, dst1, newSql, newArgs)
return d.qGet(q, dst1, newSql, newArgs...)
})
}
func (d *Pool) GetAsyncOpts(dst any, opts Opts) error {
......@@ -58,7 +58,7 @@ func (d *Pool) GetAsyncOpts(dst any, opts Opts) error {
return d.execWrapper(ConnModeAsync, dst, func(q *Conn, dst1 any) error {
return d.qGet(q, dst1, newSql, newArgs)
return d.qGet(q, dst1, newSql, newArgs...)
})
}
......
......@@ -10,13 +10,13 @@ func (d *Pool) WSelect(dst any, sql string, args ...any) error {
func (d *Pool) WSelectNamed(dst any, sql string, args map[string]any) error {
newSql, newArgs := d.prepare(sql, args)
return d.qSelect(d.SrvMaster, dst, newSql, newArgs)
return d.qSelect(d.SrvMaster, dst, newSql, newArgs...)
}
func (d *Pool) WSelectOpts(dst any, opts Opts) error {
sql, args := opts.Opts()
newSql, newArgs := d.prepare(sql, args)
return d.qSelect(d.SrvMaster, dst, newSql, newArgs)
return d.qSelect(d.SrvMaster, dst, newSql, newArgs...)
}
func (d *Pool) Select(dst any, sql string, args ...any) error {
......@@ -28,7 +28,7 @@ func (d *Pool) SelectNamed(dst any, sql string, args map[string]any) error {
return d.execWrapper(ConnModeSync, dst, func(conn *Conn, dst1 any) error {
newSql, newArgs := d.prepare(sql, args)
return d.qSelect(conn, dst1, newSql, newArgs)
return d.qSelect(conn, dst1, newSql, newArgs...)
})
}
func (d *Pool) SelectOpts(dst any, opts Opts) error {
......@@ -36,7 +36,7 @@ func (d *Pool) SelectOpts(dst any, opts Opts) error {
newSql, newArgs := d.prepare(sql, args)
return d.execWrapper(ConnModeSync, dst, func(conn *Conn, dst1 any) error {
return d.qSelect(conn, dst1, newSql, newArgs)
return d.qSelect(conn, dst1, newSql, newArgs...)
})
}
......@@ -49,7 +49,7 @@ func (d *Pool) SelectAsyncNamed(dst any, sql string, args map[string]any) error
return d.execWrapper(ConnModeAsync, dst, func(conn *Conn, dst1 any) error {
newSql, newArgs := d.prepare(sql, args)
return d.qSelect(conn, dst1, newSql, newArgs)
return d.qSelect(conn, dst1, newSql, newArgs...)
})
}
func (d *Pool) SelectAsyncOpts(dst any, opts Opts) error {
......@@ -57,7 +57,7 @@ func (d *Pool) SelectAsyncOpts(dst any, opts Opts) error {
newSql, newArgs := d.prepare(sql, args)
return d.execWrapper(ConnModeAsync, dst, func(conn *Conn, dst1 any) error {
return d.qSelect(conn, dst1, newSql, newArgs)
return d.qSelect(conn, dst1, newSql, newArgs...)
})
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment