Merge branch 'zachmu/csv-out' of github.com:dolthub/dolt into zachmu/csv-out

This commit is contained in:
Zach Musgrave
2023-01-24 11:53:50 -08:00
4 changed files with 9 additions and 8 deletions

View File

@@ -161,8 +161,8 @@ github.com/dolthub/flatbuffers v1.13.0-dh.1 h1:OWJdaPep22N52O/0xsUevxJ6Qfw1M2txC
github.com/dolthub/flatbuffers v1.13.0-dh.1/go.mod h1:CorYGaDmXjHz1Z7i50PYXG1Ricn31GcA2wNOTFIQAKE=
github.com/dolthub/fslock v0.0.3 h1:iLMpUIvJKMKm92+N1fmHVdxJP5NdyDK5bK7z7Ba2s2U=
github.com/dolthub/fslock v0.0.3/go.mod h1:QWql+P17oAAMLnL4HGB5tiovtDuAjdDTPbuqx7bYfa0=
github.com/dolthub/go-mysql-server v0.14.1-0.20230120232513-4b0d7c8fb009 h1:PEMDkiZX89Cz0/6H4ZA3Umryi7p+av47KnBDb10B0I8=
github.com/dolthub/go-mysql-server v0.14.1-0.20230120232513-4b0d7c8fb009/go.mod h1:ykkkC0nmCN0Dd7bpm+AeM6w4jcxfV9vIfLQEmajj20I=
github.com/dolthub/go-mysql-server v0.14.1-0.20230124025200-7ea16f4b9713 h1:GsSpaRBYKiX2p30ytoKwzgpKfdmWu6Ihdo8vcJbxfjk=
github.com/dolthub/go-mysql-server v0.14.1-0.20230124025200-7ea16f4b9713/go.mod h1:ykkkC0nmCN0Dd7bpm+AeM6w4jcxfV9vIfLQEmajj20I=
github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488 h1:0HHu0GWJH0N6a6keStrHhUAK5/o9LVfkh44pvsV4514=
github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488/go.mod h1:ehexgi1mPxRTk0Mok/pADALuHbvATulTh6gzr7NzZto=
github.com/dolthub/jsonpath v0.0.0-20210609232853-d49537a30474 h1:xTrR+l5l+1Lfq0NvhiEsctylXinUMFhhsqaEcl414p8=

View File

@@ -20,6 +20,8 @@ import (
"fmt"
"strings"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/dolt/go/libraries/doltcore/conflict"
"github.com/dolthub/dolt/go/libraries/doltcore/diff"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
@@ -30,7 +32,6 @@ import (
"github.com/dolthub/dolt/go/store/hash"
"github.com/dolthub/dolt/go/store/prolly/tree"
"github.com/dolthub/dolt/go/store/types"
"github.com/dolthub/go-mysql-server/sql"
)
type MergeOpts struct {

View File

@@ -24,6 +24,7 @@ import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
// needed so that system vars are initialized correctly in the empty context used during printing
_ "github.com/dolthub/go-mysql-server/sql/variables"
"github.com/dolthub/vitess/go/sqltypes"
@@ -66,7 +67,7 @@ func NewJSONSqlWriter(wr io.WriteCloser, sch sql.Schema) (*RowWriter, error) {
if err != nil {
return nil, err
}
w.sqlSch = sch
return w, nil
}
@@ -221,11 +222,10 @@ func (j *RowWriter) jsonDataForSqlSchema(row sql.Row) ([]byte, error) {
colValMap[col.Name] = val
}
return marshalToJson(colValMap)
}
func (j *RowWriter) Flush() error {
return j.bWr.Flush()
}

View File

@@ -96,7 +96,7 @@ func NewCSVSqlWriter(wr io.WriteCloser, sch sql.Schema, info *CSVFileInfo) (*CSV
nm := col.Name
colNames[i] = &nm
}
err := csvw.write(colNames)
if err != nil {
wr.Close()
@@ -137,7 +137,7 @@ func toCsvString(colType sql.Type, val interface{}) (string, error) {
return "", err
}
}
return v, nil
}