aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-04-09 16:37:31 +0000
committerrowanbeentje <rowan@beent.je>2012-04-09 16:37:31 +0000
commit761ee77727eb18e0ed6980ea98ea723cb8b3e817 (patch)
treeb3090244ce5c62b31464e7d3dc1c4f370e9f62e9
parent535ae6f2b8313ea6d5ae2e878dcd17d369807079 (diff)
downloadsequelpro-761ee77727eb18e0ed6980ea98ea723cb8b3e817.tar.gz
sequelpro-761ee77727eb18e0ed6980ea98ea723cb8b3e817.tar.bz2
sequelpro-761ee77727eb18e0ed6980ea98ea723cb8b3e817.zip
- Upgrade to the MySQL 5.5.22 client libraries, updating to a much more up-to-date codebase.
- Update the build-mysql-client.sh MySQL build script within SPMySQL.framework to allow it to easily build 5.5 client libraries - Fix reconnection within SPMySQL.framework after a connection is lost for MySQL servers < 5 when a query is cancelled by killing the connection
-rw-r--r--Frameworks/SPMySQLFramework/MySQL Client Libraries/include/my_alloc.h13
-rw-r--r--Frameworks/SPMySQLFramework/MySQL Client Libraries/include/my_list.h6
-rw-r--r--Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql.h213
-rw-r--r--Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql_com.h82
-rw-r--r--Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql_embed.h31
-rw-r--r--Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql_version.h8
-rw-r--r--Frameworks/SPMySQLFramework/MySQL Client Libraries/include/typelib.h19
-rw-r--r--Frameworks/SPMySQLFramework/MySQL Client Libraries/lib/libmysqlclient.abin4477284 -> 12882756 bytes
-rw-r--r--Frameworks/SPMySQLFramework/SPMySQLFramework.xcodeproj/project.pbxproj4
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m7
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLFastStreamingResult.m5
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLStreamingResult.m6
-rwxr-xr-xFrameworks/SPMySQLFramework/build-mysql-client.sh175
13 files changed, 265 insertions, 304 deletions
diff --git a/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/my_alloc.h b/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/my_alloc.h
index 93b7438a..9e2ef541 100644
--- a/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/my_alloc.h
+++ b/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/my_alloc.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/*
Data structures for mysys/my_alloc.c (root memory allocator)
@@ -23,6 +23,10 @@
#define ALLOC_MAX_BLOCK_TO_DROP 4096
#define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct st_used_mem
{ /* struct for once_alloc (block) */
struct st_used_mem *next; /* Next block in use */
@@ -48,4 +52,9 @@ typedef struct st_mem_root
void (*error_handler)(void);
} MEM_ROOT;
+
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/my_list.h b/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/my_list.h
index 775b5658..294be663 100644
--- a/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/my_list.h
+++ b/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/my_list.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef _list_h_
#define _list_h_
@@ -37,7 +37,7 @@ extern int list_walk(LIST *,list_walk_action action,unsigned char * argument);
#define list_rest(a) ((a)->next)
#define list_push(a,b) (a)=list_cons((b),(a))
-#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((unsigned char *) old,MYF(MY_FAE)); }
+#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old); my_free(old); }
#ifdef __cplusplus
}
diff --git a/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql.h b/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql.h
index da477278..cff8c647 100644
--- a/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql.h
+++ b/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql.h
@@ -1,5 +1,4 @@
-/*
- Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -12,18 +11,16 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/*
This file defines the client API to MySQL and also the ABI of the
dynamically linked libmysqlclient.
- The ABI should never be changed in a released product of MySQL
+ The ABI should never be changed in a released product of MySQL,
thus you need to take great care when changing the file. In case
- the file is changed so the ABI is broken, you must also
- update the SHAREDLIB_MAJOR_VERSION in configure.in .
-
+ the file is changed so the ABI is broken, you must also update
+ the SHARED_LIB_MAJOR_VERSION in cmake/mysql_version.cmake
*/
#ifndef _mysql_h
@@ -83,16 +80,14 @@ extern char *mysql_unix_port;
#define CLIENT_NET_READ_TIMEOUT 365*24*3600 /* Timeout on read */
#define CLIENT_NET_WRITE_TIMEOUT 365*24*3600 /* Timeout on write */
-#ifdef __NETWARE__
-#pragma pack(push, 8) /* 8 byte alignment */
-#endif
-
#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG)
#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG)
#define IS_BLOB(n) ((n) & BLOB_FLAG)
-#define IS_NUM(t) ((t) <= MYSQL_TYPE_INT24 || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL)
-#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
-#define INTERNAL_NUM_FIELD(f) (((f)->type <= MYSQL_TYPE_INT24 && ((f)->type != MYSQL_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == MYSQL_TYPE_YEAR)
+/**
+ Returns true if the value is a number which does not need quotes for
+ the sql_lex.cc parser to parse correctly.
+*/
+#define IS_NUM(t) (((t) <= MYSQL_TYPE_INT24 && (t) != MYSQL_TYPE_TIMESTAMP) || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL)
#define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_STRING)
@@ -171,9 +166,15 @@ enum mysql_option
MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION,
MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH,
MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT,
- MYSQL_OPT_SSL_VERIFY_SERVER_CERT
+ MYSQL_OPT_SSL_VERIFY_SERVER_CERT, MYSQL_PLUGIN_DIR, MYSQL_DEFAULT_AUTH
};
+/**
+ @todo remove the "extension", move st_mysql_options completely
+ out of mysql.h
+*/
+struct st_mysql_options_extention;
+
struct st_mysql_options {
unsigned int connect_timeout, read_timeout, write_timeout;
unsigned int port, protocol;
@@ -190,24 +191,10 @@ struct st_mysql_options {
unsigned long max_allowed_packet;
my_bool use_ssl; /* if to use SSL or not */
my_bool compress,named_pipe;
- /*
- On connect, find out the replication role of the server, and
- establish connections to all the peers
- */
- my_bool rpl_probe;
- /*
- Each call to mysql_real_query() will parse it to tell if it is a read
- or a write, and direct it to the slave or the master
- */
- my_bool rpl_parse;
- /*
- If set, never read from a master, only from slave, when doing
- a read that is replication-aware
- */
- my_bool no_master_reads;
-#if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY)
- my_bool separate_thread;
-#endif
+ my_bool unused1;
+ my_bool unused2;
+ my_bool unused3;
+ my_bool unused4;
enum mysql_option methods_to_use;
char *client_ip;
/* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */
@@ -221,7 +208,7 @@ struct st_mysql_options {
void (*local_infile_end)(void *);
int (*local_infile_error)(void *, char *, unsigned int);
void *local_infile_userdata;
- void *extension;
+ struct st_mysql_options_extention *extension;
};
enum mysql_status
@@ -235,15 +222,6 @@ enum mysql_protocol_type
MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
};
-/*
- There are three types of queries - the ones that have to go to
- the master, the ones that go to a slave, and the adminstrative
- type which must happen on the pivot connectioin
-*/
-enum mysql_rpl_type
-{
- MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
-};
typedef struct character_set
{
@@ -288,21 +266,8 @@ typedef struct st_mysql
/* session-wide random string */
char scramble[SCRAMBLE_LENGTH+1];
-
- /*
- Set if this is the original connection, not a master or a slave we have
- added though mysql_rpl_probe() or mysql_set_master()/ mysql_add_slave()
- */
- my_bool rpl_pivot;
- /*
- Pointers to the master, and the next slave connections, points to
- itself if lone connection.
- */
- struct st_mysql* master, *next_slave;
-
- struct st_mysql* last_used_slave; /* needed for round-robin slave pick */
- /* needed for send/read/store/use result to work correctly with replication */
- struct st_mysql* last_used_con;
+ my_bool unused1;
+ void *unused2, *unused3, *unused4, *unused5;
LIST *stmts; /* list of all statements */
const struct st_mysql_methods *methods;
@@ -336,35 +301,12 @@ typedef struct st_mysql_res {
void *extension;
} MYSQL_RES;
-#define MAX_MYSQL_MANAGER_ERR 256
-#define MAX_MYSQL_MANAGER_MSG 256
-
-#define MANAGER_OK 200
-#define MANAGER_INFO 250
-#define MANAGER_ACCESS 401
-#define MANAGER_CLIENT_ERR 450
-#define MANAGER_INTERNAL_ERR 500
#if !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT)
#define MYSQL_CLIENT
#endif
-typedef struct st_mysql_manager
-{
- NET net;
- char *host, *user, *passwd;
- char *net_buf, *net_buf_pos, *net_data_end;
- unsigned int port;
- int cmd_status;
- int last_errno;
- int net_buf_size;
- my_bool free_me;
- my_bool eof;
- char last_error[MAX_MYSQL_MANAGER_ERR];
- void *extension;
-} MYSQL_MANAGER;
-
typedef struct st_mysql_parameters
{
unsigned long *p_max_allowed_packet;
@@ -457,16 +399,6 @@ int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql);
MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql);
-/* perform query on master */
-my_bool STDCALL mysql_master_query(MYSQL *mysql, const char *q,
- unsigned long length);
-my_bool STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
- unsigned long length);
-/* perform query on slave */
-my_bool STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
- unsigned long length);
-my_bool STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
- unsigned long length);
void STDCALL mysql_get_character_set_info(MYSQL *mysql,
MY_CHARSET_INFO *charset);
@@ -488,37 +420,6 @@ mysql_set_local_infile_handler(MYSQL *mysql,
void
mysql_set_local_infile_default(MYSQL *mysql);
-
-/*
- enable/disable parsing of all queries to decide if they go on master or
- slave
-*/
-void STDCALL mysql_enable_rpl_parse(MYSQL* mysql);
-void STDCALL mysql_disable_rpl_parse(MYSQL* mysql);
-/* get the value of the parse flag */
-int STDCALL mysql_rpl_parse_enabled(MYSQL* mysql);
-
-/* enable/disable reads from master */
-void STDCALL mysql_enable_reads_from_master(MYSQL* mysql);
-void STDCALL mysql_disable_reads_from_master(MYSQL* mysql);
-/* get the value of the master read flag */
-my_bool STDCALL mysql_reads_from_master_enabled(MYSQL* mysql);
-
-enum mysql_rpl_type STDCALL mysql_rpl_query_type(const char* q, int len);
-
-/* discover the master and its slaves */
-my_bool STDCALL mysql_rpl_probe(MYSQL* mysql);
-
-/* set the master, close/free the old one, if it is not a pivot */
-int STDCALL mysql_set_master(MYSQL* mysql, const char* host,
- unsigned int port,
- const char* user,
- const char* passwd);
-int STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
- unsigned int port,
- const char* user,
- const char* passwd);
-
int STDCALL mysql_shutdown(MYSQL *mysql,
enum mysql_enum_shutdown_level
shutdown_level);
@@ -565,18 +466,6 @@ void STDCALL mysql_debug(const char *debug);
void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
unsigned int STDCALL mysql_thread_safe(void);
my_bool STDCALL mysql_embedded(void);
-MYSQL_MANAGER* STDCALL mysql_manager_init(MYSQL_MANAGER* con);
-MYSQL_MANAGER* STDCALL mysql_manager_connect(MYSQL_MANAGER* con,
- const char* host,
- const char* user,
- const char* passwd,
- unsigned int port);
-void STDCALL mysql_manager_close(MYSQL_MANAGER* con);
-int STDCALL mysql_manager_command(MYSQL_MANAGER* con,
- const char* cmd, int cmd_len);
-int STDCALL mysql_manager_fetch_line(MYSQL_MANAGER* con,
- char* res_buf,
- int res_buf_size);
my_bool STDCALL mysql_read_query_result(MYSQL *mysql);
@@ -684,6 +573,8 @@ typedef struct st_mysql_bind
} MYSQL_BIND;
+struct st_mysql_stmt_extension;
+
/* statement handler */
typedef struct st_mysql_stmt
{
@@ -729,7 +620,7 @@ typedef struct st_mysql_stmt
metadata fields when doing mysql_stmt_store_result.
*/
my_bool update_max_length;
- void *extension;
+ struct st_mysql_stmt_extension *extension;
} MYSQL_STMT;
enum enum_stmt_attr_type
@@ -755,38 +646,6 @@ enum enum_stmt_attr_type
};
-typedef struct st_mysql_methods
-{
- my_bool (*read_query_result)(MYSQL *mysql);
- my_bool (*advanced_command)(MYSQL *mysql,
- enum enum_server_command command,
- const unsigned char *header,
- unsigned long header_length,
- const unsigned char *arg,
- unsigned long arg_length,
- my_bool skip_check,
- MYSQL_STMT *stmt);
- MYSQL_DATA *(*read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
- unsigned int fields);
- MYSQL_RES * (*use_result)(MYSQL *mysql);
- void (*fetch_lengths)(unsigned long *to,
- MYSQL_ROW column, unsigned int field_count);
- void (*flush_use_result)(MYSQL *mysql);
-#if !defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY)
- MYSQL_FIELD * (*list_fields)(MYSQL *mysql);
- my_bool (*read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt);
- int (*stmt_execute)(MYSQL_STMT *stmt);
- int (*read_binary_rows)(MYSQL_STMT *stmt);
- int (*unbuffered_fetch)(MYSQL *mysql, char **row);
- void (*free_embedded_thd)(MYSQL *mysql);
- const char *(*read_statistics)(MYSQL *mysql);
- my_bool (*next_result)(MYSQL *mysql);
- int (*read_change_user_result)(MYSQL *mysql, char *buff, const char *passwd);
- int (*read_rows_from_cursor)(MYSQL_STMT *stmt);
-#endif
-} MYSQL_METHODS;
-
-
MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql);
int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
unsigned long length);
@@ -831,6 +690,7 @@ my_bool STDCALL mysql_rollback(MYSQL * mysql);
my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
my_bool STDCALL mysql_more_results(MYSQL *mysql);
int STDCALL mysql_next_result(MYSQL *mysql);
+int STDCALL mysql_stmt_next_result(MYSQL_STMT *stmt);
void STDCALL mysql_close(MYSQL *sock);
@@ -845,26 +705,9 @@ MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host,
const char *user, const char *passwd);
int STDCALL mysql_create_db(MYSQL *mysql, const char *DB);
int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
-#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
#endif
#define HAVE_MYSQL_REAL_CONNECT
-/*
- The following functions are mainly exported because of mysqlbinlog;
- They are not for general usage
-*/
-
-#define simple_command(mysql, command, arg, length, skip_check) \
- (*(mysql)->methods->advanced_command)(mysql, command, 0, \
- 0, arg, length, skip_check, NULL)
-#define stmt_command(mysql, command, arg, length, stmt) \
- (*(mysql)->methods->advanced_command)(mysql, command, 0, \
- 0, arg, length, 1, stmt)
-
-#ifdef __NETWARE__
-#pragma pack(pop) /* restore alignment */
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql_com.h b/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql_com.h
index 357519d5..f2345be6 100644
--- a/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql_com.h
+++ b/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql_com.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/*
** Common definition between mysql server & client
@@ -27,10 +27,20 @@
#define NAME_LEN (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN)
#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN)
+#define MYSQL_AUTODETECT_CHARSET_NAME "auto"
+
#define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5
/*
+ Maximum length of comments
+*/
+#define TABLE_COMMENT_INLINE_MAXLEN 180 /* pre 6.0: 60 characters */
+#define TABLE_COMMENT_MAXLEN 2048
+#define COLUMN_COMMENT_MAXLEN 1024
+#define INDEX_COMMENT_MAXLEN 1024
+
+/*
USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain
username and hostname parts of the user identifier with trailing zero in
MySQL standard format:
@@ -104,6 +114,10 @@ enum enum_server_command
#define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */
#define FIELD_IN_ADD_INDEX (1<< 20) /* Intern: Field used in ADD INDEX */
#define FIELD_IS_RENAMED (1<< 21) /* Intern: Field is being renamed */
+#define FIELD_FLAGS_STORAGE_MEDIA 22 /* Field storage media, bit 22-23,
+ reserved by MySQL Cluster */
+#define FIELD_FLAGS_COLUMN_FORMAT 24 /* Field column format, bit 24-25,
+ reserved by MySQL Cluster */
#define REFRESH_GRANT 1 /* Refresh grant tables */
#define REFRESH_LOG 2 /* Start on new log file */
@@ -115,6 +129,12 @@ enum enum_server_command
thread */
#define REFRESH_MASTER 128 /* Remove all bin logs in the index
and truncate the index */
+#define REFRESH_ERROR_LOG 256 /* Rotate only the erorr log */
+#define REFRESH_ENGINE_LOG 512 /* Flush all storage engine logs */
+#define REFRESH_BINARY_LOG 1024 /* Flush the binary log */
+#define REFRESH_RELAY_LOG 2048 /* Flush the relay log */
+#define REFRESH_GENERAL_LOG 4096 /* Flush the general log */
+#define REFRESH_SLOW_LOG 8192 /* Flush the slow query log */
/* The following can't be set with mysql_refresh() */
#define REFRESH_READ_LOCK 16384 /* Lock tables for read */
@@ -144,10 +164,19 @@ enum enum_server_command
#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
#define CLIENT_MULTI_STATEMENTS (1UL << 16) /* Enable/disable multi-stmt support */
#define CLIENT_MULTI_RESULTS (1UL << 17) /* Enable/disable multi-results */
+#define CLIENT_PS_MULTI_RESULTS (1UL << 18) /* Multi-results in PS-protocol */
+
+#define CLIENT_PLUGIN_AUTH (1UL << 19) /* Client supports plugin authentication */
#define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)
#define CLIENT_REMEMBER_OPTIONS (1UL << 31)
+#ifdef HAVE_COMPRESS
+#define CAN_CLIENT_COMPRESS CLIENT_COMPRESS
+#else
+#define CAN_CLIENT_COMPRESS 0
+#endif
+
/* Gather all possible capabilites (flags) supported by the server */
#define CLIENT_ALL_FLAGS (CLIENT_LONG_PASSWORD | \
CLIENT_FOUND_ROWS | \
@@ -167,8 +196,10 @@ enum enum_server_command
CLIENT_SECURE_CONNECTION | \
CLIENT_MULTI_STATEMENTS | \
CLIENT_MULTI_RESULTS | \
+ CLIENT_PS_MULTI_RESULTS | \
CLIENT_SSL_VERIFY_SERVER_CERT | \
- CLIENT_REMEMBER_OPTIONS)
+ CLIENT_REMEMBER_OPTIONS | \
+ CLIENT_PLUGIN_AUTH)
/*
Switch off the flags that are optional and depending on build flags
@@ -179,7 +210,14 @@ enum enum_server_command
& ~CLIENT_COMPRESS) \
& ~CLIENT_SSL_VERIFY_SERVER_CERT)
-#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
+/**
+ Is raised when a multi-statement transaction
+ has been started, either explicitly, by means
+ of BEGIN or COMMIT AND CHAIN, or
+ implicitly, by the first transactional
+ statement, when autocommit=off.
+*/
+#define SERVER_STATUS_IN_TRANS 1
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
#define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */
#define SERVER_QUERY_NO_GOOD_INDEX_USED 16
@@ -203,6 +241,12 @@ enum enum_server_command
number of result set columns.
*/
#define SERVER_STATUS_METADATA_CHANGED 1024
+#define SERVER_QUERY_WAS_SLOW 2048
+
+/**
+ To mark ResultSet containing output parameter values.
+*/
+#define SERVER_PS_OUT_PARAMS 4096
/**
Server status flags that must be cleared when starting
@@ -215,7 +259,11 @@ enum enum_server_command
#define SERVER_STATUS_CLEAR_SET (SERVER_QUERY_NO_GOOD_INDEX_USED| \
SERVER_QUERY_NO_INDEX_USED|\
SERVER_MORE_RESULTS_EXISTS|\
- SERVER_STATUS_METADATA_CHANGED)
+ SERVER_STATUS_METADATA_CHANGED |\
+ SERVER_QUERY_WAS_SLOW |\
+ SERVER_STATUS_DB_DROPPED |\
+ SERVER_STATUS_CURSOR_EXISTS|\
+ SERVER_STATUS_LAST_ROW_SENT)
#define MYSQL_ERRMSG_SIZE 512
#define NET_READ_TIMEOUT 30 /* Timeout on read */
@@ -254,24 +302,23 @@ typedef struct st_net {
unsigned int *return_status;
unsigned char reading_or_writing;
char save_char;
- my_bool unused0; /* Please remove with the next incompatible ABI change. */
- my_bool unused; /* Please remove with the next incompatible ABI change */
- my_bool compress;
my_bool unused1; /* Please remove with the next incompatible ABI change. */
+ my_bool unused2; /* Please remove with the next incompatible ABI change */
+ my_bool compress;
+ my_bool unused3; /* Please remove with the next incompatible ABI change. */
/*
Pointer to query object in query cache, do not equal NULL (0) for
queries in cache that have not stored its results yet
*/
#endif
/*
- 'query_cache_query' should be accessed only via query cache
- functions and methods to maintain proper locking.
+ Unused, please remove with the next incompatible ABI change.
*/
- unsigned char *query_cache_query;
+ unsigned char *unused;
unsigned int last_errno;
unsigned char error;
- my_bool unused2; /* Please remove with the next incompatible ABI change. */
- my_bool return_errno;
+ my_bool unused4; /* Please remove with the next incompatible ABI change. */
+ my_bool unused5; /* Please remove with the next incompatible ABI change. */
/** Client library error message buffer. Actually belongs to struct MYSQL. */
char last_error[MYSQL_ERRMSG_SIZE];
/** Client library sqlstate buffer. Set along with the error message. */
@@ -419,10 +466,6 @@ void my_net_set_write_timeout(NET *net, uint timeout);
void my_net_set_read_timeout(NET *net, uint timeout);
#endif
-/*
- The following function is not meant for normal usage
- Currently it's used internally by manager.c
-*/
struct sockaddr;
int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen,
unsigned int timeout);
@@ -492,14 +535,14 @@ void create_random_string(char *to, unsigned int length, struct rand_struct *ran
void hash_password(unsigned long *to, const char *password, unsigned int password_len);
void make_scrambled_password_323(char *to, const char *password);
void scramble_323(char *to, const char *message, const char *password);
-my_bool check_scramble_323(const char *, const char *message,
+my_bool check_scramble_323(const unsigned char *reply, const char *message,
unsigned long *salt);
void get_salt_from_password_323(unsigned long *res, const char *password);
void make_password_from_salt_323(char *to, const unsigned long *salt);
void make_scrambled_password(char *to, const char *password);
void scramble(char *to, const char *message, const char *password);
-my_bool check_scramble(const char *reply, const char *message,
+my_bool check_scramble(const unsigned char *reply, const char *message,
const unsigned char *hash_stage2);
void get_salt_from_password(unsigned char *res, const char *password);
void make_password_from_salt(char *to, const unsigned char *hash_stage2);
@@ -529,4 +572,5 @@ uchar *net_store_length(uchar *pkg, ulonglong length);
#define MYSQL_STMT_HEADER 4
#define MYSQL_LONG_DATA_HEADER 6
+#define NOT_FIXED_DEC 31
#endif
diff --git a/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql_embed.h b/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql_embed.h
deleted file mode 100644
index e3318864..00000000
--- a/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql_embed.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-/* Defines that are unique to the embedded version of MySQL */
-
-#ifdef EMBEDDED_LIBRARY
-
-/* Things we don't need in the embedded version of MySQL */
-/* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */
-
-#undef HAVE_OPENSSL
-#undef HAVE_SMEM /* No shared memory */
-#undef HAVE_NDBCLUSTER_DB /* No NDB cluster */
-
-#define DONT_USE_RAID
-
-#endif /* EMBEDDED_LIBRARY */
diff --git a/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql_version.h b/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql_version.h
index dc8c5b3f..2822e22d 100644
--- a/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql_version.h
+++ b/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql_version.h
@@ -9,16 +9,16 @@
#include <custom_conf.h>
#else
#define PROTOCOL_VERSION 10
-#define MYSQL_SERVER_VERSION "5.1.61"
-#define MYSQL_BASE_VERSION "mysqld-5.1"
+#define MYSQL_SERVER_VERSION "5.5.22"
+#define MYSQL_BASE_VERSION "mysqld-5.5"
#define MYSQL_SERVER_SUFFIX_DEF ""
#define FRM_VER 6
-#define MYSQL_VERSION_ID 50161
+#define MYSQL_VERSION_ID 50522
#define MYSQL_PORT 3306
#define MYSQL_PORT_DEFAULT 0
#define MYSQL_UNIX_ADDR "/tmp/mysql.sock"
#define MYSQL_CONFIG_NAME "my"
-#define MYSQL_COMPILATION_COMMENT "Source distribution"
+#define MYSQL_COMPILATION_COMMENT "MySQL Community Server (GPL)"
/* mysqld compile time options */
#endif /* _CUSTOMCONFIG_ */
diff --git a/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/typelib.h b/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/typelib.h
index 46106d1b..00dbafea 100644
--- a/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/typelib.h
+++ b/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/typelib.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,11 +29,26 @@ typedef struct st_typelib { /* Different types saved here */
extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position);
extern int find_type_or_exit(const char *x, TYPELIB *typelib,
const char *option);
-extern int find_type(char *x, const TYPELIB *typelib, unsigned int full_name);
+#define FIND_TYPE_BASIC 0
+/** makes @c find_type() require the whole name, no prefix */
+#define FIND_TYPE_NO_PREFIX (1 << 0)
+/** always implicitely on, so unused, but old code may pass it */
+#define FIND_TYPE_NO_OVERWRITE (1 << 1)
+/** makes @c find_type() accept a number */
+#define FIND_TYPE_ALLOW_NUMBER (1 << 2)
+/** makes @c find_type() treat ',' as terminator */
+#define FIND_TYPE_COMMA_TERM (1 << 3)
+
+extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags);
extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
extern const char *get_type(TYPELIB *typelib,unsigned int nr);
extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);
extern TYPELIB sql_protocol_typelib;
+my_ulonglong find_set_from_flags(const TYPELIB *lib, unsigned int default_name,
+ my_ulonglong cur_set, my_ulonglong default_set,
+ const char *str, unsigned int length,
+ char **err_pos, unsigned int *err_len);
+
#endif /* _typelib_h */
diff --git a/Frameworks/SPMySQLFramework/MySQL Client Libraries/lib/libmysqlclient.a b/Frameworks/SPMySQLFramework/MySQL Client Libraries/lib/libmysqlclient.a
index 5b7d405a..ab6be1a6 100644
--- a/Frameworks/SPMySQLFramework/MySQL Client Libraries/lib/libmysqlclient.a
+++ b/Frameworks/SPMySQLFramework/MySQL Client Libraries/lib/libmysqlclient.a
Binary files differ
diff --git a/Frameworks/SPMySQLFramework/SPMySQLFramework.xcodeproj/project.pbxproj b/Frameworks/SPMySQLFramework/SPMySQLFramework.xcodeproj/project.pbxproj
index ef6d538c..076e112a 100644
--- a/Frameworks/SPMySQLFramework/SPMySQLFramework.xcodeproj/project.pbxproj
+++ b/Frameworks/SPMySQLFramework/SPMySQLFramework.xcodeproj/project.pbxproj
@@ -15,7 +15,6 @@
584292A014C34B36000F8438 /* my_list.h in Headers */ = {isa = PBXBuildFile; fileRef = 5842929514C34B36000F8438 /* my_list.h */; settings = {ATTRIBUTES = (); }; };
584292A114C34B36000F8438 /* mysql.h in Headers */ = {isa = PBXBuildFile; fileRef = 5842929614C34B36000F8438 /* mysql.h */; };
584292A214C34B36000F8438 /* mysql_com.h in Headers */ = {isa = PBXBuildFile; fileRef = 5842929714C34B36000F8438 /* mysql_com.h */; };
- 584292A314C34B36000F8438 /* mysql_embed.h in Headers */ = {isa = PBXBuildFile; fileRef = 5842929814C34B36000F8438 /* mysql_embed.h */; };
584292A414C34B36000F8438 /* mysql_time.h in Headers */ = {isa = PBXBuildFile; fileRef = 5842929914C34B36000F8438 /* mysql_time.h */; };
584292A514C34B36000F8438 /* mysql_version.h in Headers */ = {isa = PBXBuildFile; fileRef = 5842929A14C34B36000F8438 /* mysql_version.h */; };
584292A614C34B36000F8438 /* typelib.h in Headers */ = {isa = PBXBuildFile; fileRef = 5842929B14C34B36000F8438 /* typelib.h */; };
@@ -82,7 +81,6 @@
5842929514C34B36000F8438 /* my_list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = my_list.h; sourceTree = "<group>"; };
5842929614C34B36000F8438 /* mysql.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mysql.h; sourceTree = "<group>"; };
5842929714C34B36000F8438 /* mysql_com.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mysql_com.h; sourceTree = "<group>"; };
- 5842929814C34B36000F8438 /* mysql_embed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mysql_embed.h; sourceTree = "<group>"; };
5842929914C34B36000F8438 /* mysql_time.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mysql_time.h; sourceTree = "<group>"; };
5842929A14C34B36000F8438 /* mysql_version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mysql_version.h; sourceTree = "<group>"; };
5842929B14C34B36000F8438 /* typelib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = typelib.h; sourceTree = "<group>"; };
@@ -279,7 +277,6 @@
5842929514C34B36000F8438 /* my_list.h */,
5842929614C34B36000F8438 /* mysql.h */,
5842929714C34B36000F8438 /* mysql_com.h */,
- 5842929814C34B36000F8438 /* mysql_embed.h */,
5842929914C34B36000F8438 /* mysql_time.h */,
5842929A14C34B36000F8438 /* mysql_version.h */,
5842929B14C34B36000F8438 /* typelib.h */,
@@ -377,7 +374,6 @@
584292A014C34B36000F8438 /* my_list.h in Headers */,
584292A114C34B36000F8438 /* mysql.h in Headers */,
584292A214C34B36000F8438 /* mysql_com.h in Headers */,
- 584292A314C34B36000F8438 /* mysql_embed.h in Headers */,
584292A414C34B36000F8438 /* mysql_time.h in Headers */,
584292A514C34B36000F8438 /* mysql_version.h in Headers */,
584292A614C34B36000F8438 /* typelib.h in Headers */,
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m
index 686be183..5df71e96 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m
@@ -339,6 +339,13 @@
if (lastQueryWasCancelled) {
theErrorMessage = NSLocalizedString(@"Query cancelled.", @"Query cancelled error");
theErrorID = 1317;
+
+ // If the query was cancelled on a MySQL <5 server, check the connection to allow reconnects
+ // after query kills. This is also handled within the class for internal cancellations, but
+ // as other external classes may also cancel the query.
+ if (![self serverVersionIsGreaterThanOrEqualTo:5 minorVersion:0 releaseVersion:0]) {
+ [self checkConnection];
+ }
}
// Unlock the connection if appropriate - if not a streaming result type.
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLFastStreamingResult.m b/Frameworks/SPMySQLFramework/Source/SPMySQLFastStreamingResult.m
index 8ba55134..1fa4b829 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLFastStreamingResult.m
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLFastStreamingResult.m
@@ -398,6 +398,11 @@ typedef struct st_spmysqlstreamingrowdata {
[parentConnection _unlockConnection];
connectionUnlocked = YES;
+ // If the connection query may have been cancelled with a query kill, double-check connection
+ if ([parentConnection lastQueryWasCancelled] && [parentConnection serverMajorVersion] < 5) {
+ [parentConnection checkConnection];
+ }
+
dataDownloaded = YES;
[downloadPool drain];
}
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLStreamingResult.m b/Frameworks/SPMySQLFramework/Source/SPMySQLStreamingResult.m
index b19e5356..51a17611 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLStreamingResult.m
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLStreamingResult.m
@@ -170,6 +170,12 @@
dataDownloaded = YES;
[parentConnection _unlockConnection];
connectionUnlocked = YES;
+
+ // If the connection query may have been cancelled with a query kill, double-check connection
+ if ([parentConnection lastQueryWasCancelled] && [parentConnection serverMajorVersion] < 5) {
+ [parentConnection checkConnection];
+ }
+
return nil;
}
diff --git a/Frameworks/SPMySQLFramework/build-mysql-client.sh b/Frameworks/SPMySQLFramework/build-mysql-client.sh
index 45e3c465..158d9393 100755
--- a/Frameworks/SPMySQLFramework/build-mysql-client.sh
+++ b/Frameworks/SPMySQLFramework/build-mysql-client.sh
@@ -27,10 +27,10 @@
# Builds the MySQL client libraries for distrubution in Sequel Pro's MySQL framework.
#
-# Paramters: -s -- The path to the MySQL source directory.
-# -q -- Quiet. Don't output any compiler messages.
-# -c -- Clean the source after build completes.
-# -d -- Debug. Output the build statements.
+# Parameters: -s -- The path to the MySQL source directory.
+# -q -- Quiet. Don't output any compiler messages.
+# -c -- Clean the source instead of building it.
+# -d -- Debug. Output the build statements.
QUIET='NO'
DEBUG='NO'
@@ -40,8 +40,11 @@ CLEAN='NO'
export CFLAGS='-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386 -arch x86_64 -O3 -fno-omit-frame-pointer -fno-exceptions -mmacosx-version-min=10.5'
export CXXFLAGS='-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386 -arch x86_64 -O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti -mmacosx-version-min=10.5'
-CONFIGURE_OPTIONS='--without-server --enable-thread-safe-client --disable-dependency-tracking --enable-local-infile --with-ssl --enable-assembler --with-mysqld-ldflags=-all-static'
-BINARY_DISTRIBUTION_SCRIPT='scripts/make_binary_distribution'
+CONFIGURE_OPTIONS='-DBUILD_CONFIG=mysql_release -DENABLED_LOCAL_INFILE=1 -DWITH_SSL=bundled -DWITH_MYSQLD_LDFLAGS="-all-static --disable-shared"'
+OUTPUT_DIR='SPMySQLFiles.build'
+
+set -A INCLUDE_HEADERS 'my_alloc.h' 'my_list.h' 'mysql_com.h' 'mysql_time.h' 'mysql_version.h' 'mysql.h' 'typelib.h'
+ESC=`printf '\033'`
usage()
{
@@ -50,32 +53,28 @@ Usage: $(basename $0): -s <mysql_source_path> [-q -c -d]
Where: -s -- Path to the MySQL source directory
-q -- Be quiet during the build. Suppress all compiler messages
- -c -- Clean the source directory after the build completes
+ -c -- Clean the source directory instead of building
-d -- Debug. Output all the build commands
!EOF
}
+# Test for cmake
+cmake --version > /dev/null 2>&1
+if [ ! $? -eq 0 ]
+then
+ echo "$ESC[1;31mIn addition to the standard OS X build tools, '$ESC[0;1mcmake$ESC[1;31m' is required to compile the MySQL source. $ESC[0;1mcmake$ESC[1;31m is found at $ESC[0mcmake.org$ESC[1;31m, and a binary distribution is available from $ESC[0mhttp://www.cmake.org/cmake/resources/software.mhtml$ESC[1;31m ."
+ echo "Exiting...$ESC[0m"
+ exit 1
+fi
+
if [ $# -eq 0 ]
then
- echo "Invalid number of arguments. I need the path to the MySQL source directory."
+ echo "$ESC[1;31mInvalid number of arguments. I need the path to the MySQL source directory.$ESC[0m"
echo ''
usage
exit 1
fi
-echo ''
-echo "This script builds the MySQL client libraries for distribution in Sequel Pro's MySQL framework."
-echo 'They are all built as 3-way binaries (32 bit PPC, 32/64 bit i386).'
-echo ''
-echo -n 'This may take a while, are you sure you want to continue [y | n]: '
-
-read CONTINUE
-
-if [ "x${CONTINUE}" == 'xn' ]
-then
- echo 'Aborting...'
- exit 0
-fi
while getopts ':s:qcd' OPTION
do
@@ -84,88 +83,156 @@ do
q) QUIET='YES';;
c) CLEAN='YES';;
d) DEBUG='YES';;
- *) echo 'Unrecognised option'; usage; exit 1;;
+ *) echo "$ESC[1;31mUnrecognised option$ESC[0m"; usage; exit 1;;
esac
done
if [ ! -d "$MYSQL_SOURCE_DIR" ]
then
- echo "MySQL source directory does not exist at path '${MYSQL_SOURCE_DIR}'."
- echo 'Exiting...'
+ echo "$ESC[1;31mMySQL source directory does not exist at path '${MYSQL_SOURCE_DIR}'.$ESC[0m"
+ echo "$ESC[1;31mExiting...$ESC[0m"
exit 1
fi
# Change to source directory
+if [ "x${DEBUG}" == 'xYES' ]
+then
+ echo "cd ${MYSQL_SOURCE_DIR}"
+fi
cd "$MYSQL_SOURCE_DIR"
-echo 'Configuring MySQL source...'
+# Perform a clean if requested
+if [ "x${CLEAN}" == 'xYES' ]
+then
+ echo "$ESC[1mCleaning MySQL source and builds...$ESC[0m"
+
+ if [ "x${QUIET}" == 'xYES' ]
+ then
+ make clean > /dev/null
+ if [ -f 'CMakeCache.txt' ]; then rm 'CMakeCache.txt' > /dev/null; fi
+ if [ -d "$OUTPUT_DIR" ]; then rm -rf "$OUTPUT_DIR" > /dev/null; fi
+ else
+ make clean
+ if [ -f 'CMakeCache.txt' ]; then rm 'CMakeCache.txt'; fi
+ if [ -d "$OUTPUT_DIR" ]; then rm -rf "$OUTPUT_DIR" > /dev/null; fi
+ fi
+
+ echo "$ESC[1mCleaning MySQL completed.$ESC[0m"
+
+ exit 0
+fi
+
+echo ''
+echo "This script builds the MySQL client libraries for distribution in Sequel Pro's MySQL framework."
+echo 'They are all built as 3-way binaries (32 bit PPC, 32/64 bit i386).'
+echo ''
+echo -n "$ESC[1mThis may take a while, are you sure you want to continue [y | n]: $ESC[0m"
+
+read CONTINUE
+
+if [ "x${CONTINUE}" == 'xn' ]
+then
+ echo "$ESC[31mAborting...$ESC[0m"
+ exit 0
+fi
+
+
+echo "$ESC[1mConfiguring MySQL source...$ESC[0m"
if [ "x${DEBUG}" == 'xYES' ]
then
- echo "${MYSQL_SOURCE_DIR}/configure" "$CONFIGURE_OPTIONS"
+ echo "cmake ${CONFIGURE_OPTIONS} ."
fi
if [ "x${QUIET}" == 'xYES' ]
then
- ./configure $CONFIGURE_OPTIONS > /dev/null
+ cmake $CONFIGURE_OPTIONS . > /dev/null
else
- ./configure $CONFIGURE_OPTIONS
+ cmake $CONFIGURE_OPTIONS .
fi
if [ $? -eq 0 ]
then
- echo 'Configure successfully completed'
+ echo "$ESC[1mConfigure successfully completed$ESC[0m"
else
- echo 'Configure failed. Exiting...'
+ echo "$ESC[1;31mConfigure failed. Exiting...$ESC[0m"
exit 1
fi
-echo 'Building client libraries...'
+if [ "x${DEBUG}" == 'xYES' ]
+then
+ echo "make mysqlclient"
+fi
+
+echo "$ESC[1mBuilding client libraries...$ESC[0m"
if [ "x${QUIET}" == 'xYES' ]
then
- make > /dev/null
+ make mysqlclient > /dev/null
else
- make
+ make mysqlclient
fi
if [ $? -eq 0 ]
then
- echo 'Building libraries successfully completed'
+ echo "$ESC[1mBuilding libraries successfully completed$ESC[0m"
else
- echo 'Building libraries failed. Exiting...'
+ echo "$ESC[1;31mBuilding libraries failed. Exiting...$ESC[0m"
exit 1
fi
-echo 'Building binary distribution...'
+echo "$ESC[1mPutting together files for distribution...$ESC[0m"
-if [ "x${QUIET}" == 'xYES' ]
+# Create the appropriate directories
+if [ ! -d "$OUTPUT_DIR" ]
then
- $BINARY_DISTRIBUTION_SCRIPT > /dev/null
-else
- $BINARY_DISTRIBUTION_SCRIPT
+ mkdir "$OUTPUT_DIR"
+ if [ ! $? -eq 0 ]
+ then
+ echo "$ESC[1;31mCould not create $OUTPUT_DIR output directory!$ESC[0m"
+ exit 1
+ fi
+fi
+if [ ! -d "${OUTPUT_DIR}/lib" ]
+then
+ mkdir "${OUTPUT_DIR}/lib"
+ if [ ! $? -eq 0 ]
+ then
+ echo "$ESC[1;31mCould not create ${OUTPUT_DIR}/lib output directory!$ESC[0m"
+ exit 1
+ fi
+fi
+if [ ! -d "${OUTPUT_DIR}/include" ]
+then
+ mkdir "${OUTPUT_DIR}/include"
+ if [ ! $? -eq 0 ]
+ then
+ echo "$ESC[1;31mCould not create ${OUTPUT_DIR}/include output directory!$ESC[0m"
+ exit 1
+ fi
fi
-if [ $? -eq 0 ]
+# Copy the library
+cp 'libmysql/libmysqlclient.a' "${OUTPUT_DIR}/lib/"
+if [ ! $? -eq 0 ]
then
- echo 'Building binary distribution successfully completed'
-else
- echo 'Building binary distribution failed. Exiting...'
+ echo "$ESC[1;31mCould not copy libmysqlclient.a to output directory! (${MYSQL_SOURCE_DIR}/${OUTPUT_DIR}/lib)$ESC[0m"
exit 1
fi
-if [ "x${CLEAN}" == 'xYES' ]
-then
- echo 'Cleaning build...'
-
- if [ "x${QUIET}" == 'xYES' ]
+# Copy in the required headers
+for eachheader in ${INCLUDE_HEADERS[@]}
+do
+ cp "include/${eachheader}" "${OUTPUT_DIR}/include/"
+ if [ ! $? -eq 0 ]
then
- make clean > /dev/null
- else
- make clean
+ echo "$ESC[1;31mCould not copy ${eachheader} to output directory! (${MYSQL_SOURCE_DIR}/${OUTPUT_DIR}/include)$ESC[0m"
+ exit 1
fi
-fi
+done
+
-echo 'Building MySQL client libraries successfully completed.'
+echo "$ESC[1mBuilding MySQL client libraries successfully completed.$ESC[0m"
+echo "$ESC[1mSee ${MYSQL_SOURCE_DIR}/${OUTPUT_DIR}/ for the product.$ESC[0m"
exit 0