Commit 3c6ca775 authored by unknown's avatar unknown
Browse files

Merge bk-internal:/home/bk/mysql-5.1-maint

into  siva.hindu.god:/usr/home/tim/m/bk/tmp/51-mrg50


sql/item_func.h:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
parents d3da7356 3f2f1c2b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -22,7 +22,8 @@ noinst_HEADERS = dbug_long.h
libdbug_a_SOURCES =     dbug.c sanity.c
EXTRA_DIST =            CMakeLists.txt example1.c example2.c example3.c \
                        user.r monty.doc dbug_add_tags.pl \
                        my_main.c main.c factorial.c dbug_analyze.c
                        my_main.c main.c factorial.c dbug_analyze.c \
						CMakeLists.txt
NROFF_INC =             example1.r example2.r example3.r main.r \
                        factorial.r output1.r output2.r output3.r \
                        output4.r output5.r
+4 −1
Original line number Diff line number Diff line
@@ -26,6 +26,9 @@
#define USERNAME_LENGTH 16
#define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5
#define SYSTEM_CHARSET_MBMAXLEN 3
#define NAME_BYTE_LEN   NAME_LEN*SYSTEM_CHARSET_MBMAXLEN
#define USERNAME_BYTE_LENGTH USERNAME_LENGTH*SYSTEM_CHARSET_MBMAXLEN

/*
  USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain
@@ -33,7 +36,7 @@
  MySQL standard format:
  user_name_part@host_name_part\0
*/
#define USER_HOST_BUFF_SIZE HOSTNAME_LENGTH + USERNAME_LENGTH + 2
#define USER_HOST_BUFF_SIZE HOSTNAME_LENGTH + USERNAME_BYTE_LENGTH + 2

#define LOCAL_HOST	"localhost"
#define LOCAL_HOST_NAMEDPIPE "."
+138 −285
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),
@@ -124,199 +75,101 @@ 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 ;



}
+23 −0
Original line number Diff line number Diff line
# Test if the engine does autocommit in LOAD DATA INFILE, or not
# (NDB wants to do, others don't).

eval SET SESSION STORAGE_ENGINE = $engine_type;

--disable_warnings
drop table if exists t1;
--enable_warnings

# NDB does not support the create option 'Binlog of table with BLOB attribute and no PK'
# So use a dummy PK here.
create table t1 (id int unsigned not null auto_increment primary key, a text, b text);
start transaction;
load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
commit;
select count(*) from t1;
truncate table t1;
start transaction;
load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
rollback;
select count(*) from t1;

drop table t1;
+13 −0
Original line number Diff line number Diff line
@@ -1340,6 +1340,19 @@ select a from t1 group by a;
a
e
drop table t1;
set names utf8;
grant select on test.* to юзер_юзер@localhost;
user()
юзер_юзер@localhost
revoke all on test.* from юзер_юзер@localhost;
drop user юзер_юзер@localhost;
create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
use имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
select database();
database()
имя_базы_в_кодировке_утф8_длиной_больше_чем_45
drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
use test;
CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
SELECT id FROM t1;
Loading