Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Vincent Bechu
slapos
Commits
6c502cb6
Commit
6c502cb6
authored
Sep 05, 2011
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
version up : MySQL-5.1.58 and sphinx search engine based on sphinx-2.0.1-beta.
parent
67cd8b46
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
237 additions
and
1414 deletions
+237
-1414
component/mysql-5.1/buildout.cfg
component/mysql-5.1/buildout.cfg
+5
-5
component/mysql-5.1/mysql-5.1-sphinx-2.0.1-beta.diff
component/mysql-5.1/mysql-5.1-sphinx-2.0.1-beta.diff
+232
-1409
No files found.
component/mysql-5.1/buildout.cfg
View file @
6c502cb6
...
...
@@ -15,15 +15,15 @@ parts =
[mysql-5.1-sphinx-patch]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
md5sum =
6580393ca93ecf564cad0552b91a563e
filename = mysql-5.1
.49-sphinx-1.10
.diff
md5sum =
eefcd08c400c58d3e89542ab482a8429
filename = mysql-5.1
-sphinx-2.0.1-beta
.diff
download-only = true
[mysql-5.1]
recipe = hexagonit.recipe.cmmi
version = 5.1.5
7
version = 5.1.5
8
url = http://mysql.he.net/Downloads/MySQL-5.1/mysql-${:version}.tar.gz
md5sum =
8d6998ef0f2e2d1dac2a761348c71c21
md5sum =
ae5aef506088e521e4b1cc4f668e96d2
# compile directory is required to build mysql plugins.
keep-compile-dir = true
# configure: how to avoid searching for my.cnf?
...
...
@@ -54,7 +54,7 @@ configure-options =
make-options =
LIBTOOL=libtool
patch-options = -p
1
patch-options = -p
0
patches =
${mysql-5.1-sphinx-patch:location}/${mysql-5.1-sphinx-patch:filename}
environment =
...
...
component/mysql-5.1/mysql-5.1
.49-sphinx-1.10
.diff
→
component/mysql-5.1/mysql-5.1
-sphinx-2.0.1-beta
.diff
View file @
6c502cb6
#
This patch is based on:
#
http://www.sphinxsearch.com/downloads/sphinx-1.10-beta.tar.gz
diff -uNr mysql-5.1.49.orig/storage/sphinx/CMakeLists.txt mysql-5.1.49/storage/sphinx/CMakeLists.txt
--- mysql-5.1.49.orig/storage/sphinx/CMakeLists.txt 1970-01-01 09:00:00.000000000 +0900
+++ mysql-5.1.49/storage/sphinx/CMakeLists.txt 2008-02-15 01:37:44.000000000 +0900
diff -uNr storage/CMakeLists.txt storage/sphinx//CMakeLists.txt
--- storage/sphinx/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
+++ storage/sphinx/CMakeLists.txt 2008-02-14 17:37:44.000000000 +0100
@@ -0,0 +1,11 @@
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
...
...
@@ -16,9 +13,9 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/CMakeLists.txt mysql-5.1.49/storage/s
+
+SET(SPHINX_SOURCES ha_sphinx.cc)
+ADD_LIBRARY(sphinx ha_sphinx.cc)
diff -uNr
mysql-5.1.49.orig/storage/sphinx/gen_data.php mysql-5.1.49/storage/sphinx
/gen_data.php
---
mysql-5.1.49.orig/storage/sphinx/gen_data.php 1970-01-01 09:00:00.000000000 +09
00
+++
mysql-5.1.49/storage/sphinx/gen_data.php 2006-06-07 16:28:43.000000000 +09
00
diff -uNr
storage/gen_data.php storage/sphinx/
/gen_data.php
---
storage/sphinx/gen_data.php 1970-01-01 01:00:00.000000000 +01
00
+++
storage/sphinx/gen_data.php 2006-06-07 09:28:43.000000000 +02
00
@@ -0,0 +1,37 @@
+<?php
+
...
...
@@ -57,17 +54,17 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/gen_data.php mysql-5.1.49/storage/sph
+
+
+?>
diff -uNr
mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sphinx
/ha_sphinx.cc
---
mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc 1970-01-01 09:00:00.000000000 +09
00
+++
mysql-5.1.49/storage/sphinx/ha_sphinx.cc 2010-07-08 20:05:08.000000000 +09
00
@@ -0,0 +1,3
363
@@
diff -uNr
storage/ha_sphinx.cc storage/sphinx/
/ha_sphinx.cc
---
storage/sphinx/ha_sphinx.cc 1970-01-01 01:00:00.000000000 +01
00
+++
storage/sphinx/ha_sphinx.cc 2011-03-29 10:21:05.000000000 +02
00
@@ -0,0 +1,3
510
@@
+//
+// $Id: ha_sphinx.cc 2
391 2010-07-08 11:05:08
Z tomat $
+// $Id: ha_sphinx.cc 2
752 2011-03-29 08:21:05
Z tomat $
+//
+
+//
+// Copyright (c) 2001-201
0
, Andrew Aksyonoff
+// Copyright (c) 2008-201
0
, Sphinx Technologies Inc
+// Copyright (c) 2001-201
1
, Andrew Aksyonoff
+// Copyright (c) 2008-201
1
, Sphinx Technologies Inc
+// All rights reserved
+//
+// This program is free software; you can redistribute it and/or modify
...
...
@@ -198,7 +195,7 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+#define SPHINXSE_MAX_ALLOC (16*1024*1024)
+#define SPHINXSE_MAX_KEYWORDSTATS 4096
+
+#define SPHINXSE_VERSION "0.9.9 ($Revision: 2
391
$)"
+#define SPHINXSE_VERSION "0.9.9 ($Revision: 2
752
$)"
+
+// FIXME? the following is cut-n-paste from sphinx.h and searchd.cpp
+// cut-n-paste is somewhat simpler that adding dependencies however..
...
...
@@ -247,6 +244,7 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+ SPH_RANK_PROXIMITY = 4, ///< phrase proximity
+ SPH_RANK_MATCHANY = 5, ///< emulate old match-any weighting
+ SPH_RANK_FIELDMASK = 6, ///< sets bits where there were matches
+ SPH_RANK_SPH04 = 7, ///< codename SPH04, phrase proximity + bm25 + head/exact boost
+
+ SPH_RANK_TOTAL,
+ SPH_RANK_DEFAULT = SPH_RANK_PROXIMITY_BM25
...
...
@@ -474,10 +472,20 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+
+ CHARSET_INFO * m_pQueryCharset;
+
+ bool m_bReplace; ///< are we doing an INSERT or REPLACE
+
+ bool m_bCondId; ///< got a value from condition pushdown
+ longlong m_iCondId; ///< value acquired from id=value condition pushdown
+ bool m_bCondDone; ///< index_read() is now over
+
+ CSphSEThreadData ()
+ : m_bStats ( false )
+ , m_bQuery ( false )
+ , m_pQueryCharset ( NULL )
+ , m_bReplace ( false )
+ , m_bCondId ( false )
+ , m_iCondId ( 0 )
+ , m_bCondDone ( false )
+ {}
+};
+
...
...
@@ -1420,11 +1428,13 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+ m_sQuery = sField;
+ m_bQuery = true;
+
+ // unescape
+ // unescape
only 1st one
+ char *s = sField, *d = sField;
+ int iSlashes = 0;
+ while ( *s )
+ {
+ if ( *s!='\\' ) *d++ = *s;
+ iSlashes = ( *s=='\\' ) ? iSlashes+1 : 0;
+ if ( ( iSlashes%2 )==0 ) *d++ = *s;
+ s++;
+ }
+ *d = '\0';
...
...
@@ -1485,6 +1495,7 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+ else if ( !strcmp ( sValue, "proximity" ) ) m_eRanker = SPH_RANK_PROXIMITY;
+ else if ( !strcmp ( sValue, "matchany" ) ) m_eRanker = SPH_RANK_MATCHANY;
+ else if ( !strcmp ( sValue, "fieldmask" ) ) m_eRanker = SPH_RANK_FIELDMASK;
+ else if ( !strcmp ( sValue, "sph04" ) ) m_eRanker = SPH_RANK_SPH04;
+ else
+ {
+ snprintf ( m_sParseError, sizeof(m_sParseError), "unknown ranking mode '%s'", sValue );
...
...
@@ -1828,6 +1839,8 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+ pCur = pNext;
+ }
+
+ SPH_DEBUG ( "q [[ %s ]]", m_sQuery );
+
+ SPH_RET(true);
+}
+
...
...
@@ -2243,6 +2256,20 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+}
+
+
+int ha_sphinx::extra ( enum ha_extra_function op )
+{
+ CSphSEThreadData * pTls = GetTls();
+ if ( pTls )
+ {
+ if ( op==HA_EXTRA_WRITE_CAN_REPLACE )
+ pTls->m_bReplace = true;
+ else if ( op==HA_EXTRA_WRITE_CANNOT_REPLACE )
+ pTls->m_bReplace = false;
+ }
+ return 0;
+}
+
+
+int ha_sphinx::write_row ( byte * )
+{
+ SPH_ENTER_METHOD();
...
...
@@ -2258,7 +2285,8 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+ sQuery.length ( 0 );
+ sValue.length ( 0 );
+
+ sQuery.append ( "INSERT INTO " );
+ CSphSEThreadData * pTls = GetTls ();
+ sQuery.append ( pTls && pTls->m_bReplace ? "REPLACE INTO " : "INSERT INTO " );
+ sQuery.append ( m_pShare->m_sIndex );
+ sQuery.append ( " (" );
+
...
...
@@ -2324,16 +2352,68 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+}
+
+
+
int ha_sphinx::update_row ( const byte *, byte *
)
+
static inline bool IsIntegerFieldType ( enum_field_types eType
)
+{
+ SPH_ENTER_METHOD();
+ SPH_RET ( HA_ERR_WRONG_COMMAND );
+ return eType==MYSQL_TYPE_LONG || eType==MYSQL_TYPE_LONGLONG;
+}
+
+
+static inline bool IsIDField ( Field * pField )
+{
+ enum_field_types eType = pField->type();
+
+ if ( eType==MYSQL_TYPE_LONGLONG )
+ return true;
+
+ if ( eType==MYSQL_TYPE_LONG && ((Field_num*)pField)->unsigned_flag )
+ return true;
+
+ return false;
+}
+
+
+int ha_sphinx::delete_row ( const byte * )
+{
+ SPH_ENTER_METHOD();
+ if ( !m_pShare || !m_pShare->m_bSphinxQL )
+ SPH_RET ( HA_ERR_WRONG_COMMAND );
+
+ char sQueryBuf[1024];
+ String sQuery ( sQueryBuf, sizeof(sQueryBuf), &my_charset_bin );
+ sQuery.length ( 0 );
+
+ sQuery.append ( "DELETE FROM " );
+ sQuery.append ( m_pShare->m_sIndex );
+ sQuery.append ( " WHERE id=" );
+
+ char sValue[32];
+ snprintf ( sValue, sizeof(sValue), "%lld", table->field[0]->val_int() );
+ sQuery.append ( sValue );
+
+ // FIXME? pretty inefficient to reconnect every time under high load,
+ // but this was intentionally written for a low load scenario..
+ MYSQL * pConn = mysql_init ( NULL );
+ if ( !pConn )
+ SPH_RET ( ER_OUT_OF_RESOURCES );
+
+ unsigned int uTimeout = 1;
+ mysql_options ( pConn, MYSQL_OPT_CONNECT_TIMEOUT, (const char*)&uTimeout );
+
+ if ( !mysql_real_connect ( pConn, m_pShare->m_sHost, "root", "", "", m_pShare->m_iPort, m_pShare->m_sSocket, 0 ) )
+ SPH_RET ( HandleMysqlError ( pConn, ER_CONNECT_TO_FOREIGN_DATA_SOURCE ) );
+
+ if ( mysql_real_query ( pConn, sQuery.ptr(), sQuery.length() ) )
+ SPH_RET ( HandleMysqlError ( pConn, ER_QUERY_ON_FOREIGN_DATA_SOURCE ) );
+
+ // all ok!
+ mysql_close ( pConn );
+ SPH_RET(0);
+}
+
+
+int ha_sphinx::update_row ( const byte *, byte * )
+{
+ SPH_ENTER_METHOD();
+ SPH_RET ( HA_ERR_WRONG_COMMAND );
+}
+
...
...
@@ -2344,6 +2424,11 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+{
+ SPH_ENTER_METHOD();
+ active_index = keynr;
+
+ CSphSEThreadData * pTls = GetTls();
+ if ( pTls )
+ pTls->m_bCondDone = false;
+
+ SPH_RET(0);
+}
+
...
...
@@ -2357,7 +2442,7 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+
+uint32 ha_sphinx::UnpackDword ()
+{
+ if ( m_pCur+sizeof(uint32)>m_pResponseEnd )
+ if ( m_pCur+sizeof(uint32)>m_pResponseEnd )
// NOLINT
+ {
+ m_pCur = m_pResponseEnd;
+ m_bUnpackError = true;
...
...
@@ -2365,7 +2450,7 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+ }
+
+ uint32 uRes = ntohl ( sphUnalignedRead ( *(uint32*)m_pCur ) );
+ m_pCur += sizeof(uint32);
+ m_pCur += sizeof(uint32);
// NOLINT
+ return uRes;
+}
+
...
...
@@ -2527,10 +2612,10 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+ assert ( pStats );
+
+ char * pCurSave = m_pCur;
+ for ( uint i=0; i<m_iMatchesTotal && m_pCur<m_pResponseEnd-sizeof(uint32); i++ )
+ for ( uint i=0; i<m_iMatchesTotal && m_pCur<m_pResponseEnd-sizeof(uint32); i++ )
// NOLINT
+ {
+ m_pCur += m_bId64 ? 12 : 8; // skip id+weight
+ for ( uint32 i=0; i<m_iAttrs && m_pCur<m_pResponseEnd-sizeof(uint32); i++ )
+ for ( uint32 i=0; i<m_iAttrs && m_pCur<m_pResponseEnd-sizeof(uint32); i++ )
// NOLINT
+ {
+ if ( m_dAttrs[i].m_uType & SPH_ATTR_MULTI )
+ {
...
...
@@ -2586,25 +2671,45 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+ if ( condf->functype()!=Item_func::EQ_FUNC || condf->argument_count()!=2 )
+ break;
+
+ Item ** args = condf->arguments();
+ if ( args[0]->type()!=COND::FIELD_ITEM || args[1]->type()!=COND::STRING_ITEM )
+ break;
+
+ Item_field * pField = (Item_field *) args[0];
+ if ( pField->field->field_index!=2 ) // FIXME! magic key index
+ break;
+
+ // get my tls
+ CSphSEThreadData * pTls = GetTls ();
+ if ( !pTls )
+ break;
+
+ // copy the query, and let know that we intercepted this condition
+ Item_string * pString = (Item_string *) args[1];
+ pTls->m_bQuery = true;
+ strncpy ( pTls->m_sQuery, pString->str_value.c_ptr(), sizeof(pTls->m_sQuery) );
+ pTls->m_sQuery[sizeof(pTls->m_sQuery)-1] = '\0';
+ pTls->m_pQueryCharset = pString->str_value.charset();
+ Item ** args = condf->arguments();
+ if ( !m_pShare->m_bSphinxQL )
+ {
+ // on non-QL tables, intercept query=value condition for SELECT
+ if (!( args[0]->type()==COND::FIELD_ITEM && args[1]->type()==COND::STRING_ITEM ))
+ break;
+
+ Item_field * pField = (Item_field *) args[0];
+ if ( pField->field->field_index!=2 ) // FIXME! magic key index
+ break;
+
+ // copy the query, and let know that we intercepted this condition
+ Item_string * pString = (Item_string *) args[1];
+ pTls->m_bQuery = true;
+ strncpy ( pTls->m_sQuery, pString->str_value.c_ptr(), sizeof(pTls->m_sQuery) );
+ pTls->m_sQuery[sizeof(pTls->m_sQuery)-1] = '\0';
+ pTls->m_pQueryCharset = pString->str_value.charset();
+
+ } else
+ {
+ if (!( args[0]->type()==COND::FIELD_ITEM && args[1]->type()==COND::INT_ITEM ))
+ break;
+
+ // on QL tables, intercept id=value condition for DELETE
+ Item_field * pField = (Item_field *) args[0];
+ if ( pField->field->field_index!=0 ) // FIXME! magic key index
+ break;
+
+ Item_int * pVal = (Item_int *) args[1];
+ pTls->m_iCondId = pVal->val_int();
+ pTls->m_bCondId = true;
+ }
+
+ // we intercepted this condition
+ return NULL;
+ }
+
...
...
@@ -2617,9 +2722,8 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+void ha_sphinx::cond_pop ()
+{
+ CSphSEThreadData * pTls = GetTls ();
+ if ( pTls
&& pTls->m_bQuery
)
+ if ( pTls )
+ pTls->m_bQuery = false;
+ return;
+}
+
+
...
...
@@ -2660,6 +2764,38 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+ }
+ pTls->m_tStats.Reset ();
+
+ // sphinxql table, just return the key once
+ if ( m_pShare->m_bSphinxQL )
+ {
+ // over and out
+ if ( pTls->m_bCondDone )
+ SPH_RET ( HA_ERR_END_OF_FILE );
+
+ // return a value from pushdown, if any
+ if ( pTls->m_bCondId )
+ {
+ table->field[0]->store ( pTls->m_iCondId, 1 );
+ pTls->m_bCondDone = true;
+ SPH_RET(0);
+ }
+
+ // return a value from key
+ longlong iRef = 0;
+ if ( key_len==4 )
+ iRef = uint4korr ( key );
+ else if ( key_len==8 )
+ iRef = uint8korr ( key );
+ else
+ {
+ my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), "INTERNAL ERROR: unexpected key length" );
+ SPH_RET ( HA_ERR_END_OF_FILE );
+ }
+
+ table->field[0]->store ( iRef, 1 );
+ pTls->m_bCondDone = true;
+ SPH_RET(0);
+ }
+
+ // parse query
+ if ( pTls->m_bQuery )
+ {
...
...
@@ -3117,12 +3253,6 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+}
+
+
+static inline bool IsIntegerFieldType ( enum_field_types eType )
+{
+ return eType==MYSQL_TYPE_LONG || eType==MYSQL_TYPE_LONGLONG;
+}
+
+
+// create() is called to create a database. The variable name will have the name
+// of the table. When create() is called you do not need to worry about opening
+// the table. Also, the FRM file will have already been created so adjusting
...
...
@@ -3151,7 +3281,7 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+ break;
+ }
+
+ if ( !IsI
ntegerFieldType ( table->field[0]->type() ) || !((Field_num *)table->field[0])->unsigned_flag
)
+ if ( !IsI
DField ( table->field[0] )
)
+ {
+ my_snprintf ( sError, sizeof(sError), "%s: 1st column (docid) MUST be unsigned integer or bigint", name );
+ break;
...
...
@@ -3207,10 +3337,32 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+ for ( ; tInfo.m_bSphinxQL; )
+ {
+ sError[0] = '\0';
+ bool bId = false;
+
+ // check column types, and also for presence of an id column
+ for ( int i=0; i<(int)table->s->fields; i++ )
+ // check that 1st column is id, is of int type, and has an index
+ if ( strcmp ( table->field[0]->field_name, "id" ) )
+ {
+ my_snprintf ( sError, sizeof(sError), "%s: 1st column must be called 'id'", name );
+ break;
+ }
+
+ if ( !IsIDField ( table->field[0] ) )
+ {
+ my_snprintf ( sError, sizeof(sError), "%s: 'id' column must be INT UNSIGNED or BIGINT", name );
+ break;
+ }
+
+ // check index
+ if (
+ table->s->keys!=1 ||
+ table->key_info[0].key_parts!=1 ||
+ strcasecmp ( table->key_info[0].key_part[0].field->field_name, "id" ) )
+ {
+ my_snprintf ( sError, sizeof(sError), "%s: 'id' column must be indexed", name );
+ break;
+ }
+
+ // check column types
+ for ( int i=1; i<(int)table->s->fields; i++ )
+ {
+ enum_field_types eType = table->field[i]->type();
+ if ( eType!=MYSQL_TYPE_TIMESTAMP && !IsIntegerFieldType(eType) && eType!=MYSQL_TYPE_VARCHAR && eType!=MYSQL_TYPE_FLOAT )
...
...
@@ -3219,18 +3371,10 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+ name, i+1, table->field[i]->field_name );
+ break;
+ }
+ if ( strcmp ( table->field[i]->field_name, "id" )==0 )
+ bId = true;
+ }
+ if ( sError[0] )
+ break;
+
+ if ( !bId )
+ {
+ my_snprintf ( sError, sizeof(sError), "%s: id column not found", name );
+ break;
+ }
+
+ // all good
+ break;
+ }
...
...
@@ -3422,14 +3566,14 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.cc mysql-5.1.49/storage/sph
+#endif // >50100
+
+//
+// $Id: ha_sphinx.cc 2
391 2010-07-08 11:05:08
Z tomat $
+// $Id: ha_sphinx.cc 2
752 2011-03-29 08:21:05
Z tomat $
+//
diff -uNr
mysql-5.1.49.orig/storage/sphinx/ha_sphinx.h mysql-5.1.49/storage/sphinx
/ha_sphinx.h
---
mysql-5.1.49.orig/storage/sphinx/ha_sphinx.h 1970-01-01 09:00:00.000000000 +09
00
+++
mysql-5.1.49/storage/sphinx/ha_sphinx.h 2010-06-30 07:48:24.000000000 +09
00
@@ -0,0 +1,16
6
@@
diff -uNr
storage/ha_sphinx.h storage/sphinx/
/ha_sphinx.h
---
storage/sphinx/ha_sphinx.h 1970-01-01 01:00:00.000000000 +01
00
+++
storage/sphinx/ha_sphinx.h 2010-08-03 13:38:09.000000000 +02
00
@@ -0,0 +1,16
7
@@
+//
+// $Id: ha_sphinx.h 2
379 2010-06-29 22:48:24
Z shodan $
+// $Id: ha_sphinx.h 2
428 2010-08-03 11:38:09
Z shodan $
+//
+
+#ifdef USE_PRAGMA_INTERFACE
...
...
@@ -3515,6 +3659,7 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.h mysql-5.1.49/storage/sphi
+ int write_row ( byte * buf );
+ int update_row ( const byte * old_data, byte * new_data );
+ int delete_row ( const byte * buf );
+ int extra ( enum ha_extra_function op );
+
+ int index_init ( uint keynr, bool sorted ); // 5.1.x
+ int index_init ( uint keynr ) { return index_init ( keynr, false ); } // 5.0.x
...
...
@@ -3592,11 +3737,11 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/ha_sphinx.h mysql-5.1.49/storage/sphi
+int sphinx_showfunc_words ( THD *, SHOW_VAR *, char * );
+
+//
+// $Id: ha_sphinx.h 2
379 2010-06-29 22:48:24
Z shodan $
+// $Id: ha_sphinx.h 2
428 2010-08-03 11:38:09
Z shodan $
+//
diff -uNr
mysql-5.1.49.orig/storage/sphinx/INSTALL mysql-5.1.49/storage/sphinx
/INSTALL
---
mysql-5.1.49.orig/storage/sphinx/INSTALL 1970-01-01 09:00:00.000000000 +09
00
+++
mysql-5.1.49/storage/sphinx/INSTALL 2010-07-08 01:12:02.000000000 +09
00
diff -uNr
storage/INSTALL storage/sphinx/
/INSTALL
---
storage/sphinx/INSTALL 1970-01-01 01:00:00.000000000 +01
00
+++
storage/sphinx/INSTALL 2010-07-07 18:12:02.000000000 +02
00
@@ -0,0 +1,48 @@
+Building MySQL with SphinxSE
+=============================
...
...
@@ -3646,9 +3791,9 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/INSTALL mysql-5.1.49/storage/sphinx/I
+win/build-vs8
+
+--eof--
diff -uNr
mysql-5.1.49.orig/storage/sphinx/Makefile.am mysql-5.1.49/storage/sphinx
/Makefile.am
---
mysql-5.1.49.orig/storage/sphinx/Makefile.am 1970-01-01 09:00:00.000000000 +09
00
+++
mysql-5.1.49/storage/sphinx/Makefile.am 2009-02-14 06:26:46.000000000 +09
00
diff -uNr
storage/Makefile.am storage/sphinx/
/Makefile.am
---
storage/sphinx/Makefile.am 1970-01-01 01:00:00.000000000 +01
00
+++
storage/sphinx/Makefile.am 2009-02-13 22:26:46.000000000 +01
00
@@ -0,0 +1,59 @@
+# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+#
...
...
@@ -3709,9 +3854,9 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/Makefile.am mysql-5.1.49/storage/sphi
+EXTRA_DIST = cmakelists.txt
+# Don't update the files from bitkeeper
+%::SCCS/s.%
diff -uNr
mysql-5.1.49.orig/storage/sphinx/make-patch.sh mysql-5.1.49/storage/sphinx
/make-patch.sh
---
mysql-5.1.49.orig/storage/sphinx/make-patch.sh 1970-01-01 09:00:00.000000000 +09
00
+++
mysql-5.1.49/storage/sphinx/make-patch.sh 2008-09-06 03:06:30.000000000 +09
00
diff -uNr
storage/make-patch.sh storage/sphinx/
/make-patch.sh
---
storage/sphinx/make-patch.sh 1970-01-01 01:00:00.000000000 +01
00
+++
storage/sphinx/make-patch.sh 2008-09-05 20:06:30.000000000 +02
00
@@ -0,0 +1,36 @@
+#!/bin/sh
+
...
...
@@ -3749,26 +3894,26 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/make-patch.sh mysql-5.1.49/storage/sp
+for name in $FILES; do
+ diff -BNru "$ORIG$name" "$NEW$name" >> $OUT
+done
diff -uNr
mysql-5.1.49.orig/storage/sphinx/plug.in mysql-5.1.49/storage/sphinx
/plug.in
---
mysql-5.1.49.orig/storage/sphinx/plug.in 1970-01-01 09:00:00.000000000 +09
00
+++
mysql-5.1.49/storage/sphinx/plug.in 2006-06-07 16:28:43.000000000 +09
00
diff -uNr
storage/plug.in storage/sphinx/
/plug.in
---
storage/sphinx/plug.in 1970-01-01 01:00:00.000000000 +01
00
+++
storage/sphinx/plug.in 2006-06-07 09:28:43.000000000 +02
00
@@ -0,0 +1,5 @@
+MYSQL_STORAGE_ENGINE(sphinx,, [Sphinx Storage Engine],
+ [Sphinx Storage Engines], [max,max-no-ndb])
+MYSQL_PLUGIN_DIRECTORY(sphinx, [storage/sphinx])
+MYSQL_PLUGIN_STATIC(sphinx, [libsphinx.a])
+MYSQL_PLUGIN_DYNAMIC(sphinx, [ha_sphinx.la])
diff -uNr
mysql-5.1.49.orig/storage/sphinx/snippets_udf.cc mysql-5.1.49/storage/sphinx
/snippets_udf.cc
---
mysql-5.1.49.orig/storage/sphinx/snippets_udf.cc 1970-01-01 09:00:00.000000000 +09
00
+++
mysql-5.1.49/storage/sphinx/snippets_udf.cc 2010-01-05 04:17:57.000000000 +09
00
diff -uNr
storage/snippets_udf.cc storage/sphinx/
/snippets_udf.cc
---
storage/sphinx/snippets_udf.cc 1970-01-01 01:00:00.000000000 +01
00
+++
storage/sphinx/snippets_udf.cc 2011-01-01 03:33:06.000000000 +01
00
@@ -0,0 +1,768 @@
+//
+// $Id: snippets_udf.cc 2
153 2010-01-04 19:17:57
Z shodan $
+// $Id: snippets_udf.cc 2
616 2011-01-01 02:33:06
Z shodan $
+//
+
+//
+// Copyright (c) 2001-201
0
, Andrew Aksyonoff
+// Copyright (c) 2008-201
0
, Sphinx Technologies Inc
+// Copyright (c) 2001-201
1
, Andrew Aksyonoff
+// Copyright (c) 2008-201
1
, Sphinx Technologies Inc
+// All rights reserved
+//
+// This program is free software; you can redistribute it and/or modify
...
...
@@ -4528,1327 +4673,5 @@ diff -uNr mysql-5.1.49.orig/storage/sphinx/snippets_udf.cc mysql-5.1.49/storage/
+}
+
+//
+// $Id: snippets_udf.cc 2
153 2010-01-04 19:17:57
Z shodan $
+// $Id: snippets_udf.cc 2
616 2011-01-01 02:33:06
Z shodan $
+//
diff -uNr mysql-5.1.49.orig/storage/sphinx/sphinx.5.0.22.diff mysql-5.1.49/storage/sphinx/sphinx.5.0.22.diff
--- mysql-5.1.49.orig/storage/sphinx/sphinx.5.0.22.diff 1970-01-01 09:00:00.000000000 +0900
+++ mysql-5.1.49/storage/sphinx/sphinx.5.0.22.diff 2006-06-07 16:28:43.000000000 +0900
@@ -0,0 +1,284 @@
+diff -B -N -r -u mysql-5.0.22/config/ac-macros/ha_sphinx.m4 mysql-5.0.22.sx/config/ac-macros/ha_sphinx.m4
+--- mysql-5.0.22/config/ac-macros/ha_sphinx.m4 1970-01-01 01:00:00.000000000 +0100
++++ mysql-5.0.22.sx/config/ac-macros/ha_sphinx.m4 2006-06-06 19:49:38.000000000 +0200
+@@ -0,0 +1,30 @@
++dnl ---------------------------------------------------------------------------
++dnl Macro: MYSQL_CHECK_EXAMPLEDB
++dnl Sets HAVE_SPHINX_DB if --with-sphinx-storage-engine is used
++dnl ---------------------------------------------------------------------------
++AC_DEFUN([MYSQL_CHECK_SPHINXDB], [
++ AC_ARG_WITH([sphinx-storage-engine],
++ [
++ --with-sphinx-storage-engine
++ Enable the Sphinx Storage Engine],
++ [sphinxdb="$withval"],
++ [sphinxdb=no])
++ AC_MSG_CHECKING([for example storage engine])
++
++ case "$sphinxdb" in
++ yes )
++ AC_DEFINE([HAVE_SPHINX_DB], [1], [Builds Sphinx Engine])
++ AC_MSG_RESULT([yes])
++ [sphinxdb=yes]
++ ;;
++ * )
++ AC_MSG_RESULT([no])
++ [sphinxdb=no]
++ ;;
++ esac
++
++])
++dnl ---------------------------------------------------------------------------
++dnl END OF MYSQL_CHECK_EXAMPLE SECTION
++dnl ---------------------------------------------------------------------------
++
+diff -B -N -r -u mysql-5.0.22/configure.in mysql-5.0.22.sx/configure.in
+--- mysql-5.0.22/configure.in 2006-05-25 10:56:45.000000000 +0200
++++ mysql-5.0.22.sx/configure.in 2006-06-06 19:49:38.000000000 +0200
+@@ -41,6 +41,7 @@
+ sinclude(config/ac-macros/ha_berkeley.m4)
+ sinclude(config/ac-macros/ha_blackhole.m4)
+ sinclude(config/ac-macros/ha_example.m4)
++sinclude(config/ac-macros/ha_sphinx.m4)
+ sinclude(config/ac-macros/ha_federated.m4)
+ sinclude(config/ac-macros/ha_innodb.m4)
+ sinclude(config/ac-macros/ha_ndbcluster.m4)
+@@ -2450,6 +2451,7 @@
+ MYSQL_CHECK_BDB
+ MYSQL_CHECK_INNODB
+ MYSQL_CHECK_EXAMPLEDB
++MYSQL_CHECK_SPHINXDB
+ MYSQL_CHECK_ARCHIVEDB
+ MYSQL_CHECK_CSVDB
+ MYSQL_CHECK_BLACKHOLEDB
+diff -B -N -r -u mysql-5.0.22/libmysqld/Makefile.am mysql-5.0.22.sx/libmysqld/Makefile.am
+--- mysql-5.0.22/libmysqld/Makefile.am 2006-05-25 10:56:55.000000000 +0200
++++ mysql-5.0.22.sx/libmysqld/Makefile.am 2006-06-06 19:49:38.000000000 +0200
+@@ -27,7 +27,7 @@
+ -DSHAREDIR="\"$(MYSQLSHAREdir)\""
+ INCLUDES= @bdb_includes@ \
+ -I$(top_builddir)/include -I$(top_srcdir)/include \
+- -I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples \
++ -I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples -I$(top_srcdir)/sql/sphinx \
+ -I$(top_srcdir)/regex \
+ $(openssl_includes) $(yassl_includes) @ZLIB_INCLUDES@
+
+@@ -38,6 +38,7 @@
+ libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \
+ my_time.c
+ sqlexamplessources = ha_example.cc ha_tina.cc
++sqlsphinxsources = ha_sphinx.cc
+
+ noinst_HEADERS = embedded_priv.h emb_qcache.h
+
+@@ -65,7 +66,7 @@
+ parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
+ ha_blackhole.cc ha_archive.cc my_user.c
+
+-libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources)
++libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources) $(sqlsphinxsources)
+ libmysqld_a_SOURCES=
+
+ # automake misses these
+@@ -133,12 +134,16 @@
+ rm -f $$f; \
+ @LN_CP_F@ $(top_srcdir)/sql/examples/$$f $$f; \
+ done; \
++ for f in $(sqlsphinxsources); do \
++ rm -f $$f; \
++ @LN_CP_F@ $(top_srcdir)/sql/sphinx/$$f $$f; \
++ done; \
+ rm -f client_settings.h; \
+ @LN_CP_F@ $(top_srcdir)/libmysql/client_settings.h client_settings.h
+
+
+ clean-local:
+- rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) | sed "s;\.lo;.c;g"` \
++ rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) $(sqlsphinxsources) | sed "s;\.lo;.c;g"` \
+ $(top_srcdir)/linked_libmysqld_sources; \
+ rm -f client_settings.h
+
+diff -B -N -r -u mysql-5.0.22/sql/handler.cc mysql-5.0.22.sx/sql/handler.cc
+--- mysql-5.0.22/sql/handler.cc 2006-05-25 10:56:42.000000000 +0200
++++ mysql-5.0.22.sx/sql/handler.cc 2006-06-06 19:49:38.000000000 +0200
+@@ -78,6 +78,15 @@
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ HTON_NO_FLAGS };
+ #endif
++#ifdef HAVE_SPHINX_DB
++#include "sphinx/ha_sphinx.h"
++extern handlerton sphinx_hton;
++#else
++handlerton sphinx_hton = { "SPHINX", SHOW_OPTION_NO, "SPHINX storage engine",
++ DB_TYPE_SPHINX_DB, NULL, 0, 0, NULL, NULL,
++ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++ HTON_NO_FLAGS };
++#endif
+ #ifdef HAVE_INNOBASE_DB
+ #include "ha_innodb.h"
+ extern handlerton innobase_hton;
+@@ -147,6 +156,7 @@
+ &example_hton,
+ &archive_hton,
+ &tina_hton,
++ &sphinx_hton,
+ &ndbcluster_hton,
+ &federated_hton,
+ &myisammrg_hton,
+@@ -345,6 +355,12 @@
+ return new (alloc) ha_tina(table);
+ return NULL;
+ #endif
++#ifdef HAVE_SPHINX_DB
++ case DB_TYPE_SPHINX_DB:
++ if (have_sphinx_db == SHOW_OPTION_YES)
++ return new (alloc) ha_sphinx(table);
++ return NULL;
++#endif
+ #ifdef HAVE_NDBCLUSTER_DB
+ case DB_TYPE_NDBCLUSTER:
+ if (have_ndbcluster == SHOW_OPTION_YES)
+diff -B -N -r -u mysql-5.0.22/sql/handler.h mysql-5.0.22.sx/sql/handler.h
+--- mysql-5.0.22/sql/handler.h 2006-05-25 10:56:55.000000000 +0200
++++ mysql-5.0.22.sx/sql/handler.h 2006-06-06 19:49:38.000000000 +0200
+@@ -183,8 +183,9 @@
+ DB_TYPE_BERKELEY_DB, DB_TYPE_INNODB,
+ DB_TYPE_GEMINI, DB_TYPE_NDBCLUSTER,
+ DB_TYPE_EXAMPLE_DB, DB_TYPE_ARCHIVE_DB, DB_TYPE_CSV_DB,
+- DB_TYPE_FEDERATED_DB,
++ DB_TYPE_FEDERATED_DB,
+ DB_TYPE_BLACKHOLE_DB,
++ DB_TYPE_SPHINX_DB,
+ DB_TYPE_DEFAULT // Must be last
+ };
+
+diff -B -N -r -u mysql-5.0.22/sql/Makefile.am mysql-5.0.22.sx/sql/Makefile.am
+--- mysql-5.0.22/sql/Makefile.am 2006-05-25 10:56:41.000000000 +0200
++++ mysql-5.0.22.sx/sql/Makefile.am 2006-06-06 19:49:38.000000000 +0200
+@@ -66,6 +66,7 @@
+ sql_array.h sql_cursor.h \
+ examples/ha_example.h ha_archive.h \
+ examples/ha_tina.h ha_blackhole.h \
++ sphinx/ha_sphinx.h \
+ ha_federated.h
+ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
+ item.cc item_sum.cc item_buff.cc item_func.cc \
+@@ -102,6 +103,7 @@
+ sp_cache.cc parse_file.cc sql_trigger.cc \
+ examples/ha_example.cc ha_archive.cc \
+ examples/ha_tina.cc ha_blackhole.cc \
++ sphinx/ha_sphinx.cc \
+ ha_federated.cc
+
+ gen_lex_hash_SOURCES = gen_lex_hash.cc
+diff -B -N -r -u mysql-5.0.22/sql/mysqld.cc mysql-5.0.22.sx/sql/mysqld.cc
+--- mysql-5.0.22/sql/mysqld.cc 2006-05-25 10:56:41.000000000 +0200
++++ mysql-5.0.22.sx/sql/mysqld.cc 2006-06-06 19:49:38.000000000 +0200
+@@ -6420,6 +6420,11 @@
+ #else
+ have_csv_db= SHOW_OPTION_NO;
+ #endif
++#ifdef HAVE_SPHINX_DB
++ have_sphinx_db= SHOW_OPTION_YES;
++#else
++ have_sphinx_db= SHOW_OPTION_NO;
++#endif
+ #ifdef HAVE_NDBCLUSTER_DB
+ have_ndbcluster=SHOW_OPTION_DISABLED;
+ #else
+@@ -7457,6 +7462,7 @@
+ #undef have_example_db
+ #undef have_archive_db
+ #undef have_csv_db
++#undef have_sphinx_db
+ #undef have_federated_db
+ #undef have_partition_db
+ #undef have_blackhole_db
+@@ -7467,6 +7473,7 @@
+ SHOW_COMP_OPTION have_example_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_archive_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_csv_db= SHOW_OPTION_NO;
++SHOW_COMP_OPTION have_sphinx_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_federated_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_partition_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_blackhole_db= SHOW_OPTION_NO;
+diff -B -N -r -u mysql-5.0.22/sql/mysql_priv.h mysql-5.0.22.sx/sql/mysql_priv.h
+--- mysql-5.0.22/sql/mysql_priv.h 2006-05-25 10:56:43.000000000 +0200
++++ mysql-5.0.22.sx/sql/mysql_priv.h 2006-06-06 19:49:38.000000000 +0200
+@@ -1279,6 +1279,12 @@
+ #else
+ extern SHOW_COMP_OPTION have_csv_db;
+ #endif
++#ifdef HAVE_SPHINX_DB
++extern handlerton sphinx_hton;
++#define have_sphinx_db sphinx_hton.state
++#else
++extern SHOW_COMP_OPTION have_sphinx_db;
++#endif
+ #ifdef HAVE_FEDERATED_DB
+ extern handlerton federated_hton;
+ #define have_federated_db federated_hton.state
+diff -B -N -r -u mysql-5.0.22/sql/set_var.cc mysql-5.0.22.sx/sql/set_var.cc
+--- mysql-5.0.22/sql/set_var.cc 2006-05-25 10:56:41.000000000 +0200
++++ mysql-5.0.22.sx/sql/set_var.cc 2006-06-06 19:49:38.000000000 +0200
+@@ -809,6 +809,7 @@
+ {"have_compress", (char*) &have_compress, SHOW_HAVE},
+ {"have_crypt", (char*) &have_crypt, SHOW_HAVE},
+ {"have_csv", (char*) &have_csv_db, SHOW_HAVE},
++ {"have_sphinx", (char*) &have_sphinx_db, SHOW_HAVE},
+ {"have_example_engine", (char*) &have_example_db, SHOW_HAVE},
+ {"have_federated_engine", (char*) &have_federated_db, SHOW_HAVE},
+ {"have_geometry", (char*) &have_geometry, SHOW_HAVE},
+diff -B -N -r -u mysql-5.0.22/sql/sql_lex.h mysql-5.0.22.sx/sql/sql_lex.h
+--- mysql-5.0.22/sql/sql_lex.h 2006-05-25 10:56:41.000000000 +0200
++++ mysql-5.0.22.sx/sql/sql_lex.h 2006-06-06 19:49:38.000000000 +0200
+@@ -58,6 +58,7 @@
+ SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS,
+ SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_LOGS, SQLCOM_SHOW_STATUS,
+ SQLCOM_SHOW_INNODB_STATUS, SQLCOM_SHOW_NDBCLUSTER_STATUS, SQLCOM_SHOW_MUTEX_STATUS,
++ SQLCOM_SHOW_SPHINX_STATUS,
+ SQLCOM_SHOW_PROCESSLIST, SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT,
+ SQLCOM_SHOW_GRANTS, SQLCOM_SHOW_CREATE, SQLCOM_SHOW_CHARSETS,
+ SQLCOM_SHOW_COLLATIONS, SQLCOM_SHOW_CREATE_DB, SQLCOM_SHOW_TABLE_STATUS,
+diff -B -N -r -u mysql-5.0.22/sql/sql_parse.cc mysql-5.0.22.sx/sql/sql_parse.cc
+--- mysql-5.0.22/sql/sql_parse.cc 2006-05-25 10:56:41.000000000 +0200
++++ mysql-5.0.22.sx/sql/sql_parse.cc 2006-06-06 19:49:38.000000000 +0200
+@@ -25,6 +25,9 @@
+ #ifdef HAVE_INNOBASE_DB
+ #include "ha_innodb.h"
+ #endif
++#ifdef HAVE_SPHINX_DB
++#include "sphinx/ha_sphinx.h"
++#endif
+
+ #ifdef HAVE_NDBCLUSTER_DB
+ #include "ha_ndbcluster.h"
+@@ -2722,6 +2725,15 @@
+ break;
+ }
+ #endif
++#ifdef HAVE_SPHINX_DB
++ case SQLCOM_SHOW_SPHINX_STATUS:
++ {
++ if (check_global_access(thd, SUPER_ACL))
++ goto error;
++ res = sphinx_show_status(thd);
++ break;
++ }
++#endif
+ #ifdef HAVE_REPLICATION
+ case SQLCOM_LOAD_MASTER_TABLE:
+ {
+diff -B -N -r -u mysql-5.0.22/sql/sql_yacc.yy mysql-5.0.22.sx/sql/sql_yacc.yy
+--- mysql-5.0.22/sql/sql_yacc.yy 2006-05-25 10:56:43.000000000 +0200
++++ mysql-5.0.22.sx/sql/sql_yacc.yy 2006-06-06 19:49:38.000000000 +0200
+@@ -6584,6 +6584,9 @@
+ case DB_TYPE_INNODB:
+ Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS;
+ break;
++ case DB_TYPE_SPHINX_DB:
++ Lex->sql_command = SQLCOM_SHOW_SPHINX_STATUS;
++ break;
+ default:
+ my_error(ER_NOT_SUPPORTED_YET, MYF(0), "STATUS");
+ YYABORT;
diff -uNr mysql-5.1.49.orig/storage/sphinx/sphinx.5.0.27.diff mysql-5.1.49/storage/sphinx/sphinx.5.0.27.diff
--- mysql-5.1.49.orig/storage/sphinx/sphinx.5.0.27.diff 1970-01-01 09:00:00.000000000 +0900
+++ mysql-5.1.49/storage/sphinx/sphinx.5.0.27.diff 2006-12-15 08:13:25.000000000 +0900
@@ -0,0 +1,284 @@
+diff -B -N -r -u mysql-5.0.22/config/ac-macros/ha_sphinx.m4 mysql-5.0.22.sx/config/ac-macros/ha_sphinx.m4
+--- mysql-5.0.22/config/ac-macros/ha_sphinx.m4 1970-01-01 01:00:00.000000000 +0100
++++ mysql-5.0.22.sx/config/ac-macros/ha_sphinx.m4 2006-06-06 19:49:38.000000000 +0200
+@@ -0,0 +1,30 @@
++dnl ---------------------------------------------------------------------------
++dnl Macro: MYSQL_CHECK_EXAMPLEDB
++dnl Sets HAVE_SPHINX_DB if --with-sphinx-storage-engine is used
++dnl ---------------------------------------------------------------------------
++AC_DEFUN([MYSQL_CHECK_SPHINXDB], [
++ AC_ARG_WITH([sphinx-storage-engine],
++ [
++ --with-sphinx-storage-engine
++ Enable the Sphinx Storage Engine],
++ [sphinxdb="$withval"],
++ [sphinxdb=no])
++ AC_MSG_CHECKING([for example storage engine])
++
++ case "$sphinxdb" in
++ yes )
++ AC_DEFINE([HAVE_SPHINX_DB], [1], [Builds Sphinx Engine])
++ AC_MSG_RESULT([yes])
++ [sphinxdb=yes]
++ ;;
++ * )
++ AC_MSG_RESULT([no])
++ [sphinxdb=no]
++ ;;
++ esac
++
++])
++dnl ---------------------------------------------------------------------------
++dnl END OF MYSQL_CHECK_EXAMPLE SECTION
++dnl ---------------------------------------------------------------------------
++
+diff -B -N -r -u mysql-5.0.22/configure.in mysql-5.0.22.sx/configure.in
+--- mysql-5.0.22/configure.in 2006-05-25 10:56:45.000000000 +0200
++++ mysql-5.0.22.sx/configure.in 2006-06-06 19:49:38.000000000 +0200
+@@ -41,6 +41,7 @@
+ sinclude(config/ac-macros/ha_berkeley.m4)
+ sinclude(config/ac-macros/ha_blackhole.m4)
+ sinclude(config/ac-macros/ha_example.m4)
++sinclude(config/ac-macros/ha_sphinx.m4)
+ sinclude(config/ac-macros/ha_federated.m4)
+ sinclude(config/ac-macros/ha_innodb.m4)
+ sinclude(config/ac-macros/ha_ndbcluster.m4)
+@@ -2450,6 +2451,7 @@
+ MYSQL_CHECK_BDB
+ MYSQL_CHECK_INNODB
+ MYSQL_CHECK_EXAMPLEDB
++MYSQL_CHECK_SPHINXDB
+ MYSQL_CHECK_ARCHIVEDB
+ MYSQL_CHECK_CSVDB
+ MYSQL_CHECK_BLACKHOLEDB
+diff -B -N -r -u mysql-5.0.22/libmysqld/Makefile.am mysql-5.0.22.sx/libmysqld/Makefile.am
+--- mysql-5.0.22/libmysqld/Makefile.am 2006-05-25 10:56:55.000000000 +0200
++++ mysql-5.0.22.sx/libmysqld/Makefile.am 2006-06-06 19:49:38.000000000 +0200
+@@ -27,7 +27,7 @@
+ -DSHAREDIR="\"$(MYSQLSHAREdir)\""
+ INCLUDES= @bdb_includes@ \
+ -I$(top_builddir)/include -I$(top_srcdir)/include \
+- -I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples \
++ -I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples -I$(top_srcdir)/sql/sphinx \
+ -I$(top_srcdir)/regex \
+ $(openssl_includes) $(yassl_includes) @ZLIB_INCLUDES@
+
+@@ -38,6 +38,7 @@
+ libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \
+ my_time.c
+ sqlexamplessources = ha_example.cc ha_tina.cc
++sqlsphinxsources = ha_sphinx.cc
+
+ noinst_HEADERS = embedded_priv.h emb_qcache.h
+
+@@ -65,7 +66,7 @@
+ parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
+ ha_blackhole.cc ha_archive.cc my_user.c
+
+-libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources)
++libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources) $(sqlsphinxsources)
+ libmysqld_a_SOURCES=
+
+ # automake misses these
+@@ -133,12 +134,16 @@
+ rm -f $$f; \
+ @LN_CP_F@ $(top_srcdir)/sql/examples/$$f $$f; \
+ done; \
++ for f in $(sqlsphinxsources); do \
++ rm -f $$f; \
++ @LN_CP_F@ $(top_srcdir)/sql/sphinx/$$f $$f; \
++ done; \
+ rm -f client_settings.h; \
+ @LN_CP_F@ $(top_srcdir)/libmysql/client_settings.h client_settings.h
+
+
+ clean-local:
+- rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) | sed "s;\.lo;.c;g"` \
++ rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) $(sqlsphinxsources) | sed "s;\.lo;.c;g"` \
+ $(top_srcdir)/linked_libmysqld_sources; \
+ rm -f client_settings.h
+
+diff -B -N -r -u mysql-5.0.22/sql/handler.cc mysql-5.0.22.sx/sql/handler.cc
+--- mysql-5.0.22/sql/handler.cc 2006-05-25 10:56:42.000000000 +0200
++++ mysql-5.0.22.sx/sql/handler.cc 2006-06-06 19:49:38.000000000 +0200
+@@ -78,6 +78,15 @@
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ HTON_NO_FLAGS };
+ #endif
++#ifdef HAVE_SPHINX_DB
++#include "sphinx/ha_sphinx.h"
++extern handlerton sphinx_hton;
++#else
++handlerton sphinx_hton = { "SPHINX", SHOW_OPTION_NO, "SPHINX storage engine",
++ DB_TYPE_SPHINX_DB, NULL, 0, 0, NULL, NULL,
++ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++ HTON_NO_FLAGS };
++#endif
+ #ifdef HAVE_INNOBASE_DB
+ #include "ha_innodb.h"
+ extern handlerton innobase_hton;
+@@ -147,6 +156,7 @@
+ &example_hton,
+ &archive_hton,
+ &tina_hton,
++ &sphinx_hton,
+ &ndbcluster_hton,
+ &federated_hton,
+ &myisammrg_hton,
+@@ -345,6 +355,12 @@
+ return new (alloc) ha_tina(table);
+ return NULL;
+ #endif
++#ifdef HAVE_SPHINX_DB
++ case DB_TYPE_SPHINX_DB:
++ if (have_sphinx_db == SHOW_OPTION_YES)
++ return new (alloc) ha_sphinx(table);
++ return NULL;
++#endif
+ #ifdef HAVE_NDBCLUSTER_DB
+ case DB_TYPE_NDBCLUSTER:
+ if (have_ndbcluster == SHOW_OPTION_YES)
+diff -B -N -r -u mysql-5.0.22/sql/handler.h mysql-5.0.22.sx/sql/handler.h
+--- mysql-5.0.22/sql/handler.h 2006-05-25 10:56:55.000000000 +0200
++++ mysql-5.0.22.sx/sql/handler.h 2006-06-06 19:49:38.000000000 +0200
+@@ -183,8 +183,9 @@
+ DB_TYPE_BERKELEY_DB, DB_TYPE_INNODB,
+ DB_TYPE_GEMINI, DB_TYPE_NDBCLUSTER,
+ DB_TYPE_EXAMPLE_DB, DB_TYPE_ARCHIVE_DB, DB_TYPE_CSV_DB,
+- DB_TYPE_FEDERATED_DB,
++ DB_TYPE_FEDERATED_DB,
+ DB_TYPE_BLACKHOLE_DB,
++ DB_TYPE_SPHINX_DB,
+ DB_TYPE_DEFAULT // Must be last
+ };
+
+diff -B -N -r -u mysql-5.0.22/sql/Makefile.am mysql-5.0.22.sx/sql/Makefile.am
+--- mysql-5.0.22/sql/Makefile.am 2006-05-25 10:56:41.000000000 +0200
++++ mysql-5.0.22.sx/sql/Makefile.am 2006-06-06 19:49:38.000000000 +0200
+@@ -66,6 +66,7 @@
+ sql_array.h sql_cursor.h \
+ examples/ha_example.h ha_archive.h \
+ examples/ha_tina.h ha_blackhole.h \
++ sphinx/ha_sphinx.h \
+ ha_federated.h
+ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
+ item.cc item_sum.cc item_buff.cc item_func.cc \
+@@ -102,6 +103,7 @@
+ sp_cache.cc parse_file.cc sql_trigger.cc \
+ examples/ha_example.cc ha_archive.cc \
+ examples/ha_tina.cc ha_blackhole.cc \
++ sphinx/ha_sphinx.cc \
+ ha_federated.cc
+
+ gen_lex_hash_SOURCES = gen_lex_hash.cc
+diff -B -N -r -u mysql-5.0.22/sql/mysqld.cc mysql-5.0.22.sx/sql/mysqld.cc
+--- mysql-5.0.22/sql/mysqld.cc 2006-05-25 10:56:41.000000000 +0200
++++ mysql-5.0.22.sx/sql/mysqld.cc 2006-06-06 19:49:38.000000000 +0200
+@@ -6420,6 +6420,11 @@
+ #else
+ have_csv_db= SHOW_OPTION_NO;
+ #endif
++#ifdef HAVE_SPHINX_DB
++ have_sphinx_db= SHOW_OPTION_YES;
++#else
++ have_sphinx_db= SHOW_OPTION_NO;
++#endif
+ #ifdef HAVE_NDBCLUSTER_DB
+ have_ndbcluster=SHOW_OPTION_DISABLED;
+ #else
+@@ -7457,6 +7462,7 @@
+ #undef have_example_db
+ #undef have_archive_db
+ #undef have_csv_db
++#undef have_sphinx_db
+ #undef have_federated_db
+ #undef have_partition_db
+ #undef have_blackhole_db
+@@ -7467,6 +7473,7 @@
+ SHOW_COMP_OPTION have_example_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_archive_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_csv_db= SHOW_OPTION_NO;
++SHOW_COMP_OPTION have_sphinx_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_federated_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_partition_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_blackhole_db= SHOW_OPTION_NO;
+diff -B -N -r -u mysql-5.0.22/sql/mysql_priv.h mysql-5.0.22.sx/sql/mysql_priv.h
+--- mysql-5.0.22/sql/mysql_priv.h 2006-05-25 10:56:43.000000000 +0200
++++ mysql-5.0.22.sx/sql/mysql_priv.h 2006-06-06 19:49:38.000000000 +0200
+@@ -1279,6 +1279,12 @@
+ #else
+ extern SHOW_COMP_OPTION have_csv_db;
+ #endif
++#ifdef HAVE_SPHINX_DB
++extern handlerton sphinx_hton;
++#define have_sphinx_db sphinx_hton.state
++#else
++extern SHOW_COMP_OPTION have_sphinx_db;
++#endif
+ #ifdef HAVE_FEDERATED_DB
+ extern handlerton federated_hton;
+ #define have_federated_db federated_hton.state
+diff -B -N -r -u mysql-5.0.22/sql/set_var.cc mysql-5.0.22.sx/sql/set_var.cc
+--- mysql-5.0.22/sql/set_var.cc 2006-05-25 10:56:41.000000000 +0200
++++ mysql-5.0.22.sx/sql/set_var.cc 2006-06-06 19:49:38.000000000 +0200
+@@ -864,6 +864,7 @@
+ {"have_compress", (char*) &have_compress, SHOW_HAVE},
+ {"have_crypt", (char*) &have_crypt, SHOW_HAVE},
+ {"have_csv", (char*) &have_csv_db, SHOW_HAVE},
++ {"have_sphinx", (char*) &have_sphinx_db, SHOW_HAVE},
+ {"have_dynamic_loading", (char*) &have_dlopen, SHOW_HAVE},
+ {"have_example_engine", (char*) &have_example_db, SHOW_HAVE},
+ {"have_federated_engine", (char*) &have_federated_db, SHOW_HAVE},
+diff -B -N -r -u mysql-5.0.22/sql/sql_lex.h mysql-5.0.22.sx/sql/sql_lex.h
+--- mysql-5.0.22/sql/sql_lex.h 2006-05-25 10:56:41.000000000 +0200
++++ mysql-5.0.22.sx/sql/sql_lex.h 2006-06-06 19:49:38.000000000 +0200
+@@ -58,6 +58,7 @@
+ SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS,
+ SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_LOGS, SQLCOM_SHOW_STATUS,
+ SQLCOM_SHOW_INNODB_STATUS, SQLCOM_SHOW_NDBCLUSTER_STATUS, SQLCOM_SHOW_MUTEX_STATUS,
++ SQLCOM_SHOW_SPHINX_STATUS,
+ SQLCOM_SHOW_PROCESSLIST, SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT,
+ SQLCOM_SHOW_GRANTS, SQLCOM_SHOW_CREATE, SQLCOM_SHOW_CHARSETS,
+ SQLCOM_SHOW_COLLATIONS, SQLCOM_SHOW_CREATE_DB, SQLCOM_SHOW_TABLE_STATUS,
+diff -B -N -r -u mysql-5.0.22/sql/sql_parse.cc mysql-5.0.22.sx/sql/sql_parse.cc
+--- mysql-5.0.22/sql/sql_parse.cc 2006-05-25 10:56:41.000000000 +0200
++++ mysql-5.0.22.sx/sql/sql_parse.cc 2006-06-06 19:49:38.000000000 +0200
+@@ -25,6 +25,9 @@
+ #ifdef HAVE_INNOBASE_DB
+ #include "ha_innodb.h"
+ #endif
++#ifdef HAVE_SPHINX_DB
++#include "sphinx/ha_sphinx.h"
++#endif
+
+ #ifdef HAVE_NDBCLUSTER_DB
+ #include "ha_ndbcluster.h"
+@@ -2722,6 +2725,15 @@
+ break;
+ }
+ #endif
++#ifdef HAVE_SPHINX_DB
++ case SQLCOM_SHOW_SPHINX_STATUS:
++ {
++ if (check_global_access(thd, SUPER_ACL))
++ goto error;
++ res = sphinx_show_status(thd);
++ break;
++ }
++#endif
+ #ifdef HAVE_REPLICATION
+ case SQLCOM_LOAD_MASTER_TABLE:
+ {
+diff -B -N -r -u mysql-5.0.22/sql/sql_yacc.yy mysql-5.0.22.sx/sql/sql_yacc.yy
+--- mysql-5.0.22/sql/sql_yacc.yy 2006-05-25 10:56:43.000000000 +0200
++++ mysql-5.0.22.sx/sql/sql_yacc.yy 2006-06-06 19:49:38.000000000 +0200
+@@ -6584,6 +6584,9 @@
+ case DB_TYPE_INNODB:
+ Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS;
+ break;
++ case DB_TYPE_SPHINX_DB:
++ Lex->sql_command = SQLCOM_SHOW_SPHINX_STATUS;
++ break;
+ default:
+ my_error(ER_NOT_SUPPORTED_YET, MYF(0), "STATUS");
+ YYABORT;
diff -uNr mysql-5.1.49.orig/storage/sphinx/sphinx.5.0.37.diff mysql-5.1.49/storage/sphinx/sphinx.5.0.37.diff
--- mysql-5.1.49.orig/storage/sphinx/sphinx.5.0.37.diff 1970-01-01 09:00:00.000000000 +0900
+++ mysql-5.1.49/storage/sphinx/sphinx.5.0.37.diff 2009-02-14 22:57:42.000000000 +0900
@@ -0,0 +1,338 @@
+--- mysql-5.0.67/config/ac-macros/ha_sphinx.m4 1970-01-01 10:00:00.000000000 +1000
++++ mysql-5.0.67-sphinx/config/ac-macros/ha_sphinx.m4 2009-02-14 09:15:48.000000000 +1000
+@@ -0,0 +1,30 @@
++dnl ---------------------------------------------------------------------------
++dnl Macro: MYSQL_CHECK_EXAMPLEDB
++dnl Sets HAVE_SPHINX_DB if --with-sphinx-storage-engine is used
++dnl ---------------------------------------------------------------------------
++AC_DEFUN([MYSQL_CHECK_SPHINXDB], [
++ AC_ARG_WITH([sphinx-storage-engine],
++ [
++ --with-sphinx-storage-engine
++ Enable the Sphinx Storage Engine],
++ [sphinxdb="$withval"],
++ [sphinxdb=no])
++ AC_MSG_CHECKING([for example storage engine])
++
++ case "$sphinxdb" in
++ yes )
++ AC_DEFINE([HAVE_SPHINX_DB], [1], [Builds Sphinx Engine])
++ AC_MSG_RESULT([yes])
++ [sphinxdb=yes]
++ ;;
++ * )
++ AC_MSG_RESULT([no])
++ [sphinxdb=no]
++ ;;
++ esac
++
++])
++dnl ---------------------------------------------------------------------------
++dnl END OF MYSQL_CHECK_EXAMPLE SECTION
++dnl ---------------------------------------------------------------------------
++
+--- mysql-5.0.67/configure.in 2008-08-04 23:19:07.000000000 +1100
++++ mysql-5.0.67-sphinx/configure.in 2009-02-14 09:15:48.000000000 +1000
+@@ -58,6 +58,7 @@
+ sinclude(config/ac-macros/ha_berkeley.m4)
+ sinclude(config/ac-macros/ha_blackhole.m4)
+ sinclude(config/ac-macros/ha_example.m4)
++sinclude(config/ac-macros/ha_sphinx.m4)
+ sinclude(config/ac-macros/ha_federated.m4)
+ sinclude(config/ac-macros/ha_innodb.m4)
+ sinclude(config/ac-macros/ha_ndbcluster.m4)
+@@ -2625,6 +2626,7 @@
+ MYSQL_CHECK_BDB
+ MYSQL_CHECK_INNODB
+ MYSQL_CHECK_EXAMPLEDB
++MYSQL_CHECK_SPHINXDB
+ MYSQL_CHECK_ARCHIVEDB
+ MYSQL_CHECK_CSVDB
+ MYSQL_CHECK_BLACKHOLEDB
+--- mysql-5.0.67/libmysqld/Makefile.am 2008-08-04 23:19:18.000000000 +1100
++++ mysql-5.0.67-sphinx/libmysqld/Makefile.am 2009-02-14 09:15:48.000000000 +1000
+@@ -29,6 +29,7 @@
+ -I$(top_builddir)/include -I$(top_srcdir)/include \
+ -I$(top_builddir)/sql -I$(top_srcdir)/sql \
+ -I$(top_srcdir)/sql/examples \
++ -I$(top_srcdir)/sql/sphinx \
+ -I$(top_srcdir)/regex \
+ $(openssl_includes) @ZLIB_INCLUDES@
+
+@@ -39,6 +40,7 @@
+ libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \
+ my_time.c
+ sqlexamplessources = ha_example.cc ha_tina.cc
++sqlsphinxsources = ha_sphinx.cc
+
+ noinst_HEADERS = embedded_priv.h emb_qcache.h
+
+@@ -67,7 +69,7 @@
+ parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
+ ha_blackhole.cc ha_archive.cc my_user.c
+
+-libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources)
++libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources) $(sqlsphinxsources)
+ libmysqld_a_SOURCES=
+
+ # automake misses these
+@@ -147,12 +149,16 @@
+ rm -f $$f; \
+ @LN_CP_F@ $(top_srcdir)/sql/examples/$$f $$f; \
+ done; \
++ for f in $(sqlsphinxsources); do \
++ rm -f $$f; \
++ @LN_CP_F@ $(top_srcdir)/sql/sphinx/$$f $$f; \
++ done; \
+ rm -f client_settings.h; \
+ @LN_CP_F@ $(top_srcdir)/libmysql/client_settings.h client_settings.h
+
+
+ clean-local:
+- rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) | sed "s;\.lo;.c;g"` \
++ rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) $(sqlsphinxsources) | sed "s;\.lo;.c;g"` \
+ $(top_srcdir)/linked_libmysqld_sources; \
+ rm -f client_settings.h
+
+--- mysql-5.0.67/sql/handler.cc 2008-08-04 23:20:04.000000000 +1100
++++ mysql-5.0.67-sphinx/sql/handler.cc 2009-02-14 09:15:48.000000000 +1000
+@@ -77,6 +77,15 @@
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ HTON_NO_FLAGS };
+ #endif
++#ifdef HAVE_SPHINX_DB
++#include "sphinx/ha_sphinx.h"
++extern handlerton sphinx_hton;
++#else
++handlerton sphinx_hton = { "SPHINX", SHOW_OPTION_NO, "SPHINX storage engine",
++ DB_TYPE_SPHINX_DB, NULL, 0, 0, NULL, NULL,
++ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++ HTON_NO_FLAGS };
++#endif
+ #ifdef HAVE_INNOBASE_DB
+ #include "ha_innodb.h"
+ extern handlerton innobase_hton;
+@@ -141,6 +150,7 @@
+ &example_hton,
+ &archive_hton,
+ &tina_hton,
++ &sphinx_hton,
+ &ndbcluster_hton,
+ &federated_hton,
+ &myisammrg_hton,
+@@ -341,6 +351,12 @@
+ return new (alloc) ha_tina(table);
+ return NULL;
+ #endif
++#ifdef HAVE_SPHINX_DB
++ case DB_TYPE_SPHINX_DB:
++ if (have_sphinx_db == SHOW_OPTION_YES)
++ return new (alloc) ha_sphinx(table);
++ return NULL;
++#endif
+ #ifdef HAVE_NDBCLUSTER_DB
+ case DB_TYPE_NDBCLUSTER:
+ if (have_ndbcluster == SHOW_OPTION_YES)
+--- mysql-5.0.67/sql/handler.h 2008-08-04 23:20:04.000000000 +1100
++++ mysql-5.0.67-sphinx/sql/handler.h 2009-02-14 09:15:48.000000000 +1000
+@@ -186,8 +186,9 @@
+ DB_TYPE_BERKELEY_DB, DB_TYPE_INNODB,
+ DB_TYPE_GEMINI, DB_TYPE_NDBCLUSTER,
+ DB_TYPE_EXAMPLE_DB, DB_TYPE_ARCHIVE_DB, DB_TYPE_CSV_DB,
+- DB_TYPE_FEDERATED_DB,
++ DB_TYPE_FEDERATED_DB,
+ DB_TYPE_BLACKHOLE_DB,
++ DB_TYPE_SPHINX_DB,
+ DB_TYPE_DEFAULT // Must be last
+ };
+
+--- mysql-5.0.67/sql/Makefile.am 2008-08-04 23:20:02.000000000 +1100
++++ mysql-5.0.67-sphinx/sql/Makefile.am 2009-02-14 09:23:28.000000000 +1000
+@@ -68,6 +68,7 @@
+ sql_array.h sql_cursor.h \
+ examples/ha_example.h ha_archive.h \
+ examples/ha_tina.h ha_blackhole.h \
++ sphinx/ha_sphinx.h \
+ ha_federated.h
+ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
+ item.cc item_sum.cc item_buff.cc item_func.cc \
+@@ -105,6 +106,7 @@
+ sp_cache.cc parse_file.cc sql_trigger.cc \
+ examples/ha_example.cc ha_archive.cc \
+ examples/ha_tina.cc ha_blackhole.cc \
++ sphinx/ha_sphinx.cc \
+ ha_federated.cc
+
+ gen_lex_hash_SOURCES = gen_lex_hash.cc
+@@ -174,6 +176,10 @@
+ udf_example_la_SOURCES= udf_example.c
+ udf_example_la_LDFLAGS= -module -rpath $(pkglibdir)
+
++pkglib_LTLIBRARIES = sphinx/sphinx.la
++sphinx_sphinx_la_SOURCES = sphinx/snippets_udf.cc
++sphinx_sphinx_la_LDFLAGS = -module
++
+
+ # Don't update the files from bitkeeper
+ %::SCCS/s.%
+--- mysql-5.0.67/sql/mysqld.cc 2008-08-04 23:20:07.000000000 +1100
++++ mysql-5.0.67-sphinx/sql/mysqld.cc 2009-02-14 09:15:48.000000000 +1000
+@@ -36,6 +36,10 @@
+ #include <sys/prctl.h>
+ #endif
+
++#ifdef HAVE_SPHINX_DB
++#include "sphinx/ha_sphinx.h"
++#endif
++
+ #ifdef HAVE_INNOBASE_DB
+ #define OPT_INNODB_DEFAULT 1
+ #else
+@@ -6633,6 +6637,13 @@
+ {"Threads_running", (char*) &thread_running, SHOW_INT_CONST},
+ {"Uptime", (char*) 0, SHOW_STARTTIME},
+ {"Uptime_since_flush_status",(char*) 0, SHOW_FLUSHTIME},
++#ifdef HAVE_SPHINX_DB
++ {"sphinx_total", (char *)sphinx_showfunc_total, SHOW_SPHINX_FUNC},
++ {"sphinx_total_found", (char *)sphinx_showfunc_total_found, SHOW_SPHINX_FUNC},
++ {"sphinx_time", (char *)sphinx_showfunc_time, SHOW_SPHINX_FUNC},
++ {"sphinx_word_count", (char *)sphinx_showfunc_word_count, SHOW_SPHINX_FUNC},
++ {"sphinx_words", (char *)sphinx_showfunc_words, SHOW_SPHINX_FUNC},
++#endif
+ {NullS, NullS, SHOW_LONG}
+ };
+
+@@ -6875,6 +6886,11 @@
+ #else
+ have_csv_db= SHOW_OPTION_NO;
+ #endif
++#ifdef HAVE_SPHINX_DB
++ have_sphinx_db= SHOW_OPTION_YES;
++#else
++ have_sphinx_db= SHOW_OPTION_NO;
++#endif
+ #ifdef HAVE_NDBCLUSTER_DB
+ have_ndbcluster=SHOW_OPTION_DISABLED;
+ #else
+@@ -7983,6 +7999,7 @@
+ #undef have_example_db
+ #undef have_archive_db
+ #undef have_csv_db
++#undef have_sphinx_db
+ #undef have_federated_db
+ #undef have_partition_db
+ #undef have_blackhole_db
+@@ -7993,6 +8010,7 @@
+ SHOW_COMP_OPTION have_example_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_archive_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_csv_db= SHOW_OPTION_NO;
++SHOW_COMP_OPTION have_sphinx_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_federated_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_partition_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_blackhole_db= SHOW_OPTION_NO;
+--- mysql-5.0.67/sql/mysql_priv.h 2008-08-04 23:20:07.000000000 +1100
++++ mysql-5.0.67-sphinx/sql/mysql_priv.h 2009-02-14 09:15:48.000000000 +1000
+@@ -1439,6 +1439,12 @@
+ #else
+ extern SHOW_COMP_OPTION have_csv_db;
+ #endif
++#ifdef HAVE_SPHINX_DB
++extern handlerton sphinx_hton;
++#define have_sphinx_db sphinx_hton.state
++#else
++extern SHOW_COMP_OPTION have_sphinx_db;
++#endif
+ #ifdef HAVE_FEDERATED_DB
+ extern handlerton federated_hton;
+ #define have_federated_db federated_hton.state
+--- mysql-5.0.67/sql/set_var.cc 2008-08-04 23:20:08.000000000 +1100
++++ mysql-5.0.67-sphinx/sql/set_var.cc 2009-02-14 09:15:48.000000000 +1000
+@@ -888,6 +888,7 @@
+ {"have_compress", (char*) &have_compress, SHOW_HAVE},
+ {"have_crypt", (char*) &have_crypt, SHOW_HAVE},
+ {"have_csv", (char*) &have_csv_db, SHOW_HAVE},
++ {"have_sphinx", (char*) &have_sphinx_db, SHOW_HAVE},
+ {"have_dynamic_loading", (char*) &have_dlopen, SHOW_HAVE},
+ {"have_example_engine", (char*) &have_example_db, SHOW_HAVE},
+ {"have_federated_engine", (char*) &have_federated_db, SHOW_HAVE},
+--- mysql-5.0.67/sql/sql_lex.h 2008-08-04 23:20:10.000000000 +1100
++++ mysql-5.0.67-sphinx/sql/sql_lex.h 2009-02-14 09:15:48.000000000 +1000
+@@ -57,6 +57,7 @@
+ SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS,
+ SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_LOGS, SQLCOM_SHOW_STATUS,
+ SQLCOM_SHOW_INNODB_STATUS, SQLCOM_SHOW_NDBCLUSTER_STATUS, SQLCOM_SHOW_MUTEX_STATUS,
++ SQLCOM_SHOW_SPHINX_STATUS,
+ SQLCOM_SHOW_PROCESSLIST, SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT,
+ SQLCOM_SHOW_GRANTS, SQLCOM_SHOW_CREATE, SQLCOM_SHOW_CHARSETS,
+ SQLCOM_SHOW_COLLATIONS, SQLCOM_SHOW_CREATE_DB, SQLCOM_SHOW_TABLE_STATUS,
+--- mysql-5.0.67/sql/sql_parse.cc 2008-08-04 23:20:10.000000000 +1100
++++ mysql-5.0.67-sphinx/sql/sql_parse.cc 2009-02-14 09:15:48.000000000 +1000
+@@ -24,6 +24,9 @@
+ #ifdef HAVE_INNOBASE_DB
+ #include "ha_innodb.h"
+ #endif
++#ifdef HAVE_SPHINX_DB
++#include "sphinx/ha_sphinx.h"
++#endif
+
+ #ifdef HAVE_NDBCLUSTER_DB
+ #include "ha_ndbcluster.h"
+@@ -3006,6 +3009,15 @@
+ break;
+ }
+ #endif
++#ifdef HAVE_SPHINX_DB
++ case SQLCOM_SHOW_SPHINX_STATUS:
++ {
++ if (check_global_access(thd, SUPER_ACL))
++ goto error;
++ res = sphinx_show_status(thd);
++ break;
++ }
++#endif
+ #ifdef HAVE_REPLICATION
+ case SQLCOM_LOAD_MASTER_TABLE:
+ {
+--- mysql-5.0.67/sql/sql_yacc.yy 2008-08-04 23:20:12.000000000 +1100
++++ mysql-5.0.67-sphinx/sql/sql_yacc.yy 2009-02-14 09:15:48.000000000 +1000
+@@ -7393,6 +7393,9 @@
+ case DB_TYPE_INNODB:
+ Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS;
+ break;
++ case DB_TYPE_SPHINX_DB:
++ Lex->sql_command = SQLCOM_SHOW_SPHINX_STATUS;
++ break;
+ default:
+ my_error(ER_NOT_SUPPORTED_YET, MYF(0), "STATUS");
+ MYSQL_YYABORT;
+--- mysql-5.0.67/sql/structs.h 2008-08-04 23:20:12.000000000 +1100
++++ mysql-5.0.67-sphinx/sql/structs.h 2009-02-14 09:15:48.000000000 +1000
+@@ -188,6 +188,9 @@
+ SHOW_SSL_CTX_SESS_TIMEOUTS, SHOW_SSL_CTX_SESS_CACHE_FULL,
+ SHOW_SSL_GET_CIPHER_LIST,
+ #endif /* HAVE_OPENSSL */
++#ifdef HAVE_SPHINX_DB
++ SHOW_SPHINX_FUNC,
++#endif
+ SHOW_NET_COMPRESSION,
+ SHOW_RPL_STATUS, SHOW_SLAVE_RUNNING, SHOW_SLAVE_RETRIED_TRANS,
+ SHOW_KEY_CACHE_LONG, SHOW_KEY_CACHE_CONST_LONG, SHOW_KEY_CACHE_LONGLONG,
+--- mysql-5.0.67/sql/sql_show.cc 2008-08-04 23:20:11.000000000 +1100
++++ mysql-5.0.67-sphinx/sql/sql_show.cc 2009-02-14 09:15:48.000000000 +1000
+@@ -1473,6 +1473,16 @@
+ value= (char*) ((sys_var*) value)->value_ptr(thd, value_type,
+ &null_lex_str);
+ }
++ #ifdef HAVE_SPHINX_DB
++ else if (show_type == SHOW_SPHINX_FUNC)
++ {
++ SHOW_VAR var;
++ ((int (*)(THD *, SHOW_VAR *, char *))value)(thd, &var, buff);
++
++ value = var.value;
++ show_type = var.type;
++ }
++ #endif /* HAVE_SPHINX_DB */
+
+ pos= end= buff;
+ switch (show_type) {
diff -uNr mysql-5.1.49.orig/storage/sphinx/sphinx.5.0.91.diff mysql-5.1.49/storage/sphinx/sphinx.5.0.91.diff
--- mysql-5.1.49.orig/storage/sphinx/sphinx.5.0.91.diff 1970-01-01 09:00:00.000000000 +0900
+++ mysql-5.1.49/storage/sphinx/sphinx.5.0.91.diff 2010-07-07 05:03:30.000000000 +0900
@@ -0,0 +1,400 @@
+diff -r 319c65835581 CMakeLists.txt
+--- a/CMakeLists.txt Sun Jun 20 15:15:01 2010 +0400
++++ b/CMakeLists.txt Sun Jun 20 15:59:31 2010 +0400
+@@ -70,6 +70,10 @@
+ ADD_DEFINITIONS(-DHAVE_INNOBASE_DB)
+ ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
+
++IF(WITH_SPHINX_STORAGE_ENGINE)
++ ADD_DEFINITIONS(-DHAVE_SPHINX_DB)
++ENDIF(WITH_SPHINX_STORAGE_ENGINE)
++
+ SET(localstatedir "C:\\mysql\\data")
+ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-huge.cnf.sh
+ ${CMAKE_SOURCE_DIR}/support-files/my-huge.ini @ONLY)
+diff -r 319c65835581 configure.in
+--- a/configure.in Sun Jun 20 15:15:01 2010 +0400
++++ b/configure.in Sun Jun 20 15:59:31 2010 +0400
+@@ -60,6 +60,7 @@
+ sinclude(config/ac-macros/ha_berkeley.m4)
+ sinclude(config/ac-macros/ha_blackhole.m4)
+ sinclude(config/ac-macros/ha_example.m4)
++sinclude(config/ac-macros/ha_sphinx.m4)
+ sinclude(config/ac-macros/ha_federated.m4)
+ sinclude(config/ac-macros/ha_innodb.m4)
+ sinclude(config/ac-macros/ha_ndbcluster.m4)
+@@ -2696,6 +2697,7 @@
+ MYSQL_CHECK_BDB
+ MYSQL_CHECK_INNODB
+ MYSQL_CHECK_EXAMPLEDB
++MYSQL_CHECK_SPHINXDB
+ MYSQL_CHECK_ARCHIVEDB
+ MYSQL_CHECK_CSVDB
+ MYSQL_CHECK_BLACKHOLEDB
+diff -r 319c65835581 libmysqld/Makefile.am
+--- a/libmysqld/Makefile.am Sun Jun 20 15:15:01 2010 +0400
++++ b/libmysqld/Makefile.am Sun Jun 20 15:59:31 2010 +0400
+@@ -29,6 +29,7 @@
+ -I$(top_builddir)/include -I$(top_srcdir)/include \
+ -I$(top_builddir)/sql -I$(top_srcdir)/sql \
+ -I$(top_srcdir)/sql/examples \
++ -I$(top_srcdir)/sql/sphinx \
+ -I$(top_srcdir)/regex \
+ $(openssl_includes) @ZLIB_INCLUDES@
+
+@@ -39,6 +40,7 @@
+ libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \
+ my_time.c
+ sqlexamplessources = ha_example.cc ha_tina.cc
++sqlsphinxsources = ha_sphinx.cc
+
+ noinst_HEADERS = embedded_priv.h emb_qcache.h
+
+@@ -67,7 +69,7 @@
+ parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
+ ha_blackhole.cc ha_archive.cc my_user.c
+
+-libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources)
++libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources) $(sqlsphinxsources)
+ libmysqld_a_SOURCES=
+
+ # automake misses these
+@@ -147,12 +149,16 @@
+ rm -f $$f; \
+ @LN_CP_F@ $(top_srcdir)/sql/examples/$$f $$f; \
+ done; \
++ for f in $(sqlsphinxsources); do \
++ rm -f $$f; \
++ @LN_CP_F@ $(top_srcdir)/sql/sphinx/$$f $$f; \
++ done; \
+ rm -f client_settings.h; \
+ @LN_CP_F@ $(top_srcdir)/libmysql/client_settings.h client_settings.h
+
+
+ clean-local:
+- rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) | sed "s;\.lo;.c;g"` \
++ rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) $(sqlsphinxsources) | sed "s;\.lo;.c;g"` \
+ $(top_srcdir)/linked_libmysqld_sources; \
+ rm -f client_settings.h
+
+diff -r 319c65835581 sql/CMakeLists.txt
+--- a/sql/CMakeLists.txt Sun Jun 20 15:15:01 2010 +0400
++++ b/sql/CMakeLists.txt Sun Jun 20 15:59:31 2010 +0400
+@@ -50,6 +50,7 @@
+ filesort.cc gstream.cc ha_blackhole.cc
+ ha_archive.cc ha_heap.cc ha_myisam.cc ha_myisammrg.cc
+ ha_innodb.cc ha_federated.cc ha_berkeley.cc
++ sphinx/ha_sphinx.cc
+ handler.cc hash_filo.cc hash_filo.h
+ hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc
+ item_create.cc item_func.cc item_geofunc.cc item_row.cc
+diff -r 319c65835581 sql/Makefile.am
+--- a/sql/Makefile.am Sun Jun 20 15:15:01 2010 +0400
++++ b/sql/Makefile.am Sun Jun 20 15:59:31 2010 +0400
+@@ -68,6 +68,7 @@
+ sql_array.h sql_cursor.h \
+ examples/ha_example.h ha_archive.h \
+ examples/ha_tina.h ha_blackhole.h \
++ sphinx/ha_sphinx.h \
+ ha_federated.h
+ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
+ item.cc item_sum.cc item_buff.cc item_func.cc \
+@@ -105,6 +106,7 @@
+ sp_cache.cc parse_file.cc sql_trigger.cc \
+ examples/ha_example.cc ha_archive.cc \
+ examples/ha_tina.cc ha_blackhole.cc \
++ sphinx/ha_sphinx.cc \
+ ha_federated.cc
+
+ gen_lex_hash_SOURCES = gen_lex_hash.cc
+@@ -175,6 +177,10 @@
+ udf_example_la_SOURCES= udf_example.c
+ udf_example_la_LDFLAGS= -module -rpath $(pkglibdir)
+
++pkglib_LTLIBRARIES = sphinx/sphinx.la
++sphinx_sphinx_la_SOURCES = sphinx/snippets_udf.cc
++sphinx_sphinx_la_LDFLAGS = -module
++
+
+ # Don't update the files from bitkeeper
+ %::SCCS/s.%
+diff -r 319c65835581 sql/handler.cc
+--- a/sql/handler.cc Sun Jun 20 15:15:01 2010 +0400
++++ b/sql/handler.cc Sun Jun 20 15:59:31 2010 +0400
+@@ -77,6 +77,15 @@
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ HTON_NO_FLAGS };
+ #endif
++#ifdef HAVE_SPHINX_DB
++#include "sphinx/ha_sphinx.h"
++extern handlerton sphinx_hton;
++#else
++handlerton sphinx_hton = { "SPHINX", SHOW_OPTION_NO, "SPHINX storage engine",
++ DB_TYPE_SPHINX_DB, NULL, 0, 0, NULL, NULL,
++ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++ HTON_NO_FLAGS };
++#endif
+ #ifdef HAVE_INNOBASE_DB
+ #include "ha_innodb.h"
+ extern handlerton innobase_hton;
+@@ -141,6 +150,7 @@
+ &example_hton,
+ &archive_hton,
+ &tina_hton,
++ &sphinx_hton,
+ &ndbcluster_hton,
+ &federated_hton,
+ &myisammrg_hton,
+@@ -342,6 +352,12 @@
+ return new (alloc) ha_tina(table);
+ return NULL;
+ #endif
++#ifdef HAVE_SPHINX_DB
++ case DB_TYPE_SPHINX_DB:
++ if (have_sphinx_db == SHOW_OPTION_YES)
++ return new (alloc) ha_sphinx(table);
++ return NULL;
++#endif
+ #ifdef HAVE_NDBCLUSTER_DB
+ case DB_TYPE_NDBCLUSTER:
+ if (have_ndbcluster == SHOW_OPTION_YES)
+diff -r 319c65835581 sql/handler.h
+--- a/sql/handler.h Sun Jun 20 15:15:01 2010 +0400
++++ b/sql/handler.h Sun Jun 20 15:59:31 2010 +0400
+@@ -186,8 +186,9 @@
+ DB_TYPE_BERKELEY_DB, DB_TYPE_INNODB,
+ DB_TYPE_GEMINI, DB_TYPE_NDBCLUSTER,
+ DB_TYPE_EXAMPLE_DB, DB_TYPE_ARCHIVE_DB, DB_TYPE_CSV_DB,
+- DB_TYPE_FEDERATED_DB,
++ DB_TYPE_FEDERATED_DB,
+ DB_TYPE_BLACKHOLE_DB,
++ DB_TYPE_SPHINX_DB,
+ DB_TYPE_DEFAULT // Must be last
+ };
+
+diff -r 319c65835581 sql/mysql_priv.h
+--- a/sql/mysql_priv.h Sun Jun 20 15:15:01 2010 +0400
++++ b/sql/mysql_priv.h Sun Jun 20 15:59:31 2010 +0400
+@@ -1462,6 +1462,12 @@
+ #else
+ extern SHOW_COMP_OPTION have_csv_db;
+ #endif
++#ifdef HAVE_SPHINX_DB
++extern handlerton sphinx_hton;
++#define have_sphinx_db sphinx_hton.state
++#else
++extern SHOW_COMP_OPTION have_sphinx_db;
++#endif
+ #ifdef HAVE_FEDERATED_DB
+ extern handlerton federated_hton;
+ #define have_federated_db federated_hton.state
+diff -r 319c65835581 sql/mysqld.cc
+--- a/sql/mysqld.cc Sun Jun 20 15:15:01 2010 +0400
++++ b/sql/mysqld.cc Sun Jun 20 15:59:31 2010 +0400
+@@ -36,6 +36,10 @@
+ #include <sys/prctl.h>
+ #endif
+
++#ifdef HAVE_SPHINX_DB
++#include "sphinx/ha_sphinx.h"
++#endif
++
+ #ifdef HAVE_INNOBASE_DB
+ #define OPT_INNODB_DEFAULT 1
+ #else
+@@ -6721,6 +6725,13 @@
+ #ifdef COMMUNITY_SERVER
+ {"Uptime_since_flush_status",(char*) 0, SHOW_FLUSHTIME},
+ #endif
++#ifdef HAVE_SPHINX_DB
++ {"sphinx_total", (char *)sphinx_showfunc_total, SHOW_SPHINX_FUNC},
++ {"sphinx_total_found", (char *)sphinx_showfunc_total_found, SHOW_SPHINX_FUNC},
++ {"sphinx_time", (char *)sphinx_showfunc_time, SHOW_SPHINX_FUNC},
++ {"sphinx_word_count", (char *)sphinx_showfunc_word_count, SHOW_SPHINX_FUNC},
++ {"sphinx_words", (char *)sphinx_showfunc_words, SHOW_SPHINX_FUNC},
++#endif
+ {NullS, NullS, SHOW_LONG}
+ };
+
+@@ -6964,6 +6975,11 @@
+ #else
+ have_csv_db= SHOW_OPTION_NO;
+ #endif
++#ifdef HAVE_SPHINX_DB
++ have_sphinx_db= SHOW_OPTION_YES;
++#else
++ have_sphinx_db= SHOW_OPTION_NO;
++#endif
+ #ifdef HAVE_NDBCLUSTER_DB
+ have_ndbcluster=SHOW_OPTION_DISABLED;
+ #else
+@@ -8087,6 +8103,7 @@
+ #undef have_example_db
+ #undef have_archive_db
+ #undef have_csv_db
++#undef have_sphinx_db
+ #undef have_federated_db
+ #undef have_partition_db
+ #undef have_blackhole_db
+@@ -8097,6 +8114,7 @@
+ SHOW_COMP_OPTION have_example_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_archive_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_csv_db= SHOW_OPTION_NO;
++SHOW_COMP_OPTION have_sphinx_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_federated_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_partition_db= SHOW_OPTION_NO;
+ SHOW_COMP_OPTION have_blackhole_db= SHOW_OPTION_NO;
+diff -r 319c65835581 sql/set_var.cc
+--- a/sql/set_var.cc Sun Jun 20 15:15:01 2010 +0400
++++ b/sql/set_var.cc Sun Jun 20 15:59:31 2010 +0400
+@@ -913,6 +913,7 @@
+ {"have_profiling", (char*) &have_profiling, SHOW_HAVE},
+ {"have_crypt", (char*) &have_crypt, SHOW_HAVE},
+ {"have_csv", (char*) &have_csv_db, SHOW_HAVE},
++ {"have_sphinx", (char*) &have_sphinx_db, SHOW_HAVE},
+ {"have_dynamic_loading", (char*) &have_dlopen, SHOW_HAVE},
+ {"have_example_engine", (char*) &have_example_db, SHOW_HAVE},
+ {"have_federated_engine", (char*) &have_federated_db, SHOW_HAVE},
+diff -r 319c65835581 sql/sql_lex.h
+--- a/sql/sql_lex.h Sun Jun 20 15:15:01 2010 +0400
++++ b/sql/sql_lex.h Sun Jun 20 15:59:31 2010 +0400
+@@ -57,6 +57,7 @@
+ SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS,
+ SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_LOGS, SQLCOM_SHOW_STATUS,
+ SQLCOM_SHOW_INNODB_STATUS, SQLCOM_SHOW_NDBCLUSTER_STATUS, SQLCOM_SHOW_MUTEX_STATUS,
++ SQLCOM_SHOW_SPHINX_STATUS,
+ SQLCOM_SHOW_PROCESSLIST, SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT,
+ SQLCOM_SHOW_GRANTS, SQLCOM_SHOW_CREATE, SQLCOM_SHOW_CHARSETS,
+ SQLCOM_SHOW_COLLATIONS, SQLCOM_SHOW_CREATE_DB, SQLCOM_SHOW_TABLE_STATUS,
+diff -r 319c65835581 sql/sql_parse.cc
+--- a/sql/sql_parse.cc Sun Jun 20 15:15:01 2010 +0400
++++ b/sql/sql_parse.cc Sun Jun 20 15:59:31 2010 +0400
+@@ -24,6 +24,9 @@
+ #ifdef HAVE_INNOBASE_DB
+ #include "ha_innodb.h"
+ #endif
++#ifdef HAVE_SPHINX_DB
++#include "sphinx/ha_sphinx.h"
++#endif
+
+ #ifdef HAVE_NDBCLUSTER_DB
+ #include "ha_ndbcluster.h"
+@@ -3166,6 +3169,15 @@
+ break;
+ }
+ #endif
++#ifdef HAVE_SPHINX_DB
++ case SQLCOM_SHOW_SPHINX_STATUS:
++ {
++ if (check_global_access(thd, SUPER_ACL))
++ goto error;
++ res = sphinx_show_status(thd);
++ break;
++ }
++#endif
+ #ifdef HAVE_REPLICATION
+ case SQLCOM_LOAD_MASTER_TABLE:
+ {
+diff -r 319c65835581 sql/sql_show.cc
+--- a/sql/sql_show.cc Sun Jun 20 15:15:01 2010 +0400
++++ b/sql/sql_show.cc Sun Jun 20 15:59:31 2010 +0400
+@@ -1500,6 +1500,16 @@
+ value= (char*) var->value_ptr(thd, value_type, &null_lex_str);
+ charset= var->charset(thd);
+ }
++ #ifdef HAVE_SPHINX_DB
++ else if (show_type == SHOW_SPHINX_FUNC)
++ {
++ SHOW_VAR var;
++ ((int (*)(THD *, SHOW_VAR *, char *))value)(thd, &var, buff);
++
++ value = var.value;
++ show_type = var.type;
++ }
++ #endif /* HAVE_SPHINX_DB */
+
+ pos= end= buff;
+ switch (show_type) {
+diff -r 319c65835581 sql/sql_yacc.yy
+--- a/sql/sql_yacc.yy Sun Jun 20 15:15:01 2010 +0400
++++ b/sql/sql_yacc.yy Sun Jun 20 15:59:31 2010 +0400
+@@ -8342,6 +8342,9 @@
+ case DB_TYPE_INNODB:
+ Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS;
+ break;
++ case DB_TYPE_SPHINX_DB:
++ Lex->sql_command = SQLCOM_SHOW_SPHINX_STATUS;
++ break;
+ default:
+ my_error(ER_NOT_SUPPORTED_YET, MYF(0), "STATUS");
+ MYSQL_YYABORT;
+diff -r 319c65835581 sql/sql_yacc.cc
+--- a/sql/sql_yacc.cc Sun Jun 20 15:15:01 2010 +0400
++++ b/sql/sql_yacc.cc Sun Jun 20 15:59:31 2010 +0400
+@@ -27003,6 +27003,9 @@
+ case DB_TYPE_INNODB:
+ Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS;
+ break;
++ case DB_TYPE_SPHINX_DB:
++ Lex->sql_command = SQLCOM_SHOW_SPHINX_STATUS;
++ break;
+ default:
+ my_error(ER_NOT_SUPPORTED_YET, MYF(0), "STATUS");
+ MYSQL_YYABORT;
+diff -r 319c65835581 sql/structs.h
+--- a/sql/structs.h Sun Jun 20 15:15:01 2010 +0400
++++ b/sql/structs.h Sun Jun 20 15:59:31 2010 +0400
+@@ -194,6 +194,9 @@
+ SHOW_SSL_CTX_SESS_TIMEOUTS, SHOW_SSL_CTX_SESS_CACHE_FULL,
+ SHOW_SSL_GET_CIPHER_LIST,
+ #endif /* HAVE_OPENSSL */
++#ifdef HAVE_SPHINX_DB
++ SHOW_SPHINX_FUNC,
++#endif
+ SHOW_NET_COMPRESSION,
+ SHOW_RPL_STATUS, SHOW_SLAVE_RUNNING, SHOW_SLAVE_RETRIED_TRANS,
+ SHOW_KEY_CACHE_LONG, SHOW_KEY_CACHE_CONST_LONG, SHOW_KEY_CACHE_LONGLONG,
+diff -r 319c65835581 win/configure.js
+--- a/win/configure.js Sun Jun 20 15:15:01 2010 +0400
++++ b/win/configure.js Sun Jun 20 15:59:31 2010 +0400
+@@ -45,6 +45,7 @@
+ case "WITH_EXAMPLE_STORAGE_ENGINE":
+ case "WITH_FEDERATED_STORAGE_ENGINE":
+ case "WITH_INNOBASE_STORAGE_ENGINE":
++ case "WITH_SPHINX_STORAGE_ENGINE":
+ case "__NT__":
+ case "DISABLE_GRANT_OPTIONS":
+ case "EMBED_MANIFESTS":
+--- mysql-5.0.67/config/ac-macros/ha_sphinx.m4 1970-01-01 10:00:00.000000000 +1000
++++ mysql-5.0.67-sphinx/config/ac-macros/ha_sphinx.m4 2009-02-14 09:15:48.000000000 +1000
+@@ -0,0 +1,30 @@
++dnl ---------------------------------------------------------------------------
++dnl Macro: MYSQL_CHECK_EXAMPLEDB
++dnl Sets HAVE_SPHINX_DB if --with-sphinx-storage-engine is used
++dnl ---------------------------------------------------------------------------
++AC_DEFUN([MYSQL_CHECK_SPHINXDB], [
++ AC_ARG_WITH([sphinx-storage-engine],
++ [
++ --with-sphinx-storage-engine
++ Enable the Sphinx Storage Engine],
++ [sphinxdb="$withval"],
++ [sphinxdb=no])
++ AC_MSG_CHECKING([for example storage engine])
++
++ case "$sphinxdb" in
++ yes )
++ AC_DEFINE([HAVE_SPHINX_DB], [1], [Builds Sphinx Engine])
++ AC_MSG_RESULT([yes])
++ [sphinxdb=yes]
++ ;;
++ * )
++ AC_MSG_RESULT([no])
++ [sphinxdb=no]
++ ;;
++ esac
++
++])
++dnl ---------------------------------------------------------------------------
++dnl END OF MYSQL_CHECK_EXAMPLE SECTION
++dnl ---------------------------------------------------------------------------
++
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment