提交 d6e1ad7c 编写于 作者: martianzhang's avatar martianzhang

fix Makefile enviroment deps

上级 ccdfcb81
......@@ -46,7 +46,7 @@ deps:
@bash ./deps.sh
# The retool tools.json is setup from retool-install.sh
retool sync
retool do gometalinter.v2 intall
retool do gometalinter.v2 --install
# Code format
.PHONY: fmt
......@@ -176,7 +176,7 @@ docker:
-v `pwd`/doc/example/sakila.sql.gz:/docker-entrypoint-initdb.d/sakila.sql.gz \
$(MYSQL_RELEASE):$(MYSQL_VERSION)
@echo -n "waiting for sakila database initializing "
@echo "waiting for sakila database initializing "
@while ! mysql -h 127.0.0.1 -u root sakila -p1tIsB1g3rt -NBe "do 1;" 2>/dev/null; do \
printf '.' ; \
sleep 1 ; \
......
......@@ -10,3 +10,22 @@ for cmd in ${NEEDED_COMMANDS} ; do
echo "${cmd} found"
fi
done
# MySQL client
## Mac OS: brew install mysql
## Ubuntu: apt-get install mysql-client
# Docker
## https://www.docker.com
# Git
## https://git-scm.com/
# Go
## https://golang.org/
# Govendor
## go get github.com/kardianos/govendor
# retool
## go get github.com/twitchtv/retool
#!/bin/bash
GOPATH=$(go env GOPATH)
PROJECT_PATH=${GOPATH}/src/github.com/XiaoMi/soar/
if [ "$1x" == "-updatex" ]; then
......
......@@ -135,7 +135,18 @@ type TableName struct {
// Restore implements Recoverable interface.
func (n *TableName) Restore(sb *strings.Builder) error {
return errors.New("Not implemented")
if n.Schema.String() != "" {
WriteName(sb, n.Schema.String())
sb.WriteString(".")
}
WriteName(sb, n.Name.String())
for _, value := range n.IndexHints {
sb.WriteString(" ")
if err := value.Restore(sb); err != nil {
return errors.Annotate(err, "An error occurred while splicing IndexHints")
}
}
return nil
}
// IndexHintType is the type for index hint use, ignore or force.
......@@ -166,6 +177,48 @@ type IndexHint struct {
HintScope IndexHintScope
}
// IndexHint Restore (The const field uses switch to facilitate understanding)
func (n *IndexHint) Restore(sb *strings.Builder) error {
indexHintType := ""
switch n.HintType {
case 1:
indexHintType = "USE INDEX"
case 2:
indexHintType = "IGNORE INDEX"
case 3:
indexHintType = "FORCE INDEX"
default: // Prevent accidents
return errors.New("IndexHintType has an error while matching")
}
indexHintScope := ""
switch n.HintScope {
case 1:
indexHintScope = ""
case 2:
indexHintScope = " FOR JOIN"
case 3:
indexHintScope = " FOR ORDER BY"
case 4:
indexHintScope = " FOR GROUP BY"
default: // Prevent accidents
return errors.New("IndexHintScope has an error while matching")
}
sb.WriteString(indexHintType)
sb.WriteString(indexHintScope)
sb.WriteString(" (")
for i, value := range n.IndexNames {
if i > 0 {
sb.WriteString(", ")
}
WriteName(sb, value.O)
}
sb.WriteString(")")
return nil
}
// Accept implements Node Accept interface.
func (n *TableName) Accept(v Visitor) (Node, bool) {
newNode, skipChildren := v.Enter(n)
......
......@@ -50,6 +50,12 @@ func NewFieldType(tp byte) *FieldType {
}
}
// Clone returns a copy of itself.
func (ft *FieldType) Clone() *FieldType {
ret := *ft
return &ret
}
// Equal checks whether two FieldType objects are equal.
func (ft *FieldType) Equal(other *FieldType) bool {
// We do not need to compare whole `ft.Flag == other.Flag` when wrapping cast upon an Expression.
......
......@@ -40,12 +40,6 @@ func NewFieldType(tp byte) *FieldType {
}
}
// CloneFieldType clones the given FieldType.
func CloneFieldType(src *FieldType) *FieldType {
ft := *src
return &ft
}
// AggFieldType aggregates field types for a multi-argument function like `IF`, `IFNULL`, `COALESCE`
// whose return type is determined by the arguments' FieldTypes.
// Aggregation is performed by MergeFieldType function.
......
......@@ -107,104 +107,104 @@
{
"checksumSHA1": "xbV0lm0Qw8rFC82Dttxbf5ypBjA=",
"path": "github.com/pingcap/parser",
"revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-11T02:45:40Z"
"revision": "f20218bc290343c2752c4926c1bf4264343bbef4",
"revisionTime": "2018-12-12T04:21:31Z"
},
{
"checksumSHA1": "zrZ2JfaxdfwpArtuyiPjgH9GKeY=",
"checksumSHA1": "RosqMriA/39ZEtqGgNU+bOfRBVc=",
"path": "github.com/pingcap/parser/ast",
"revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-11T02:45:40Z"
"revision": "f20218bc290343c2752c4926c1bf4264343bbef4",
"revisionTime": "2018-12-12T04:21:31Z"
},
{
"checksumSHA1": "skWGV4FNvD3vr+5olepaPPnylUw=",
"path": "github.com/pingcap/parser/auth",
"revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-11T02:45:40Z"
"revision": "f20218bc290343c2752c4926c1bf4264343bbef4",
"revisionTime": "2018-12-12T04:21:31Z"
},
{
"checksumSHA1": "t4UHo966WzU9Z0IJkyGHRp0loOk=",
"path": "github.com/pingcap/parser/charset",
"revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-11T02:45:40Z"
"revision": "f20218bc290343c2752c4926c1bf4264343bbef4",
"revisionTime": "2018-12-12T04:21:31Z"
},
{
"checksumSHA1": "SInoXbsRe0tnBwmatmtZYfSFbdk=",
"path": "github.com/pingcap/parser/format",
"revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-11T02:45:40Z"
"revision": "f20218bc290343c2752c4926c1bf4264343bbef4",
"revisionTime": "2018-12-12T04:21:31Z"
},
{
"checksumSHA1": "reRV2qecd6NpB7tIW3JeK46K/sk=",
"path": "github.com/pingcap/parser/model",
"revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-11T02:45:40Z"
"revision": "f20218bc290343c2752c4926c1bf4264343bbef4",
"revisionTime": "2018-12-12T04:21:31Z"
},
{
"checksumSHA1": "QBa9yiMDQNl2cLLwqlRoNTpCPNg=",
"path": "github.com/pingcap/parser/mysql",
"revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-11T02:45:40Z"
"revision": "f20218bc290343c2752c4926c1bf4264343bbef4",
"revisionTime": "2018-12-12T04:21:31Z"
},
{
"checksumSHA1": "oNBCSwJRykKuzIKgPCttatB9hAo=",
"path": "github.com/pingcap/parser/opcode",
"revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-11T02:45:40Z"
"revision": "f20218bc290343c2752c4926c1bf4264343bbef4",
"revisionTime": "2018-12-12T04:21:31Z"
},
{
"checksumSHA1": "XvnUllvwMYd6HrMvMiKnn4cGN2M=",
"path": "github.com/pingcap/parser/terror",
"revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-11T02:45:40Z"
"revision": "f20218bc290343c2752c4926c1bf4264343bbef4",
"revisionTime": "2018-12-12T04:21:31Z"
},
{
"checksumSHA1": "s96v2EoeGKcWHO3mpMOQk/z2iaI=",
"checksumSHA1": "YoDiJ3sniNqxkP5X/BDkx6efteA=",
"path": "github.com/pingcap/parser/types",
"revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-11T02:45:40Z"
"revision": "f20218bc290343c2752c4926c1bf4264343bbef4",
"revisionTime": "2018-12-12T04:21:31Z"
},
{
"checksumSHA1": "fWqL/7jTYOiqDNmiUcQi3u45Hw0=",
"path": "github.com/pingcap/tidb/sessionctx/stmtctx",
"revision": "ef0ad26da8f99044a741fc0a781a0c4791446e8b",
"revisionTime": "2018-12-10T15:48:53Z"
"revision": "63e7dacf8d4e59dce05131561d313065cbeda586",
"revisionTime": "2018-12-12T05:36:44Z"
},
{
"checksumSHA1": "U/TFas5WBPWG2DARj51bcfoN0xQ=",
"checksumSHA1": "0CCq+3fAyaXs9XU+xWaRvbbtSOQ=",
"path": "github.com/pingcap/tidb/types",
"revision": "ef0ad26da8f99044a741fc0a781a0c4791446e8b",
"revisionTime": "2018-12-10T15:48:53Z"
"revision": "63e7dacf8d4e59dce05131561d313065cbeda586",
"revisionTime": "2018-12-12T05:36:44Z"
},
{
"checksumSHA1": "DWVD7+ygtT66IQ+cqXmMJ5OVqUk=",
"path": "github.com/pingcap/tidb/types/json",
"revision": "ef0ad26da8f99044a741fc0a781a0c4791446e8b",
"revisionTime": "2018-12-10T15:48:53Z"
"revision": "63e7dacf8d4e59dce05131561d313065cbeda586",
"revisionTime": "2018-12-12T05:36:44Z"
},
{
"checksumSHA1": "Zp5ME8OXNTmHnYTwJJUZlydN4/U=",
"path": "github.com/pingcap/tidb/types/parser_driver",
"revision": "ef0ad26da8f99044a741fc0a781a0c4791446e8b",
"revisionTime": "2018-12-10T15:48:53Z"
"revision": "63e7dacf8d4e59dce05131561d313065cbeda586",
"revisionTime": "2018-12-12T05:36:44Z"
},
{
"checksumSHA1": "s709bhSrG2Ec35406mGtrySid4s=",
"path": "github.com/pingcap/tidb/util/execdetails",
"revision": "ef0ad26da8f99044a741fc0a781a0c4791446e8b",
"revisionTime": "2018-12-10T15:48:53Z"
"revision": "63e7dacf8d4e59dce05131561d313065cbeda586",
"revisionTime": "2018-12-12T05:36:44Z"
},
{
"checksumSHA1": "nUC7zVoAMNR2a+z2iGqHoN2AkFE=",
"path": "github.com/pingcap/tidb/util/hack",
"revision": "ef0ad26da8f99044a741fc0a781a0c4791446e8b",
"revisionTime": "2018-12-10T15:48:53Z"
"revision": "63e7dacf8d4e59dce05131561d313065cbeda586",
"revisionTime": "2018-12-12T05:36:44Z"
},
{
"checksumSHA1": "xSyepiuqsoaaeDch7cXeumvVHKM=",
"path": "github.com/pingcap/tidb/util/memory",
"revision": "ef0ad26da8f99044a741fc0a781a0c4791446e8b",
"revisionTime": "2018-12-10T15:48:53Z"
"revision": "63e7dacf8d4e59dce05131561d313065cbeda586",
"revisionTime": "2018-12-12T05:36:44Z"
},
{
"checksumSHA1": "SmYeIK/fIYXNu8IKxD6HOVQVTuU=",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册