Re: How to get the MySQL Command-Line Tool to display Unicode properly?
Probably the dumbest suggestion yet, but have you tried "set names utf8" in the client? On 20 March 2018 20:50:08 CET, Roger House <rho...@sonic.net> wrote: > > >On 03/15/2018 02:06 PM, Roger House wrote: >> >> >> On 03/15/2018 11:30 AM, shawn l.green wrote: >>> Hi Roger, >>> >>> (please note, this is a bottom-post forum) >>> >>> On 3/13/2018 7:54 PM, Roger House wrote: >>> > >>> > On 03/13/2018 03:11 PM, Reindl Harald wrote: >>> >> >>> >> >>> >> Am 13.03.2018 um 22:59 schrieb Roger House: >>> >>> In all respects except one, the treatment of Unicode works just >>> fine. >>> >>> I can write Unicode to database tables, read it, display it, >etc., >>> >>> with no problems. The exception is mysql, the MySQL Command-Line >>> >>> Tool. When I execute a SELECT statement to see rows in a table >>> >>> containing the Venus and Mars Unicode characters, here is what I >see >>> >>> on the screen: >>> >>> >>> >>> || Venus | ♀ | | Mars | ♂ | | >>> >>> >>> >>> What I should see in the right column are the standard glyphs >for >>> >>> Venus and Mars. >>> >>> >>> >>> Any ideas about how to get the MySQL Command-Line Tool to >display >>> >>> Unicode properly? >>> >> what operating system >>> >> what terminal >>> >> >>> >> all recent Linux systems have UTF8 as default >>> >> >>> > >>> > >>>> I am running Ubuntu MATE 16.04. I have the problem also on Windows >7 >>>> and on Mac OS Version 10.11.6. I do not think that the problem has >to >>>> do with the operating system nor the terminal. Everything about >the >>>> Unicode text works fine in all tools such as editors, the cat >command, >>>> etc. It is only when I am running mysql and I issue a SELECT >>>> command to >>>> see what is in a row. Then the UTF-8 is not rendered properly. I >>>> believe the problem is with mysql. >>>> >>>> Roger >>>> >>> >>> If I presume that your terminal has a code page that is >>> utf8-compatible (you say that cat command renders the multibyte >>> characters just fine) then it could be your client-side mysql >>> settings that are rendering those multibyte characters into >>> individual glyphs based on their individual byte values. >>> >>> The next time you are in mysql and have a chance to look at some >utf8 >>> data, please collect and share these two reports: >>> >>> status >>> SHOW GLOBAL VARIABLES like '%haracter%'; >>> >>> (you can obfuscate any sensitive details like server names or >addresses) >>> >>> Yours, >> Here is the requested info: >> >> mysql> status >> -- >> mysql Ver 14.14 Distrib 5.7.21, for Linux (x86_64) using EditLine >> wrapper >> >> Connection id: 5 >> Current database: ephemeris >> Current user: root@localhost >> SSL: Not in use >> Current pager: stdout >> Using outfile: '' >> Using delimiter: ; >> Server version: 5.7.21-0ubuntu0.16.04.1 (Ubuntu) >> Protocol version: 10 >> Connection: Localhost via UNIX socket >> Server characterset: utf8mb4 >> Db characterset: latin1 >> Client characterset: utf8mb4 >> Conn. characterset: utf8mb4 >> UNIX socket: /var/run/mysqld/mysqld.sock >> Uptime: 6 hours 17 min 8 sec >> >> Threads: 1 Questions: 28 Slow queries: 0 Opens: 122 Flush tables: >> 1 Open tables: 41 Queries per second avg: 0.001 >> -- >> >> mysql> show global variables like '%haracter%'; >> +--++ >> | Variable_name | Value | >> +--++ >> | character_set_client | utf8mb4 | >> | character_set_connection | utf8mb4 | >> | character_set_database | utf8mb4 | >> | character_set_filesystem | binary | >> | character_set_results | utf8mb4 | >> | character_set_server | utf8mb4 | >> | cha
Re: How to get the MySQL Command-Line Tool to display Unicode properly?
On 03/15/2018 02:06 PM, Roger House wrote: On 03/15/2018 11:30 AM, shawn l.green wrote: Hi Roger, (please note, this is a bottom-post forum) On 3/13/2018 7:54 PM, Roger House wrote: > > On 03/13/2018 03:11 PM, Reindl Harald wrote: >> >> >> Am 13.03.2018 um 22:59 schrieb Roger House: >>> In all respects except one, the treatment of Unicode works just fine. >>> I can write Unicode to database tables, read it, display it, etc., >>> with no problems. The exception is mysql, the MySQL Command-Line >>> Tool. When I execute a SELECT statement to see rows in a table >>> containing the Venus and Mars Unicode characters, here is what I see >>> on the screen: >>> >>> || Venus | ♀ | | Mars | ♂ | | >>> >>> What I should see in the right column are the standard glyphs for >>> Venus and Mars. >>> >>> Any ideas about how to get the MySQL Command-Line Tool to display >>> Unicode properly? >> what operating system >> what terminal >> >> all recent Linux systems have UTF8 as default >> > > I am running Ubuntu MATE 16.04. I have the problem also on Windows 7 and on Mac OS Version 10.11.6. I do not think that the problem has to do with the operating system nor the terminal. Everything about the Unicode text works fine in all tools such as editors, the cat command, etc. It is only when I am running mysql and I issue a SELECT command to see what is in a row. Then the UTF-8 is not rendered properly. I believe the problem is with mysql. Roger If I presume that your terminal has a code page that is utf8-compatible (you say that cat command renders the multibyte characters just fine) then it could be your client-side mysql settings that are rendering those multibyte characters into individual glyphs based on their individual byte values. The next time you are in mysql and have a chance to look at some utf8 data, please collect and share these two reports: status SHOW GLOBAL VARIABLES like '%haracter%'; (you can obfuscate any sensitive details like server names or addresses) Yours, Here is the requested info: mysql> status -- mysql Ver 14.14 Distrib 5.7.21, for Linux (x86_64) using EditLine wrapper Connection id: 5 Current database: ephemeris Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 5.7.21-0ubuntu0.16.04.1 (Ubuntu) Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8mb4 Db characterset: latin1 Client characterset: utf8mb4 Conn. characterset: utf8mb4 UNIX socket: /var/run/mysqld/mysqld.sock Uptime: 6 hours 17 min 8 sec Threads: 1 Questions: 28 Slow queries: 0 Opens: 122 Flush tables: 1 Open tables: 41 Queries per second avg: 0.001 -- mysql> show global variables like '%haracter%'; +--++ | Variable_name | Value | +--++ | character_set_client | utf8mb4 | | character_set_connection | utf8mb4 | | character_set_database | utf8mb4 | | character_set_filesystem | binary | | character_set_results | utf8mb4 | | character_set_server | utf8mb4 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--++ 8 rows in set (0.01 sec) Update I noticed that the status command shows Db characterset: latin1 whereas all the other charactersets are utf8mb4. So I looked around to see how to change the Db characterset, and came up with this: ALTER DATABASE ephemeris CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; After which, status shows Db characterset: utf8mb4 So the database characterset has now been changed. But select * from planet_desc; still shows Venus | ♀ Mars | ♂ I shut down the mysql service and restarted it, but this did not change anything. I'm beginning to think that the command line tool mysql does not pay any attention to character sets when the SELECT command displays on the terminal. Roger -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: How to get the MySQL Command-Line Tool to display Unicode properly?
On 03/15/2018 11:30 AM, shawn l.green wrote: Hi Roger, (please note, this is a bottom-post forum) On 3/13/2018 7:54 PM, Roger House wrote: > > On 03/13/2018 03:11 PM, Reindl Harald wrote: >> >> >> Am 13.03.2018 um 22:59 schrieb Roger House: >>> In all respects except one, the treatment of Unicode works just fine. >>> I can write Unicode to database tables, read it, display it, etc., >>> with no problems. The exception is mysql, the MySQL Command-Line >>> Tool. When I execute a SELECT statement to see rows in a table >>> containing the Venus and Mars Unicode characters, here is what I see >>> on the screen: >>> >>> || Venus | ♀ | | Mars | ♂ | | >>> >>> What I should see in the right column are the standard glyphs for >>> Venus and Mars. >>> >>> Any ideas about how to get the MySQL Command-Line Tool to display >>> Unicode properly? >> what operating system >> what terminal >> >> all recent Linux systems have UTF8 as default >> > > I am running Ubuntu MATE 16.04. I have the problem also on Windows 7 and on Mac OS Version 10.11.6. I do not think that the problem has to do with the operating system nor the terminal. Everything about the Unicode text works fine in all tools such as editors, the cat command, etc. It is only when I am running mysql and I issue a SELECT command to see what is in a row. Then the UTF-8 is not rendered properly. I believe the problem is with mysql. Roger If I presume that your terminal has a code page that is utf8-compatible (you say that cat command renders the multibyte characters just fine) then it could be your client-side mysql settings that are rendering those multibyte characters into individual glyphs based on their individual byte values. The next time you are in mysql and have a chance to look at some utf8 data, please collect and share these two reports: status SHOW GLOBAL VARIABLES like '%haracter%'; (you can obfuscate any sensitive details like server names or addresses) Yours, Here is the requested info: mysql> status -- mysql Ver 14.14 Distrib 5.7.21, for Linux (x86_64) using EditLine wrapper Connection id: 5 Current database: ephemeris Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 5.7.21-0ubuntu0.16.04.1 (Ubuntu) Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8mb4 Db characterset: latin1 Client characterset: utf8mb4 Conn. characterset: utf8mb4 UNIX socket: /var/run/mysqld/mysqld.sock Uptime: 6 hours 17 min 8 sec Threads: 1 Questions: 28 Slow queries: 0 Opens: 122 Flush tables: 1 Open tables: 41 Queries per second avg: 0.001 -- mysql> show global variables like '%haracter%'; +--++ | Variable_name | Value | +--++ | character_set_client | utf8mb4 | | character_set_connection | utf8mb4 | | character_set_database | utf8mb4 | | character_set_filesystem | binary | | character_set_results | utf8mb4 | | character_set_server | utf8mb4 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--++ 8 rows in set (0.01 sec) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: How to get the MySQL Command-Line Tool to display Unicode properly?
Hi Roger, (please note, this is a bottom-post forum) On 3/13/2018 7:54 PM, Roger House wrote: > > On 03/13/2018 03:11 PM, Reindl Harald wrote: >> >> >> Am 13.03.2018 um 22:59 schrieb Roger House: >>> In all respects except one, the treatment of Unicode works just fine. >>> I can write Unicode to database tables, read it, display it, etc., >>> with no problems. The exception is mysql, the MySQL Command-Line >>> Tool. When I execute a SELECT statement to see rows in a table >>> containing the Venus and Mars Unicode characters, here is what I see >>> on the screen: >>> >>> || Venus | ♀ | | Mars | ♂ | | >>> >>> What I should see in the right column are the standard glyphs for >>> Venus and Mars. >>> >>> Any ideas about how to get the MySQL Command-Line Tool to display >>> Unicode properly? >> what operating system >> what terminal >> >> all recent Linux systems have UTF8 as default >> > > I am running Ubuntu MATE 16.04. I have the problem also on Windows 7 and on Mac OS Version 10.11.6. I do not think that the problem has to do with the operating system nor the terminal. Everything about the Unicode text works fine in all tools such as editors, the cat command, etc. It is only when I am running mysql and I issue a SELECT command to see what is in a row. Then the UTF-8 is not rendered properly. I believe the problem is with mysql. Roger If I presume that your terminal has a code page that is utf8-compatible (you say that cat command renders the multibyte characters just fine) then it could be your client-side mysql settings that are rendering those multibyte characters into individual glyphs based on their individual byte values. The next time you are in mysql and have a chance to look at some utf8 data, please collect and share these two reports: status SHOW GLOBAL VARIABLES like '%haracter%'; (you can obfuscate any sensitive details like server names or addresses) Yours, -- Shawn Green MySQL Senior Principal Technical Support Engineer Oracle USA, Inc. - Integrated Cloud Applications & Platform Services Become certified in MySQL! Visit https://www.mysql.com/certification/ for details. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: How to get the MySQL Command-Line Tool to display Unicode properly?
I am running Ubuntu MATE 16.04. I have the problem also on Windows 7 and on Mac OS Version 10.11.6. I do not think that the problem has to do with the operating system nor the terminal. Everything about the Unicode text works fine in all tools such as editors, the cat command, etc. It is only when I am running mysql and I issue a SELECT command to see what is in a row. Then the UTF-8 is not rendered properly. I believe the problem is with mysql. Roger On 03/13/2018 03:11 PM, Reindl Harald wrote: Am 13.03.2018 um 22:59 schrieb Roger House: In all respects except one, the treatment of Unicode works just fine. I can write Unicode to database tables, read it, display it, etc., with no problems. The exception is mysql, the MySQL Command-Line Tool. When I execute a SELECT statement to see rows in a table containing the Venus and Mars Unicode characters, here is what I see on the screen: || Venus | ♀ | | Mars | ♂ | | What I should see in the right column are the standard glyphs for Venus and Mars. Any ideas about how to get the MySQL Command-Line Tool to display Unicode properly? what operating system what terminal all recent Linux systems have UTF8 as default -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: How to get the MySQL Command-Line Tool to display Unicode properly?
Am 13.03.2018 um 22:59 schrieb Roger House: In all respects except one, the treatment of Unicode works just fine. I can write Unicode to database tables, read it, display it, etc., with no problems. The exception is mysql, the MySQL Command-Line Tool. When I execute a SELECT statement to see rows in a table containing the Venus and Mars Unicode characters, here is what I see on the screen: || Venus | ♀ | | Mars | ♂ | | What I should see in the right column are the standard glyphs for Venus and Mars. Any ideas about how to get the MySQL Command-Line Tool to display Unicode properly? what operating system what terminal all recent Linux systems have UTF8 as default -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
How to get the MySQL Command-Line Tool to display Unicode properly?
Five months ago I posted the query shown below on StackOverflow. I got one reply which was not of much help. So I am trying again, hoping a more MySQL-centric forum might be able to solve my problem. Roger House How to get the MySQL Command-Line Tool to display Unicode properly? I use a Python program to write text containing Unicode characters to a MySQL database. As an example, two of the characters are |u'\u2640' a symbol for Venus or female u'\u2642' a symbol for Mars or male | I use utf8mb4 for virtually all character sets involved with MySQL. Here is an excerpt from /etc/mysql/my.cnf |[client] default-character-set=utf8mb4 [mysql] default-character-set=utf8mb4 [mysqld] default-character-set=utf8mb4 character-set-server =utf8mb4 character_set_system =utf8mb4 | In addition, all tables are created with these parameters: |ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci | In all respects except one, the treatment of Unicode works just fine. I can write Unicode to database tables, read it, display it, etc., with no problems. The exception is mysql, the MySQL Command-Line Tool. When I execute a SELECT statement to see rows in a table containing the Venus and Mars Unicode characters, here is what I see on the screen: || Venus | ♀ | | Mars | ♂ | | What I should see in the right column are the standard glyphs for Venus and Mars. Any ideas about how to get the MySQL Command-Line Tool to display Unicode properly? Edit: I have done a fair amount of research into the various MySQL system variables, etc., and I now realize that the my.cnf settings shown above have some serious issues. In fact, the server, mysqld, would not launch with the settings shown. To correct things, remove these from [mysqld]: |default-character-set=utf8mb4 character-set-system=utf8mb4 | I'm not sure that the [client] option does anything, but it doesn't seem to hurt. In Python u'\u2640' represents a single Unicode character, namely "♀". This compiles down to three bytes containing the hex value E29980. I am having no problems at all encoding and decoding Unicode. The correct values are being stored in a MySQL table; they are correctly read from the table, and when displayed by a Python program they show up like this: |♀ Venus ♂ Mars | The program output can be redirected to a file, processed by a text editor, etc., and in all cases the correct Unicode symbol is displayed. There is only one place where the correct Unicode symbol is not displayed, and that is when I am using the MySQL Command Line Tool. When I issue a SELECT statement on the table containing the Unicode symbols I get the junk shown above. This is not a Windows specific issue. I have exactly the same problem with the MySQL Command Line Tool when I run it on Windows, Mac OS X, and Ubuntu.
Re: How to get the MySQL Command-Line Tool to display Unicode properly
2017/10/18 18:32 ... Roger House: I get the same behavior with the MySQL Command Line Tool when I run it on Windows, Mac OS X, and Ubuntu, so I'm pretty sure the problem has to do with mysql itself. What do you know about the displays to which the client is writing? In the case of "cmd" under Windows, see what others had to do for other programs: https://stackoverflow.com/questions/388490/unicode-characters-in-windows-command-line-how -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
How to get the MySQL Command-Line Tool to display Unicode properly
I use a Python program to write text containing Unicode characters to a MySQL database. As an example, two of the characters are u'\u2640' a symbol for Venus or female u'\u2642' a symbol for Mars or male I use utf8mb4 for virtually all character sets involved with MySQL. Here is an excerpt from /etc/mysql/my.cnf [client] default-character-set=utf8mb4 [mysql] default-character-set=utf8mb4 [mysqld] character-set-server =utf8mb4 I'm not sure that the [client] option does anything, but it doesn't seem to hurt. In addition, all tables are created with these parameters: ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci In all respects except one, the treatment of Unicode works just fine. I can write Unicode to database tables, read it, display it, etc., with no problems. The exception is mysql, the MySQL Command-Line Tool. When I execute a SELECT statement to see rows in a table containing the Venus and Mars Unicode characters, here is what I see on the screen: | Venus | ♀ | | Mars | ♂ | What I want to see is this | Venus | ♀ | | Mars | ♂ | I get the same behavior with the MySQL Command Line Tool when I run it on Windows, Mac OS X, and Ubuntu, so I'm pretty sure the problem has to do with mysql itself. Any ideas about how to get the MySQL Command-Line Tool to display Unicode properly? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Multiple sql lines in command line tool
I am running the command line in two modes. In one I pipe to it in an application with arguments -s -n -N -r; and I can send multiple queries in one write to the mysql command line too. I then run mysql command tool in the linux shell with the same parameters and I cannot submit multiple queries on one line. I wonder what the catch is. I have gotten the embedded application running, instead of pipes. And I evidently lose the ability to submitt multiple sql statements. I wonder how I can obtain that capability back. Matt Young -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Problems with ORDER BY from C API (works from command-line tool mysql.exe)
Hi! This SQL works perfect when running the command line tool mysql.exe SELECT exe, sum(duration) FROM data GROUP BY exe ORDER BY 2 BUT when running from the C API, the ORDER BY part doesn't seem active, why? Please help. /Christer - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Problems with ORDER BY from C API (works from command-line tool mysql.exe)
Hi, and thanks for the response, but unfortunately the same problem with both below SELECT exe, sum(duration) FROM data GROUP BY exe ORDER BY 2 DESC; SELECT exe, sum(duration) AS s FROM data GROUP exe BY ORDER BY s DESC; Works from mysql.exe but not from C API. /Christer -Original Message- From: Joseph Bueno [mailto:joseph.bueno;trader.com] Sent: den 4 november 2002 11:57 To: Christer Holmström (at Home) Cc: [EMAIL PROTECTED] Subject: Re: Problems with ORDER BY from C API (works from command-line tool mysql.exe) Christer Holmström (at Home) wrote: Hi! This SQL works perfect when running the command line tool mysql.exe SELECT exe, sum(duration) FROM data GROUP BY exe ORDER BY 2 BUT when running from the C API, the ORDER BY part doesn't seem active, why? Please help. /Christer Hi, What do expect with ORDER BY 2 ? If you want to arder by sum(duration) you should use: SELECT exe, sum(duration) AS s FROM data GROUP BY exe ORDER BY s Hope this helps -- Joseph Bueno - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Problems with ORDER BY from C API (works from command-line tool mysql.exe)
The code works in that sence that I get resultsets, the only thing that does not work is the ORDER BY option for the SELECT statement. The resultset is ordered by the exe column instead. Should I run MyODBC instead? Is the sourcecode for mysql.exe available? Is there any miss-usage of mysql_query, mysql_store_result etc? /Christer void StatisticsToday() { charszSQL[1024]; MYSQL_RES* res;// Resultset MYSQL_ROW row;// Row int i, j; // Tried both below strcpy(szSQL, SELECT DISTINCT exe, sum(duration) AS s FROM data GROUP BY exe ORDER BY s DESC); strcpy(szSQL, SELECT DISTINCT exe, sum(duration) FROM data GROUP BY exe ORDER BY 2 DESC;); if (!mysql_query( myData, szSQL)) { res = mysql_store_result( myData ) ; i = (int) mysql_num_rows( res ) ; while ( row = mysql_fetch_row( res ) ) { j=mysql_num_fields( res ); sprintf(szId, %s %s, row[0], row[1]); } mysql_free_result( res ) ; } else { printf( Couldn't execute %s on the server !\n, szSQL ) ; } } -Original Message- From: gerald_clark [mailto:gerald_clark;suppliersystems.com] Sent: den 4 november 2002 15:51 To: Christer Holmström (at Home) Cc: 'Joseph Bueno'; [EMAIL PROTECTED] Subject: Re: Problems with ORDER BY from C API (works from command-line tool mysql.exe) Then I would suggest you check your C code. The program 'mysql' uses the C API. Christer Holmström (at Home) wrote: Hi, and thanks for the response, but unfortunately the same problem with both below SELECT exe, sum(duration) FROM data GROUP BY exe ORDER BY 2 DESC; SELECT exe, sum(duration) AS s FROM data GROUP exe BY ORDER BY s DESC; Works from mysql.exe but not from C API. /Christer -Original Message- From: Joseph Bueno [mailto:joseph.bueno;trader.com] Sent: den 4 november 2002 11:57 To: Christer Holmström (at Home) Cc: [EMAIL PROTECTED] Subject: Re: Problems with ORDER BY from C API (works from command-line tool mysql.exe) Christer Holmström (at Home) wrote: Hi! This SQL works perfect when running the command line tool mysql.exe SELECT exe, sum(duration) FROM data GROUP BY exe ORDER BY 2 BUT when running from the C API, the ORDER BY part doesn't seem active, why? Please help. /Christer Hi, What do expect with ORDER BY 2 ? If you want to arder by sum(duration) you should use: SELECT exe, sum(duration) AS s FROM data GROUP BY exe ORDER BY s Hope this helps - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Problems with ORDER BY from C API (works from command-line tool mysql.exe)
Hmm, sorry, but it works! Found the problem, it was all my misstake. It was my win32 dialoglist that was sorted :-( Thanks! /Christer -Original Message- From: Christer Holmström (at Home) [mailto:Christer.Holmstrom;home.se] Sent: den 4 november 2002 15:59 To: 'gerald_clark' Cc: 'Joseph Bueno'; [EMAIL PROTECTED] Subject: RE: Problems with ORDER BY from C API (works from command-line tool mysql.exe) The code works in that sence that I get resultsets, the only thing that does not work is the ORDER BY option for the SELECT statement. The resultset is ordered by the exe column instead. Should I run MyODBC instead? Is the sourcecode for mysql.exe available? Is there any miss-usage of mysql_query, mysql_store_result etc? /Christer void StatisticsToday() { charszSQL[1024]; MYSQL_RES* res;// Resultset MYSQL_ROW row;// Row int i, j; // Tried both below strcpy(szSQL, SELECT DISTINCT exe, sum(duration) AS s FROM data GROUP BY exe ORDER BY s DESC); strcpy(szSQL, SELECT DISTINCT exe, sum(duration) FROM data GROUP BY exe ORDER BY 2 DESC;); if (!mysql_query( myData, szSQL)) { res = mysql_store_result( myData ) ; i = (int) mysql_num_rows( res ) ; while ( row = mysql_fetch_row( res ) ) { j=mysql_num_fields( res ); sprintf(szId, %s %s, row[0], row[1]); } mysql_free_result( res ) ; } else { printf( Couldn't execute %s on the server !\n, szSQL ) ; } } -Original Message- From: gerald_clark [mailto:gerald_clark;suppliersystems.com] Sent: den 4 november 2002 15:51 To: Christer Holmström (at Home) Cc: 'Joseph Bueno'; [EMAIL PROTECTED] Subject: Re: Problems with ORDER BY from C API (works from command-line tool mysql.exe) Then I would suggest you check your C code. The program 'mysql' uses the C API. Christer Holmström (at Home) wrote: Hi, and thanks for the response, but unfortunately the same problem with both below SELECT exe, sum(duration) FROM data GROUP BY exe ORDER BY 2 DESC; SELECT exe, sum(duration) AS s FROM data GROUP exe BY ORDER BY s DESC; Works from mysql.exe but not from C API. /Christer -Original Message- From: Joseph Bueno [mailto:joseph.bueno;trader.com] Sent: den 4 november 2002 11:57 To: Christer Holmström (at Home) Cc: [EMAIL PROTECTED] Subject: Re: Problems with ORDER BY from C API (works from command-line tool mysql.exe) Christer Holmström (at Home) wrote: Hi! This SQL works perfect when running the command line tool mysql.exe SELECT exe, sum(duration) FROM data GROUP BY exe ORDER BY 2 BUT when running from the C API, the ORDER BY part doesn't seem active, why? Please help. /Christer Hi, What do expect with ORDER BY 2 ? If you want to arder by sum(duration) you should use: SELECT exe, sum(duration) AS s FROM data GROUP BY exe ORDER BY s Hope this helps - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Problems with ORDER BY from C API (works from command-line tool mysql.exe)
Hi. On Mon 2002-11-04 at 11:56:40 +0100, [EMAIL PROTECTED] wrote: Christer Holmström (at Home) wrote: [...] This SQL works perfect when running the command line tool mysql.exe SELECT exe, sum(duration) FROM data GROUP BY exe ORDER BY 2 BUT when running from the C API, the ORDER BY part doesn't seem active, why? [...] What do expect with ORDER BY 2 ? That is a shortcut for what you explain below. If you want to arder by sum(duration) you should use: SELECT exe, sum(duration) AS s FROM data GROUP BY exe ORDER BY s See http://www.mysql.com/doc/en/SELECT.html (look for column position) Regards, Benjamin. -- [EMAIL PROTECTED] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Problems with ORDER BY from C API (works from command-line tool mysql.exe)
At 11:56 +0100 11/4/02, Joseph Bueno wrote: Christer Holmström (at Home) wrote: Hi! This SQL works perfect when running the command line tool mysql.exe SELECT exe, sum(duration) FROM data GROUP BY exe ORDER BY 2 BUT when running from the C API, the ORDER BY part doesn't seem active, why? Please help. /Christer Hi, What do expect with ORDER BY 2 ? If you want to arder by sum(duration) you should use: SELECT exe, sum(duration) AS s FROM data GROUP BY exe ORDER BY s How will that be different than ORDER BY 2, which sorts using the second column? Your alternate query does the same thing. Hope this helps -- Joseph Bueno - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Problems with ORDER BY from C API (works from command-line tool mysql.exe)
Yes, but the problem was in the listbox with auto-sort ;-) /Chris -Original Message- From: Paul DuBois [mailto:paul;snake.net] Sent: den 5 november 2002 00:20 To: Joseph Bueno; Christer Holmström (at Home) Cc: [EMAIL PROTECTED] Subject: Re: Problems with ORDER BY from C API (works from command-line tool mysql.exe) At 11:56 +0100 11/4/02, Joseph Bueno wrote: Christer Holmström (at Home) wrote: Hi! This SQL works perfect when running the command line tool mysql.exe SELECT exe, sum(duration) FROM data GROUP BY exe ORDER BY 2 BUT when running from the C API, the ORDER BY part doesn't seem active, why? Please help. /Christer Hi, What do expect with ORDER BY 2 ? If you want to arder by sum(duration) you should use: SELECT exe, sum(duration) AS s FROM data GROUP BY exe ORDER BY s How will that be different than ORDER BY 2, which sorts using the second column? Your alternate query does the same thing. Hope this helps -- Joseph Bueno - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Command Line Tool
I'm having a bit of a problem trying to get MySQL version 4.0.1-alpha-max-nt binary version to accept The Command - Line Tool to run a script to create a table. My operating system is Windows 2000 Professional. I can connect with MyODBC-3.51.02.exe without any problem and run successful queries. I am using the model example from chapter 4.8.2 The Command-line Tool. I am trying to create a table in the test database example in MySQL I am logged in correctly and using the test database that is created when MySQL is installed as best as I can tell by reviewing the command line mysql status. I am issuing the command line statement at the mysql prompt: mysql test create.sql; I get the following mysql error: ERROR 1064 You have an error in your SQL near 'mysql test create1.sql' at line 1 Basically, I have a script named create1.sql with the following syntax: CREATE TABLE Names ( NameID int(11) NOT NULL auto_increment, FirstName varchar(30) NOT NULL default '', LastName varchar(30) NOT NULL default '', PRIMARY KEY (NameID), KEY idx_Names_LastFirst (LastName,FirstName) ) TYPE=MyISAM; INSERT INTO Names VALUES (1,'Morton','Salter'); INSERT INTO Names VALUES (2,'Jimi','Filmore'); INSERT INTO Names VALUES (3,'Eustace','Shoe'); INSERT INTO Names VALUES (4,'Archy','Roche'); INSERT INTO Names VALUES (5,'Catherine','LaGrande'); Anyone got any suggestions? Thanks In Advance Lenny R. Sorey FatDot.com [EMAIL PROTECTED] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Command Line Tool
At 10:29 -0600 4/5/02, Lenny Sorey wrote: I'm having a bit of a problem trying to get MySQL version 4.0.1-alpha-max-nt binary version to accept The Command - Line Tool to run a script to create a table. My operating system is Windows 2000 Professional. I can connect with MyODBC-3.51.02.exe without any problem and run successful queries. I am using the model example from chapter 4.8.2 The Command-line Tool. I am trying to create a table in the test database example in MySQL I am logged in correctly and using the test database that is created when MySQL is installed as best as I can tell by reviewing the command line mysql status. I am issuing the command line statement at the mysql prompt: mysql test create.sql; That's your problem. Issue that command from the DOS prompt. I get the following mysql error: ERROR 1064 You have an error in your SQL near 'mysql test create1.sql' at line 1 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Command Line Tool
At 10:43 -0600 4/5/02, Paul DuBois wrote: At 10:29 -0600 4/5/02, Lenny Sorey wrote: I'm having a bit of a problem trying to get MySQL version 4.0.1-alpha-max-nt binary version to accept The Command - Line Tool to run a script to create a table. My operating system is Windows 2000 Professional. I can connect with MyODBC-3.51.02.exe without any problem and run successful queries. I am using the model example from chapter 4.8.2 The Command-line Tool. I am trying to create a table in the test database example in MySQL I am logged in correctly and using the test database that is created when MySQL is installed as best as I can tell by reviewing the command line mysql status. I am issuing the command line statement at the mysql prompt: mysql test create.sql; That's your problem. Issue that command from the DOS prompt. Having just been castigated in private mail for being snippy in my response, I'll amend that to: That's the problem. Issue that command from the DOS prompt. I get the following mysql error: ERROR 1064 You have an error in your SQL near 'mysql test create1.sql' at line 1 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Fw: Command Line Tool
No problem Paul, I understood what you meant. Lenny Sorey - Original Message - From: Paul DuBois [EMAIL PROTECTED] To: Lenny Sorey [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, April 05, 2002 11:17 AM Subject: Re: Command Line Tool At 10:43 -0600 4/5/02, Paul DuBois wrote: At 10:29 -0600 4/5/02, Lenny Sorey wrote: I'm having a bit of a problem trying to get MySQL version 4.0.1-alpha-max-nt binary version to accept The Command - Line Tool to run a script to create a table. My operating system is Windows 2000 Professional. I can connect with MyODBC-3.51.02.exe without any problem and run successful queries. I am using the model example from chapter 4.8.2 The Command-line Tool. I am trying to create a table in the test database example in MySQL I am logged in correctly and using the test database that is created when MySQL is installed as best as I can tell by reviewing the command line mysql status. I am issuing the command line statement at the mysql prompt: mysql test create.sql; That's your problem. Issue that command from the DOS prompt. Having just been castigated in private mail for being snippy in my response, I'll amend that to: That's the problem. Issue that command from the DOS prompt. I get the following mysql error: ERROR 1064 You have an error in your SQL near 'mysql test create1.sql' at line 1 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Command Line Tool
Lenny, You might find it easier to use a GUI like MySQL Front from http://www.anse.de/mysqlfront/. It will save you a great deal of time. Just enter (or copy and paste) the SQL into their query window and press a button. Editing your errors are also a lot easier. It is free or you can make a $15 donation to the author if you like it. Brent _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
How to get my shell readline settings in mysql command line tool?
Hello all, I use the bash shell and the vi editing mode (set -o vi) in my .inputrc. On one of my boxes, I managed to get the command line tool (mysql) to honour that setting. However, I have forgotten how I did that. Does anyone know how to do that? - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php