Commit c73df225 authored by unknown's avatar unknown
Browse files

Merge 192.168.0.10:mysql/mysql-5.1

into  shellback.:C:/mysql/my51-bug17368


sql/ha_partition.cc:
  Auto merged
parents 08dd4932 ea28e412
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -3,6 +3,9 @@ PROJECT(MySql)
# This reads user configuration, generated by configure.js.
INCLUDE(win/configure.data)

# Hardcode support for CSV storage engine
SET(WITH_CSV_STORAGE_ENGINE TRUE)

CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
               ${CMAKE_SOURCE_DIR}/include/mysql_version.h @ONLY)

@@ -18,6 +21,12 @@ IF(WITH_BLACKHOLE_STORAGE_ENGINE)
  SET (mysql_se_decls "${mysql_se_decls}, blackhole_hton")
  SET (mysql_se_ha_src ${mysql_se_ha_src} "../sql/ha_blackhole.cc")
ENDIF(WITH_BLACKHOLE_STORAGE_ENGINE)
IF(WITH_CSV_STORAGE_ENGINE)
  ADD_DEFINITIONS(-D WITH_CSV_STORAGE_ENGINE)
  SET (mysql_se_htons "${mysql_se_htons}, &tina_hton")
  SET (mysql_se_decls "${mysql_se_decls}, tina_hton")
  SET (mysql_se_ha_src ${mysql_se_ha_src} "../storage/csv/ha_tina.cc")
ENDIF(WITH_CSV_STORAGE_ENGINE)
IF(WITH_EXAMPLE_STORAGE_ENGINE)
  ADD_DEFINITIONS(-D WITH_EXAMPLE_STORAGE_ENGINE)
  SET (mysql_se_htons "${mysql_se_htons}, &example_hton")
+147 −0
Original line number Diff line number Diff line
/*C4*/

/****************************************************************/

/*	Author:	Jethro Wright, III	TS :  3/ 4/1998  9:15	*/

/*	Date:	02/18/1998					*/

/*	mytest.c :  do some testing of the libmySQL.DLL....	*/

/*								*/

/*	History:						*/

/*		02/18/1998  jw3  also sprach zarathustra....	*/

/****************************************************************/





#include        <windows.h>

#include	<stdio.h>

#include	<string.h>



#include	<mysql.h>



#define		DEFALT_SQL_STMT	"SELECT * FROM db"

#ifndef offsetof

#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)

#endif





/********************************************************

**

**		main  :-

**

********************************************************/



int

main( int argc, char * argv[] )

{



  char		szSQL[ 200 ], aszFlds[ 25 ][ 25 ], szDB[ 50 ] ;

  const  char   *pszT;
  int			i, j, k, l, x ;

  MYSQL		* myData ;

  MYSQL_RES	* res ;

  MYSQL_FIELD	* fd ;

  MYSQL_ROW	row ;



  //....just curious....

  printf( "sizeof( MYSQL ) == %d\n", (int) sizeof( MYSQL ) ) ;
  if ( argc == 2 )

    {

      strcpy( szDB, argv[ 1 ] ) ;

      strcpy( szSQL, DEFALT_SQL_STMT ) ;

      if (!strcmp(szDB,"--debug"))

      {

	strcpy( szDB, "mysql" ) ;

	printf("Some mysql struct information (size and offset):\n");

	printf("net:\t%3d %3d\n",(int) sizeof(myData->net),
	       (int) offsetof(MYSQL,net));
	printf("host:\t%3d %3d\n",(int) sizeof(myData->host),
@@ -75,101 +124,199 @@ main( int argc, char * argv[] )
	printf("options:\t%3d %3d\n",(int) sizeof(myData->options),
	       (int) offsetof(MYSQL,options));
	puts("");

      }

    }		

  else if ( argc > 2 ) {

    strcpy( szDB, argv[ 1 ] ) ;

    strcpy( szSQL, argv[ 2 ] ) ;

  }

  else {

    strcpy( szDB, "mysql" ) ;

    strcpy( szSQL, DEFALT_SQL_STMT ) ;

  }

  //....

		  

  if ( (myData = mysql_init((MYSQL*) 0)) && 

       mysql_real_connect( myData, NULL, NULL, NULL, NULL, MYSQL_PORT,

			   NULL, 0 ) )

    {

      myData->reconnect= 1;
      if ( mysql_select_db( myData, szDB ) < 0 ) {

	printf( "Can't select the %s database !\n", szDB ) ;

	mysql_close( myData ) ;

	return 2 ;

      }

    }

  else {

    printf( "Can't connect to the mysql server on port %d !\n",

	    MYSQL_PORT ) ;

    mysql_close( myData ) ;

    return 1 ;

  }

  //....

  if ( ! mysql_query( myData, szSQL ) ) {

    res = mysql_store_result( myData ) ;

    i = (int) mysql_num_rows( res ) ; l = 1 ;

    printf( "Query:  %s\nNumber of records found:  %ld\n", szSQL, i ) ;

    //....we can get the field-specific characteristics here....

    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( "Couldn't execute %s on the server !\n", szSQL ) ;

  //....

  puts( "====  Diagnostic info  ====" ) ;

  pszT = mysql_get_client_info() ;

  printf( "Client info: %s\n", pszT ) ;

  //....

  pszT = mysql_get_host_info( myData ) ;

  printf( "Host info: %s\n", pszT ) ;

  //....

  pszT = mysql_get_server_info( myData ) ;

  printf( "Server info: %s\n", pszT ) ;

  //....

  res = mysql_list_processes( myData ) ; l = 1 ;

  if (res)

    {

      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( "Process #%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" ) ;

      }

    }

  else

    {

      printf("Got error %s when retreiving processlist\n",mysql_error(myData));

    }

  //....

  res = mysql_list_tables( myData, "%" ) ; l = 1 ;

  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( "Table #%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" ) ;

  }

  //....

  pszT = mysql_stat( myData ) ;

  puts( pszT ) ;

  //....

  mysql_close( myData ) ;

  return 0 ;



}
+0 −2
Original line number Diff line number Diff line
@@ -274,7 +274,6 @@ static int emb_stmt_execute(MYSQL_STMT *stmt)
{
  DBUG_ENTER("emb_stmt_execute");
  char header[5];
  MYSQL_DATA *res;
  THD *thd;

  int4store(header, stmt->stmt_id);
@@ -1033,7 +1032,6 @@ void Protocol_simple::prepare_for_resend()
  data->embedded_info->prev_ptr= &cur->next;
  next_field=cur->data;
  next_mysql_field= data->embedded_info->fields_list;
err:
  DBUG_VOID_RETURN;
}

+30 −0
Original line number Diff line number Diff line
@@ -5085,6 +5085,36 @@ Table Op Msg_type Msg_text
test.test_repair_table5	repair	status	OK
SELECT * FROM test_repair_table5;
num	magic_no	company_name	founded
INSERT INTO test_repair_table5 VALUES (1, 102, "CORRECT", 1876);
SELECT * FROM test_repair_table5;
num	magic_no	company_name	founded
1	0102	CORRECT	1876
FLUSH TABLES;
CHECK TABLE test_repair_table5;
Table	Op	Msg_type	Msg_text
test.test_repair_table5	check	error	Corrupt
REPAIR TABLE test_repair_table5;
Table	Op	Msg_type	Msg_text
test.test_repair_table5	repair	status	OK
SELECT * FROM test_repair_table5;
num	magic_no	company_name	founded
1	0102	CORRECT	1876
INSERT INTO test_repair_table5 VALUES (1, 102, "CORRECT2", 1876);
SELECT * FROM test_repair_table5;
num	magic_no	company_name	founded
1	0102	CORRECT	1876
1	0102	CORRECT2	1876
FLUSH TABLES;
CHECK TABLE test_repair_table5;
Table	Op	Msg_type	Msg_text
test.test_repair_table5	check	error	Corrupt
REPAIR TABLE test_repair_table5;
Table	Op	Msg_type	Msg_text
test.test_repair_table5	repair	status	OK
SELECT * FROM test_repair_table5;
num	magic_no	company_name	founded
1	0102	CORRECT	1876
1	0102	CORRECT2	1876
DROP TABLE test_repair_table5;
create table t1 (a int) engine=csv;
insert t1 values (1);
+22 −1
Original line number Diff line number Diff line
@@ -1477,8 +1477,29 @@ CREATE TABLE test_repair_table5 (
CHECK TABLE test_repair_table5;
REPAIR TABLE test_repair_table5;
SELECT * FROM test_repair_table5;
DROP TABLE test_repair_table5;
INSERT INTO test_repair_table5 VALUES (1, 102, "CORRECT", 1876);
SELECT * FROM test_repair_table5;

# Corrupt a table -- put a row with wrong # of columns at end of file
--exec perl -e 'print "\"1\",\"101\",\"IBM\"\n";' >> $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV

FLUSH TABLES;
CHECK TABLE test_repair_table5;
REPAIR TABLE test_repair_table5;
# The correct record inserted should still be in the file
SELECT * FROM test_repair_table5;
INSERT INTO test_repair_table5 VALUES (1, 102, "CORRECT2", 1876);
SELECT * FROM test_repair_table5;

# Corrupt table again -- put a row with wrong # of columns at end of file
--exec perl -e 'print "\"1\",\"101\",\"IBM\"\n";' >> $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV

FLUSH TABLES;
CHECK TABLE test_repair_table5;
REPAIR TABLE test_repair_table5;
# The two correct records inserted should still be in the file
SELECT * FROM test_repair_table5;
DROP TABLE test_repair_table5;

#
# BUG#13406 - incorrect amount of "records deleted"
Loading