Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
m0_67397764
soar
提交
caf32e9e
S
soar
项目概览
m0_67397764
/
soar
与 Fork 源项目一致
Fork自
Xiaomi / soar
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
soar
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
caf32e9e
编写于
12月 19, 2018
作者:
martianzhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
run all test single pass
not fix too many connections yet
上级
019ee551
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
21 addition
and
9 deletion
+21
-9
advisor/heuristic.go
advisor/heuristic.go
+1
-1
advisor/index_test.go
advisor/index_test.go
+3
-1
ast/rewrite_test.go
ast/rewrite_test.go
+6
-0
database/show.go
database/show.go
+10
-6
database/testdata/TestFindColumn.golden
database/testdata/TestFindColumn.golden
+1
-1
未找到文件。
advisor/heuristic.go
浏览文件 @
caf32e9e
...
...
@@ -309,7 +309,7 @@ func (idxAdv *IndexAdvisor) RuleImplicitConversion() Rule {
// 列与值比较
for
_
,
val
:=
range
values
{
if
colList
[
0
]
.
DataType
==
""
{
common
.
Log
.
Debug
(
"Can't get %s data type"
,
colList
[
0
]
.
Name
)
common
.
Log
.
Warn
(
"Can't get %s data type"
,
colList
[
0
]
.
Name
)
break
}
...
...
advisor/index_test.go
浏览文件 @
caf32e9e
...
...
@@ -357,8 +357,9 @@ func TestIndexAdvise(t *testing.T) {
}
func
TestIndexAdviseNoEnv
(
t
*
testing
.
T
)
{
common
.
Config
.
OnlineDSN
.
Disable
=
true
common
.
Log
.
Debug
(
"Entering function: %s"
,
common
.
GetFunctionName
())
orgOnlineDSNStatus
:=
common
.
Config
.
OnlineDSN
.
Disable
common
.
Config
.
OnlineDSN
.
Disable
=
true
vEnv
,
rEnv
:=
env
.
BuildEnv
()
defer
vEnv
.
CleanUp
()
...
...
@@ -384,6 +385,7 @@ func TestIndexAdviseNoEnv(t *testing.T) {
}
}
}
common
.
Config
.
OnlineDSN
.
Disable
=
orgOnlineDSNStatus
common
.
Log
.
Debug
(
"Exiting function: %s"
,
common
.
GetFunctionName
())
}
...
...
ast/rewrite_test.go
浏览文件 @
caf32e9e
...
...
@@ -25,6 +25,7 @@ import (
)
func
TestRewrite
(
t
*
testing
.
T
)
{
orgTestDSNStatus
:=
common
.
Config
.
TestDSN
.
Disable
common
.
Config
.
TestDSN
.
Disable
=
false
testSQL
:=
[]
map
[
string
]
string
{
{
...
...
@@ -97,9 +98,11 @@ func TestRewrite(t *testing.T) {
t
.
Errorf
(
"want: %s
\n
got: %s"
,
sql
[
"output"
],
rw
.
NewSQL
)
}
}
common
.
Config
.
TestDSN
.
Disable
=
orgTestDSNStatus
}
func
TestRewriteStar2Columns
(
t
*
testing
.
T
)
{
orgTestDSNStatus
:=
common
.
Config
.
TestDSN
.
Disable
common
.
Config
.
TestDSN
.
Disable
=
false
testSQL
:=
[]
map
[
string
]
string
{
{
...
...
@@ -127,6 +130,7 @@ func TestRewriteStar2Columns(t *testing.T) {
t
.
Errorf
(
"want: %s
\n
got: %s"
,
sql
[
"output"
],
rw
.
NewSQL
)
}
}
common
.
Config
.
TestDSN
.
Disable
=
orgTestDSNStatus
}
func
TestRewriteInsertColumns
(
t
*
testing
.
T
)
{
...
...
@@ -427,6 +431,7 @@ func TestRewriteAlwaysTrue(t *testing.T) {
// TODO:
func
TestRewriteSubQuery2Join
(
t
*
testing
.
T
)
{
orgTestDSNStatus
:=
common
.
Config
.
TestDSN
.
Disable
common
.
Config
.
TestDSN
.
Disable
=
true
testSQL
:=
[]
map
[
string
]
string
{
{
...
...
@@ -452,6 +457,7 @@ func TestRewriteSubQuery2Join(t *testing.T) {
t
.
Errorf
(
"want: %s
\n
got: %s"
,
sql
[
"output"
],
rw
.
NewSQL
)
}
}
common
.
Config
.
TestDSN
.
Disable
=
orgTestDSNStatus
}
func
TestRewriteDML2Select
(
t
*
testing
.
T
)
{
...
...
database/show.go
浏览文件 @
caf32e9e
...
...
@@ -371,7 +371,8 @@ func (td TableDesc) Columns() []string {
// showCreate show create
func
(
db
*
Connector
)
showCreate
(
createType
,
name
string
)
(
string
,
error
)
{
// 执行 show create table
// 执行 show create table|database
// createType = [table|database]
res
,
err
:=
db
.
Query
(
fmt
.
Sprintf
(
"show create %s `%s`"
,
createType
,
name
))
if
err
!=
nil
{
return
""
,
err
...
...
@@ -461,14 +462,17 @@ func (db *Connector) FindColumn(name, dbName string, tables ...string) ([]*commo
var
col
common
.
Column
for
res
.
Rows
.
Next
()
{
var
character
,
collation
string
res
.
Rows
.
Scan
(
&
col
.
Table
,
var
character
,
collation
[]
byte
res
.
Rows
.
Scan
(
&
col
.
Table
,
&
col
.
DB
,
&
col
.
DataType
,
&
character
,
&
collation
)
col
.
Character
=
character
col
.
Collation
=
collation
&
collation
,
)
col
.
Name
=
name
col
.
Character
=
string
(
character
)
col
.
Collation
=
string
(
collation
)
// 填充字符集和排序规则
if
col
.
Character
==
""
{
// 当从`INFORMATION_SCHEMA`.`COLUMNS`表中查询不到相关列的character和collation的信息时
...
...
database/testdata/TestFindColumn.golden
浏览文件 @
caf32e9e
[]*common.Column{
&common.Column{
Name: "",
Name: "
film_id
",
Alias: nil,
Table: "film",
DB: "sakila",
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录