summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/log.cc5
-rw-r--r--sql/sql_cache.cc4
-rw-r--r--sql/sql_show.cc55
3 files changed, 32 insertions, 32 deletions
diff --git a/sql/log.cc b/sql/log.cc
index 94cd553bfce..1f12bcacf6c 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -149,7 +149,8 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
fn_format(index_file_name, name, mysql_data_home, ".index", 6);
db[0]=0;
- file=my_fopen(log_file_name,O_APPEND | O_WRONLY,MYF(MY_WME | ME_WAITTANG));
+ file=my_fopen(log_file_name,O_APPEND | O_WRONLY | O_BINARY,
+ MYF(MY_WME | ME_WAITTANG));
if (!file)
{
my_free(name,MYF(0));
@@ -188,7 +189,7 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
{
Start_log_event s;
if(!index_file &&
- !(index_file = my_fopen(index_file_name,O_APPEND | O_RDWR,
+ !(index_file = my_fopen(index_file_name,O_APPEND | O_BINARY | O_RDWR,
MYF(MY_WME))))
{
my_fclose(file,MYF(MY_WME));
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 78053d0d3e3..09d436c0c9c 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -19,10 +19,10 @@
#include <my_dir.h>
#include <hash.h>
-#define SQL_CACHE_LENGTH 300
+#define SQL_CACHE_LENGTH 30 // 300 crashes apple gcc.
HASH sql_cache;
-LEX lex_array_static[SQL_CACHE_LENGTH];
+static LEX lex_array_static[SQL_CACHE_LENGTH];
LEX * lex_array = lex_array_static;
int last_lex_array_item = SQL_CACHE_LENGTH - 1;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index ea6e09f6cb5..83a53467426 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -476,6 +476,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
DBUG_PRINT("enter",("db: %s table: %s",table_list->db,
table_list->real_name));
+ /* Only one table for now */
if (!(table = open_ltable(thd, table_list, TL_UNLOCK)))
{
send_error(&thd->net);
@@ -490,34 +491,32 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
DBUG_RETURN(1);
String *packet = &thd->packet;
- for(;table; table = table->next)
- {
- packet->length(0);
- net_store_data(packet, table->table_name);
- // a hack - we need to reserve some space for the length before
- // we know what it is - let's assume that the length of create table
- // statement will fit into 3 bytes ( 16 MB max :-) )
- ulong store_len_offset = packet->length();
- packet->length(store_len_offset + 4);
- if(store_create_info(thd, table, packet))
- DBUG_RETURN(-1);
- ulong create_len = packet->length() - store_len_offset - 4;
- if(create_len > 0x00ffffff) // better readable in HEX ...
- DBUG_RETURN(1); // just in case somebody manages to create a table
- // with *that* much stuff in the definition
-
- // now we have to store the length in three bytes, even if it would fit
- // into fewer, so we cannot use net_store_data() anymore,
- // and do it ourselves
- char* p = (char*)packet->ptr() + store_len_offset;
- *p++ = (char) 253; // The client the length is stored using 3-bytes
- int3store(p, create_len);
-
- // now we are in business :-)
- if(my_net_write(&thd->net, (char*)packet->ptr(), packet->length()))
- DBUG_RETURN(1);
- }
-
+ {
+ packet->length(0);
+ net_store_data(packet, table->table_name);
+ // a hack - we need to reserve some space for the length before
+ // we know what it is - let's assume that the length of create table
+ // statement will fit into 3 bytes ( 16 MB max :-) )
+ ulong store_len_offset = packet->length();
+ packet->length(store_len_offset + 4);
+ if (store_create_info(thd, table, packet))
+ DBUG_RETURN(-1);
+ ulong create_len = packet->length() - store_len_offset - 4;
+ if (create_len > 0x00ffffff) // better readable in HEX ...
+ DBUG_RETURN(1); // just in case somebody manages to create a table
+ // with *that* much stuff in the definition
+
+ // now we have to store the length in three bytes, even if it would fit
+ // into fewer, so we cannot use net_store_data() anymore,
+ // and do it ourselves
+ char* p = (char*)packet->ptr() + store_len_offset;
+ *p++ = (char) 253; // The client the length is stored using 3-bytes
+ int3store(p, create_len);
+
+ // now we are in business :-)
+ if (my_net_write(&thd->net, (char*)packet->ptr(), packet->length()))
+ DBUG_RETURN(1);
+ }
send_eof(&thd->net);
DBUG_RETURN(0);
}