mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-14 01:07:08 -06:00
Fixes for GMS bump
This commit is contained in:
@@ -303,6 +303,12 @@ func WriteEWKBPolyData(p sql.Polygon, buf []byte) {
|
||||
}
|
||||
}
|
||||
|
||||
// The Type.SQL() call takes in a SQL context to determine the output character set for types that use a collation.
|
||||
// As the SqlColToStr utility function is primarily used in places where no SQL context is available (such as commands
|
||||
// on the CLI), we force the `utf8mb4` character set to be used, as it is the most likely to be supported by the
|
||||
// destination. `utf8mb4` is the default character set for empty contexts, so we don't need to explicitly set it.
|
||||
var sqlColToStrContext = sql.NewEmptyContext()
|
||||
|
||||
// SqlColToStr is a utility function for converting a sql column of type interface{} to a string
|
||||
func SqlColToStr(sqlType sql.Type, col interface{}) (string, error) {
|
||||
if col != nil {
|
||||
@@ -314,7 +320,7 @@ func SqlColToStr(sqlType sql.Type, col interface{}) (string, error) {
|
||||
return "false", nil
|
||||
}
|
||||
default:
|
||||
res, err := sqlType.SQL(nil, col)
|
||||
res, err := sqlType.SQL(sqlColToStrContext, nil, col)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -144,6 +144,12 @@ func (j *RowWriter) WriteRow(ctx context.Context, r row.Row) error {
|
||||
}
|
||||
|
||||
func (j *RowWriter) WriteSqlRow(ctx context.Context, row sql.Row) error {
|
||||
// The Type.SQL() call takes in a SQL context to determine the output character set for types that use a collation.
|
||||
// The context given is not a SQL context, so we force the `utf8mb4` character set to be used, as it is the most
|
||||
// likely to be supported by the destination. `utf8mb4` is the default character set for empty SQL contexts, so we
|
||||
// don't need to explicitly set it.
|
||||
sqlContext := sql.NewEmptyContext()
|
||||
|
||||
if j.rowsWritten == 0 {
|
||||
err := iohelp.WriteAll(j.bWr, []byte(j.header))
|
||||
if err != nil {
|
||||
@@ -169,7 +175,7 @@ func (j *RowWriter) WriteSqlRow(ctx context.Context, row sql.Row) error {
|
||||
typeinfo.TupleTypeIdentifier,
|
||||
typeinfo.UuidTypeIdentifier,
|
||||
typeinfo.VarBinaryTypeIdentifier:
|
||||
sqlVal, err := col.TypeInfo.ToSqlType().SQL(nil, val)
|
||||
sqlVal, err := col.TypeInfo.ToSqlType().SQL(sqlContext, nil, val)
|
||||
if err != nil {
|
||||
return true, err
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ teardown() {
|
||||
run dolt sql -q "SELECT * FROM german1 WHERE c = 'Bär'"
|
||||
[ $status -eq 0 ]
|
||||
[[ $output =~ 'Bar' ]] || false
|
||||
skip "Daylon has a GMS PR to fix this"
|
||||
[[ $output =~ 'Bär' ]] || false
|
||||
[ ${#lines[@]} -eq 6 ]
|
||||
|
||||
@@ -88,7 +87,6 @@ teardown() {
|
||||
run dolt sql -q "SELECT * FROM german1 WHERE c = 'Bär'"
|
||||
[ $status -eq 0 ]
|
||||
[[ ! $output =~ 'Bar' ]] || false
|
||||
skip "Daylon has a GMS PR to fix this"
|
||||
[[ $output =~ 'Bär' ]] || false
|
||||
[ ${#lines[@]} -eq 5 ]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user