Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 939ca76

Browse files
author
Juanjo Alvarez
committed
Add length to Char.String
Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
1 parent 70cc4b7 commit 939ca76

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

sql/plan/show_create_table_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func TestShowCreateTable(t *testing.T) {
2020
&sql.Column{Name: "zab", Type: sql.Int32, Default: int32(0), Nullable: true},
2121
&sql.Column{Name: "bza", Type: sql.Uint64, Default: uint64(0), Nullable: true},
2222
&sql.Column{Name: "foo", Type: sql.VarChar(123), Default: "", Nullable: true},
23+
&sql.Column{Name: "pok", Type: sql.Char(123), Default: "", Nullable: true},
2324
})
2425

2526
db.AddTable(table.Name(), table)
@@ -41,7 +42,8 @@ func TestShowCreateTable(t *testing.T) {
4142
"CREATE TABLE `test-table` (\n `baz` text NOT NULL,\n"+
4243
" `zab` integer DEFAULT 0,\n"+
4344
" `bza` bigint unsigned DEFAULT 0,\n"+
44-
" `foo` varchar(123)\n"+
45+
" `foo` varchar(123),\n"+
46+
" `pok` char(123)\n"+
4547
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4",
4648
)
4749

sql/type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,7 @@ func MySQLTypeName(t Type) string {
12561256
case sqltypes.Date:
12571257
return "DATE"
12581258
case sqltypes.Char:
1259-
return "CHAR"
1259+
return fmt.Sprintf("CHAR(%v)", t.(charT).Capacity())
12601260
case sqltypes.VarChar:
12611261
return fmt.Sprintf("VARCHAR(%v)", t.(varCharT).Capacity())
12621262
case sqltypes.Text:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy