mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
merge
This commit is contained in:
@@ -7,7 +7,7 @@ $opt_tmp=$opt_version_suffix="";
|
|||||||
$opt_help=$opt_Information=$opt_delete=$opt_debug=$opt_stage=$opt_rsh_mail=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_no_mysqltest=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=0;
|
$opt_help=$opt_Information=$opt_delete=$opt_debug=$opt_stage=$opt_rsh_mail=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_no_mysqltest=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=0;
|
||||||
$opt_innodb=$opt_bdb=0;
|
$opt_innodb=$opt_bdb=0;
|
||||||
|
|
||||||
GetOptions("Information","help","distribution=s","user=s","result=s","delete","no-test","no-mysqltest","perl-files=s","debug","config-options=s","config-env=s","stage=i","rsh-mail","with-low-memory","fast-benchmark","tmp=s","static-client","static-server","static-perl","no-perl","local-perl","perl-options=s","sur","with-small-disk","dbd-options=s","tcpip","suffix=s","build-thread=i","innodb","bdb","use-old-distribution","enable-shared","no-crash-me","no-strip","version-suffix=s", "with-other-libc=s) || usage();
|
GetOptions("Information","help","distribution=s","user=s","result=s","delete","no-test","no-mysqltest","perl-files=s","debug","config-options=s","config-env=s","stage=i","rsh-mail","with-low-memory","fast-benchmark","tmp=s","static-client","static-server","static-perl","no-perl","local-perl","perl-options=s","sur","with-small-disk","dbd-options=s","tcpip","suffix=s","build-thread=i","innodb","bdb","use-old-distribution","enable-shared","no-crash-me","no-strip","version-suffix=s", "with-other-libc=s") || usage();
|
||||||
|
|
||||||
usage() if ($opt_help || $opt_Information);
|
usage() if ($opt_help || $opt_Information);
|
||||||
usage() if (!$opt_distribution);
|
usage() if (!$opt_distribution);
|
||||||
|
@@ -566,7 +566,8 @@ a commercial memory leakage detector.
|
|||||||
@item
|
@item
|
||||||
Works on many different platforms. @xref{Which OS}.
|
Works on many different platforms. @xref{Which OS}.
|
||||||
@item
|
@item
|
||||||
Uses GNU Automake, Autoconf (Ver 2.52 or newer), and Libtool for portability.
|
Uses GNU Automake (1.4), Autoconf (Ver 2.52 or newer), and Libtool for
|
||||||
|
portability.
|
||||||
@item
|
@item
|
||||||
APIs for C, C++, Eiffel, Java, Perl, PHP, Python and Tcl. @xref{Clients}.
|
APIs for C, C++, Eiffel, Java, Perl, PHP, Python and Tcl. @xref{Clients}.
|
||||||
@item
|
@item
|
||||||
@@ -6254,11 +6255,14 @@ shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
|
|||||||
shell> ln -s mysql-VERSION-OS mysql
|
shell> ln -s mysql-VERSION-OS mysql
|
||||||
shell> cd mysql
|
shell> cd mysql
|
||||||
shell> scripts/mysql_install_db
|
shell> scripts/mysql_install_db
|
||||||
shell> chown -R root /usr/local/mysql
|
shell> chown -R root .
|
||||||
shell> chown -R mysql /usr/local/mysql/data
|
shell> chown -R mysql ./data
|
||||||
shell> chgrp -R mysql /usr/local/mysql
|
shell> chgrp -R mysql .
|
||||||
shell> chown -R root /usr/local/mysql/bin
|
shell> chown -R root ./bin
|
||||||
shell> bin/safe_mysqld --user=mysql &
|
shell> bin/safe_mysqld --user=mysql &
|
||||||
|
or
|
||||||
|
shell> bin/mysqld_safe --user=mysql &
|
||||||
|
if you are running MySQL 4.x
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@cindex adding, new users
|
@cindex adding, new users
|
||||||
@@ -6522,6 +6526,9 @@ shell> chown -R mysql /usr/local/mysql/var
|
|||||||
shell> chgrp -R mysql /usr/local/mysql
|
shell> chgrp -R mysql /usr/local/mysql
|
||||||
shell> cp support-files/my-medium.cnf /etc/my.cnf
|
shell> cp support-files/my-medium.cnf /etc/my.cnf
|
||||||
shell> /usr/local/mysql/bin/safe_mysqld --user=mysql &
|
shell> /usr/local/mysql/bin/safe_mysqld --user=mysql &
|
||||||
|
or
|
||||||
|
shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &
|
||||||
|
if you are running MySQL 4.x.
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
If you want have support for InnoDB tables, you should edit the
|
If you want have support for InnoDB tables, you should edit the
|
||||||
@@ -7009,11 +7016,10 @@ The initial download of the source tree may take a while, depending on the
|
|||||||
speed of your connection; be patient.
|
speed of your connection; be patient.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
You will need GNU @code{autoconf 2.13}, @code{automake 1.4},
|
You will need GNU @code{autoconf 2.52}, @code{automake 1.4},
|
||||||
@code{libtool}, and @code{m4} to run the next set of commands.
|
@code{libtool}, and @code{m4} to run the next set of commands.
|
||||||
|
|
||||||
If you are using the 3.23 tree the new versions of @code{autoconf}
|
@code{automake} (1.5) doesn't yet work.
|
||||||
(2.52) and @code{automake} (1.5) will not work.
|
|
||||||
|
|
||||||
If you get some strange error during this stage, check that you really
|
If you get some strange error during this stage, check that you really
|
||||||
have @code{libtool} installed!
|
have @code{libtool} installed!
|
||||||
@@ -8141,6 +8147,9 @@ version 4.0;
|
|||||||
|
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@item
|
@item
|
||||||
|
Use @code{ORDER BY column DESC} now always sorts @code{NULL} values
|
||||||
|
first; In 3.23 this was not always consistent.
|
||||||
|
@item
|
||||||
@code{SHOW INDEX} has 2 columns more (@code{Null} and @code{Index_type})
|
@code{SHOW INDEX} has 2 columns more (@code{Null} and @code{Index_type})
|
||||||
than it had in 3.23.
|
than it had in 3.23.
|
||||||
@item
|
@item
|
||||||
@@ -12676,9 +12685,15 @@ mysql> SELECT 1 IS NULL, 1 IS NOT NULL;
|
|||||||
+-----------+---------------+
|
+-----------+---------------+
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
Note that two @code{NULL} are compared as equal is when you do an
|
||||||
|
@code{GROUP BY}.
|
||||||
|
|
||||||
In MySQL, 0 or @code{NULL} means false and anything else means true.
|
In MySQL, 0 or @code{NULL} means false and anything else means true.
|
||||||
The default truth value from a boolean operation is 1.
|
The default truth value from a boolean operation is 1.
|
||||||
|
|
||||||
|
When doing an @code{ORDER BY}, @code{NULL} values are always sorted first,
|
||||||
|
even if you are using @code{DESC}.
|
||||||
|
|
||||||
This special treatment of @code{NULL} is why, in the previous section, it
|
This special treatment of @code{NULL} is why, in the previous section, it
|
||||||
was necessary to determine which animals are no longer alive using
|
was necessary to determine which animals are no longer alive using
|
||||||
@code{death IS NOT NULL} instead of @code{death <> NULL}.
|
@code{death IS NOT NULL} instead of @code{death <> NULL}.
|
||||||
@@ -13206,7 +13221,7 @@ mysql> DESCRIBE pet;
|
|||||||
@end example
|
@end example
|
||||||
|
|
||||||
@code{Field} indicates the column name, @code{Type} is the data type for
|
@code{Field} indicates the column name, @code{Type} is the data type for
|
||||||
the column, @code{Null} indicates whether or not the column can contain
|
the column, @code{NULL} indicates whether or not the column can contain
|
||||||
@code{NULL} values, @code{Key} indicates whether or not the column is
|
@code{NULL} values, @code{Key} indicates whether or not the column is
|
||||||
indexed, and @code{Default} specifies the column's default value.
|
indexed, and @code{Default} specifies the column's default value.
|
||||||
|
|
||||||
@@ -13692,6 +13707,13 @@ tell @code{mysql} to read its input from the file:
|
|||||||
shell> mysql < batch-file
|
shell> mysql < batch-file
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
If you are running @code{mysql} under windows and have some special
|
||||||
|
characters in the file that causes problems, you can do:
|
||||||
|
|
||||||
|
@example
|
||||||
|
dos> mysql -e "source batch-file"
|
||||||
|
@end example
|
||||||
|
|
||||||
If you need to specify connection parameters on the command line, the
|
If you need to specify connection parameters on the command line, the
|
||||||
command might look like this:
|
command might look like this:
|
||||||
|
|
||||||
@@ -13703,6 +13725,9 @@ Enter password: ********
|
|||||||
When you use @code{mysql} this way, you are creating a script file, then
|
When you use @code{mysql} this way, you are creating a script file, then
|
||||||
executing the script.
|
executing the script.
|
||||||
|
|
||||||
|
If you want the script to continue even if you have errors, you should
|
||||||
|
use the @code{--force} command line option.
|
||||||
|
|
||||||
Why use a script? Here are a few reasons:
|
Why use a script? Here are a few reasons:
|
||||||
|
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@@ -13776,6 +13801,12 @@ If you want to get the interactive output format in batch mode, use
|
|||||||
@code{mysql -t}. To echo to the output the commands that are executed, use
|
@code{mysql -t}. To echo to the output the commands that are executed, use
|
||||||
@code{mysql -vvv}.
|
@code{mysql -vvv}.
|
||||||
|
|
||||||
|
You can also use scripts in the @code{mysql} command line prompt by
|
||||||
|
using the @code{source} command:
|
||||||
|
|
||||||
|
@example
|
||||||
|
mysql> source filename
|
||||||
|
@end example
|
||||||
|
|
||||||
@node Twin, Apache, Batch mode, Tutorial
|
@node Twin, Apache, Batch mode, Tutorial
|
||||||
@section Queries from Twin Project
|
@section Queries from Twin Project
|
||||||
@@ -16496,8 +16527,10 @@ password will be set to the password specified by the @code{IDENTIFIED BY}
|
|||||||
clause, if one is given. If the user already had a password, it is replaced
|
clause, if one is given. If the user already had a password, it is replaced
|
||||||
by the new one.
|
by the new one.
|
||||||
|
|
||||||
Optional @code{PASSWORD} changes behaviour of @code{IDENTIFIED BY} from
|
If you don't want to send the password in clear text you can use the
|
||||||
accepting plain password to accept encrypted password as argument.
|
@code{PASSWORD} option followed by a scrambled password from SQL
|
||||||
|
function @code{PASSWORD()} or the C API function
|
||||||
|
@code{make_scrambled_password(char *to, const char *password)}.
|
||||||
|
|
||||||
@strong{Warning:} If you create a new user but do not specify an
|
@strong{Warning:} If you create a new user but do not specify an
|
||||||
@code{IDENTIFIED BY} clause, the user has no password. This is insecure.
|
@code{IDENTIFIED BY} clause, the user has no password. This is insecure.
|
||||||
@@ -25574,7 +25607,13 @@ You have different @code{ORDER BY} and @code{GROUP BY} expressions.
|
|||||||
|
|
||||||
@item
|
@item
|
||||||
The used table index is an index type that doesn't store rows in order.
|
The used table index is an index type that doesn't store rows in order.
|
||||||
(Like index in @code{HEAP} tables).
|
(Like the @code{HASH} index in @code{HEAP} tables).
|
||||||
|
|
||||||
|
@item
|
||||||
|
The index colum may contain @code{NULL} values and one is using
|
||||||
|
@code{ORDER BY ... DESC}. This is because in SQL @code{NULL} values is
|
||||||
|
always sorted before normal values, independent of you are using
|
||||||
|
@code{DESC} or not.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
|
|
||||||
@@ -26509,6 +26548,9 @@ probably much faster, as this will require us to do much fewer seeks.)
|
|||||||
Note that if such a query uses @code{LIMIT} to only retrieve
|
Note that if such a query uses @code{LIMIT} to only retrieve
|
||||||
part of the rows, MySQL will use an index anyway, as it can
|
part of the rows, MySQL will use an index anyway, as it can
|
||||||
much more quickly find the few rows to return in the result.
|
much more quickly find the few rows to return in the result.
|
||||||
|
@item
|
||||||
|
If the index range may contain @code{NULL} values and you are using
|
||||||
|
@code{ORDER BY ... DESC}
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@node Indexes, Multiple-column indexes, MySQL indexes, Optimising Database Structure
|
@node Indexes, Multiple-column indexes, MySQL indexes, Optimising Database Structure
|
||||||
@@ -30018,7 +30060,7 @@ mysql> select 2 > 2;
|
|||||||
@cindex @code{NULL}, testing for null
|
@cindex @code{NULL}, testing for null
|
||||||
@findex <=> (Equal to)
|
@findex <=> (Equal to)
|
||||||
@item <=>
|
@item <=>
|
||||||
Null safe equal:
|
NULL safe equal:
|
||||||
@example
|
@example
|
||||||
mysql> select 1 <=> 1, NULL <=> NULL, 1 <=> NULL;
|
mysql> select 1 <=> 1, NULL <=> NULL, 1 <=> NULL;
|
||||||
-> 1 1 0
|
-> 1 1 0
|
||||||
@@ -48665,6 +48707,12 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
|
|||||||
|
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@item
|
@item
|
||||||
|
Use @code{ORDER BY column DESC} now sorts @code{NULL} values first.
|
||||||
|
@item
|
||||||
|
Fixed bug in @code{SELECT DISTINCT ... ORDER BY DESC} optimization.
|
||||||
|
@item
|
||||||
|
Fixed bug in @code{... HAVING 'GROUP_FUNCTION'(xxx) IS [NOT] NULL}.
|
||||||
|
@item
|
||||||
Fixed bug in truncation operator for boolean fulltext search.
|
Fixed bug in truncation operator for boolean fulltext search.
|
||||||
@item
|
@item
|
||||||
Allow numeric user id to @code{mysqld --user=#}.
|
Allow numeric user id to @code{mysqld --user=#}.
|
||||||
@@ -49035,8 +49083,19 @@ not yet 100% confident in this code.
|
|||||||
@node News-3.23.50, News-3.23.49, News-3.23.x, News-3.23.x
|
@node News-3.23.50, News-3.23.49, News-3.23.x, News-3.23.x
|
||||||
@appendixsubsec Changes in release 3.23.50
|
@appendixsubsec Changes in release 3.23.50
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
|
Fixed core-dump bug when reading client groups from option files using
|
||||||
|
@code{mysql_options()}.
|
||||||
@item
|
@item
|
||||||
Memory leak (16 bytes per every @strong{corrupted} table) closed.
|
Memory leak (16 bytes per every @strong{corrupted} table) closed.
|
||||||
|
@item
|
||||||
|
Fixed binary builds to use @code{--enable-local-infile}.
|
||||||
|
@item
|
||||||
|
Update source to work with new @code{bison} version.
|
||||||
|
@item
|
||||||
|
Updated shell scripts to new agree with new POSIX standard.
|
||||||
|
@item
|
||||||
|
Fixed bug where @code{DATE_FORMAT()} returned empty string when used
|
||||||
|
with @code{GROUP BY}.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@node News-3.23.49, News-3.23.48, News-3.23.50, News-3.23.x
|
@node News-3.23.49, News-3.23.48, News-3.23.50, News-3.23.x
|
||||||
@@ -49054,6 +49113,8 @@ Added options to make @code{LOAD DATA LOCAL INFILE} more secure.
|
|||||||
MySQL binary release 3.23.48 for Linux contained a new glibc library, which
|
MySQL binary release 3.23.48 for Linux contained a new glibc library, which
|
||||||
has serious problems under high load and RedHat 7.2. The 3.23.49 binary
|
has serious problems under high load and RedHat 7.2. The 3.23.49 binary
|
||||||
release doesn't have this problem.
|
release doesn't have this problem.
|
||||||
|
@item
|
||||||
|
Fixed shutdown problem on NT.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@node News-3.23.48, News-3.23.47, News-3.23.49, News-3.23.x
|
@node News-3.23.48, News-3.23.47, News-3.23.49, News-3.23.x
|
||||||
|
@@ -846,21 +846,21 @@ dnl ---------------------------------------------------------------------------
|
|||||||
|
|
||||||
AC_DEFUN([MYSQL_CHECK_BDB], [
|
AC_DEFUN([MYSQL_CHECK_BDB], [
|
||||||
AC_ARG_WITH([berkeley-db],
|
AC_ARG_WITH([berkeley-db],
|
||||||
[\
|
[
|
||||||
--with-berkeley-db[=DIR]
|
--with-berkeley-db[=DIR]
|
||||||
Use BerkeleyDB located in DIR],
|
Use BerkeleyDB located in DIR],
|
||||||
[bdb="$withval"],
|
[bdb="$withval"],
|
||||||
[bdb=no])
|
[bdb=no])
|
||||||
|
|
||||||
AC_ARG_WITH([berkeley-db-includes],
|
AC_ARG_WITH([berkeley-db-includes],
|
||||||
[\
|
[
|
||||||
--with-berkeley-db-includes=DIR
|
--with-berkeley-db-includes=DIR
|
||||||
Find Berkeley DB headers in DIR],
|
Find Berkeley DB headers in DIR],
|
||||||
[bdb_includes="$withval"],
|
[bdb_includes="$withval"],
|
||||||
[bdb_includes=default])
|
[bdb_includes=default])
|
||||||
|
|
||||||
AC_ARG_WITH([berkeley-db-libs],
|
AC_ARG_WITH([berkeley-db-libs],
|
||||||
[\
|
[
|
||||||
--with-berkeley-db-libs=DIR
|
--with-berkeley-db-libs=DIR
|
||||||
Find Berkeley DB libraries in DIR],
|
Find Berkeley DB libraries in DIR],
|
||||||
[bdb_libs="$withval"],
|
[bdb_libs="$withval"],
|
||||||
@@ -1108,7 +1108,7 @@ dnl ---------------------------------------------------------------------------
|
|||||||
|
|
||||||
AC_DEFUN([MYSQL_CHECK_INNODB], [
|
AC_DEFUN([MYSQL_CHECK_INNODB], [
|
||||||
AC_ARG_WITH([innodb],
|
AC_ARG_WITH([innodb],
|
||||||
[\
|
[
|
||||||
--without-innodb Do not include the InnoDB table handler],
|
--without-innodb Do not include the InnoDB table handler],
|
||||||
[innodb="$withval"],
|
[innodb="$withval"],
|
||||||
[innodb=yes])
|
[innodb=yes])
|
||||||
@@ -1182,6 +1182,7 @@ dnl END OF MYSQL_CHECK_INNODB SECTION
|
|||||||
dnl ---------------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------------
|
||||||
|
|
||||||
dnl ---------------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------------
|
||||||
|
|
||||||
dnl Got this from the GNU tar 1.13.11 distribution
|
dnl Got this from the GNU tar 1.13.11 distribution
|
||||||
dnl by Paul Eggert <eggert@twinsun.com>
|
dnl by Paul Eggert <eggert@twinsun.com>
|
||||||
dnl ---------------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------------
|
||||||
|
12
bdb/dist/s_recover
vendored
12
bdb/dist/s_recover
vendored
@@ -12,6 +12,13 @@ rm -f $loglist
|
|||||||
|
|
||||||
trap 'rm -f $t; exit 1' 1 2 3 13 15
|
trap 'rm -f $t; exit 1' 1 2 3 13 15
|
||||||
|
|
||||||
|
# Use the standard -k option if it works;
|
||||||
|
# otherwise fall back on the traditional notation.
|
||||||
|
if sort -k 1,1 /dev/null
|
||||||
|
then sort_2_etc='-k 2'
|
||||||
|
else sort_2_etc='+1'
|
||||||
|
fi
|
||||||
|
|
||||||
# Check to make sure we haven't duplicated a log record entry, and build
|
# Check to make sure we haven't duplicated a log record entry, and build
|
||||||
# the list of log record types that the test suite uses.
|
# the list of log record types that the test suite uses.
|
||||||
for i in $DIR; do
|
for i in $DIR; do
|
||||||
@@ -19,13 +26,14 @@ for i in $DIR; do
|
|||||||
for f in ../$i/*.src; do
|
for f in ../$i/*.src; do
|
||||||
# Grab the PREFIX; there should only be one per file, and
|
# Grab the PREFIX; there should only be one per file, and
|
||||||
# so it's okay to just take the first.
|
# so it's okay to just take the first.
|
||||||
grep '^PREFIX' $f | head -1
|
grep '^PREFIX' $f | sed q
|
||||||
egrep '^DEPRECATED[ ]|^BEGIN[ ]' $f | \
|
egrep '^DEPRECATED[ ]|^BEGIN[ ]' $f | \
|
||||||
awk '{print $1 "\t" $2 "\t" $3}'
|
awk '{print $1 "\t" $2 "\t" $3}'
|
||||||
|
|
||||||
done
|
done
|
||||||
done > $loglist
|
done > $loglist
|
||||||
grep -v '^PREFIX' $loglist | awk '{print $2 "\t" $3}' | sort +1 -n | \
|
grep -v '^PREFIX' $loglist | awk '{print $2 "\t" $3}' | \
|
||||||
|
sort $sort_2_etc -n | \
|
||||||
uniq -d -f 1 > $t
|
uniq -d -f 1 > $t
|
||||||
[ -s $t ] && {
|
[ -s $t ] && {
|
||||||
echo "DUPLICATE LOG VALUES:"
|
echo "DUPLICATE LOG VALUES:"
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <violite.h>
|
#include <violite.h>
|
||||||
|
|
||||||
const char *VER="11.20";
|
const char *VER="11.21";
|
||||||
|
|
||||||
/* Don't try to make a nice table if the data is too big */
|
/* Don't try to make a nice table if the data is too big */
|
||||||
#define MAX_COLUMN_LENGTH 1024
|
#define MAX_COLUMN_LENGTH 1024
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
** and adapted to mysqldump 05/11/01 by Jani Tolonen
|
** and adapted to mysqldump 05/11/01 by Jani Tolonen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DUMP_VERSION "8.22"
|
#define DUMP_VERSION "8.23"
|
||||||
|
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
@@ -897,8 +897,6 @@ static uint getTableStructure(char *table, char* db)
|
|||||||
fputs(";\n", sql_file);
|
fputs(";\n", sql_file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (opt_disable_keys)
|
|
||||||
fprintf(sql_file,"\n/*!40000 ALTER TABLE %s DISABLE KEYS */;\n",table_name);
|
|
||||||
if (cFlag)
|
if (cFlag)
|
||||||
{
|
{
|
||||||
strpos=strmov(strpos,") VALUES ");
|
strpos=strmov(strpos,") VALUES ");
|
||||||
@@ -1023,7 +1021,7 @@ static void dumpTable(uint numFields, char *table)
|
|||||||
strxmov(strend(query), " WHERE ",where,NullS);
|
strxmov(strend(query), " WHERE ",where,NullS);
|
||||||
}
|
}
|
||||||
if (!opt_xml)
|
if (!opt_xml)
|
||||||
fputs("\n\n", md_result_file);
|
fputs("\n", md_result_file);
|
||||||
if (mysql_query(sock, query))
|
if (mysql_query(sock, query))
|
||||||
{
|
{
|
||||||
DBerror(sock, "when retrieving data from server");
|
DBerror(sock, "when retrieving data from server");
|
||||||
@@ -1048,6 +1046,9 @@ static void dumpTable(uint numFields, char *table)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opt_disable_keys)
|
||||||
|
fprintf(md_result_file,"/*!40000 ALTER TABLE %s DISABLE KEYS */;\n",
|
||||||
|
quote_name(table, table_buff));
|
||||||
if (opt_lock)
|
if (opt_lock)
|
||||||
fprintf(md_result_file,"LOCK TABLES %s WRITE;\n",
|
fprintf(md_result_file,"LOCK TABLES %s WRITE;\n",
|
||||||
quote_name(table,table_buff));
|
quote_name(table,table_buff));
|
||||||
@@ -1207,11 +1208,11 @@ static void dumpTable(uint numFields, char *table)
|
|||||||
safe_exit(EX_CONSCHECK);
|
safe_exit(EX_CONSCHECK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (opt_disable_keys)
|
|
||||||
fprintf(md_result_file,"\n/*!40000 ALTER TABLE %s ENABLE KEYS */;\n",
|
|
||||||
quote_name(table,table_buff));
|
|
||||||
if (opt_lock)
|
if (opt_lock)
|
||||||
fputs("UNLOCK TABLES;\n", md_result_file);
|
fputs("UNLOCK TABLES;\n", md_result_file);
|
||||||
|
if (opt_disable_keys)
|
||||||
|
fprintf(md_result_file,"/*!40000 ALTER TABLE %s ENABLE KEYS */;\n",
|
||||||
|
quote_name(table,table_buff));
|
||||||
if (opt_autocommit)
|
if (opt_autocommit)
|
||||||
fprintf(md_result_file, "commit;\n");
|
fprintf(md_result_file, "commit;\n");
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
|
15
configure.in
15
configure.in
@@ -602,16 +602,21 @@ AC_ARG_WITH(mysqld-user,
|
|||||||
)
|
)
|
||||||
AC_SUBST(MYSQLD_USER)
|
AC_SUBST(MYSQLD_USER)
|
||||||
|
|
||||||
# compile with strings functions in assembler
|
# If we should allove LOAD DATA LOCAL
|
||||||
|
AC_MSG_CHECKING(if we should should enable LOAD DATA LOCAL by default)
|
||||||
AC_ARG_ENABLE(local-infile,
|
AC_ARG_ENABLE(local-infile,
|
||||||
[ --enable-local-infile
|
[ --enable-local-infile
|
||||||
If LOAD DATA LOCAL INFILE is enabled by default.],
|
If LOAD DATA LOCAL INFILE is enabled by default.],
|
||||||
[
|
[ ENABLED_LOCAL_INFILE=$enableval ],
|
||||||
ENABLED_LOCAL_INFILE=$enablewal
|
|
||||||
AC_DEFINE(ENABLED_LOCAL_INFILE)
|
|
||||||
],
|
|
||||||
[ ENABLED_LOCAL_INFILE=no ]
|
[ ENABLED_LOCAL_INFILE=no ]
|
||||||
)
|
)
|
||||||
|
if test "$ENABLED_LOCAL_INFILE" = "yes"
|
||||||
|
then
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
AC_DEFINE([ENABLED_LOCAL_INFILE])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
fi
|
||||||
|
|
||||||
# Use Paul Eggerts macros from GNU tar to check for large file support.
|
# Use Paul Eggerts macros from GNU tar to check for large file support.
|
||||||
MYSQL_SYS_LARGEFILE
|
MYSQL_SYS_LARGEFILE
|
||||||
|
@@ -737,7 +737,7 @@ static void mysql_read_default_options(struct st_mysql_options *options,
|
|||||||
*end=0; /* Remove '=' */
|
*end=0; /* Remove '=' */
|
||||||
}
|
}
|
||||||
/* Change all '_' in variable name to '-' */
|
/* Change all '_' in variable name to '-' */
|
||||||
for (end= *option ; (end= strcend(end,'_')) && *end ; )
|
for (end= *option ; *(end= strcend(end,'_')) ; )
|
||||||
*end= '-';
|
*end= '-';
|
||||||
switch (find_type(*option+2,&option_types,2)) {
|
switch (find_type(*option+2,&option_types,2)) {
|
||||||
case 1: /* port */
|
case 1: /* port */
|
||||||
@@ -1338,7 +1338,7 @@ mysql_init(MYSQL *mysql)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Only enable LOAD DATA INFILE by default if configured with
|
Only enable LOAD DATA INFILE by default if configured with
|
||||||
--with-enabled-local-inflile
|
--enable-local-infile
|
||||||
*/
|
*/
|
||||||
#ifdef ENABLED_LOCAL_INFILE
|
#ifdef ENABLED_LOCAL_INFILE
|
||||||
mysql->options.client_flag|= CLIENT_LOCAL_FILES;
|
mysql->options.client_flag|= CLIENT_LOCAL_FILES;
|
||||||
|
@@ -193,7 +193,7 @@ static struct my_option my_long_options[] =
|
|||||||
0, 0, 0, GET_NO_ARG, NO_ARG, 'i', 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_NO_ARG, NO_ARG, 'i', 0, 0, 0, 0, 0, 0},
|
||||||
{"keys-used", "Tell MyISAM to update only some specific keys. # is a bit mask of which keys to use. This can be used to get faster inserts!",
|
{"keys-used", "Tell MyISAM to update only some specific keys. # is a bit mask of which keys to use. This can be used to get faster inserts!",
|
||||||
(gptr*) &check_param.keys_in_use, (gptr*) &check_param.keys_in_use, 0,
|
(gptr*) &check_param.keys_in_use, (gptr*) &check_param.keys_in_use, 0,
|
||||||
GET_LL, REQUIRED_ARG, 'k', -1LL, 0, 0, 0, 0, 0},
|
GET_LL, REQUIRED_ARG, 'k',-1, 0, 0, 0, 0, 0},
|
||||||
{"medium-check",
|
{"medium-check",
|
||||||
"Faster than extended-check, but only finds 99.99% of all errors. Should be good enough for most cases.", 0, 0, 0, GET_NO_ARG, NO_ARG, 'm', 0, 0, 0, 0, 0,
|
"Faster than extended-check, but only finds 99.99% of all errors. Should be good enough for most cases.", 0, 0, 0, GET_NO_ARG, NO_ARG, 'm', 0, 0, 0, 0, 0,
|
||||||
0},
|
0},
|
||||||
|
@@ -79,8 +79,10 @@ sleep_until_file_created ()
|
|||||||
|
|
||||||
# No paths below as we can't be sure where the program is!
|
# No paths below as we can't be sure where the program is!
|
||||||
|
|
||||||
BASENAME=`which basename | head -1`
|
SED=sed
|
||||||
DIFF=`which diff | head -1`
|
|
||||||
|
BASENAME=`which basename | $SED q`
|
||||||
|
DIFF=`which diff | $SED q`
|
||||||
CAT=cat
|
CAT=cat
|
||||||
CUT=cut
|
CUT=cut
|
||||||
HEAD=head
|
HEAD=head
|
||||||
@@ -88,13 +90,12 @@ TAIL=tail
|
|||||||
ECHO=echo # use internal echo if possible
|
ECHO=echo # use internal echo if possible
|
||||||
EXPR=expr # use internal if possible
|
EXPR=expr # use internal if possible
|
||||||
FIND=find
|
FIND=find
|
||||||
GCOV=`which gcov | head -1`
|
GCOV=`which gcov | $SED q`
|
||||||
PRINTF=printf
|
PRINTF=printf
|
||||||
RM=rm
|
RM=rm
|
||||||
TIME=time
|
TIME=time
|
||||||
TR=tr
|
TR=tr
|
||||||
XARGS=`which xargs | head -1`
|
XARGS=`which xargs | $SED q`
|
||||||
SED=sed
|
|
||||||
|
|
||||||
# Are we using a source or a binary distribution?
|
# Are we using a source or a binary distribution?
|
||||||
|
|
||||||
|
@@ -77,6 +77,7 @@ NULL NULL
|
|||||||
10 VMT
|
10 VMT
|
||||||
select id+0 as a,max(id),concat(facility) as b from t1 group by a order by b desc,a;
|
select id+0 as a,max(id),concat(facility) as b from t1 group by a order by b desc,a;
|
||||||
a max(id) b
|
a max(id) b
|
||||||
|
NULL NULL NULL
|
||||||
10 10 VMT
|
10 10 VMT
|
||||||
9 9 SRV
|
9 9 SRV
|
||||||
8 8 RV
|
8 8 RV
|
||||||
@@ -89,7 +90,6 @@ a max(id) b
|
|||||||
1 1 /L
|
1 1 /L
|
||||||
-1 -1
|
-1 -1
|
||||||
0 0
|
0 0
|
||||||
NULL NULL NULL
|
|
||||||
select id >= 0 and id <= 5 as grp,count(*) from t1 group by grp;
|
select id >= 0 and id <= 5 as grp,count(*) from t1 group by grp;
|
||||||
grp count(*)
|
grp count(*)
|
||||||
0 7
|
0 7
|
||||||
@@ -336,3 +336,16 @@ a c
|
|||||||
4 NULL
|
4 NULL
|
||||||
3 NULL
|
3 NULL
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (a char(1), key(a)) type=myisam;
|
||||||
|
insert into t1 values('1'),('1');
|
||||||
|
select * from t1 where a >= '1';
|
||||||
|
a
|
||||||
|
1
|
||||||
|
1
|
||||||
|
select distinct a from t1 order by a desc;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
select distinct a from t1 where a >= '1' order by a desc;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
drop table t1;
|
||||||
|
@@ -226,7 +226,7 @@ key (score)
|
|||||||
INSERT INTO t1 VALUES (1,1,1),(2,2,2),(2,1,1),(3,3,3),(4,3,3),(5,3,3);
|
INSERT INTO t1 VALUES (1,1,1),(2,2,2),(2,1,1),(3,3,3),(4,3,3),(5,3,3);
|
||||||
explain select userid,count(*) from t1 group by userid desc;
|
explain select userid,count(*) from t1 group by userid desc;
|
||||||
table type possible_keys key key_len ref rows Extra
|
table type possible_keys key key_len ref rows Extra
|
||||||
t1 ALL NULL NULL NULL NULL 6 Using temporary
|
t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
|
||||||
select userid,count(*) from t1 group by userid desc;
|
select userid,count(*) from t1 group by userid desc;
|
||||||
userid count(*)
|
userid count(*)
|
||||||
3 3
|
3 3
|
||||||
@@ -244,6 +244,8 @@ spid count(*)
|
|||||||
2 2
|
2 2
|
||||||
select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
|
select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
|
||||||
spid count(*)
|
spid count(*)
|
||||||
|
2 2
|
||||||
|
1 1
|
||||||
explain select sql_big_result spid,sum(userid) from t1 group by spid desc;
|
explain select sql_big_result spid,sum(userid) from t1 group by spid desc;
|
||||||
table type possible_keys key key_len ref rows Extra
|
table type possible_keys key key_len ref rows Extra
|
||||||
t1 ALL NULL NULL NULL NULL 6 Using filesort
|
t1 ALL NULL NULL NULL NULL 6 Using filesort
|
||||||
|
@@ -44,3 +44,22 @@ AND start <= 999660;
|
|||||||
id start end chr_strand
|
id start end chr_strand
|
||||||
133197 813898 813898 -1.0000
|
133197 813898 813898 -1.0000
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
CREATE TABLE t1 (Fld1 int(11) default NULL,Fld2 int(11) default NULL);
|
||||||
|
INSERT INTO t1 VALUES (1,10),(1,20),(2,NULL),(2,NULL),(3,50);
|
||||||
|
select Fld1, max(Fld2) as q from t1 group by Fld1 having q is not null;
|
||||||
|
Fld1 q
|
||||||
|
1 20
|
||||||
|
3 50
|
||||||
|
select Fld1, max(Fld2) from t1 group by Fld1 having max(Fld2) is not null;
|
||||||
|
Fld1 max(Fld2)
|
||||||
|
1 20
|
||||||
|
3 50
|
||||||
|
select Fld1, max(Fld2) from t1 group by Fld1 having avg(Fld2) is not null;
|
||||||
|
Fld1 max(Fld2)
|
||||||
|
1 20
|
||||||
|
3 50
|
||||||
|
select Fld1, max(Fld2) from t1 group by Fld1 having std(Fld2) is not null;
|
||||||
|
Fld1 max(Fld2)
|
||||||
|
1 20
|
||||||
|
3 50
|
||||||
|
drop table t1;
|
||||||
|
@@ -207,3 +207,14 @@ insert into t1 (a) values (1),(2),(3),(4),(1),(2),(3),(4);
|
|||||||
select distinct a from t1 group by b,a having a > 2 order by a desc;
|
select distinct a from t1 group by b,a having a > 2 order by a desc;
|
||||||
select distinct a,c from t1 group by b,c,a having a > 2 order by a desc;
|
select distinct a,c from t1 group by b,c,a having a > 2 order by a desc;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test problem with DISTINCT and ORDER BY DESC
|
||||||
|
#
|
||||||
|
|
||||||
|
create table t1 (a char(1), key(a)) type=myisam;
|
||||||
|
insert into t1 values('1'),('1');
|
||||||
|
select * from t1 where a >= '1';
|
||||||
|
select distinct a from t1 order by a desc;
|
||||||
|
select distinct a from t1 where a >= '1' order by a desc;
|
||||||
|
drop table t1;
|
||||||
|
@@ -48,3 +48,15 @@ GROUP BY e.id
|
|||||||
HAVING chr_strand= -1 and end >= 0
|
HAVING chr_strand= -1 and end >= 0
|
||||||
AND start <= 999660;
|
AND start <= 999660;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test problem with having and MAX() IS NOT NULL
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (Fld1 int(11) default NULL,Fld2 int(11) default NULL);
|
||||||
|
INSERT INTO t1 VALUES (1,10),(1,20),(2,NULL),(2,NULL),(3,50);
|
||||||
|
select Fld1, max(Fld2) as q from t1 group by Fld1 having q is not null;
|
||||||
|
select Fld1, max(Fld2) from t1 group by Fld1 having max(Fld2) is not null;
|
||||||
|
select Fld1, max(Fld2) from t1 group by Fld1 having avg(Fld2) is not null;
|
||||||
|
select Fld1, max(Fld2) from t1 group by Fld1 having std(Fld2) is not null;
|
||||||
|
drop table t1;
|
||||||
|
@@ -62,3 +62,16 @@ create table t1 (date date);
|
|||||||
insert into t1 values ("2000-08-10"),("2000-08-11");
|
insert into t1 values ("2000-08-10"),("2000-08-11");
|
||||||
select date_add(date,INTERVAL 1 DAY),date_add(date,INTERVAL 1 SECOND) from t1;
|
select date_add(date,INTERVAL 1 DAY),date_add(date,INTERVAL 1 SECOND) from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test problem with DATE_FORMAT
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1(AFIELD INT);
|
||||||
|
INSERT INTO t1 VALUES(1);
|
||||||
|
CREATE TABLE t2(GMT VARCHAR(32));
|
||||||
|
INSERT INTO t2 VALUES('GMT-0800');
|
||||||
|
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1, t2 GROUP BY t1.AFIELD;
|
||||||
|
INSERT INTO t1 VALUES(1);
|
||||||
|
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)), DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1,t2 GROUP BY t1.AFIELD;
|
||||||
|
drop table t1,t2;
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
|
||||||
#include <my_config.h>
|
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include <m_string.h>
|
#include <m_string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -452,7 +451,7 @@ static void init_variables(const struct my_option *options)
|
|||||||
{
|
{
|
||||||
if (options->var_type == GET_LONG)
|
if (options->var_type == GET_LONG)
|
||||||
*((long*) options->u_max_value)= *((long*) options->value)=
|
*((long*) options->u_max_value)= *((long*) options->value)=
|
||||||
options->def_value;
|
(long) options->def_value;
|
||||||
else if (options->var_type == GET_LL)
|
else if (options->var_type == GET_LL)
|
||||||
*((longlong*) options->u_max_value)= *((longlong*) options->value)=
|
*((longlong*) options->u_max_value)= *((longlong*) options->value)=
|
||||||
options->def_value;
|
options->def_value;
|
||||||
|
@@ -291,7 +291,7 @@ do
|
|||||||
I=1
|
I=1
|
||||||
while test "$I" -le "$numofproces"
|
while test "$I" -le "$numofproces"
|
||||||
do
|
do
|
||||||
PROC=`ps xa | grep $ledir/$MYSQLD | grep -v "grep" | tail -1`
|
PROC=`ps xa | grep $ledir/$MYSQLD | grep -v "grep" | sed -n '$p'`
|
||||||
for T in $PROC
|
for T in $PROC
|
||||||
do
|
do
|
||||||
break
|
break
|
||||||
|
@@ -37,7 +37,7 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome.
|
|||||||
|
|
||||||
# Documentation continued at end of file
|
# Documentation continued at end of file
|
||||||
|
|
||||||
my $VERSION = "1.14";
|
my $VERSION = "1.15";
|
||||||
|
|
||||||
my $opt_tmpdir = $ENV{TMPDIR} || "/tmp";
|
my $opt_tmpdir = $ENV{TMPDIR} || "/tmp";
|
||||||
|
|
||||||
@@ -562,7 +562,7 @@ sub copy_files {
|
|||||||
# add recursive option for scp
|
# add recursive option for scp
|
||||||
push @cp, "-r" if $^O =~ /m^(solaris|linux|freebsd)$/ && $method =~ /^scp\b/;
|
push @cp, "-r" if $^O =~ /m^(solaris|linux|freebsd)$/ && $method =~ /^scp\b/;
|
||||||
|
|
||||||
my @non_raid = grep { $_ !~ m:\d\d/: } @$files;
|
my @non_raid = grep { ! m:/\d{2}/[^/]+$: } @$files;
|
||||||
|
|
||||||
# add files to copy and the destination directory
|
# add files to copy and the destination directory
|
||||||
safe_system( @cp, @non_raid, $target );
|
safe_system( @cp, @non_raid, $target );
|
||||||
|
@@ -958,7 +958,7 @@ sub version
|
|||||||
{
|
{
|
||||||
if ($dir && -e "$dir/bin/solcon")
|
if ($dir && -e "$dir/bin/solcon")
|
||||||
{
|
{
|
||||||
$version=`$dir/bin/solcon -e"ver" $main::opt_user $main::opt_password | grep Server | head -1`;
|
$version=`$dir/bin/solcon -e"ver" $main::opt_user $main::opt_password | grep Server | sed q`;
|
||||||
if ($? == 0)
|
if ($? == 0)
|
||||||
{
|
{
|
||||||
chomp($version);
|
chomp($version);
|
||||||
|
@@ -452,9 +452,6 @@ static void make_sortkey(register SORTPARAM *param,
|
|||||||
{
|
{
|
||||||
if (field->is_null())
|
if (field->is_null())
|
||||||
{
|
{
|
||||||
if (sort_field->reverse)
|
|
||||||
bfill(to,sort_field->length+1,(char) 255);
|
|
||||||
else
|
|
||||||
bzero((char*) to,sort_field->length+1);
|
bzero((char*) to,sort_field->length+1);
|
||||||
to+= sort_field->length+1;
|
to+= sort_field->length+1;
|
||||||
continue;
|
continue;
|
||||||
|
@@ -343,6 +343,11 @@ public:
|
|||||||
null_value=(*ref)->null_value;
|
null_value=(*ref)->null_value;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
bool is_null()
|
||||||
|
{
|
||||||
|
(void) (*ref)->val_int_result();
|
||||||
|
return (*ref)->null_value;
|
||||||
|
}
|
||||||
bool get_date(TIME *ltime,bool fuzzydate)
|
bool get_date(TIME *ltime,bool fuzzydate)
|
||||||
{
|
{
|
||||||
return (null_value=(*ref)->get_date(ltime,fuzzydate));
|
return (null_value=(*ref)->get_date(ltime,fuzzydate));
|
||||||
|
@@ -64,6 +64,7 @@ public:
|
|||||||
{ return new Item_field(field);}
|
{ return new Item_field(field);}
|
||||||
table_map used_tables() const { return ~(table_map) 0; } /* Not used */
|
table_map used_tables() const { return ~(table_map) 0; } /* Not used */
|
||||||
bool const_item() const { return 0; }
|
bool const_item() const { return 0; }
|
||||||
|
bool is_null() { return null_value; }
|
||||||
void update_used_tables() { }
|
void update_used_tables() { }
|
||||||
void make_field(Send_field *field);
|
void make_field(Send_field *field);
|
||||||
void print(String *str);
|
void print(String *str);
|
||||||
@@ -202,6 +203,7 @@ public:
|
|||||||
enum Type type() const { return FIELD_AVG_ITEM; }
|
enum Type type() const { return FIELD_AVG_ITEM; }
|
||||||
double val();
|
double val();
|
||||||
longlong val_int() { return (longlong) val(); }
|
longlong val_int() { return (longlong) val(); }
|
||||||
|
bool is_null() { (void) val_int(); return null_value; }
|
||||||
String *val_str(String*);
|
String *val_str(String*);
|
||||||
void make_field(Send_field *field);
|
void make_field(Send_field *field);
|
||||||
void fix_length_and_dec() {}
|
void fix_length_and_dec() {}
|
||||||
@@ -239,6 +241,7 @@ public:
|
|||||||
double val();
|
double val();
|
||||||
longlong val_int() { return (longlong) val(); }
|
longlong val_int() { return (longlong) val(); }
|
||||||
String *val_str(String*);
|
String *val_str(String*);
|
||||||
|
bool is_null() { (void) val_int(); return null_value; }
|
||||||
void make_field(Send_field *field);
|
void make_field(Send_field *field);
|
||||||
void fix_length_and_dec() {}
|
void fix_length_and_dec() {}
|
||||||
};
|
};
|
||||||
|
@@ -672,7 +672,7 @@ String *Item_func_date_format::val_str(String *str)
|
|||||||
else
|
else
|
||||||
size=format_length(format);
|
size=format_length(format);
|
||||||
if (format == str)
|
if (format == str)
|
||||||
str= &str_value; // Save result here
|
str= &value; // Save result here
|
||||||
if (str->alloc(size))
|
if (str->alloc(size))
|
||||||
{
|
{
|
||||||
null_value=1;
|
null_value=1;
|
||||||
|
@@ -333,6 +333,7 @@ class Item_func_date_format :public Item_str_func
|
|||||||
{
|
{
|
||||||
int fixed_length;
|
int fixed_length;
|
||||||
const bool date_or_time;
|
const bool date_or_time;
|
||||||
|
String value;
|
||||||
public:
|
public:
|
||||||
Item_func_date_format(Item *a,Item *b,bool date_or_time_arg)
|
Item_func_date_format(Item *a,Item *b,bool date_or_time_arg)
|
||||||
:Item_str_func(a,b),date_or_time(date_or_time_arg) {}
|
:Item_str_func(a,b),date_or_time(date_or_time_arg) {}
|
||||||
|
@@ -484,11 +484,25 @@ static void close_connections(void)
|
|||||||
#ifdef __NT__
|
#ifdef __NT__
|
||||||
if ( hPipe != INVALID_HANDLE_VALUE )
|
if ( hPipe != INVALID_HANDLE_VALUE )
|
||||||
{
|
{
|
||||||
HANDLE hTempPipe = &hPipe;
|
HANDLE temp;
|
||||||
DBUG_PRINT( "quit", ("Closing named pipes") );
|
DBUG_PRINT( "quit", ("Closing named pipes") );
|
||||||
hPipe = INVALID_HANDLE_VALUE;
|
|
||||||
DisconnectNamedPipe( hTempPipe );
|
/* Create connection to the handle named pipe handler to break the loop */
|
||||||
CloseHandle( hTempPipe );
|
if ((temp = CreateFile(szPipeName,
|
||||||
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
OPEN_EXISTING,
|
||||||
|
0,
|
||||||
|
NULL )) != INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
WaitNamedPipe(szPipeName, 1000);
|
||||||
|
DWORD dwMode = PIPE_READMODE_BYTE | PIPE_WAIT;
|
||||||
|
SetNamedPipeHandleState(temp, &dwMode, NULL, NULL);
|
||||||
|
CancelIo(temp);
|
||||||
|
DisconnectNamedPipe(temp);
|
||||||
|
CloseHandle(temp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SYS_UN_H
|
#ifdef HAVE_SYS_UN_H
|
||||||
@@ -771,8 +785,10 @@ void clean_up(bool print_message)
|
|||||||
my_free(opt_ssl_ca,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(opt_ssl_ca,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
my_free(opt_ssl_capath,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(opt_ssl_capath,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
my_free(opt_ssl_cipher,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(opt_ssl_cipher,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
|
my_free((gptr) ssl_acceptor_fd, MYF(MY_ALLOW_ZERO_PTR));
|
||||||
opt_ssl_key=opt_ssl_cert=opt_ssl_ca=opt_ssl_capath=0;
|
opt_ssl_key=opt_ssl_cert=opt_ssl_ca=opt_ssl_capath=0;
|
||||||
#endif /* HAVE_OPENSSL */
|
#endif /* HAVE_OPENSSL */
|
||||||
|
|
||||||
free_defaults(defaults_argv);
|
free_defaults(defaults_argv);
|
||||||
my_free(charsets_list, MYF(MY_ALLOW_ZERO_PTR));
|
my_free(charsets_list, MYF(MY_ALLOW_ZERO_PTR));
|
||||||
my_free(allocated_mysql_tmpdir,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(allocated_mysql_tmpdir,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
@@ -1775,7 +1791,8 @@ int main(int argc, char **argv)
|
|||||||
if (opt_use_ssl)
|
if (opt_use_ssl)
|
||||||
{
|
{
|
||||||
ssl_acceptor_fd = new_VioSSLAcceptorFd(opt_ssl_key, opt_ssl_cert,
|
ssl_acceptor_fd = new_VioSSLAcceptorFd(opt_ssl_key, opt_ssl_cert,
|
||||||
opt_ssl_ca, opt_ssl_capath, opt_ssl_cipher);
|
opt_ssl_ca, opt_ssl_capath,
|
||||||
|
opt_ssl_cipher);
|
||||||
DBUG_PRINT("info",("ssl_acceptor_fd: %p",ssl_acceptor_fd));
|
DBUG_PRINT("info",("ssl_acceptor_fd: %p",ssl_acceptor_fd));
|
||||||
if (!ssl_acceptor_fd)
|
if (!ssl_acceptor_fd)
|
||||||
opt_use_ssl = 0;
|
opt_use_ssl = 0;
|
||||||
@@ -1906,6 +1923,14 @@ The server will not act as a slave.");
|
|||||||
if (opt_slow_log)
|
if (opt_slow_log)
|
||||||
open_log(&mysql_slow_log, glob_hostname, opt_slow_logname, "-slow.log",
|
open_log(&mysql_slow_log, glob_hostname, opt_slow_logname, "-slow.log",
|
||||||
LOG_NORMAL);
|
LOG_NORMAL);
|
||||||
|
#ifdef __WIN__
|
||||||
|
#define MYSQL_ERR_FILE "mysql.err"
|
||||||
|
if (!opt_console)
|
||||||
|
{
|
||||||
|
freopen(MYSQL_ERR_FILE,"a+",stdout);
|
||||||
|
freopen(MYSQL_ERR_FILE,"a+",stderr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (ha_init())
|
if (ha_init())
|
||||||
{
|
{
|
||||||
sql_print_error("Can't init databases");
|
sql_print_error("Can't init databases");
|
||||||
@@ -1931,13 +1956,8 @@ The server will not act as a slave.");
|
|||||||
ft_init_stopwords(ft_precompiled_stopwords);
|
ft_init_stopwords(ft_precompiled_stopwords);
|
||||||
|
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
#define MYSQL_ERR_FILE "mysql.err"
|
|
||||||
if (!opt_console)
|
if (!opt_console)
|
||||||
{
|
|
||||||
freopen(MYSQL_ERR_FILE,"a+",stdout);
|
|
||||||
freopen(MYSQL_ERR_FILE,"a+",stderr);
|
|
||||||
FreeConsole(); // Remove window
|
FreeConsole(); // Remove window
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2023,7 +2043,7 @@ The server will not act as a slave.");
|
|||||||
#ifdef __NT__
|
#ifdef __NT__
|
||||||
if (hPipe == INVALID_HANDLE_VALUE && !have_tcpip)
|
if (hPipe == INVALID_HANDLE_VALUE && !have_tcpip)
|
||||||
{
|
{
|
||||||
sql_print_error("TCP/IP must be installed on Win98 platforms");
|
sql_print_error("TCP/IP or Named Pipes should be installed on NT OS");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2082,42 +2102,26 @@ The server will not act as a slave.");
|
|||||||
#ifdef EXTRA_DEBUG2
|
#ifdef EXTRA_DEBUG2
|
||||||
sql_print_error("After lock_thread_count");
|
sql_print_error("After lock_thread_count");
|
||||||
#endif
|
#endif
|
||||||
#else
|
#endif /* __WIN__ */
|
||||||
#if !defined(EMBEDDED_LIBRARY)
|
|
||||||
if (Service.IsNT())
|
|
||||||
{
|
|
||||||
if(start_mode)
|
|
||||||
{
|
|
||||||
if (WaitForSingleObject(hEventShutdown,1000)==WAIT_TIMEOUT)
|
|
||||||
Service.Stop();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Service.SetShutdownEvent(0);
|
|
||||||
if(hEventShutdown) CloseHandle(hEventShutdown);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Service.SetShutdownEvent(0);
|
|
||||||
if(hEventShutdown) CloseHandle(hEventShutdown);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_OPENSSL
|
|
||||||
my_free((gptr)ssl_acceptor_fd,MYF(MY_ALLOW_ZERO_PTR));
|
|
||||||
#endif /* HAVE_OPENSSL */
|
|
||||||
/* Wait until cleanup is done */
|
/* Wait until cleanup is done */
|
||||||
(void) pthread_mutex_lock(&LOCK_thread_count);
|
(void) pthread_mutex_lock(&LOCK_thread_count);
|
||||||
DBUG_PRINT("quit", ("Got thread_count mutex for clean up wait"));
|
|
||||||
|
|
||||||
while (!ready_to_exit)
|
while (!ready_to_exit)
|
||||||
{
|
{
|
||||||
DBUG_PRINT("quit", ("not yet ready to exit"));
|
|
||||||
pthread_cond_wait(&COND_thread_count,&LOCK_thread_count);
|
pthread_cond_wait(&COND_thread_count,&LOCK_thread_count);
|
||||||
}
|
}
|
||||||
DBUG_PRINT("quit", ("ready to exit"));
|
|
||||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
|
|
||||||
|
#if defined(__WIN__) && !defined(EMBEDDED_LIBRARY)
|
||||||
|
if (Service.IsNT() && start_mode)
|
||||||
|
Service.Stop();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Service.SetShutdownEvent(0);
|
||||||
|
if (hEventShutdown)
|
||||||
|
CloseHandle(hEventShutdown);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
|
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
|
||||||
exit(0);
|
exit(0);
|
||||||
return(0); /* purecov: deadcode */
|
return(0); /* purecov: deadcode */
|
||||||
|
@@ -2523,13 +2523,13 @@ int QUICK_SELECT::cmp_next(QUICK_RANGE *range)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a hack: we inherit from QUICK_SELECT so that we can use the
|
This is a hack: we inherit from QUICK_SELECT so that we can use the
|
||||||
* get_next() interface, but we have to hold a pointer to the original
|
get_next() interface, but we have to hold a pointer to the original
|
||||||
* QUICK_SELECT because its data are used all over the place. What
|
QUICK_SELECT because its data are used all over the place. What
|
||||||
* should be done is to factor out the data that is needed into a base
|
should be done is to factor out the data that is needed into a base
|
||||||
* class (QUICK_SELECT), and then have two subclasses (_ASC and _DESC)
|
class (QUICK_SELECT), and then have two subclasses (_ASC and _DESC)
|
||||||
* which handle the ranges and implement the get_next() function. But
|
which handle the ranges and implement the get_next() function. But
|
||||||
* for now, this seems to work right at least.
|
for now, this seems to work right at least.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUICK_SELECT *q, uint used_key_parts)
|
QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUICK_SELECT *q, uint used_key_parts)
|
||||||
@@ -2538,6 +2538,7 @@ QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUICK_SELECT *q, uint used_key_parts)
|
|||||||
bool not_read_after_key = file->option_flag() & HA_NOT_READ_AFTER_KEY;
|
bool not_read_after_key = file->option_flag() & HA_NOT_READ_AFTER_KEY;
|
||||||
QUICK_RANGE *r;
|
QUICK_RANGE *r;
|
||||||
|
|
||||||
|
it.rewind();
|
||||||
for (r = it++; r; r = it++)
|
for (r = it++; r; r = it++)
|
||||||
{
|
{
|
||||||
rev_ranges.push_front(r);
|
rev_ranges.push_front(r);
|
||||||
|
@@ -77,6 +77,7 @@ public:
|
|||||||
void reset(void) { next=0; it.rewind(); }
|
void reset(void) { next=0; it.rewind(); }
|
||||||
int init() { return error=file->index_init(index); }
|
int init() { return error=file->index_init(index); }
|
||||||
virtual int get_next();
|
virtual int get_next();
|
||||||
|
virtual bool reverse_sorted() { return 0; }
|
||||||
int cmp_next(QUICK_RANGE *range);
|
int cmp_next(QUICK_RANGE *range);
|
||||||
bool unique_key_range();
|
bool unique_key_range();
|
||||||
};
|
};
|
||||||
@@ -87,6 +88,7 @@ class QUICK_SELECT_DESC: public QUICK_SELECT
|
|||||||
public:
|
public:
|
||||||
QUICK_SELECT_DESC(QUICK_SELECT *q, uint used_key_parts);
|
QUICK_SELECT_DESC(QUICK_SELECT *q, uint used_key_parts);
|
||||||
int get_next();
|
int get_next();
|
||||||
|
bool reverse_sorted() { return 1; }
|
||||||
private:
|
private:
|
||||||
int cmp_prev(QUICK_RANGE *range);
|
int cmp_prev(QUICK_RANGE *range);
|
||||||
bool range_reads_after_key(QUICK_RANGE *range);
|
bool range_reads_after_key(QUICK_RANGE *range);
|
||||||
@@ -96,6 +98,7 @@ private:
|
|||||||
List_iterator<QUICK_RANGE> rev_it;
|
List_iterator<QUICK_RANGE> rev_it;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class SQL_SELECT :public Sql_alloc {
|
class SQL_SELECT :public Sql_alloc {
|
||||||
public:
|
public:
|
||||||
QUICK_SELECT *quick; // If quick-select used
|
QUICK_SELECT *quick; // If quick-select used
|
||||||
|
@@ -221,6 +221,8 @@ int acl_init(bool dont_read_acl_tables)
|
|||||||
user.x509_issuer=get_field(&mem, table, 19);
|
user.x509_issuer=get_field(&mem, table, 19);
|
||||||
user.x509_subject=get_field(&mem, table, 20);
|
user.x509_subject=get_field(&mem, table, 20);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
user.ssl_type=SSL_TYPE_NONE;
|
||||||
#endif /* HAVE_OPENSSL */
|
#endif /* HAVE_OPENSSL */
|
||||||
if (user.password && (length=(uint) strlen(user.password)) == 8 &&
|
if (user.password && (length=(uint) strlen(user.password)) == 8 &&
|
||||||
protocol_version == PROTOCOL_VERSION)
|
protocol_version == PROTOCOL_VERSION)
|
||||||
|
@@ -273,7 +273,6 @@ void intern_close_table(TABLE *table)
|
|||||||
free_io_cache(table);
|
free_io_cache(table);
|
||||||
if (table->file)
|
if (table->file)
|
||||||
VOID(closefrm(table)); // close file
|
VOID(closefrm(table)); // close file
|
||||||
hash_free(&table->name_hash);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -612,8 +612,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
|
|||||||
HA_POS_ERROR : thd->select_limit,0))))
|
HA_POS_ERROR : thd->select_limit,0))))
|
||||||
order=0;
|
order=0;
|
||||||
select_describe(&join,need_tmp,
|
select_describe(&join,need_tmp,
|
||||||
(order != 0 &&
|
order != 0 && !skip_sort_order,
|
||||||
(!need_tmp || order != group || simple_group)),
|
|
||||||
select_distinct);
|
select_distinct);
|
||||||
error=0;
|
error=0;
|
||||||
goto err;
|
goto err;
|
||||||
@@ -5451,7 +5450,16 @@ static uint find_shortest_key(TABLE *table, key_map usable_keys)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Return 1 if we don't have to do file sorting */
|
/*
|
||||||
|
Test if we can skip the ORDER BY by using an index.
|
||||||
|
|
||||||
|
If we can use an index, the JOIN_TAB / tab->select struct
|
||||||
|
is changed to use the index.
|
||||||
|
|
||||||
|
Return:
|
||||||
|
0 We have to use filesort to do the sorting
|
||||||
|
1 We can use an index.
|
||||||
|
*/
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
|
test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
|
||||||
@@ -5496,6 +5504,12 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
|
|||||||
if (order_direction == -1) // If ORDER BY ... DESC
|
if (order_direction == -1) // If ORDER BY ... DESC
|
||||||
{
|
{
|
||||||
if (select && select->quick)
|
if (select && select->quick)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Don't reverse the sort order, if it's already done.
|
||||||
|
(In some cases test_if_order_by_key() can be called multiple times
|
||||||
|
*/
|
||||||
|
if (!select->quick->reverse_sorted())
|
||||||
{
|
{
|
||||||
// ORDER BY range_key DESC
|
// ORDER BY range_key DESC
|
||||||
QUICK_SELECT_DESC *tmp=new QUICK_SELECT_DESC(select->quick,
|
QUICK_SELECT_DESC *tmp=new QUICK_SELECT_DESC(select->quick,
|
||||||
@@ -5506,6 +5520,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
|
|||||||
DBUG_RETURN(0); // Reverse sort not supported
|
DBUG_RETURN(0); // Reverse sort not supported
|
||||||
}
|
}
|
||||||
select->quick=tmp;
|
select->quick=tmp;
|
||||||
|
}
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
if (tab->ref.key_parts < used_key_parts)
|
if (tab->ref.key_parts < used_key_parts)
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
extern void yyerror(const char*);
|
extern void yyerror(const char*);
|
||||||
int yylex(void *yylval);
|
int yylex(void *yylval);
|
||||||
|
|
||||||
#define yyoverflow(A,B,C,D,E,F) if (my_yyoverflow((B),(D),(F))) { yyerror((char*) (A)); return 2; }
|
#define yyoverflow(A,B,C,D,E,F) if (my_yyoverflow((B),(D),(int*) (F))) { yyerror((char*) (A)); return 2; }
|
||||||
|
|
||||||
inline Item *or_or_concat(Item* A, Item* B)
|
inline Item *or_or_concat(Item* A, Item* B)
|
||||||
{
|
{
|
||||||
|
@@ -576,6 +576,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
|
|||||||
delete outparam->file;
|
delete outparam->file;
|
||||||
outparam->file=0; // For easyer errorchecking
|
outparam->file=0; // For easyer errorchecking
|
||||||
outparam->db_stat=0;
|
outparam->db_stat=0;
|
||||||
|
hash_free(&outparam->name_hash);
|
||||||
free_root(&outparam->mem_root,MYF(0));
|
free_root(&outparam->mem_root,MYF(0));
|
||||||
my_free(outparam->table_name,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(outparam->table_name,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
DBUG_RETURN (error);
|
DBUG_RETURN (error);
|
||||||
@@ -603,6 +604,7 @@ int closefrm(register TABLE *table)
|
|||||||
}
|
}
|
||||||
delete table->file;
|
delete table->file;
|
||||||
table->file=0; /* For easyer errorchecking */
|
table->file=0; /* For easyer errorchecking */
|
||||||
|
hash_free(&table->name_hash);
|
||||||
free_root(&table->mem_root,MYF(0));
|
free_root(&table->mem_root,MYF(0));
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
@@ -1,18 +1,17 @@
|
|||||||
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
# Copyright (C) 2000 MySQL AB
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
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
|
||||||
it under the terms of the GNU General Public License as published by
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
# (at your option) any later version.
|
||||||
(at your option) any later version.
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
This program is distributed in the hope that it will be useful,
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# GNU General Public License for more details.
|
||||||
GNU General Public License for more details.
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
You should have received a copy of the GNU General Public License
|
# along with this program; if not, write to the Free Software
|
||||||
along with this program; if not, write to the Free Software
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
||||||
|
|
||||||
# Optimized longlong2str function for Intel 80x86 (gcc/gas syntax)
|
# Optimized longlong2str function for Intel 80x86 (gcc/gas syntax)
|
||||||
# Some set sequences are optimized for pentuimpro II
|
# Some set sequences are optimized for pentuimpro II
|
||||||
|
@@ -1,38 +1,37 @@
|
|||||||
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
# 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; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
# Optimized string functions Intel 80x86 (gcc/gas syntax)
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
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 */
|
|
||||||
|
|
||||||
/* Optimized string functions Intel 80x86 (gcc/gas syntax) */
|
|
||||||
|
|
||||||
.file "strings.s"
|
.file "strings.s"
|
||||||
.version "1.00"
|
.version "1.00"
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
/* Move a alligned, not overlapped, by (long) divided memory area */
|
# Move a alligned, not overlapped, by (long) divided memory area
|
||||||
/* Args: to,from,length */
|
# Args: to,from,length
|
||||||
|
|
||||||
.globl bmove_allign
|
.globl bmove_allign
|
||||||
.type bmove_allign,@function
|
.type bmove_allign,@function
|
||||||
bmove_allign:
|
bmove_allign:
|
||||||
movl %edi,%edx
|
movl %edi,%edx
|
||||||
movl %esi,%eax
|
movl %esi,%eax
|
||||||
movl 4(%esp),%edi /* to */
|
movl 4(%esp),%edi # to
|
||||||
movl 8(%esp),%esi /* from */
|
movl 8(%esp),%esi # from
|
||||||
movl 12(%esp),%ecx /* length */
|
movl 12(%esp),%ecx # length
|
||||||
addw $3,%cx /* fix if not divisible with long */
|
addw $3,%cx # fix if not divisible with long
|
||||||
shrw $2,%cx
|
shrw $2,%cx
|
||||||
rep
|
rep
|
||||||
movsl
|
movsl
|
||||||
@@ -42,198 +41,198 @@ bmove_allign:
|
|||||||
.end:
|
.end:
|
||||||
.size bmove_allign,.end-bmove_allign
|
.size bmove_allign,.end-bmove_allign
|
||||||
|
|
||||||
/* Move a string from higher to lower */
|
# Move a string from higher to lower
|
||||||
/* Arg from+1,to+1,length */
|
# Arg from+1,to+1,length
|
||||||
|
|
||||||
.globl bmove_upp
|
.globl bmove_upp
|
||||||
.type bmove_upp,@function
|
.type bmove_upp,@function
|
||||||
bmove_upp:
|
bmove_upp:
|
||||||
std /* Work downward */
|
std # Work downward
|
||||||
movl %edi,%edx
|
movl %edi,%edx
|
||||||
movl %esi,%eax
|
movl %esi,%eax
|
||||||
movl 4(%esp),%edi /* p1 */
|
movl 4(%esp),%edi # p1
|
||||||
movl 8(%esp),%esi /* p2 */
|
movl 8(%esp),%esi # p2
|
||||||
movl 12(%esp),%ecx /* length */
|
movl 12(%esp),%ecx # length
|
||||||
decl %edi /* Don't move last arg */
|
decl %edi # Don't move last arg
|
||||||
decl %esi
|
decl %esi
|
||||||
rep
|
rep
|
||||||
movsb /* One byte a time because overlap */
|
movsb # One byte a time because overlap
|
||||||
cld /* C library wants cld */
|
cld # C library wants cld
|
||||||
movl %eax,%esi
|
movl %eax,%esi
|
||||||
movl %edx,%edi
|
movl %edx,%edi
|
||||||
ret
|
ret
|
||||||
.bmove_upp_end:
|
.bmove_upp_end:
|
||||||
.size bmove_upp,.bmove_upp_end-bmove_upp
|
.size bmove_upp,.bmove_upp_end-bmove_upp
|
||||||
|
|
||||||
/* Append fillchars to string */
|
# Append fillchars to string
|
||||||
/* Args: dest,len,fill */
|
# Args: dest,len,fill
|
||||||
|
|
||||||
.globl strappend
|
.globl strappend
|
||||||
.type strappend,@function
|
.type strappend,@function
|
||||||
strappend:
|
strappend:
|
||||||
pushl %edi
|
pushl %edi
|
||||||
movl 8(%esp),%edi /* Memory pointer */
|
movl 8(%esp),%edi # Memory pointer
|
||||||
movl 12(%esp),%ecx /* Length */
|
movl 12(%esp),%ecx # Length
|
||||||
clrl %eax /* Find end of string */
|
clrl %eax # Find end of string
|
||||||
repne
|
repne
|
||||||
scasb
|
scasb
|
||||||
jnz sa_99 /* String to long, shorten it */
|
jnz sa_99 # String to long, shorten it
|
||||||
movzb 16(%esp),%eax /* Fillchar */
|
movzb 16(%esp),%eax # Fillchar
|
||||||
decl %edi /* Point at end null */
|
decl %edi # Point at end null
|
||||||
incl %ecx /* rep made one dec for null-char */
|
incl %ecx # rep made one dec for null-char
|
||||||
|
|
||||||
movb %al,%ah /* (2) Set up a 32 bit pattern. */
|
movb %al,%ah # (2) Set up a 32 bit pattern.
|
||||||
movw %ax,%dx /* (2) */
|
movw %ax,%dx # (2)
|
||||||
shll $16,%eax /* (3) */
|
shll $16,%eax # (3)
|
||||||
movw %dx,%ax /* (2) %eax has the 32 bit pattern. */
|
movw %dx,%ax # (2) %eax has the 32 bit pattern.
|
||||||
|
|
||||||
movl %ecx,%edx /* (2) Save the count of bytes. */
|
movl %ecx,%edx # (2) Save the count of bytes.
|
||||||
shrl $2,%ecx /* (2) Number of dwords. */
|
shrl $2,%ecx # (2) Number of dwords.
|
||||||
rep
|
rep
|
||||||
stosl /* (5 + 5n) */
|
stosl # (5 + 5n)
|
||||||
movb $3,%cl /* (2) */
|
movb $3,%cl # (2)
|
||||||
and %edx,%ecx /* (2) Fill in the odd bytes*/
|
and %edx,%ecx # (2) Fill in the odd bytes
|
||||||
rep
|
rep
|
||||||
stosb /* Move last bytes if any */
|
stosb # Move last bytes if any
|
||||||
|
|
||||||
sa_99: movb $0,(%edi) /* End of string */
|
sa_99: movb $0,(%edi) # End of string
|
||||||
popl %edi
|
popl %edi
|
||||||
ret
|
ret
|
||||||
.strappend_end:
|
.strappend_end:
|
||||||
.size strappend,.strappend_end-strappend
|
.size strappend,.strappend_end-strappend
|
||||||
|
|
||||||
/* Find if string contains any char in another string */
|
# Find if string contains any char in another string
|
||||||
/* Arg: str,set */
|
# Arg: str,set
|
||||||
/* Ret: Pointer to first found char in str */
|
# Ret: Pointer to first found char in str
|
||||||
|
|
||||||
.globl strcont
|
.globl strcont
|
||||||
.type strcont,@function
|
.type strcont,@function
|
||||||
strcont:
|
strcont:
|
||||||
movl %edi,%edx
|
movl %edi,%edx
|
||||||
pushl %esi
|
pushl %esi
|
||||||
movl 8(%esp),%esi /* str */
|
movl 8(%esp),%esi # str
|
||||||
movl 12(%esp),%ecx /* set */
|
movl 12(%esp),%ecx # set
|
||||||
clrb %ah /* For endtest */
|
clrb %ah # For endtest
|
||||||
jmp sc_60
|
jmp sc_60
|
||||||
|
|
||||||
sc_10: scasb
|
sc_10: scasb
|
||||||
jz sc_fo /* Found char */
|
jz sc_fo # Found char
|
||||||
sc_20: cmp (%edi),%ah /* Test if null */
|
sc_20: cmp (%edi),%ah # Test if null
|
||||||
jnz sc_10 /* Not end of set yet */
|
jnz sc_10 # Not end of set yet
|
||||||
incl %esi /* Next char in str */
|
incl %esi # Next char in str
|
||||||
sc_60: movl %ecx,%edi /* %edi = Set */
|
sc_60: movl %ecx,%edi # %edi = Set
|
||||||
movb (%esi),%al /* Test if this char exist */
|
movb (%esi),%al # Test if this char exist
|
||||||
andb %al,%al
|
andb %al,%al
|
||||||
jnz sc_20 /* Not end of string */
|
jnz sc_20 # Not end of string
|
||||||
clrl %esi /* Return Null */
|
clrl %esi # Return Null
|
||||||
sc_fo: movl %esi,%eax /* Char found here */
|
sc_fo: movl %esi,%eax # Char found here
|
||||||
movl %edx,%edi /* Restore */
|
movl %edx,%edi # Restore
|
||||||
popl %esi
|
popl %esi
|
||||||
ret
|
ret
|
||||||
.strcont_end:
|
.strcont_end:
|
||||||
.size strcont,.strcont_end-strcont
|
.size strcont,.strcont_end-strcont
|
||||||
|
|
||||||
/* Find end of string */
|
# Find end of string
|
||||||
/* Arg: str */
|
# Arg: str
|
||||||
/* ret: Pointer to end null */
|
# ret: Pointer to end null
|
||||||
|
|
||||||
.globl strend
|
.globl strend
|
||||||
.type strend,@function
|
.type strend,@function
|
||||||
strend:
|
strend:
|
||||||
movl %edi,%edx /* Save */
|
movl %edi,%edx # Save
|
||||||
movl 4(%esp),%edi /* str */
|
movl 4(%esp),%edi # str
|
||||||
clrl %eax /* Find end of string */
|
clrl %eax # Find end of string
|
||||||
movl %eax,%ecx
|
movl %eax,%ecx
|
||||||
decl %ecx /* ECX = -1 */
|
decl %ecx # ECX = -1
|
||||||
repne
|
repne
|
||||||
scasb
|
scasb
|
||||||
movl %edi,%eax
|
movl %edi,%eax
|
||||||
decl %eax /* End of string */
|
decl %eax # End of string
|
||||||
movl %edx,%edi /* Restore */
|
movl %edx,%edi # Restore
|
||||||
ret
|
ret
|
||||||
.strend_end:
|
.strend_end:
|
||||||
.size strend,.strend_end-strend
|
.size strend,.strend_end-strend
|
||||||
|
|
||||||
/* Make a string with len fill-chars and endnull */
|
# Make a string with len fill-chars and endnull
|
||||||
/* Args: dest,len,fill */
|
# Args: dest,len,fill
|
||||||
/* Ret: dest+len */
|
# Ret: dest+len
|
||||||
|
|
||||||
.globl strfill
|
.globl strfill
|
||||||
.type strfill,@function
|
.type strfill,@function
|
||||||
strfill:
|
strfill:
|
||||||
pushl %edi
|
pushl %edi
|
||||||
movl 8(%esp),%edi /* Memory pointer */
|
movl 8(%esp),%edi # Memory pointer
|
||||||
movl 12(%esp),%ecx /* Length */
|
movl 12(%esp),%ecx # Length
|
||||||
movzb 16(%esp),%eax /* Fill */
|
movzb 16(%esp),%eax # Fill
|
||||||
|
|
||||||
movb %al,%ah /* (2) Set up a 32 bit pattern */
|
movb %al,%ah # (2) Set up a 32 bit pattern
|
||||||
movw %ax,%dx /* (2) */
|
movw %ax,%dx # (2)
|
||||||
shll $16,%eax /* (3) */
|
shll $16,%eax # (3)
|
||||||
movw %dx,%ax /* (2) %eax has the 32 bit pattern. */
|
movw %dx,%ax # (2) %eax has the 32 bit pattern.
|
||||||
|
|
||||||
movl %ecx,%edx /* (2) Save the count of bytes. */
|
movl %ecx,%edx # (2) Save the count of bytes.
|
||||||
shrl $2,%ecx /* (2) Number of dwords. */
|
shrl $2,%ecx # (2) Number of dwords.
|
||||||
rep
|
rep
|
||||||
stosl /* (5 + 5n) */
|
stosl # (5 + 5n)
|
||||||
movb $3,%cl /* (2) */
|
movb $3,%cl # (2)
|
||||||
and %edx,%ecx /* (2) Fill in the odd bytes */
|
and %edx,%ecx # (2) Fill in the odd bytes
|
||||||
rep
|
rep
|
||||||
stosb /* Move last bytes if any */
|
stosb # Move last bytes if any
|
||||||
|
|
||||||
movb %cl,(%edi) /* End NULL */
|
movb %cl,(%edi) # End NULL
|
||||||
movl %edi,%eax /* End i %eax */
|
movl %edi,%eax # End i %eax
|
||||||
popl %edi
|
popl %edi
|
||||||
ret
|
ret
|
||||||
.strfill_end:
|
.strfill_end:
|
||||||
.size strfill,.strfill_end-strfill
|
.size strfill,.strfill_end-strfill
|
||||||
|
|
||||||
|
|
||||||
/* Find a char in or end of a string */
|
# Find a char in or end of a string
|
||||||
/* Arg: str,char */
|
# Arg: str,char
|
||||||
/* Ret: pointer to found char or NullS */
|
# Ret: pointer to found char or NullS
|
||||||
|
|
||||||
.globl strcend
|
.globl strcend
|
||||||
.type strcend,@function
|
.type strcend,@function
|
||||||
strcend:
|
strcend:
|
||||||
movl %edi,%edx
|
movl %edi,%edx
|
||||||
movl 4(%esp),%edi /* str */
|
movl 4(%esp),%edi # str
|
||||||
movb 8(%esp),%ah /* search */
|
movb 8(%esp),%ah # search
|
||||||
clrb %al /* for scasb to find end */
|
clrb %al # for scasb to find end
|
||||||
|
|
||||||
se_10: cmpb (%edi),%ah
|
se_10: cmpb (%edi),%ah
|
||||||
jz se_20 /* Found char */
|
jz se_20 # Found char
|
||||||
scasb
|
scasb
|
||||||
jnz se_10 /* Not end */
|
jnz se_10 # Not end
|
||||||
dec %edi /* Not found, point at end of string */
|
dec %edi # Not found, point at end of string
|
||||||
se_20: movl %edi,%eax
|
se_20: movl %edi,%eax
|
||||||
movl %edx,%edi /* Restore */
|
movl %edx,%edi # Restore
|
||||||
ret
|
ret
|
||||||
.strcend_end:
|
.strcend_end:
|
||||||
.size strcend,.strcend_end-strcend
|
.size strcend,.strcend_end-strcend
|
||||||
|
|
||||||
/* Test if string has a given suffix */
|
# Test if string has a given suffix
|
||||||
|
|
||||||
.globl is_prefix
|
.globl is_prefix
|
||||||
.type is_prefix,@function
|
.type is_prefix,@function
|
||||||
is_prefix:
|
is_prefix:
|
||||||
movl %edi,%edx /* Save %edi */
|
movl %edi,%edx # Save %edi
|
||||||
pushl %esi /* and %esi */
|
pushl %esi # and %esi
|
||||||
movl 12(%esp),%esi /* get suffix */
|
movl 12(%esp),%esi # get suffix
|
||||||
movl 8(%esp),%edi /* s1 */
|
movl 8(%esp),%edi # s1
|
||||||
movl $1,%eax /* Ok and zero-test */
|
movl $1,%eax # Ok and zero-test
|
||||||
ip_10: cmpb (%esi),%ah
|
ip_10: cmpb (%esi),%ah
|
||||||
jz suf_ok /* End of string/ found suffix */
|
jz suf_ok # End of string/ found suffix
|
||||||
cmpsb /* Compare strings */
|
cmpsb # Compare strings
|
||||||
jz ip_10 /* Same, possible prefix */
|
jz ip_10 # Same, possible prefix
|
||||||
xor %eax,%eax /* Not suffix */
|
xor %eax,%eax # Not suffix
|
||||||
suf_ok: popl %esi
|
suf_ok: popl %esi
|
||||||
movl %edx,%edi
|
movl %edx,%edi
|
||||||
ret
|
ret
|
||||||
.is_prefix_end:
|
.is_prefix_end:
|
||||||
.size is_prefix,.is_prefix_end-is_prefix
|
.size is_prefix,.is_prefix_end-is_prefix
|
||||||
|
|
||||||
/* Find a substring in string */
|
# Find a substring in string
|
||||||
/* Arg: str,search */
|
# Arg: str,search
|
||||||
|
|
||||||
.globl strstr
|
.globl strstr
|
||||||
.type strstr,@function
|
.type strstr,@function
|
||||||
@@ -241,31 +240,31 @@ suf_ok: popl %esi
|
|||||||
strstr:
|
strstr:
|
||||||
pushl %edi
|
pushl %edi
|
||||||
pushl %esi
|
pushl %esi
|
||||||
movl 12(%esp),%esi /* str */
|
movl 12(%esp),%esi # str
|
||||||
movl 16(%esp),%edi /* search */
|
movl 16(%esp),%edi # search
|
||||||
movl %edi,%ecx
|
movl %edi,%ecx
|
||||||
incl %ecx /* %ecx = search+1 */
|
incl %ecx # %ecx = search+1
|
||||||
movb (%edi),%ah /* %ah = First char in search */
|
movb (%edi),%ah # %ah = First char in search
|
||||||
jmp sf_10
|
jmp sf_10
|
||||||
|
|
||||||
sf_00: movl %edx,%esi /* si = Current str-pos */
|
sf_00: movl %edx,%esi # si = Current str-pos
|
||||||
sf_10: movb (%esi),%al /* Test if this char exist */
|
sf_10: movb (%esi),%al # Test if this char exist
|
||||||
andb %al,%al
|
andb %al,%al
|
||||||
jz sf_90 /* End of string, didn't find search */
|
jz sf_90 # End of string, didn't find search
|
||||||
incl %esi
|
incl %esi
|
||||||
cmpb %al,%ah
|
cmpb %al,%ah
|
||||||
jnz sf_10 /* Didn't find first char, continue */
|
jnz sf_10 # Didn't find first char, continue
|
||||||
movl %esi,%edx /* Save str-pos in %edx */
|
movl %esi,%edx # Save str-pos in %edx
|
||||||
movl %ecx,%edi
|
movl %ecx,%edi
|
||||||
sf_20: cmpb $0,(%edi)
|
sf_20: cmpb $0,(%edi)
|
||||||
jz sf_fo /* Found substring */
|
jz sf_fo # Found substring
|
||||||
cmpsb
|
cmpsb
|
||||||
jz sf_20 /* Char ok */
|
jz sf_20 # Char ok
|
||||||
jmp sf_00 /* Next str-pos */
|
jmp sf_00 # Next str-pos
|
||||||
|
|
||||||
sf_90: movl $1,%edx /* Return Null */
|
sf_90: movl $1,%edx # Return Null
|
||||||
sf_fo: movl %edx,%eax /* Char found here */
|
sf_fo: movl %edx,%eax # Char found here
|
||||||
decl %eax /* Pointed one after */
|
decl %eax # Pointed one after
|
||||||
popl %esi
|
popl %esi
|
||||||
popl %edi
|
popl %edi
|
||||||
ret
|
ret
|
||||||
@@ -273,8 +272,8 @@ sf_fo: movl %edx,%eax /* Char found here */
|
|||||||
.size strstr,.strstr_end-strstr
|
.size strstr,.strstr_end-strstr
|
||||||
|
|
||||||
|
|
||||||
/* Find a substring in string, return index */
|
# Find a substring in string, return index
|
||||||
/* Arg: str,search */
|
# Arg: str,search
|
||||||
|
|
||||||
.globl strinstr
|
.globl strinstr
|
||||||
.type strinstr,@function
|
.type strinstr,@function
|
||||||
@@ -282,22 +281,22 @@ sf_fo: movl %edx,%eax /* Char found here */
|
|||||||
strinstr:
|
strinstr:
|
||||||
pushl %ebp
|
pushl %ebp
|
||||||
movl %esp,%ebp
|
movl %esp,%ebp
|
||||||
pushl 12(%ebp) /* search */
|
pushl 12(%ebp) # search
|
||||||
pushl 8(%ebp) /* str */
|
pushl 8(%ebp) # str
|
||||||
call strstr
|
call strstr
|
||||||
add $8,%esp
|
add $8,%esp
|
||||||
or %eax,%eax
|
or %eax,%eax
|
||||||
jz si_99 /* Not found, return NULL */
|
jz si_99 # Not found, return NULL
|
||||||
sub 8(%ebp),%eax /* Pos from start */
|
sub 8(%ebp),%eax # Pos from start
|
||||||
inc %eax /* And first pos = 1 */
|
inc %eax # And first pos = 1
|
||||||
si_99: popl %ebp
|
si_99: popl %ebp
|
||||||
ret
|
ret
|
||||||
.strinstr_end:
|
.strinstr_end:
|
||||||
.size strinstr,.strinstr_end-strinstr
|
.size strinstr,.strinstr_end-strinstr
|
||||||
|
|
||||||
/* Make a string of len length from another string */
|
# Make a string of len length from another string
|
||||||
/* Arg: dst,src,length */
|
# Arg: dst,src,length
|
||||||
/* ret: end of dst */
|
# ret: end of dst
|
||||||
|
|
||||||
.globl strmake
|
.globl strmake
|
||||||
.type strmake,@function
|
.type strmake,@function
|
||||||
@@ -305,48 +304,48 @@ si_99: popl %ebp
|
|||||||
strmake:
|
strmake:
|
||||||
pushl %edi
|
pushl %edi
|
||||||
pushl %esi
|
pushl %esi
|
||||||
movl 12(%esp),%edi /* dst */
|
movl 12(%esp),%edi # dst
|
||||||
movl 16(%esp),%esi /* src */
|
movl 16(%esp),%esi # src
|
||||||
movl 20(%esp),%ecx /* Length of memory-area */
|
movl 20(%esp),%ecx # Length of memory-area
|
||||||
clrb %al /* For test of end-null */
|
clrb %al # For test of end-null
|
||||||
jecxz sm_90 /* Nothing to move, put zero at end. */
|
jecxz sm_90 # Nothing to move, put zero at end.
|
||||||
|
|
||||||
sm_10: cmpb (%esi),%al /* Next char to move */
|
sm_10: cmpb (%esi),%al # Next char to move
|
||||||
movsb /* move arg */
|
movsb # move arg
|
||||||
jz sm_99 /* last char, we are ready */
|
jz sm_99 # last char, we are ready
|
||||||
loop sm_10 /* Continue moving */
|
loop sm_10 # Continue moving
|
||||||
sm_90: movb %al,(%edi) /* Set end pos */
|
sm_90: movb %al,(%edi) # Set end pos
|
||||||
incl %edi /* Fix that di points at end null */
|
incl %edi # Fix that di points at end null
|
||||||
sm_99: decl %edi /* di points now at end null */
|
sm_99: decl %edi # di points now at end null
|
||||||
movl %edi,%eax /* Ret value.p $ */
|
movl %edi,%eax # Ret value.p $
|
||||||
popl %esi
|
popl %esi
|
||||||
popl %edi
|
popl %edi
|
||||||
ret
|
ret
|
||||||
.strmake_end:
|
.strmake_end:
|
||||||
.size strmake,.strmake_end-strmake
|
.size strmake,.strmake_end-strmake
|
||||||
|
|
||||||
/* Move a string with max len chars */
|
# Move a string with max len chars
|
||||||
/* arg: dst,src,len */
|
# arg: dst,src,len
|
||||||
/* ret: pos to first null or dst+len */
|
# ret: pos to first null or dst+len
|
||||||
|
|
||||||
.globl strnmov
|
.globl strnmov
|
||||||
.type strnmov,@function
|
.type strnmov,@function
|
||||||
strnmov:
|
strnmov:
|
||||||
pushl %edi
|
pushl %edi
|
||||||
pushl %esi
|
pushl %esi
|
||||||
movl 12(%esp),%edi /* dst */
|
movl 12(%esp),%edi # dst
|
||||||
movl 16(%esp),%esi /* src */
|
movl 16(%esp),%esi # src
|
||||||
movl 20(%esp),%ecx /* Length of memory-area */
|
movl 20(%esp),%ecx # Length of memory-area
|
||||||
jecxz snm_99 /* Nothing to do */
|
jecxz snm_99 # Nothing to do
|
||||||
clrb %al /* For test of end-null */
|
clrb %al # For test of end-null
|
||||||
|
|
||||||
snm_10: cmpb (%esi),%al /* Next char to move */
|
snm_10: cmpb (%esi),%al # Next char to move
|
||||||
movsb /* move arg */
|
movsb # move arg
|
||||||
jz snm_20 /* last char, fill with null */
|
jz snm_20 # last char, fill with null
|
||||||
loop snm_10 /* Continue moving */
|
loop snm_10 # Continue moving
|
||||||
incl %edi /* Point two after last */
|
incl %edi # Point two after last
|
||||||
snm_20: decl %edi /* Point at first null (or last+1) */
|
snm_20: decl %edi # Point at first null (or last+1)
|
||||||
snm_99: movl %edi,%eax /* Pointer at last char */
|
snm_99: movl %edi,%eax # Pointer at last char
|
||||||
popl %esi
|
popl %esi
|
||||||
popl %edi
|
popl %edi
|
||||||
ret
|
ret
|
||||||
@@ -357,17 +356,17 @@ snm_99: movl %edi,%eax /* Pointer at last char */
|
|||||||
.globl strmov
|
.globl strmov
|
||||||
.type strmov,@function
|
.type strmov,@function
|
||||||
strmov:
|
strmov:
|
||||||
movl %esi,%ecx /* Save old %esi and %edi */
|
movl %esi,%ecx # Save old %esi and %edi
|
||||||
movl %edi,%edx
|
movl %edi,%edx
|
||||||
movl 8(%esp),%esi /* get source pointer (s2) */
|
movl 8(%esp),%esi # get source pointer (s2)
|
||||||
movl 4(%esp),%edi /* %edi -> s1 */
|
movl 4(%esp),%edi # %edi -> s1
|
||||||
smo_10: movb (%esi),%al
|
smo_10: movb (%esi),%al
|
||||||
movsb /* move arg */
|
movsb # move arg
|
||||||
andb %al,%al
|
andb %al,%al
|
||||||
jnz smo_10 /* Not last */
|
jnz smo_10 # Not last
|
||||||
movl %edi,%eax
|
movl %edi,%eax
|
||||||
dec %eax
|
dec %eax
|
||||||
movl %ecx,%esi /* Restore */
|
movl %ecx,%esi # Restore
|
||||||
movl %edx,%edi
|
movl %edx,%edi
|
||||||
ret
|
ret
|
||||||
.strmov_end:
|
.strmov_end:
|
||||||
@@ -376,29 +375,29 @@ smo_10: movb (%esi),%al
|
|||||||
.globl strxmov
|
.globl strxmov
|
||||||
.type strxmov,@function
|
.type strxmov,@function
|
||||||
strxmov:
|
strxmov:
|
||||||
movl %ebx,%edx /* Save %ebx, %esi and %edi */
|
movl %ebx,%edx # Save %ebx, %esi and %edi
|
||||||
mov %esi,%ecx
|
mov %esi,%ecx
|
||||||
push %edi
|
push %edi
|
||||||
leal 8(%esp),%ebx /* Get destination */
|
leal 8(%esp),%ebx # Get destination
|
||||||
movl (%ebx),%edi
|
movl (%ebx),%edi
|
||||||
xorb %al,%al
|
xorb %al,%al
|
||||||
jmp next_str /* Handle source ebx+4 */
|
jmp next_str # Handle source ebx+4
|
||||||
|
|
||||||
start_str:
|
start_str:
|
||||||
movsb
|
movsb
|
||||||
cmpb -1(%edi),%al
|
cmpb -1(%edi),%al
|
||||||
jne start_str
|
jne start_str
|
||||||
decl %edi /* Don't copy last null */
|
decl %edi # Don't copy last null
|
||||||
|
|
||||||
next_str:
|
next_str:
|
||||||
addl $4,%ebx
|
addl $4,%ebx
|
||||||
movl (%ebx),%esi
|
movl (%ebx),%esi
|
||||||
orl %esi,%esi
|
orl %esi,%esi
|
||||||
jne start_str
|
jne start_str
|
||||||
movb %al,0(%edi) /* Force last to ASCII 0 */
|
movb %al,0(%edi) # Force last to ASCII 0
|
||||||
|
|
||||||
movl %edi,%eax /* Return ptr to ASCII 0 */
|
movl %edi,%eax # Return ptr to ASCII 0
|
||||||
pop %edi /* Restore registers */
|
pop %edi # Restore registers
|
||||||
movl %ecx,%esi
|
movl %ecx,%esi
|
||||||
movl %edx,%ebx
|
movl %edx,%ebx
|
||||||
ret
|
ret
|
||||||
|
Reference in New Issue
Block a user