Bug #9378 | Accessing data from local and remote application | ||
---|---|---|---|
Submitted: | 24 Mar 2005 9:46 | Modified: | 24 Mar 2005 16:57 |
Reporter: | Carmelo R. Cartiere | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | MySQL Server | Severity: | S1 (Critical) |
Version: | 4.0.14 | OS: | Windows (Win2k/Win2003 Server) |
Assigned to: | CPU Architecture: | Any |
[24 Mar 2005 9:46]
Carmelo R. Cartiere
[24 Mar 2005 12:07]
MySQL Verification Team
Could you please provide a complete test case (code + table schema + dump). Thanks in advance.
[24 Mar 2005 12:28]
Carmelo R. Cartiere
Uploaded the code and table schema. Hope this can help.
[24 Mar 2005 13:00]
Carmelo R. Cartiere
Don't know how to provide a dump. Further, the issue is not repeatable on my side (i work on the remote session that is fine working and have the database on the Win2003 server at 800 miles) and when the error is occurring there are no return codes. If I can provide you with some other specifics just ask.
[24 Mar 2005 13:08]
MySQL Verification Team
You can create a dump of your table using the client tool called mysqldump i.e: c:\mysql\bin>mysqldump -uroot mydb mytbl > mydump.sql c:\mysql\bin>type mydump.sql -- MySQL dump 10.9 -- -- Host: localhost Database: mydb -- ------------------------------------------------------ -- Server version 4.1.10-nt /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `mytbl` -- DROP TABLE IF EXISTS `mytbl`; CREATE TABLE `mytbl` ( `id` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `mytbl` -- /*!40000 ALTER TABLE `mytbl` DISABLE KEYS */; LOCK TABLES `mytbl` WRITE; INSERT INTO `mytbl` VALUES (1),(2); UNLOCK TABLES; /*!40000 ALTER TABLE `mytbl` ENABLE KEYS */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
[24 Mar 2005 13:23]
Carmelo R. Cartiere
table dump
Attachment: mydump.sql (text/plain), 12.45 KiB.
[24 Mar 2005 13:24]
Carmelo R. Cartiere
Great. Added the dump file. Thank you for supporting.
[24 Mar 2005 16:15]
Carmelo R. Cartiere
Think I got the bug. Carefully reviewing the code that I sent to you I noticed that while fetching the record with mysql_fetch_row, I used a global variable instead of the local one which had the returning address from the SELECT statement (OpenMySQLTable function). Sorry for bothering you though I enjoyed your help and it was precious to me for keeping me on the part of code I sent to you. Thanks a lot.
[24 Mar 2005 16:57]
MySQL Verification Team
I wasn't able to repeat. Using the mysql client: c:\mysql\bin>mysql -uroot bug9378 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 11 to server version: 4.0.23-nt Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> select max(nr) from ordini where modello = 'PERA'; +---------+ | max(nr) | +---------+ | 96 | +---------+ 1 row in set (0.01 sec) and doing the same with the C application at the bottom: C:\temp>bug9378 Connected with the Server: 4.0.23-nt Query: SELECT MAX(nr) FROM ordini WHERE modello = 'PERA' Number of records found: 1 Record #1:- Fld #1 (MAX(nr)): 96 ========================================== #include <stdio.h> #include <string.h> #include <my_global.h> #include <m_ctype.h> #include <m_string.h> #include <mysql.h> #define MyQuery "SELECT MAX(nr) FROM ordini WHERE modello = 'PERA'" void main() { MYSQL *MySQL; MYSQL_RES * res ; int i, j, k, l, x ; MYSQL_FIELD * fd ; MYSQL_ROW row ; char aszFlds[ 25 ][ 25 ] ; if ( (MySQL = mysql_init((MYSQL*) 0)) && mysql_real_connect( MySQL,"localhost","root", "", "bug9378", 0, NULL, 0 )) printf("Connected with the Server: %s\n", mysql_get_server_info(MySQL)); else { printf("Failed to connect with the server\n"); mysql_close( MySQL ); return; } if ( ! mysql_query( MySQL, MyQuery ) ) { res = mysql_store_result( MySQL ) ; i = (int) mysql_num_rows( res ) ; l = 1 ; printf( "Query: %s\nNumber of records found: %ld\n", MyQuery, i ) ; for ( x = 0 ; fd = mysql_fetch_field( res ) ; x++ ) strcpy( aszFlds[ x ], fd->name ) ; while ( row = mysql_fetch_row( res ) ) { j = mysql_num_fields( res ) ; printf( "Record #%ld:-\n", l++ ) ; for ( k = 0 ; k < j ; k++ ) printf( " Fld #%d (%s): %s\n", k + 1, aszFlds[ k ], (((row[k]==NULL)||(!strlen(row[k])))?"NULL":row[k])) ; puts( "==========================================\n" ) ; } mysql_free_result( res ) ; } else printf( "Sorry Query Failed\n" ) ; mysql_close(MySQL); return; }