Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
e5e17602
Commit
e5e17602
authored
Mar 03, 2006
by
cmiller@zippy.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysqldev@production.mysql.com:my/mysql-5.0-release
into zippy.(none):/home/cmiller/work/mysql/mysql-5.0.19-tbr
parents
2ffb679a
599c710a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
8 deletions
+59
-8
client/mysql.cc
client/mysql.cc
+47
-8
mysql-test/r/mysql.result
mysql-test/r/mysql.result
+7
-0
mysql-test/t/mysql.test
mysql-test/t/mysql.test
+5
-0
No files found.
client/mysql.cc
View file @
e5e17602
...
@@ -185,6 +185,7 @@ void tee_fprintf(FILE *file, const char *fmt, ...);
...
@@ -185,6 +185,7 @@ void tee_fprintf(FILE *file, const char *fmt, ...);
void
tee_fputs
(
const
char
*
s
,
FILE
*
file
);
void
tee_fputs
(
const
char
*
s
,
FILE
*
file
);
void
tee_puts
(
const
char
*
s
,
FILE
*
file
);
void
tee_puts
(
const
char
*
s
,
FILE
*
file
);
void
tee_putc
(
int
c
,
FILE
*
file
);
void
tee_putc
(
int
c
,
FILE
*
file
);
static
void
tee_print_sized_data
(
const
char
*
data
,
unsigned
int
length
,
unsigned
int
width
);
/* The names of functions that actually do the manipulation. */
/* The names of functions that actually do the manipulation. */
static
int
get_options
(
int
argc
,
char
**
argv
);
static
int
get_options
(
int
argc
,
char
**
argv
);
static
int
com_quit
(
String
*
str
,
char
*
),
static
int
com_quit
(
String
*
str
,
char
*
),
...
@@ -2308,20 +2309,29 @@ print_table_data(MYSQL_RES *result)
...
@@ -2308,20 +2309,29 @@ print_table_data(MYSQL_RES *result)
for
(
uint
off
=
0
;
off
<
mysql_num_fields
(
result
);
off
++
)
for
(
uint
off
=
0
;
off
<
mysql_num_fields
(
result
);
off
++
)
{
{
const
char
*
str
=
cur
[
off
]
?
cur
[
off
]
:
"NULL"
;
const
char
*
str
=
cur
[
off
]
?
cur
[
off
]
:
"NULL"
;
uint
currlength
;
uint
maxlength
;
uint
numcells
;
field
=
mysql_fetch_field
(
result
);
field
=
mysql_fetch_field
(
result
);
uint
maxlength
=
field
->
max_length
;
maxlength
=
field
->
max_length
;
currlength
=
(
uint
)
lengths
[
off
];
numcells
=
charset_info
->
cset
->
numcells
(
charset_info
,
str
,
str
+
currlength
);
if
(
maxlength
>
MAX_COLUMN_LENGTH
)
if
(
maxlength
>
MAX_COLUMN_LENGTH
)
{
{
tee_fputs
(
str
,
PAGER
);
tee_print_sized_data
(
str
,
currlength
,
maxlength
);
tee_fputs
(
" |"
,
PAGER
);
tee_fputs
(
" |"
,
PAGER
);
}
}
else
else
{
{
uint
currlength
=
(
uint
)
lengths
[
off
];
if
(
num_flag
[
off
]
!=
0
)
uint
numcells
=
charset_info
->
cset
->
numcells
(
charset_info
,
tee_fprintf
(
PAGER
,
" %-*s|"
,
maxlength
+
currlength
-
numcells
,
str
);
str
,
str
+
currlength
);
else
tee_fprintf
(
PAGER
,
num_flag
[
off
]
?
"%*s |"
:
" %-*s|"
,
{
maxlength
+
currlength
-
numcells
,
str
);
tee_print_sized_data
(
str
,
currlength
,
maxlength
);
tee_fputs
(
" |"
,
PAGER
);
}
}
}
}
}
(
void
)
tee_fputs
(
"
\n
"
,
PAGER
);
(
void
)
tee_fputs
(
"
\n
"
,
PAGER
);
...
@@ -2331,6 +2341,35 @@ print_table_data(MYSQL_RES *result)
...
@@ -2331,6 +2341,35 @@ print_table_data(MYSQL_RES *result)
}
}
static
void
tee_print_sized_data
(
const
char
*
data
,
unsigned
int
length
,
unsigned
int
width
)
{
/*
It is not a number, so print each character justified to the left.
For '\0's print ASCII spaces instead, as '\0' is eaten by (at
least my) console driver, and that messes up the pretty table
grid. (The \0 is also the reason we can't use fprintf() .)
*/
unsigned
int
i
;
const
char
*
p
;
tee_putc
(
' '
,
PAGER
);
for
(
i
=
0
,
p
=
data
;
i
<
length
;
i
+=
1
,
p
+=
1
)
{
if
(
*
p
==
'\0'
)
tee_putc
((
int
)
' '
,
PAGER
);
else
tee_putc
((
int
)
*
p
,
PAGER
);
}
i
+=
1
;
for
(
;
i
<
width
;
i
+=
1
)
tee_putc
((
int
)
' '
,
PAGER
);
}
static
void
static
void
print_table_data_html
(
MYSQL_RES
*
result
)
print_table_data_html
(
MYSQL_RES
*
result
)
{
{
...
...
mysql-test/r/mysql.result
View file @
e5e17602
...
@@ -69,3 +69,10 @@ c_cp932
...
@@ -69,3 +69,10 @@ c_cp932
ソ
ソ
ソ
ソ
ソ
ソ
+----------------------+------------+--------+
| concat('>',col1,'<') | col2 | col3 |
+----------------------+------------+--------+
| >a < | b | 123421 |
| >a < | 0123456789 | 4 |
| >abcd< | | 4 |
+----------------------+------------+--------+
mysql-test/t/mysql.test
View file @
e5e17602
...
@@ -56,3 +56,8 @@ drop table t1;
...
@@ -56,3 +56,8 @@ drop table t1;
--
exec
$MYSQL
--
default
-
character
-
set
=
utf8
test
-
e
"charset cp932; set character_set_client= cp932; select '\'"
--
exec
$MYSQL
--
default
-
character
-
set
=
utf8
test
-
e
"charset cp932; set character_set_client= cp932; select '\'"
--
exec
$MYSQL
--
default
-
character
-
set
=
utf8
test
-
e
"/*charset cp932 */; set character_set_client= cp932; select '\'"
--
exec
$MYSQL
--
default
-
character
-
set
=
utf8
test
-
e
"/*charset cp932 */; set character_set_client= cp932; select '\'"
--
exec
$MYSQL
--
default
-
character
-
set
=
utf8
test
-
e
"/*!\C cp932 */; set character_set_client= cp932; select '\'"
--
exec
$MYSQL
--
default
-
character
-
set
=
utf8
test
-
e
"/*!\C cp932 */; set character_set_client= cp932; select '\'"
#
# Bug#16859 -- NULLs in columns must not truncate data as if a C-language "string".
#
--
exec
$MYSQL
-
t
test
-
e
"create table t1 (col1 binary(4), col2 varchar(10), col3 int); insert into t1 values ('a', 'b', 123421),('a ', '0123456789', 4), ('abcd', '', 4); select concat('>',col1,'<'), col2, col3 from t1; drop table t1;"
2
>&
1
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment