Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types: Regard TypeNewDecimal as not a hasVariantFieldLength type. #21849

Merged
merged 22 commits into from
Dec 23, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
aaffbc1
regard `TypeNewDecimal` as not a `hasVariantFieldLength` type.
LittleFall Dec 17, 2020
a8f884b
Merge branch 'master' into decimal
LittleFall Dec 17, 2020
e40d19d
Merge branch 'master' into decimal
LittleFall Dec 17, 2020
db45943
add a little test
LittleFall Dec 17, 2020
9e1452d
Merge remote-tracking branch 'origin/master' into decimal
LittleFall Dec 17, 2020
89bebf7
Merge branch 'master' into decimal
LittleFall Dec 17, 2020
aef28a3
Merge remote-tracking branch 'qizhi/decimal' into decimal
LittleFall Dec 17, 2020
6591f0e
Update executor/seqtest/prepared_test.go
LittleFall Dec 18, 2020
fcf27a0
fix test.
LittleFall Dec 21, 2020
7f30277
Merge remote-tracking branch 'origin/master' into decimal
LittleFall Dec 21, 2020
793914f
add new test
LittleFall Dec 21, 2020
a8209c2
fmt
LittleFall Dec 21, 2020
0c8a591
review test
LittleFall Dec 21, 2020
1222cee
Merge remote-tracking branch 'qizhi/decimal' into decimal
LittleFall Dec 21, 2020
bcc05ac
Merge branch 'master' into decimal
LittleFall Dec 21, 2020
80a8e8c
Merge branch 'master' into decimal
LittleFall Dec 21, 2020
c320931
Merge branch 'master' into decimal
ti-srebot Dec 22, 2020
ff693ad
rename stmt1,stmt2,stmt3 to stmt because there is a limit of 2 statem…
LittleFall Dec 22, 2020
ee17ed1
Merge branch 'master' into decimal
ti-srebot Dec 22, 2020
db2f97c
Merge branch 'master' into decimal
ti-srebot Dec 22, 2020
cff3394
Merge branch 'master' into decimal
ti-srebot Dec 23, 2020
b372618
Merge branch 'master' into decimal
ti-srebot Dec 23, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions executor/seqtest/prepared_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,20 @@ func (s *seqTestSuite) TestPreparedIssue8644(c *C) {

r := tk.MustQuery(`select * from t`)
r.Check(testkit.Rows("a", "aaaaaaaaaaaaaaaaaa"))

tk.MustExec("drop table if exists t")
tk.MustExec("create table t(data decimal)")

tk.MustExec(`prepare s1 from 'insert t (data) values (?)'`)

tk.MustExec(`set @a = '1'`)
tk.MustExec(`execute stmt1 using @a;`)
LittleFall marked this conversation as resolved.
Show resolved Hide resolved

tk.MustExec(`set @b = '11111.11111'`) // '.11111' will be truncated.
tk.MustExec(`execute stmt1 using @b;`)

r = tk.MustQuery(`select * from t`)
r.Check(testkit.Rows("1", "11111"))
LittleFall marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
2 changes: 1 addition & 1 deletion types/field_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func DefaultParamTypeForValue(value interface{}, tp *FieldType) {
func hasVariantFieldLength(tp *FieldType) bool {
switch tp.Tp {
case mysql.TypeLonglong, mysql.TypeVarString, mysql.TypeDouble, mysql.TypeBlob,
mysql.TypeBit, mysql.TypeDuration, mysql.TypeNewDecimal, mysql.TypeEnum, mysql.TypeSet:
mysql.TypeBit, mysql.TypeDuration, mysql.TypeEnum, mysql.TypeSet:
LittleFall marked this conversation as resolved.
Show resolved Hide resolved
return true
}
return false
Expand Down