1 Index: mysqlse/ha_sphinx.cc
2 ===================================================================
3 --- mysqlse/ha_sphinx.cc (wersja 2920)
4 +++ mysqlse/ha_sphinx.cc (wersja 2921)
7 #include <mysql_version.h>
9 -#if MYSQL_VERSION_ID>50100
10 +#if MYSQL_VERSION_ID>=50515
11 +#include "sql_class.h"
12 +#include "sql_array.h"
13 +#elif MYSQL_VERSION_ID>50100
14 #include "mysql_priv.h"
15 #include <mysql/plugin.h>
21 +#if MYSQL_VERSION_ID>=50515
23 +#define sphinx_hash_init my_hash_init
24 +#define sphinx_hash_free my_hash_free
25 +#define sphinx_hash_search my_hash_search
26 +#define sphinx_hash_delete my_hash_delete
30 +#define sphinx_hash_init hash_init
31 +#define sphinx_hash_free hash_free
32 +#define sphinx_hash_search hash_search
33 +#define sphinx_hash_delete hash_delete
37 /////////////////////////////////////////////////////////////////////////////
39 // FIXME! make this all dynamic
44 - VOID ( pthread_mutex_init ( &sphinx_mutex, MY_MUTEX_INIT_FAST ) );
45 - hash_init ( &sphinx_open_tables, system_charset_info, 32, 0, 0,
46 + void ( pthread_mutex_init ( &sphinx_mutex, MY_MUTEX_INIT_FAST ) );
47 + sphinx_hash_init ( &sphinx_open_tables, system_charset_info, 32, 0, 0,
48 sphinx_get_key, 0, 0 );
50 #if MYSQL_VERSION_ID > 50100
53 if ( sphinx_open_tables.records )
55 - hash_free ( &sphinx_open_tables );
56 + sphinx_hash_free ( &sphinx_open_tables );
57 pthread_mutex_destroy ( &sphinx_mutex );
60 @@ -1131,12 +1150,12 @@
62 // check if we already have this share
63 #if MYSQL_VERSION_ID>=50120
64 - pShare = (CSphSEShare*) hash_search ( &sphinx_open_tables, (const uchar *) table_name, strlen(table_name) );
65 + pShare = (CSphSEShare*) sphinx_hash_search ( &sphinx_open_tables, (const uchar *) table_name, strlen(table_name) );
68 - pShare = (CSphSEShare*) hash_search ( &sphinx_open_tables, (const byte *) table_name, strlen(table_name) );
69 + pShare = (CSphSEShare*) sphinx_hash_search ( &sphinx_open_tables, (const byte *) table_name, strlen(table_name) );
71 - pShare = (CSphSEShare*) hash_search ( &sphinx_open_tables, table_name, strlen(table_name) );
72 + pShare = (CSphSEShare*) sphinx_hash_search ( &sphinx_open_tables, table_name, strlen(table_name) );
78 if ( !--pShare->m_iUseCount )
80 - hash_delete ( &sphinx_open_tables, (byte *)pShare );
81 + sphinx_hash_delete ( &sphinx_open_tables, (byte *)pShare );
82 SafeDelete ( pShare );
85 @@ -2073,15 +2092,29 @@
89 + bool bError = false;
91 +#if MYSQL_VERSION_ID>=50515
92 + struct addrinfo tmp_hostent, *hp;
93 + tmp_errno = getaddrinfo ( sHost, NULL, &tmp_hostent, &hp );
96 + freeaddrinfo ( hp );
100 struct hostent tmp_hostent, *hp;
101 char buff2 [ GETHOSTBYNAME_BUFF_SIZE ];
103 - hp = my_gethostbyname_r ( sHost, &tmp_hostent,
104 - buff2, sizeof(buff2), &tmp_errno );
105 + hp = my_gethostbyname_r ( sHost, &tmp_hostent, buff2, sizeof(buff2), &tmp_errno );
108 my_gethostbyname_r_free();
116 my_snprintf ( sError, sizeof(sError), "failed to resolve searchd host (name=%s)", sHost );
118 @@ -2089,9 +2122,13 @@
122 - memcpy ( &sin.sin_addr, hp->h_addr,
123 - Min ( sizeof(sin.sin_addr), (size_t)hp->h_length ) );
124 +#if MYSQL_VERSION_ID>=50515
125 + memcpy ( &sin.sin_addr, hp->ai_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->ai_addrlen ) );
126 + freeaddrinfo ( hp );
128 + memcpy ( &sin.sin_addr, hp->h_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->h_length ) );
129 my_gethostbyname_r_free();
134 @@ -2932,7 +2969,7 @@
136 for ( uint32 i=0; i<m_iAttrs; i++ )
139 + longlong iValue64 = 0;
140 uint32 uValue = UnpackDword ();
141 if ( m_dAttrs[i].m_uType==SPH_ATTR_BIGINT )
142 iValue64 = ( (longlong)uValue<<32 ) | UnpackDword();
143 Index: mysqlse/ha_sphinx.h
144 ===================================================================
145 --- mysqlse/ha_sphinx.h (wersja 2920)
146 +++ mysqlse/ha_sphinx.h (wersja 2921)
151 -#if MYSQL_VERSION_ID>50100
152 +#if MYSQL_VERSION_ID>=50515
153 +#define TABLE_ARG TABLE_SHARE
154 +#elif MYSQL_VERSION_ID>50100
155 #define TABLE_ARG st_table_share
157 #define TABLE_ARG st_table
161 #if MYSQL_VERSION_ID<50100
162 - ha_sphinx ( TABLE_ARG * table_arg );
163 + ha_sphinx ( TABLE_ARG * table_arg ); // NOLINT
165 ha_sphinx ( handlerton * hton, TABLE_ARG * table_arg );
168 int index_init ( uint keynr, bool sorted ); // 5.1.x
169 int index_init ( uint keynr ) { return index_init ( keynr, false ); } // 5.0.x
173 int index_read ( byte * buf, const byte * key, uint key_len, enum ha_rkey_function find_flag );
174 int index_read_idx ( byte * buf, uint idx, const byte * key, uint key_len, enum ha_rkey_function find_flag );
175 int index_next ( byte * buf );
176 Index: mysqlse/CMakeLists.txt
177 ===================================================================
178 --- mysqlse/CMakeLists.txt (wersja 2920)
179 +++ mysqlse/CMakeLists.txt (wersja 2921)
181 ${CMAKE_SOURCE_DIR}/regex)
183 SET(SPHINX_SOURCES ha_sphinx.cc)
184 +IF(MYSQL_VERSION_ID LESS 50515)
185 ADD_LIBRARY(sphinx ha_sphinx.cc)
187 +SET(SPHINX_PLUGIN_DYNAMIC "ha_sphinx")
188 +MYSQL_ADD_PLUGIN(sphinx ${SPHINX_SOURCES} STORAGE_ENGINE MODULE_ONLY LINK_LIBRARIES mysys)