Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
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
Kirill Smelkov
mariadb
Commits
570c6cc8
Commit
570c6cc8
authored
May 28, 2010
by
Davi Arnaut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport: Remove unused and ancient files, functions, and facilities.
parent
b2fda7cf
Changes
20
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
9 additions
and
1156 deletions
+9
-1156
client/mysql.cc
client/mysql.cc
+0
-16
client/sql_string.cc
client/sql_string.cc
+0
-7
include/my_pthread.h
include/my_pthread.h
+0
-1
mysys/my_pthread.c
mysys/my_pthread.c
+0
-5
sql/lock.cc
sql/lock.cc
+0
-14
sql/lock.h
sql/lock.h
+3
-33
sql/sql_class.h
sql/sql_class.h
+0
-2
sql/sql_const.h
sql/sql_const.h
+0
-6
sql/sql_delete.cc
sql/sql_delete.cc
+1
-2
sql/sql_priv.h
sql/sql_priv.h
+0
-4
sql/sql_string.cc
sql/sql_string.cc
+0
-7
sql/thr_malloc.cc
sql/thr_malloc.cc
+0
-4
sql/thr_malloc.h
sql/thr_malloc.h
+0
-1
storage/myisam/CMakeLists.txt
storage/myisam/CMakeLists.txt
+2
-2
storage/myisam/Makefile.am
storage/myisam/Makefile.am
+3
-6
storage/myisam/ft_eval.c
storage/myisam/ft_eval.c
+0
-252
storage/myisam/ft_eval.h
storage/myisam/ft_eval.h
+0
-41
storage/myisam/ft_stem.c
storage/myisam/ft_stem.c
+0
-18
storage/myisam/ft_test1.c
storage/myisam/ft_test1.c
+0
-315
storage/myisam/ft_test1.h
storage/myisam/ft_test1.h
+0
-420
No files found.
client/mysql.cc
View file @
570c6cc8
...
...
@@ -59,8 +59,6 @@ static char *server_version= NULL;
/* Array of options to pass to libemysqld */
#define MAX_SERVER_ARGS 64
void
*
sql_alloc
(
unsigned
size
);
// Don't use mysqld alloc for these
void
sql_element_free
(
void
*
ptr
);
#include "sql_string.h"
extern
"C"
{
...
...
@@ -4963,17 +4961,3 @@ static int com_prompt(String *buffer, char *line)
tee_fprintf
(
stdout
,
"PROMPT set to '%s'
\n
"
,
current_prompt
);
return
0
;
}
#ifndef EMBEDDED_LIBRARY
/* Keep sql_string library happy */
void
*
sql_alloc
(
size_t
Size
)
{
return
my_malloc
(
Size
,
MYF
(
MY_WME
));
}
void
sql_element_free
(
void
*
ptr
)
{
my_free
(
ptr
,
MYF
(
0
));
}
#endif
/* EMBEDDED_LIBRARY */
client/sql_string.cc
View file @
570c6cc8
...
...
@@ -24,13 +24,6 @@
#include <m_string.h>
#include <m_ctype.h>
#include <mysql_com.h>
/*
The following extern declarations are ok as these are interface functions
required by the string function
*/
extern
void
sql_alloc
(
size_t
size
);
extern
void
sql_element_free
(
void
*
ptr
);
#include "sql_string.h"
...
...
include/my_pthread.h
View file @
570c6cc8
...
...
@@ -712,7 +712,6 @@ extern my_bool my_thread_init(void);
extern
void
my_thread_end
(
void
);
extern
const
char
*
my_thread_name
(
void
);
extern
my_thread_id
my_thread_dbug_id
(
void
);
extern
int
pthread_no_free
(
void
*
);
extern
int
pthread_dummy
(
int
);
/* All thread specific variables are in the following struct */
...
...
mysys/my_pthread.c
View file @
570c6cc8
...
...
@@ -492,11 +492,6 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex)
/* Some help functions */
int
pthread_no_free
(
void
*
not_used
__attribute__
((
unused
)))
{
return
0
;
}
int
pthread_dummy
(
int
ret
)
{
return
ret
;
...
...
sql/lock.cc
View file @
570c6cc8
...
...
@@ -533,20 +533,6 @@ void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table)
}
}
/* Downgrade all locks on a table to new WRITE level from WRITE_ONLY */
void
mysql_lock_downgrade_write
(
THD
*
thd
,
TABLE
*
table
,
thr_lock_type
new_lock_type
)
{
MYSQL_LOCK
*
locked
;
if
((
locked
=
get_lock_data
(
thd
,
&
table
,
1
,
GET_LOCK_UNLOCK
)))
{
for
(
uint
i
=
0
;
i
<
locked
->
lock_count
;
i
++
)
thr_downgrade_write_lock
(
locked
->
locks
[
i
],
new_lock_type
);
my_free
((
uchar
*
)
locked
,
MYF
(
0
));
}
}
/** Abort all other threads waiting to get lock in table. */
...
...
sql/lock.h
View file @
570c6cc8
...
...
@@ -53,52 +53,22 @@ typedef struct st_mysql_lock MYSQL_LOCK;
MYSQL_OPEN_HAS_MDL_LOCK)
#include "thr_lock.h"
/* thr_lock_type */
struct
TABLE_LIST
;
class
THD
;
struct
TABLE
;
typedef
struct
st_mysql_lock
MYSQL_LOCK
;
MYSQL_LOCK
*
mysql_lock_tables
(
THD
*
thd
,
TABLE
**
table
,
uint
count
,
uint
flags
);
void
mysql_unlock_tables
(
THD
*
thd
,
MYSQL_LOCK
*
sql_lock
);
void
mysql_unlock_read_tables
(
THD
*
thd
,
MYSQL_LOCK
*
sql_lock
);
void
mysql_unlock_some_tables
(
THD
*
thd
,
TABLE
**
table
,
uint
count
);
void
mysql_lock_remove
(
THD
*
thd
,
MYSQL_LOCK
*
locked
,
TABLE
*
table
);
void
mysql_lock_abort
(
THD
*
thd
,
TABLE
*
table
,
bool
upgrade_lock
);
void
mysql_lock_downgrade_write
(
THD
*
thd
,
TABLE
*
table
,
thr_lock_type
new_lock_type
);
bool
mysql_lock_abort_for_thread
(
THD
*
thd
,
TABLE
*
table
);
MYSQL_LOCK
*
mysql_lock_merge
(
MYSQL_LOCK
*
a
,
MYSQL_LOCK
*
b
);
TABLE_LIST
*
mysql_lock_have_duplicate
(
THD
*
thd
,
TABLE_LIST
*
needle
,
TABLE_LIST
*
haystack
);
bool
lock_global_read_lock
(
THD
*
thd
);
void
unlock_global_read_lock
(
THD
*
thd
);
bool
wait_if_global_read_lock
(
THD
*
thd
,
bool
abort_on_refresh
,
bool
is_not_commit
);
void
start_waiting_global_read_lock
(
THD
*
thd
);
bool
make_global_read_lock_block_commit
(
THD
*
thd
);
bool
set_protect_against_global_read_lock
(
void
);
void
unset_protect_against_global_read_lock
(
void
);
/* Lock based on stored routine name */
bool
lock_routine_name
(
THD
*
thd
,
bool
is_function
,
const
char
*
db
,
const
char
*
name
);
void
broadcast_refresh
(
void
);
/* Lock based on name */
int
lock_and_wait_for_table_name
(
THD
*
thd
,
TABLE_LIST
*
table_list
);
int
lock_table_name
(
THD
*
thd
,
TABLE_LIST
*
table_list
,
bool
check_in_use
);
void
unlock_table_name
(
THD
*
thd
,
TABLE_LIST
*
table_list
);
bool
wait_for_locked_table_names
(
THD
*
thd
,
TABLE_LIST
*
table_list
);
bool
lock_table_names
(
THD
*
thd
,
TABLE_LIST
*
table_list
);
void
unlock_table_names
(
THD
*
thd
);
bool
lock_table_names_exclusively
(
THD
*
thd
,
TABLE_LIST
*
table_list
);
bool
is_table_name_exclusively_locked_by_this_thread
(
THD
*
thd
,
TABLE_LIST
*
table_list
);
bool
is_table_name_exclusively_locked_by_this_thread
(
THD
*
thd
,
uchar
*
key
,
int
key_length
);
void
broadcast_refresh
(
void
);
/* Lock based on stored routine name */
bool
lock_routine_name
(
THD
*
thd
,
bool
is_function
,
const
char
*
db
,
const
char
*
name
);
#endif
/* LOCK_INCLUDED */
sql/sql_class.h
View file @
570c6cc8
...
...
@@ -2119,8 +2119,6 @@ public:
char
scramble
[
SCRAMBLE_LENGTH
+
1
];
bool
slave_thread
,
one_shot_set
;
bool
locked
,
some_tables_deleted
;
bool
last_cuted_field
;
bool
no_errors
,
password
;
/**
Set to TRUE if execution of the current compound statement
...
...
sql/sql_const.h
View file @
570c6cc8
...
...
@@ -136,7 +136,6 @@
#ifndef MYSQLD_NET_RETRY_COUNT
#define MYSQLD_NET_RETRY_COUNT 10 ///< Abort read after this many int.
#endif
#define TEMP_POOL_SIZE 128
#define QUERY_ALLOC_BLOCK_SIZE 8192
#define QUERY_ALLOC_PREALLOC_SIZE 8192
...
...
@@ -146,11 +145,8 @@
#define ACL_ALLOC_BLOCK_SIZE 1024
#define UDF_ALLOC_BLOCK_SIZE 1024
#define TABLE_ALLOC_BLOCK_SIZE 1024
#define BDB_LOG_ALLOC_BLOCK_SIZE 1024
#define WARN_ALLOC_BLOCK_SIZE 2048
#define WARN_ALLOC_PREALLOC_SIZE 1024
#define PROFILE_ALLOC_BLOCK_SIZE 2048
#define PROFILE_ALLOC_PREALLOC_SIZE 1024
/*
The following parameters is to decide when to use an extra cache to
...
...
@@ -194,8 +190,6 @@
*/
#define MATCHING_ROWS_IN_OTHER_TABLE 10
#define RAID_BLOCK_SIZE 1024
#define MY_CHARSET_BIN_MB_MAXLEN 1
/** Don't pack string keys shorter than this (if PACK_KEYS=1 isn't used). */
...
...
sql/sql_delete.cc
View file @
570c6cc8
...
...
@@ -25,8 +25,7 @@
#include "sql_cache.h" // query_cache_*
#include "sql_base.h" // open_temprary_table
#include "sql_table.h" // build_table_filename
#include "lock.h" // lock_and_wait_for_table_name,
// unlock_table_name
#include "lock.h" // unlock_table_name
#include "sql_view.h" // check_key_in_view, mysql_frm_type
#include "sql_parse.h" // mysql_init_select
#include "sql_acl.h" // *_ACL
...
...
sql/sql_priv.h
View file @
570c6cc8
...
...
@@ -187,10 +187,6 @@ extern char err_shared_dir[];
#define BINLOG_DUMP_NON_BLOCK 1
/* sql_show.cc:show_log_files() */
#define SHOW_LOG_STATUS_FREE "FREE"
#define SHOW_LOG_STATUS_INUSE "IN USE"
/*
Some defines for exit codes for ::is_equal class functions.
*/
...
...
sql/sql_string.cc
View file @
570c6cc8
...
...
@@ -24,13 +24,6 @@
#include <m_string.h>
#include <m_ctype.h>
#include <mysql_com.h>
/*
The following extern declarations are ok as these are interface functions
required by the string function
*/
extern
uchar
*
sql_alloc
(
unsigned
size
);
extern
void
sql_element_free
(
void
*
ptr
);
#include "sql_string.h"
...
...
sql/thr_malloc.cc
View file @
570c6cc8
...
...
@@ -109,10 +109,6 @@ void* sql_memdup(const void *ptr, size_t len)
return
pos
;
}
void
sql_element_free
(
void
*
ptr
__attribute__
((
unused
)))
{}
/* purecov: deadcode */
char
*
sql_strmake_with_convert
(
const
char
*
str
,
size_t
arg_length
,
CHARSET_INFO
*
from_cs
,
...
...
sql/thr_malloc.h
View file @
570c6cc8
...
...
@@ -27,7 +27,6 @@ void *sql_calloc(size_t);
char
*
sql_strdup
(
const
char
*
str
);
char
*
sql_strmake
(
const
char
*
str
,
size_t
len
);
void
*
sql_memdup
(
const
void
*
ptr
,
size_t
size
);
void
sql_element_free
(
void
*
ptr
);
char
*
sql_strmake_with_convert
(
const
char
*
str
,
size_t
arg_length
,
CHARSET_INFO
*
from_cs
,
size_t
max_res_length
,
...
...
storage/myisam/CMakeLists.txt
View file @
570c6cc8
...
...
@@ -13,7 +13,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET
(
MYISAM_SOURCES ft_boolean_search.c ft_nlq_search.c ft_parser.c ft_static.c
ft_stem.c
SET
(
MYISAM_SOURCES ft_boolean_search.c ft_nlq_search.c ft_parser.c ft_static.c
ha_myisam.cc
ft_stopwords.c ft_update.c mi_cache.c mi_changed.c mi_check.c
mi_checksum.c mi_close.c mi_create.c mi_dbug.c mi_delete.c
...
...
@@ -23,7 +23,7 @@ SET(MYISAM_SOURCES ft_boolean_search.c ft_nlq_search.c ft_parser.c ft_static.c
mi_rfirst.c mi_rlast.c mi_rnext.c mi_rnext_same.c mi_rprev.c mi_rrnd.c
mi_rsame.c mi_rsamepos.c mi_scan.c mi_search.c mi_static.c mi_statrec.c
mi_unique.c mi_update.c mi_write.c rt_index.c rt_key.c rt_mbr.c
rt_split.c sort.c sp_key.c
ft_eval.h
mi_extrafunc.h myisamdef.h
rt_split.c sort.c sp_key.c mi_extrafunc.h myisamdef.h
rt_index.h mi_rkey.c
)
MYSQL_ADD_PLUGIN
(
myisam
${
MYISAM_SOURCES
}
...
...
storage/myisam/Makefile.am
View file @
570c6cc8
...
...
@@ -27,7 +27,7 @@ LDADD =
DEFS
=
@DEFS@
EXTRA_DIST
=
mi_test_all.sh mi_test_all.res
ft_stem.c
CMakeLists.txt plug.in
EXTRA_DIST
=
mi_test_all.sh mi_test_all.res CMakeLists.txt plug.in
pkgdata_DATA
=
mi_test_all mi_test_all.res
pkglib_LIBRARIES
=
libmyisam.a
...
...
@@ -47,10 +47,9 @@ myisampack_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
$(top_builddir)
/mysys/libmysys.a
\
$(top_builddir)
/dbug/libdbug.a
\
$(top_builddir)
/strings/libmystrings.a @ZLIB_LIBS@
noinst_PROGRAMS
=
mi_test1 mi_test2 mi_test3 rt_test sp_test
#ft_test1 ft_eval
noinst_PROGRAMS
=
mi_test1 mi_test2 mi_test3 rt_test sp_test
noinst_HEADERS
=
myisamdef.h rt_index.h rt_key.h rt_mbr.h sp_defs.h
\
fulltext.h ftdefs.h ft_test1.h ft_eval.h
\
ha_myisam.h mi_extrafunc.h
fulltext.h ftdefs.h ha_myisam.h mi_extrafunc.h
mi_test1_DEPENDENCIES
=
$(LIBRARIES)
mi_test1_LDADD
=
@CLIENT_EXTRA_LDFLAGS@ libmyisam.a
\
$(top_builddir)
/mysys/libmysys.a
\
...
...
@@ -66,8 +65,6 @@ mi_test3_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
$(top_builddir)
/mysys/libmysys.a
\
$(top_builddir)
/dbug/libdbug.a
\
$(top_builddir)
/strings/libmystrings.a @ZLIB_LIBS@
#ft_test1_DEPENDENCIES= $(LIBRARIES)
#ft_eval_DEPENDENCIES= $(LIBRARIES)
myisam_ftdump_DEPENDENCIES
=
$(LIBRARIES)
myisam_ftdump_LDADD
=
@CLIENT_EXTRA_LDFLAGS@ libmyisam.a
\
$(top_builddir)
/mysys/libmysys.a
\
...
...
storage/myisam/ft_eval.c
deleted
100644 → 0
View file @
b2fda7cf
/* Copyright (C) 2000-2002 MySQL AB
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code
added support for long options (my_getopt) 22.5.2002 by Jani Tolonen */
#include "ftdefs.h"
#include "ft_eval.h"
#include <stdarg.h>
#include <my_getopt.h>
static
void
print_error
(
int
exit_code
,
const
char
*
fmt
,...);
static
void
get_options
(
int
argc
,
char
*
argv
[]);
static
int
create_record
(
char
*
pos
,
FILE
*
file
);
static
void
usage
();
static
struct
my_option
my_long_options
[]
=
{
{
""
,
's'
,
""
,
0
,
0
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
""
,
'q'
,
""
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
""
,
'S'
,
""
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
""
,
'#'
,
""
,
0
,
0
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
""
,
'V'
,
""
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
""
,
'?'
,
""
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
""
,
'h'
,
""
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
}
};
int
main
(
int
argc
,
char
*
argv
[])
{
MI_INFO
*
file
;
int
i
,
j
;
MY_INIT
(
argv
[
0
]);
get_options
(
argc
,
argv
);
bzero
((
char
*
)
recinfo
,
sizeof
(
recinfo
));
/* First define 2 columns */
recinfo
[
0
].
type
=
FIELD_SKIP_ENDSPACE
;
recinfo
[
0
].
length
=
docid_length
;
recinfo
[
1
].
type
=
FIELD_BLOB
;
recinfo
[
1
].
length
=
4
+
portable_sizeof_char_ptr
;
/* Define a key over the first column */
keyinfo
[
0
].
seg
=
keyseg
;
keyinfo
[
0
].
keysegs
=
1
;
keyinfo
[
0
].
block_length
=
0
;
/* Default block length */
keyinfo
[
0
].
seg
[
0
].
type
=
HA_KEYTYPE_TEXT
;
keyinfo
[
0
].
seg
[
0
].
flag
=
HA_BLOB_PART
;
keyinfo
[
0
].
seg
[
0
].
start
=
recinfo
[
0
].
length
;
keyinfo
[
0
].
seg
[
0
].
length
=
key_length
;
keyinfo
[
0
].
seg
[
0
].
null_bit
=
0
;
keyinfo
[
0
].
seg
[
0
].
null_pos
=
0
;
keyinfo
[
0
].
seg
[
0
].
bit_start
=
4
;
keyinfo
[
0
].
seg
[
0
].
language
=
MY_CHARSET_CURRENT
;
keyinfo
[
0
].
flag
=
HA_FULLTEXT
;
if
(
!
silent
)
printf
(
"- Creating isam-file
\n
"
);
if
(
mi_create
(
filename
,
1
,
keyinfo
,
2
,
recinfo
,
0
,
NULL
,(
MI_CREATE_INFO
*
)
0
,
0
))
goto
err
;
if
(
!
(
file
=
mi_open
(
filename
,
2
,
0
)))
goto
err
;
if
(
!
silent
)
printf
(
"Initializing stopwords
\n
"
);
ft_init_stopwords
(
stopwordlist
);
if
(
!
silent
)
printf
(
"- Writing key:s
\n
"
);
my_errno
=
0
;
i
=
0
;
while
(
create_record
(
record
,
df
))
{
error
=
mi_write
(
file
,
record
);
if
(
error
)
printf
(
"I= %2d mi_write: %d errno: %d
\n
"
,
i
,
error
,
my_errno
);
i
++
;
}
fclose
(
df
);
if
(
mi_close
(
file
))
goto
err
;
if
(
!
silent
)
printf
(
"- Reopening file
\n
"
);
if
(
!
(
file
=
mi_open
(
filename
,
2
,
0
)))
goto
err
;
if
(
!
silent
)
printf
(
"- Reading rows with key
\n
"
);
for
(
i
=
1
;
create_record
(
record
,
qf
);
i
++
)
{
FT_DOCLIST
*
result
;
double
w
;
int
t
,
err
;
result
=
ft_nlq_init_search
(
file
,
0
,
blob_record
,(
uint
)
strlen
(
blob_record
),
1
);
if
(
!
result
)
{
printf
(
"Query %d failed with errno %3d
\n
"
,
i
,
my_errno
);
goto
err
;
}
if
(
!
silent
)
printf
(
"Query %d. Found: %d.
\n
"
,
i
,
result
->
ndocs
);
for
(
j
=
0
;(
err
=
ft_nlq_read_next
(
result
,
read_record
))
==
0
;
j
++
)
{
t
=
uint2korr
(
read_record
);
w
=
ft_nlq_get_relevance
(
result
);
printf
(
"%d %.*s %f
\n
"
,
i
,
t
,
read_record
+
2
,
w
);
}
if
(
err
!=
HA_ERR_END_OF_FILE
)
{
printf
(
"ft_read_next %d failed with errno %3d
\n
"
,
j
,
my_errno
);
goto
err
;
}
ft_nlq_close_search
(
result
);
}
if
(
mi_close
(
file
))
goto
err
;
my_end
(
MY_CHECK_ERROR
);
return
(
0
);
err:
printf
(
"got error: %3d when using myisam-database
\n
"
,
my_errno
);
return
1
;
/* skip warning */
}
static
my_bool
get_one_option
(
int
optid
,
const
struct
my_option
*
opt
__attribute__
((
unused
)),
char
*
argument
)
{
switch
(
optid
)
{
case
's'
:
if
(
stopwordlist
&&
stopwordlist
!=
ft_precompiled_stopwords
)
break
;
{
FILE
*
f
;
char
s
[
HA_FT_MAXLEN
];
int
i
=
0
,
n
=
SWL_INIT
;
if
(
!
(
stopwordlist
=
(
const
char
**
)
malloc
(
n
*
sizeof
(
char
*
))))
print_error
(
1
,
"malloc(%d)"
,
n
*
sizeof
(
char
*
));
if
(
!
(
f
=
fopen
(
argument
,
"r"
)))
print_error
(
1
,
"fopen(%s)"
,
argument
);
while
(
!
feof
(
f
))
{
if
(
!
(
fgets
(
s
,
HA_FT_MAXLEN
,
f
)))
print_error
(
1
,
"fgets(s,%d,%s)"
,
HA_FT_MAXLEN
,
argument
);
if
(
!
(
stopwordlist
[
i
++
]
=
strdup
(
s
)))
print_error
(
1
,
"strdup(%s)"
,
s
);
if
(
i
>=
n
)
{
n
+=
SWL_PLUS
;
if
(
!
(
stopwordlist
=
(
const
char
**
)
realloc
((
char
*
)
stopwordlist
,
n
*
sizeof
(
char
*
))))
print_error
(
1
,
"realloc(%d)"
,
n
*
sizeof
(
char
*
));
}
}
fclose
(
f
);
stopwordlist
[
i
]
=
NULL
;
break
;
}
case
'q'
:
silent
=
1
;
break
;
case
'S'
:
if
(
stopwordlist
==
ft_precompiled_stopwords
)
stopwordlist
=
NULL
;
break
;
case
'#'
:
DBUG_PUSH
(
argument
);
break
;
case
'V'
:
case
'?'
:
case
'h'
:
usage
();
exit
(
1
);
}
return
0
;
}
static
void
get_options
(
int
argc
,
char
*
argv
[])
{
int
ho_error
;
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
)))
exit
(
ho_error
);
if
(
!
(
d_file
=
argv
[
optind
]))
print_error
(
1
,
"No d_file"
);
if
(
!
(
df
=
fopen
(
d_file
,
"r"
)))
print_error
(
1
,
"fopen(%s)"
,
d_file
);
if
(
!
(
q_file
=
argv
[
optind
+
1
]))
print_error
(
1
,
"No q_file"
);
if
(
!
(
qf
=
fopen
(
q_file
,
"r"
)))
print_error
(
1
,
"fopen(%s)"
,
q_file
);
return
;
}
/* get options */
static
int
create_record
(
char
*
pos
,
FILE
*
file
)
{
uint
tmp
;
char
*
ptr
;
bzero
((
char
*
)
pos
,
MAX_REC_LENGTH
);
/* column 1 - VARCHAR */
if
(
!
(
fgets
(
pos
+
2
,
MAX_REC_LENGTH
-
32
,
file
)))
{
if
(
feof
(
file
))
return
0
;
else
print_error
(
1
,
"fgets(docid) - 1"
);
}
tmp
=
(
uint
)
strlen
(
pos
+
2
)
-
1
;
int2store
(
pos
,
tmp
);
pos
+=
recinfo
[
0
].
length
;
/* column 2 - BLOB */
if
(
!
(
fgets
(
blob_record
,
MAX_BLOB_LENGTH
,
file
)))
print_error
(
1
,
"fgets(docid) - 2"
);
tmp
=
(
uint
)
strlen
(
blob_record
);
int4store
(
pos
,
tmp
);
ptr
=
blob_record
;
memcpy_fixed
(
pos
+
4
,
&
ptr
,
sizeof
(
char
*
));
return
1
;
}
/* VARARGS */
static
void
print_error
(
int
exit_code
,
const
char
*
fmt
,...)
{
va_list
args
;
va_start
(
args
,
fmt
);
fprintf
(
stderr
,
"%s: error: "
,
my_progname
);
(
void
)
vfprintf
(
stderr
,
fmt
,
args
);
(
void
)
fputc
(
'\n'
,
stderr
);
fflush
(
stderr
);
va_end
(
args
);
exit
(
exit_code
);
}
static
void
usage
()
{
printf
(
"%s [options]
\n
"
,
my_progname
);
my_print_help
(
my_long_options
);
my_print_variables
(
my_long_options
);
}
storage/myisam/ft_eval.h
deleted
100644 → 0
View file @
b2fda7cf
/* Copyright (C) 2000 MySQL AB & Sergei A. Golubchik
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
const
char
**
stopwordlist
=
ft_precompiled_stopwords
;
#define MAX_REC_LENGTH 128
#define MAX_BLOB_LENGTH 60000
char
record
[
MAX_REC_LENGTH
],
read_record
[
MAX_REC_LENGTH
+
MAX_BLOB_LENGTH
];
char
blob_record
[
MAX_BLOB_LENGTH
+
20
*
20
];
char
*
filename
=
(
char
*
)
"EVAL"
;
int
silent
=
0
,
error
=
0
;
uint
key_length
=
MAX_BLOB_LENGTH
,
docid_length
=
32
;
char
*
d_file
,
*
q_file
;
FILE
*
df
,
*
qf
;
MI_COLUMNDEF
recinfo
[
3
];
MI_KEYDEF
keyinfo
[
2
];
HA_KEYSEG
keyseg
[
10
];
#define SWL_INIT 500
#define SWL_PLUS 50
#define MAX_LINE_LENGTH 128
char
line
[
MAX_LINE_LENGTH
];
storage/myisam/ft_stem.c
deleted
100644 → 0
View file @
b2fda7cf
/* Copyright (C) 2000 MySQL AB
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
/* mulitingual stem */
storage/myisam/ft_test1.c
deleted
100644 → 0
View file @
b2fda7cf
/* Copyright (C) 2000-2002, 2004 MySQL AB
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code
added support for long options (my_getopt) 22.5.2002 by Jani Tolonen */
#include "ftdefs.h"
#include "ft_test1.h"
#include <my_getopt.h>
static
int
key_field
=
FIELD_VARCHAR
,
extra_field
=
FIELD_SKIP_ENDSPACE
;
static
uint
key_length
=
200
,
extra_length
=
50
;
static
int
key_type
=
HA_KEYTYPE_TEXT
;
static
int
verbose
=
0
,
silent
=
0
,
skip_update
=
0
,
no_keys
=
0
,
no_stopwords
=
0
,
no_search
=
0
,
no_fulltext
=
0
;
static
int
create_flag
=
0
,
error
=
0
;
#define MAX_REC_LENGTH 300
static
char
record
[
MAX_REC_LENGTH
],
read_record
[
MAX_REC_LENGTH
];
static
int
run_test
(
const
char
*
filename
);
static
void
get_options
(
int
argc
,
char
*
argv
[]);
static
void
create_record
(
char
*
,
int
);
static
void
usage
();
static
struct
my_option
my_long_options
[]
=
{
{
""
,
'v'
,
""
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
""
,
'?'
,
""
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
""
,
'h'
,
""
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
""
,
'V'
,
""
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
""
,
'v'
,
""
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
""
,
's'
,
""
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
""
,
'N'
,
""
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
""
,
'S'
,
""
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
""
,
'K'
,
""
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
""
,
'F'
,
""
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
""
,
'U'
,
""
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
""
,
'#'
,
""
,
0
,
0
,
0
,
GET_STR
,
OPT_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
}
};
int
main
(
int
argc
,
char
*
argv
[])
{
MY_INIT
(
argv
[
0
]);
get_options
(
argc
,
argv
);
exit
(
run_test
(
"FT1"
));
}
static
MI_COLUMNDEF
recinfo
[
3
];
static
MI_KEYDEF
keyinfo
[
2
];
static
HA_KEYSEG
keyseg
[
10
];
static
int
run_test
(
const
char
*
filename
)
{
MI_INFO
*
file
;
int
i
,
j
;
my_off_t
pos
;
bzero
((
char
*
)
recinfo
,
sizeof
(
recinfo
));
/* First define 2 columns */
recinfo
[
0
].
type
=
extra_field
;
recinfo
[
0
].
length
=
(
extra_field
==
FIELD_BLOB
?
4
+
portable_sizeof_char_ptr
:
extra_length
);
if
(
extra_field
==
FIELD_VARCHAR
)
recinfo
[
0
].
length
+=
HA_VARCHAR_PACKLENGTH
(
extra_length
);
recinfo
[
1
].
type
=
key_field
;
recinfo
[
1
].
length
=
(
key_field
==
FIELD_BLOB
?
4
+
portable_sizeof_char_ptr
:
key_length
);
if
(
key_field
==
FIELD_VARCHAR
)
recinfo
[
1
].
length
+=
HA_VARCHAR_PACKLENGTH
(
key_length
);
/* Define a key over the first column */
keyinfo
[
0
].
seg
=
keyseg
;
keyinfo
[
0
].
keysegs
=
1
;
keyinfo
[
0
].
block_length
=
0
;
/* Default block length */
keyinfo
[
0
].
seg
[
0
].
type
=
key_type
;
keyinfo
[
0
].
seg
[
0
].
flag
=
(
key_field
==
FIELD_BLOB
)
?
HA_BLOB_PART
:
(
key_field
==
FIELD_VARCHAR
)
?
HA_VAR_LENGTH_PART
:
0
;
keyinfo
[
0
].
seg
[
0
].
start
=
recinfo
[
0
].
length
;
keyinfo
[
0
].
seg
[
0
].
length
=
key_length
;
keyinfo
[
0
].
seg
[
0
].
null_bit
=
0
;
keyinfo
[
0
].
seg
[
0
].
null_pos
=
0
;
keyinfo
[
0
].
seg
[
0
].
language
=
default_charset_info
->
number
;
keyinfo
[
0
].
flag
=
(
no_fulltext
?
HA_PACK_KEY
:
HA_FULLTEXT
);
if
(
!
silent
)
printf
(
"- Creating isam-file
\n
"
);
if
(
mi_create
(
filename
,(
no_keys
?
0
:
1
),
keyinfo
,
2
,
recinfo
,
0
,
NULL
,
(
MI_CREATE_INFO
*
)
0
,
create_flag
))
goto
err
;
if
(
!
(
file
=
mi_open
(
filename
,
2
,
0
)))
goto
err
;
if
(
!
silent
)
printf
(
"- %s stopwords
\n
"
,
no_stopwords
?
"Skipping"
:
"Initializing"
);
ft_init_stopwords
(
no_stopwords
?
NULL
:
ft_precompiled_stopwords
);
if
(
!
silent
)
printf
(
"- Writing key:s
\n
"
);
my_errno
=
0
;
for
(
i
=
NUPD
;
i
<
NDATAS
;
i
++
)
{
create_record
(
record
,
i
);
error
=
mi_write
(
file
,
record
);
if
(
verbose
||
error
)
printf
(
"I= %2d mi_write: %d errno: %d, record: %s
\n
"
,
i
,
error
,
my_errno
,
data
[
i
].
f0
);
}
if
(
!
skip_update
)
{
if
(
!
silent
)
printf
(
"- Updating rows
\n
"
);
/* Read through all rows and update them */
pos
=
(
ha_rows
)
0
;
i
=
0
;
while
((
error
=
mi_rrnd
(
file
,
read_record
,
pos
))
==
0
)
{
create_record
(
record
,
NUPD
-
i
-
1
);
if
(
mi_update
(
file
,
read_record
,
record
))
{
printf
(
"Can't update row: %.*s, error: %d
\n
"
,
keyinfo
[
0
].
seg
[
0
].
length
,
record
,
my_errno
);
}
if
(
++
i
==
NUPD
)
break
;
pos
=
HA_OFFSET_ERROR
;
}
if
(
i
!=
NUPD
)
printf
(
"Found %d of %d rows
\n
"
,
i
,
NUPD
);
}
if
(
mi_close
(
file
))
goto
err
;
if
(
no_search
)
return
0
;
if
(
!
silent
)
printf
(
"- Reopening file
\n
"
);
if
(
!
(
file
=
mi_open
(
filename
,
2
,
0
)))
goto
err
;
if
(
!
silent
)
printf
(
"- Reading rows with key
\n
"
);
for
(
i
=
0
;
i
<
NQUERIES
;
i
++
)
{
FT_DOCLIST
*
result
;
result
=
ft_nlq_init_search
(
file
,
0
,(
char
*
)
query
[
i
],
strlen
(
query
[
i
]),
1
);
if
(
!
result
)
{
printf
(
"Query %d: `%s' failed with errno %3d
\n
"
,
i
,
query
[
i
],
my_errno
);
continue
;
}
printf
(
"Query %d: `%s'. Found: %d. Top five documents:
\n
"
,
i
,
query
[
i
],
result
->
ndocs
);
for
(
j
=
0
;
j
<
5
;
j
++
)
{
double
w
;
int
err
;
err
=
ft_nlq_read_next
(
result
,
read_record
);
if
(
err
==
HA_ERR_END_OF_FILE
)
{
printf
(
"No more matches!
\n
"
);
break
;
}
else
if
(
err
)
{
printf
(
"ft_read_next %d failed with errno %3d
\n
"
,
j
,
my_errno
);
break
;
}
w
=
ft_nlq_get_relevance
(
result
);
if
(
key_field
==
FIELD_VARCHAR
)
{
uint
l
;
char
*
p
;
p
=
recinfo
[
0
].
length
+
read_record
;
l
=
uint2korr
(
p
);
printf
(
"%10.7f: %.*s
\n
"
,
w
,(
int
)
l
,
p
+
2
);
}
else
printf
(
"%10.7f: %.*s
\n
"
,
w
,
recinfo
[
1
].
length
,
recinfo
[
0
].
length
+
read_record
);
}
ft_nlq_close_search
(
result
);
}
if
(
mi_close
(
file
))
goto
err
;
my_end
(
MY_CHECK_ERROR
);
return
(
0
);
err:
printf
(
"got error: %3d when using myisam-database
\n
"
,
my_errno
);
return
1
;
/* skip warning */
}
static
char
blob_key
[
MAX_REC_LENGTH
];
/* static char blob_record[MAX_REC_LENGTH+20*20]; */
void
create_record
(
char
*
pos
,
int
n
)
{
bzero
((
char
*
)
pos
,
MAX_REC_LENGTH
);
if
(
recinfo
[
0
].
type
==
FIELD_BLOB
)
{
uint
tmp
;
char
*
ptr
;
strnmov
(
blob_key
,
data
[
n
].
f0
,
keyinfo
[
0
].
seg
[
0
].
length
);
tmp
=
strlen
(
blob_key
);
int4store
(
pos
,
tmp
);
ptr
=
blob_key
;
memcpy_fixed
(
pos
+
4
,
&
ptr
,
sizeof
(
char
*
));
pos
+=
recinfo
[
0
].
length
;
}
else
if
(
recinfo
[
0
].
type
==
FIELD_VARCHAR
)
{
uint
tmp
;
/* -1 is here because pack_length is stored in seg->length */
uint
pack_length
=
HA_VARCHAR_PACKLENGTH
(
keyinfo
[
0
].
seg
[
0
].
length
-
1
);
strnmov
(
pos
+
pack_length
,
data
[
n
].
f0
,
keyinfo
[
0
].
seg
[
0
].
length
);
tmp
=
strlen
(
pos
+
pack_length
);
if
(
pack_length
==
1
)
*
pos
=
(
char
)
tmp
;
else
int2store
(
pos
,
tmp
);
pos
+=
recinfo
[
0
].
length
;
}
else
{
strnmov
(
pos
,
data
[
n
].
f0
,
keyinfo
[
0
].
seg
[
0
].
length
);
pos
+=
recinfo
[
0
].
length
;
}
if
(
recinfo
[
1
].
type
==
FIELD_BLOB
)
{
uint
tmp
;
char
*
ptr
;
strnmov
(
blob_key
,
data
[
n
].
f2
,
keyinfo
[
0
].
seg
[
0
].
length
);
tmp
=
strlen
(
blob_key
);
int4store
(
pos
,
tmp
);
ptr
=
blob_key
;
memcpy_fixed
(
pos
+
4
,
&
ptr
,
sizeof
(
char
*
));
pos
+=
recinfo
[
1
].
length
;
}
else
if
(
recinfo
[
1
].
type
==
FIELD_VARCHAR
)
{
uint
tmp
;
/* -1 is here because pack_length is stored in seg->length */
uint
pack_length
=
HA_VARCHAR_PACKLENGTH
(
keyinfo
[
0
].
seg
[
0
].
length
-
1
);
strnmov
(
pos
+
pack_length
,
data
[
n
].
f2
,
keyinfo
[
0
].
seg
[
0
].
length
);
tmp
=
strlen
(
pos
+
1
);
if
(
pack_length
==
1
)
*
pos
=
(
char
)
tmp
;
else
int2store
(
pos
,
tmp
);
pos
+=
recinfo
[
1
].
length
;
}
else
{
strnmov
(
pos
,
data
[
n
].
f2
,
keyinfo
[
0
].
seg
[
0
].
length
);
pos
+=
recinfo
[
1
].
length
;
}
}
static
my_bool
get_one_option
(
int
optid
,
const
struct
my_option
*
opt
__attribute__
((
unused
)),
char
*
argument
)
{
switch
(
optid
)
{
case
'v'
:
verbose
=
1
;
break
;
case
's'
:
silent
=
1
;
break
;
case
'F'
:
no_fulltext
=
1
;
no_search
=
1
;
case
'U'
:
skip_update
=
1
;
break
;
case
'K'
:
no_keys
=
no_search
=
1
;
break
;
case
'N'
:
no_search
=
1
;
break
;
case
'S'
:
no_stopwords
=
1
;
break
;
case
'#'
:
DBUG_PUSH
(
argument
);
break
;
case
'V'
:
case
'?'
:
case
'h'
:
usage
();
exit
(
1
);
}
return
0
;
}
/* Read options */
static
void
get_options
(
int
argc
,
char
*
argv
[])
{
int
ho_error
;
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
my_long_options
,
get_one_option
)))
exit
(
ho_error
);
return
;
}
/* get options */
static
void
usage
()
{
printf
(
"%s [options]
\n
"
,
my_progname
);
my_print_help
(
my_long_options
);
my_print_variables
(
my_long_options
);
}
storage/myisam/ft_test1.h
deleted
100644 → 0
View file @
b2fda7cf
This diff is collapsed.
Click to expand it.
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