Dolt changes for sql types package

This commit is contained in:
Zach Musgrave
2023-01-09 11:21:34 -08:00
parent 5f3b5cdb91
commit ad4bf92b95
142 changed files with 1231 additions and 1097 deletions
+3 -2
View File
@@ -18,6 +18,7 @@ import (
"testing"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -231,9 +232,9 @@ func emptyRowDiff(columns int) rowDiff {
}
func strCol(name string) *sql.Column {
return &sql.Column{Name: name, Type: sql.Text}
return &sql.Column{Name: name, Type: types.Text}
}
func intCol(name string) *sql.Column {
return &sql.Column{Name: name, Type: sql.Int64}
return &sql.Column{Name: name, Type: types.Int64}
}
+3 -2
View File
@@ -21,6 +21,7 @@ import (
"time"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
"github.com/dolthub/dolt/go/libraries/doltcore/row"
@@ -201,7 +202,7 @@ func printOKResult(ctx *sql.Context, iter sql.RowIter, start time.Time) error {
return err
}
if okResult, ok := row[0].(sql.OkResult); ok {
if okResult, ok := row[0].(types.OkResult); ok {
rowNoun := "row"
if okResult.RowsAffected != 1 {
rowNoun = "rows"
@@ -219,7 +220,7 @@ func printOKResult(ctx *sql.Context, iter sql.RowIter, start time.Time) error {
}
func isOkResult(sch sql.Schema) bool {
return sch.Equals(sql.OkResultSchema)
return sch.Equals(types.OkResultSchema)
}
type verticalRowWriter struct {
+2 -1
View File
@@ -25,6 +25,7 @@ import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/analyzer"
"github.com/dolthub/go-mysql-server/sql/mysql_db"
"github.com/dolthub/go-mysql-server/sql/sysvars"
"github.com/dolthub/vitess/go/vt/sqlparser"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
@@ -90,7 +91,7 @@ func NewSqlEngine(
return nil, err
}
config.ClusterController.ManageSystemVariables(sql.SystemVariables)
config.ClusterController.ManageSystemVariables(variables.SystemVariables)
err = config.ClusterController.ApplyStandbyReplicationConfig(ctx, bThreads, mrEnv, dbs...)
if err != nil {
+3 -2
View File
@@ -19,6 +19,7 @@ import (
"fmt"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/sysvars"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
@@ -49,7 +50,7 @@ func CollectDBs(ctx context.Context, mrEnv *env.MultiRepoEnv, useBulkEditor bool
return false, err
}
if _, remote, ok := sql.SystemVariables.GetGlobal(dsess.ReadReplicaRemote); ok && remote != "" {
if _, remote, ok := variables.SystemVariables.GetGlobal(dsess.ReadReplicaRemote); ok && remote != "" {
remoteName, ok := remote.(string)
if !ok {
return true, sql.ErrInvalidSystemVariableValue.New(remote)
@@ -141,7 +142,7 @@ func newReplicaDatabase(ctx context.Context, name string, remoteName string, dEn
}
func getPushOnWriteHook(ctx context.Context, dEnv *env.DoltEnv) (*doltdb.PushOnWriteHook, error) {
_, val, ok := sql.SystemVariables.GetGlobal(dsess.ReplicateToRemote)
_, val, ok := variables.SystemVariables.GetGlobal(dsess.ReplicateToRemote)
if !ok {
return nil, sql.ErrUnknownSystemVariable.New(dsess.ReplicateToRemote)
} else if val == "" {
+4 -3
View File
@@ -18,6 +18,7 @@ import (
"context"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
"github.com/dolthub/dolt/go/cmd/dolt/commands"
@@ -91,9 +92,9 @@ func (cmd TagsCmd) Exec(ctx context.Context, commandStr string, args []string, d
}
var headerSchema = sql.Schema{
{Name: "table", Type: sql.Text, Default: nil},
{Name: "column", Type: sql.Text, Default: nil},
{Name: "tag", Type: sql.Uint64, Default: nil},
{Name: "table", Type: types.Text, Default: nil},
{Name: "column", Type: types.Text, Default: nil},
{Name: "tag", Type: types.Uint64, Default: nil},
}
rows := make([]sql.Row, 0)
+2 -1
View File
@@ -30,6 +30,7 @@ import (
"github.com/dolthub/go-mysql-server/sql/parse"
"github.com/dolthub/go-mysql-server/sql/plan"
"github.com/dolthub/go-mysql-server/sql/transform"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/ishell"
"github.com/dolthub/vitess/go/vt/sqlparser"
"github.com/dolthub/vitess/go/vt/vterrors"
@@ -1560,7 +1561,7 @@ func mergeResultIntoStats(ctx *sql.Context, statement sqlparser.Statement, rowIt
} else if err != nil {
return err
} else {
okResult := row[0].(sql.OkResult)
okResult := row[0].(types.OkResult)
s.unflushedEdits += int(okResult.RowsAffected)
s.unprintedEdits += int(okResult.RowsAffected)
switch statement.(type) {
+3 -3
View File
@@ -19,7 +19,7 @@ import (
"fmt"
"testing"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/sysvars"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -564,8 +564,8 @@ func TestCommitHooksNoErrors(t *testing.T) {
require.NoError(t, err)
sqle.AddDoltSystemVariables()
sql.SystemVariables.SetGlobal(dsess.SkipReplicationErrors, true)
sql.SystemVariables.SetGlobal(dsess.ReplicateToRemote, "unknown")
variables.SystemVariables.SetGlobal(dsess.SkipReplicationErrors, true)
variables.SystemVariables.SetGlobal(dsess.ReplicateToRemote, "unknown")
hooks, err := engine.GetCommitHooks(context.Background(), dEnv)
assert.NoError(t, err)
if len(hooks) < 1 {
+1
View File
@@ -496,3 +496,4 @@ func checkForUnixSocket(config ServerConfig) (string, bool, error) {
return "", false, nil
}
+2 -1
View File
@@ -26,6 +26,7 @@ import (
"github.com/abiosoft/readline"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/ishell"
"github.com/fatih/color"
mysqlDriver "github.com/go-sql-driver/mysql"
@@ -390,7 +391,7 @@ func NewMysqlRowWrapper(rows *mysql.Rows) (*MysqlRowWrapper, error) {
for i, colName := range colNames {
schema[i] = &sql.Column{
Name: colName,
Type: sql.LongText,
Type: types.LongText,
Nullable: true,
}
iRow[i] = &vRow[i]
+7 -7
View File
@@ -22,7 +22,7 @@ import (
"strconv"
"strings"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/sysvars"
"github.com/fatih/color"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
@@ -387,11 +387,11 @@ func getCommandLineServerConfig(dEnv *env.DoltEnv, apr *argparser.ArgParseResult
serverConfig.withTimeout(timeout * 1000)
err = sql.SystemVariables.SetGlobal("net_read_timeout", timeout*1000)
err = variables.SystemVariables.SetGlobal("net_read_timeout", timeout*1000)
if err != nil {
return nil, fmt.Errorf("failed to set net_read_timeout. Error: %s", err.Error())
}
err = sql.SystemVariables.SetGlobal("net_write_timeout", timeout*1000)
err = variables.SystemVariables.SetGlobal("net_write_timeout", timeout*1000)
if err != nil {
return nil, fmt.Errorf("failed to set net_write_timeout. Error: %s", err.Error())
}
@@ -431,7 +431,7 @@ func getCommandLineServerConfig(dEnv *env.DoltEnv, apr *argparser.ArgParseResult
if maxConnections, ok := apr.GetInt(maxConnectionsFlag); ok {
serverConfig.withMaxConnections(uint64(maxConnections))
err := sql.SystemVariables.SetGlobal("max_connections", uint64(maxConnections))
err := variables.SystemVariables.SetGlobal("max_connections", uint64(maxConnections))
if err != nil {
return nil, fmt.Errorf("failed to set max_connections. Error: %s", err.Error())
}
@@ -461,19 +461,19 @@ func getYAMLServerConfig(fs filesys.Filesys, path string) (ServerConfig, error)
}
if cfg.ListenerConfig.MaxConnections != nil {
err = sql.SystemVariables.SetGlobal("max_connections", *cfg.ListenerConfig.MaxConnections)
err = variables.SystemVariables.SetGlobal("max_connections", *cfg.ListenerConfig.MaxConnections)
if err != nil {
return nil, fmt.Errorf("Failed to set max_connections from yaml file '%s'. Error: %s", path, err.Error())
}
}
if cfg.ListenerConfig.ReadTimeoutMillis != nil {
err = sql.SystemVariables.SetGlobal("net_read_timeout", *cfg.ListenerConfig.ReadTimeoutMillis)
err = variables.SystemVariables.SetGlobal("net_read_timeout", *cfg.ListenerConfig.ReadTimeoutMillis)
if err != nil {
return nil, fmt.Errorf("Failed to set net_read_timeout from yaml file '%s'. Error: %s", path, err.Error())
}
}
if cfg.ListenerConfig.WriteTimeoutMillis != nil {
err = sql.SystemVariables.SetGlobal("net_write_timeout", *cfg.ListenerConfig.WriteTimeoutMillis)
err = variables.SystemVariables.SetGlobal("net_write_timeout", *cfg.ListenerConfig.WriteTimeoutMillis)
if err != nil {
return nil, fmt.Errorf("Failed to set net_write_timeout from yaml file '%s'. Error: %s", path, err.Error())
}
+3 -2
View File
@@ -25,6 +25,7 @@ import (
"sync/atomic"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/fatih/color"
"golang.org/x/sync/errgroup"
@@ -737,7 +738,7 @@ func NameAndTypeTransform(row sql.Row, rowOperationSchema sql.PrimaryKeySchema,
// Bit types need additional verification due to the differing values they can take on. "4", "0x04", b'100' should
// be interpreted in the correct manner.
if _, ok := col.Type.(sql.BitType); ok {
if _, ok := col.Type.(types2.BitType); ok {
colAsString, ok := row[i].(string)
if !ok {
return nil, fmt.Errorf("error: column value should be of type string")
@@ -774,7 +775,7 @@ func NameAndTypeTransform(row sql.Row, rowOperationSchema sql.PrimaryKeySchema,
// For non string types we want empty strings to be converted to nils. String types should be allowed to take on
// an empty string value
switch col.Type.(type) {
case sql.StringType:
case types2.StringType:
default:
row[i] = emptyStringToNil(row[i])
}
+2
View File
@@ -139,4 +139,6 @@ replace (
github.com/oliveagle/jsonpath => github.com/dolthub/jsonpath v0.0.0-20210609232853-d49537a30474
)
replace github.com/dolthub/go-mysql-server => ../../go-mysql-server
go 1.19
+2 -1
View File
@@ -23,6 +23,7 @@ import (
"unicode"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/conflict"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb/durable"
@@ -354,7 +355,7 @@ func (t *Table) GetConstraintViolationsSchema(ctx context.Context) (schema.Schem
}
typeType, err := typeinfo.FromSqlType(
sql.MustCreateEnumType([]string{"foreign key", "unique index", "check constraint"}, sql.Collation_Default))
types2.MustCreateEnumType([]string{"foreign key", "unique index", "check constraint"}, sql.Collation_Default))
if err != nil {
return nil, err
}
+3 -3
View File
@@ -20,7 +20,7 @@ import (
"fmt"
"strings"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/conflict"
"github.com/dolthub/dolt/go/libraries/doltcore/diff"
@@ -408,8 +408,8 @@ func validateTupleFields(existingSch schema.Schema, targetSch schema.Schema) (bo
// If the collation was changed, bail.
// Different collations will affect the ordering of any secondary indexes using this column.
existingStr, ok1 := existingSch.GetNonPKCols().GetByIndex(i).TypeInfo.ToSqlType().(sql.StringType)
targetStr, ok2 := targetSch.GetNonPKCols().GetByIndex(i).TypeInfo.ToSqlType().(sql.StringType)
existingStr, ok1 := existingSch.GetNonPKCols().GetByIndex(i).TypeInfo.ToSqlType().(types2.StringType)
targetStr, ok2 := targetSch.GetNonPKCols().GetByIndex(i).TypeInfo.ToSqlType().(types2.StringType)
if ok1 && ok2 && !existingStr.Collation().Equals(targetStr.Collation()) {
return false, nil
+2 -2
View File
@@ -21,7 +21,7 @@ import (
"io"
"time"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/diff"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
@@ -625,7 +625,7 @@ func jsonDataToNomsValue(ctx context.Context, vrw types.ValueReadWriter, data []
if err := json.Unmarshal(data, &doc); err != nil {
return types.JSON{}, err
}
sqlDoc := sql.JSONDocument{Val: doc}
sqlDoc := types2.JSONDocument{Val: doc}
nomsJson, err := json2.NomsJSONFromJSONValue(ctx, vrw, sqlDoc)
if err != nil {
return types.JSON{}, err
@@ -22,6 +22,7 @@ import (
"strings"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb/durable"
@@ -332,12 +333,12 @@ type FkCVMeta struct {
Table string `json:"Table"`
}
func (m FkCVMeta) Unmarshall(ctx *sql.Context) (val sql.JSONDocument, err error) {
return sql.JSONDocument{Val: m}, nil
func (m FkCVMeta) Unmarshall(ctx *sql.Context) (val types.JSONDocument, err error) {
return types.JSONDocument{Val: m}, nil
}
func (m FkCVMeta) Compare(ctx *sql.Context, v sql.JSONValue) (cmp int, err error) {
ours := sql.JSONDocument{Val: m}
func (m FkCVMeta) Compare(ctx *sql.Context, v types.JSONValue) (cmp int, err error) {
ours := types.JSONDocument{Val: m}
return ours.Compare(ctx, v)
}
@@ -345,7 +346,7 @@ func (m FkCVMeta) ToString(ctx *sql.Context) (string, error) {
return m.PrettyPrint(), nil
}
var _ sql.JSONValue = FkCVMeta{}
var _ types.JSONValue = FkCVMeta{}
// PrettyPrint is a custom pretty print function to match the old format's
// output which includes additional whitespace between keys, values, and array elements.
@@ -22,6 +22,7 @@ import (
"strings"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
"github.com/dolthub/dolt/go/libraries/doltcore/schema"
@@ -120,12 +121,12 @@ type UniqCVMeta struct {
Name string `json:"Name"`
}
func (m UniqCVMeta) Unmarshall(ctx *sql.Context) (val sql.JSONDocument, err error) {
return sql.JSONDocument{Val: m}, nil
func (m UniqCVMeta) Unmarshall(ctx *sql.Context) (val types.JSONDocument, err error) {
return types.JSONDocument{Val: m}, nil
}
func (m UniqCVMeta) Compare(ctx *sql.Context, v sql.JSONValue) (cmp int, err error) {
ours := sql.JSONDocument{Val: m}
func (m UniqCVMeta) Compare(ctx *sql.Context, v types.JSONValue) (cmp int, err error) {
ours := types.JSONDocument{Val: m}
return ours.Compare(ctx, v)
}
+4 -3
View File
@@ -19,6 +19,7 @@ import (
"fmt"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/vt/proto/query"
"golang.org/x/sync/errgroup"
@@ -501,7 +502,7 @@ func migrateSchema(ctx context.Context, tableName string, existing schema.Schema
// String types are sorted using a binary collation in __LD_1__
// force-set collation to utf8mb4_0900_bin to match the order
for i, c := range cols {
st, ok := c.TypeInfo.ToSqlType().(sql.StringType)
st, ok := c.TypeInfo.ToSqlType().(types2.StringType)
if !ok {
continue
}
@@ -510,9 +511,9 @@ func migrateSchema(ctx context.Context, tableName string, existing schema.Schema
var err error
switch st.Type() {
case query.Type_CHAR, query.Type_VARCHAR, query.Type_TEXT:
st, err = sql.CreateString(st.Type(), st.Length(), sql.Collation_utf8mb4_0900_bin)
st, err = types2.CreateString(st.Type(), st.Length(), sql.Collation_utf8mb4_0900_bin)
case query.Type_BINARY, query.Type_VARBINARY, query.Type_BLOB:
st, err = sql.CreateString(st.Type(), st.Length(), sql.Collation_binary)
st, err = types2.CreateString(st.Type(), st.Length(), sql.Collation_binary)
}
if err != nil {
return nil, err
+4 -3
View File
@@ -24,6 +24,7 @@ import (
"unicode"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/vt/proto/query"
"golang.org/x/sync/errgroup"
@@ -184,13 +185,13 @@ func equalRows(old, new sql.Row, sch sql.Schema) (bool, error) {
// for precision changes between formats
if _, ok := old[i].(time.Time); ok {
var o, n interface{}
if o, err = sql.Int64.Convert(old[i]); err != nil {
if o, err = types2.Int64.Convert(old[i]); err != nil {
return false, err
}
if n, err = sql.Int64.Convert(new[i]); err != nil {
if n, err = types2.Int64.Convert(new[i]); err != nil {
return false, err
}
if cmp, err = sql.Int64.Compare(o, n); err != nil {
if cmp, err = types2.Int64.Compare(o, n); err != nil {
return false, err
}
} else {
@@ -23,6 +23,7 @@ import (
"testing"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -93,41 +94,41 @@ func getSqlTypes() []sql.Type {
//TODO: determine the storage format for TINYBLOB
//TODO: determine the storage format for VARBINARY
return []sql.Type{
sql.Int64, //BIGINT
sql.Uint64, //BIGINT UNSIGNED
types2.Int64, //BIGINT
types2.Uint64, //BIGINT UNSIGNED
//sql.MustCreateBinary(sqltypes.Binary, 10), //BINARY(10)
sql.MustCreateBitType(10), //BIT(10)
types2.MustCreateBitType(10), //BIT(10)
//sql.Blob, //BLOB
sql.Boolean, //BOOLEAN
sql.MustCreateStringWithDefaults(sqltypes.Char, 10), //CHAR(10)
sql.Date, //DATE
sql.Datetime, //DATETIME
sql.MustCreateColumnDecimalType(9, 5), //DECIMAL(9, 5)
sql.Float64, //DOUBLE
sql.MustCreateEnumType([]string{"a", "b", "c"}, sql.Collation_Default), //ENUM('a','b','c')
sql.Float32, //FLOAT
sql.Int32, //INT
sql.Uint32, //INT UNSIGNED
types2.Boolean, //BOOLEAN
types2.MustCreateStringWithDefaults(sqltypes.Char, 10), //CHAR(10)
types2.Date, //DATE
types2.Datetime, //DATETIME
types2.MustCreateColumnDecimalType(9, 5), //DECIMAL(9, 5)
types2.Float64, //DOUBLE
types2.MustCreateEnumType([]string{"a", "b", "c"}, sql.Collation_Default), //ENUM('a','b','c')
types2.Float32, //FLOAT
types2.Int32, //INT
types2.Uint32, //INT UNSIGNED
//sql.LongBlob, //LONGBLOB
sql.LongText, //LONGTEXT
types2.LongText, //LONGTEXT
//sql.MediumBlob, //MEDIUMBLOB
sql.Int24, //MEDIUMINT
sql.Uint24, //MEDIUMINT UNSIGNED
sql.MediumText, //MEDIUMTEXT
sql.MustCreateSetType([]string{"a", "b", "c"}, sql.Collation_Default), //SET('a','b','c')
sql.Int16, //SMALLINT
sql.Uint16, //SMALLINT UNSIGNED
sql.Text, //TEXT
sql.Time, //TIME
sql.Timestamp, //TIMESTAMP
types2.Int24, //MEDIUMINT
types2.Uint24, //MEDIUMINT UNSIGNED
types2.MediumText, //MEDIUMTEXT
types2.MustCreateSetType([]string{"a", "b", "c"}, sql.Collation_Default), //SET('a','b','c')
types2.Int16, //SMALLINT
types2.Uint16, //SMALLINT UNSIGNED
types2.Text, //TEXT
types2.Time, //TIME
types2.Timestamp, //TIMESTAMP
//sql.TinyBlob, //TINYBLOB
sql.Int8, //TINYINT
sql.Uint8, //TINYINT UNSIGNED
sql.TinyText, //TINYTEXT
types2.Int8, //TINYINT
types2.Uint8, //TINYINT UNSIGNED
types2.TinyText, //TINYTEXT
//sql.MustCreateBinary(sqltypes.VarBinary, 10), //VARBINARY(10)
sql.MustCreateStringWithDefaults(sqltypes.VarChar, 10), //VARCHAR(10)
sql.MustCreateString(sqltypes.VarChar, 10, sql.Collation_utf8mb3_bin), //VARCHAR(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin
sql.Year, //YEAR
types2.MustCreateStringWithDefaults(sqltypes.VarChar, 10), //VARCHAR(10)
types2.MustCreateString(sqltypes.VarChar, 10, sql.Collation_utf8mb3_bin), //VARCHAR(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin
types2.Year, //YEAR
}
}
+3 -2
View File
@@ -21,6 +21,7 @@ import (
"strings"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/vt/proto/query"
"github.com/dolthub/dolt/go/store/types"
@@ -438,7 +439,7 @@ func (si *schemaImpl) GetKeyDescriptor() val.TupleDesc {
tt = append(tt, t)
if queryType == query.Type_CHAR || queryType == query.Type_VARCHAR || queryType == query.Type_TEXT {
useCollations = true
collations = append(collations, sqlType.(sql.StringType).Collation())
collations = append(collations, sqlType.(types2.StringType).Collation())
} else {
collations = append(collations, sql.Collation_Unspecified)
}
@@ -475,7 +476,7 @@ func (si *schemaImpl) GetValueDescriptor() val.TupleDesc {
})
if queryType == query.Type_CHAR || queryType == query.Type_VARCHAR {
useCollations = true
collations = append(collations, sqlType.(sql.StringType).Collation())
collations = append(collations, sqlType.(types2.StringType).Collation())
} else {
collations = append(collations, sql.Collation_Unspecified)
}
+6 -5
View File
@@ -24,6 +24,7 @@ import (
"unicode/utf8"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/dolthub/dolt/go/store/types"
@@ -36,12 +37,12 @@ const (
// This is a dolt implementation of the MySQL type Bit, thus most of the functionality
// within is directly reliant on the go-mysql-server implementation.
type bitType struct {
sqlBitType sql.BitType
sqlBitType types2.BitType
}
var _ TypeInfo = (*bitType)(nil)
var PseudoBoolType TypeInfo = &bitType{sql.MustCreateBitType(1)}
var PseudoBoolType TypeInfo = &bitType{types2.MustCreateBitType(1)}
func CreateBitTypeFromParams(params map[string]string) (TypeInfo, error) {
if bitStr, ok := params[bitTypeParam_Bits]; ok {
@@ -49,7 +50,7 @@ func CreateBitTypeFromParams(params map[string]string) (TypeInfo, error) {
if err != nil {
return nil, err
}
sqlBitType, err := sql.CreateBitType(uint8(bitUint))
sqlBitType, err := types2.CreateBitType(uint8(bitUint))
if err != nil {
return nil, err
}
@@ -162,7 +163,7 @@ func (ti *bitType) NomsKind() types.NomsKind {
// Promote implements TypeInfo interface.
func (ti *bitType) Promote() TypeInfo {
return &bitType{ti.sqlBitType.Promote().(sql.BitType)}
return &bitType{ti.sqlBitType.Promote().(types2.BitType)}
}
// String implements TypeInfo interface.
@@ -198,7 +199,7 @@ func bitTypeConverter(ctx context.Context, src *bitType, destTi TypeInfo) (tc Ty
return nil, fmt.Errorf("unexpected type converting bit to %s: %T", strings.ToLower(dest.String()), v)
}
if val == 0 {
return types.Timestamp(sql.Datetime.Zero().(time.Time)), nil
return types.Timestamp(types2.Datetime.Zero().(time.Time)), nil
}
return nil, fmt.Errorf("invalid %s value: %d", strings.ToLower(dest.String()), uint64(val))
}, true, nil
@@ -23,6 +23,7 @@ import (
"unsafe"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/dolthub/dolt/go/store/types"
@@ -38,16 +39,16 @@ const (
// repositories that were made before the introduction of blobStringType will still use varStringType for existing
// columns.
type blobStringType struct {
sqlStringType sql.StringType
sqlStringType types2.StringType
}
var _ TypeInfo = (*blobStringType)(nil)
var (
TinyTextType TypeInfo = &blobStringType{sqlStringType: sql.TinyText}
TextType TypeInfo = &blobStringType{sqlStringType: sql.Text}
MediumTextType TypeInfo = &blobStringType{sqlStringType: sql.MediumText}
LongTextType TypeInfo = &blobStringType{sqlStringType: sql.LongText}
TinyTextType TypeInfo = &blobStringType{sqlStringType: types2.TinyText}
TextType TypeInfo = &blobStringType{sqlStringType: types2.Text}
MediumTextType TypeInfo = &blobStringType{sqlStringType: types2.MediumText}
LongTextType TypeInfo = &blobStringType{sqlStringType: types2.LongText}
)
func CreateBlobStringTypeFromParams(params map[string]string) (TypeInfo, error) {
@@ -71,7 +72,7 @@ func CreateBlobStringTypeFromParams(params map[string]string) (TypeInfo, error)
} else {
return nil, fmt.Errorf(`create blobstring type info is missing param "%v"`, blobStringTypeParam_Length)
}
sqlType, err := sql.CreateString(sqltypes.Text, length, collation)
sqlType, err := types2.CreateString(sqltypes.Text, length, collation)
if err != nil {
return nil, err
}
@@ -82,7 +83,7 @@ func CreateBlobStringTypeFromParams(params map[string]string) (TypeInfo, error)
func (ti *blobStringType) ConvertNomsValueToValue(v types.Value) (interface{}, error) {
if val, ok := v.(types.Blob); ok {
b, err := fromBlob(val)
if sql.IsBinaryType(ti.sqlStringType) {
if types2.IsBinaryType(ti.sqlStringType) {
return b, err
}
return string(b), err
@@ -103,7 +104,7 @@ func (ti *blobStringType) ReadFrom(_ *types.NomsBinFormat, reader types.CodecRea
return nil, err
}
b, err := fromBlob(val)
if sql.IsBinaryType(ti.sqlStringType) {
if types2.IsBinaryType(ti.sqlStringType) {
return b, err
}
return string(b), err
@@ -191,7 +192,7 @@ func (ti *blobStringType) NomsKind() types.NomsKind {
// Promote implements TypeInfo interface.
func (ti *blobStringType) Promote() TypeInfo {
return &blobStringType{ti.sqlStringType.Promote().(sql.StringType)}
return &blobStringType{ti.sqlStringType.Promote().(types2.StringType)}
}
// String implements TypeInfo interface.
@@ -21,6 +21,7 @@ import (
"time"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -47,7 +48,7 @@ func TestBlobStringConvertNomsValueToValue(t *testing.T) {
false,
},
{
&blobStringType{sql.CreateLongText(sql.Collation_Default)},
&blobStringType{types2.CreateLongText(sql.Collation_Default)},
mustBlobString(t, " This is a sentence. "),
" This is a sentence. ",
false,
@@ -87,7 +88,7 @@ func TestBlobStringConvertValueToNomsValue(t *testing.T) {
false,
},
{
&blobStringType{sql.CreateLongText(sql.Collation_Default)},
&blobStringType{types2.CreateLongText(sql.Collation_Default)},
float32(3724.75),
mustBlobString(t, "3724.75"),
false,
@@ -134,7 +135,7 @@ func TestBlobStringFormatValue(t *testing.T) {
false,
},
{
&blobStringType{sql.CreateLongText(sql.Collation_Default)},
&blobStringType{types2.CreateLongText(sql.Collation_Default)},
mustBlobString(t, " This is a sentence. "),
" This is a sentence. ",
false,
@@ -174,7 +175,7 @@ func TestBlobStringParseValue(t *testing.T) {
false,
},
{
&blobStringType{sql.CreateLongText(sql.Collation_Default)},
&blobStringType{types2.CreateLongText(sql.Collation_Default)},
" This is a sentence. ",
mustBlobString(t, " This is a sentence. "),
false,
@@ -21,17 +21,18 @@ import (
"strconv"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/store/types"
)
type boolType struct {
sqlBitType sql.BitType
sqlBitType types2.BitType
}
var _ TypeInfo = (*boolType)(nil)
var BoolType TypeInfo = &boolType{sql.MustCreateBitType(1)}
var BoolType TypeInfo = &boolType{types2.MustCreateBitType(1)}
// ConvertNomsValueToValue implements TypeInfo interface.
func (ti *boolType) ConvertNomsValueToValue(v types.Value) (interface{}, error) {
@@ -173,7 +174,7 @@ func (ti *boolType) String() string {
// ToSqlType implements TypeInfo interface.
func (ti *boolType) ToSqlType() sql.Type {
return sql.Boolean
return types2.Boolean
}
// boolTypeConverter is an internal function for GetTypeConverter that handles the specific type as the source TypeInfo.
@@ -23,6 +23,7 @@ import (
"testing"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/stretchr/testify/require"
@@ -50,8 +51,8 @@ func generateBitType(t *testing.T, bits uint8) *bitType {
func generateDecimalTypes(t *testing.T, numOfTypes uint16) []TypeInfo {
var res []TypeInfo
scaleMult := float64(sql.DecimalTypeMaxScale) / sql.DecimalTypeMaxPrecision
loop(t, 1, sql.DecimalTypeMaxPrecision, numOfTypes, func(i int64) {
scaleMult := float64(types2.DecimalTypeMaxScale) / types2.DecimalTypeMaxPrecision
loop(t, 1, types2.DecimalTypeMaxPrecision, numOfTypes, func(i int64) {
if i%9 <= 5 {
res = append(res, generateDecimalType(t, i, int64(float64(i)*scaleMult)))
} else {
@@ -81,7 +82,7 @@ func generateEnumTypes(t *testing.T, numOfTypes int64) []TypeInfo {
}
func generateEnumType(t *testing.T, numOfElements int) *enumType {
require.True(t, numOfElements >= 1 && numOfElements <= sql.EnumTypeMaxElements)
require.True(t, numOfElements >= 1 && numOfElements <= types2.EnumTypeMaxElements)
vals := make([]string, numOfElements)
str := make([]byte, 4)
alphabet := "abcdefghijklmnopqrstuvwxyz"
@@ -94,7 +95,7 @@ func generateEnumType(t *testing.T, numOfElements int) *enumType {
str[3] = alphabet[i%len(alphabet)]
vals[i] = string(str)
}
return &enumType{sql.MustCreateEnumType(vals, sql.Collation_Default)}
return &enumType{types2.MustCreateEnumType(vals, sql.Collation_Default)}
}
func generateSetTypes(t *testing.T, numOfTypes int64) []TypeInfo {
@@ -106,14 +107,14 @@ func generateSetTypes(t *testing.T, numOfTypes int64) []TypeInfo {
}
func generateSetType(t *testing.T, numOfElements int) *setType {
require.True(t, numOfElements >= 1 && numOfElements <= sql.SetTypeMaxElements)
require.True(t, numOfElements >= 1 && numOfElements <= types2.SetTypeMaxElements)
vals := make([]string, numOfElements)
alphabet := "abcdefghijklmnopqrstuvwxyz"
lenAlphabet := len(alphabet)
for i := 0; i < numOfElements; i++ {
vals[i] = string([]byte{alphabet[(i/lenAlphabet)%lenAlphabet], alphabet[i%lenAlphabet]})
}
return &setType{sql.MustCreateSetType(vals, sql.Collation_Default)}
return &setType{types2.MustCreateSetType(vals, sql.Collation_Default)}
}
func generateInlineBlobTypes(t *testing.T, numOfTypes uint16) []TypeInfo {
@@ -131,12 +132,12 @@ func generateInlineBlobTypes(t *testing.T, numOfTypes uint16) []TypeInfo {
func generateInlineBlobType(t *testing.T, length int64, pad bool) *inlineBlobType {
require.True(t, length > 0)
if pad {
t, err := sql.CreateBinary(sqltypes.Binary, length)
t, err := types2.CreateBinary(sqltypes.Binary, length)
if err == nil {
return &inlineBlobType{t}
}
}
return &inlineBlobType{sql.MustCreateBinary(sqltypes.VarBinary, length)}
return &inlineBlobType{types2.MustCreateBinary(sqltypes.VarBinary, length)}
}
func generateVarStringTypes(t *testing.T, numOfTypes uint16) []TypeInfo {
@@ -154,17 +155,17 @@ func generateVarStringTypes(t *testing.T, numOfTypes uint16) []TypeInfo {
func generateVarStringType(t *testing.T, length int64, rts bool) *varStringType {
require.True(t, length > 0)
if rts {
t, err := sql.CreateStringWithDefaults(sqltypes.Char, length)
t, err := types2.CreateStringWithDefaults(sqltypes.Char, length)
if err == nil {
return &varStringType{t}
}
}
return &varStringType{sql.MustCreateStringWithDefaults(sqltypes.VarChar, length)}
return &varStringType{types2.MustCreateStringWithDefaults(sqltypes.VarChar, length)}
}
func generateBlobStringType(t *testing.T, length int64) *blobStringType {
require.True(t, length > 0)
return &blobStringType{sql.MustCreateStringWithDefaults(sqltypes.Text, length)}
return &blobStringType{types2.MustCreateStringWithDefaults(sqltypes.Text, length)}
}
func mustBlobString(t *testing.T, str string) types.Blob {
@@ -20,6 +20,7 @@ import (
"time"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/dolthub/dolt/go/store/types"
@@ -38,9 +39,9 @@ type datetimeType struct {
var _ TypeInfo = (*datetimeType)(nil)
var (
DateType = &datetimeType{sql.Date}
DatetimeType = &datetimeType{sql.Datetime}
TimestampType = &datetimeType{sql.Timestamp}
DateType = &datetimeType{types2.Date}
DatetimeType = &datetimeType{types2.Datetime}
TimestampType = &datetimeType{types2.Timestamp}
)
func CreateDatetimeTypeFromParams(params map[string]string) (TypeInfo, error) {
@@ -20,6 +20,7 @@ import (
"strconv"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/shopspring/decimal"
"github.com/dolthub/dolt/go/store/types"
@@ -59,7 +60,7 @@ func CreateDecimalTypeFromParams(params map[string]string) (TypeInfo, error) {
} else {
return nil, fmt.Errorf(`create decimal type info is missing param "%v"`, decimalTypeParam_Scale)
}
sqlDecimalType, err := sql.CreateColumnDecimalType(precision, scale)
sqlDecimalType, err := types2.CreateColumnDecimalType(precision, scale)
if err != nil {
return nil, err
}
@@ -232,7 +233,7 @@ func decimalTypeConverter(ctx context.Context, src *decimalType, destTi TypeInfo
if !ok {
return nil, fmt.Errorf("unexpected type converting decimal to enum: %T", v)
}
uintVal, err := sql.Uint64.Convert(decimal.Decimal(val))
uintVal, err := types2.Uint64.Convert(decimal.Decimal(val))
if err != nil {
return nil, err
}
@@ -328,7 +329,7 @@ func decimalTypeConverter(ctx context.Context, src *decimalType, destTi TypeInfo
if !ok {
return nil, fmt.Errorf("unexpected type converting decimal to year: %T", v)
}
intVal, err := sql.Int64.Convert(decimal.Decimal(val))
intVal, err := types2.Int64.Convert(decimal.Decimal(val))
if err != nil {
return nil, err
}
@@ -22,6 +22,7 @@ import (
"time"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/shopspring/decimal"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -343,7 +344,7 @@ func TestDecimalMarshal(t *testing.T) {
for _, test := range tests {
t.Run(fmt.Sprintf("%v %v %v", test.precision, test.scale, test.val), func(t *testing.T) {
typ := &decimalType{sql.MustCreateDecimalType(test.precision, test.scale)}
typ := &decimalType{types2.MustCreateDecimalType(test.precision, test.scale)}
vrw := types.NewMemoryValueStore()
val, err := typ.ConvertValueToNomsValue(context.Background(), vrw, test.val)
if test.expectedErr {
@@ -21,6 +21,7 @@ import (
"strings"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/store/types"
)
@@ -59,7 +60,7 @@ func CreateEnumTypeFromParams(params map[string]string) (TypeInfo, error) {
} else {
return nil, fmt.Errorf(`create enum type info is missing param "%v"`, enumTypeParam_Values)
}
sqlEnumType, err := sql.CreateEnumType(values, collation)
sqlEnumType, err := types2.CreateEnumType(values, collation)
if err != nil {
return nil, err
}
@@ -22,6 +22,7 @@ import (
"strings"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/dolthub/dolt/go/store/types"
@@ -41,8 +42,8 @@ type floatType struct {
var _ TypeInfo = (*floatType)(nil)
var (
Float32Type = &floatType{sql.Float32}
Float64Type = &floatType{sql.Float64}
Float32Type = &floatType{types2.Float32}
Float64Type = &floatType{types2.Float64}
)
func CreateFloatTypeFromParams(params map[string]string) (TypeInfo, error) {
@@ -63,9 +64,9 @@ func CreateFloatTypeFromParams(params map[string]string) (TypeInfo, error) {
func (ti *floatType) ConvertNomsValueToValue(v types.Value) (interface{}, error) {
if val, ok := v.(types.Float); ok {
switch ti.sqlFloatType {
case sql.Float32:
case types2.Float32:
return float32(val), nil
case sql.Float64:
case types2.Float64:
return float64(val), nil
}
}
@@ -82,9 +83,9 @@ func (ti *floatType) ReadFrom(nbf *types.NomsBinFormat, reader types.CodecReader
case types.FloatKind:
f := reader.ReadFloat(nbf)
switch ti.sqlFloatType {
case sql.Float32:
case types2.Float32:
return float32(f), nil
case sql.Float64:
case types2.Float64:
return f, nil
}
case types.NullKind:
@@ -219,7 +220,7 @@ func floatTypeConverter(ctx context.Context, src *floatType, destTi TypeInfo) (t
return nil, fmt.Errorf("unexpected type converting float to enum: %T", v)
}
fltVal := floatTypeRoundToZero(float64(val))
intVal, err := sql.Int64.Convert(fltVal)
intVal, err := types2.Int64.Convert(fltVal)
if err != nil {
return nil, err
}
@@ -20,6 +20,7 @@ import (
"strconv"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/store/types"
)
@@ -27,12 +28,12 @@ import (
// This is a dolt implementation of the MySQL type Geometry, thus most of the functionality
// within is directly reliant on the go-mysql-server implementation.
type geometryType struct {
sqlGeometryType sql.GeometryType // References the corresponding GeometryType in GMS
sqlGeometryType types2.GeometryType // References the corresponding GeometryType in GMS
}
var _ TypeInfo = (*geometryType)(nil)
var GeometryType = &geometryType{sql.GeometryType{}}
var GeometryType = &geometryType{types2.GeometryType{}}
// ConvertNomsValueToValue implements TypeInfo interface.
func (ti *geometryType) ConvertNomsValueToValue(v types.Value) (interface{}, error) {
@@ -318,5 +319,5 @@ func CreateGeometryTypeFromParams(params map[string]string) (TypeInfo, error) {
}
}
return &geometryType{sqlGeometryType: sql.GeometryType{SRID: uint32(sridVal), DefinedSRID: def}}, nil
return &geometryType{sqlGeometryType: types2.GeometryType{SRID: uint32(sridVal), DefinedSRID: def}}, nil
}
@@ -20,6 +20,7 @@ import (
"strconv"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/store/types"
)
@@ -27,12 +28,12 @@ import (
// This is a dolt implementation of the MySQL type Point, thus most of the functionality
// within is directly reliant on the go-mysql-server implementation.
type geomcollType struct {
sqlGeomCollType sql.GeomCollType
sqlGeomCollType types2.GeomCollType
}
var _ TypeInfo = (*geomcollType)(nil)
var GeomCollType = &geomcollType{sql.GeomCollType{}}
var GeomCollType = &geomcollType{types2.GeomCollType{}}
// ConvertNomsValueToValue implements TypeInfo interface.
func (ti *geomcollType) ConvertNomsValueToValue(v types.Value) (interface{}, error) {
@@ -78,7 +79,7 @@ func (ti *geomcollType) ConvertValueToNomsValue(ctx context.Context, vrw types.V
return nil, err
}
return types.ConvertSQLGeomCollToTypesGeomColl(geomColl.(sql.GeomColl)), nil
return types.ConvertSQLGeomCollToTypesGeomColl(geomColl.(types2.GeomColl)), nil
}
// Equals implements TypeInfo interface.
@@ -135,7 +136,7 @@ func (ti *geomcollType) NomsKind() types.NomsKind {
// Promote implements TypeInfo interface.
func (ti *geomcollType) Promote() TypeInfo {
return &geomcollType{ti.sqlGeomCollType.Promote().(sql.GeomCollType)}
return &geomcollType{ti.sqlGeomCollType.Promote().(types2.GeomCollType)}
}
// String implements TypeInfo interface.
@@ -227,5 +228,5 @@ func CreateGeomCollTypeFromParams(params map[string]string) (TypeInfo, error) {
}
}
return &geomcollType{sqlGeomCollType: sql.GeomCollType{SRID: uint32(sridVal), DefinedSRID: def}}, nil
return &geomcollType{sqlGeomCollType: types2.GeomCollType{SRID: uint32(sridVal), DefinedSRID: def}}, nil
}
@@ -22,6 +22,7 @@ import (
"unsafe"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/dolthub/dolt/go/store/types"
@@ -36,13 +37,13 @@ const (
// inlineBlobType handles BINARY and VARBINARY. BLOB types are handled by varBinaryType.
type inlineBlobType struct {
sqlBinaryType sql.StringType
sqlBinaryType types2.StringType
}
var _ TypeInfo = (*inlineBlobType)(nil)
var (
VarbinaryDefaultType = &inlineBlobType{sql.MustCreateBinary(sqltypes.VarBinary, 16383)}
VarbinaryDefaultType = &inlineBlobType{types2.MustCreateBinary(sqltypes.VarBinary, 16383)}
)
func CreateInlineBlobTypeFromParams(params map[string]string) (TypeInfo, error) {
@@ -57,12 +58,12 @@ func CreateInlineBlobTypeFromParams(params map[string]string) (TypeInfo, error)
return nil, fmt.Errorf(`create inlineblob type info is missing param "%v"`, inlineBlobTypeParam_Length)
}
if sqlStr, ok := params[inlineBlobTypeParam_SQL]; ok {
var sqlType sql.StringType
var sqlType types2.StringType
switch sqlStr {
case inlineBlobTypeParam_SQL_Binary:
sqlType, err = sql.CreateBinary(sqltypes.Binary, length)
sqlType, err = types2.CreateBinary(sqltypes.Binary, length)
case inlineBlobTypeParam_SQL_VarBinary:
sqlType, err = sql.CreateBinary(sqltypes.VarBinary, length)
sqlType, err = types2.CreateBinary(sqltypes.VarBinary, length)
default:
return nil, fmt.Errorf(`create inlineblob type info has "%v" param with value "%v"`, inlineBlobTypeParam_SQL, sqlStr)
}
@@ -186,7 +187,7 @@ func (ti *inlineBlobType) NomsKind() types.NomsKind {
// Promote implements TypeInfo interface.
func (ti *inlineBlobType) Promote() TypeInfo {
return &inlineBlobType{ti.sqlBinaryType.Promote().(sql.StringType)}
return &inlineBlobType{ti.sqlBinaryType.Promote().(types2.StringType)}
}
// String implements TypeInfo interface.
@@ -21,7 +21,7 @@ import (
"testing"
"time"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -29,7 +29,7 @@ import (
"github.com/dolthub/dolt/go/store/types"
)
var DefaultInlineBlobType = &inlineBlobType{sql.MustCreateBinary(sqltypes.VarBinary, math.MaxUint16)}
var DefaultInlineBlobType = &inlineBlobType{types2.MustCreateBinary(sqltypes.VarBinary, math.MaxUint16)}
func TestInlineBlobConvertNomsValueToValue(t *testing.T) {
tests := []struct {
+16 -15
View File
@@ -20,6 +20,7 @@ import (
"strconv"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/dolthub/dolt/go/store/types"
@@ -40,11 +41,11 @@ type intType struct {
var _ TypeInfo = (*intType)(nil)
var (
Int8Type = &intType{sql.Int8}
Int16Type = &intType{sql.Int16}
Int24Type = &intType{sql.Int24}
Int32Type = &intType{sql.Int32}
Int64Type = &intType{sql.Int64}
Int8Type = &intType{types2.Int8}
Int16Type = &intType{types2.Int16}
Int24Type = &intType{types2.Int24}
Int32Type = &intType{types2.Int32}
Int64Type = &intType{types2.Int64}
)
func CreateIntTypeFromParams(params map[string]string) (TypeInfo, error) {
@@ -71,15 +72,15 @@ func CreateIntTypeFromParams(params map[string]string) (TypeInfo, error) {
func (ti *intType) ConvertNomsValueToValue(v types.Value) (interface{}, error) {
if val, ok := v.(types.Int); ok {
switch ti.sqlIntType {
case sql.Int8:
case types2.Int8:
return int8(val), nil
case sql.Int16:
case types2.Int16:
return int16(val), nil
case sql.Int24:
case types2.Int24:
return int32(val), nil
case sql.Int32:
case types2.Int32:
return int32(val), nil
case sql.Int64:
case types2.Int64:
return int64(val), nil
}
}
@@ -96,15 +97,15 @@ func (ti *intType) ReadFrom(_ *types.NomsBinFormat, reader types.CodecReader) (i
case types.IntKind:
val := reader.ReadInt()
switch ti.sqlIntType {
case sql.Int8:
case types2.Int8:
return int8(val), nil
case sql.Int16:
case types2.Int16:
return int16(val), nil
case sql.Int24:
case types2.Int24:
return int32(val), nil
case sql.Int32:
case types2.Int32:
return int32(val), nil
case sql.Int64:
case types2.Int64:
return int64(val), nil
}
case types.NullKind:
@@ -19,6 +19,7 @@ import (
"fmt"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/json"
"github.com/dolthub/dolt/go/store/types"
@@ -29,7 +30,7 @@ type jsonType struct {
}
var _ TypeInfo = (*jsonType)(nil)
var JSONType = &jsonType{sql.JSON}
var JSONType = &jsonType{types2.JSON}
// ConvertNomsValueToValue implements TypeInfo interface.
func (ti *jsonType) ConvertNomsValueToValue(v types.Value) (interface{}, error) {
@@ -71,7 +72,7 @@ func (ti *jsonType) ConvertValueToNomsValue(ctx context.Context, vrw types.Value
return nil, err
}
jsVal, ok := jsDoc.(sql.JSONValue)
jsVal, ok := jsDoc.(types2.JSONValue)
if !ok {
return nil, fmt.Errorf(`"%v" cannot convert value "%v" of type "%T" as it is invalid`, ti.String(), v, v)
}
@@ -20,6 +20,7 @@ import (
"strconv"
"github.com/dolthub/dolt/go/store/types"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/go-mysql-server/sql"
)
@@ -27,12 +28,12 @@ import (
// This is a dolt implementation of the MySQL type Point, thus most of the functionality
// within is directly reliant on the go-mysql-server implementation.
type linestringType struct {
sqlLineStringType sql.LineStringType
sqlLineStringType types2.LineStringType
}
var _ TypeInfo = (*linestringType)(nil)
var LineStringType = &linestringType{sql.LineStringType{}}
var LineStringType = &linestringType{types2.LineStringType{}}
// ConvertNomsValueToValue implements TypeInfo interface.
func (ti *linestringType) ConvertNomsValueToValue(v types.Value) (interface{}, error) {
@@ -78,7 +79,7 @@ func (ti *linestringType) ConvertValueToNomsValue(ctx context.Context, vrw types
return nil, err
}
return types.ConvertSQLLineStringToTypesLineString(line.(sql.LineString)), nil
return types.ConvertSQLLineStringToTypesLineString(line.(types2.LineString)), nil
}
// Equals implements TypeInfo interface.
@@ -135,7 +136,7 @@ func (ti *linestringType) NomsKind() types.NomsKind {
// Promote implements TypeInfo interface.
func (ti *linestringType) Promote() TypeInfo {
return &linestringType{ti.sqlLineStringType.Promote().(sql.LineStringType)}
return &linestringType{ti.sqlLineStringType.Promote().(types2.LineStringType)}
}
// String implements TypeInfo interface.
@@ -226,5 +227,5 @@ func CreateLineStringTypeFromParams(params map[string]string) (TypeInfo, error)
return nil, err
}
}
return &linestringType{sqlLineStringType: sql.LineStringType{SRID: uint32(sridVal), DefinedSRID: def}}, nil
return &linestringType{sqlLineStringType: types2.LineStringType{SRID: uint32(sridVal), DefinedSRID: def}}, nil
}
@@ -20,6 +20,7 @@ import (
"strconv"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/store/types"
)
@@ -27,12 +28,12 @@ import (
// This is a dolt implementation of the MySQL type Point, thus most of the functionality
// within is directly reliant on the go-mysql-server implementation.
type multilinestringType struct {
sqlMultiLineStringType sql.MultiLineStringType
sqlMultiLineStringType types2.MultiLineStringType
}
var _ TypeInfo = (*multilinestringType)(nil)
var MultiLineStringType = &multilinestringType{sql.MultiLineStringType{}}
var MultiLineStringType = &multilinestringType{types2.MultiLineStringType{}}
// ConvertNomsValueToValue implements TypeInfo interface.
func (ti *multilinestringType) ConvertNomsValueToValue(v types.Value) (interface{}, error) {
@@ -78,7 +79,7 @@ func (ti *multilinestringType) ConvertValueToNomsValue(ctx context.Context, vrw
return nil, err
}
return types.ConvertSQLMultiLineStringToTypesMultiLineString(mline.(sql.MultiLineString)), nil
return types.ConvertSQLMultiLineStringToTypesMultiLineString(mline.(types2.MultiLineString)), nil
}
// Equals implements TypeInfo interface.
@@ -135,7 +136,7 @@ func (ti *multilinestringType) NomsKind() types.NomsKind {
// Promote implements TypeInfo interface.
func (ti *multilinestringType) Promote() TypeInfo {
return &multilinestringType{ti.sqlMultiLineStringType.Promote().(sql.MultiLineStringType)}
return &multilinestringType{ti.sqlMultiLineStringType.Promote().(types2.MultiLineStringType)}
}
// String implements TypeInfo interface.
@@ -227,5 +228,5 @@ func CreateMultiLineStringTypeFromParams(params map[string]string) (TypeInfo, er
}
}
return &multilinestringType{sqlMultiLineStringType: sql.MultiLineStringType{SRID: uint32(sridVal), DefinedSRID: def}}, nil
return &multilinestringType{sqlMultiLineStringType: types2.MultiLineStringType{SRID: uint32(sridVal), DefinedSRID: def}}, nil
}
@@ -20,6 +20,7 @@ import (
"strconv"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/store/types"
)
@@ -27,12 +28,12 @@ import (
// This is a dolt implementation of the MySQL type Point, thus most of the functionality
// within is directly reliant on the go-mysql-server implementation.
type multipointType struct {
sqlMultiPointType sql.MultiPointType
sqlMultiPointType types2.MultiPointType
}
var _ TypeInfo = (*multipointType)(nil)
var MultiPointType = &multipointType{sql.MultiPointType{}}
var MultiPointType = &multipointType{types2.MultiPointType{}}
// ConvertNomsValueToValue implements TypeInfo interface.
func (ti *multipointType) ConvertNomsValueToValue(v types.Value) (interface{}, error) {
@@ -78,7 +79,7 @@ func (ti *multipointType) ConvertValueToNomsValue(ctx context.Context, vrw types
return nil, err
}
return types.ConvertSQLMultiPointToTypesMultiPoint(multipoint.(sql.MultiPoint)), nil
return types.ConvertSQLMultiPointToTypesMultiPoint(multipoint.(types2.MultiPoint)), nil
}
// Equals implements TypeInfo interface.
@@ -135,7 +136,7 @@ func (ti *multipointType) NomsKind() types.NomsKind {
// Promote implements TypeInfo interface.
func (ti *multipointType) Promote() TypeInfo {
return &multipointType{ti.sqlMultiPointType.Promote().(sql.MultiPointType)}
return &multipointType{ti.sqlMultiPointType.Promote().(types2.MultiPointType)}
}
// String implements TypeInfo interface.
@@ -226,5 +227,5 @@ func CreateMultiPointTypeFromParams(params map[string]string) (TypeInfo, error)
return nil, err
}
}
return &multipointType{sqlMultiPointType: sql.MultiPointType{SRID: uint32(sridVal), DefinedSRID: def}}, nil
return &multipointType{sqlMultiPointType: types2.MultiPointType{SRID: uint32(sridVal), DefinedSRID: def}}, nil
}
@@ -20,6 +20,7 @@ import (
"strconv"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/store/types"
)
@@ -27,12 +28,12 @@ import (
// This is a dolt implementation of the MySQL type Point, thus most of the functionality
// within is directly reliant on the go-mysql-server implementation.
type multipolygonType struct {
sqlMultiPolygonType sql.MultiPolygonType
sqlMultiPolygonType types2.MultiPolygonType
}
var _ TypeInfo = (*multipolygonType)(nil)
var MultiPolygonType = &multipolygonType{sql.MultiPolygonType{}}
var MultiPolygonType = &multipolygonType{types2.MultiPolygonType{}}
// ConvertNomsValueToValue implements TypeInfo interface.
func (ti *multipolygonType) ConvertNomsValueToValue(v types.Value) (interface{}, error) {
@@ -78,7 +79,7 @@ func (ti *multipolygonType) ConvertValueToNomsValue(ctx context.Context, vrw typ
return nil, err
}
return types.ConvertSQLMultiPolygonToTypesMultiPolygon(mpoly.(sql.MultiPolygon)), nil
return types.ConvertSQLMultiPolygonToTypesMultiPolygon(mpoly.(types2.MultiPolygon)), nil
}
// Equals implements TypeInfo interface.
@@ -135,7 +136,7 @@ func (ti *multipolygonType) NomsKind() types.NomsKind {
// Promote implements TypeInfo interface.
func (ti *multipolygonType) Promote() TypeInfo {
return &multipolygonType{ti.sqlMultiPolygonType.Promote().(sql.MultiPolygonType)}
return &multipolygonType{ti.sqlMultiPolygonType.Promote().(types2.MultiPolygonType)}
}
// String implements TypeInfo interface.
@@ -227,5 +228,5 @@ func CreateMultiPolygonTypeFromParams(params map[string]string) (TypeInfo, error
}
}
return &multipolygonType{sqlMultiPolygonType: sql.MultiPolygonType{SRID: uint32(sridVal), DefinedSRID: def}}, nil
return &multipolygonType{sqlMultiPolygonType: types2.MultiPolygonType{SRID: uint32(sridVal), DefinedSRID: def}}, nil
}
@@ -20,6 +20,7 @@ import (
"strconv"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/store/types"
)
@@ -27,12 +28,12 @@ import (
// This is a dolt implementation of the MySQL type Point, thus most of the functionality
// within is directly reliant on the go-mysql-server implementation.
type pointType struct {
sqlPointType sql.PointType
sqlPointType types2.PointType
}
var _ TypeInfo = (*pointType)(nil)
var PointType = &pointType{sql.PointType{}}
var PointType = &pointType{types2.PointType{}}
// ConvertNomsValueToValue implements TypeInfo interface.
func (ti *pointType) ConvertNomsValueToValue(v types.Value) (interface{}, error) {
@@ -78,7 +79,7 @@ func (ti *pointType) ConvertValueToNomsValue(ctx context.Context, vrw types.Valu
return nil, err
}
return types.ConvertSQLPointToTypesPoint(point.(sql.Point)), nil
return types.ConvertSQLPointToTypesPoint(point.(types2.Point)), nil
}
// Equals implements TypeInfo interface.
@@ -135,7 +136,7 @@ func (ti *pointType) NomsKind() types.NomsKind {
// Promote implements TypeInfo interface.
func (ti *pointType) Promote() TypeInfo {
return &pointType{ti.sqlPointType.Promote().(sql.PointType)}
return &pointType{ti.sqlPointType.promote().(types2.PointType)}
}
// String implements TypeInfo interface.
@@ -227,5 +228,5 @@ func CreatePointTypeFromParams(params map[string]string) (TypeInfo, error) {
}
}
return &pointType{sqlPointType: sql.PointType{SRID: uint32(sridVal), DefinedSRID: def}}, nil
return &pointType{sqlPointType: types2.PointType{SRID: uint32(sridVal), DefinedSRID: def}}, nil
}
@@ -20,6 +20,7 @@ import (
"strconv"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/store/types"
)
@@ -27,12 +28,12 @@ import (
// This is a dolt implementation of the MySQL type Point, thus most of the functionality
// within is directly reliant on the go-mysql-server implementation.
type polygonType struct {
sqlPolygonType sql.PolygonType
sqlPolygonType types2.PolygonType
}
var _ TypeInfo = (*polygonType)(nil)
var PolygonType = &polygonType{sql.PolygonType{}}
var PolygonType = &polygonType{types2.PolygonType{}}
// ConvertNomsValueToValue implements TypeInfo interface.
func (ti *polygonType) ConvertNomsValueToValue(v types.Value) (interface{}, error) {
@@ -78,7 +79,7 @@ func (ti *polygonType) ConvertValueToNomsValue(ctx context.Context, vrw types.Va
return nil, err
}
return types.ConvertSQLPolygonToTypesPolygon(poly.(sql.Polygon)), nil
return types.ConvertSQLPolygonToTypesPolygon(poly.(types2.Polygon)), nil
}
// Equals implements TypeInfo interface.
@@ -135,7 +136,7 @@ func (ti *polygonType) NomsKind() types.NomsKind {
// Promote implements TypeInfo interface.
func (ti *polygonType) Promote() TypeInfo {
return &polygonType{ti.sqlPolygonType.Promote().(sql.PolygonType)}
return &polygonType{ti.sqlPolygonType.Promote().(types2.PolygonType)}
}
// String implements TypeInfo interface.
@@ -227,5 +228,5 @@ func CreatePolygonTypeFromParams(params map[string]string) (TypeInfo, error) {
}
}
return &polygonType{sqlPolygonType: sql.PolygonType{SRID: uint32(sridVal), DefinedSRID: def}}, nil
return &polygonType{sqlPolygonType: types2.PolygonType{SRID: uint32(sridVal), DefinedSRID: def}}, nil
}
+2 -1
View File
@@ -21,6 +21,7 @@ import (
"strings"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/store/types"
)
@@ -59,7 +60,7 @@ func CreateSetTypeFromParams(params map[string]string) (TypeInfo, error) {
} else {
return nil, fmt.Errorf(`create set type info is missing param "%v"`, setTypeParam_Values)
}
sqlSetType, err := sql.CreateSetType(values, collation)
sqlSetType, err := types2.CreateSetType(values, collation)
if err != nil {
return nil, err
}
@@ -19,6 +19,7 @@ import (
"fmt"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/store/types"
)
@@ -26,17 +27,17 @@ import (
// This is a dolt implementation of the MySQL type Time, thus most of the functionality
// within is directly reliant on the go-mysql-server implementation.
type timeType struct {
sqlTimeType sql.TimeType
sqlTimeType types2.TimeType
}
var _ TypeInfo = (*timeType)(nil)
var TimeType = &timeType{sql.Time}
var TimeType = &timeType{types2.Time}
// ConvertNomsValueToValue implements TypeInfo interface.
func (ti *timeType) ConvertNomsValueToValue(v types.Value) (interface{}, error) {
if val, ok := v.(types.Int); ok {
return ti.sqlTimeType.Convert(sql.Timespan(val))
return ti.sqlTimeType.Convert(types2.Timespan(val))
}
if _, ok := v.(types.Null); ok || v == nil {
return nil, nil
@@ -50,7 +51,7 @@ func (ti *timeType) ReadFrom(_ *types.NomsBinFormat, reader types.CodecReader) (
switch k {
case types.IntKind:
val := reader.ReadInt()
return ti.sqlTimeType.Convert(sql.Timespan(val))
return ti.sqlTimeType.Convert(types2.Timespan(val))
case types.NullKind:
return nil, nil
}
@@ -67,7 +68,7 @@ func (ti *timeType) ConvertValueToNomsValue(ctx context.Context, vrw types.Value
if err != nil {
return nil, err
}
return types.Int(val.(sql.Timespan)), nil
return types.Int(val.(types2.Timespan)), nil
}
// Equals implements TypeInfo interface.
@@ -88,7 +89,7 @@ func (ti *timeType) FormatValue(v types.Value) (*string, error) {
if err != nil {
return nil, err
}
val := convVal.(sql.Timespan).String()
val := convVal.(types2.Timespan).String()
return &val, nil
}
@@ -120,7 +121,7 @@ func (ti *timeType) NomsKind() types.NomsKind {
// Promote implements TypeInfo interface.
func (ti *timeType) Promote() TypeInfo {
return &timeType{ti.sqlTimeType.Promote().(sql.TimeType)}
return &timeType{ti.sqlTimeType.Promote().(types2.TimeType)}
}
// String implements TypeInfo interface.
@@ -20,7 +20,7 @@ import (
"testing"
"time"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -30,7 +30,7 @@ import (
func TestTimeConvertNomsValueToValue(t *testing.T) {
tests := []struct {
input types.Int
output sql.Timespan
output types2.Timespan
expectedErr bool
}{
{
@@ -20,6 +20,7 @@ import (
"math"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/dolthub/dolt/go/store/types"
@@ -173,22 +174,22 @@ func FromSqlType(sqlType sql.Type) (TypeInfo, error) {
return YearType, nil
case sqltypes.Geometry:
switch sqlType.String() {
case sql.PointType{}.String():
return &pointType{sqlType.(sql.PointType)}, nil
case sql.LineStringType{}.String():
return &linestringType{sqlType.(sql.LineStringType)}, nil
case sql.PolygonType{}.String():
return &polygonType{sqlType.(sql.PolygonType)}, nil
case sql.MultiPointType{}.String():
case types2.PointType{}.String():
return &pointType{sqlType.(types2.PointType)}, nil
case types2.LineStringType{}.String():
return &linestringType{sqlType.(types2.LineStringType)}, nil
case types2.PolygonType{}.String():
return &polygonType{sqlType.(types2.PolygonType)}, nil
case types2.MultiPointType{}.String():
return &multipointType{}, nil
case sql.MultiLineStringType{}.String():
case types2.MultiLineStringType{}.String():
return &multilinestringType{}, nil
case sql.MultiPolygonType{}.String():
case types2.MultiPolygonType{}.String():
return &multipolygonType{}, nil
case sql.GeomCollType{}.String():
case types2.GeomCollType{}.String():
return &geomcollType{}, nil
case sql.GeometryType{}.String():
return &geometryType{sqlGeometryType: sqlType.(sql.GeometryType)}, nil
case types2.GeometryType{}.String():
return &geometryType{sqlGeometryType: sqlType.(types2.GeometryType)}, nil
default:
return nil, fmt.Errorf(`expected "PointTypeIdentifier" from SQL basetype "Geometry"`)
}
@@ -199,43 +200,43 @@ func FromSqlType(sqlType sql.Type) (TypeInfo, error) {
}
return &decimalType{decimalSQLType}, nil
case sqltypes.Text:
stringType, ok := sqlType.(sql.StringType)
stringType, ok := sqlType.(types2.StringType)
if !ok {
return nil, fmt.Errorf(`expected "StringType" from SQL basetype "Text"`)
}
return &blobStringType{stringType}, nil
case sqltypes.Blob:
stringType, ok := sqlType.(sql.StringType)
stringType, ok := sqlType.(types2.StringType)
if !ok {
return nil, fmt.Errorf(`expected "StringType" from SQL basetype "Blob"`)
}
return &varBinaryType{stringType}, nil
case sqltypes.VarChar:
stringType, ok := sqlType.(sql.StringType)
stringType, ok := sqlType.(types2.StringType)
if !ok {
return nil, fmt.Errorf(`expected "StringType" from SQL basetype "VarChar"`)
}
return &varStringType{stringType}, nil
case sqltypes.VarBinary:
stringType, ok := sqlType.(sql.StringType)
stringType, ok := sqlType.(types2.StringType)
if !ok {
return nil, fmt.Errorf(`expected "StringType" from SQL basetype "VarBinary"`)
}
return &inlineBlobType{stringType}, nil
case sqltypes.Char:
stringType, ok := sqlType.(sql.StringType)
stringType, ok := sqlType.(types2.StringType)
if !ok {
return nil, fmt.Errorf(`expected "StringType" from SQL basetype "Char"`)
}
return &varStringType{stringType}, nil
case sqltypes.Binary:
stringType, ok := sqlType.(sql.StringType)
stringType, ok := sqlType.(types2.StringType)
if !ok {
return nil, fmt.Errorf(`expected "StringType" from SQL basetype "Binary"`)
}
return &inlineBlobType{stringType}, nil
case sqltypes.Bit:
bitSQLType, ok := sqlType.(sql.BitType)
bitSQLType, ok := sqlType.(types2.BitType)
if !ok {
return nil, fmt.Errorf(`expected "BitTypeIdentifier" from SQL basetype "Bit"`)
}
@@ -327,13 +328,13 @@ func FromTypeParams(id Identifier, params map[string]string) (TypeInfo, error) {
func FromKind(kind types.NomsKind) TypeInfo {
switch kind {
case types.BlobKind:
return &varBinaryType{sql.LongBlob}
return &varBinaryType{types2.LongBlob}
case types.BoolKind:
return BoolType
case types.FloatKind:
return Float64Type
case types.InlineBlobKind:
return &inlineBlobType{sql.MustCreateBinary(sqltypes.VarBinary, math.MaxUint16)}
return &inlineBlobType{types2.MustCreateBinary(sqltypes.VarBinary, math.MaxUint16)}
case types.IntKind:
return Int64Type
case types.JSONKind:
@@ -359,7 +360,7 @@ func FromKind(kind types.NomsKind) TypeInfo {
case types.UUIDKind:
return UuidType
case types.DecimalKind:
return &decimalType{sql.MustCreateDecimalType(65, 30)}
return &decimalType{types2.MustCreateDecimalType(65, 30)}
default:
panic(fmt.Errorf(`no default type info for NomsKind "%v"`, kind.String()))
}
@@ -21,6 +21,7 @@ import (
"time"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/shopspring/decimal"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -345,8 +346,8 @@ func testTypeInfoConversionsExist(t *testing.T, tiArrays [][]TypeInfo) {
func generateTypeInfoArrays(t *testing.T) ([][]TypeInfo, [][]types.Value) {
return [][]TypeInfo{
generateBitTypes(t, 16),
{&blobStringType{sql.TinyText}, &blobStringType{sql.Text},
&blobStringType{sql.MediumText}, &blobStringType{sql.LongText}},
{&blobStringType{types2.TinyText}, &blobStringType{types2.Text},
&blobStringType{types2.MediumText}, &blobStringType{types2.LongText}},
{BoolType},
{DateType, DatetimeType, TimestampType},
generateDecimalTypes(t, 16),
@@ -367,11 +368,11 @@ func generateTypeInfoArrays(t *testing.T) ([][]TypeInfo, [][]types.Value) {
{TimeType},
{Uint8Type, Uint16Type, Uint24Type, Uint32Type, Uint64Type},
{UuidType},
{&varBinaryType{sql.TinyBlob}, &varBinaryType{sql.Blob},
&varBinaryType{sql.MediumBlob}, &varBinaryType{sql.LongBlob}},
{&varBinaryType{types2.TinyBlob}, &varBinaryType{types2.Blob},
&varBinaryType{types2.MediumBlob}, &varBinaryType{types2.LongBlob}},
append(generateVarStringTypes(t, 12),
&varStringType{sql.CreateTinyText(sql.Collation_Default)}, &varStringType{sql.CreateText(sql.Collation_Default)},
&varStringType{sql.CreateMediumText(sql.Collation_Default)}, &varStringType{sql.CreateLongText(sql.Collation_Default)}),
&varStringType{types2.CreateTinyText(sql.Collation_Default)}, &varStringType{types2.CreateText(sql.Collation_Default)},
&varStringType{types2.CreateMediumText(sql.Collation_Default)}, &varStringType{types2.CreateLongText(sql.Collation_Default)}),
{YearType},
},
[][]types.Value{
+16 -15
View File
@@ -20,6 +20,7 @@ import (
"strconv"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/dolthub/dolt/go/store/types"
@@ -40,11 +41,11 @@ type uintType struct {
var _ TypeInfo = (*uintType)(nil)
var (
Uint8Type = &uintType{sql.Uint8}
Uint16Type = &uintType{sql.Uint16}
Uint24Type = &uintType{sql.Uint24}
Uint32Type = &uintType{sql.Uint32}
Uint64Type = &uintType{sql.Uint64}
Uint8Type = &uintType{types2.Uint8}
Uint16Type = &uintType{types2.Uint16}
Uint24Type = &uintType{types2.Uint24}
Uint32Type = &uintType{types2.Uint32}
Uint64Type = &uintType{types2.Uint64}
)
func CreateUintTypeFromParams(params map[string]string) (TypeInfo, error) {
@@ -71,15 +72,15 @@ func CreateUintTypeFromParams(params map[string]string) (TypeInfo, error) {
func (ti *uintType) ConvertNomsValueToValue(v types.Value) (interface{}, error) {
if val, ok := v.(types.Uint); ok {
switch ti.sqlUintType {
case sql.Uint8:
case types2.Uint8:
return uint8(val), nil
case sql.Uint16:
case types2.Uint16:
return uint16(val), nil
case sql.Uint24:
case types2.Uint24:
return uint32(val), nil
case sql.Uint32:
case types2.Uint32:
return uint32(val), nil
case sql.Uint64:
case types2.Uint64:
return uint64(val), nil
}
}
@@ -96,15 +97,15 @@ func (ti *uintType) ReadFrom(_ *types.NomsBinFormat, reader types.CodecReader) (
case types.UintKind:
val := reader.ReadUint()
switch ti.sqlUintType {
case sql.Uint8:
case types2.Uint8:
return uint8(val), nil
case sql.Uint16:
case types2.Uint16:
return uint16(val), nil
case sql.Uint24:
case types2.Uint24:
return uint32(val), nil
case sql.Uint32:
case types2.Uint32:
return uint32(val), nil
case sql.Uint64:
case types2.Uint64:
return val, nil
}
case types.NullKind:
@@ -19,6 +19,7 @@ import (
"fmt"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/google/uuid"
@@ -26,12 +27,12 @@ import (
)
type uuidType struct {
sqlCharType sql.StringType
sqlCharType types2.StringType
}
var _ TypeInfo = (*uuidType)(nil)
var UuidType = &uuidType{sql.MustCreateString(sqltypes.Char, 36, sql.Collation_ascii_bin)}
var UuidType = &uuidType{types2.MustCreateString(sqltypes.Char, 36, sql.Collation_ascii_bin)}
// ConvertNomsValueToValue implements TypeInfo interface.
func (ti *uuidType) ConvertNomsValueToValue(v types.Value) (interface{}, error) {
@@ -24,6 +24,7 @@ import (
"unsafe"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/dolthub/dolt/go/store/types"
@@ -40,16 +41,16 @@ const (
//
// This type handles the BLOB types. BINARY and VARBINARY are handled by inlineBlobType.
type varBinaryType struct {
sqlBinaryType sql.StringType
sqlBinaryType types2.StringType
}
var _ TypeInfo = (*varBinaryType)(nil)
var (
TinyBlobType TypeInfo = &varBinaryType{sqlBinaryType: sql.TinyBlob}
BlobType TypeInfo = &varBinaryType{sqlBinaryType: sql.Blob}
MediumBlobType TypeInfo = &varBinaryType{sqlBinaryType: sql.MediumBlob}
LongBlobType TypeInfo = &varBinaryType{sqlBinaryType: sql.LongBlob}
TinyBlobType TypeInfo = &varBinaryType{sqlBinaryType: types2.TinyBlob}
BlobType TypeInfo = &varBinaryType{sqlBinaryType: types2.Blob}
MediumBlobType TypeInfo = &varBinaryType{sqlBinaryType: types2.MediumBlob}
LongBlobType TypeInfo = &varBinaryType{sqlBinaryType: types2.LongBlob}
)
func CreateVarBinaryTypeFromParams(params map[string]string) (TypeInfo, error) {
@@ -63,7 +64,7 @@ func CreateVarBinaryTypeFromParams(params map[string]string) (TypeInfo, error) {
} else {
return nil, fmt.Errorf(`create varbinary type info is missing param "%v"`, varBinaryTypeParam_Length)
}
sqlType, err := sql.CreateBinary(sqltypes.Blob, length)
sqlType, err := types2.CreateBinary(sqltypes.Blob, length)
if err != nil {
return nil, err
}
@@ -173,7 +174,7 @@ func (ti *varBinaryType) NomsKind() types.NomsKind {
// Promote implements TypeInfo interface.
func (ti *varBinaryType) Promote() TypeInfo {
return &varBinaryType{ti.sqlBinaryType.Promote().(sql.StringType)}
return &varBinaryType{ti.sqlBinaryType.Promote().(types2.StringType)}
}
// String implements TypeInfo interface.
@@ -22,6 +22,7 @@ import (
"unicode"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/dolthub/dolt/go/store/types"
@@ -42,13 +43,13 @@ const (
// legacy repositories will run into issues if they attempt to insert very large strings. Any and all new repositories
// must use blobStringType for all TEXT types to ensure proper behavior.
type varStringType struct {
sqlStringType sql.StringType
sqlStringType types2.StringType
}
var _ TypeInfo = (*varStringType)(nil)
var (
StringDefaultType = &varStringType{sql.MustCreateStringWithDefaults(sqltypes.VarChar, 16383)}
StringDefaultType = &varStringType{types2.MustCreateStringWithDefaults(sqltypes.VarChar, 16383)}
)
func CreateVarStringTypeFromParams(params map[string]string) (TypeInfo, error) {
@@ -73,14 +74,14 @@ func CreateVarStringTypeFromParams(params map[string]string) (TypeInfo, error) {
return nil, fmt.Errorf(`create varstring type info is missing param "%v"`, varStringTypeParam_Length)
}
if sqlStr, ok := params[varStringTypeParam_SQL]; ok {
var sqlType sql.StringType
var sqlType types2.StringType
switch sqlStr {
case varStringTypeParam_SQL_Char:
sqlType, err = sql.CreateString(sqltypes.Char, length, collation)
sqlType, err = types2.CreateString(sqltypes.Char, length, collation)
case varStringTypeParam_SQL_VarChar:
sqlType, err = sql.CreateString(sqltypes.VarChar, length, collation)
sqlType, err = types2.CreateString(sqltypes.VarChar, length, collation)
case varStringTypeParam_SQL_Text:
sqlType, err = sql.CreateString(sqltypes.Text, length, collation)
sqlType, err = types2.CreateString(sqltypes.Text, length, collation)
default:
return nil, fmt.Errorf(`create varstring type info has "%v" param with value "%v"`, varStringTypeParam_SQL, sqlStr)
}
@@ -225,7 +226,7 @@ func (ti *varStringType) NomsKind() types.NomsKind {
// Promote implements TypeInfo interface.
func (ti *varStringType) Promote() TypeInfo {
return &varStringType{ti.sqlStringType.Promote().(sql.StringType)}
return &varStringType{ti.sqlStringType.Promote().(types2.StringType)}
}
// String implements TypeInfo interface.
@@ -21,6 +21,7 @@ import (
"time"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -53,7 +54,7 @@ func TestVarStringConvertNomsValueToValue(t *testing.T) {
false,
},
{
&varStringType{sql.CreateLongText(sql.Collation_Default)},
&varStringType{types2.CreateLongText(sql.Collation_Default)},
" This is a sentence. ",
" This is a sentence. ",
false,
@@ -99,7 +100,7 @@ func TestVarStringConvertValueToNomsValue(t *testing.T) {
false,
},
{
&varStringType{sql.CreateLongText(sql.Collation_Default)},
&varStringType{types2.CreateLongText(sql.Collation_Default)},
float32(3724.75),
"3724.75",
false,
@@ -164,7 +165,7 @@ func TestVarStringFormatValue(t *testing.T) {
false,
},
{
&varStringType{sql.CreateLongText(sql.Collation_Default)},
&varStringType{types2.CreateLongText(sql.Collation_Default)},
" This is a sentence. ",
" This is a sentence. ",
false,
@@ -210,7 +211,7 @@ func TestVarStringParseValue(t *testing.T) {
false,
},
{
&varStringType{sql.CreateLongText(sql.Collation_Default)},
&varStringType{types2.CreateLongText(sql.Collation_Default)},
" This is a sentence. ",
" This is a sentence. ",
false,
@@ -20,6 +20,7 @@ import (
"strconv"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/store/types"
)
@@ -32,7 +33,7 @@ type yearType struct {
var _ TypeInfo = (*yearType)(nil)
var YearType = &yearType{sql.Year}
var YearType = &yearType{types2.Year}
// ConvertNomsValueToValue implements TypeInfo interface.
func (ti *yearType) ConvertNomsValueToValue(v types.Value) (interface{}, error) {
@@ -22,6 +22,7 @@ import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/parse"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -644,7 +645,7 @@ func TestModifyColumn(t *testing.T) {
schema.NewColumn("is_married", dtestutils.IsMarriedTag, types.IntKind, false, schema.NotNullConstraint{}),
schema.NewColumn("title", dtestutils.TitleTag, types.StringKind, false),
)
ti, err := typeinfo.FromSqlType(sql.MustCreateStringWithDefaults(sqltypes.VarChar, 599))
ti, err := typeinfo.FromSqlType(types2.MustCreateStringWithDefaults(sqltypes.VarChar, 599))
require.NoError(t, err)
newNameColSameTag, err := schema.NewColumnWithTypeInfo("name", dtestutils.NameTag, ti, false, "", false, "", schema.NotNullConstraint{})
require.NoError(t, err)
@@ -18,6 +18,7 @@ import (
"errors"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
)
@@ -30,7 +31,7 @@ func newAssumeRoleProcedure(controller *Controller) sql.ExternalStoredProcedureD
Schema: sql.Schema{
&sql.Column{
Name: "status",
Type: sql.Int64,
Type: types.Int64,
Nullable: false,
},
},
@@ -30,6 +30,7 @@ import (
"time"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/sirupsen/logrus"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
@@ -285,14 +286,14 @@ func (c *Controller) refreshSystemVars() {
Name: DoltClusterRoleVariable,
Dynamic: false,
Scope: sql.SystemVariableScope_Persist,
Type: sql.NewSystemStringType(DoltClusterRoleVariable),
Type: types2.NewSystemStringType(DoltClusterRoleVariable),
Default: role,
},
{
Name: DoltClusterRoleEpochVariable,
Dynamic: false,
Scope: sql.SystemVariableScope_Persist,
Type: sql.NewSystemIntType(DoltClusterRoleEpochVariable, 0, 9223372036854775807, false),
Type: types2.NewSystemIntType(DoltClusterRoleEpochVariable, 0, 9223372036854775807, false),
Default: epoch,
},
}
@@ -18,6 +18,7 @@ import (
"time"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
)
type ReplicaStatus struct {
@@ -111,12 +112,12 @@ func replicaStatusToRow(rs ReplicaStatus) sql.Row {
func (t ClusterStatusTable) Schema() sql.Schema {
return sql.Schema{
{Name: "database", Type: sql.Text, Source: StatusTableName, PrimaryKey: true, Nullable: false},
{Name: "standby_remote", Type: sql.Text, Source: StatusTableName, PrimaryKey: true, Nullable: false},
{Name: "role", Type: sql.Text, Source: StatusTableName, PrimaryKey: false, Nullable: false},
{Name: "epoch", Type: sql.Int64, Source: StatusTableName, PrimaryKey: false, Nullable: false},
{Name: "replication_lag_millis", Type: sql.Int64, Source: StatusTableName, PrimaryKey: false, Nullable: true},
{Name: "last_update", Type: sql.Datetime, Source: StatusTableName, PrimaryKey: false, Nullable: true},
{Name: "current_error", Type: sql.Text, Source: StatusTableName, PrimaryKey: false, Nullable: true},
{Name: "database", Type: types.Text, Source: StatusTableName, PrimaryKey: true, Nullable: false},
{Name: "standby_remote", Type: types.Text, Source: StatusTableName, PrimaryKey: true, Nullable: false},
{Name: "role", Type: types.Text, Source: StatusTableName, PrimaryKey: false, Nullable: false},
{Name: "epoch", Type: types.Int64, Source: StatusTableName, PrimaryKey: false, Nullable: false},
{Name: "replication_lag_millis", Type: types.Int64, Source: StatusTableName, PrimaryKey: false, Nullable: true},
{Name: "last_update", Type: types.Datetime, Source: StatusTableName, PrimaryKey: false, Nullable: true},
{Name: "current_error", Type: types.Text, Source: StatusTableName, PrimaryKey: false, Nullable: true},
}
}
+2 -1
View File
@@ -24,6 +24,7 @@ import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/mysql_db"
"github.com/dolthub/go-mysql-server/sql/types"
"gopkg.in/src-d/go-errors.v1"
"github.com/dolthub/dolt/go/libraries/doltcore/branch_control"
@@ -940,7 +941,7 @@ func (db Database) createIndexedSqlTable(ctx *sql.Context, tableName string, sch
// Prevent any tables that use BINARY, CHAR, VARBINARY, VARCHAR prefixes in Primary Key
for _, idxCol := range idxDef.Columns {
col := sch.Schema[sch.Schema.IndexOfColName(idxCol.Name)]
if col.PrimaryKey && sql.IsText(col.Type) && idxCol.Length > 0 {
if col.PrimaryKey && types.IsText(col.Type) && idxCol.Length > 0 {
return sql.ErrUnsupportedIndexPrefix.New(col.Name)
}
}
@@ -22,6 +22,7 @@ import (
"sync"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/sysvars"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
"github.com/dolthub/dolt/go/libraries/doltcore/dbfactory"
@@ -226,7 +227,7 @@ func wrapForStandby(db sql.Database, standby bool) sql.Database {
// TODO: distinct error for not found v. others
func (p DoltDatabaseProvider) attemptCloneReplica(ctx *sql.Context, dbName string) error {
// TODO: these need some reworking, they don't make total sense together
_, readReplicaRemoteName, _ := sql.SystemVariables.GetGlobal(dsess.ReadReplicaRemote)
_, readReplicaRemoteName, _ := variables.SystemVariables.GetGlobal(dsess.ReadReplicaRemote)
if readReplicaRemoteName == "" {
// not a read replica DB
return nil
@@ -235,7 +236,7 @@ func (p DoltDatabaseProvider) attemptCloneReplica(ctx *sql.Context, dbName strin
remoteName := readReplicaRemoteName.(string)
// TODO: error handling when not set
_, remoteUrlTemplate, _ := sql.SystemVariables.GetGlobal(dsess.ReplicationRemoteURLTemplate)
_, remoteUrlTemplate, _ := variables.SystemVariables.GetGlobal(dsess.ReplicationRemoteURLTemplate)
if remoteUrlTemplate == "" {
return nil
}
@@ -419,7 +420,7 @@ type InitDatabaseHook func(ctx *sql.Context, pro DoltDatabaseProvider, name stri
// configureReplication sets up replication for a newly created database as necessary
// TODO: consider the replication heads / all heads setting
func ConfigureReplicationDatabaseHook(ctx *sql.Context, p DoltDatabaseProvider, name string, newEnv *env.DoltEnv) error {
_, replicationRemoteName, _ := sql.SystemVariables.GetGlobal(dsess.ReplicateToRemote)
_, replicationRemoteName, _ := variables.SystemVariables.GetGlobal(dsess.ReplicateToRemote)
if replicationRemoteName == "" {
return nil
}
@@ -429,7 +430,7 @@ func ConfigureReplicationDatabaseHook(ctx *sql.Context, p DoltDatabaseProvider,
return nil
}
_, remoteUrlTemplate, _ := sql.SystemVariables.GetGlobal(dsess.ReplicationRemoteURLTemplate)
_, remoteUrlTemplate, _ := variables.SystemVariables.GetGlobal(dsess.ReplicationRemoteURLTemplate)
if remoteUrlTemplate == "" {
return nil
}
@@ -776,12 +777,12 @@ func (p DoltDatabaseProvider) databaseForClone(ctx *sql.Context, revDB string) (
// TODO: figure out the right contract: which variables must be set? What happens if they aren't all set?
func readReplicationActive(ctx *sql.Context) bool {
_, readReplicaRemoteName, _ := sql.SystemVariables.GetGlobal(dsess.ReadReplicaRemote)
_, readReplicaRemoteName, _ := variables.SystemVariables.GetGlobal(dsess.ReadReplicaRemote)
if readReplicaRemoteName == "" {
return false
}
_, remoteUrlTemplate, _ := sql.SystemVariables.GetGlobal(dsess.ReplicationRemoteURLTemplate)
_, remoteUrlTemplate, _ := variables.SystemVariables.GetGlobal(dsess.ReplicationRemoteURLTemplate)
if remoteUrlTemplate == "" {
return false
}
@@ -18,6 +18,7 @@ import (
"fmt"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/ref"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
@@ -79,7 +80,7 @@ func (*ActiveBranchFunc) Resolved() bool {
}
func (ab *ActiveBranchFunc) Type() sql.Type {
return sql.Text
return types.Text
}
// Children implements the Expression interface.
@@ -19,6 +19,7 @@ import (
"strings"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
)
const CommitFuncName = "commit"
@@ -78,5 +79,5 @@ func (cf *CommitFunc) WithChildren(children ...sql.Expression) (sql.Expression,
}
func (cf *CommitFunc) Type() sql.Type {
return sql.Text
return types.Text
}
@@ -19,6 +19,7 @@ import (
"strings"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
"github.com/dolthub/dolt/go/libraries/doltcore/branch_control"
@@ -111,7 +112,7 @@ func (d DoltAddFunc) String() string {
}
func (d DoltAddFunc) Type() sql.Type {
return sql.Int8
return types.Int8
}
func (d DoltAddFunc) IsNullable() bool {
@@ -20,6 +20,7 @@ import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/expression"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
"github.com/dolthub/dolt/go/libraries/doltcore/branch_control"
@@ -59,7 +60,7 @@ func (d DoltBackupFunc) String() string {
}
func (d DoltBackupFunc) Type() sql.Type {
return sql.Int8
return types.Int8
}
func (d DoltBackupFunc) WithChildren(children ...sql.Expression) (sql.Expression, error) {
@@ -21,6 +21,7 @@ import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/expression"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
"github.com/dolthub/dolt/go/libraries/doltcore/branch_control"
@@ -60,7 +61,7 @@ func (d DoltBranchFunc) String() string {
}
func (d DoltBranchFunc) Type() sql.Type {
return sql.Int8
return types.Int8
}
func (d DoltBranchFunc) WithChildren(children ...sql.Expression) (sql.Expression, error) {
@@ -21,6 +21,7 @@ import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/expression"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
"github.com/dolthub/dolt/go/cmd/dolt/errhand"
@@ -290,7 +291,7 @@ func (d DoltCheckoutFunc) String() string {
}
func (d DoltCheckoutFunc) Type() sql.Type {
return sql.Int8
return types.Int8
}
func (d DoltCheckoutFunc) WithChildren(children ...sql.Expression) (sql.Expression, error) {
@@ -19,6 +19,7 @@ import (
"strings"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
"github.com/dolthub/dolt/go/libraries/doltcore/branch_control"
@@ -96,7 +97,7 @@ func (d DoltCleanFunc) String() string {
}
func (d DoltCleanFunc) Type() sql.Type {
return sql.Int8
return types.Int8
}
func (d DoltCleanFunc) IsNullable() bool {
@@ -19,6 +19,7 @@ import (
"fmt"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/vt/proto/query"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
@@ -29,7 +30,7 @@ import (
const DoltCommitFuncName = "dolt_commit"
var hashType = sql.MustCreateString(query.Type_TEXT, 32, sql.Collation_ascii_bin)
var hashType = types.MustCreateString(query.Type_TEXT, 32, sql.Collation_ascii_bin)
// DoltCommitFunc runs a `dolt commit` in the SQL context, committing staged changes to head.
// Deprecated: please use the version in the dprocedures package
@@ -161,7 +162,7 @@ func getDoltArgs(ctx *sql.Context, row sql.Row, children []sql.Expression) ([]st
return nil, err
}
text, err := sql.Text.Convert(childVal)
text, err := types.Text.Convert(childVal)
if err != nil {
return nil, err
@@ -183,7 +184,7 @@ func (d DoltCommitFunc) String() string {
}
func (d DoltCommitFunc) Type() sql.Type {
return sql.Text
return types.Text
}
func (d DoltCommitFunc) IsNullable() bool {
@@ -20,6 +20,7 @@ import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/expression"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
"github.com/dolthub/dolt/go/libraries/doltcore/branch_control"
@@ -58,7 +59,7 @@ func (d DoltFetchFunc) String() string {
}
func (d DoltFetchFunc) Type() sql.Type {
return sql.Boolean
return types.Boolean
}
func (d DoltFetchFunc) WithChildren(children ...sql.Expression) (sql.Expression, error) {
@@ -21,6 +21,7 @@ import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/expression"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
"github.com/dolthub/dolt/go/libraries/doltcore/branch_control"
@@ -479,7 +480,7 @@ func (d DoltMergeFunc) String() string {
}
func (d DoltMergeFunc) Type() sql.Type {
return sql.Boolean
return types.Boolean
}
func (d DoltMergeFunc) WithChildren(children ...sql.Expression) (sql.Expression, error) {
@@ -19,6 +19,7 @@ import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/expression"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
"github.com/dolthub/dolt/go/libraries/doltcore/merge"
@@ -38,10 +39,10 @@ func NewMergeBase(left, right sql.Expression) sql.Expression {
// Eval implements the sql.Expression interface.
func (d MergeBase) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
if _, ok := d.Left.Type().(sql.StringType); !ok {
if _, ok := d.Left.Type().(types.StringType); !ok {
return nil, sql.ErrInvalidType.New(d.Left.Type())
}
if _, ok := d.Right.Type().(sql.StringType); !ok {
if _, ok := d.Right.Type().(types.StringType); !ok {
return nil, sql.ErrInvalidType.New(d.Right.Type())
}
@@ -112,7 +113,7 @@ func (d MergeBase) String() string {
// Type implements the sql.Expression interface.
func (d MergeBase) Type() sql.Type {
return sql.Text
return types.Text
}
// WithChildren implements the sql.Expression interface.
@@ -23,6 +23,7 @@ import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/expression"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
"github.com/dolthub/dolt/go/libraries/doltcore/branch_control"
@@ -58,7 +59,7 @@ func (d DoltPullFunc) String() string {
}
func (d DoltPullFunc) Type() sql.Type {
return sql.Boolean
return types.Boolean
}
func (d DoltPullFunc) WithChildren(children ...sql.Expression) (sql.Expression, error) {
@@ -21,6 +21,7 @@ import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/expression"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
"github.com/dolthub/dolt/go/libraries/doltcore/branch_control"
@@ -55,7 +56,7 @@ func (d DoltPushFunc) String() string {
}
func (d DoltPushFunc) Type() sql.Type {
return sql.Boolean
return types.Boolean
}
func (d DoltPushFunc) WithChildren(children ...sql.Expression) (sql.Expression, error) {
@@ -19,6 +19,7 @@ import (
"strings"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
"github.com/dolthub/dolt/go/libraries/doltcore/branch_control"
@@ -155,7 +156,7 @@ func (d DoltResetFunc) String() string {
}
func (d DoltResetFunc) Type() sql.Type {
return sql.Int8
return types.Int8
}
func (d DoltResetFunc) IsNullable() bool {
@@ -21,6 +21,7 @@ import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/expression"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
@@ -131,5 +132,5 @@ func (t *HashOf) WithChildren(children ...sql.Expression) (sql.Expression, error
// Type implements the Expression interface.
func (t *HashOf) Type() sql.Type {
return sql.Text
return types.Text
}
@@ -19,6 +19,7 @@ import (
"strings"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
goerrors "gopkg.in/src-d/go-errors.v1"
)
@@ -82,5 +83,5 @@ func (mf *MergeFunc) WithChildren(children ...sql.Expression) (sql.Expression, e
// Type implements the Expression interface.
func (mf *MergeFunc) Type() sql.Type {
return sql.Text
return types.Text
}
@@ -19,6 +19,7 @@ import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/expression"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
"github.com/dolthub/dolt/go/libraries/doltcore/branch_control"
@@ -175,7 +176,7 @@ func (r *RevertFunc) Resolved() bool {
}
func (r *RevertFunc) Type() sql.Type {
return sql.Int8
return types.Int8
}
// Children implements the Expression interface.
@@ -19,6 +19,7 @@ import (
"fmt"
"github.com/dolthub/go-mysql-server/sql"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
"github.com/dolthub/dolt/go/store/types"
@@ -80,7 +81,7 @@ func (*StorageFormat) String() string {
// Type implements the Expression interface.
func (*StorageFormat) Type() sql.Type {
return sql.Text
return types2.Text
}
// WithChildren implements the Expression interface.
@@ -19,6 +19,7 @@ import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/expression"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
"github.com/dolthub/dolt/go/libraries/doltcore/branch_control"
@@ -152,7 +153,7 @@ func (vc *ConstraintsVerifyFunc) Resolved() bool {
}
func (vc *ConstraintsVerifyFunc) Type() sql.Type {
return sql.Int8
return types.Int8
}
// Children implements the Expression interface.
@@ -14,7 +14,10 @@
package dfunctions
import "github.com/dolthub/go-mysql-server/sql"
import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
)
const VersionFuncName = "dolt_version"
@@ -54,7 +57,7 @@ func (*Version) String() string {
// Type implements the Expression interface.
func (*Version) Type() sql.Type {
return sql.Text
return types.Text
}
// WithChildren implements the Expression interface.
@@ -22,6 +22,7 @@ import (
"strings"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"golang.org/x/sync/errgroup"
"github.com/dolthub/dolt/go/libraries/doltcore/diff"
@@ -43,18 +44,18 @@ type DiffSummaryTableFunction struct {
}
var diffSummaryTableSchema = sql.Schema{
&sql.Column{Name: "table_name", Type: sql.LongText, Nullable: false},
&sql.Column{Name: "rows_unmodified", Type: sql.Int64, Nullable: true},
&sql.Column{Name: "rows_added", Type: sql.Int64, Nullable: true},
&sql.Column{Name: "rows_deleted", Type: sql.Int64, Nullable: true},
&sql.Column{Name: "rows_modified", Type: sql.Int64, Nullable: true},
&sql.Column{Name: "cells_added", Type: sql.Int64, Nullable: true},
&sql.Column{Name: "cells_deleted", Type: sql.Int64, Nullable: true},
&sql.Column{Name: "cells_modified", Type: sql.Int64, Nullable: true},
&sql.Column{Name: "old_row_count", Type: sql.Int64, Nullable: true},
&sql.Column{Name: "new_row_count", Type: sql.Int64, Nullable: true},
&sql.Column{Name: "old_cell_count", Type: sql.Int64, Nullable: true},
&sql.Column{Name: "new_cell_count", Type: sql.Int64, Nullable: true},
&sql.Column{Name: "table_name", Type: types.LongText, Nullable: false},
&sql.Column{Name: "rows_unmodified", Type: types.Int64, Nullable: true},
&sql.Column{Name: "rows_added", Type: types.Int64, Nullable: true},
&sql.Column{Name: "rows_deleted", Type: types.Int64, Nullable: true},
&sql.Column{Name: "rows_modified", Type: types.Int64, Nullable: true},
&sql.Column{Name: "cells_added", Type: types.Int64, Nullable: true},
&sql.Column{Name: "cells_deleted", Type: types.Int64, Nullable: true},
&sql.Column{Name: "cells_modified", Type: types.Int64, Nullable: true},
&sql.Column{Name: "old_row_count", Type: types.Int64, Nullable: true},
&sql.Column{Name: "new_row_count", Type: types.Int64, Nullable: true},
&sql.Column{Name: "old_cell_count", Type: types.Int64, Nullable: true},
&sql.Column{Name: "new_cell_count", Type: types.Int64, Nullable: true},
}
// NewInstance creates a new instance of TableFunction interface
@@ -138,7 +139,7 @@ func (ds *DiffSummaryTableFunction) WithChildren(children ...sql.Node) (sql.Node
// CheckPrivileges implements the interface sql.Node.
func (ds *DiffSummaryTableFunction) CheckPrivileges(ctx *sql.Context, opChecker sql.PrivilegedOperationChecker) bool {
if ds.tableNameExpr != nil {
if !sql.IsText(ds.tableNameExpr.Type()) {
if !types.IsText(ds.tableNameExpr.Type()) {
return false
}
@@ -220,20 +221,20 @@ func (ds *DiffSummaryTableFunction) WithExpressions(expression ...sql.Expression
// validate the expressions
if ds.dotCommitExpr != nil {
if !sql.IsText(ds.dotCommitExpr.Type()) {
if !types.IsText(ds.dotCommitExpr.Type()) {
return nil, sql.ErrInvalidArgumentDetails.New(ds.Name(), ds.dotCommitExpr.String())
}
} else {
if !sql.IsText(ds.fromCommitExpr.Type()) {
if !types.IsText(ds.fromCommitExpr.Type()) {
return nil, sql.ErrInvalidArgumentDetails.New(ds.Name(), ds.fromCommitExpr.String())
}
if !sql.IsText(ds.toCommitExpr.Type()) {
if !types.IsText(ds.toCommitExpr.Type()) {
return nil, sql.ErrInvalidArgumentDetails.New(ds.Name(), ds.toCommitExpr.String())
}
}
if ds.tableNameExpr != nil {
if !sql.IsText(ds.tableNameExpr.Type()) {
if !types.IsText(ds.tableNameExpr.Type()) {
return nil, sql.ErrInvalidArgumentDetails.New(ds.Name(), ds.tableNameExpr.String())
}
}
@@ -29,6 +29,7 @@ import (
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dtables"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/sqlutil"
"github.com/dolthub/dolt/go/store/types"
types2 "github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/go-mysql-server/sql"
"gopkg.in/src-d/go-errors.v1"
@@ -346,7 +347,7 @@ func (dtf *DiffTableFunction) evaluateArguments() (interface{}, interface{}, int
return nil, nil, nil, "", nil
}
if !sql.IsText(dtf.tableNameExpr.Type()) {
if !types2.IsText(dtf.tableNameExpr.Type()) {
return nil, nil, nil, "", sql.ErrInvalidArgumentDetails.New(dtf.Name(), dtf.tableNameExpr.String())
}
@@ -361,7 +362,7 @@ func (dtf *DiffTableFunction) evaluateArguments() (interface{}, interface{}, int
}
if dtf.dotCommitExpr != nil {
if !sql.IsText(dtf.dotCommitExpr.Type()) {
if !types2.IsText(dtf.dotCommitExpr.Type()) {
return nil, nil, nil, "", sql.ErrInvalidArgumentDetails.New(dtf.Name(), dtf.dotCommitExpr.String())
}
@@ -373,10 +374,10 @@ func (dtf *DiffTableFunction) evaluateArguments() (interface{}, interface{}, int
return nil, nil, dotCommitVal, tableName, nil
}
if !sql.IsText(dtf.fromCommitExpr.Type()) {
if !types2.IsText(dtf.fromCommitExpr.Type()) {
return nil, nil, nil, "", sql.ErrInvalidArgumentDetails.New(dtf.Name(), dtf.fromCommitExpr.String())
}
if !sql.IsText(dtf.toCommitExpr.Type()) {
if !types2.IsText(dtf.toCommitExpr.Type()) {
return nil, nil, nil, "", sql.ErrInvalidArgumentDetails.New(dtf.Name(), dtf.toCommitExpr.String())
}
@@ -19,6 +19,7 @@ import (
"strings"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"gopkg.in/src-d/go-errors.v1"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
@@ -46,11 +47,11 @@ type LogTableFunction struct {
}
var logTableSchema = sql.Schema{
&sql.Column{Name: "commit_hash", Type: sql.Text},
&sql.Column{Name: "committer", Type: sql.Text},
&sql.Column{Name: "email", Type: sql.Text},
&sql.Column{Name: "date", Type: sql.Datetime},
&sql.Column{Name: "message", Type: sql.Text},
&sql.Column{Name: "commit_hash", Type: types.Text},
&sql.Column{Name: "committer", Type: types.Text},
&sql.Column{Name: "email", Type: types.Text},
&sql.Column{Name: "date", Type: types.Datetime},
&sql.Column{Name: "message", Type: types.Text},
}
// NewInstance creates a new instance of TableFunction interface
@@ -135,10 +136,10 @@ func (ltf *LogTableFunction) Schema() sql.Schema {
logSchema := logTableSchema
if ltf.showParents {
logSchema = append(logSchema, &sql.Column{Name: "parents", Type: sql.Text})
logSchema = append(logSchema, &sql.Column{Name: "parents", Type: types.Text})
}
if shouldDecorateWithRefs(ltf.decoration) {
logSchema = append(logSchema, &sql.Column{Name: "refs", Type: sql.Text})
logSchema = append(logSchema, &sql.Column{Name: "refs", Type: types.Text})
}
return logSchema
@@ -195,11 +196,11 @@ func getDoltArgs(ctx *sql.Context, expressions []sql.Expression, name string) ([
return nil, err
}
if !sql.IsText(expr.Type()) {
if !types.IsText(expr.Type()) {
return args, sql.ErrInvalidArgumentDetails.New(name, expr.String())
}
text, err := sql.Text.Convert(childVal)
text, err := types.Text.Convert(childVal)
if err != nil {
return nil, err
}
@@ -301,7 +302,7 @@ func (ltf *LogTableFunction) validateRevisionExpressions() error {
if ltf.revisionExpr != nil {
revisionStr = mustExpressionToString(ltf.ctx, ltf.revisionExpr)
if !sql.IsText(ltf.revisionExpr.Type()) {
if !types.IsText(ltf.revisionExpr.Type()) {
return sql.ErrInvalidArgumentDetails.New(ltf.Name(), ltf.revisionExpr.String())
}
if ltf.secondRevisionExpr == nil && strings.HasPrefix(revisionStr, "^") {
@@ -314,7 +315,7 @@ func (ltf *LogTableFunction) validateRevisionExpressions() error {
if ltf.secondRevisionExpr != nil {
secondRevisionStr = mustExpressionToString(ltf.ctx, ltf.secondRevisionExpr)
if !sql.IsText(ltf.secondRevisionExpr.Type()) {
if !types.IsText(ltf.secondRevisionExpr.Type()) {
return sql.ErrInvalidArgumentDetails.New(ltf.Name(), ltf.secondRevisionExpr.String())
}
if strings.Contains(secondRevisionStr, "..") {
@@ -14,7 +14,10 @@
package dprocedures
import "github.com/dolthub/go-mysql-server/sql"
import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
)
var DoltProcedures = []sql.ExternalStoredProcedureDetails{
{Name: "dolt_add", Schema: int64Schema("status"), Function: doltAdd},
@@ -61,7 +64,7 @@ func stringSchema(columnNames ...string) sql.Schema {
for i, colName := range columnNames {
sch[i] = &sql.Column{
Name: colName,
Type: sql.LongText,
Type: types.LongText,
Nullable: false,
}
}
@@ -74,7 +77,7 @@ func int64Schema(columnNames ...string) sql.Schema {
for i, colName := range columnNames {
sch[i] = &sql.Column{
Name: colName,
Type: sql.Int64,
Type: types.Int64,
Nullable: false,
}
}
+8 -6
View File
@@ -24,6 +24,8 @@ import (
"time"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/sysvars"
types2 "github.com/dolthub/go-mysql-server/sql/types"
goerrors "gopkg.in/src-d/go-errors.v1"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
@@ -145,7 +147,7 @@ func (d *DoltSession) lookupDbState(ctx *sql.Context, dbName string) (*DatabaseS
var init InitialDbState
var err error
_, val, ok := sql.SystemVariables.GetGlobal(DefaultBranchKey(dbName))
_, val, ok := variables.SystemVariables.GetGlobal(DefaultBranchKey(dbName))
initialBranch := ""
if ok {
initialBranch = val.(string)
@@ -323,7 +325,7 @@ func (d *DoltSession) StartTransaction(ctx *sql.Context, tCharacteristic sql.Tra
return DisabledTransaction{}, nil
}
if _, v, ok := sql.SystemVariables.GetGlobal(ReadReplicaRemote); ok && v != "" {
if _, v, ok := variables.SystemVariables.GetGlobal(ReadReplicaRemote); ok && v != "" {
err = sessionState.dbData.Ddb.Rebase(ctx)
if err != nil && !IgnoreReplicationErrors() {
return nil, err
@@ -1037,7 +1039,7 @@ func (d *DoltSession) setHeadRefSessionVar(ctx *sql.Context, db, value string) e
}
func (d *DoltSession) setForeignKeyChecksSessionVar(ctx *sql.Context, key string, value interface{}) error {
convertedVal, err := sql.Int64.Convert(value)
convertedVal, err := types2.Int64.Convert(value)
if err != nil {
return err
}
@@ -1373,7 +1375,7 @@ func (d *DoltSession) GetController() *branch_control.Controller {
// validatePersistedSysVar checks whether a system variable exists and is dynamic
func validatePersistableSysVar(name string) (sql.SystemVariable, interface{}, error) {
sysVar, val, ok := sql.SystemVariables.GetGlobal(name)
sysVar, val, ok := variables.SystemVariables.GetGlobal(name)
if !ok {
return sql.SystemVariable{}, nil, sql.ErrUnknownSystemVariable.New(name)
}
@@ -1480,7 +1482,7 @@ func SystemVariablesInConfig(conf config.ReadableConfig) ([]sql.SystemVariable,
return true
}
// getPersistedVal already checked for errors
sysVar, _, _ = sql.SystemVariables.GetGlobal(k)
sysVar, _, _ = variables.SystemVariables.GetGlobal(k)
sysVar.Default = def
allVars[i] = sysVar
i++
@@ -1515,6 +1517,6 @@ func InitPersistedSystemVars(dEnv *env.DoltEnv) error {
for _, k := range missingKeys {
cli.Printf("warning: persisted system variable %s was not loaded since its definition does not exist.\n", k)
}
sql.SystemVariables.AddSystemVariables(persistedGlobalVars)
variables.SystemVariables.AddSystemVariables(persistedGlobalVars)
return nil
}
+10 -8
View File
@@ -19,6 +19,8 @@ import (
"strings"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/sysvars"
"github.com/dolthub/go-mysql-server/sql/types"
)
// Per-DB system variables
@@ -54,14 +56,14 @@ const URLTemplateDatabasePlaceholder = "{database}"
// DefineSystemVariablesForDB defines per database dolt-session variables in the engine as necessary
func DefineSystemVariablesForDB(name string) {
if _, _, ok := sql.SystemVariables.GetGlobal(name + HeadKeySuffix); !ok {
sql.SystemVariables.AddSystemVariables([]sql.SystemVariable{
if _, _, ok := variables.SystemVariables.GetGlobal(name + HeadKeySuffix); !ok {
variables.SystemVariables.AddSystemVariables([]sql.SystemVariable{
{
Name: HeadRefKey(name),
Scope: sql.SystemVariableScope_Session,
Dynamic: true,
SetVarHintApplies: false,
Type: sql.NewSystemStringType(HeadRefKey(name)),
Type: types.NewSystemStringType(HeadRefKey(name)),
Default: "",
},
// The following variable are Dynamic, but read-only. Their values
@@ -71,7 +73,7 @@ func DefineSystemVariablesForDB(name string) {
Scope: sql.SystemVariableScope_Session,
Dynamic: true,
SetVarHintApplies: false,
Type: sql.NewSystemStringType(HeadKey(name)),
Type: types.NewSystemStringType(HeadKey(name)),
Default: "",
},
{
@@ -79,7 +81,7 @@ func DefineSystemVariablesForDB(name string) {
Scope: sql.SystemVariableScope_Session,
Dynamic: true,
SetVarHintApplies: false,
Type: sql.NewSystemStringType(WorkingKey(name)),
Type: types.NewSystemStringType(WorkingKey(name)),
Default: "",
},
{
@@ -87,7 +89,7 @@ func DefineSystemVariablesForDB(name string) {
Scope: sql.SystemVariableScope_Session,
Dynamic: true,
SetVarHintApplies: false,
Type: sql.NewSystemStringType(StagedKey(name)),
Type: types.NewSystemStringType(StagedKey(name)),
Default: "",
},
{
@@ -95,7 +97,7 @@ func DefineSystemVariablesForDB(name string) {
Scope: sql.SystemVariableScope_Global,
Dynamic: true,
SetVarHintApplies: false,
Type: sql.NewSystemStringType(DefaultBranchKey(name)),
Type: types.NewSystemStringType(DefaultBranchKey(name)),
Default: "",
},
})
@@ -171,7 +173,7 @@ func GetBooleanSystemVar(ctx *sql.Context, varName string) (bool, error) {
// IgnoreReplicationErrors returns true if the dolt_skip_replication_errors system variable is set to true, which means
// that errors that occur during replication should be logged and ignored.
func IgnoreReplicationErrors() bool {
_, skip, ok := sql.SystemVariables.GetGlobal(SkipReplicationErrors)
_, skip, ok := variables.SystemVariables.GetGlobal(SkipReplicationErrors)
if !ok {
panic("dolt system variables not loaded")
}
@@ -16,6 +16,7 @@ package dtables
import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/dolthub/dolt/go/libraries/doltcore/branch_control"
@@ -32,37 +33,37 @@ const (
var accessBinlogSchema = sql.Schema{
&sql.Column{
Name: "index",
Type: sql.Int64,
Type: types.Int64,
Source: AccessBinlogTableName,
PrimaryKey: true,
},
&sql.Column{
Name: "operation",
Type: sql.MustCreateEnumType([]string{"insert", "delete"}, sql.Collation_utf8mb4_0900_bin),
Type: types.MustCreateEnumType([]string{"insert", "delete"}, sql.Collation_utf8mb4_0900_bin),
Source: AccessBinlogTableName,
PrimaryKey: false,
},
&sql.Column{
Name: "branch",
Type: sql.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Type: types.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Source: AccessBinlogTableName,
PrimaryKey: false,
},
&sql.Column{
Name: "user",
Type: sql.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_bin),
Type: types.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_bin),
Source: AccessBinlogTableName,
PrimaryKey: false,
},
&sql.Column{
Name: "host",
Type: sql.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Type: types.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Source: AccessBinlogTableName,
PrimaryKey: false,
},
&sql.Column{
Name: "permissions",
Type: sql.MustCreateSetType(PermissionsStrings, sql.Collation_utf8mb4_0900_ai_ci),
Type: types.MustCreateSetType(PermissionsStrings, sql.Collation_utf8mb4_0900_ai_ci),
Source: AccessBinlogTableName,
PrimaryKey: false,
},
@@ -72,31 +73,31 @@ var accessBinlogSchema = sql.Schema{
var namespaceBinlogSchema = sql.Schema{
&sql.Column{
Name: "index",
Type: sql.Int64,
Type: types.Int64,
Source: NamespaceBinlogTableName,
PrimaryKey: true,
},
&sql.Column{
Name: "operation",
Type: sql.MustCreateEnumType([]string{"insert", "delete"}, sql.Collation_utf8mb4_0900_bin),
Type: types.MustCreateEnumType([]string{"insert", "delete"}, sql.Collation_utf8mb4_0900_bin),
Source: NamespaceBinlogTableName,
PrimaryKey: false,
},
&sql.Column{
Name: "branch",
Type: sql.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Type: types.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Source: NamespaceBinlogTableName,
PrimaryKey: false,
},
&sql.Column{
Name: "user",
Type: sql.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_bin),
Type: types.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_bin),
Source: NamespaceBinlogTableName,
PrimaryKey: false,
},
&sql.Column{
Name: "host",
Type: sql.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Type: types.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Source: NamespaceBinlogTableName,
PrimaryKey: false,
},
@@ -21,6 +21,7 @@ import (
"strings"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/dolthub/dolt/go/libraries/doltcore/branch_control"
@@ -39,31 +40,31 @@ var PermissionsStrings = []string{"admin", "write"}
var accessSchema = sql.Schema{
&sql.Column{
Name: "database",
Type: sql.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Type: types.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Source: AccessTableName,
PrimaryKey: true,
},
&sql.Column{
Name: "branch",
Type: sql.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Type: types.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Source: AccessTableName,
PrimaryKey: true,
},
&sql.Column{
Name: "user",
Type: sql.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_bin),
Type: types.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_bin),
Source: AccessTableName,
PrimaryKey: true,
},
&sql.Column{
Name: "host",
Type: sql.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Type: types.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Source: AccessTableName,
PrimaryKey: true,
},
&sql.Column{
Name: "permissions",
Type: sql.MustCreateSetType(PermissionsStrings, sql.Collation_utf8mb4_0900_ai_ci),
Type: types.MustCreateSetType(PermissionsStrings, sql.Collation_utf8mb4_0900_ai_ci),
Source: AccessTableName,
PrimaryKey: false,
},
@@ -21,6 +21,7 @@ import (
"strings"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/vitess/go/sqltypes"
"github.com/dolthub/dolt/go/libraries/doltcore/branch_control"
@@ -35,25 +36,25 @@ const (
var namespaceSchema = sql.Schema{
&sql.Column{
Name: "database",
Type: sql.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Type: types.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Source: NamespaceTableName,
PrimaryKey: true,
},
&sql.Column{
Name: "branch",
Type: sql.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Type: types.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Source: NamespaceTableName,
PrimaryKey: true,
},
&sql.Column{
Name: "user",
Type: sql.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_bin),
Type: types.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_bin),
Source: NamespaceTableName,
PrimaryKey: true,
},
&sql.Column{
Name: "host",
Type: sql.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Type: types.MustCreateString(sqltypes.VarChar, 16383, sql.Collation_utf8mb4_0900_ai_ci),
Source: NamespaceTableName,
PrimaryKey: true,
},
@@ -19,6 +19,7 @@ import (
"io"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/index"
@@ -55,12 +56,12 @@ func (bt *BranchesTable) String() string {
// Schema is a sql.Table interface function that gets the sql.Schema of the branches system table
func (bt *BranchesTable) Schema() sql.Schema {
return []*sql.Column{
{Name: "name", Type: sql.Text, Source: doltdb.BranchesTableName, PrimaryKey: true, Nullable: false},
{Name: "hash", Type: sql.Text, Source: doltdb.BranchesTableName, PrimaryKey: false, Nullable: false},
{Name: "latest_committer", Type: sql.Text, Source: doltdb.BranchesTableName, PrimaryKey: false, Nullable: true},
{Name: "latest_committer_email", Type: sql.Text, Source: doltdb.BranchesTableName, PrimaryKey: false, Nullable: true},
{Name: "latest_commit_date", Type: sql.Datetime, Source: doltdb.BranchesTableName, PrimaryKey: false, Nullable: true},
{Name: "latest_commit_message", Type: sql.Text, Source: doltdb.BranchesTableName, PrimaryKey: false, Nullable: true},
{Name: "name", Type: types.Text, Source: doltdb.BranchesTableName, PrimaryKey: true, Nullable: false},
{Name: "hash", Type: types.Text, Source: doltdb.BranchesTableName, PrimaryKey: false, Nullable: false},
{Name: "latest_committer", Type: types.Text, Source: doltdb.BranchesTableName, PrimaryKey: false, Nullable: true},
{Name: "latest_committer_email", Type: types.Text, Source: doltdb.BranchesTableName, PrimaryKey: false, Nullable: true},
{Name: "latest_commit_date", Type: types.Datetime, Source: doltdb.BranchesTableName, PrimaryKey: false, Nullable: true},
{Name: "latest_commit_message", Type: types.Text, Source: doltdb.BranchesTableName, PrimaryKey: false, Nullable: true},
}
}
@@ -16,6 +16,7 @@ package dtables
import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/index"
@@ -47,9 +48,9 @@ func (dt *CommitAncestorsTable) String() string {
// Schema is a sql.Table interface function that gets the sql.Schema of the commit_ancestors system table.
func (dt *CommitAncestorsTable) Schema() sql.Schema {
return []*sql.Column{
{Name: "commit_hash", Type: sql.Text, Source: doltdb.CommitAncestorsTableName, PrimaryKey: true},
{Name: "parent_hash", Type: sql.Text, Source: doltdb.CommitAncestorsTableName, PrimaryKey: true},
{Name: "parent_index", Type: sql.Int32, Source: doltdb.CommitAncestorsTableName, PrimaryKey: true},
{Name: "commit_hash", Type: types.Text, Source: doltdb.CommitAncestorsTableName, PrimaryKey: true},
{Name: "parent_hash", Type: types.Text, Source: doltdb.CommitAncestorsTableName, PrimaryKey: true},
{Name: "parent_index", Type: types.Int32, Source: doltdb.CommitAncestorsTableName, PrimaryKey: true},
}
}
@@ -16,6 +16,7 @@ package dtables
import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/index"
@@ -48,11 +49,11 @@ func (dt *CommitsTable) String() string {
// Schema is a sql.Table interface function that gets the sql.Schema of the commits system table.
func (dt *CommitsTable) Schema() sql.Schema {
return []*sql.Column{
{Name: "commit_hash", Type: sql.Text, Source: doltdb.CommitsTableName, PrimaryKey: true},
{Name: "committer", Type: sql.Text, Source: doltdb.CommitsTableName, PrimaryKey: false},
{Name: "email", Type: sql.Text, Source: doltdb.CommitsTableName, PrimaryKey: false},
{Name: "date", Type: sql.Datetime, Source: doltdb.CommitsTableName, PrimaryKey: false},
{Name: "message", Type: sql.Text, Source: doltdb.CommitsTableName, PrimaryKey: false},
{Name: "commit_hash", Type: types.Text, Source: doltdb.CommitsTableName, PrimaryKey: true},
{Name: "committer", Type: types.Text, Source: doltdb.CommitsTableName, PrimaryKey: false},
{Name: "email", Type: types.Text, Source: doltdb.CommitsTableName, PrimaryKey: false},
{Name: "date", Type: types.Datetime, Source: doltdb.CommitsTableName, PrimaryKey: false},
{Name: "message", Type: types.Text, Source: doltdb.CommitsTableName, PrimaryKey: false},
}
}
@@ -16,6 +16,7 @@ package dtables
import (
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/env/actions/commitwalk"
"github.com/dolthub/dolt/go/store/hash"
@@ -52,11 +53,11 @@ func (dt *LogTable) String() string {
// Schema is a sql.Table interface function that gets the sql.Schema of the log system table.
func (dt *LogTable) Schema() sql.Schema {
return []*sql.Column{
{Name: "commit_hash", Type: sql.Text, Source: doltdb.LogTableName, PrimaryKey: true},
{Name: "committer", Type: sql.Text, Source: doltdb.LogTableName, PrimaryKey: false},
{Name: "email", Type: sql.Text, Source: doltdb.LogTableName, PrimaryKey: false},
{Name: "date", Type: sql.Datetime, Source: doltdb.LogTableName, PrimaryKey: false},
{Name: "message", Type: sql.Text, Source: doltdb.LogTableName, PrimaryKey: false},
{Name: "commit_hash", Type: types.Text, Source: doltdb.LogTableName, PrimaryKey: true},
{Name: "committer", Type: types.Text, Source: doltdb.LogTableName, PrimaryKey: false},
{Name: "email", Type: types.Text, Source: doltdb.LogTableName, PrimaryKey: false},
{Name: "date", Type: types.Datetime, Source: doltdb.LogTableName, PrimaryKey: false},
{Name: "message", Type: types.Text, Source: doltdb.LogTableName, PrimaryKey: false},
}
}
@@ -20,6 +20,7 @@ import (
"strings"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
@@ -43,11 +44,11 @@ func (s MergeStatusTable) String() string {
func (s MergeStatusTable) Schema() sql.Schema {
return []*sql.Column{
{Name: "is_merging", Type: sql.Boolean, Source: doltdb.MergeStatusTableName, PrimaryKey: false, Nullable: false},
{Name: "source", Type: sql.Text, Source: doltdb.MergeStatusTableName, PrimaryKey: false, Nullable: true},
{Name: "source_commit", Type: sql.Text, Source: doltdb.MergeStatusTableName, PrimaryKey: false, Nullable: true},
{Name: "target", Type: sql.Text, Source: doltdb.MergeStatusTableName, PrimaryKey: false, Nullable: true},
{Name: "unmerged_tables", Type: sql.Text, Source: doltdb.MergeStatusTableName, PrimaryKey: false, Nullable: true},
{Name: "is_merging", Type: types.Boolean, Source: doltdb.MergeStatusTableName, PrimaryKey: false, Nullable: false},
{Name: "source", Type: types.Text, Source: doltdb.MergeStatusTableName, PrimaryKey: false, Nullable: true},
{Name: "source_commit", Type: types.Text, Source: doltdb.MergeStatusTableName, PrimaryKey: false, Nullable: true},
{Name: "target", Type: types.Text, Source: doltdb.MergeStatusTableName, PrimaryKey: false, Nullable: true},
{Name: "unmerged_tables", Type: types.Text, Source: doltdb.MergeStatusTableName, PrimaryKey: false, Nullable: true},
}
}
@@ -19,6 +19,7 @@ import (
"io"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
"github.com/dolthub/dolt/go/libraries/doltcore/env"
@@ -57,10 +58,10 @@ func (bt *RemotesTable) String() string {
// Schema is a sql.Table interface function that gets the sql.Schema of the remotes system table
func (bt *RemotesTable) Schema() sql.Schema {
return []*sql.Column{
{Name: "name", Type: sql.Text, Source: doltdb.RemotesTableName, PrimaryKey: true, Nullable: false},
{Name: "url", Type: sql.Text, Source: doltdb.RemotesTableName, PrimaryKey: false, Nullable: false},
{Name: "fetch_specs", Type: sql.JSON, Source: doltdb.RemotesTableName, PrimaryKey: false, Nullable: true},
{Name: "params", Type: sql.JSON, Source: doltdb.RemotesTableName, PrimaryKey: false, Nullable: true},
{Name: "name", Type: types.Text, Source: doltdb.RemotesTableName, PrimaryKey: true, Nullable: false},
{Name: "url", Type: types.Text, Source: doltdb.RemotesTableName, PrimaryKey: false, Nullable: false},
{Name: "fetch_specs", Type: types.JSON, Source: doltdb.RemotesTableName, PrimaryKey: false, Nullable: true},
{Name: "params", Type: types.JSON, Source: doltdb.RemotesTableName, PrimaryKey: false, Nullable: true},
}
}
@@ -126,11 +127,11 @@ func (itr *RemoteItr) Next(*sql.Context) (sql.Row, error) {
remote := itr.remotes[itr.idx]
fs, err := sql.JSON.Convert(remote.FetchSpecs)
fs, err := types.JSON.Convert(remote.FetchSpecs)
if err != nil {
return nil, err
}
params, err := sql.JSON.Convert(remote.Params)
params, err := types.JSON.Convert(remote.Params)
if err != nil {
return nil, err
}
@@ -19,6 +19,7 @@ import (
"io"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/diff"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
@@ -44,9 +45,9 @@ func (s StatusTable) String() string {
func (s StatusTable) Schema() sql.Schema {
return []*sql.Column{
{Name: "table_name", Type: sql.Text, Source: doltdb.StatusTableName, PrimaryKey: true, Nullable: false},
{Name: "staged", Type: sql.Boolean, Source: doltdb.StatusTableName, PrimaryKey: false, Nullable: false},
{Name: "status", Type: sql.Text, Source: doltdb.StatusTableName, PrimaryKey: false, Nullable: false},
{Name: "table_name", Type: types.Text, Source: doltdb.StatusTableName, PrimaryKey: true, Nullable: false},
{Name: "staged", Type: types.Boolean, Source: doltdb.StatusTableName, PrimaryKey: false, Nullable: false},
{Name: "status", Type: types.Text, Source: doltdb.StatusTableName, PrimaryKey: false, Nullable: false},
}
}
@@ -18,6 +18,7 @@ import (
"io"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
@@ -51,8 +52,8 @@ func (dt *TableOfTablesInConflict) String() string {
// Schema is a sql.Table interface function that gets the sql.Schema of the log system table.
func (dt *TableOfTablesInConflict) Schema() sql.Schema {
return []*sql.Column{
{Name: "table", Type: sql.Text, Source: doltdb.TableOfTablesInConflictName, PrimaryKey: true},
{Name: "num_conflicts", Type: sql.Uint64, Source: doltdb.TableOfTablesInConflictName, PrimaryKey: false},
{Name: "table", Type: types.Text, Source: doltdb.TableOfTablesInConflictName, PrimaryKey: true},
{Name: "num_conflicts", Type: types.Uint64, Source: doltdb.TableOfTablesInConflictName, PrimaryKey: false},
}
}
@@ -19,6 +19,7 @@ import (
"io"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
)
@@ -49,8 +50,8 @@ func (totwv *TableOfTablesWithViolations) String() string {
// Schema implements the interface sql.Table.
func (totwv *TableOfTablesWithViolations) Schema() sql.Schema {
return []*sql.Column{
{Name: "table", Type: sql.Text, Source: doltdb.TableOfTablesWithViolationsName, PrimaryKey: true},
{Name: "num_violations", Type: sql.Uint64, Source: doltdb.TableOfTablesWithViolationsName, PrimaryKey: false},
{Name: "table", Type: types.Text, Source: doltdb.TableOfTablesWithViolationsName, PrimaryKey: true},
{Name: "num_violations", Type: types.Uint64, Source: doltdb.TableOfTablesWithViolationsName, PrimaryKey: false},
}
}
@@ -18,6 +18,7 @@ import (
"io"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/index"
@@ -50,12 +51,12 @@ func (dt *TagsTable) String() string {
// Schema is a sql.Table interface function that gets the sql.Schema of the tags system table.
func (dt *TagsTable) Schema() sql.Schema {
return []*sql.Column{
{Name: "tag_name", Type: sql.Text, Source: doltdb.TagsTableName, PrimaryKey: true},
{Name: "tag_hash", Type: sql.Text, Source: doltdb.TagsTableName, PrimaryKey: true},
{Name: "tagger", Type: sql.Text, Source: doltdb.TagsTableName, PrimaryKey: false},
{Name: "email", Type: sql.Text, Source: doltdb.TagsTableName, PrimaryKey: false},
{Name: "date", Type: sql.Datetime, Source: doltdb.TagsTableName, PrimaryKey: false},
{Name: "message", Type: sql.Text, Source: doltdb.TagsTableName, PrimaryKey: false},
{Name: "tag_name", Type: types.Text, Source: doltdb.TagsTableName, PrimaryKey: true},
{Name: "tag_hash", Type: types.Text, Source: doltdb.TagsTableName, PrimaryKey: true},
{Name: "tagger", Type: types.Text, Source: doltdb.TagsTableName, PrimaryKey: false},
{Name: "email", Type: types.Text, Source: doltdb.TagsTableName, PrimaryKey: false},
{Name: "date", Type: types.Datetime, Source: doltdb.TagsTableName, PrimaryKey: false},
{Name: "message", Type: types.Text, Source: doltdb.TagsTableName, PrimaryKey: false},
}
}
@@ -26,6 +26,7 @@ import (
"github.com/dolthub/dolt/go/libraries/utils/set"
"github.com/dolthub/dolt/go/store/datas"
"github.com/dolthub/dolt/go/store/hash"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/expression"
@@ -106,14 +107,14 @@ func (dt *UnscopedDiffTable) String() string {
// Schema is a sql.Table interface function that returns the sql.Schema for this system table.
func (dt *UnscopedDiffTable) Schema() sql.Schema {
return []*sql.Column{
{Name: "commit_hash", Type: sql.Text, Source: doltdb.DiffTableName, PrimaryKey: true},
{Name: "table_name", Type: sql.Text, Source: doltdb.DiffTableName, PrimaryKey: true},
{Name: "committer", Type: sql.Text, Source: doltdb.DiffTableName, PrimaryKey: false},
{Name: "email", Type: sql.Text, Source: doltdb.DiffTableName, PrimaryKey: false},
{Name: "date", Type: sql.Datetime, Source: doltdb.DiffTableName, PrimaryKey: false},
{Name: "message", Type: sql.Text, Source: doltdb.DiffTableName, PrimaryKey: false},
{Name: "data_change", Type: sql.Boolean, Source: doltdb.DiffTableName, PrimaryKey: false},
{Name: "schema_change", Type: sql.Boolean, Source: doltdb.DiffTableName, PrimaryKey: false},
{Name: "commit_hash", Type: types.Text, Source: doltdb.DiffTableName, PrimaryKey: true},
{Name: "table_name", Type: types.Text, Source: doltdb.DiffTableName, PrimaryKey: true},
{Name: "committer", Type: types.Text, Source: doltdb.DiffTableName, PrimaryKey: false},
{Name: "email", Type: types.Text, Source: doltdb.DiffTableName, PrimaryKey: false},
{Name: "date", Type: types.Datetime, Source: doltdb.DiffTableName, PrimaryKey: false},
{Name: "message", Type: types.Text, Source: doltdb.DiffTableName, PrimaryKey: false},
{Name: "data_change", Type: types.Boolean, Source: doltdb.DiffTableName, PrimaryKey: false},
{Name: "schema_change", Type: types.Boolean, Source: doltdb.DiffTableName, PrimaryKey: false},
}
}

Some files were not shown because too many files have changed in this diff Show More