2
0

Update for rename of pgconn.PreparedStatementDescription

This commit is contained in:
Jack Christensen
2019-08-24 20:44:56 -05:00
parent 0c3e59b07a
commit 3675337e5b
7 changed files with 65 additions and 63 deletions
+4 -4
View File
@@ -69,7 +69,7 @@ func (ct *copyFrom) run(ctx context.Context) (int64, error) {
}
quotedColumnNames := cbuf.String()
ps, err := ct.conn.Prepare(ctx, "", fmt.Sprintf("select %s from %s", quotedColumnNames, quotedTableName))
sd, err := ct.conn.Prepare(ctx, "", fmt.Sprintf("select %s from %s", quotedColumnNames, quotedTableName))
if err != nil {
return 0, err
}
@@ -87,7 +87,7 @@ func (ct *copyFrom) run(ctx context.Context) (int64, error) {
moreRows := true
for moreRows {
var err error
moreRows, buf, err = ct.buildCopyBuf(buf, ps)
moreRows, buf, err = ct.buildCopyBuf(buf, sd)
if err != nil {
w.CloseWithError(err)
return
@@ -117,7 +117,7 @@ func (ct *copyFrom) run(ctx context.Context) (int64, error) {
return commandTag.RowsAffected(), err
}
func (ct *copyFrom) buildCopyBuf(buf []byte, ps *pgconn.PreparedStatementDescription) (bool, []byte, error) {
func (ct *copyFrom) buildCopyBuf(buf []byte, sd *pgconn.StatementDescription) (bool, []byte, error) {
for ct.rowSrc.Next() {
values, err := ct.rowSrc.Values()
@@ -130,7 +130,7 @@ func (ct *copyFrom) buildCopyBuf(buf []byte, ps *pgconn.PreparedStatementDescrip
buf = pgio.AppendInt16(buf, int16(len(ct.columnNames)))
for i, val := range values {
buf, err = encodePreparedStatementArgument(ct.conn.ConnInfo, buf, ps.Fields[i].DataTypeOID, val)
buf, err = encodePreparedStatementArgument(ct.conn.ConnInfo, buf, sd.Fields[i].DataTypeOID, val)
if err != nil {
return false, nil, err
}