1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Manual merge from mysql-trunk.

Conflicts:
  - client/mysqltest.cc
  - mysql-test/collections/default.experimental
  - mysql-test/suite/rpl/t/disabled.def
  - sql/mysqld.cc
  - sql/opt_range.cc
  - sql/sp.cc
  - sql/sql_acl.cc
  - sql/sql_partition.cc
  - sql/sql_table.cc
This commit is contained in:
Alexander Nozdrin
2009-12-11 12:39:38 +03:00
1063 changed files with 62539 additions and 35389 deletions

View File

@ -1139,6 +1139,7 @@ libmysqld/protocol_cursor.cc
libmysqld/records.cc libmysqld/records.cc
libmysqld/repl_failsafe.cc libmysqld/repl_failsafe.cc
libmysqld/rpl_filter.cc libmysqld/rpl_filter.cc
libmysqld/rpl_handler.cc
libmysqld/rpl_injector.cc libmysqld/rpl_injector.cc
libmysqld/rpl_record.cc libmysqld/rpl_record.cc
libmysqld/rpl_record_old.cc libmysqld/rpl_record_old.cc
@ -3064,4 +3065,8 @@ sql/share/spanish
sql/share/swedish sql/share/swedish
sql/share/ukrainian sql/share/ukrainian
libmysqld/examples/mysqltest.cc libmysqld/examples/mysqltest.cc
libmysqld/sql_signal.cc
libmysqld/rpl_handler.cc
libmysqld/debug_sync.cc libmysqld/debug_sync.cc
libmysqld/rpl_handler.cc
dbug/tests

View File

@ -1,37 +0,0 @@
.snprj
COPYING
COPYING.LIB
INSTALL-SOURCE
INSTALL-SOURCE-GENERIC
Logs
MIRRORS
Makefile
Makefile.in
NEW-RPMS
PUBLIC
Projects
TODO
WIN-LICENSE
aclocal.m4
binary
compile
confdefs.h
config.cache
config.h
config.log
config.status
configure
configure.in-removed
conftest.c
conftest.s1
conftest.s2
conftest.subs
internal-docs
libtool
linked_client_sources
linked_server_sources
mysql-copyright-120700-194832
mysql-copyright-120700-221248
skr
stamp-h
tmp

View File

@ -556,7 +556,7 @@ parse_package()
package="pro" package="pro"
;; ;;
extended ) extended )
package="" package="extended"
;; ;;
cge ) cge )
package="cge" package="cge"
@ -1274,7 +1274,7 @@ set_bsd_configs()
if test "x$fast_flag" != "xno" ; then if test "x$fast_flag" != "xno" ; then
compiler_flags="$compiler_flags -O3" compiler_flags="$compiler_flags -O3"
else else
compiler_flags="$compiler_flags -O" compiler_flags="$compiler_flags -O0"
fi fi
set_cc_and_cxx_for_gcc set_cc_and_cxx_for_gcc
} }
@ -1305,7 +1305,7 @@ set_linux_configs()
if test "x$fast_flag" != "xno" ; then if test "x$fast_flag" != "xno" ; then
compiler_flags="$compiler_flags -O2" compiler_flags="$compiler_flags -O2"
else else
compiler_flags="$compiler_flags -O" compiler_flags="$compiler_flags -O0"
fi fi
# configure will set proper compiler flags for gcc on Linux # configure will set proper compiler flags for gcc on Linux
elif test "x$compiler" = "xicc" ; then elif test "x$compiler" = "xicc" ; then
@ -1375,8 +1375,8 @@ set_solaris_configs()
LDFLAGS="$LDFLAGS -O2" LDFLAGS="$LDFLAGS -O2"
compiler_flags="$compiler_flags -O2" compiler_flags="$compiler_flags -O2"
else else
LDFLAGS="$LDFLAGS -O" LDFLAGS="$LDFLAGS -O0"
compiler_flags="$compiler_flags -O" compiler_flags="$compiler_flags -O0"
fi fi
fi fi
else else
@ -1407,7 +1407,7 @@ set_solaris_configs()
elif test "x$fast_flag" = "xgeneric" ; then elif test "x$fast_flag" = "xgeneric" ; then
compiler_flags="$compiler_flags -xO2" compiler_flags="$compiler_flags -xO2"
else else
compiler_flags="$compiler_flags -xO" compiler_flags="$compiler_flags -xO0"
fi fi
else else
#Using SPARC cpu with SunStudio (Forte) compiler #Using SPARC cpu with SunStudio (Forte) compiler
@ -1421,7 +1421,7 @@ set_solaris_configs()
elif test "x$fast_flag" = "xgeneric" ; then elif test "x$fast_flag" = "xgeneric" ; then
compiler_flags="$compiler_flags -xO2" compiler_flags="$compiler_flags -xO2"
else else
compiler_flags="$compiler_flags -xO" compiler_flags="$compiler_flags -xO0"
fi fi
fi fi
fi fi
@ -1452,7 +1452,7 @@ set_macosx_configs()
if test "x$fast_flag" != "xno" ; then if test "x$fast_flag" != "xno" ; then
compiler_flags="$compiler_flags -Os" compiler_flags="$compiler_flags -Os"
else else
compiler_flags="$compiler_flags -O" compiler_flags="$compiler_flags -O0"
fi fi
set_cc_and_cxx_for_gcc set_cc_and_cxx_for_gcc
} }

View File

@ -1,62 +0,0 @@
44d03f27qNdqJmARzBoP3Is_cN5e0w
44ec850ac2k4y2Omgr92GiWPBAVKGQ
44edb86b1iE5knJ97MbliK_3lCiAXA
44f33f3aj5KW5qweQeekY1LU0E9ZCg
45001f7c3b2hhCXDKfUvzkX9TNe6VA
45002051rHJfMEXAIMiAZV0clxvKSA
4513d8e4Af4dQWuk13sArwofRgFDQw
45143312u0Tz4r0wPXCbUKwdHa2jWA
45143b90ewOQuTW8-jrB3ZSAQvMRJw
45184588w9U72A6KX1hUFeAC4shSHA
45185df8mZbxfp85FbA0VxUXkmDewA
4519a6c5BVUxEHTf5iJnjZkixMBs8g
451ab499rgdjXyOnUDqHu-wBDoS-OQ
451b110a3ZV6MITl93ehXk2wxrbW7g
45214442pBGT9KuZEGixBH71jTzbOA
45214a07hVsIGwvwa-WrO-jpeaSwVw
452a92d0-31-8wSzSfZi165fcGcXPA
452c6c6dAjuNghfc1ObZ_UQ5SCl85g
4538a7b0EbDHHkWPbIwxO6ZIDdg6Dg
454a7ef8gdvE_ddMlJyghvOAkKPNOQ
454bb488ijVLOUK_GFjcoISE0GxPUA
454bb9a8AwlGRC_wWLS2sNMoRBMRGw
454c946ciQoR4dfTBZ0RTBmGJKp6lw
454f6e7eAnfLD9OCbGr5X9KiKvfKcQ
454f704bJiJy0_Nx2drY9P5kK3uOzg
454f8960jsVT_kMKJtZ9OCgXoba0xQ
454fa71cxshxszXJQYa9jbo0-_hAHw
4550b0ceIcozdgQhWFUTAtWkN196lA
4554a95d7txO1DuO9G3nAizI3SkFAA
4554b3722d71SbPiI2Gx-RhbZjmuIQ
4558b3d73Cxjlb7Wv1oytdSTthxDfw
4561b2ecZbhuAc0TTDdCdultxUYaMw
4561bde4qWhz1I8tkItXKex5uniipA
4562ba016dYH0JzszOqZ8p6psbKfnQ
45771031yRCoM_ZfONdYchPvVEgLRg
459a60d8rIxeTuhB3j_QsOwLGdcpng
459a61c9OS8PzIsdviZJDkybJ1y1uA
459a70691aYIfU2ohV0a3P5iTLpO2A
459a7422KF_P7PuU3YQ5qG6ZLEVpiA
459a74e4nRcXppMSBYeQQ5efDkTADg
459c03b9N_mqF2XJKK6DwSrIt7e6_g
459c1965_BQMBzBO8S_gVqjTHYQrmw
459c2098XoAUsUn8N07IVRDD6CTM-A
459ea845XenN-uWqEM5LFvUT60tW_A
45ae6628gqKTsUFfnoNExadETVIkbA
45af88c9RIIJWPfBxs3o7zekI-ELPQ
45ba4faf2oqu6eR8fqecR3LfSNcYUg
45ba5238-NKl80QVXzdGo8hO9M75Xg
45c0fdfb2mz6NdOIsLenJtf6_ZelTA
45c38d90tNwOTSaYKHXd3ccLtnytlQ
45c390d6BbWrwyEi5T5VsWKYxl06Rg
45c39d31g0iik6UE_oTK5N55ry-ycA
45d1ffcd-r3v8A7uh92hQaMfQM9UPQ
45d21437Vg_-i4uOWyvzYWHESXDP6A
45da6370nnZlAAIieMCrXkxF9toOyQ
45da6551zUuplwxuqcT2fhRgceC0CQ
45db0d4bkGtxBk21sZFJgbCV1FcNRg
45db468b-DKE8kUTV42eYMYmk8_g9g
45dd21d1rVPnDfvZTNVHLalcjnbsZw
45ddaf15_Ld7IAEpUUP3FJjJ-oSEFg
45ddc763DodLG1BqH_wRBJXMbCSB5A
45ddc8282KnaNGuijqCTphlXV_eeog

View File

@ -1,80 +0,0 @@
# This is the BitKeeper configuration for this package.
#
# Please take a minute to fill it out carefully, it needs to be accurate.
#
# NOTICE: you really do want to fill this out, if something goes wrong
# with your repository, or if someone changes the logging policy, we
# send mail to the contact listed here for confirmation.
#
# BitKeeper can maintain a log of your change comments (not your source,
# just the comments) on a centralized server. This is useful as your
# project grows, it gives people a place to go see what is happening on
# a per project basis. This is especially useful for distributed developers.
#
#
# Name of the project, such as "BitKeeper" or "The GNU C compiler".
#
description: MySQL - fast and reliable SQL database
#
# Open Logging server. This site is where users go to see the
# changelog comments for all instances of this repository. This must
# be logging@openlogging.org for usage under the terms of the BKL,
# "bk help bkl" will show you the default licensing terms. If this
# repository is commercial it can be an internal email address or "none"
# to disable logging.
#
logging: none
#
# If this field is set, all checkins will appear to be made by this user,
# in effect making this a single user package. Single user packages are
# free from the logging constraint. In order for the package to really
# be free, both the single_user and the single_host field need to be set.
#
single_user:
#
# If this field is set, all checkins will appear to be made on this host.
#
single_host:
#
# Contact person for this project. This is whoever is the person that
# should be contacted with update information or contacted if BitKeeper
# discovers a problem which requires local intervention. Please make the
# contact information accurate so we can support you.
#
contact: sys@mysql.com
#
# It is very important that this email address is filled out and accurate.
# If someone converts your repository to open logging (which you may not
# want), we will contact this email address for confirmation that you really
# did want open logging. If the email address is inaccurate and we get no
# response from anyone else at your location after 90 days, then open logging
# will be implicitly approved.
#
email: sys@mysql.com
#
# Add your street address if you like, it is optional.
#
street:
city:
state:
postal:
country:
phone:
cell:
pager:
#
# Business Hours when we can contact you if you left a phone number.
#
hours:
[serg:]checkout:get
[arjen:]checkout:get
[kostja:]checkout:get
[nick:]checkout:get
[jonas:]checkout:get
[tomas:]checkout:get
[guilhem:]checkout:get
[pekka:]checkout:get
[msvensson:]checkout:get
checkout:edit
eoln:unix

File diff suppressed because it is too large Load Diff

View File

@ -1,314 +0,0 @@
Administrador@light.
Administrator@co3064164-a.
Administrator@co3064164-a.rochd1.qld.optushome.com.au
Administrator@fred.
Administrator@w2k.
Greg@greg-laptop.
Miguel@light.local
Sinisa@sinisa.nasamreza.org
WAX@sergbook.mysql.com
acurtis@ltantony.rdg.cyberkinetica.homeunix.net
acurtis@pcgem.rdg.cyberkinetica.com
acurtis@xiphis.org
administrador@light.hegel.local
ahlentz@co3064164-a.rochd1.qld.optusnet.com.au
akishkin@work.mysql.com
anjuta@arthur.local
antony@ltantony.dsl-verizon.net
antony@ltantony.mysql.com
antony@ltantony.rdg.cyberkinetica.com
antony@ltantony.rdg.cyberkinetica.homeunix.net
antony@ltantony.xiphis.org
arjen@bitbike.com
arjen@co3064164-a.bitbike.com
arjen@fred.bitbike.com
arjen@george.bitbike.com
autotest@mc01.ndb.mysql.com
bar@bar.intranet.mysql.r18.ru
bar@bar.mysql.r18.ru
bar@bar.udmsearch.izhnet.ru
bar@deer.(none)
bar@eagle.intranet.mysql.r18.ru
bar@gw.udmsearch.izhnet.ru
bar@mysql.com
bar@noter.intranet.mysql.r18.ru
bell@51.0.168.192.in-addr.arpa
bell@52.0.168.192.in-addr.arpa
bell@book.sanja.is.com.ua
bell@laptop.sanja.is.com.ua
bell@sanja.is.com.ua
bk@admin.bk
bk@mysql.r18.ru
brian@avenger.(none)
brian@brian-akers-computer.local
brian@private-client-ip-101.oz.net
brian@zim.(none)
carsten@tsort.bitbybit.dk
cps@silver_beast.(none)
davida@isil.mysql.com
dean@mysql.com
dellis@goetia.(none)
dlenev@brandersnatch.localdomain
dlenev@build.mysql.com
dlenev@jabberwock.localdomain
dlenev@mysql.com
ejonore@mc03.ndb.mysql.com
elliot@mysql.com
evgen@moonbone.(none)
evgen@moonbone.local
gbichot@bk-internal.mysql.com
gbichot@production.mysql.com
gbichot@quadita2.mysql.com
gbichot@quadxeon.mysql.com
geert@kriem.kemuri.org
georg@beethoven.local
georg@beethoven.site
georg@lmy002.wdf.sap.corp
gerberb@ou800.zenez.com
gluh@eagle.intranet.mysql.r18.ru
gluh@gluh.(none)
gluh@gluh.mysql.r18.ru
gluh@mysql.com
gordon@zero.local.lan
greg@gcw.ath.cx
greg@mysql.com
guilhem@mysql.com
gweir@build.mysql.com
gweir@work.mysql.com
harrison@mysql.com
harry@corona.lordblink.com
hartmut@mysql.com
heikki@donna.mysql.fi
heikki@hundin.mysql.fi
heikki@rescue.
heikki@work.mysql.com
hf@bison.(none)
hf@bisonxp.(none)
hf@deer.(none)
hf@deer.mysql.r18.ru
hf@genie.(none)
holyfoot@mysql.com
igor@hundin.mysql.fi
igor@igor-inspiron.creware.com
igor@linux.local
igor@rurik.mysql.com
ingo@mysql.com
jan@hundin.mysql.fi
jani@a193-229-222-105.elisa-laajakaista.fi
jani@a193-229-222-2.elisa-laajakaista.fi
jani@a80-186-24-72.elisa-laajakaista.fi
jani@a80-186-41-201.elisa-laajakaista.fi
jani@a80-186-8-224.elisa-laajakaista.fi
jani@dsl-jkl1657.dial.inet.fi
jani@dsl-kpogw4gb5.dial.inet.fi
jani@hynda.(none)
jani@hynda.mysql.fi
jani@ibmlab.site
jani@janikt.pp.saunalahti.fi
jani@linux.local
jani@rhols221.adsl.netsonic.fi
jani@rhols221.arenanet.fi
jani@ua126d19.elisa.omakaista.fi
jani@ua141d10.elisa.omakaista.fi
jani@ua167d18.elisa.omakaista.fi
jani@ua72d24.elisa.omakaista.fi
jcole@abel.spaceapes.com
jcole@main.burghcom.com
jcole@mugatu.jcole.us
jcole@mugatu.spaceapes.com
jcole@sarvik.tfr.cafe.ee
jcole@tetra.spaceapes.com
jimw@mysql.com
joerg@mysql.com
joerg@trift-lap.fambruehe
jon@gigan.
jonas@mysql.com
joreland@bk-internal.mysql.com
joreland@mysql.com
jorge@linux.jorge.mysql.com
jplindst@t41.(none)
kaa@polly.local
kaj@work.mysql.com
kent@mysql.com
konstantin@mysql.com
kosipov@production.mysql.com
kostja@oak.local
lars@mysql.com
lenz@kallisto.mysql.com
lenz@mysql.com
magnus@msdesk.mysql.com
magnus@neptunus.(none)
magnus@shellback.(none)
marko@hundin.mysql.fi
marty@flipper.bredbandsbolaget.se
marty@linux.site
marty@shark.
mats@mysql.com
matt@booty.(none)
matt@mysql.com
matthias@three.local.lan
miguel@hegel.(none)
miguel@hegel.br
miguel@hegel.local
miguel@hegel.txg
miguel@hegel.txg.br
miguel@light.
miguel@light.local
miguel@sartre.local
mikael@mc04.(none)
mikael@orca.ndb.mysql.com
mikron@c-fb0ae253.1238-1-64736c10.cust.bredbandsbolaget.se
mikron@mikael-ronstr-ms-dator.local
mleich@mysql.com
mmatthew@markslaptop.
monty@bitch.mysql.fi
monty@butch.
monty@donna.mysql.fi
monty@hundin.mysql.fi
monty@mashka.(none)
monty@mashka.mysql.fi
monty@mishka.local
monty@mishka.mysql.fi
monty@mysql.com
monty@narttu.
monty@narttu.mysql.fi
monty@rescue.
monty@tik.
monty@tik.mysql.fi
monty@tramp.mysql.fi
monty@work.mysql.com
mronstrom@build.mysql.com
mronstrom@mysql.com
mskold@bk-internal.mysql.com
mskold@mysql.com
msvensson@build.mysql.com
msvensson@neptunus.(none)
msvensson@neptunus.homeip.net
mwagner@cash.mwagner.org
mwagner@evoq.mwagner.org
mwagner@here.mwagner.org
mwagner@mysql.com
mwagner@ultrafly.mysql.com
mwagner@work.mysql.com
mydev@mysql.com
mysql@home.(none)
mysql@mc04.(none)
mysqldev@bk-internal.mysql.com
mysqldev@build.mysql2.com
mysqldev@melody.local
mysqldev@mysql.com
mysqldev@o2k.irixworld.net
ndbdev@dl145b.mysql.com
ndbdev@dl145c.mysql.com
ndbdev@eel.hemma.oreland.se
ndbdev@ndbmaster.mysql.com
ndbdev@shark.
nick@mysql.com
nick@nick.leippe.com
obarnir@mysql.com
papa@gbichot.local
patg@krsna.
patg@krsna.patg.net
patg@patrick-galbraiths-computer.local
patg@patrick.local
patg@pc248.lfp.kcls.org
patg@radha.local
paul@central.snake.net
paul@frost.snake.net
paul@ice.local
paul@ice.snake.net
paul@kite-hub.kitebird.com
paul@snake-hub.snake.net
paul@teton.kitebird.com
pekka@mysql.com
pem@mysql.com
pem@per-erik-martins-dator.local
peter@linux.local
peter@mysql.com
peterg@mysql.com
petr@mysql.com
pgulutzan@linux.local
pmartin@build.mysql2.com
psergey@psergey-rh8.(none)
psergey@psergey.(none)
ram@deer.(none)
ram@gw.mysql.r18.ru
ram@gw.udmsearch.izhnet.ru
ram@mysql.r18.ru
ram@ram-book.(none)
ram@ram.(none)
ramil@mysql.com
ranger@regul.home.lan
rburnett@bk-internal.mysql.com
rburnett@build.mysql.com
reggie@bob.(none)
reggie@mdk10.(none)
reggie@monster.
root@home.(none)
root@mc04.(none)
root@x3.internalnet
salle@banica.(none)
salle@geopard.(none)
salle@geopard.online.bg
salle@vafla.home
salle@vafla.online.bg
sasha@mysql.sashanet.com
schwenke@lmy003.wdf.sap.corp
schwenke@lmy003.xl.local
serg@build.mysql.com
serg@build.mysql2.com
serg@mysql.com
serg@serg.mylan
serg@serg.mysql.com
serg@sergbook.mylan
serg@sergbook.mysql.com
sergefp@mysql.com
shuichi@mysql.com
sinisa@rhols221.adsl.netsonic.fi
stewart@mysql.com
svoj@mysql.com
tfr@beta.frontier86.ee
tfr@indrek.tfr.cafe.ee
tfr@sarvik.tfr.cafe.ee
tim@bitch.mysql.fi
tim@black.box
tim@hundin.mysql.fi
tim@sand.box
tim@siva.hindu.god
tim@threads.polyesthetic.msg
tim@white.box
tim@work.mysql.com
timour@mysql.com
tom@basil-firewall.home.com
tomas@mc05.(none)
tomas@poseidon.(none)
tomas@poseidon.bredbandsbolaget.se
tomas@poseidon.elisa-laajakaista.fi
tomas@poseidon.ndb.mysql.com
tonu@hundin.mysql.fi
tonu@volk.internalnet
tonu@x153.internalnet
tonu@x3.internalnet
tsmith@build.mysql.com
tulin@build.mysql.com
tulin@dl145b.mysql.com
tulin@dl145c.mysql.com
tulin@mysql.com
ulli@morbus.(none)
venu@hundin.mysql.fi
venu@myvenu.com
venu@work.mysql.com
vtkachenko@intelp4d.mysql.com
vtkachenko@mail.mysql.com
vva@eagle.mysql.r18.ru
vva@genie.(none)
vva@mysql.r18.ru
walrus@kishkin.ru
walrus@mysql.com
wax@kishkin.ru
wax@mysql.com
worm@altair.is.lan
zak@balfor.local
zak@linux.local
zak@mysql.com
zgreant@mysql.com

View File

@ -1 +0,0 @@
dev@mysql.com

View File

@ -1,7 +0,0 @@
BK|scripts/safe_mysqld.sh|19700101030959|01930|d0a3cc73fd1b0d8d tim@localhost.polyesthetic.msg|scripts/safe_mysqld.sh|20000802235627|38519
bk@work.mysql.com|BitKeeper/etc/logging_ok|20000731192914|03271|5e19f6258f804ffe arjen@co3064164-a.bitbike.com|BitKeeper/etc/logging_ok|20011212060636|33009
bk@work.mysql.com|BitKeeper/etc/logging_ok|20000731192914|03271|5e19f6258f804ffe jcole@tetra.bedford.progress.com|BitKeeper/etc/logging_ok|20001004201211|30554
bk@work.mysql.com|BitKeeper/etc/logging_ok|20000731192914|03271|5e19f6258f804ffe sasha@work.mysql.com|BitKeeper/etc/logging_ok|20000802223223|24242
bk@work.mysql.com|BitKeeper/etc/logging_ok|20000731192914|03271|5e19f6258f804ffe tim@localhost.polyesthetic.msg|BitKeeper/etc/logging_ok|20000802235640|27343
bk@work.mysql.com|ChangeSet|20000731191004|44203|eae70093a6122e66+ sasha@work.mysql.com|ChangeSet|20000802223249|54774
bk@work.mysql.com|ChangeSet|20000731191004|44203|eae70093a6122e66+ tim@localhost.polyesthetic.msg|ChangeSet|20000802235645|56533

View File

@ -1,14 +0,0 @@
#!/bin/sh
shift
REPO=`bk gethost`:`pwd`
TO=dev@mysql.com
if [ -f BitKeeper/etc/pushed -a "$BK_OUTGOING" = OK ]
then (
echo ${USER}@"$@"
echo ""
bk changes - < BitKeeper/etc/pushed
) | mail -s "Outgoing from $REPO" $TO
else
echo ${USER}@"$@"| mail -s "Outgoing from $REPO = $BK_OUTGOING" $TO
fi

View File

@ -1,134 +0,0 @@
#!/bin/sh
#shift
if [ -n "$BK_USER" ]
then
COMMITTER=$BK_USER
else
COMMITTER=$USER
fi
FROM=$COMMITTER@mysql.com
COMMITS=commits@lists.mysql.com
DOCS=docs-commit@mysql.com
LIMIT=10000
VERSION="5.1"
BKROOT=`bk root`
if [ -x /usr/sbin/sendmail ]; then
SENDMAIL=/usr/sbin/sendmail
else
SENDMAIL=sendmail
fi
if [ "$REAL_EMAIL" = "" ]
then
echo "Warning: you must set REAL_EMAIL in your profile"
else
FROM=$REAL_EMAIL
fi
BK_STATUS=$BK_STATUS$BK_COMMIT
if [ "$BK_STATUS" = OK ]
then
HAS_ACTUAL_CHANGES=`bk cset -r+ -d | grep -v "^#"`
if [ "$HAS_ACTUAL_CHANGES" = "" ]
then
echo ChangeSet had no real changes, not sending emails
exit
fi
IS_MERGE=`bk changes -r+ -k -m`
if [ "$IS_MERGE" = "" ]
then
echo Merge changeset, not sending mails
exit
fi
CHANGESET=`bk -R prs -r+ -h -d':P:::I:' ChangeSet`
CSETKEY=`bk -R prs -r+ -h -d':KEY:' ChangeSet`
#
# composing subject lines of commit mails.
# if a fix targets to a WL and there is a bug referred
# then X-Bug mail header will contain the first found bug's number
#
BUG=`bk -R prs -r+ -h -d':C:' ChangeSet | \
sed -ne 's/[Bb][Uu][Gg] *# *\([0-9][0-9]*\).*$/BUG#\1/
s/.*BUG#\([0-9][0-9]*\)/\1/p'`
WL=`bk -R prs -r+ -h -d':C:' ChangeSet | \
sed -ne 's/[Ww][Ll] *# *\([0-9][0-9]*\).*$/WL#\1/
s/.*\(WL#[0-9][0-9]*\)/ \1/p'`
if [ "$BUG" = "" ]
then
# TO=dev-public@mysql.com
BS=""
BH=""
else
# TO=dev-bugs@mysql.com
BS=" BUG#$BUG"
# need newline here
BH="X-Bug: $BUG
"
fi
#++
# commits@ or dev-private@ mail
#--
LIST="commits"
TO="commits@lists.mysql.com"
if [ -f .tree-is-private ]
then
LIST="dev-private"
TO="dev-private@mysql.com"
fi
echo "Notifying $LIST list at $TO"
(
cat <<EOF
List-ID: <bk.mysql-$VERSION>
From: $FROM
To: $TO
Subject: bk commit into $VERSION tree ($CHANGESET)$BS
X-CSetKey: <$CSETKEY>
$BH
Below is the list of changes that have just been committed into a local
$VERSION repository of $COMMITTER. When $COMMITTER does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
EOF
bk changes -v -r+
bk rset -r+ -ah | bk gnupatch -h -dup -T
) | bk sed -e ${LIMIT}q > $BKROOT/BitKeeper/tmp/commits.txt
$SENDMAIL -t < $BKROOT/BitKeeper/tmp/commits.txt
#++
# docs-commit@ mail
# Picks up anything under the Docs subdirectory (relevant for docs team).
#--
bk changes -v -r+ | grep -q " Docs/"
if [ $? -eq 0 ]
then
echo "Notifying docs list at $DOCS"
(
cat <<EOF
List-ID: <bk.mysql-$VERSION>
From: $FROM
To: $DOCS
Subject: bk commit - $VERSION tree (Manual) ($CHANGESET)$BS
EOF
bk changes -v -r+
bk rset -r+ -ah | bk gnupatch -h -dup -T
) > $BKROOT/BitKeeper/tmp/docs.txt
$SENDMAIL -t < $BKROOT/BitKeeper/tmp/docs.txt
fi
else
echo "commit failed because '$BK_STATUS', you may need to re-clone..."
fi

View File

@ -1,22 +0,0 @@
#! /usr/bin/perl
use strict;
use warnings;
use FindBin;
require "$FindBin::Bin/triggers-lib.pl";
# Don't run unless commit was successful
check_status() || exit 0;
my $cset = latest_cset();
# Read most recent ChangeSet's changed files. Send merge changes along, since
# they'll need to be incorporated in InnoDB's source tree eventually.
my $changes = innodb_get_changes('cset', $cset, 'yes')
or exit 0;
innodb_send_changes_email($cset, $changes)
or exit 1;
exit 0;

View File

@ -1,30 +0,0 @@
#! /usr/bin/perl
use strict;
use warnings;
use FindBin;
require "$FindBin::Bin/triggers-lib.pl";
# Don't run unless push/pull was successful
check_status() or exit 0;
# Don't run if push/pull is in local clones
exit 0 if repository_type() eq 'local';
# For each pushed ChangeSet, check it for InnoDB files and send
# diff of entire ChangeSet to InnoDB developers if such changes
# exist.
my $error = 0;
foreach my $cset (read_bk_csetlist())
{
my $changes = innodb_get_changes('cset', $cset, 'yes')
or next;
innodb_send_changes_email($cset, $changes)
or $error = 1;
}
exit ($error == 0 ? 0 : 1);

View File

@ -1,22 +0,0 @@
#!/bin/sh
if [ "$BK_USER" = "Administrator" -o "$BK_USER" = "mysqldev" ]
then
echo "Error: you cannot commit as 'Administrator' or 'mysqldev' user."
echo "as a workaround set BK_USER to your nickname"
echo "e.g.: export BK_USER='bar'"
echo ""
echo "Checkin FAILED!"
echo "Set BK_USER and retry."
exit 1
fi
if [ "$REAL_EMAIL" = "" ]
then
echo "Error: you must set REAL_EMAIL in your profile"
echo "e.g.: export REAL_EMAIL='Joe Dow <joe@foo.bar>'"
echo ""
echo "Commit FAILED!"
echo "Set REAL_EMAIL and retry."
exit 1
fi

View File

@ -1,26 +0,0 @@
#!/usr/bin/perl
my $status = 0;
my $pending = $ENV{'BK_PENDING'};
exit 0 unless -f $pending;
open FI, "<", $pending || exit 0;
while(<FI>) {
my ($file, $stuff) = split /\|/, $_, 2;
next unless -f $file;
$file =~ s/^(.*)\/([^\/]*)$/$2/;
my $path = $1;
opendir DIR, $path;
my @files = sort map { lc } readdir DIR;
closedir DIR;
my %count = ();
$count{$_}++ for @files;
@files = grep { $count{$_} > 1 } keys %count;
if(@files > 0) {
print "$path/$file: duplicate file names: " . (join " ", @files) . "\n";
$status = 1;
}
}
close FI;
exit $status;

View File

@ -1,21 +0,0 @@
#! /usr/bin/perl
use strict;
use warnings;
use FindBin;
require "$FindBin::Bin/triggers-lib.pl";
die "$0: Script error: \$BK_PENDING is not set in pre-commit trigger\n"
unless defined $ENV{BK_PENDING};
# Read changed files from $BK_PENDING directly. Do not bother user about
# merge changes; they don't have any choice, the merge must be done.
my $changes = innodb_get_changes('file', $ENV{BK_PENDING}, undef)
or exit 0;
innodb_inform_and_query_user($changes)
or exit 1; # Abort commit
# OK, continue with commit
exit 0;

View File

@ -1,22 +0,0 @@
#!/bin/sh
if [ "$BK_USER" = "Administrator" -o "$BK_USER" = "mysqldev" ]
then
echo "Error: you cannot checkin as 'Administrator' or 'mysqldev' user."
echo "as a workaround set BK_USER to your nickname"
echo "e.g.: export BK_USER='bar'"
echo ""
echo "Checkin FAILED!"
echo "Set BK_USER and retry."
exit 1
fi
if [ `tail -c1 $BK_FILE` ]
then
echo "File $BK_FILE does not end with a new-line character!"
echo ""
echo "Checkin FAILED!"
echo "Fix the problem and retry."
exit 1
fi

View File

@ -1,82 +0,0 @@
#! /usr/bin/perl
use strict;
use warnings;
my $event= $ENV{BK_EVENT};
unless($event eq 'outgoing pull' || $event eq 'outgoing push' ||
$event eq 'resolve') {
exit 0;
}
my @bad_csets=
( 'monty@mysql.com|ChangeSet|20060418090255|16983',
'monty@mysql.com|ChangeSet|20060418090458|02628',
'monty@mysql.com|ChangeSet|20060419084236|49576',
'monty@mysql.com|ChangeSet|20060503164655|51444',
'monty@mysql.com|ChangeSet|20060503225814|60133',
'monty@mysql.com|ChangeSet|20060504033006|54878',
'monty@mysql.com|ChangeSet|20060504130520|48660',
'monty@mysql.com|ChangeSet|20060504164102|03511',
'monty@mysql.com|ChangeSet|20060504193112|04109',
'monty@mysql.com|ChangeSet|20060505015314|02799',
'monty@mysql.com|ChangeSet|20060505084007|16704',
'monty@mysql.com|ChangeSet|20060505104008|16695',
'monty@mysql.com|ChangeSet|20060505171041|13924',
'monty@mysql.com|ChangeSet|20060508121933|13866',
'monty@mysql.com|ChangeSet|20060508160902|15029',
'monty@mysql.com|ChangeSet|20060509145448|38636',
'monty@mysql.com|ChangeSet|20060509224111|40037',
'monty@mysql.com|ChangeSet|20060510090758|40678',
'monty@mysql.com|ChangeSet|20060515164104|46760',
'monty@mysql.com|ChangeSet|20060530114549|35852',
'monty@mysql.com|ChangeSet|20060605032828|23579',
'monty@mysql.com|ChangeSet|20060605033011|10641',
'monty@mysql.com|ChangeSet|20060605060652|09843',
'msvensson@neptunus.(none)|ChangeSet|20060605094744|10838',
'msvensson@neptunus.(none)|ChangeSet|20060605105746|11800',
'msvensson@neptunus.(none)|ChangeSet|20060605122345|12772',
'jmiller@mysql.com|ChangeSet|20060531210831|36442',
'jmiller@mysql.com|ChangeSet|20060602151941|36118',
'jmiller@mysql.com|ChangeSet|20060602152136|27762',
'jmiller@mysql.com|ChangeSet|20060605121748|12864',
'jmiller@mysql.com|ChangeSet|20060605160304|14798',
'jimw@mysql.com|ChangeSet|20060605210201|14667',
'igor@rurik.mysql.com|ChangeSet|20060605220727|15265',
'igor@rurik.mysql.com|ChangeSet|20060605221206|15134',
'stewart@mysql.com|ChangeSet|20060525073521|11169',
'stewart@mysql.com|ChangeSet|20060605154220|12975',
'stewart@mysql.com|ChangeSet|20060606040001|15337',
'hartmut@mysql.com/linux.site|ChangeSet|20070413121444|50289'
);
# Read the list of changesets.
my $csetlist = $ENV{BK_CSETLIST};
if(!defined($csetlist) || !open(FH, '<', $csetlist)) {
die "Failed to open list of incoming changesets '$csetlist': $!.\n";
}
my @csets = <FH>;
close FH;
# Reject any attempt to push/pull a bad changeset.
for my $cs (@csets) {
# Do this the raw way, don't want to be bitten by different EOL conventions
# on server and client (Unix/Windows/Mac).
$cs =~ s/\x0d?\x0a?$//s;
if(grep($_ eq $cs, @bad_csets)) {
print <<END;
BAD CHANGESET DETECTED! $event REJECTED!
The changeset with key '$cs' was detected in the attempted push or pull.
This changeset is from the corrupt part of the crashed mysql-5.1-new tree.
Pushing or pulling this changeset would result in corruption of the new tree,
and therefore the operation has been rejected.
Contact Kristian Nielsen (knielsen\@mysql.com, IRC knielsen) if you have any
questions regarding this.
END
exit 1;
}
}
exit 0;

View File

@ -1,82 +0,0 @@
#! /usr/bin/perl
use strict;
use warnings;
my $event= $ENV{BK_EVENT};
unless($event eq 'outgoing pull' || $event eq 'outgoing push' ||
$event eq 'resolve') {
exit 0;
}
my @bad_csets=
( 'monty@mysql.com|ChangeSet|20060418090255|16983',
'monty@mysql.com|ChangeSet|20060418090458|02628',
'monty@mysql.com|ChangeSet|20060419084236|49576',
'monty@mysql.com|ChangeSet|20060503164655|51444',
'monty@mysql.com|ChangeSet|20060503225814|60133',
'monty@mysql.com|ChangeSet|20060504033006|54878',
'monty@mysql.com|ChangeSet|20060504130520|48660',
'monty@mysql.com|ChangeSet|20060504164102|03511',
'monty@mysql.com|ChangeSet|20060504193112|04109',
'monty@mysql.com|ChangeSet|20060505015314|02799',
'monty@mysql.com|ChangeSet|20060505084007|16704',
'monty@mysql.com|ChangeSet|20060505104008|16695',
'monty@mysql.com|ChangeSet|20060505171041|13924',
'monty@mysql.com|ChangeSet|20060508121933|13866',
'monty@mysql.com|ChangeSet|20060508160902|15029',
'monty@mysql.com|ChangeSet|20060509145448|38636',
'monty@mysql.com|ChangeSet|20060509224111|40037',
'monty@mysql.com|ChangeSet|20060510090758|40678',
'monty@mysql.com|ChangeSet|20060515164104|46760',
'monty@mysql.com|ChangeSet|20060530114549|35852',
'monty@mysql.com|ChangeSet|20060605032828|23579',
'monty@mysql.com|ChangeSet|20060605033011|10641',
'monty@mysql.com|ChangeSet|20060605060652|09843',
'msvensson@neptunus.(none)|ChangeSet|20060605094744|10838',
'msvensson@neptunus.(none)|ChangeSet|20060605105746|11800',
'msvensson@neptunus.(none)|ChangeSet|20060605122345|12772',
'jmiller@mysql.com|ChangeSet|20060531210831|36442',
'jmiller@mysql.com|ChangeSet|20060602151941|36118',
'jmiller@mysql.com|ChangeSet|20060602152136|27762',
'jmiller@mysql.com|ChangeSet|20060605121748|12864',
'jmiller@mysql.com|ChangeSet|20060605160304|14798',
'jimw@mysql.com|ChangeSet|20060605210201|14667',
'igor@rurik.mysql.com|ChangeSet|20060605220727|15265',
'igor@rurik.mysql.com|ChangeSet|20060605221206|15134',
'stewart@mysql.com|ChangeSet|20060525073521|11169',
'stewart@mysql.com|ChangeSet|20060605154220|12975',
'stewart@mysql.com|ChangeSet|20060606040001|15337',
'hartmut@mysql.com/linux.site|ChangeSet|20070413121444|50289'
);
# Read the list of changesets.
my $csetlist = $ENV{BK_CSETLIST};
if(!defined($csetlist) || !open(FH, '<', $csetlist)) {
die "Failed to open list of incoming changesets '$csetlist': $!.\n";
}
my @csets = <FH>;
close FH;
# Reject any attempt to push/pull a bad changeset.
for my $cs (@csets) {
# Do this the raw way, don't want to be bitten by different EOL conventions
# on server and client (Unix/Windows/Mac).
$cs =~ s/\x0d?\x0a?$//s;
if(grep($_ eq $cs, @bad_csets)) {
print <<END;
BAD CHANGESET DETECTED! $event REJECTED!
The changeset with key '$cs' was detected in the attempted push or pull.
This changeset is from the corrupt part of the crashed mysql-5.1-new tree.
Pushing or pulling this changeset would result in corruption of the new tree,
and therefore the operation has been rejected.
Contact Kristian Nielsen (knielsen\@mysql.com, IRC knielsen) if you have any
questions regarding this.
END
exit 1;
}
}
exit 0;

View File

@ -1,356 +0,0 @@
# To use this convenience library in a trigger, simply require it at
# at the top of the script. For example:
#
# #! /usr/bin/perl
#
# use FindBin;
# require "$FindBin::Bin/triggers-lib.pl";
#
# FindBin is needed, because sometimes a trigger is called from the
# RESYNC directory, and the trigger dir is ../BitKeeper/triggers
use strict;
use warnings;
use Carp;
use FindBin;
my $mysql_version = "5.1";
# These addresses must be kept current in all MySQL versions.
# See the wiki page InnoDBandOracle.
#my @innodb_to_email = ('dev_innodb_ww@oracle.com');
#my @innodb_cc_email = ('dev-innodb@mysql.com');
# FIXME: Keep this for testing; remove it once it's been used for a
# week or two.
my @innodb_to_email = ('tim@mysql.com');
my @innodb_cc_email = ();
# This is for MySQL >= 5.1. Regex which defines the InnoDB files
# which should generally not be touched by MySQL developers.
my $innodb_files_description = <<EOF;
storage/innobase/*
mysql-test/t/innodb* (except mysql-test/t/innodb_mysql*)
mysql-test/r/innodb* (except mysql-test/r/innodb_mysql*)
EOF
my $innodb_files_regex = qr{
^
(
# Case 1: innobase/*
storage/innobase/
|
# Case 2: mysql-test/[tr]/innodb* (except innodb_mysql*)
mysql-test/(t|r)/SCCS/s.innodb
# The mysql-test/[tr]/innodb_mysql* are OK to edit
(?!_mysql)
)
}x;
# See 'bk help log', and the format of, e.g., $BK_PENDING.
# Important: this already contains the terminating newline!
my $file_rev_dspec = ':SFILE:|:REV:\n';
my $bktmp = "$FindBin::Bin/../tmp";
my $sendmail;
foreach ('/usr/sbin/sendmail', 'sendmail') {
$sendmail = $_;
last if -x $sendmail;
}
my $from = $ENV{REAL_EMAIL} || $ENV{USER} . '@mysql.com';
# close_or_warn
# $fh file handle to be closed
# $description description of the file handle
# RETURN Return value of close($fh)
#
# Print a nice warning message if close() isn't successful. See
# perldoc perlvar and perldoc -f close for details.
sub close_or_warn (*$)
{
my ($fh, $description) = @_;
my $status = close $fh;
if (not $status) {
warn "$0: error on close of '$description': ",
($! ? "$!" : "exit status " . ($? >> 8)), "\n";
}
return $status;
}
# check_status
# $warn If true, warn about bad status
# RETURN TRUE, if $BK_STATUS is "OK"; FALSE otherwise
#
# Also checks the undocumented $BK_COMMIT env variable
sub check_status
{
my ($warn) = @_;
my $status = (grep { defined $_ }
$ENV{BK_STATUS}, $ENV{BK_COMMIT}, '<undef>')[0];
unless ($status eq 'OK')
{
warn "Bad BK_STATUS '$status'\n" if $warn;
return undef;
}
return 1;
}
# repository_location
#
# RETURN ('HOST', 'ROOT') for the repository being modified
sub repository_location
{
if ($ENV{BK_SIDE} eq 'client') {
return ($ENV{BK_HOST}, $ENV{BK_ROOT});
} else {
return ($ENV{BKD_HOST}, $ENV{BKD_ROOT});
}
}
# repository_type
# RETURN:
# 'main' for repo on bk-internal with post-incoming.bugdb trigger
# 'team' for repo on bk-internal with post-incoming.queuepush.pl trigger
# 'local' otherwise
#
# This definition may need to be modified if the host name or triggers change.
sub repository_type
{
my ($host, $root) = repository_location();
return 'local'
unless uc($host) eq 'BK-INTERNAL.MYSQL.COM'
and -e "$root/BitKeeper/triggers/post-incoming.queuepush.pl";
return 'main' if -e "$root/BitKeeper/triggers/post-incoming.bugdb";
return 'team';
}
# latest_cset
# RETURN Key for most recent ChangeSet
sub latest_cset {
chomp(my $retval = `bk changes -r+ -k`);
return $retval;
}
# read_bk_csetlist
# RETURN list of cset keys from $BK_CSETLIST file
sub read_bk_csetlist
{
die "$0: script error: \$BK_CSETLIST not set\n"
unless defined $ENV{BK_CSETLIST};
open CSETS, '<', $ENV{BK_CSETLIST}
or die "$0: can't read \$BK_CSETLIST='$ENV{BK_CSETLIST}': $!\n";
chomp(my @csets = <CSETS>);
close_or_warn(CSETS, "\$BK_CSETLIST='$ENV{BK_CSETLIST}'");
return @csets;
}
# innodb_get_changes
# $type 'file' or 'cset'
# $value file name (e.g., $BK_PENDING) or ChangeSet key
# $want_merge_changes flag; if false, merge changes will be ignored
# RETURN A string describing the InnoDB changes, or undef if no changes
#
# The return value does *not* include ChangeSet comments, only per-file
# comments.
sub innodb_get_changes
{
my ($type, $value, $want_merge_changes) = @_;
if ($type eq 'file')
{
open CHANGES, '<', $value
or die "$0: can't read '$value': $!\n";
}
elsif ($type eq 'cset')
{
open CHANGES, '-|', "bk changes -r'$value' -v -d'$file_rev_dspec'"
or die "$0: can't exec 'bk changes': $!\n";
}
else
{
croak "$0: script error: invalid type '$type'";
}
my @changes = grep { /$innodb_files_regex/ } <CHANGES>;
close_or_warn(CHANGES, "($type, '$value')");
return undef unless @changes;
# Set up a pipeline of 'bk log' commands to weed out unwanted deltas. We
# never want deltas which contain no actual changes. We may not want deltas
# which are merges.
my @filters;
# This tests if :LI: (lines inserted) or :LD: (lines deleted) is
# non-zero. That is, did this delta change the file contents?
push @filters,
"bk log -d'"
. "\$if(:LI: -gt 0){$file_rev_dspec}"
. "\$if(:LI: -eq 0){\$if(:LD: -gt 0){$file_rev_dspec}}"
. "' -";
push @filters, "bk log -d'\$unless(:MERGE:){$file_rev_dspec}' -"
unless $want_merge_changes;
my $tmpname = "$bktmp/ibchanges.txt";
my $pipeline = join(' | ', @filters) . " > $tmpname";
open TMP, '|-', $pipeline
or die "$0: can't exec [[$pipeline]]: $!\n";
print TMP @changes;
close_or_warn(TMP, "| $pipeline");
# Use bk log to describe the changes
open LOG, "bk log - < $tmpname |"
or die "$0: can't exec 'bk log - < $tmpname': $!\n";
my @log = <LOG>;
close_or_warn(LOG, "bk log - < $tmpname |");
unlink $tmpname;
return undef unless @log;
return join('', @log);
}
# Ask user if they really want to commit.
# RETURN TRUE = YES, commit; FALSE = NO, do not commit
sub innodb_inform_and_query_user
{
my ($description) = @_;
my $tmpname = "$bktmp/ibquery.txt";
open MESSAGE, "> $tmpname"
or die "$0: can't write message to '$tmpname': $!";
print MESSAGE <<EOF;
This ChangeSet modifies some files which should normally be changed by
InnoDB developers only. In general, MySQL developers should not change:
$innodb_files_description
The following InnoDB files were modified:
=========================================================
$description
=========================================================
If you understand this, you may Commit these changes. The changes
will be sent to the InnoDB developers at @{[join ', ', @innodb_to_email]},
CC @{[join ', ', @innodb_cc_email]}.
EOF
close_or_warn(MESSAGE, "$tmpname");
my $status = system('bk', 'prompt', '-w',
'-yCommit these changes', '-nDo not Commit', "-f$tmpname");
unlink $tmpname;
return ($status == 0 ? 1 : undef);
}
# innodb_send_changes_email
# $cset The ChangeSet key
# $description A (maybe brief) description of the changes
# RETURN TRUE = Success, e-mail sent; FALSE = Failure
#
# Sends a complete diff of changes in $cset by e-mail.
sub innodb_send_changes_email
{
my ($cset, $description) = @_;
# FIXME: Much of this is duplicated in the 'post-commit' Bourne shell
# trigger
my $cset_short = `bk changes -r'$cset' -d':P:::I:'`;
my $cset_key = `bk changes -r'$cset' -d':KEY:'`;
my ($host, $bk_root) = repository_location();
my $type = repository_type();
(my $treename = $bk_root) =~ s,^.*/,,;
print "Nofifying InnoDB developers at ",
(join ', ', @innodb_to_email, @innodb_cc_email), "\n";
open SENDMAIL, '|-', "$sendmail -t"
or die "Can't exec '$sendmail -t': $!\n";
my @headers;
push @headers, "List-ID: <bk.innodb-$mysql_version>";
push @headers, "From: $from";
push @headers, "To: " . (join ', ', @innodb_to_email);
push @headers, "Cc: " . (join ', ', @innodb_cc_email) if @innodb_cc_email;
push @headers,
"Subject: InnoDB changes in $type $mysql_version tree ($cset_short)";
push @headers, "X-CSetKey: <$cset_key>";
print SENDMAIL map { "$_\n" } @headers, '';
if ($type eq 'main')
{
print SENDMAIL <<EOF;
Changes pushed to $treename by $ENV{USER} affect the following
files. These changes are in a $mysql_version main tree. They
will be available publicly within 24 hours.
EOF
}
elsif ($type eq 'team')
{
print SENDMAIL <<EOF;
Changes added to $treename by $ENV{USER} affect the
following files. These changes are in a $mysql_version team tree.
EOF
}
else
{
print SENDMAIL <<EOF;
A local commit by $ENV{USER} affects the following files. These
changes are in a clone of a $mysql_version tree.
EOF
}
print SENDMAIL "\n";
print SENDMAIL qx(bk changes -r'$cset');
print SENDMAIL "$description";
print SENDMAIL "The complete ChangeSet diffs follow.\n\n";
print SENDMAIL qx(bk rset -r'$cset' -ah | bk gnupatch -h -dup -T);
close_or_warn(SENDMAIL, "$sendmail -t")
or return undef;
return 1;
}
1;

View File

@ -42,6 +42,13 @@ ADD_DEFINITIONS(-DSHAREDIR="share")
# Set debug options # Set debug options
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFORCE_INIT_OF_VARS") SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFORCE_INIT_OF_VARS")
# Do not use SAFEMALLOC for Windows builds, as Debug CRT has the same functionality
# Neither SAFE_MUTEX works on Windows and it has been explicitely undefined in
# my_pthread.h
IF(NOT WIN32)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
ENDIF(NOT WIN32)
SET(localstatedir "C:\\mysql\\data") SET(localstatedir "C:\\mysql\\data")
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-huge.cnf.sh CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-huge.cnf.sh
@ -55,9 +62,6 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-medium.cnf.sh
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-small.cnf.sh CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-small.cnf.sh
${CMAKE_SOURCE_DIR}/support-files/my-small.ini @ONLY) ${CMAKE_SOURCE_DIR}/support-files/my-small.ini @ONLY)
ADD_DEFINITIONS(-D__NT__)
IF(CYBOZU) IF(CYBOZU)
ADD_DEFINITIONS(-DCYBOZU) ADD_DEFINITIONS(-DCYBOZU)
ENDIF(CYBOZU) ENDIF(CYBOZU)
@ -287,6 +291,10 @@ FOREACH(DIR ${DYNAMIC_ENGINE_DIRECTORIES})
ADD_SUBDIRECTORY(${DIR}) ADD_SUBDIRECTORY(${DIR})
ENDFOREACH(DIR ${DYNAMIC_ENGINE_DIRECTORIES}) ENDFOREACH(DIR ${DYNAMIC_ENGINE_DIRECTORIES})
# Add subdirectories for semisync plugin
IF(NOT WITHOUT_DYNAMIC_PLUGINS)
ADD_SUBDIRECTORY(plugin/semisync)
ENDIF(NOT WITHOUT_DYNAMIC_PLUGINS)
# FIXME "debug" only needed if build type is "Debug", but # FIXME "debug" only needed if build type is "Debug", but
# CMAKE_BUILD_TYPE is not set during configure time. # CMAKE_BUILD_TYPE is not set during configure time.
@ -303,6 +311,7 @@ ADD_SUBDIRECTORY(extra)
ADD_SUBDIRECTORY(client) ADD_SUBDIRECTORY(client)
ADD_SUBDIRECTORY(sql) ADD_SUBDIRECTORY(sql)
ADD_SUBDIRECTORY(libmysql) ADD_SUBDIRECTORY(libmysql)
ADD_SUBDIRECTORY(libservices)
ADD_SUBDIRECTORY(tests) ADD_SUBDIRECTORY(tests)
IF(WITH_EMBEDDED_SERVER) IF(WITH_EMBEDDED_SERVER)
ADD_SUBDIRECTORY(libmysqld) ADD_SUBDIRECTORY(libmysqld)

View File

@ -23,7 +23,7 @@ EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \
SUBDIRS = . include @docs_dirs@ @zlib_dir@ \ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
@readline_topdir@ sql-common scripts \ @readline_topdir@ sql-common scripts \
@pstack_dir@ \ @pstack_dir@ libservices \
@sql_union_dirs@ unittest \ @sql_union_dirs@ unittest \
@sql_server@ @man_dirs@ tests \ @sql_server@ @man_dirs@ tests \
netware @libmysqld_dirs@ \ netware @libmysqld_dirs@ \
@ -32,7 +32,7 @@ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
DIST_SUBDIRS = . include Docs zlib \ DIST_SUBDIRS = . include Docs zlib \
cmd-line-utils sql-common scripts \ cmd-line-utils sql-common scripts \
pstack \ pstack libservices \
strings mysys dbug extra regex libmysql libmysql_r client unittest storage plugin \ strings mysys dbug extra regex libmysql libmysql_r client unittest storage plugin \
vio sql man tests \ vio sql man tests \
netware libmysqld \ netware libmysqld \
@ -98,7 +98,8 @@ test-pr:
test-ns: test-ns:
cd mysql-test ; \ cd mysql-test ; \
@PERL@ ./mysql-test-run.pl $(force) $(mem) --mysqld=--binlog-format=mixed @PERL@ ./mysql-test-run.pl $(force) $(mem) --mysqld=--binlog-format=mixed ; \
@PERL@ ./mysql-test-run.pl $(force) $(mem) --suite=funcs_1
test-binlog-statement: test-binlog-statement:
cd mysql-test ; \ cd mysql-test ; \

View File

@ -14,13 +14,6 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake") INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake")
# We use the "mysqlclient_notls" library here just as safety, in case
# any of the clients here would go beyond the client API and access the
# Thread Local Storage directly.
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/zlib ${CMAKE_SOURCE_DIR}/zlib
${CMAKE_SOURCE_DIR}/extra/yassl/include ${CMAKE_SOURCE_DIR}/extra/yassl/include
@ -30,27 +23,27 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/strings) ${CMAKE_SOURCE_DIR}/strings)
ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c) ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c)
TARGET_LINK_LIBRARIES(mysql mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysql mysqlclient)
ADD_EXECUTABLE(mysqltest mysqltest.cc) ADD_EXECUTABLE(mysqltest mysqltest.cc)
SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS") SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys regex wsock32 dbug) TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys regex dbug)
ADD_EXECUTABLE(mysqlcheck mysqlcheck.c) ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)
TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient)
ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c ../mysys/mf_getdate.c) ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c ../mysys/mf_getdate.c)
TARGET_LINK_LIBRARIES(mysqldump mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysqldump mysqlclient)
ADD_EXECUTABLE(mysqlimport mysqlimport.c) ADD_EXECUTABLE(mysqlimport mysqlimport.c)
TARGET_LINK_LIBRARIES(mysqlimport mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysqlimport mysqlclient)
ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c ../mysys/my_getpagesize.c) ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c ../mysys/my_getpagesize.c)
TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient)
ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs) ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs)
ADD_EXECUTABLE(mysqlshow mysqlshow.c) ADD_EXECUTABLE(mysqlshow mysqlshow.c)
TARGET_LINK_LIBRARIES(mysqlshow mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysqlshow mysqlclient)
ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc
../mysys/mf_tempdir.c ../mysys/mf_tempdir.c
@ -59,14 +52,14 @@ ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc
../mysys/my_bitmap.c ../mysys/my_bitmap.c
../mysys/my_vle.c ../mysys/my_vle.c
../mysys/base64.c) ../mysys/base64.c)
TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient)
ADD_EXECUTABLE(mysqladmin mysqladmin.cc) ADD_EXECUTABLE(mysqladmin mysqladmin.cc)
TARGET_LINK_LIBRARIES(mysqladmin mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysqladmin mysqlclient)
ADD_EXECUTABLE(mysqlslap mysqlslap.c) ADD_EXECUTABLE(mysqlslap mysqlslap.c)
SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS") SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqlslap mysqlclient mysys zlib wsock32 dbug) TARGET_LINK_LIBRARIES(mysqlslap mysqlclient mysys zlib dbug)
ADD_EXECUTABLE(echo echo.c) ADD_EXECUTABLE(echo echo.c)

View File

@ -80,5 +80,6 @@ enum options_client
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT, OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE, OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE,
OPT_WRITE_BINLOG, OPT_DUMP_DATE, OPT_WRITE_BINLOG, OPT_DUMP_DATE,
OPT_INIT_COMMAND,
OPT_MAX_CLIENT_OPTION OPT_MAX_CLIENT_OPTION
}; };

View File

@ -1,3 +1,6 @@
#ifndef CLIENT_MY_READLINE_INCLUDED
#define CLIENT_MY_READLINE_INCLUDED
/* Copyright (C) 2000 MySQL 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
@ -31,3 +34,5 @@ extern LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file);
extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, char * str); extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, char * str);
extern char *batch_readline(LINE_BUFFER *buffer, bool *truncated); extern char *batch_readline(LINE_BUFFER *buffer, bool *truncated);
extern void batch_readline_end(LINE_BUFFER *buffer); extern void batch_readline_end(LINE_BUFFER *buffer);
#endif /* CLIENT_MY_READLINE_INCLUDED */

View File

@ -141,7 +141,7 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0,
vertical=0, line_numbers=1, column_names=1,opt_html=0, vertical=0, line_numbers=1, column_names=1,opt_html=0,
opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0, opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0,
tty_password= 0, opt_nobeep=0, opt_reconnect=1, tty_password= 0, opt_nobeep=0, opt_reconnect=1,
default_charset_used= 0, opt_secure_auth= 0, opt_secure_auth= 0,
default_pager_set= 0, opt_sigint_ignore= 0, default_pager_set= 0, opt_sigint_ignore= 0,
show_warnings= 0, executing_query= 0, interrupted_query= 0, show_warnings= 0, executing_query= 0, interrupted_query= 0,
ignore_spaces= 0; ignore_spaces= 0;
@ -155,7 +155,8 @@ static char * opt_mysql_unix_port=0;
static int connect_flag=CLIENT_INTERACTIVE; static int connect_flag=CLIENT_INTERACTIVE;
static char *current_host,*current_db,*current_user=0,*opt_password=0, static char *current_host,*current_db,*current_user=0,*opt_password=0,
*current_prompt=0, *delimiter_str= 0, *current_prompt=0, *delimiter_str= 0,
*default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME; *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME,
*opt_init_command= 0;
static char *histfile; static char *histfile;
static char *histfile_tmp; static char *histfile_tmp;
static String glob_buffer,old_buffer; static String glob_buffer,old_buffer;
@ -1398,6 +1399,10 @@ static struct my_option my_long_options[] =
{"ignore-spaces", 'i', "Ignore space after function names.", {"ignore-spaces", 'i', "Ignore space after function names.",
(uchar**) &ignore_spaces, (uchar**) &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0, (uchar**) &ignore_spaces, (uchar**) &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0}, 0, 0, 0, 0},
{"init-command", OPT_INIT_COMMAND,
"SQL Command to execute when connecting to MySQL server. Will automatically be re-executed when reconnecting.",
(uchar**) &opt_init_command, (uchar**) &opt_init_command, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.", {"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
(uchar**) &opt_local_infile, (uchar**) &opt_local_infile,
(uchar**) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, (uchar**) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
@ -1590,9 +1595,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
strmake(mysql_charsets_dir, argument, sizeof(mysql_charsets_dir) - 1); strmake(mysql_charsets_dir, argument, sizeof(mysql_charsets_dir) - 1);
charsets_dir = mysql_charsets_dir; charsets_dir = mysql_charsets_dir;
break; break;
case OPT_DEFAULT_CHARSET:
default_charset_used= 1;
break;
case OPT_DELIMITER: case OPT_DELIMITER:
if (argument == disabled_my_option) if (argument == disabled_my_option)
{ {
@ -1797,10 +1799,6 @@ static int get_options(int argc, char **argv)
connect_flag= 0; /* Not in interactive mode */ connect_flag= 0; /* Not in interactive mode */
} }
if (strcmp(default_charset, charset_info->csname) &&
!(charset_info= get_charset_by_csname(default_charset,
MY_CS_PRIMARY, MYF(MY_WME))))
exit(1);
if (argc > 1) if (argc > 1)
{ {
usage(0); usage(0);
@ -2928,7 +2926,6 @@ com_charset(String *buffer __attribute__((unused)), char *line)
charset_info= new_cs; charset_info= new_cs;
mysql_set_character_set(&mysql, charset_info->csname); mysql_set_character_set(&mysql, charset_info->csname);
default_charset= (char *)charset_info->csname; default_charset= (char *)charset_info->csname;
default_charset_used= 1;
put_info("Charset changed", INFO_INFO); put_info("Charset changed", INFO_INFO);
} }
else put_info("Charset is not found", INFO_INFO); else put_info("Charset is not found", INFO_INFO);
@ -4217,6 +4214,8 @@ sql_real_connect(char *host,char *database,char *user,char *password,
mysql_close(&mysql); mysql_close(&mysql);
} }
mysql_init(&mysql); mysql_init(&mysql);
if (opt_init_command)
mysql_options(&mysql, MYSQL_INIT_COMMAND, opt_init_command);
if (opt_connect_timeout) if (opt_connect_timeout)
{ {
uint timeout=opt_connect_timeout; uint timeout=opt_connect_timeout;
@ -4250,8 +4249,9 @@ sql_real_connect(char *host,char *database,char *user,char *password,
select_limit,max_join_size); select_limit,max_join_size);
mysql_options(&mysql, MYSQL_INIT_COMMAND, init_command); mysql_options(&mysql, MYSQL_INIT_COMMAND, init_command);
} }
if (default_charset_used)
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
if (!mysql_real_connect(&mysql, host, user, password, if (!mysql_real_connect(&mysql, host, user, password,
database, opt_mysql_port, opt_mysql_unix_port, database, opt_mysql_port, opt_mysql_unix_port,
connect_flag | CLIENT_MULTI_STATEMENTS)) connect_flag | CLIENT_MULTI_STATEMENTS))
@ -4266,6 +4266,9 @@ sql_real_connect(char *host,char *database,char *user,char *password,
} }
return -1; // Retryable return -1; // Retryable
} }
charset_info= mysql.charset;
connected=1; connected=1;
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
mysql.reconnect= debug_info_flag; // We want to know if this happens mysql.reconnect= debug_info_flag; // We want to know if this happens

View File

@ -34,7 +34,8 @@
static char mysql_path[FN_REFLEN]; static char mysql_path[FN_REFLEN];
static char mysqlcheck_path[FN_REFLEN]; static char mysqlcheck_path[FN_REFLEN];
static my_bool opt_force, opt_verbose, debug_info_flag, debug_check_flag; static my_bool opt_force, opt_verbose, debug_info_flag, debug_check_flag,
opt_systables_only;
static uint my_end_arg= 0; static uint my_end_arg= 0;
static char *opt_user= (char*)"root"; static char *opt_user= (char*)"root";
@ -121,6 +122,10 @@ static struct my_option my_long_options[]=
#include <sslopt-longopts.h> #include <sslopt-longopts.h>
{"tmpdir", 't', "Directory for temporary files", {"tmpdir", 't', "Directory for temporary files",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"upgrade-system-tables", 's', "Only upgrade the system tables "
"do not try to upgrade the data.",
(uchar**)&opt_systables_only, (uchar**)&opt_systables_only, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "User for login if not current user.", (uchar**) &opt_user, {"user", 'u', "User for login if not current user.", (uchar**) &opt_user,
(uchar**) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (uchar**) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Display more output about the process", {"verbose", 'v', "Display more output about the process",
@ -838,8 +843,15 @@ int main(int argc, char **argv)
/* Find mysql */ /* Find mysql */
find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name); find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name);
/* Find mysqlcheck */ if (!opt_systables_only)
find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name); {
/* Find mysqlcheck */
find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name);
}
else
{
printf("The --upgrade-system-tables option was used, databases won't be touched.\n");
}
/* /*
Read the mysql_upgrade_info file to check if mysql_upgrade Read the mysql_upgrade_info file to check if mysql_upgrade
@ -856,8 +868,8 @@ int main(int argc, char **argv)
/* /*
Run "mysqlcheck" and "mysql_fix_privilege_tables.sql" Run "mysqlcheck" and "mysql_fix_privilege_tables.sql"
*/ */
if (run_mysqlcheck_fixnames() || if ((!opt_systables_only &&
run_mysqlcheck_upgrade() || (run_mysqlcheck_fixnames() || run_mysqlcheck_upgrade())) ||
run_sql_fix_privilege_tables()) run_sql_fix_privilege_tables())
{ {
/* /*

View File

@ -30,7 +30,7 @@
#define MAX_TRUNC_LENGTH 3 #define MAX_TRUNC_LENGTH 3
char *host= NULL, *user= 0, *opt_password= 0, char *host= NULL, *user= 0, *opt_password= 0,
*default_charset= NULL; *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
char truncated_var_names[MAX_MYSQL_VAR][MAX_TRUNC_LENGTH]; char truncated_var_names[MAX_MYSQL_VAR][MAX_TRUNC_LENGTH];
char ex_var_names[MAX_MYSQL_VAR][FN_REFLEN]; char ex_var_names[MAX_MYSQL_VAR][FN_REFLEN];
ulonglong last_values[MAX_MYSQL_VAR]; ulonglong last_values[MAX_MYSQL_VAR];
@ -348,8 +348,7 @@ int main(int argc,char *argv[])
if (shared_memory_base_name) if (shared_memory_base_name)
mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
#endif #endif
if (default_charset) mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
error_flags= (myf)(opt_nobeep ? 0 : ME_BELL); error_flags= (myf)(opt_nobeep ? 0 : ME_BELL);
if (sql_connect(&mysql, option_wait)) if (sql_connect(&mysql, option_wait))

View File

@ -1358,7 +1358,6 @@ static int parse_args(int *argc, char*** argv)
int ho_error; int ho_error;
result_file = stdout; result_file = stdout;
load_defaults("my",load_default_groups,argc,argv);
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error); exit(ho_error);
if (debug_info_flag) if (debug_info_flag)
@ -1926,7 +1925,7 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
return ERROR_STOP; return ERROR_STOP;
} }
#endif #endif
if (init_io_cache(file, fileno(stdin), 0, READ_CACHE, (my_off_t) 0, if (init_io_cache(file, my_fileno(stdin), 0, READ_CACHE, (my_off_t) 0,
0, MYF(MY_WME | MY_NABP | MY_DONT_CHECK_FILESIZE))) 0, MYF(MY_WME | MY_NABP | MY_DONT_CHECK_FILESIZE)))
{ {
error("Failed to init IO cache."); error("Failed to init IO cache.");
@ -2015,8 +2014,9 @@ int main(int argc, char** argv)
my_init_time(); // for time functions my_init_time(); // for time functions
load_defaults("my", load_default_groups, &argc, &argv);
defaults_argv= argv;
parse_args(&argc, (char***)&argv); parse_args(&argc, (char***)&argv);
defaults_argv=argv;
if (!argc) if (!argc)
{ {

View File

@ -369,12 +369,15 @@ static int get_options(int *argc, char ***argv)
If there's no --default-character-set option given with If there's no --default-character-set option given with
--fix-table-name or --fix-db-name set the default character set to "utf8". --fix-table-name or --fix-db-name set the default character set to "utf8".
*/ */
if (!default_charset && (opt_fix_db_names || opt_fix_table_names)) if (!default_charset)
{ {
default_charset= (char*) "utf8"; if (opt_fix_db_names || opt_fix_table_names)
default_charset= (char*) "utf8";
else
default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
} }
if (default_charset && !get_charset_by_csname(default_charset, MY_CS_PRIMARY, if (strcmp(default_charset, MYSQL_AUTODETECT_CHARSET_NAME) &&
MYF(MY_WME))) !get_charset_by_csname(default_charset, MY_CS_PRIMARY, MYF(MY_WME)))
{ {
printf("Unsupported character set: %s\n", default_charset); printf("Unsupported character set: %s\n", default_charset);
return 1; return 1;
@ -798,8 +801,7 @@ static int dbConnect(char *host, char *user, char *passwd)
if (shared_memory_base_name) if (shared_memory_base_name)
mysql_options(&mysql_connection,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); mysql_options(&mysql_connection,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
#endif #endif
if (default_charset) mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset);
mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset);
if (!(sock = mysql_real_connect(&mysql_connection, host, user, passwd, if (!(sock = mysql_real_connect(&mysql_connection, host, user, passwd,
NULL, opt_mysql_port, opt_mysql_unix_port, 0))) NULL, opt_mysql_port, opt_mysql_unix_port, 0)))
{ {

View File

@ -861,9 +861,9 @@ static int get_options(int *argc, char ***argv)
load_defaults("my",load_default_groups,argc,argv); load_defaults("my",load_default_groups,argc,argv);
defaults_argv= *argv; defaults_argv= *argv;
if (hash_init(&ignore_table, charset_info, 16, 0, 0, if (my_hash_init(&ignore_table, charset_info, 16, 0, 0,
(hash_get_key) get_table_key, (my_hash_get_key) get_table_key,
(hash_free_key) free_table_ent, 0)) (my_hash_free_key) free_table_ent, 0))
return(EX_EOM); return(EX_EOM);
/* Don't copy internal log tables */ /* Don't copy internal log tables */
if (my_hash_insert(&ignore_table, if (my_hash_insert(&ignore_table,
@ -1273,120 +1273,68 @@ static int switch_character_set_results(MYSQL *mysql, const char *cs_name)
} }
/** /**
Rewrite CREATE TRIGGER statement, enclosing DEFINER clause in Rewrite statement, enclosing DEFINER clause in version-specific comment.
version-specific comment.
This function parses the CREATE TRIGGER statement and encloses This function parses any CREATE statement and encloses DEFINER-clause in
DEFINER-clause in version-specific comment: version-specific comment:
input query: CREATE DEFINER=a@b TRIGGER ...
rewritten query: CREATE * / / *!50017 DEFINER=a@b * / / *!50003 TRIGGER ...
@note This function will go away when WL#3995 is implemented.
@param[in] trigger_def_str CREATE TRIGGER statement string.
@param[in] trigger_def_length length of the trigger_def_str.
@return pointer to the new allocated query string.
*/
static char *cover_definer_clause_in_trigger(const char *trigger_def_str,
uint trigger_def_length)
{
char *query_str= NULL;
char *definer_begin= my_case_str(trigger_def_str, trigger_def_length,
C_STRING_WITH_LEN(" DEFINER"));
char *definer_end;
if (!definer_begin)
return NULL;
definer_end= my_case_str(definer_begin, strlen(definer_begin),
C_STRING_WITH_LEN(" TRIGGER"));
if (definer_end)
{
char *query_str_tail;
/*
Allocate memory for new query string: original string
from SHOW statement and version-specific comments.
*/
query_str= alloc_query_str(trigger_def_length + 23);
query_str_tail= strnmov(query_str,
trigger_def_str,
definer_begin - trigger_def_str);
query_str_tail= strmov(query_str_tail,
"*/ /*!50017");
query_str_tail= strnmov(query_str_tail,
definer_begin,
definer_end - definer_begin);
query_str_tail= strxmov(query_str_tail,
"*/ /*!50003",
definer_end,
NullS);
}
return query_str;
}
/**
Rewrite CREATE FUNCTION or CREATE PROCEDURE statement, enclosing DEFINER
clause in version-specific comment.
This function parses the CREATE FUNCTION | PROCEDURE statement and
encloses DEFINER-clause in version-specific comment:
input query: CREATE DEFINER=a@b FUNCTION ... input query: CREATE DEFINER=a@b FUNCTION ...
rewritten query: CREATE * / / *!50020 DEFINER=a@b * / / *!50003 FUNCTION ... rewritten query: CREATE * / / *!50020 DEFINER=a@b * / / *!50003 FUNCTION ...
@note This function will go away when WL#3995 is implemented. @note This function will go away when WL#3995 is implemented.
@param[in] def_str CREATE FUNCTION|PROCEDURE statement string. @param[in] stmt_str CREATE statement string.
@param[in] def_str_length length of the def_str. @param[in] stmt_length Length of the stmt_str.
@param[in] definer_version_str Minimal MySQL version number when
DEFINER clause is supported in the
given statement.
@param[in] definer_version_length Length of definer_version_str.
@param[in] stmt_version_str Minimal MySQL version number when the
given statement is supported.
@param[in] stmt_version_length Length of stmt_version_str.
@param[in] keyword_str Keyword to look for after CREATE.
@param[in] keyword_length Length of keyword_str.
@return pointer to the new allocated query string. @return pointer to the new allocated query string.
*/ */
static char *cover_definer_clause_in_sp(const char *def_str, static char *cover_definer_clause(const char *stmt_str,
uint def_str_length) uint stmt_length,
const char *definer_version_str,
uint definer_version_length,
const char *stmt_version_str,
uint stmt_version_length,
const char *keyword_str,
uint keyword_length)
{ {
char *query_str= NULL; char *definer_begin= my_case_str(stmt_str, stmt_length,
char *definer_begin= my_case_str(def_str, def_str_length,
C_STRING_WITH_LEN(" DEFINER")); C_STRING_WITH_LEN(" DEFINER"));
char *definer_end; char *definer_end= NULL;
char *query_str= NULL;
char *query_ptr;
if (!definer_begin) if (!definer_begin)
return NULL; return NULL;
definer_end= my_case_str(definer_begin, strlen(definer_begin), definer_end= my_case_str(definer_begin, strlen(definer_begin),
C_STRING_WITH_LEN(" PROCEDURE")); keyword_str, keyword_length);
if (!definer_end) if (!definer_end)
{ return NULL;
definer_end= my_case_str(definer_begin, strlen(definer_begin),
C_STRING_WITH_LEN(" FUNCTION"));
}
if (definer_end) /*
{ Allocate memory for new query string: original string
char *query_str_tail; from SHOW statement and version-specific comments.
*/
query_str= alloc_query_str(stmt_length + 23);
/* query_ptr= strnmov(query_str, stmt_str, definer_begin - stmt_str);
Allocate memory for new query string: original string query_ptr= strnmov(query_ptr, C_STRING_WITH_LEN("*/ /*!"));
from SHOW statement and version-specific comments. query_ptr= strnmov(query_ptr, definer_version_str, definer_version_length);
*/ query_ptr= strnmov(query_ptr, definer_begin, definer_end - definer_begin);
query_str= alloc_query_str(def_str_length + 23); query_ptr= strnmov(query_ptr, C_STRING_WITH_LEN("*/ /*!"));
query_ptr= strnmov(query_ptr, stmt_version_str, stmt_version_length);
query_str_tail= strnmov(query_str, def_str, definer_begin - def_str); query_ptr= strxmov(query_ptr, definer_end, NullS);
query_str_tail= strmov(query_str_tail, "*/ /*!50020");
query_str_tail= strnmov(query_str_tail, definer_begin,
definer_end - definer_begin);
query_str_tail= strxmov(query_str_tail, "*/ /*!50003",
definer_end, NullS);
}
return query_str; return query_str;
} }
@ -1419,8 +1367,8 @@ static void free_resources()
if (md_result_file && md_result_file != stdout) if (md_result_file && md_result_file != stdout)
my_fclose(md_result_file, MYF(0)); my_fclose(md_result_file, MYF(0));
my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
if (hash_inited(&ignore_table)) if (my_hash_inited(&ignore_table))
hash_free(&ignore_table); my_hash_free(&ignore_table);
if (extended_insert) if (extended_insert)
dynstr_free(&extended_row); dynstr_free(&extended_row);
if (insert_pat_inited) if (insert_pat_inited)
@ -1922,6 +1870,8 @@ static uint dump_events_for_db(char *db)
*/ */
if (strlen(row[3]) != 0) if (strlen(row[3]) != 0)
{ {
char *query_str;
if (opt_drop) if (opt_drop)
fprintf(sql_file, "/*!50106 DROP EVENT IF EXISTS %s */%s\n", fprintf(sql_file, "/*!50106 DROP EVENT IF EXISTS %s */%s\n",
event_name, delimiter); event_name, delimiter);
@ -1948,31 +1898,36 @@ static uint dump_events_for_db(char *db)
row[4], /* character_set_results */ row[4], /* character_set_results */
row[5]); /* collation_connection */ row[5]); /* collation_connection */
} }
else else
{ {
/* /*
mysqldump is being run against the server, that does not mysqldump is being run against the server, that does not
provide character set information in SHOW CREATE provide character set information in SHOW CREATE
statements. statements.
NOTE: the dump may be incorrect, since character set NOTE: the dump may be incorrect, since character set
information is required in order to restore event properly. information is required in order to restore event properly.
*/ */
fprintf(sql_file, fprintf(sql_file,
"--\n" "--\n"
"-- WARNING: old server version. " "-- WARNING: old server version. "
"The following dump may be incomplete.\n" "The following dump may be incomplete.\n"
"--\n"); "--\n");
} }
switch_sql_mode(sql_file, delimiter, row[1]); switch_sql_mode(sql_file, delimiter, row[1]);
switch_time_zone(sql_file, delimiter, row[2]); switch_time_zone(sql_file, delimiter, row[2]);
query_str= cover_definer_clause(row[3], strlen(row[3]),
C_STRING_WITH_LEN("50117"),
C_STRING_WITH_LEN("50106"),
C_STRING_WITH_LEN(" EVENT"));
fprintf(sql_file, fprintf(sql_file,
"/*!50106 %s */ %s\n", "/*!50106 %s */ %s\n",
(const char *) row[3], (const char *) (query_str != NULL ? query_str : row[3]),
(const char *) delimiter); (const char *) delimiter);
restore_time_zone(sql_file, delimiter); restore_time_zone(sql_file, delimiter);
@ -2127,7 +2082,16 @@ static uint dump_routines_for_db(char *db)
fprintf(sql_file, "/*!50003 DROP %s IF EXISTS %s */;\n", fprintf(sql_file, "/*!50003 DROP %s IF EXISTS %s */;\n",
routine_type[i], routine_name); routine_type[i], routine_name);
query_str= cover_definer_clause_in_sp(row[2], strlen(row[2])); query_str= cover_definer_clause(row[2], strlen(row[2]),
C_STRING_WITH_LEN("50020"),
C_STRING_WITH_LEN("50003"),
C_STRING_WITH_LEN(" FUNCTION"));
if (!query_str)
query_str= cover_definer_clause(row[2], strlen(row[2]),
C_STRING_WITH_LEN("50020"),
C_STRING_WITH_LEN("50003"),
C_STRING_WITH_LEN(" PROCEDURE"));
if (mysql_num_fields(routine_res) >= 6) if (mysql_num_fields(routine_res) >= 6)
{ {
@ -2806,8 +2770,10 @@ static int dump_trigger(FILE *sql_file, MYSQL_RES *show_create_trigger_rs,
while ((row= mysql_fetch_row(show_create_trigger_rs))) while ((row= mysql_fetch_row(show_create_trigger_rs)))
{ {
char *query_str= cover_definer_clause_in_trigger(row[2], strlen(row[2])); char *query_str= cover_definer_clause(row[2], strlen(row[2]),
C_STRING_WITH_LEN("50017"),
C_STRING_WITH_LEN("50003"),
C_STRING_WITH_LEN(" TRIGGER"));
if (switch_db_collation(sql_file, db_name, ";", if (switch_db_collation(sql_file, db_name, ";",
db_cl_name, row[5], &db_cl_altered)) db_cl_name, row[5], &db_cl_altered))
@ -3316,7 +3282,7 @@ static void dump_table(char *table, char *db)
{ {
if (length) if (length)
{ {
if (!IS_NUM_FIELD(field)) if (!(field->flags & NUM_FLAG))
{ {
/* /*
"length * 2 + 2" is OK for both HEX and non-HEX modes: "length * 2 + 2" is OK for both HEX and non-HEX modes:
@ -3384,7 +3350,7 @@ static void dump_table(char *table, char *db)
} }
if (row[i]) if (row[i])
{ {
if (!IS_NUM_FIELD(field)) if (!(field->flags & NUM_FLAG))
{ {
if (opt_xml) if (opt_xml)
{ {
@ -3992,7 +3958,7 @@ static int init_dumping(char *database, int init_func(char*))
my_bool include_table(const uchar *hash_key, size_t len) my_bool include_table(const uchar *hash_key, size_t len)
{ {
return !hash_search(&ignore_table, hash_key, len); return ! my_hash_search(&ignore_table, hash_key, len);
} }

View File

@ -55,11 +55,10 @@ static char *opt_password=0, *current_user=0,
*current_host=0, *current_db=0, *fields_terminated=0, *current_host=0, *current_db=0, *fields_terminated=0,
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *lines_terminated=0, *enclosed=0, *opt_enclosed=0,
*escaped=0, *opt_columns=0, *escaped=0, *opt_columns=0,
*default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME; *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
static uint opt_mysql_port= 0, opt_protocol= 0; static uint opt_mysql_port= 0, opt_protocol= 0;
static char * opt_mysql_unix_port=0; static char * opt_mysql_unix_port=0;
static longlong opt_ignore_lines= -1; static longlong opt_ignore_lines= -1;
static CHARSET_INFO *charset_info= &my_charset_latin1;
#include <sslopt-vars.h> #include <sslopt-vars.h>
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
@ -282,10 +281,6 @@ static int get_options(int *argc, char ***argv)
fprintf(stderr, "You can't use --ignore (-i) and --replace (-r) at the same time.\n"); fprintf(stderr, "You can't use --ignore (-i) and --replace (-r) at the same time.\n");
return(1); return(1);
} }
if (strcmp(default_charset, charset_info->csname) &&
!(charset_info= get_charset_by_csname(default_charset,
MY_CS_PRIMARY, MYF(MY_WME))))
exit(1);
if (*argc < 2) if (*argc < 2)
{ {
usage(); usage();
@ -440,6 +435,7 @@ static MYSQL *db_connect(char *host, char *database,
if (shared_memory_base_name) if (shared_memory_base_name)
mysql_options(mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); mysql_options(mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
#endif #endif
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset);
if (!(mysql_real_connect(mysql,host,user,passwd, if (!(mysql_real_connect(mysql,host,user,passwd,
database,opt_mysql_port,opt_mysql_unix_port, database,opt_mysql_port,opt_mysql_unix_port,
0))) 0)))

View File

@ -32,7 +32,7 @@ static my_bool tty_password= 0, opt_table_type= 0;
static my_bool debug_info_flag= 0, debug_check_flag= 0; static my_bool debug_info_flag= 0, debug_check_flag= 0;
static uint my_end_arg= 0; static uint my_end_arg= 0;
static uint opt_verbose=0; static uint opt_verbose=0;
static char *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME; static char *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
static char *shared_memory_base_name=0; static char *shared_memory_base_name=0;

View File

@ -1204,7 +1204,7 @@ get_options(int *argc,char ***argv)
if (opt_csv_str[0] == '-') if (opt_csv_str[0] == '-')
{ {
csv_file= fileno(stdout); csv_file= my_fileno(stdout);
} }
else else
{ {

View File

@ -115,6 +115,8 @@ static uint my_end_arg= 0;
/* Number of lines of the result to include in failure report */ /* Number of lines of the result to include in failure report */
static uint opt_tail_lines= 0; static uint opt_tail_lines= 0;
static uint opt_connect_timeout= 0;
static char delimiter[MAX_DELIMITER_LENGTH]= ";"; static char delimiter[MAX_DELIMITER_LENGTH]= ";";
static uint delimiter_length= 1; static uint delimiter_length= 1;
@ -260,8 +262,7 @@ enum enum_commands {
Q_SEND, Q_REAP, Q_SEND, Q_REAP,
Q_DIRTY_CLOSE, Q_REPLACE, Q_REPLACE_COLUMN, Q_DIRTY_CLOSE, Q_REPLACE, Q_REPLACE_COLUMN,
Q_PING, Q_EVAL, Q_PING, Q_EVAL,
Q_RPL_PROBE, Q_ENABLE_RPL_PARSE, Q_EVAL_RESULT,
Q_DISABLE_RPL_PARSE, Q_EVAL_RESULT,
Q_ENABLE_QUERY_LOG, Q_DISABLE_QUERY_LOG, Q_ENABLE_QUERY_LOG, Q_DISABLE_QUERY_LOG,
Q_ENABLE_RESULT_LOG, Q_DISABLE_RESULT_LOG, Q_ENABLE_RESULT_LOG, Q_DISABLE_RESULT_LOG,
Q_WAIT_FOR_SLAVE_TO_STOP, Q_WAIT_FOR_SLAVE_TO_STOP,
@ -283,7 +284,7 @@ enum enum_commands {
Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR, Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR,
Q_LIST_FILES, Q_LIST_FILES_WRITE_FILE, Q_LIST_FILES_APPEND_FILE, Q_LIST_FILES, Q_LIST_FILES_WRITE_FILE, Q_LIST_FILES_APPEND_FILE,
Q_SEND_SHUTDOWN, Q_SHUTDOWN_SERVER, Q_SEND_SHUTDOWN, Q_SHUTDOWN_SERVER,
Q_MOVE_FILE, Q_MOVE_FILE, Q_SEND_EVAL,
Q_UNKNOWN, /* Unknown command. */ Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */ Q_COMMENT, /* Comments, ignored. */
@ -320,9 +321,6 @@ const char *command_names[]=
"replace_column", "replace_column",
"ping", "ping",
"eval", "eval",
"rpl_probe",
"enable_rpl_parse",
"disable_rpl_parse",
"eval_result", "eval_result",
/* Enable/disable that the _query_ is logged to result file */ /* Enable/disable that the _query_ is logged to result file */
"enable_query_log", "enable_query_log",
@ -381,6 +379,7 @@ const char *command_names[]=
"send_shutdown", "send_shutdown",
"shutdown_server", "shutdown_server",
"move_file", "move_file",
"send_eval",
0 0
}; };
@ -662,14 +661,6 @@ public:
LogFile log_file; LogFile log_file;
LogFile progress_file; LogFile progress_file;
/* Disable functions that only exist in MySQL 4.0 */
#if MYSQL_VERSION_ID < 40000
void mysql_enable_rpl_parse(MYSQL* mysql __attribute__((unused))) {}
void mysql_disable_rpl_parse(MYSQL* mysql __attribute__((unused))) {}
int mysql_rpl_parse_enabled(MYSQL* mysql __attribute__((unused))) { return 1; }
my_bool mysql_rpl_probe(MYSQL *mysql __attribute__((unused))) { return 1; }
#endif
void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val, void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val,
int len); int len);
void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val); void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val);
@ -1138,7 +1129,7 @@ void free_used_memory()
close_connections(); close_connections();
close_files(); close_files();
hash_free(&var_hash); my_hash_free(&var_hash);
for (i= 0 ; i < q_lines.elements ; i++) for (i= 0 ; i < q_lines.elements ; i++)
{ {
@ -1171,7 +1162,6 @@ void free_used_memory()
mysql_server_end(); mysql_server_end();
/* Don't use DBUG after mysql_server_end() */ /* Don't use DBUG after mysql_server_end() */
DBUG_VIOLATION_HELPER_LEAVE;
return; return;
} }
@ -2001,8 +1991,8 @@ VAR* var_get(const char *var_name, const char **var_name_end, my_bool raw,
if (length >= MAX_VAR_NAME_LENGTH) if (length >= MAX_VAR_NAME_LENGTH)
die("Too long variable name: %s", save_var_name); die("Too long variable name: %s", save_var_name);
if (!(v = (VAR*) hash_search(&var_hash, (const uchar*) save_var_name, if (!(v = (VAR*) my_hash_search(&var_hash, (const uchar*) save_var_name,
length))) length)))
{ {
char buff[MAX_VAR_NAME_LENGTH+1]; char buff[MAX_VAR_NAME_LENGTH+1];
strmake(buff, save_var_name, length); strmake(buff, save_var_name, length);
@ -2033,7 +2023,7 @@ err:
VAR *var_obtain(const char *name, int len) VAR *var_obtain(const char *name, int len)
{ {
VAR* v; VAR* v;
if ((v = (VAR*)hash_search(&var_hash, (const uchar *) name, len))) if ((v = (VAR*)my_hash_search(&var_hash, (const uchar *) name, len)))
return v; return v;
v = var_init(0, name, len, "", 0); v = var_init(0, name, len, "", 0);
my_hash_insert(&var_hash, (uchar*)v); my_hash_insert(&var_hash, (uchar*)v);
@ -2967,6 +2957,7 @@ void do_move_file(struct st_command *command)
void do_chmod_file(struct st_command *command) void do_chmod_file(struct st_command *command)
{ {
long mode= 0; long mode= 0;
int err_code;
static DYNAMIC_STRING ds_mode; static DYNAMIC_STRING ds_mode;
static DYNAMIC_STRING ds_file; static DYNAMIC_STRING ds_file;
const struct command_arg chmod_file_args[] = { const struct command_arg chmod_file_args[] = {
@ -2986,7 +2977,10 @@ void do_chmod_file(struct st_command *command)
die("You must write a 4 digit octal number for mode"); die("You must write a 4 digit octal number for mode");
DBUG_PRINT("info", ("chmod %o %s", (uint)mode, ds_file.str)); DBUG_PRINT("info", ("chmod %o %s", (uint)mode, ds_file.str));
handle_command_error(command, chmod(ds_file.str, mode)); err_code= chmod(ds_file.str, mode);
if (err_code < 0)
err_code= 1;
handle_command_error(command, err_code);
dynstr_free(&ds_mode); dynstr_free(&ds_mode);
dynstr_free(&ds_file); dynstr_free(&ds_file);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
@ -3847,12 +3841,8 @@ int do_save_master_pos()
MYSQL_ROW row; MYSQL_ROW row;
MYSQL *mysql = &cur_con->mysql; MYSQL *mysql = &cur_con->mysql;
const char *query; const char *query;
int rpl_parse;
DBUG_ENTER("do_save_master_pos"); DBUG_ENTER("do_save_master_pos");
rpl_parse = mysql_rpl_parse_enabled(mysql);
mysql_disable_rpl_parse(mysql);
#ifdef HAVE_NDB_BINLOG #ifdef HAVE_NDB_BINLOG
/* /*
Wait for ndb binlog to be up-to-date with all changes Wait for ndb binlog to be up-to-date with all changes
@ -4002,10 +3992,6 @@ int do_save_master_pos()
strnmov(master_pos.file, row[0], sizeof(master_pos.file)-1); strnmov(master_pos.file, row[0], sizeof(master_pos.file)-1);
master_pos.pos = strtoul(row[1], (char**) 0, 10); master_pos.pos = strtoul(row[1], (char**) 0, 10);
mysql_free_result(res); mysql_free_result(res);
if (rpl_parse)
mysql_enable_rpl_parse(mysql);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -4068,29 +4054,6 @@ void do_let(struct st_command *command)
} }
int do_rpl_probe(struct st_command *command __attribute__((unused)))
{
DBUG_ENTER("do_rpl_probe");
if (mysql_rpl_probe(&cur_con->mysql))
die("Failed in mysql_rpl_probe(): '%s'", mysql_error(&cur_con->mysql));
DBUG_RETURN(0);
}
int do_enable_rpl_parse(struct st_command *command __attribute__((unused)))
{
mysql_enable_rpl_parse(&cur_con->mysql);
return 0;
}
int do_disable_rpl_parse(struct st_command *command __attribute__((unused)))
{
mysql_disable_rpl_parse(&cur_con->mysql);
return 0;
}
/* /*
Sleep the number of specified seconds Sleep the number of specified seconds
@ -5021,6 +4984,11 @@ void do_connect(struct st_command *command)
#endif #endif
if (!mysql_init(&con_slot->mysql)) if (!mysql_init(&con_slot->mysql))
die("Failed on mysql_init()"); die("Failed on mysql_init()");
if (opt_connect_timeout)
mysql_options(&con_slot->mysql, MYSQL_OPT_CONNECT_TIMEOUT,
(void *) &opt_connect_timeout);
if (opt_compress || con_compress) if (opt_compress || con_compress)
mysql_options(&con_slot->mysql, MYSQL_OPT_COMPRESS, NullS); mysql_options(&con_slot->mysql, MYSQL_OPT_COMPRESS, NullS);
mysql_options(&con_slot->mysql, MYSQL_OPT_LOCAL_INFILE, 0); mysql_options(&con_slot->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
@ -5810,6 +5778,11 @@ static struct my_option my_long_options[] =
{"view-protocol", OPT_VIEW_PROTOCOL, "Use views for select", {"view-protocol", OPT_VIEW_PROTOCOL, "Use views for select",
(uchar**) &view_protocol, (uchar**) &view_protocol, 0, (uchar**) &view_protocol, (uchar**) &view_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"connect_timeout", OPT_CONNECT_TIMEOUT,
"Number of seconds before connection timeout.",
(uchar**) &opt_connect_timeout,
(uchar**) &opt_connect_timeout, 0, GET_UINT, REQUIRED_ARG,
120, 0, 3600 * 12, 0, 0, 0},
{ 0, 0, 0, 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}
}; };
@ -6548,8 +6521,6 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
if (!disable_result_log) if (!disable_result_log)
{ {
ulonglong UNINIT_VAR(affected_rows); /* Ok to be undef if 'disable_info' is set */
if (res) if (res)
{ {
MYSQL_FIELD *fields= mysql_fetch_fields(res); MYSQL_FIELD *fields= mysql_fetch_fields(res);
@ -6566,10 +6537,10 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
/* /*
Need to call mysql_affected_rows() before the "new" Need to call mysql_affected_rows() before the "new"
query to find the warnings query to find the warnings.
*/ */
if (!disable_info) if (!disable_info)
affected_rows= mysql_affected_rows(mysql); append_info(ds, mysql_affected_rows(mysql), mysql_info(mysql));
/* /*
Add all warnings to the result. We can't do this if we are in Add all warnings to the result. We can't do this if we are in
@ -6584,9 +6555,6 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
dynstr_append_mem(ds, ds_warnings->str, ds_warnings->length); dynstr_append_mem(ds, ds_warnings->str, ds_warnings->length);
} }
} }
if (!disable_info)
append_info(ds, affected_rows, mysql_info(mysql));
} }
if (res) if (res)
@ -6960,40 +6928,34 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command,
} }
/* /*
Need to grab affected rows information before getting Fetch info before fetching warnings, since it will be reset
warnings here otherwise.
*/ */
if (!disable_info)
append_info(ds, mysql_stmt_affected_rows(stmt), mysql_info(mysql));
if (!disable_warnings)
{ {
ulonglong UNINIT_VAR(affected_rows); /* Get the warnings from execute */
if (!disable_info) /* Append warnings to ds - if there are any */
affected_rows= mysql_affected_rows(mysql); if (append_warnings(&ds_execute_warnings, mysql) ||
ds_execute_warnings.length ||
if (!disable_warnings) ds_prepare_warnings.length ||
ds_warnings->length)
{ {
/* Get the warnings from execute */ dynstr_append_mem(ds, "Warnings:\n", 10);
if (ds_warnings->length)
/* Append warnings to ds - if there are any */ dynstr_append_mem(ds, ds_warnings->str,
if (append_warnings(&ds_execute_warnings, mysql) || ds_warnings->length);
ds_execute_warnings.length || if (ds_prepare_warnings.length)
ds_prepare_warnings.length || dynstr_append_mem(ds, ds_prepare_warnings.str,
ds_warnings->length) ds_prepare_warnings.length);
{ if (ds_execute_warnings.length)
dynstr_append_mem(ds, "Warnings:\n", 10); dynstr_append_mem(ds, ds_execute_warnings.str,
if (ds_warnings->length) ds_execute_warnings.length);
dynstr_append_mem(ds, ds_warnings->str,
ds_warnings->length);
if (ds_prepare_warnings.length)
dynstr_append_mem(ds, ds_prepare_warnings.str,
ds_prepare_warnings.length);
if (ds_execute_warnings.length)
dynstr_append_mem(ds, ds_execute_warnings.str,
ds_execute_warnings.length);
}
} }
if (!disable_info)
append_info(ds, affected_rows, mysql_info(mysql));
} }
} }
@ -7043,6 +7005,10 @@ int util_query(MYSQL* org_mysql, const char* query){
if (!(mysql= mysql_init(mysql))) if (!(mysql= mysql_init(mysql)))
die("Failed in mysql_init()"); die("Failed in mysql_init()");
if (opt_connect_timeout)
mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT,
(void *) &opt_connect_timeout);
/* enable local infile, in non-binary builds often disabled by default */ /* enable local infile, in non-binary builds often disabled by default */
mysql_options(mysql, MYSQL_OPT_LOCAL_INFILE, 0); mysql_options(mysql, MYSQL_OPT_LOCAL_INFILE, 0);
safe_connect(mysql, "util", org_mysql->host, org_mysql->user, safe_connect(mysql, "util", org_mysql->host, org_mysql->user,
@ -7091,7 +7057,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
/* /*
Evaluate query if this is an eval command Evaluate query if this is an eval command
*/ */
if (command->type == Q_EVAL) if (command->type == Q_EVAL || command->type == Q_SEND_EVAL)
{ {
init_dynamic_string(&eval_query, "", command->query_len+256, 1024); init_dynamic_string(&eval_query, "", command->query_len+256, 1024);
do_eval(&eval_query, command->query, command->end, FALSE); do_eval(&eval_query, command->query, command->end, FALSE);
@ -7638,8 +7604,8 @@ int main(int argc, char **argv)
my_init_dynamic_array(&q_lines, sizeof(struct st_command*), 1024, 1024); my_init_dynamic_array(&q_lines, sizeof(struct st_command*), 1024, 1024);
if (hash_init(&var_hash, charset_info, if (my_hash_init(&var_hash, charset_info,
1024, 0, 0, get_var_key, var_free, MYF(0))) 1024, 0, 0, get_var_key, var_free, MYF(0)))
die("Variable hash initialization failed"); die("Variable hash initialization failed");
var_set_string("$MYSQL_SERVER_VERSION", MYSQL_SERVER_VERSION); var_set_string("$MYSQL_SERVER_VERSION", MYSQL_SERVER_VERSION);
@ -7702,6 +7668,9 @@ int main(int argc, char **argv)
st_connection *con= connections; st_connection *con= connections;
if (!( mysql_init(&con->mysql))) if (!( mysql_init(&con->mysql)))
die("Failed in mysql_init()"); die("Failed in mysql_init()");
if (opt_connect_timeout)
mysql_options(&con->mysql, MYSQL_OPT_CONNECT_TIMEOUT,
(void *) &opt_connect_timeout);
if (opt_compress) if (opt_compress)
mysql_options(&con->mysql,MYSQL_OPT_COMPRESS,NullS); mysql_options(&con->mysql,MYSQL_OPT_COMPRESS,NullS);
mysql_options(&con->mysql, MYSQL_OPT_LOCAL_INFILE, 0); mysql_options(&con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
@ -7806,9 +7775,6 @@ int main(int argc, char **argv)
case Q_DISCONNECT: case Q_DISCONNECT:
case Q_DIRTY_CLOSE: case Q_DIRTY_CLOSE:
do_close_connection(command); break; do_close_connection(command); break;
case Q_RPL_PROBE: do_rpl_probe(command); break;
case Q_ENABLE_RPL_PARSE: do_enable_rpl_parse(command); break;
case Q_DISABLE_RPL_PARSE: do_disable_rpl_parse(command); break;
case Q_ENABLE_QUERY_LOG: disable_query_log=0; break; case Q_ENABLE_QUERY_LOG: disable_query_log=0; break;
case Q_DISABLE_QUERY_LOG: disable_query_log=1; break; case Q_DISABLE_QUERY_LOG: disable_query_log=1; break;
case Q_ENABLE_ABORT_ON_ERROR: abort_on_error=1; break; case Q_ENABLE_ABORT_ON_ERROR: abort_on_error=1; break;
@ -7915,6 +7881,7 @@ int main(int argc, char **argv)
break; break;
} }
case Q_SEND: case Q_SEND:
case Q_SEND_EVAL:
if (!*command->first_argument) if (!*command->first_argument)
{ {
/* /*

View File

@ -33,7 +33,7 @@ LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
if (!(line_buff=(LINE_BUFFER*) if (!(line_buff=(LINE_BUFFER*)
my_malloc(sizeof(*line_buff),MYF(MY_WME | MY_ZEROFILL)))) my_malloc(sizeof(*line_buff),MYF(MY_WME | MY_ZEROFILL))))
return 0; return 0;
if (init_line_buffer(line_buff,fileno(file),IO_SIZE,max_size)) if (init_line_buffer(line_buff,my_fileno(file),IO_SIZE,max_size))
{ {
my_free(line_buff,MYF(0)); my_free(line_buff,MYF(0));
return 0; return 0;

View File

@ -1,3 +1,6 @@
#ifndef CLIENT_SQL_STRING_INCLUDED
#define CLIENT_SQL_STRING_INCLUDED
/* Copyright (C) 2000 MySQL 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
@ -353,3 +356,5 @@ public:
return (s->alloced && Ptr >= s->Ptr && Ptr < s->Ptr + s->str_length); return (s->alloced && Ptr >= s->Ptr && Ptr < s->Ptr + s->str_length);
} }
}; };
#endif /* CLIENT_SQL_STRING_INCLUDED */

View File

@ -623,24 +623,6 @@ then
fi fi
fi fi
AC_MSG_CHECKING(whether features provided by the user community should be included.)
AC_ARG_ENABLE(community-features,
AC_HELP_STRING(
[--disable-community-features],
[Disable additional features provided by the user community.]),
[ ENABLE_COMMUNITY_FEATURES=$enableval ],
[ ENABLE_COMMUNITY_FEATURES=yes ]
)
if test "$ENABLE_COMMUNITY_FEATURES" = "yes"
then
AC_DEFINE([COMMUNITY_SERVER], [1],
[Whether features provided by the user community should be included])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_ARG_WITH(server-suffix, AC_ARG_WITH(server-suffix,
[ --with-server-suffix Append value to the version string.], [ --with-server-suffix Append value to the version string.],
[ MYSQL_SERVER_SUFFIX=`echo "$withval" | sed -e 's/^\(...................................\)..*$/\1/'` ], [ MYSQL_SERVER_SUFFIX=`echo "$withval" | sed -e 's/^\(...................................\)..*$/\1/'` ],
@ -706,21 +688,14 @@ fi
# Add query profiler # Add query profiler
AC_MSG_CHECKING(if SHOW PROFILE should be enabled.) AC_MSG_CHECKING(if SHOW PROFILE should be enabled.)
AC_ARG_ENABLE(profiling, AC_ARG_ENABLE(profiling,
AS_HELP_STRING([--enable-profiling], [Build a version with query profiling code (req. community-features)]), AS_HELP_STRING([--enable-profiling], [Enable profiling of query lifetime.]),
[ ENABLED_PROFILING=$enableval ], [ ENABLED_PROFILING=$enableval ],
[ ENABLED_PROFILING=$ENABLE_COMMUNITY_FEATURES ]) [ ENABLED_PROFILING=no ])
AC_DEFINE([ENABLED_PROFILING], [1], [If SHOW PROFILE should be enabled])
if test "$ENABLED_PROFILING" = "yes" if test "$ENABLED_PROFILING" = "yes"
then then
if test "$ENABLE_COMMUNITY_FEATURES" = "yes"; AC_MSG_RESULT([yes])
then
AC_DEFINE([ENABLED_PROFILING], [1],
[If SHOW PROFILE should be enabled])
AC_MSG_RESULT([yes])
else
ENABLED_PROFILING="no"
AC_MSG_RESULT([no, overridden by community-features disabled])
fi
else else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
fi fi
@ -2054,10 +2029,11 @@ AC_SUBST(MAKE_SHELL)
AC_CHECK_HEADERS(varargs.h stdarg.h dirent.h locale.h ndir.h sys/dir.h \ AC_CHECK_HEADERS(varargs.h stdarg.h dirent.h locale.h ndir.h sys/dir.h \
sys/file.h sys/ndir.h sys/ptem.h sys/pte.h sys/select.h sys/stream.h \ sys/file.h sys/ndir.h sys/ptem.h sys/pte.h sys/select.h sys/stream.h \
sys/mman.h curses.h termcap.h termio.h termbits.h asm/termbits.h grp.h \ sys/mman.h curses.h termcap.h termio.h termbits.h asm/termbits.h grp.h \
paths.h semaphore.h) paths.h semaphore.h langinfo.h)
# Already-done: strcasecmp # Already-done: strcasecmp
AC_CHECK_FUNCS(lstat putenv select setenv setlocale strcoll tcgetattr) AC_CHECK_FUNCS(lstat putenv select setenv setlocale strcoll tcgetattr)
AC_CHECK_FUNCS(nl_langinfo)
AC_STAT_MACROS_BROKEN AC_STAT_MACROS_BROKEN
MYSQL_SIGNAL_CHECK MYSQL_SIGNAL_CHECK
@ -2951,7 +2927,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
man/Makefile BUILD/Makefile vio/Makefile dnl man/Makefile BUILD/Makefile vio/Makefile dnl
libmysql/Makefile libmysql_r/Makefile client/Makefile dnl libmysql/Makefile libmysql_r/Makefile client/Makefile dnl
sql/Makefile sql/share/Makefile dnl sql/Makefile sql/share/Makefile dnl
sql/sql_builtin.cc sql-common/Makefile dnl sql/sql_builtin.cc sql-common/Makefile libservices/Makefile dnl
dbug/Makefile scripts/Makefile include/Makefile dnl dbug/Makefile scripts/Makefile include/Makefile dnl
tests/Makefile Docs/Makefile support-files/Makefile dnl tests/Makefile Docs/Makefile support-files/Makefile dnl
support-files/MacOSX/Makefile support-files/RHEL4-SElinux/Makefile dnl support-files/MacOSX/Makefile support-files/RHEL4-SElinux/Makefile dnl

View File

@ -1,3 +0,0 @@
.deps
Makefile
Makefile.in

View File

@ -18,7 +18,6 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/dbug)
SET(DBUG_SOURCES dbug.c factorial.c sanity.c) SET(DBUG_SOURCES dbug.c factorial.c sanity.c)
IF(NOT SOURCE_SUBLIBS) IF(NOT SOURCE_SUBLIBS)
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_LIBRARY(dbug ${DBUG_SOURCES}) ADD_LIBRARY(dbug ${DBUG_SOURCES})
ENDIF(NOT SOURCE_SUBLIBS) ENDIF(NOT SOURCE_SUBLIBS)

View File

@ -23,19 +23,20 @@ libdbug_a_SOURCES = dbug.c sanity.c
EXTRA_DIST = CMakeLists.txt example1.c example2.c example3.c \ EXTRA_DIST = CMakeLists.txt example1.c example2.c example3.c \
user.r monty.doc dbug_add_tags.pl \ user.r monty.doc dbug_add_tags.pl \
my_main.c main.c factorial.c dbug_analyze.c \ my_main.c main.c factorial.c dbug_analyze.c \
CMakeLists.txt CMakeLists.txt tests.c tests-t.pl
NROFF_INC = example1.r example2.r example3.r main.r \ NROFF_INC = example1.r example2.r example3.r main.r \
factorial.r output1.r output2.r output3.r \ factorial.r output1.r output2.r output3.r \
output4.r output5.r output4.r output5.r
CLEANFILES = $(NROFF_INC) user.t user.ps CLEANFILES = $(NROFF_INC) user.t user.ps tests-t
# Must be linked with libs that are not compiled yet # Must be linked with libs that are not compiled yet
noinst_PROGRAMS = factorial dbug_analyze noinst_PROGRAMS = factorial dbug_analyze tests
factorial_SOURCES = my_main.c factorial.c factorial_SOURCES = my_main.c factorial.c
tests_SOURCES = tests.c
dbug_analyze_SOURCES = dbug_analyze.c dbug_analyze_SOURCES = dbug_analyze.c
all: user.t user.ps all: user.t user.ps tests-t
user.t: user.r $(NROFF_INC) user.t: user.r $(NROFF_INC)
-nroff -mm user.r > $@ -nroff -mm user.r > $@
@ -61,5 +62,7 @@ output5.r: factorial
@RM@ -f $@ @RM@ -f $@
@SED@ -e 's!\\!\\\\!g' $< > $@ @SED@ -e 's!\\!\\\\!g' $< > $@
# Don't update the files from bitkeeper # a hack to have executable in builddir, not in srcdir
%::SCCS/s.% tests-t: tests-t.pl
cp -f $(srcdir)/tests-t.pl ./tests-t

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ $ctags="exctags -x -f - --c-types=f -u";
sub get_tag { sub get_tag {
local $.; local $_=<TAGS>; local $.; local $_=<TAGS>;
($symbol, $line)= /^(.*\S)\s+function\s+(\d+)/; ($symbol, $line)= /^(.*\S)\s+function\s+(\d+)/;
$symbol=$1 if /\s(\S+)\s*\(/; $symbol=$1 if /[\s*]([^\s*]+)\s*\(/;
$line=1e50 unless $line; $line=1e50 unless $line;
} }
@ -51,7 +51,7 @@ while($src=shift)
$skip=!$semicolon; $skip=!$semicolon;
$semicolon= /;\s*$/; $semicolon= /;\s*$/;
print && next if $skip || print && next if $skip ||
(/^\s+\w+((::\w+)?|<\w+>)\s+\**\w+/ && !/^\s*return/); (/^\s+\w+((::\w+)?|<\w+>)\s+\**\w+/ && !/^\s*return\b/);
last if /DBUG_ENTER/; last if /DBUG_ENTER/;
print "$tab DBUG_ENTER(\"$symbol\");\n"; print "$tab DBUG_ENTER(\"$symbol\");\n";
print "\n" unless $_ eq "\n"; print "\n" unless $_ eq "\n";

View File

@ -1,15 +0,0 @@
# Warning - first line left blank for sh/csh/ksh compatibility. Do not
# remove it. fnf@Unisoft
# doinstall.sh --- figure out environment and do recursive make with
# appropriate pathnames. Works under SV or BSD.
if [ -r /usr/include/search.h ]
then
# System V
$* LLIB=/usr/lib
else
# 4.2 BSD
$* LLIB=/usr/lib/lint
fi

View File

@ -1,64 +0,0 @@
# WARNING -- first line intentionally left blank for sh/csh/ksh
# compatibility. Do not remove it! FNF, UniSoft Systems.
#
# Usage is:
# install <from> <to>
#
# The file <to> is replaced with the file <from>, after first
# moving <to> to a backup file. The backup file name is created
# by prepending the filename (after removing any leading pathname
# components) with "OLD".
#
# This script is currently not real robust in the face of signals
# or permission problems. It also does not do (by intention) all
# the things that the System V or BSD install scripts try to do
#
if [ $# -ne 2 ]
then
echo "usage: $0 <from> <to>"
exit 1
fi
# Now extract the dirname and basename components. Unfortunately, BSD does
# not have dirname, so we do it the hard way.
fd=`expr $1'/' : '\(/\)[^/]*/$' \| $1'/' : '\(.*[^/]\)//*[^/][^/]*//*$' \| .`
ff=`basename $1`
td=`expr $2'/' : '\(/\)[^/]*/$' \| $2'/' : '\(.*[^/]\)//*[^/][^/]*//*$' \| .`
tf=`basename $2`
# Now test to make sure that they are not the same files.
if [ $fd/$ff = $td/$tf ]
then
echo "install: input and output are same files"
exit 2
fi
# Save a copy of the "to" file as a backup.
if test -f $td/$tf
then
if test -f $td/OLD$tf
then
rm -f $td/OLD$tf
fi
mv $td/$tf $td/OLD$tf
if [ $? != 0 ]
then
exit 3
fi
fi
# Now do the copy and return appropriate status
cp $fd/$ff $td/$tf
if [ $? != 0 ]
then
exit 4
else
exit 0
fi

View File

@ -1,30 +0,0 @@
# Warning - first line left blank for sh/csh/ksh compatibility. Do not
# remove it. fnf@Unisoft
# mklintlib --- make a lint library, under either System V or 4.2 BSD
#
# usage: mklintlib <infile> <outfile>
#
if test $# -ne 2
then
echo "usage: mklintlib <infile> <outfile>"
exit 1
fi
if grep SIGTSTP /usr/include/signal.h >/dev/null
then # BSD
if test -r /usr/include/whoami.h # 4.1
then
/lib/cpp -C -Dlint $1 >hlint
(/usr/lib/lint/lint1 <hlint >$2) 2>&1 | grep -v warning
else # 4.2
lint -Cxxxx $1
mv llib-lxxxx.ln $2
fi
else # USG
cc -E -C -Dlint $1 | /usr/lib/lint1 -vx -Hhlint >$2
rm -f hlint
fi
exit 0 # don't kill make

View File

@ -1,4 +0,0 @@
CL -I\my\include -AL -Gsm2 -FPi -DDBUG_OFF *.c
rm \my\lib\dbug.lib
lib.exe \my\lib\dbug dbug.obj sanity.obj;
link /NOD /STACK:8000 main factoria,factoria,,DBUG+STRINGS+LLIBCEP+DOSCALLS;

View File

@ -0,0 +1,26 @@
#!/usr/bin/perl
die <<EEE unless @ARGV;
Usage: $0 func1 [func2 [ ...] ]
This filter (stdin->stdout) removes lines from dbug trace that were generated
by specified functions and all functions down the call stack. Produces the
same effect as if the original source had DBUG_PUSH(""); right after
DBUG_ENTER() and DBUG_POP(); right before DBUG_RETURN in every such a function.
EEE
$re=join('|', @ARGV);
$skip='';
while(<STDIN>) {
print unless $skip;
next unless /^(?:.*: )*((?:\| )*)([<>])($re)\n/o;
if ($2 eq '>') {
$skip=$1.$3 unless $skip;
next;
}
next if $skip ne $1.$3;
$skip='';
print;
}

496
dbug/tests-t.pl Executable file
View File

@ -0,0 +1,496 @@
#!/usr/bin/env perl
#
# A driver program to test DBUG features - runs tests (shell commands)
# from the end of file to invoke tests.c, which does the real dbug work.
#
use Test::More;
$exe=$0;
die unless $exe =~ s/(tests)-t(\.exe)?$/$1$2 /;
# load tests
@tests=();
while (<DATA>) {
if (/^% \.\/tests /) {
push @tests, [ $' ]
} elsif (/^#/) {
next;
} else {
push @{$tests[$#tests]}, $_
}
}
plan skip_all => "because dbug is disabled" if system $exe;
plan tests => scalar(@tests);
for (@tests) {
$t=$exe . shift @$_;
chomp($t);
open F, '-|', $t or die "open($t|): $!";
local $";
$out=join($", <F>); close(F);
# special cases are handled here:
$out =~ s/Memory: 0x[0-9A-Fa-f]+/Memory: 0x####/g if $t =~ /dump/;
# compare ("\n" at the beginning makes better output in case of errors)
is("\n$out","\n@$_", $t);
}
__DATA__
% ./tests -#d
func2: info: s=ok
=> execute
=> evaluate: ON
=> evaluate_if: OFF
main: explain: dbug explained: d
func2: info: s=ok
% ./tests d,ret3
=> evaluate: OFF
=> evaluate_if: OFF
#
## Testing negative lists
#
% ./tests d:-d,ret3
func2: info: s=ko
=> execute
=> evaluate: ON
=> evaluate_if: OFF
main: explain: dbug explained: d:-d,ret3
func2: info: s=ko
% ./tests t:-d,ret3
>main
| >func1
| | >func2
| | | >func3
| | | <func3
| | <func2
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
| | <func3
| <func2
<main
% ./tests t:d,info:-d,ret3
>main
| >func1
| | >func2
| | | >func3
| | | <func3
| | | info: s=ko
| | <func2
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
| | <func3
| | info: s=ko
| <func2
<main
% ./tests t:d,info:-d,ret3:-f,func2
>main
| >func1
| | | >func3
| | | <func3
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
| | >func3
| | <func3
<main
% ./tests t:d,info:-d,ret3:-f,func2 d,evaluate
=> evaluate: ON
=> evaluate_if: OFF
% ./tests t:d,info:-d,ret3:-f,func2 d,evaluate_if
=> evaluate: OFF
=> evaluate_if: ON
% ./tests t:d:-d,ret3:-f,func2 d,evaluate_if
=> evaluate: OFF
=> evaluate_if: ON
% ./tests t:d:-d,ret3:-f,func2
>main
| >func1
| | | >func3
| | | <func3
| <func1
=> execute
=> evaluate: ON
=> evaluate_if: OFF
| explain: dbug explained: d:-d,ret3:f:-f,func2:t
| | >func3
| | <func3
<main
#
## Adding incremental settings to the brew
#
% ./tests t:d:-d,ret3:-f,func2 +d,evaluate_if
>main
| >func1
| | | >func3
| | | <func3
| <func1
=> evaluate: OFF
=> evaluate_if: ON
| | >func3
| | <func3
<main
#
## DBUG_DUMP
#
% ./tests t:d:-d,ret3:f:-f,func2 +d,dump
>main
| >func1
| | | >func3
| | | <func3
| <func1
| dump: Memory: 0x#### Bytes: (27)
64 2C 64 75 6D 70 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D 66 2C 66 75 6E 63 32 3A
74
=> evaluate: OFF
=> evaluate_if: OFF
| | >func3
| | <func3
<main
% ./tests t:d:-d,ret3:f:-f,func2 +d,dump
>main
| >func1
| | | >func3
| | | <func3
| <func1
| dump: Memory: 0x#### Bytes: (27)
64 2C 64 75 6D 70 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D 66 2C 66 75 6E 63 32 3A
74
=> evaluate: OFF
=> evaluate_if: OFF
| | >func3
| | <func3
<main
% ./tests t:d:-d,ret3:f:-f,func2:+d,dump
>main
| >func1
| | | >func3
| | | <func3
| <func1
| dump: Memory: 0x#### Bytes: (27)
64 2C 64 75 6D 70 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D 66 2C 66 75 6E 63 32 3A
74
=> evaluate: OFF
=> evaluate_if: OFF
| | >func3
| | <func3
<main
% ./tests t:d:-d,ret3:f:-f,func2 +d,dump,explain
>main
| >func1
| | | >func3
| | | <func3
| <func1
| dump: Memory: 0x#### Bytes: (35)
64 2C 64 75 6D 70 2C 65 78 70 6C 61 69 6E 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D
66 2C 66 75 6E 63 32 3A 74
=> evaluate: OFF
=> evaluate_if: OFF
| explain: dbug explained: d,dump,explain:-d,ret3:f:-f,func2:t
| | >func3
| | <func3
<main
% ./tests t:d:-d,ret3:f:-f,func2 +d,dump,explain:P
dbug: >main
dbug-tests: | >func1
dbug-tests: | | | >func3
dbug-tests: | | | <func3
dbug-tests: | <func1
dbug-tests: | dump: Memory: 0x#### Bytes: (37)
64 2C 64 75 6D 70 2C 65 78 70 6C 61 69 6E 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D
66 2C 66 75 6E 63 32 3A 50 3A 74
=> evaluate: OFF
=> evaluate_if: OFF
dbug-tests: | explain: dbug explained: d,dump,explain:-d,ret3:f:-f,func2:P:t
dbug-tests: | | >func3
dbug-tests: | | <func3
dbug-tests: <main
% ./tests t:d:-d,ret3:f:-f,func2 +d,dump,explain:P:F
dbug: tests.c: >main
dbug-tests: tests.c: | >func1
dbug-tests: tests.c: | | | >func3
dbug-tests: tests.c: | | | <func3
dbug-tests: tests.c: | <func1
dbug-tests: tests.c: | dump: Memory: 0x#### Bytes: (39)
64 2C 64 75 6D 70 2C 65 78 70 6C 61 69 6E 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D
66 2C 66 75 6E 63 32 3A 46 3A 50 3A 74
=> evaluate: OFF
=> evaluate_if: OFF
dbug-tests: tests.c: | explain: dbug explained: d,dump,explain:-d,ret3:f:-f,func2:F:P:t
dbug-tests: tests.c: | | >func3
dbug-tests: tests.c: | | <func3
dbug-tests: tests.c: <main
#
## DBUG_EXPLAIN, DBUG_PUSH, DBUG_POP, DBUG_SET
#
% ./tests t:d:-d,ret3:f:-f,func2
>main
| >func1
| | | >func3
| | | <func3
| <func1
=> execute
=> evaluate: ON
=> evaluate_if: OFF
| explain: dbug explained: d:-d,ret3:f:-f,func2:t
| | >func3
| | <func3
<main
% ./tests t:d:-d,ret3
>main
| >func1
| | >func2
| | | >func3
| | | <func3
| | | info: s=ko
| | <func2
| <func1
=> execute
=> evaluate: ON
=> evaluate_if: OFF
| explain: dbug explained: d:-d,ret3:t
| >func2
| | >func3
| | <func3
| | info: s=ko
| <func2
<main
% ./tests d,info:-d,ret3:d,push
func2: info: s=ko
=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
| | <func3
| | info: s=ko
| <func2
<main
% ./tests d,info:-d,ret3:d,push,explain
func2: info: s=ko
=> evaluate: OFF
=> evaluate_if: OFF
| explain: dbug explained: d,info,push,explain:-d,ret3:t
| >func2
| | >func3
| | <func3
| | info: s=ko
| <func2
<main
% ./tests d,info:-d,ret3:d,explain
func2: info: s=ko
=> evaluate: OFF
=> evaluate_if: OFF
main: explain: dbug explained: d,info,explain:-d,ret3
func2: info: s=ko
% ./tests d,info:-d,ret3:d,explain,pop
func2: info: s=ko
=> evaluate: OFF
=> evaluate_if: OFF
% ./tests d,info:-d,ret3:d,explain t:d,pop
>main
| >func1
| | >func2
| | | >func3
| | | <func3
| | <func2
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
main: explain: dbug explained: d,info,explain:-d,ret3
func2: info: s=ko
% ./tests d,info:-d,ret3:d,explain,pop +t
>main
| >func1
| | >func2
| | | >func3
| | | <func3
| | | info: s=ko
| | <func2
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
main: explain: dbug explained: d,info,explain,pop:-d,ret3
func2: info: s=ko
% ./tests d,info:-d,ret3:d,explain,set
func2: info: s=ko
=> evaluate: OFF
=> evaluate_if: OFF
tests.c: main: explain: dbug explained: d,info,explain,set:-d,ret3:F
tests.c: func2: info: s=ko
% ./tests d,info:-d,ret3:d,explain,set:t
>main
| >func1
| | >func2
| | | >func3
| | | <func3
| | | info: s=ko
| | <func2
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
tests.c: | explain: dbug explained: d,info,explain,set:-d,ret3:F:t
tests.c: | >func2
tests.c: | | >func3
tests.c: | | <func3
tests.c: | | info: s=ko
tests.c: | <func2
tests.c: <main
% ./tests t d,info:-d,ret3:d,explain,set:t
>main
| >func1
| | >func2
| | | >func3
| | | <func3
| | | info: s=ko
| | <func2
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
tests.c: | explain: dbug explained: d,info,explain,set:-d,ret3:F:t
tests.c: | >func2
tests.c: | | >func3
tests.c: | | <func3
tests.c: | | info: s=ko
tests.c: | <func2
tests.c: <main
% ./tests t d,info:-d,ret3:d,explain,set,pop
func2: info: s=ko
=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
| | <func3
| <func2
<main
% ./tests t:f,func2
| | >func2
| | <func2
=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| <func2
#
## Testing SUBDIR rules
#
% ./tests t:-f,func2/:d
>main
| >func1
| <func1
=> execute
=> evaluate: ON
=> evaluate_if: OFF
| explain: dbug explained: d:f:-f,func2/:t
<main
% ./tests t:f,func1/:d
| >func1
| | >func2
| | | >func3
| | | <func3
| | | info: s=ok
| | <func2
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
% ./tests t:f,main/:d,pop
>main
| >func1
| | >func2
| | | >func3
| | | <func3
| | <func2
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
% ./tests f,main/:d,push
=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
| | <func3
| <func2
<main
#
## Testing FixTraceFlags() - when we need to traverse the call stack
# (these tests fail with FixTraceFlags() disabled)
#
# delete the INCLUDE rule up the stack
% ./tests t:f,func1/ --push1=t:f,func3/
| >func1
| | >func2
| | | >func3
| | | <func3
| | <func2
=> push1
=> evaluate: OFF
=> evaluate_if: OFF
| | >func3
| | <func3
# delete the EXCLUDE rule up the stack
% ./tests t:-f,func1/ --push1=t
>main
=> push1
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
| | <func3
| <func2
<main
# add the INCLUDE rule up the stack
% ./tests t:f,func3 --push1=t:f,main/
| | | >func3
| | | <func3
=> push1
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
| | <func3
| <func2
<main
# add the EXCLUDE rule up the stack
% ./tests t --push1=t:-f,main/
>main
| >func1
| | >func2
| | | >func3
| | | <func3
| | <func2
=> push1
=> evaluate: OFF
=> evaluate_if: OFF
# change the defaults
% ./tests t:f,func3 --push1=t
| | | >func3
| | | <func3
=> push1
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
| | <func3
| <func2
<main
# repeated keyword
% ./tests d:-d,info,info
=> execute
=> evaluate: ON
=> evaluate_if: OFF
main: explain: dbug explained: d:-d,info
% ./tests d:-d,info/,info
=> execute
=> evaluate: ON
=> evaluate_if: OFF
main: explain: dbug explained: d:-d,info/

87
dbug/tests.c Normal file
View File

@ -0,0 +1,87 @@
/*
A program to test DBUG features. Used by tests-t.pl
*/
char *push1=0;
#include <my_global.h> /* This includes dbug.h */
#include <my_pthread.h>
#include <string.h>
const char *func3()
{
DBUG_ENTER("func3");
DBUG_RETURN(DBUG_EVALUATE("ret3", "ok", "ko"));
}
void func2()
{
const char *s;
DBUG_ENTER("func2");
s=func3();
DBUG_PRINT("info", ("s=%s", s));
DBUG_VOID_RETURN;
}
int func1()
{
DBUG_ENTER("func1");
func2();
if (push1)
{
DBUG_PUSH(push1);
fprintf(DBUG_FILE, "=> push1\n");
}
DBUG_RETURN(10);
}
int main (int argc, char *argv[])
{
int i;
#ifdef DBUG_OFF
return 1;
#endif
if (argc == 1)
return 0;
#if defined(HAVE_PTHREAD_INIT) && defined(THREAD)
pthread_init(); /* Must be called before DBUG_ENTER */
#endif
#ifdef THREAD
my_thread_global_init();
#endif
dup2(1, 2);
for (i = 1; i < argc; i++)
{
if (strncmp(argv[i], "--push1=", 8) == 0)
push1=argv[i]+8;
else
DBUG_PUSH (argv[i]);
}
{
DBUG_ENTER ("main");
DBUG_PROCESS ("dbug-tests");
func1();
DBUG_EXECUTE_IF("dump",
{
char s[1000];
DBUG_EXPLAIN(s, sizeof(s)-1);
DBUG_DUMP("dump", (uchar*)s, strlen(s));
});
DBUG_EXECUTE_IF("push", DBUG_PUSH("+t"); );
DBUG_EXECUTE("execute", fprintf(DBUG_FILE, "=> execute\n"); );
DBUG_EXECUTE_IF("set", DBUG_SET("+F"); );
fprintf(DBUG_FILE, "=> evaluate: %s\n",
DBUG_EVALUATE("evaluate", "ON", "OFF"));
fprintf(DBUG_FILE, "=> evaluate_if: %s\n",
DBUG_EVALUATE_IF("evaluate_if", "ON", "OFF"));
DBUG_EXECUTE_IF("pop", DBUG_POP(); );
{
char s[1000] __attribute__((unused));
DBUG_EXPLAIN(s, sizeof(s)-1);
DBUG_PRINT("explain", ("dbug explained: %s", s));
}
func2();
DBUG_RETURN (0);
}
}

View File

@ -512,7 +512,7 @@ possible since all code preceding the first call to
.B DBUG_PUSH .B DBUG_PUSH
is is
essentially invisible to essentially invisible to
.B dbug .I dbug
(this can be worked around by (this can be worked around by
inserting a temporary inserting a temporary
.B DBUG_PUSH(argv[1]) .B DBUG_PUSH(argv[1])
@ -708,7 +708,7 @@ EX:\ \fCDBUG_PROCESS\ (argv[0]);\fR
.SP 1 .SP 1
.LI DBUG_PUSH\ .LI DBUG_PUSH\
Sets a new debugger state by pushing the current Sets a new debugger state by pushing the current
.B dbug .I dbug
state onto an internal stack and setting up the new state using the state onto an internal stack and setting up the new state using the
debug control string passed as the macro argument. The most common debug control string passed as the macro argument. The most common
usage is to set the state specified by a debug control string usage is to set the state specified by a debug control string
@ -769,14 +769,14 @@ the 'd' flag. Used to conditionally execute "dangerous" actions, e.g
to crash the program testing how recovery works, or to introduce an to crash the program testing how recovery works, or to introduce an
artificial delay checking for race conditions. artificial delay checking for race conditions.
.SP 1 .SP 1
EX:\ \fCDBUG_EXECUTE_IF\ ("crashme",\ abort\ ());\fR EX:\ \fCDBUG_EXECUTE_IF\ ("crashme",\ DBUG_ABORT()\ ());\fR
.SP 1 .SP 1
.LI DBUG_EVALUATE\ .LI DBUG_EVALUATE\
The DBUG_EVALUATE macro is similar to DBUG_EXECUTE, but it can be used in The DBUG_EVALUATE macro is similar to DBUG_EXECUTE, but it can be used in
the expression context. The first argument is the debug keyword that is used to the expression context. The first argument is the debug keyword that is used to
choose whether the second (keyword is enabled) or the third (keyword is not choose whether the second (keyword is enabled) or the third (keyword is not
enabled) argument is evaluated. When enabled) argument is evaluated. When
.B dbug .I dbug
is compiled off, the third argument is evaluated. is compiled off, the third argument is evaluated.
.SP 1 .SP 1
EX:\fC EX:\fC
@ -796,7 +796,7 @@ EX:\fC
.br .br
if (prepare_transaction () || if (prepare_transaction () ||
.br .br
DBUG_EVALUATE ("crashme", (abort (), 0), 0) || DBUG_EVALUATE ("crashme", (DBUG_ABORT(), 0), 0) ||
.br .br
commit_transaction () )\fR commit_transaction () )\fR
.SP 1 .SP 1
@ -875,6 +875,12 @@ library. So there will be no need to disable asserts separately with NDEBUG.
.SP 1 .SP 1
EX:\ \fCDBUG_ASSERT(\ a\ >\ 0\ );\fR EX:\ \fCDBUG_ASSERT(\ a\ >\ 0\ );\fR
.SP 1 .SP 1
.LI DBUG_ABORT\
This macro could be used instead of abort(). It flushes DBUG_FILE stream
to ensure that no
.I dbug
output is lost and then calls abort().
.SP 1
.LI DBUG_EXPLAIN\ .LI DBUG_EXPLAIN\
Generates control string corresponding to the current debug state. Generates control string corresponding to the current debug state.
The macro takes two arguments - a buffer to store the result string The macro takes two arguments - a buffer to store the result string
@ -910,17 +916,17 @@ via the
.B DBUG_PUSH .B DBUG_PUSH
or or
.B DBUG_SET .B DBUG_SET
macros. Control string consists of colon separate flags. Colons macros. Control string consists of colon separated flags. Colons
that are part of ':\\', ':/', or '::' are not considered flag that are part of ':\\', ':/', or '::' are not considered flag
separators. A flag may take an argument or a list of arguments. separators. A flag may take an argument or a list of arguments.
If a control string starts from a '+' sign it works If a control string starts from a '+' sign it works
.I incrementally, .I incrementally,
that is, it can modify existing state without overriding it. In such a that is, it can modify existing state without overriding it. Every
string every flag may be preceded by a '+' or '-' to enable or disable flag may be preceded by a '+' or '-' to enable or disable a
a corresponding option in the debugger state. This section summarizes corresponding option in the debugger state or to add or remove
the currently available debugger options and the flag characters which arguments to the list. This section summarizes the currently available
enable or disable them. Argument lists enclosed in '[' and ']' are debugger options and the flag characters which enable or disable them.
optional. Argument lists enclosed in '[' and ']' are optional.
.SP 2 .SP 2
.BL 22 .BL 22
.LI a[,file] .LI a[,file]
@ -936,6 +942,9 @@ a complete log file in case of crashes. This mode is implicit in
multi-threaded environment. multi-threaded environment.
.LI d[,keywords] .LI d[,keywords]
Enable output from macros with specified keywords. Enable output from macros with specified keywords.
Every keyword can be a
.I glob(7)
pattern.
An empty list of keywords implies that all keywords are selected. An empty list of keywords implies that all keywords are selected.
.LI D[,time] .LI D[,time]
Delay for specified time after each output line, to let output drain. Delay for specified time after each output line, to let output drain.
@ -943,7 +952,19 @@ Time is given in tenths of a second (value of 10 is one second).
Default is zero. Default is zero.
.LI f[,functions] .LI f[,functions]
Limit debugger actions to the specified list of functions. Limit debugger actions to the specified list of functions.
Every function can be a
.I glob(7)
pattern.
An empty list of functions implies that all functions are selected. An empty list of functions implies that all functions are selected.
Every function in the list may optionally be followed by a '/' -
this will implicitly select all the functions down the call stack.
.SP 1
EX: \fCf,func1,func2/:-f,func3,func4/\fR
.SP 1
This would enable debugger in functions 'func1()', 'func2()' and all
functions called from it (directly or indirectly). But not in
functions 'func3()' or 'func4()' and all functions called from
it.
.LI F .LI F
Mark each debugger output line with the name of the source file Mark each debugger output line with the name of the source file
containing the macro causing the output. containing the macro causing the output.
@ -952,6 +973,9 @@ Mark each debugger output line with the PID (or thread ID) of the
current process. current process.
.LI g,[functions] .LI g,[functions]
Enable profiling for the specified list of functions. Enable profiling for the specified list of functions.
Every function can be a
.I glob(7)
pattern.
An empty list of functions enables profiling for all functions. An empty list of functions enables profiling for all functions.
See See
.B PROFILING\ WITH\ DBUG .B PROFILING\ WITH\ DBUG
@ -970,7 +994,11 @@ Like 'a[,file]' but overwrite old file, do not append.
.LI O[,file] .LI O[,file]
Like 'A[,file]' but overwrite old file, do not append. Like 'A[,file]' but overwrite old file, do not append.
.LI p[,processes] .LI p[,processes]
Limit debugger actions to the specified processes. An empty list Limit debugger actions to the specified processes.
Every name can be a
.I glob(7)
pattern.
An empty list
implies all processes. This is useful for processes which run child implies all processes. This is useful for processes which run child
processes. Note that each debugger output line can be marked with the processes. Note that each debugger output line can be marked with the
name of the current process via the 'P' flag. The process name must name of the current process via the 'P' flag. The process name must

View File

@ -1,139 +0,0 @@
/******************************************************************************
* *
* N O T I C E *
* *
* Copyright Abandoned, 1987, Fred Fish *
* *
* *
* This previously copyrighted work has been placed into the public *
* domain by the author and may be freely used for any purpose, *
* private or commercial. *
* *
* Because of the number of inquiries I was receiving about the use *
* of this product in commercially developed works I have decided to *
* simply make it public domain to further its unrestricted use. I *
* specifically would be most happy to see this material become a *
* part of the standard Unix distributions by AT&T and the Berkeley *
* Computer Science Research Group, and a standard part of the GNU *
* system from the Free Software Foundation. *
* *
* I would appreciate it, as a courtesy, if this notice is left in *
* all copies and derivative works. Thank you. *
* *
* The author makes no warranty of any kind with respect to this *
* product and explicitly disclaims any implied warranties of mer- *
* chantability or fitness for any particular purpose. *
* *
******************************************************************************
*/
/*
* FILE
*
* vargs.h include file for environments without varargs.h
*
* SCCS
*
* @(#)vargs.h 1.2 5/8/88
*
* SYNOPSIS
*
* #include "vargs.h"
*
* DESCRIPTION
*
* This file implements a varargs macro set for use in those
* environments where there is no system supplied varargs. This
* generally works because systems which don't supply a varargs
* package are precisely those which don't strictly need a varargs
* package. Using this one then allows us to minimize source
* code changes. So in some sense, this is a "portable" varargs
* since it is only used for convenience, when it is not strictly
* needed.
*
*/
/*
* These macros allow us to rebuild an argument list on the stack
* given only a va_list. We can use these to fake a function like
* vfprintf, which gets a fixed number of arguments, the last of
* which is a va_list, by rebuilding a stack and calling the variable
* argument form fprintf. Of course this only works when vfprintf
* is not available in the host environment, and thus is not available
* for fprintf to call (which would give us an infinite loop).
*
* Note that ARGS_TYPE is a long, which lets us get several bytes
* at a time while also preventing lots of "possible pointer alignment
* problem" messages from lint. The messages are valid, because this
* IS nonportable, but then we should only be using it in very
* nonrestrictive environments, and using the real varargs where it
* really counts.
*
*/
#define ARG0 a0
#define ARG1 a1
#define ARG2 a2
#define ARG3 a3
#define ARG4 a4
#define ARG5 a5
#define ARG6 a6
#define ARG7 a7
#define ARG8 a8
#define ARG9 a9
#define ARGS_TYPE long
#define ARGS_LIST ARG0,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8,ARG9
#define ARGS_DCL auto ARGS_TYPE ARGS_LIST
/*
* A pointer of type "va_list" points to a section of memory
* containing an array of variable sized arguments of unknown
* number. This pointer is initialized by the va_start
* macro to point to the first byte of the first argument.
* We can then use it to walk through the argument list by
* incrementing it by the size of the argument being referenced.
*/
typedef char *va_list;
/*
* The first variable argument overlays va_alist, which is
* nothing more than a "handle" which allows us to get the
* address of the first argument on the stack. Note that
* by definition, the va_dcl macro includes the terminating
* semicolon, which makes use of va_dcl in the source code
* appear to be missing a semicolon.
*/
#define va_dcl ARGS_TYPE va_alist;
/*
* The va_start macro takes a variable of type "va_list" and
* initializes it. In our case, it initializes a local variable
* of type "pointer to char" to point to the first argument on
* the stack.
*/
#define va_start(list) list = (char *) &va_alist
/*
* The va_end macro is a null operation for our use.
*/
#define va_end(list)
/*
* The va_arg macro is the tricky one. This one takes
* a va_list as the first argument, and a type as the second
* argument, and returns a value of the appropriate type
* while advancing the va_list to the following argument.
* For our case, we first increment the va_list arg by the
* size of the type being recovered, cast the result to
* a pointer of the appropriate type, and then dereference
* that pointer as an array to get the previous arg (which
* is the one we wanted.
*/
#define va_arg(list,type) ((type *) (list += sizeof (type)))[-1]

View File

@ -14,13 +14,11 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake") INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_EXECUTABLE(comp_err comp_err.c) ADD_EXECUTABLE(comp_err comp_err.c)
TARGET_LINK_LIBRARIES(comp_err debug dbug mysys strings zlib wsock32) TARGET_LINK_LIBRARIES(comp_err dbug mysys strings zlib)
GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION) GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION)
@ -31,24 +29,24 @@ ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_error.h
--header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h --header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h
--name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h --name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
--state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h --state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h
--in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt
DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt) DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt)
ADD_CUSTOM_TARGET(GenError ADD_CUSTOM_TARGET(GenError
ALL ALL
DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_error.h) DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_error.h)
ADD_EXECUTABLE(my_print_defaults my_print_defaults.c) ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
TARGET_LINK_LIBRARIES(my_print_defaults strings mysys debug dbug taocrypt wsock32) TARGET_LINK_LIBRARIES(my_print_defaults strings mysys dbug taocrypt)
ADD_EXECUTABLE(perror perror.c) ADD_EXECUTABLE(perror perror.c)
TARGET_LINK_LIBRARIES(perror strings mysys debug dbug wsock32) TARGET_LINK_LIBRARIES(perror strings mysys dbug)
ADD_EXECUTABLE(resolveip resolveip.c) ADD_EXECUTABLE(resolveip resolveip.c)
TARGET_LINK_LIBRARIES(resolveip strings mysys debug dbug wsock32) TARGET_LINK_LIBRARIES(resolveip strings mysys dbug)
ADD_EXECUTABLE(replace replace.c) ADD_EXECUTABLE(replace replace.c)
TARGET_LINK_LIBRARIES(replace strings mysys debug dbug wsock32) TARGET_LINK_LIBRARIES(replace strings mysys dbug)
IF(EMBED_MANIFESTS) IF(EMBED_MANIFESTS)
MYSQL_EMBED_MANIFEST("myTest" "asInvoker") MYSQL_EMBED_MANIFEST("myTest" "asInvoker")

View File

@ -30,7 +30,7 @@ DIST_SUBDIRS = yassl
# NOTE Built files should depend on their sources to avoid # NOTE Built files should depend on their sources to avoid
# the built files being rebuilt in source dist # the built files being rebuilt in source dist
$(top_builddir)/include/mysqld_error.h: comp_err.c \ $(top_builddir)/include/mysqld_error.h: comp_err.c \
$(top_srcdir)/sql/share/errmsg.txt $(top_srcdir)/sql/share/errmsg-utf8.txt
$(MAKE) $(AM_MAKEFLAGS) comp_err$(EXEEXT) $(MAKE) $(AM_MAKEFLAGS) comp_err$(EXEEXT)
$(top_builddir)/extra/comp_err$(EXEEXT) \ $(top_builddir)/extra/comp_err$(EXEEXT) \
--charset=$(top_srcdir)/sql/share/charsets \ --charset=$(top_srcdir)/sql/share/charsets \
@ -38,7 +38,7 @@ $(top_builddir)/include/mysqld_error.h: comp_err.c \
--header_file=$(top_builddir)/include/mysqld_error.h \ --header_file=$(top_builddir)/include/mysqld_error.h \
--name_file=$(top_builddir)/include/mysqld_ername.h \ --name_file=$(top_builddir)/include/mysqld_ername.h \
--state_file=$(top_builddir)/include/sql_state.h \ --state_file=$(top_builddir)/include/sql_state.h \
--in_file=$(top_srcdir)/sql/share/errmsg.txt --in_file=$(top_srcdir)/sql/share/errmsg-utf8.txt
$(top_builddir)/include/mysqld_ername.h: $(top_builddir)/include/mysqld_error.h $(top_builddir)/include/mysqld_ername.h: $(top_builddir)/include/mysqld_error.h
$(top_builddir)/include/sql_state.h: $(top_builddir)/include/mysqld_error.h $(top_builddir)/include/sql_state.h: $(top_builddir)/include/mysqld_error.h

View File

@ -39,7 +39,7 @@ static char *OUTFILE= (char*) "errmsg.sys";
static char *HEADERFILE= (char*) "mysqld_error.h"; static char *HEADERFILE= (char*) "mysqld_error.h";
static char *NAMEFILE= (char*) "mysqld_ername.h"; static char *NAMEFILE= (char*) "mysqld_ername.h";
static char *STATEFILE= (char*) "sql_state.h"; static char *STATEFILE= (char*) "sql_state.h";
static char *TXTFILE= (char*) "../sql/share/errmsg.txt"; static char *TXTFILE= (char*) "../sql/share/errmsg-utf8.txt";
static char *DATADIRECTORY= (char*) "../sql/share/"; static char *DATADIRECTORY= (char*) "../sql/share/";
#ifndef DBUG_OFF #ifndef DBUG_OFF
static char *default_dbug_option= (char*) "d:t:O,/tmp/comp_err.trace"; static char *default_dbug_option= (char*) "d:t:O,/tmp/comp_err.trace";

View File

@ -192,7 +192,8 @@ int main(int argc, char **argv)
} }
for (argument= arguments+1 ; *argument ; argument++) for (argument= arguments+1 ; *argument ; argument++)
puts(*argument); if (*argument != args_separator) /* skip arguments separator */
puts(*argument);
my_free((char*) load_default_groups,MYF(0)); my_free((char*) load_default_groups,MYF(0));
free_defaults(arguments); free_defaults(arguments);

View File

@ -21,7 +21,8 @@ HEADERS_GEN_MAKE = my_config.h
HEADERS_ABI = mysql.h mysql_com.h mysql_time.h \ HEADERS_ABI = mysql.h mysql_com.h mysql_time.h \
my_list.h my_alloc.h typelib.h mysql/plugin.h my_list.h my_alloc.h typelib.h mysql/plugin.h
pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \ pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \
my_xml.h mysql_embed.h \ my_xml.h mysql_embed.h mysql/services.h \
mysql/service_my_snprintf.h mysql/service_thd_alloc.h \
my_pthread.h my_no_pthread.h \ my_pthread.h my_no_pthread.h \
decimal.h errmsg.h my_global.h my_net.h \ decimal.h errmsg.h my_global.h my_net.h \
my_getopt.h sslopt-longopts.h my_dir.h \ my_getopt.h sslopt-longopts.h my_dir.h \
@ -36,7 +37,7 @@ noinst_HEADERS = config-win.h config-netware.h my_bit.h \
my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \ my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \
my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \ my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \
thr_lock.h t_ctype.h violite.h my_md5.h base64.h \ thr_lock.h t_ctype.h violite.h my_md5.h base64.h \
my_handler.h my_time.h \ my_handler.h my_time.h service_versions.h \
my_vle.h my_user.h my_atomic.h atomic/nolock.h \ my_vle.h my_user.h my_atomic.h atomic/nolock.h \
atomic/rwlock.h atomic/x86-gcc.h atomic/x86-msvc.h \ atomic/rwlock.h atomic/x86-gcc.h atomic/x86-msvc.h \
atomic/solaris.h \ atomic/solaris.h \

View File

@ -1,3 +1,6 @@
#ifndef ATOMIC_GCC_BUILTINS_INCLUDED
#define ATOMIC_GCC_BUILTINS_INCLUDED
/* Copyright (C) 2008 MySQL AB /* Copyright (C) 2008 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
@ -31,3 +34,5 @@
#define make_atomic_store_body(S) \ #define make_atomic_store_body(S) \
(void) __sync_lock_test_and_set(a, v); (void) __sync_lock_test_and_set(a, v);
#endif #endif
#endif /* ATOMIC_GCC_BUILTINS_INCLUDED */

View File

@ -1,3 +1,6 @@
#ifndef ATOMIC_NOLOCK_INCLUDED
#define ATOMIC_NOLOCK_INCLUDED
/* Copyright (C) 2006 MySQL AB /* Copyright (C) 2006 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
@ -59,3 +62,4 @@ typedef struct { } my_atomic_rwlock_t;
#endif #endif
#endif /* ATOMIC_NOLOCK_INCLUDED */

View File

@ -1,3 +1,6 @@
#ifndef ATOMIC_RWLOCK_INCLUDED
#define ATOMIC_RWLOCK_INCLUDED
/* Copyright (C) 2006 MySQL AB /* Copyright (C) 2006 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
@ -46,3 +49,4 @@ typedef struct {pthread_rwlock_t rw;} my_atomic_rwlock_t;
#define make_atomic_load_body(S) ret= *a; #define make_atomic_load_body(S) ret= *a;
#define make_atomic_store_body(S) *a= v; #define make_atomic_store_body(S) *a= v;
#endif /* ATOMIC_RWLOCK_INCLUDED */

View File

@ -1,3 +1,6 @@
#ifndef ATOMIC_X86_GCC_INCLUDED
#define ATOMIC_X86_GCC_INCLUDED
/* Copyright (C) 2006 MySQL AB /* Copyright (C) 2006 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
@ -56,3 +59,4 @@
asm volatile ("; xchg %0, %1;" : "+m" (*a) : "r" (v)) asm volatile ("; xchg %0, %1;" : "+m" (*a) : "r" (v))
#endif #endif
#endif /* ATOMIC_X86_GCC_INCLUDED */

View File

@ -1,3 +1,6 @@
#ifndef CONFIG_WIN_INCLUDED
#define CONFIG_WIN_INCLUDED
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. /* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
@ -27,6 +30,9 @@
#include <fcntl.h> #include <fcntl.h>
#include <io.h> #include <io.h>
#include <malloc.h> #include <malloc.h>
#include <sys/stat.h>
#include <process.h> /* getpid()*/
#define HAVE_SMEM 1 #define HAVE_SMEM 1
@ -65,7 +71,6 @@
#endif #endif
/* File and lock constants */ /* File and lock constants */
#define O_SHARE 0x1000 /* Open file in sharing mode */
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#define F_RDLCK LK_NBLCK /* read lock */ #define F_RDLCK LK_NBLCK /* read lock */
#define F_WRLCK LK_NBRLCK /* write lock */ #define F_WRLCK LK_NBRLCK /* write lock */
@ -175,7 +180,7 @@ typedef uint rf_SetTimer;
#define SIZEOF_CHARP 4 #define SIZEOF_CHARP 4
#endif #endif
#define HAVE_BROKEN_NETINET_INCLUDES #define HAVE_BROKEN_NETINET_INCLUDES
#ifdef __NT__ #ifdef _WIN32
#define HAVE_NAMED_PIPE /* We can only create pipes on NT */ #define HAVE_NAMED_PIPE /* We can only create pipes on NT */
#endif #endif
@ -288,11 +293,6 @@ inline ulonglong double2ulonglong(double d)
#define strcasecmp stricmp #define strcasecmp stricmp
#define strncasecmp strnicmp #define strncasecmp strnicmp
#ifndef __NT__
#undef FILE_SHARE_DELETE
#define FILE_SHARE_DELETE 0 /* Not implemented on Win 98/ME */
#endif
#ifdef NOT_USED #ifdef NOT_USED
#define HAVE_SNPRINTF /* Gave link error */ #define HAVE_SNPRINTF /* Gave link error */
#define _snprintf snprintf #define _snprintf snprintf
@ -336,13 +336,13 @@ inline ulonglong double2ulonglong(double d)
#define FN_DEVCHAR ':' #define FN_DEVCHAR ':'
#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */ #define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */
#define FN_NO_CASE_SENCE /* Files are not case-sensitive */ #define FN_NO_CASE_SENCE /* Files are not case-sensitive */
#define OS_FILE_LIMIT 2048 #define OS_FILE_LIMIT UINT_MAX /* No limit*/
#define DO_NOT_REMOVE_THREAD_WRAPPERS #define DO_NOT_REMOVE_THREAD_WRAPPERS
#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V)) #define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
#define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V)) #define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V))
/* The following is only used for statistics, so it should be good enough */ /* The following is only used for statistics, so it should be good enough */
#ifdef __NT__ /* This should also work on Win98 but .. */ #ifdef _WIN32
#define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C)) #define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C))
#define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C)) #define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C))
#endif #endif
@ -356,7 +356,6 @@ inline ulonglong double2ulonglong(double d)
#define HAVE_OPENSSL 1 #define HAVE_OPENSSL 1
#define HAVE_YASSL 1 #define HAVE_YASSL 1
#define COMMUNITY_SERVER 1
#define ENABLED_PROFILING 1 #define ENABLED_PROFILING 1
/* /*
@ -410,3 +409,5 @@ inline ulonglong double2ulonglong(double d)
#define HAVE_UCA_COLLATIONS 1 #define HAVE_UCA_COLLATIONS 1
#define HAVE_BOOL 1 #define HAVE_BOOL 1
#endif /* CONFIG_WIN_INCLUDED */

View File

@ -1,3 +1,6 @@
#ifndef ERRMSG_INCLUDED
#define ERRMSG_INCLUDED
/* Copyright (C) 2000 MySQL 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
@ -97,6 +100,8 @@ extern const char *client_errors[]; /* Error messages */
#define CR_SERVER_LOST_EXTENDED 2055 #define CR_SERVER_LOST_EXTENDED 2055
#define CR_STMT_CLOSED 2056 #define CR_STMT_CLOSED 2056
#define CR_NEW_STMT_METADATA 2057 #define CR_NEW_STMT_METADATA 2057
#define CR_ERROR_LAST /*Copy last error nr:*/ 2057 #define CR_ALREADY_CONNECTED 2058
#define CR_ERROR_LAST /*Copy last error nr:*/ 2058
/* Add error numbers before CR_ERROR_LAST and change it accordingly. */ /* Add error numbers before CR_ERROR_LAST and change it accordingly. */
#endif /* ERRMSG_INCLUDED */

View File

@ -21,40 +21,6 @@
extern "C" { extern "C" {
#endif #endif
/*
There was a problem on MacOSX with a shared object ha_example.so.
It used hash_search(). During build of ha_example.so no libmysys
was specified. Since MacOSX had a hash_search() in the system
library, it built the shared object so that the dynamic linker
linked hash_search() to the system library, which caused a crash
when called. To come around this, we renamed hash_search() to
my_hash_search(), as we did long ago with hash_insert() and
hash_reset(). However, this time we made the move complete with
all names. To keep compatibility, we redefine the old names.
Since every C and C++ file, that uses HASH, needs to include
this file, the change is complete. Both names could be used
in the code, but the my_* versions are recommended now.
*/
#define hash_get_key my_hash_get_key
#define hash_free_key my_hash_free_key
#define hash_init my_hash_init
#define hash_init2 my_hash_init2
#define _hash_init _my_hash_init
#define hash_free my_hash_free
#define hash_reset my_hash_reset
#define hash_element my_hash_element
#define hash_search my_hash_search
#define hash_first my_hash_first
#define hash_next my_hash_next
#define hash_insert my_hash_insert
#define hash_delete my_hash_delete
#define hash_update my_hash_update
#define hash_replace my_hash_replace
#define hash_check my_hash_check
#define hash_clear my_hash_clear
#define hash_inited my_hash_inited
#define hash_init_opt my_hash_init_opt
/* /*
Overhead to store an element in hash Overhead to store an element in hash
Can be used to approximate memory consumption for a hash Can be used to approximate memory consumption for a hash

View File

@ -1,3 +1,6 @@
#ifndef HELP_END_INCLUDED
#define HELP_END_INCLUDED
/* Copyright (C) 2004-2005 MySQL AB /* Copyright (C) 2004-2005 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
@ -20,3 +23,4 @@
#undef fputc #undef fputc
#undef putchar #undef putchar
#endif #endif
#endif /* HELP_END_INCLUDED */

View File

@ -1,3 +1,6 @@
#ifndef HELP_START_INCLUDED
#define HELP_START_INCLUDED
/* Copyright (C) 2004-2005 MySQL AB /* Copyright (C) 2004-2005 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
@ -22,3 +25,4 @@
#define fputc(s,f) consoleprintf("%c", s) #define fputc(s,f) consoleprintf("%c", s)
#define putchar(s) consoleprintf("%c", s) #define putchar(s) consoleprintf("%c", s)
#endif #endif
#endif /* HELP_START_INCLUDED */

View File

@ -87,6 +87,7 @@ extern MY_UNI_CTYPE my_uni_ctype[256];
#define MY_CS_CSSORT 1024 /* if case sensitive sort order */ #define MY_CS_CSSORT 1024 /* if case sensitive sort order */
#define MY_CS_HIDDEN 2048 /* don't display in SHOW */ #define MY_CS_HIDDEN 2048 /* don't display in SHOW */
#define MY_CS_PUREASCII 4096 /* if a charset is pure ascii */ #define MY_CS_PUREASCII 4096 /* if a charset is pure ascii */
#define MY_CS_NONASCII 8192 /* if not ASCII-compatible */
#define MY_CHARSET_UNDEFINED 0 #define MY_CHARSET_UNDEFINED 0
/* Character repertoire flags */ /* Character repertoire flags */
@ -474,6 +475,10 @@ my_bool my_charset_is_ascii_based(CHARSET_INFO *cs);
my_bool my_charset_is_8bit_pure_ascii(CHARSET_INFO *cs); my_bool my_charset_is_8bit_pure_ascii(CHARSET_INFO *cs);
uint my_charset_repertoire(CHARSET_INFO *cs); uint my_charset_repertoire(CHARSET_INFO *cs);
my_bool my_charset_is_ascii_compatible(CHARSET_INFO *cs);
extern size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n,
const char* fmt, va_list ap);
#define _MY_U 01 /* Upper case */ #define _MY_U 01 /* Upper case */
#define _MY_L 02 /* Lower case */ #define _MY_L 02 /* Lower case */

View File

@ -250,16 +250,10 @@ extern size_t my_snprintf(char *to, size_t n, const char *fmt, ...)
/* /*
LEX_STRING -- a pair of a C-string and its length. LEX_STRING -- a pair of a C-string and its length.
(it's part of the plugin API as a MYSQL_LEX_STRING)
*/ */
#ifndef _my_plugin_h #include <mysql/plugin.h>
/* This definition must match the one given in mysql/plugin.h */
struct st_mysql_lex_string
{
char *str;
size_t length;
};
#endif
typedef struct st_mysql_lex_string LEX_STRING; typedef struct st_mysql_lex_string LEX_STRING;
#define STRING_WITH_LEN(X) (X), ((size_t) (sizeof(X) - 1)) #define STRING_WITH_LEN(X) (X), ((size_t) (sizeof(X) - 1))

View File

@ -1,3 +1,6 @@
#ifndef MY_AES_INCLUDED
#define MY_AES_INCLUDED
/* Copyright (C) 2002 MySQL AB /* Copyright (C) 2002 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
@ -63,3 +66,5 @@ int my_aes_decrypt(const char *source, int source_length, char *dest,
int my_aes_get_size(int source_length); int my_aes_get_size(int source_length);
C_MODE_END C_MODE_END
#endif /* MY_AES_INCLUDED */

View File

@ -1,3 +1,6 @@
#ifndef MY_ATOMIC_INCLUDED
#define MY_ATOMIC_INCLUDED
/* Copyright (C) 2006 MySQL AB /* Copyright (C) 2006 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
@ -150,3 +153,4 @@ extern int my_atomic_initialize();
#endif #endif
#endif /* MY_ATOMIC_INCLUDED */

View File

@ -255,7 +255,17 @@ enum ha_base_keytype {
HA_BINARY_PACK_KEY | HA_FULLTEXT | HA_UNIQUE_CHECK | \ HA_BINARY_PACK_KEY | HA_FULLTEXT | HA_UNIQUE_CHECK | \
HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY) HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY)
#define HA_KEY_HAS_PART_KEY_SEG 65536 /* Key contains partial segments */ /*
Key contains partial segments.
This flag is internal to the MySQL server by design. It is not supposed
neither to be saved in FRM-files, nor to be passed to storage engines.
It is intended to pass information into internal static sort_keys(KEY *,
KEY *) function.
This flag can be calculated -- it's based on key lengths comparison.
*/
#define HA_KEY_HAS_PART_KEY_SEG 65536
/* Automatic bits in key-flag */ /* Automatic bits in key-flag */

View File

@ -1,3 +1,6 @@
#ifndef MY_BIT_INCLUDED
#define MY_BIT_INCLUDED
/* /*
Some useful bit functions Some useful bit functions
*/ */
@ -107,3 +110,5 @@ extern uint my_count_bits(ulonglong v);
extern uint my_count_bits_ushort(ushort v); extern uint my_count_bits_ushort(ushort v);
#endif /* HAVE_INLINE */ #endif /* HAVE_INLINE */
C_MODE_END C_MODE_END
#endif /* MY_BIT_INCLUDED */

View File

@ -16,101 +16,64 @@
#ifndef _dbug_h #ifndef _dbug_h
#define _dbug_h #define _dbug_h
#if defined(__cplusplus) && !defined(DBUG_OFF) #ifdef __cplusplus
class Dbug_violation_helper
{
public:
inline Dbug_violation_helper() :
_entered(TRUE)
{ }
inline ~Dbug_violation_helper()
{
assert(!_entered);
}
inline void leave()
{
_entered= FALSE;
}
private:
bool _entered;
};
#endif /* C++ */
#ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#if !defined(DBUG_OFF) && !defined(_lint) #if !defined(DBUG_OFF) && !defined(_lint)
struct _db_code_state_;
extern int _db_keyword_(struct _db_code_state_ *cs, const char *keyword); struct _db_stack_frame_ {
extern int _db_strict_keyword_(const char *keyword); const char *func; /* function name of the previous stack frame */
const char *file; /* filename of the function of previous frame */
uint level; /* this nesting level, highest bit enables tracing */
struct _db_stack_frame_ *prev; /* pointer to the previous frame */
};
struct _db_code_state_;
extern my_bool _dbug_on_;
extern my_bool _db_keyword_(struct _db_code_state_ *, const char *, int);
extern int _db_explain_(struct _db_code_state_ *cs, char *buf, size_t len); extern int _db_explain_(struct _db_code_state_ *cs, char *buf, size_t len);
extern int _db_explain_init_(char *buf, size_t len); extern int _db_explain_init_(char *buf, size_t len);
extern void _db_setjmp_(void); extern int _db_is_pushed_(void);
extern void _db_longjmp_(void); extern void _db_setjmp_(void);
extern void _db_longjmp_(void);
extern void _db_process_(const char *name); extern void _db_process_(const char *name);
extern void _db_push_(const char *control); extern void _db_push_(const char *control);
extern void _db_pop_(void); extern void _db_pop_(void);
extern void _db_set_(struct _db_code_state_ *cs, const char *control); extern void _db_set_(const char *control);
extern void _db_set_init_(const char *control); extern void _db_set_init_(const char *control);
extern void _db_enter_(const char *_func_,const char *_file_,uint _line_, extern void _db_enter_(const char *_func_, const char *_file_, uint _line_,
const char **_sfunc_,const char **_sfile_, struct _db_stack_frame_ *_stack_frame_);
uint *_slevel_, char ***); extern void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_);
extern void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_, extern void _db_pargs_(uint _line_,const char *keyword);
uint *_slevel_); extern void _db_doprnt_ _VARARGS((const char *format,...))
extern void _db_pargs_(uint _line_,const char *keyword);
extern void _db_doprnt_ _VARARGS((const char *format,...))
ATTRIBUTE_FORMAT(printf, 1, 2); ATTRIBUTE_FORMAT(printf, 1, 2);
extern void _db_dump_(uint _line_,const char *keyword, extern void _db_dump_(uint _line_,const char *keyword,
const unsigned char *memory, size_t length); const unsigned char *memory, size_t length);
extern void _db_end_(void); extern void _db_end_(void);
extern void _db_lock_file_(void); extern void _db_lock_file_(void);
extern void _db_unlock_file_(void); extern void _db_unlock_file_(void);
extern FILE *_db_fp_(void); extern FILE *_db_fp_(void);
extern void _db_flush_();
extern const char* _db_get_func_(void);
#ifdef __cplusplus #define DBUG_ENTER(a) struct _db_stack_frame_ _db_stack_frame_; \
_db_enter_ (a,__FILE__,__LINE__,&_db_stack_frame_)
#define DBUG_ENTER(a) \ #define DBUG_LEAVE _db_return_ (__LINE__, &_db_stack_frame_)
const char *_db_func_, *_db_file_; \
uint _db_level_; \
char **_db_framep_; \
Dbug_violation_helper dbug_violation_helper; \
_db_enter_ (a, __FILE__, __LINE__, &_db_func_, &_db_file_, \
&_db_level_, &_db_framep_)
#define DBUG_VIOLATION_HELPER_LEAVE dbug_violation_helper.leave()
#else /* C */
#define DBUG_ENTER(a) \
const char *_db_func_, *_db_file_; \
uint _db_level_; \
char **_db_framep_; \
_db_enter_ (a, __FILE__, __LINE__, &_db_func_, &_db_file_, \
&_db_level_, &_db_framep_)
#define DBUG_VIOLATION_HELPER_LEAVE do { } while(0)
#endif /* C++ */
#define DBUG_LEAVE \
DBUG_VIOLATION_HELPER_LEAVE; \
_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_)
#define DBUG_RETURN(a1) do {DBUG_LEAVE; return(a1);} while(0) #define DBUG_RETURN(a1) do {DBUG_LEAVE; return(a1);} while(0)
#define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0) #define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0)
#define DBUG_EXECUTE(keyword,a1) \ #define DBUG_EXECUTE(keyword,a1) \
do {if (_db_keyword_(0, (keyword))) { a1 }} while(0) do {if (_db_keyword_(0, (keyword), 0)) { a1 }} while(0)
#define DBUG_EXECUTE_IF(keyword,a1) \ #define DBUG_EXECUTE_IF(keyword,a1) \
do {if (_db_strict_keyword_ (keyword)) { a1 } } while(0) do {if (_db_keyword_(0, (keyword), 1)) { a1 }} while(0)
#define DBUG_EVALUATE(keyword,a1,a2) \ #define DBUG_EVALUATE(keyword,a1,a2) \
(_db_keyword_(0,(keyword)) ? (a1) : (a2)) (_db_keyword_(0,(keyword), 0) ? (a1) : (a2))
#define DBUG_EVALUATE_IF(keyword,a1,a2) \ #define DBUG_EVALUATE_IF(keyword,a1,a2) \
(_db_strict_keyword_((keyword)) ? (a1) : (a2)) (_db_keyword_(0,(keyword), 1) ? (a1) : (a2))
#define DBUG_PRINT(keyword,arglist) \ #define DBUG_PRINT(keyword,arglist) \
do {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;} while(0) do {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;} while(0)
#define DBUG_PUSH(a1) _db_push_ (a1) #define DBUG_PUSH(a1) _db_push_ (a1)
#define DBUG_POP() _db_pop_ () #define DBUG_POP() _db_pop_ ()
#define DBUG_SET(a1) _db_set_ (0, (a1)) #define DBUG_SET(a1) _db_set_ (a1)
#define DBUG_SET_INITIAL(a1) _db_set_init_ (a1) #define DBUG_SET_INITIAL(a1) _db_set_init_ (a1)
#define DBUG_PROCESS(a1) _db_process_(a1) #define DBUG_PROCESS(a1) _db_process_(a1)
#define DBUG_FILE _db_fp_() #define DBUG_FILE _db_fp_()
@ -123,37 +86,66 @@ extern FILE *_db_fp_(void);
#define DBUG_ASSERT(A) assert(A) #define DBUG_ASSERT(A) assert(A)
#define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len)) #define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len))
#define DBUG_EXPLAIN_INITIAL(buf,len) _db_explain_init_((buf),(len)) #define DBUG_EXPLAIN_INITIAL(buf,len) _db_explain_init_((buf),(len))
#define IF_DBUG(A) A #define DEBUGGER_OFF do { _dbug_on_= 0; } while(0)
#else /* No debugger */ #define DEBUGGER_ON do { _dbug_on_= 1; } while(0)
#ifndef __WIN__
#define DBUG_ABORT() (_db_flush_(), abort())
#else
/*
Avoid popup with abort/retry/ignore buttons. When BUG#31745 is fixed we can
call abort() instead of _exit(3) (now it would cause a "test signal" popup).
*/
#include <crtdbg.h>
#define DBUG_ABORT() (_db_flush_(),\
(void)_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE),\
(void)_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR),\
_exit(3))
#endif
#define DBUG_CHECK_CRASH(func, op) \
do { char _dbuf_[255]; strxnmov(_dbuf_, sizeof(_dbuf_)-1, (func), (op)); \
DBUG_EXECUTE_IF(_dbuf_, DBUG_ABORT()); } while(0)
#define DBUG_CRASH_ENTER(func) \
DBUG_ENTER(func); DBUG_CHECK_CRASH(func, "_crash_enter")
#define DBUG_CRASH_RETURN(val) \
DBUG_CHECK_CRASH(_db_get_func_(), "_crash_return")
#define DBUG_CRASH_VOID_RETURN \
DBUG_CHECK_CRASH (_db_get_func_(), "_crash_return")
#else /* No debugger */
#define DBUG_ENTER(a1) #define DBUG_ENTER(a1)
#define DBUG_LEAVE #define DBUG_LEAVE
#define DBUG_VIOLATION_HELPER_LEAVE #define DBUG_RETURN(a1) do { return(a1); } while(0)
#define DBUG_RETURN(a1) do { return(a1); } while(0) #define DBUG_VOID_RETURN do { return; } while(0)
#define DBUG_VOID_RETURN do { return; } while(0) #define DBUG_EXECUTE(keyword,a1) do { } while(0)
#define DBUG_EXECUTE(keyword,a1) do { } while(0) #define DBUG_EXECUTE_IF(keyword,a1) do { } while(0)
#define DBUG_EXECUTE_IF(keyword,a1) do { } while(0)
#define DBUG_EVALUATE(keyword,a1,a2) (a2) #define DBUG_EVALUATE(keyword,a1,a2) (a2)
#define DBUG_EVALUATE_IF(keyword,a1,a2) (a2) #define DBUG_EVALUATE_IF(keyword,a1,a2) (a2)
#define DBUG_PRINT(keyword,arglist) do { } while(0) #define DBUG_PRINT(keyword,arglist) do { } while(0)
#define DBUG_PUSH(a1) #define DBUG_PUSH(a1) do { } while(0)
#define DBUG_SET(a1) do { } while(0) #define DBUG_SET(a1) do { } while(0)
#define DBUG_SET_INITIAL(a1) do { } while(0) #define DBUG_SET_INITIAL(a1) do { } while(0)
#define DBUG_POP() #define DBUG_POP() do { } while(0)
#define DBUG_PROCESS(a1) #define DBUG_PROCESS(a1) do { } while(0)
#define DBUG_SETJMP(a1) setjmp(a1) #define DBUG_SETJMP(a1) setjmp(a1)
#define DBUG_LONGJMP(a1) longjmp(a1) #define DBUG_LONGJMP(a1) longjmp(a1)
#define DBUG_DUMP(keyword,a1,a2) do { } while(0) #define DBUG_DUMP(keyword,a1,a2) do { } while(0)
#define DBUG_END() #define DBUG_END() do { } while(0)
#define DBUG_ASSERT(A) do { } while(0) #define DBUG_ASSERT(A) do { } while(0)
#define DBUG_LOCK_FILE #define DBUG_LOCK_FILE do { } while(0)
#define DBUG_FILE (stderr) #define DBUG_FILE (stderr)
#define DBUG_UNLOCK_FILE #define DBUG_UNLOCK_FILE do { } while(0)
#define DBUG_EXPLAIN(buf,len) #define DBUG_EXPLAIN(buf,len)
#define DBUG_EXPLAIN_INITIAL(buf,len) #define DBUG_EXPLAIN_INITIAL(buf,len)
#define IF_DBUG(A) #define DEBUGGER_OFF do { } while(0)
#define DEBUGGER_ON do { } while(0)
#define DBUG_ABORT() abort()
#define DBUG_CRASH_ENTER(func)
#define DBUG_CRASH_RETURN(val) do { return(val); } while(0)
#define DBUG_CRASH_VOID_RETURN do { return; } while(0)
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif

View File

@ -69,7 +69,11 @@ typedef struct my_stat
#else #else
#if(_MSC_VER)
#define MY_STAT struct _stati64 /* 64 bit file size */
#else
#define MY_STAT struct stat /* Orginal struct have what we need */ #define MY_STAT struct stat /* Orginal struct have what we need */
#endif
#endif /* USE_MY_STAT_STRUCT */ #endif /* USE_MY_STAT_STRUCT */

View File

@ -410,6 +410,7 @@ C_MODE_END
#ifndef stdin #ifndef stdin
#include <stdio.h> #include <stdio.h>
#endif #endif
#include <stdarg.h>
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
@ -648,8 +649,6 @@ C_MODE_END
# endif # endif
#endif #endif
#include <my_dbug.h>
#define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/ #define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/
#define ASCII_BITS_USED 8 /* Bit char used */ #define ASCII_BITS_USED 8 /* Bit char used */
#define NEAR_F /* No near function handling */ #define NEAR_F /* No near function handling */
@ -749,7 +748,41 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define FN_LIBCHAR '/' #define FN_LIBCHAR '/'
#define FN_ROOTDIR "/" #define FN_ROOTDIR "/"
#endif #endif
#define MY_NFILE 64 /* This is only used to save filenames */
/*
MY_FILE_MIN is Windows speciality and is used to quickly detect
the mismatch of CRT and mysys file IO usage on Windows at runtime.
CRT file descriptors can be in the range 0-2047, whereas descriptors returned
by my_open() will start with 2048. If a file descriptor with value less then
MY_FILE_MIN is passed to mysys IO function, chances are it stemms from
open()/fileno() and not my_open()/my_fileno.
For Posix, mysys functions are light wrappers around libc, and MY_FILE_MIN
is logically 0.
*/
#ifdef _WIN32
#define MY_FILE_MIN 2048
#else
#define MY_FILE_MIN 0
#endif
/*
MY_NFILE is the default size of my_file_info array.
It is larger on Windows, because it all file handles are stored in my_file_info
Default size is 16384 and this should be enough for most cases.If it is not
enough, --max-open-files with larger value can be used.
For Posix , my_file_info array is only used to store filenames for
error reporting and its size is not a limitation for number of open files.
*/
#ifdef _WIN32
#define MY_NFILE (16384 + MY_FILE_MIN)
#else
#define MY_NFILE 64
#endif
#ifndef OS_FILE_LIMIT #ifndef OS_FILE_LIMIT
#define OS_FILE_LIMIT 65535 #define OS_FILE_LIMIT 65535
#endif #endif
@ -786,9 +819,8 @@ typedef SOCKET_SIZE_TYPE size_socket;
/* Some things that this system doesn't have */ /* Some things that this system doesn't have */
#define NO_HASH /* Not needed anymore */ #define NO_HASH /* Not needed anymore */
#ifdef __WIN__ #ifdef _WIN32
#define NO_DIR_LIBRARY /* Not standar dir-library */ #define NO_DIR_LIBRARY /* Not standard dir-library */
#define USE_MY_STAT_STRUCT /* For my_lib */
#endif #endif
/* Some defines of functions for portability */ /* Some defines of functions for portability */
@ -1143,6 +1175,8 @@ typedef char bool; /* Ordinary boolean values 0 1 */
#define reg16 register #define reg16 register
#endif #endif
#include <my_dbug.h>
/* /*
Sometimes we want to make sure that the variable is not put into Sometimes we want to make sure that the variable is not put into
a register in debugging mode so we can see its value in the core a register in debugging mode so we can see its value in the core

View File

@ -53,8 +53,8 @@ typedef struct st_HA_KEYSEG /* Key-portion */
uint16 bit_pos; /* Position to bit part */ uint16 bit_pos; /* Position to bit part */
uint16 flag; uint16 flag;
uint16 length; /* Keylength */ uint16 length; /* Keylength */
uint16 language;
uint8 type; /* Type of key (for sort) */ uint8 type; /* Type of key (for sort) */
uint8 language;
uint8 null_bit; /* bitmask to test for NULL */ uint8 null_bit; /* bitmask to test for NULL */
uint8 bit_start,bit_end; /* if bit field */ uint8 bit_start,bit_end; /* if bit field */
uint8 bit_length; /* Length of bit part */ uint8 bit_length; /* Length of bit part */

View File

@ -1,3 +1,6 @@
#ifndef MY_LIBWRAP_INCLUDED
#define MY_LIBWRAP_INCLUDED
/* Copyright (C) 2000 MySQL 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
@ -25,3 +28,4 @@ extern int my_hosts_access(struct request_info *req);
extern char *my_eval_client(struct request_info *req); extern char *my_eval_client(struct request_info *req);
#endif /* HAVE_LIBWRAP */ #endif /* HAVE_LIBWRAP */
#endif /* MY_LIBWRAP_INCLUDED */

View File

@ -1,3 +1,6 @@
#ifndef MY_MD5_INCLUDED
#define MY_MD5_INCLUDED
/* Copyright (C) 2000 MySQL 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
@ -52,3 +55,5 @@ do { \
my_MD5Update (&ctx, buf, len); \ my_MD5Update (&ctx, buf, len); \
my_MD5Final (digest, &ctx); \ my_MD5Final (digest, &ctx); \
} while (0) } while (0)
#endif /* MY_MD__INCLUDED */

View File

@ -1,3 +1,6 @@
#ifndef MY_NO_PTHREAD_INCLUDED
#define MY_NO_PTHREAD_INCLUDED
/* Copyright (C) 2000 MySQL 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
@ -14,9 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#if !defined(_my_no_pthread_h) && !defined(THREAD) #ifndef THREAD
#define _my_no_pthread_h
/* /*
This block is to access some thread-related type definitions This block is to access some thread-related type definitions
@ -48,3 +49,4 @@
#define rwlock_destroy(A) #define rwlock_destroy(A)
#endif #endif
#endif /* MY_NO_PTHREAD_INCLUDED */

View File

@ -31,7 +31,7 @@ extern "C" {
#if defined(__WIN__) #if defined(__WIN__)
typedef CRITICAL_SECTION pthread_mutex_t; typedef CRITICAL_SECTION pthread_mutex_t;
typedef HANDLE pthread_t; typedef DWORD pthread_t;
typedef struct thread_attr { typedef struct thread_attr {
DWORD dwStackSize ; DWORD dwStackSize ;
DWORD dwCreatingFlag ; DWORD dwCreatingFlag ;
@ -64,8 +64,7 @@ typedef struct {
typedef int pthread_mutexattr_t; typedef int pthread_mutexattr_t;
#define win_pthread_self my_thread_var->pthread_self #define pthread_self() GetCurrentThreadId()
#define pthread_self() win_pthread_self
#define pthread_handler_t EXTERNC void * __cdecl #define pthread_handler_t EXTERNC void * __cdecl
typedef void * (__cdecl *pthread_handler)(void *); typedef void * (__cdecl *pthread_handler)(void *);
@ -99,8 +98,7 @@ struct timespec {
(ABSTIME).max_timeout_msec= (long)((NSEC)/1000000); \ (ABSTIME).max_timeout_msec= (long)((NSEC)/1000000); \
} }
void win_pthread_init(void);
int win_pthread_setspecific(void *A,void *B,uint length);
int win_pthread_mutex_trylock(pthread_mutex_t *mutex); int win_pthread_mutex_trylock(pthread_mutex_t *mutex);
int pthread_create(pthread_t *,pthread_attr_t *,pthread_handler,void *); int pthread_create(pthread_t *,pthread_attr_t *,pthread_handler,void *);
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr); int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr);
@ -117,42 +115,25 @@ int pthread_attr_destroy(pthread_attr_t *connect_att);
struct tm *localtime_r(const time_t *timep,struct tm *tmp); struct tm *localtime_r(const time_t *timep,struct tm *tmp);
struct tm *gmtime_r(const time_t *timep,struct tm *tmp); struct tm *gmtime_r(const time_t *timep,struct tm *tmp);
void pthread_exit(void *a);
int pthread_join(pthread_t thread, void **value_ptr);
void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
#define ETIMEDOUT 145 /* Win32 doesn't have this */ #define ETIMEDOUT 145 /* Win32 doesn't have this */
#define getpid() GetCurrentThreadId()
#define HAVE_LOCALTIME_R 1 #define HAVE_LOCALTIME_R 1
#define _REENTRANT 1 #define _REENTRANT 1
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 #define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
/*
Windows has two ways to use thread local storage. The most efficient
is using __declspec(thread), but that does not work properly when
used in a .dll that is loaded at runtime, after program load. So for
libmysql.dll and libmysqld.dll we define USE_TLS in order to use the
TlsXxx() API instead, which works in all cases.
*/
#ifdef USE_TLS /* For LIBMYSQL.DLL */
#undef SAFE_MUTEX /* This will cause conflicts */ #undef SAFE_MUTEX /* This will cause conflicts */
#define pthread_key(T,V) DWORD V #define pthread_key(T,V) DWORD V
#define pthread_key_create(A,B) ((*A=TlsAlloc())==0xFFFFFFFF) #define pthread_key_create(A,B) ((*A=TlsAlloc())==0xFFFFFFFF)
#define pthread_key_delete(A) TlsFree(A) #define pthread_key_delete(A) TlsFree(A)
#define my_pthread_setspecific_ptr(T,V) (!TlsSetValue((T),(V)))
#define pthread_setspecific(A,B) (!TlsSetValue((A),(B)))
#define pthread_getspecific(A) (TlsGetValue(A)) #define pthread_getspecific(A) (TlsGetValue(A))
#define my_pthread_getspecific(T,A) ((T) TlsGetValue(A)) #define my_pthread_getspecific(T,A) ((T) TlsGetValue(A))
#define my_pthread_getspecific_ptr(T,V) ((T) TlsGetValue(V)) #define my_pthread_getspecific_ptr(T,V) ((T) TlsGetValue(V))
#define my_pthread_setspecific_ptr(T,V) (!TlsSetValue((T),(V)))
#define pthread_setspecific(A,B) (!TlsSetValue((A),(B)))
#else
#define pthread_key(T,V) __declspec(thread) T V
#define pthread_key_create(A,B) pthread_dummy(0)
#define pthread_key_delete(A) pthread_dummy(0)
#define pthread_getspecific(A) (&(A))
#define my_pthread_getspecific(T,A) (&(A))
#define my_pthread_getspecific_ptr(T,V) (V)
#define my_pthread_setspecific_ptr(T,V) ((T)=(V),0)
#define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A))
#endif /* USE_TLS */
#define pthread_equal(A,B) ((A) == (B)) #define pthread_equal(A,B) ((A) == (B))
#define pthread_mutex_init(A,B) (InitializeCriticalSection(A),0) #define pthread_mutex_init(A,B) (InitializeCriticalSection(A),0)
@ -163,7 +144,6 @@ void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
#define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B)) #define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B))
#define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH) #define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH)
#define pthread_join(A,B) (WaitForSingleObject((A), INFINITE) != WAIT_OBJECT_0)
/* Dummy defines for easier code */ /* Dummy defines for easier code */
#define pthread_attr_setdetachstate(A,B) pthread_dummy(0) #define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
@ -690,6 +670,7 @@ struct st_my_thread_var
}; };
extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const)); extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const));
extern void **my_thread_var_dbug();
extern uint my_thread_end_wait_time; extern uint my_thread_end_wait_time;
#define my_thread_var (_my_thread_var()) #define my_thread_var (_my_thread_var())
#define my_errno my_thread_var->thr_errno #define my_errno my_thread_var->thr_errno

View File

@ -39,6 +39,17 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MYSYS_PROGRAM_DONT_USE_CURSES() { error_handler_hook = my_message_no_curses; mysys_uses_curses=0;} #define MYSYS_PROGRAM_DONT_USE_CURSES() { error_handler_hook = my_message_no_curses; mysys_uses_curses=0;}
#define MY_INIT(name); { my_progname= name; my_init(); } #define MY_INIT(name); { my_progname= name; my_init(); }
/**
Max length of an error message generated by mysys utilities.
Some mysys functions produce error messages. These mostly go
to stderr.
This constant defines the size of the buffer used to format
the message. It should be kept in sync with MYSQL_ERRMSG_SIZE,
since sometimes mysys errors are stored in the server diagnostics
area, and we would like to avoid unexpected truncation.
*/
#define MYSYS_ERRMSG_SIZE (512)
#define MY_FILE_ERROR ((size_t) -1) #define MY_FILE_ERROR ((size_t) -1)
/* General bitmaps for my_func's */ /* General bitmaps for my_func's */
@ -90,8 +101,6 @@ extern int NEAR my_errno; /* Last error in mysys */
#define ME_COLOUR2 ((2 << ME_HIGHBYTE)) #define ME_COLOUR2 ((2 << ME_HIGHBYTE))
#define ME_COLOUR3 ((3 << ME_HIGHBYTE)) #define ME_COLOUR3 ((3 << ME_HIGHBYTE))
#define ME_FATALERROR 1024 /* Fatal statement error */ #define ME_FATALERROR 1024 /* Fatal statement error */
#define ME_NO_WARNING_FOR_ERROR 2048 /* Don't push a warning for error */
#define ME_NO_SP_HANDLER 4096 /* Don't call stored routine error handlers */
/* Bits in last argument to fn_format */ /* Bits in last argument to fn_format */
#define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */ #define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */
@ -220,8 +229,8 @@ extern int errno; /* declare errno */
extern char *home_dir; /* Home directory for user */ extern char *home_dir; /* Home directory for user */
extern const char *my_progname; /* program-name (printed in errors) */ extern const char *my_progname; /* program-name (printed in errors) */
extern char NEAR curr_dir[]; /* Current directory for user */ extern char NEAR curr_dir[]; /* Current directory for user */
extern int (*error_handler_hook)(uint my_err, const char *str,myf MyFlags); extern void (*error_handler_hook)(uint my_err, const char *str,myf MyFlags);
extern int (*fatal_error_handler_hook)(uint my_err, const char *str, extern void (*fatal_error_handler_hook)(uint my_err, const char *str,
myf MyFlags); myf MyFlags);
extern uint my_file_limit; extern uint my_file_limit;
extern ulong my_thread_stack_size; extern ulong my_thread_stack_size;
@ -232,8 +241,9 @@ extern uint my_large_page_size;
#endif #endif
/* charsets */ /* charsets */
#define MY_ALL_CHARSETS_SIZE 2048
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *default_charset_info; extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *default_charset_info;
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *all_charsets[256]; extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *all_charsets[MY_ALL_CHARSETS_SIZE];
extern CHARSET_INFO compiled_charsets[]; extern CHARSET_INFO compiled_charsets[];
/* statistics */ /* statistics */
@ -321,9 +331,13 @@ enum file_type
struct st_my_file_info struct st_my_file_info
{ {
char * name; char *name;
enum file_type type; #ifdef _WIN32
#if defined(THREAD) && !defined(HAVE_PREAD) HANDLE fhandle; /* win32 file handle */
int oflag; /* open flags, e.g O_APPEND */
#endif
enum file_type type;
#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32)
pthread_mutex_t mutex; pthread_mutex_t mutex;
#endif #endif
}; };
@ -628,43 +642,55 @@ extern void *my_memmem(const void *haystack, size_t haystacklen,
const void *needle, size_t needlelen); const void *needle, size_t needlelen);
#ifdef __WIN__ #ifdef _WIN32
extern int my_access(const char *path, int amode); extern int my_access(const char *path, int amode);
extern File my_sopen(const char *path, int oflag, int shflag, int pmode);
#else #else
#define my_access access #define my_access access
#endif #endif
extern int check_if_legal_filename(const char *path); extern int check_if_legal_filename(const char *path);
extern int check_if_legal_tablename(const char *path); extern int check_if_legal_tablename(const char *path);
#if defined(__WIN__) && defined(__NT__) #ifdef _WIN32
extern int nt_share_delete(const char *name,myf MyFlags); extern int nt_share_delete(const char *name,myf MyFlags);
#define my_delete_allow_opened(fname,flags) nt_share_delete((fname),(flags)) #define my_delete_allow_opened(fname,flags) nt_share_delete((fname),(flags))
#else #else
#define my_delete_allow_opened(fname,flags) my_delete((fname),(flags)) #define my_delete_allow_opened(fname,flags) my_delete((fname),(flags))
#endif #endif
#ifdef _WIN32
/* Windows-only functions (CRT equivalents)*/
extern File my_sopen(const char *path, int oflag, int shflag, int pmode);
extern HANDLE my_get_osfhandle(File fd);
extern void my_osmaperr(unsigned long last_error);
#endif
#ifndef TERMINATE #ifndef TERMINATE
extern void TERMINATE(FILE *file, uint flag); extern void TERMINATE(FILE *file, uint flag);
#endif #endif
extern void init_glob_errs(void); extern void init_glob_errs(void);
extern const char** get_global_errmsgs();
extern void wait_for_free_space(const char *filename, int errors); extern void wait_for_free_space(const char *filename, int errors);
extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags); extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags); extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
extern int my_fclose(FILE *fd,myf MyFlags); extern int my_fclose(FILE *fd,myf MyFlags);
extern File my_fileno(FILE *fd);
extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags); extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
extern int my_sync(File fd, myf my_flags); extern int my_sync(File fd, myf my_flags);
extern int my_sync_dir(const char *dir_name, myf my_flags); extern int my_sync_dir(const char *dir_name, myf my_flags);
extern int my_sync_dir_by_file(const char *file_name, myf my_flags); extern int my_sync_dir_by_file(const char *file_name, myf my_flags);
extern int my_error _VARARGS((int nr,myf MyFlags, ...)); extern void my_error _VARARGS((int nr,myf MyFlags, ...));
extern int my_printf_error _VARARGS((uint my_err, const char *format, extern void my_printf_error _VARARGS((uint my_err, const char *format,
myf MyFlags, ...)) myf MyFlags, ...))
ATTRIBUTE_FORMAT(printf, 2, 4); ATTRIBUTE_FORMAT(printf, 2, 4);
extern int my_error_register(const char **errmsgs, int first, int last); extern void my_printv_error(uint error, const char *format, myf MyFlags,
va_list ap);
extern int my_error_register(const char** (*get_errmsgs) (),
int first, int last);
extern const char **my_error_unregister(int first, int last); extern const char **my_error_unregister(int first, int last);
extern int my_message(uint my_err, const char *str,myf MyFlags); extern void my_message(uint my_err, const char *str,myf MyFlags);
extern int my_message_no_curses(uint my_err, const char *str,myf MyFlags); extern void my_message_no_curses(uint my_err, const char *str,myf MyFlags);
extern int my_message_curses(uint my_err, const char *str,myf MyFlags); extern void my_message_curses(uint my_err, const char *str,myf MyFlags);
extern my_bool my_init(void); extern my_bool my_init(void);
extern void my_end(int infoflag); extern void my_end(int infoflag);
extern int my_redel(const char *from, const char *to, int MyFlags); extern int my_redel(const char *from, const char *to, int MyFlags);
@ -853,6 +879,7 @@ extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len);
extern int get_defaults_options(int argc, char **argv, extern int get_defaults_options(int argc, char **argv,
char **defaults, char **extra_defaults, char **defaults, char **extra_defaults,
char **group_suffix); char **group_suffix);
extern const char *args_separator;
extern int my_load_defaults(const char *conf_file, const char **groups, extern int my_load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv, const char ***); int *argc, char ***argv, const char ***);
extern int load_defaults(const char *conf_file, const char **groups, extern int load_defaults(const char *conf_file, const char **groups,

View File

@ -1,3 +1,6 @@
#ifndef MY_UCTYPE_INCLUDED
#define MY_UCTYPE_INCLUDED
/* Copyright (C) 2006 MySQL AB /* Copyright (C) 2006 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
@ -1477,3 +1480,4 @@ MY_UNI_CTYPE my_uni_ctype[256]={
}; };
#endif /* MY_UCTYPE_INCLUDED */

View File

@ -162,7 +162,7 @@ typedef struct st_mi_create_info
ulonglong data_file_length; ulonglong data_file_length;
ulonglong key_file_length; ulonglong key_file_length;
uint old_options; uint old_options;
uint8 language; uint16 language;
my_bool with_auto_increment; my_bool with_auto_increment;
} MI_CREATE_INFO; } MI_CREATE_INFO;
@ -410,7 +410,7 @@ typedef struct st_mi_check_param
uint out_flag,warning_printed,error_printed,verbose; uint out_flag,warning_printed,error_printed,verbose;
uint opt_sort_key,total_files,max_level; uint opt_sort_key,total_files,max_level;
uint testflag, key_cache_block_size; uint testflag, key_cache_block_size;
uint8 language; uint16 language;
my_bool using_global_keycache, opt_lock_memory, opt_follow_links; my_bool using_global_keycache, opt_lock_memory, opt_follow_links;
my_bool retry_repair, force_sort; my_bool retry_repair, force_sort;
char temp_filename[FN_REFLEN],*isam_file_name; char temp_filename[FN_REFLEN],*isam_file_name;

View File

@ -1,3 +1,6 @@
#ifndef MYISAMPACK_INCLUDED
#define MYISAMPACK_INCLUDED
/* Copyright (C) 2000 MySQL 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
@ -236,3 +239,4 @@
mi_int4store(((T) + 4), A); }} mi_int4store(((T) + 4), A); }}
#define mi_sizekorr(T) mi_uint4korr((uchar*) (T) + 4) #define mi_sizekorr(T) mi_uint4korr((uchar*) (T) + 4)
#endif #endif
#endif /* MYISAMPACK_INCLUDED */

View File

@ -86,9 +86,11 @@ extern char *mysql_unix_port;
#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG) #define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG)
#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) #define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG)
#define IS_BLOB(n) ((n) & BLOB_FLAG) #define IS_BLOB(n) ((n) & BLOB_FLAG)
#define IS_NUM(t) ((t) <= MYSQL_TYPE_INT24 || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL) /**
#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG) Returns true if the value is a number which does not need quotes for
#define INTERNAL_NUM_FIELD(f) (((f)->type <= MYSQL_TYPE_INT24 && ((f)->type != MYSQL_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == MYSQL_TYPE_YEAR) the sql_lex.cc parser to parse correctly.
*/
#define IS_NUM(t) (((t) <= MYSQL_TYPE_INT24 && (t) != MYSQL_TYPE_TIMESTAMP) || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL)
#define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_STRING) #define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_STRING)
@ -186,24 +188,10 @@ struct st_mysql_options {
unsigned long max_allowed_packet; unsigned long max_allowed_packet;
my_bool use_ssl; /* if to use SSL or not */ my_bool use_ssl; /* if to use SSL or not */
my_bool compress,named_pipe; my_bool compress,named_pipe;
/* my_bool unused1;
On connect, find out the replication role of the server, and my_bool unused2;
establish connections to all the peers my_bool unused3;
*/ my_bool unused4;
my_bool rpl_probe;
/*
Each call to mysql_real_query() will parse it to tell if it is a read
or a write, and direct it to the slave or the master
*/
my_bool rpl_parse;
/*
If set, never read from a master, only from slave, when doing
a read that is replication-aware
*/
my_bool no_master_reads;
#if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY)
my_bool separate_thread;
#endif
enum mysql_option methods_to_use; enum mysql_option methods_to_use;
char *client_ip; char *client_ip;
/* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */ /* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */
@ -230,15 +218,6 @@ enum mysql_protocol_type
MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET, MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
}; };
/*
There are three types of queries - the ones that have to go to
the master, the ones that go to a slave, and the adminstrative
type which must happen on the pivot connectioin
*/
enum mysql_rpl_type
{
MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
};
typedef struct character_set typedef struct character_set
{ {
@ -283,21 +262,8 @@ typedef struct st_mysql
/* session-wide random string */ /* session-wide random string */
char scramble[SCRAMBLE_LENGTH+1]; char scramble[SCRAMBLE_LENGTH+1];
my_bool unused1;
/* void *unused2, *unused3, *unused4, *unused5;
Set if this is the original connection, not a master or a slave we have
added though mysql_rpl_probe() or mysql_set_master()/ mysql_add_slave()
*/
my_bool rpl_pivot;
/*
Pointers to the master, and the next slave connections, points to
itself if lone connection.
*/
struct st_mysql* master, *next_slave;
struct st_mysql* last_used_slave; /* needed for round-robin slave pick */
/* needed for send/read/store/use result to work correctly with replication */
struct st_mysql* last_used_con;
LIST *stmts; /* list of all statements */ LIST *stmts; /* list of all statements */
const struct st_mysql_methods *methods; const struct st_mysql_methods *methods;
@ -331,35 +297,12 @@ typedef struct st_mysql_res {
void *extension; void *extension;
} MYSQL_RES; } MYSQL_RES;
#define MAX_MYSQL_MANAGER_ERR 256
#define MAX_MYSQL_MANAGER_MSG 256
#define MANAGER_OK 200
#define MANAGER_INFO 250
#define MANAGER_ACCESS 401
#define MANAGER_CLIENT_ERR 450
#define MANAGER_INTERNAL_ERR 500
#if !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT) #if !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT)
#define MYSQL_CLIENT #define MYSQL_CLIENT
#endif #endif
typedef struct st_mysql_manager
{
NET net;
char *host, *user, *passwd;
char *net_buf, *net_buf_pos, *net_data_end;
unsigned int port;
int cmd_status;
int last_errno;
int net_buf_size;
my_bool free_me;
my_bool eof;
char last_error[MAX_MYSQL_MANAGER_ERR];
void *extension;
} MYSQL_MANAGER;
typedef struct st_mysql_parameters typedef struct st_mysql_parameters
{ {
unsigned long *p_max_allowed_packet; unsigned long *p_max_allowed_packet;
@ -452,16 +395,6 @@ int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql);
MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql);
/* perform query on master */
my_bool STDCALL mysql_master_query(MYSQL *mysql, const char *q,
unsigned long length);
my_bool STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
unsigned long length);
/* perform query on slave */
my_bool STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
unsigned long length);
my_bool STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
unsigned long length);
void STDCALL mysql_get_character_set_info(MYSQL *mysql, void STDCALL mysql_get_character_set_info(MYSQL *mysql,
MY_CHARSET_INFO *charset); MY_CHARSET_INFO *charset);
@ -483,37 +416,6 @@ mysql_set_local_infile_handler(MYSQL *mysql,
void void
mysql_set_local_infile_default(MYSQL *mysql); mysql_set_local_infile_default(MYSQL *mysql);
/*
enable/disable parsing of all queries to decide if they go on master or
slave
*/
void STDCALL mysql_enable_rpl_parse(MYSQL* mysql);
void STDCALL mysql_disable_rpl_parse(MYSQL* mysql);
/* get the value of the parse flag */
int STDCALL mysql_rpl_parse_enabled(MYSQL* mysql);
/* enable/disable reads from master */
void STDCALL mysql_enable_reads_from_master(MYSQL* mysql);
void STDCALL mysql_disable_reads_from_master(MYSQL* mysql);
/* get the value of the master read flag */
my_bool STDCALL mysql_reads_from_master_enabled(MYSQL* mysql);
enum mysql_rpl_type STDCALL mysql_rpl_query_type(const char* q, int len);
/* discover the master and its slaves */
my_bool STDCALL mysql_rpl_probe(MYSQL* mysql);
/* set the master, close/free the old one, if it is not a pivot */
int STDCALL mysql_set_master(MYSQL* mysql, const char* host,
unsigned int port,
const char* user,
const char* passwd);
int STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
unsigned int port,
const char* user,
const char* passwd);
int STDCALL mysql_shutdown(MYSQL *mysql, int STDCALL mysql_shutdown(MYSQL *mysql,
enum mysql_enum_shutdown_level enum mysql_enum_shutdown_level
shutdown_level); shutdown_level);
@ -560,18 +462,6 @@ void STDCALL mysql_debug(const char *debug);
void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name); void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
unsigned int STDCALL mysql_thread_safe(void); unsigned int STDCALL mysql_thread_safe(void);
my_bool STDCALL mysql_embedded(void); my_bool STDCALL mysql_embedded(void);
MYSQL_MANAGER* STDCALL mysql_manager_init(MYSQL_MANAGER* con);
MYSQL_MANAGER* STDCALL mysql_manager_connect(MYSQL_MANAGER* con,
const char* host,
const char* user,
const char* passwd,
unsigned int port);
void STDCALL mysql_manager_close(MYSQL_MANAGER* con);
int STDCALL mysql_manager_command(MYSQL_MANAGER* con,
const char* cmd, int cmd_len);
int STDCALL mysql_manager_fetch_line(MYSQL_MANAGER* con,
char* res_buf,
int res_buf_size);
my_bool STDCALL mysql_read_query_result(MYSQL *mysql); my_bool STDCALL mysql_read_query_result(MYSQL *mysql);
@ -766,7 +656,7 @@ typedef struct st_mysql_methods
MYSQL_RES * (*use_result)(MYSQL *mysql); MYSQL_RES * (*use_result)(MYSQL *mysql);
void (*fetch_lengths)(unsigned long *to, void (*fetch_lengths)(unsigned long *to,
MYSQL_ROW column, unsigned int field_count); MYSQL_ROW column, unsigned int field_count);
void (*flush_use_result)(MYSQL *mysql); void (*flush_use_result)(MYSQL *mysql, my_bool flush_all_results);
#if !defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY) #if !defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY)
MYSQL_FIELD * (*list_fields)(MYSQL *mysql); MYSQL_FIELD * (*list_fields)(MYSQL *mysql);
my_bool (*read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt); my_bool (*read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt);
@ -826,6 +716,7 @@ my_bool STDCALL mysql_rollback(MYSQL * mysql);
my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode); my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
my_bool STDCALL mysql_more_results(MYSQL *mysql); my_bool STDCALL mysql_more_results(MYSQL *mysql);
int STDCALL mysql_next_result(MYSQL *mysql); int STDCALL mysql_next_result(MYSQL *mysql);
int STDCALL mysql_stmt_next_result(MYSQL_STMT *stmt);
void STDCALL mysql_close(MYSQL *sock); void STDCALL mysql_close(MYSQL *sock);
@ -840,7 +731,6 @@ MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host,
const char *user, const char *passwd); const char *user, const char *passwd);
int STDCALL mysql_create_db(MYSQL *mysql, const char *DB); int STDCALL mysql_create_db(MYSQL *mysql, const char *DB);
int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
#endif #endif
#define HAVE_MYSQL_REAL_CONNECT #define HAVE_MYSQL_REAL_CONNECT

View File

@ -28,15 +28,15 @@ typedef struct st_net {
unsigned int *return_status; unsigned int *return_status;
unsigned char reading_or_writing; unsigned char reading_or_writing;
char save_char; char save_char;
my_bool unused0;
my_bool unused;
my_bool compress;
my_bool unused1; my_bool unused1;
unsigned char *query_cache_query; my_bool unused2;
my_bool compress;
my_bool unused3;
unsigned char *unused;
unsigned int last_errno; unsigned int last_errno;
unsigned char error; unsigned char error;
my_bool unused2; my_bool unused4;
my_bool return_errno; my_bool unused5;
char last_error[512]; char last_error[512];
char sqlstate[5 +1]; char sqlstate[5 +1];
void *extension; void *extension;
@ -277,10 +277,10 @@ struct st_mysql_options {
unsigned long max_allowed_packet; unsigned long max_allowed_packet;
my_bool use_ssl; my_bool use_ssl;
my_bool compress,named_pipe; my_bool compress,named_pipe;
my_bool rpl_probe; my_bool unused1;
my_bool rpl_parse; my_bool unused2;
my_bool no_master_reads; my_bool unused3;
my_bool separate_thread; my_bool unused4;
enum mysql_option methods_to_use; enum mysql_option methods_to_use;
char *client_ip; char *client_ip;
my_bool secure_auth; my_bool secure_auth;
@ -301,10 +301,6 @@ enum mysql_protocol_type
MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET, MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
}; };
enum mysql_rpl_type
{
MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
};
typedef struct character_set typedef struct character_set
{ {
unsigned int number; unsigned int number;
@ -344,10 +340,8 @@ typedef struct st_mysql
my_bool free_me; my_bool free_me;
my_bool reconnect; my_bool reconnect;
char scramble[20 +1]; char scramble[20 +1];
my_bool rpl_pivot; my_bool unused1;
struct st_mysql* master, *next_slave; void *unused2, *unused3, *unused4, *unused5;
struct st_mysql* last_used_slave;
struct st_mysql* last_used_con;
LIST *stmts; LIST *stmts;
const struct st_mysql_methods *methods; const struct st_mysql_methods *methods;
void *thd; void *thd;
@ -371,20 +365,6 @@ typedef struct st_mysql_res {
my_bool unbuffered_fetch_cancelled; my_bool unbuffered_fetch_cancelled;
void *extension; void *extension;
} MYSQL_RES; } MYSQL_RES;
typedef struct st_mysql_manager
{
NET net;
char *host, *user, *passwd;
char *net_buf, *net_buf_pos, *net_data_end;
unsigned int port;
int cmd_status;
int last_errno;
int net_buf_size;
my_bool free_me;
my_bool eof;
char last_error[256];
void *extension;
} MYSQL_MANAGER;
typedef struct st_mysql_parameters typedef struct st_mysql_parameters
{ {
unsigned long *p_max_allowed_packet; unsigned long *p_max_allowed_packet;
@ -437,14 +417,6 @@ int mysql_real_query(MYSQL *mysql, const char *q,
unsigned long length); unsigned long length);
MYSQL_RES * mysql_store_result(MYSQL *mysql); MYSQL_RES * mysql_store_result(MYSQL *mysql);
MYSQL_RES * mysql_use_result(MYSQL *mysql); MYSQL_RES * mysql_use_result(MYSQL *mysql);
my_bool mysql_master_query(MYSQL *mysql, const char *q,
unsigned long length);
my_bool mysql_master_send_query(MYSQL *mysql, const char *q,
unsigned long length);
my_bool mysql_slave_query(MYSQL *mysql, const char *q,
unsigned long length);
my_bool mysql_slave_send_query(MYSQL *mysql, const char *q,
unsigned long length);
void mysql_get_character_set_info(MYSQL *mysql, void mysql_get_character_set_info(MYSQL *mysql,
MY_CHARSET_INFO *charset); MY_CHARSET_INFO *charset);
void void
@ -459,22 +431,6 @@ mysql_set_local_infile_handler(MYSQL *mysql,
void *); void *);
void void
mysql_set_local_infile_default(MYSQL *mysql); mysql_set_local_infile_default(MYSQL *mysql);
void mysql_enable_rpl_parse(MYSQL* mysql);
void mysql_disable_rpl_parse(MYSQL* mysql);
int mysql_rpl_parse_enabled(MYSQL* mysql);
void mysql_enable_reads_from_master(MYSQL* mysql);
void mysql_disable_reads_from_master(MYSQL* mysql);
my_bool mysql_reads_from_master_enabled(MYSQL* mysql);
enum mysql_rpl_type mysql_rpl_query_type(const char* q, int len);
my_bool mysql_rpl_probe(MYSQL* mysql);
int mysql_set_master(MYSQL* mysql, const char* host,
unsigned int port,
const char* user,
const char* passwd);
int mysql_add_slave(MYSQL* mysql, const char* host,
unsigned int port,
const char* user,
const char* passwd);
int mysql_shutdown(MYSQL *mysql, int mysql_shutdown(MYSQL *mysql,
enum mysql_enum_shutdown_level enum mysql_enum_shutdown_level
shutdown_level); shutdown_level);
@ -521,18 +477,6 @@ void mysql_debug(const char *debug);
void myodbc_remove_escape(MYSQL *mysql,char *name); void myodbc_remove_escape(MYSQL *mysql,char *name);
unsigned int mysql_thread_safe(void); unsigned int mysql_thread_safe(void);
my_bool mysql_embedded(void); my_bool mysql_embedded(void);
MYSQL_MANAGER* mysql_manager_init(MYSQL_MANAGER* con);
MYSQL_MANAGER* mysql_manager_connect(MYSQL_MANAGER* con,
const char* host,
const char* user,
const char* passwd,
unsigned int port);
void mysql_manager_close(MYSQL_MANAGER* con);
int mysql_manager_command(MYSQL_MANAGER* con,
const char* cmd, int cmd_len);
int mysql_manager_fetch_line(MYSQL_MANAGER* con,
char* res_buf,
int res_buf_size);
my_bool mysql_read_query_result(MYSQL *mysql); my_bool mysql_read_query_result(MYSQL *mysql);
enum enum_mysql_stmt_state enum enum_mysql_stmt_state
{ {
@ -616,7 +560,7 @@ typedef struct st_mysql_methods
MYSQL_RES * (*use_result)(MYSQL *mysql); MYSQL_RES * (*use_result)(MYSQL *mysql);
void (*fetch_lengths)(unsigned long *to, void (*fetch_lengths)(unsigned long *to,
MYSQL_ROW column, unsigned int field_count); MYSQL_ROW column, unsigned int field_count);
void (*flush_use_result)(MYSQL *mysql); void (*flush_use_result)(MYSQL *mysql, my_bool flush_all_results);
MYSQL_FIELD * (*list_fields)(MYSQL *mysql); MYSQL_FIELD * (*list_fields)(MYSQL *mysql);
my_bool (*read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt); my_bool (*read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt);
int (*stmt_execute)(MYSQL_STMT *stmt); int (*stmt_execute)(MYSQL_STMT *stmt);
@ -671,4 +615,5 @@ my_bool mysql_rollback(MYSQL * mysql);
my_bool mysql_autocommit(MYSQL * mysql, my_bool auto_mode); my_bool mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
my_bool mysql_more_results(MYSQL *mysql); my_bool mysql_more_results(MYSQL *mysql);
int mysql_next_result(MYSQL *mysql); int mysql_next_result(MYSQL *mysql);
int mysql_stmt_next_result(MYSQL_STMT *stmt);
void mysql_close(MYSQL *sock); void mysql_close(MYSQL *sock);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2005 MySQL AB /* Copyright (C) 2005 MySQL AB, 2009 Sun Microsystems, Inc.
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
@ -16,7 +16,6 @@
#ifndef _my_plugin_h #ifndef _my_plugin_h
#define _my_plugin_h #define _my_plugin_h
/* /*
On Windows, exports from DLL need to be declared On Windows, exports from DLL need to be declared
*/ */
@ -34,15 +33,7 @@ class Item;
#define MYSQL_THD void* #define MYSQL_THD void*
#endif #endif
#ifndef _m_string_h #include <mysql/services.h>
/* This definition must match the one given in m_string.h */
struct st_mysql_lex_string
{
char *str;
unsigned int length;
};
#endif /* _m_string_h */
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
#define MYSQL_XIDDATASIZE 128 #define MYSQL_XIDDATASIZE 128
/** /**
@ -65,7 +56,7 @@ typedef struct st_mysql_xid MYSQL_XID;
Plugin API. Common for all plugin types. Plugin API. Common for all plugin types.
*/ */
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0100 #define MYSQL_PLUGIN_INTERFACE_VERSION 0x0101
/* /*
The allowable types of plugins The allowable types of plugins
@ -75,7 +66,8 @@ typedef struct st_mysql_xid MYSQL_XID;
#define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */ #define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */
#define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */ #define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */
#define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 /* The I_S plugin type */ #define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 /* The I_S plugin type */
#define MYSQL_MAX_PLUGIN_TYPE_NUM 5 /* The number of plugin types */ #define MYSQL_REPLICATION_PLUGIN 5 /* The replication plugin type */
#define MYSQL_MAX_PLUGIN_TYPE_NUM 6 /* The number of plugin types */
/* We use the following strings to define licenses for plugins */ /* We use the following strings to define licenses for plugins */
#define PLUGIN_LICENSE_PROPRIETARY 0 #define PLUGIN_LICENSE_PROPRIETARY 0
@ -120,7 +112,8 @@ enum enum_mysql_show_type
{ {
SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG, SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG,
SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
SHOW_always_last
}; };
struct st_mysql_show_var { struct st_mysql_show_var {
@ -650,6 +643,17 @@ struct st_mysql_information_schema
int interface_version; int interface_version;
}; };
/*
API for Replication plugin. (MYSQL_REPLICATION_PLUGIN)
*/
#define MYSQL_REPLICATION_INTERFACE_VERSION 0x0100
/**
Replication plugin descriptor
*/
struct Mysql_replication {
int interface_version;
};
/* /*
st_mysql_value struct for reading values from mysqld. st_mysql_value struct for reading values from mysqld.
@ -733,54 +737,6 @@ int thd_killed(const MYSQL_THD thd);
*/ */
unsigned long thd_get_thread_id(const MYSQL_THD thd); unsigned long thd_get_thread_id(const MYSQL_THD thd);
/**
Allocate memory in the connection's local memory pool
@details
When properly used in place of @c my_malloc(), this can significantly
improve concurrency. Don't use this or related functions to allocate
large chunks of memory. Use for temporary storage only. The memory
will be freed automatically at the end of the statement; no explicit
code is required to prevent memory leaks.
@see alloc_root()
*/
void *thd_alloc(MYSQL_THD thd, unsigned int size);
/**
@see thd_alloc()
*/
void *thd_calloc(MYSQL_THD thd, unsigned int size);
/**
@see thd_alloc()
*/
char *thd_strdup(MYSQL_THD thd, const char *str);
/**
@see thd_alloc()
*/
char *thd_strmake(MYSQL_THD thd, const char *str, unsigned int size);
/**
@see thd_alloc()
*/
void *thd_memdup(MYSQL_THD thd, const void* str, unsigned int size);
/**
Create a LEX_STRING in this connection's local memory pool
@param thd user thread connection handle
@param lex_str pointer to LEX_STRING object to be initialized
@param str initializer to be copied into lex_str
@param size length of str, in bytes
@param allocate_lex_string flag: if TRUE, allocate new LEX_STRING object,
instead of using lex_str value
@return NULL on failure, or pointer to the LEX_STRING object
@see thd_alloc()
*/
MYSQL_LEX_STRING *thd_make_lex_string(MYSQL_THD thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
/** /**
Get the XID for this connection's transaction Get the XID for this connection's transaction

View File

@ -1,9 +1,38 @@
#include <mysql/services.h>
#include <mysql/service_my_snprintf.h>
#include <stdarg.h>
#include <stdlib.h>
extern struct my_snprintf_service_st {
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
} *my_snprintf_service;
size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
#include <mysql/service_thd_alloc.h>
#include <stdlib.h>
struct st_mysql_lex_string struct st_mysql_lex_string
{ {
char *str; char *str;
unsigned int length; size_t length;
}; };
typedef struct st_mysql_lex_string MYSQL_LEX_STRING; typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
extern struct thd_alloc_service_st {
void *(*thd_alloc_func)(void*, unsigned int);
void *(*thd_calloc_func)(void*, unsigned int);
char *(*thd_strdup_func)(void*, const char *);
char *(*thd_strmake_func)(void*, const char *, unsigned int);
void *(*thd_memdup_func)(void*, const void*, unsigned int);
MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
const char *, unsigned int, int);
} *thd_alloc_service;
void *thd_alloc(void* thd, unsigned int size);
void *thd_calloc(void* thd, unsigned int size);
char *thd_strdup(void* thd, const char *str);
char *thd_strmake(void* thd, const char *str, unsigned int size);
void *thd_memdup(void* thd, const void* str, unsigned int size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
struct st_mysql_xid { struct st_mysql_xid {
long formatID; long formatID;
long gtrid_length; long gtrid_length;
@ -15,7 +44,8 @@ enum enum_mysql_show_type
{ {
SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG, SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG,
SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
SHOW_always_last
}; };
struct st_mysql_show_var { struct st_mysql_show_var {
const char *name; const char *name;
@ -105,6 +135,9 @@ struct st_mysql_information_schema
{ {
int interface_version; int interface_version;
}; };
struct Mysql_replication {
int interface_version;
};
struct st_mysql_value struct st_mysql_value
{ {
int (*value_type)(struct st_mysql_value *); int (*value_type)(struct st_mysql_value *);
@ -125,14 +158,6 @@ void thd_inc_row_count(void* thd);
int mysql_tmpfile(const char *prefix); int mysql_tmpfile(const char *prefix);
int thd_killed(const void* thd); int thd_killed(const void* thd);
unsigned long thd_get_thread_id(const void* thd); unsigned long thd_get_thread_id(const void* thd);
void *thd_alloc(void* thd, unsigned int size);
void *thd_calloc(void* thd, unsigned int size);
char *thd_strdup(void* thd, const char *str);
char *thd_strmake(void* thd, const char *str, unsigned int size);
void *thd_memdup(void* thd, const void* str, unsigned int size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
void thd_get_xid(const void* thd, MYSQL_XID *xid); void thd_get_xid(const void* thd, MYSQL_XID *xid);
void mysql_query_cache_invalidate4(void* thd, void mysql_query_cache_invalidate4(void* thd,
const char *key, unsigned int key_length, const char *key, unsigned int key_length,

View File

@ -0,0 +1,98 @@
#ifndef MYSQL_SERVICE_MY_SNPRINTF_INCLUDED
/* Copyright (C) 2009 Sun Microsystems, Inc.
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 */
/**
@file
my_snprintf service
Portable and limited vsnprintf() implementation.
This is a portable, limited vsnprintf() implementation, with some
extra features. "Portable" means that it'll produce identical result
on all platforms (for example, on Windows and Linux system printf %e
formats the exponent differently, on different systems %p either
prints leading 0x or not, %s may accept null pointer or crash on
it). "Limited" means that it does not support all the C89 features.
But it supports few extensions, not in any standard.
my_vsnprintf(to, n, fmt, ap)
@param[out] to A buffer to store the result in
@param[in] n Store up to n-1 characters, followed by an end 0
@param[in] fmt printf-like format string
@param[in] ap Arguments
@return a number of bytes written to a buffer *excluding* terminating '\0'
@post
The syntax of a format string is generally the same:
% <flag> <width> <precision> <length modifier> <format>
where everithing but the format is optional.
Three one-character flags are recognized:
'0' has the standard zero-padding semantics;
'-' is parsed, but silently ignored;
'`' (backtick) is only supported for strings (%s) and means that the
string will be quoted according to MySQL identifier quoting rules.
Both <width> and <precision> can be specified as numbers or '*'.
<length modifier> can be 'l', 'll', or 'z'.
Supported formats are 's' (null pointer is accepted, printed as
"(null)"), 'b' (extension, see below), 'c', 'd', 'u', 'x',
'X', 'p' (works as 0x%x).
Standard syntax for positional arguments $n is supported.
Extensions:
Flag '`' (backtick): see above.
Format 'b': binary buffer, prints exactly <precision> bytes from the
argument, without stopping at '\0'.
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <stdarg.h>
#include <stdlib.h>
extern struct my_snprintf_service_st {
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
} *my_snprintf_service;
#ifdef MYSQL_DYNAMIC_PLUGIN
#define my_vsnprintf my_snprintf_service->my_vsnprintf_type
#define my_snprintf my_snprintf_service->my_snprintf_type
#else
size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
#endif
#ifdef __cplusplus
}
#endif
#define MYSQL_SERVICE_MY_SNPRINTF_INCLUDED
#endif

View File

@ -0,0 +1,128 @@
#ifndef MYSQL_SERVICE_THD_ALLOC_INCLUDED
/* Copyright (C) 2009 Sun Microsystems, Inc.
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 */
/**
@file
This service provdes functions to allocate memory in a connection local
memory pool. The memory allocated there will be automatically freed at the
end of the statement, don't use it for allocations that should live longer
than that. For short living allocations this is more efficient than
using my_malloc and friends, and automatic "garbage collection" allows not
to think about memory leaks.
The pool is best for small to medium objects, don't use it for large
allocations - they are better served with my_malloc.
*/
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
struct st_mysql_lex_string
{
char *str;
size_t length;
};
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
extern struct thd_alloc_service_st {
void *(*thd_alloc_func)(MYSQL_THD, unsigned int);
void *(*thd_calloc_func)(MYSQL_THD, unsigned int);
char *(*thd_strdup_func)(MYSQL_THD, const char *);
char *(*thd_strmake_func)(MYSQL_THD, const char *, unsigned int);
void *(*thd_memdup_func)(MYSQL_THD, const void*, unsigned int);
MYSQL_LEX_STRING *(*thd_make_lex_string_func)(MYSQL_THD, MYSQL_LEX_STRING *,
const char *, unsigned int, int);
} *thd_alloc_service;
#ifdef MYSQL_DYNAMIC_PLUGIN
#define thd_alloc(thd,size) (thd_alloc_service->thd_alloc_func((thd), (size)))
#define thd_calloc(thd,size) (thd_alloc_service->thd_calloc_func((thd), (size)))
#define thd_strdup(thd,str) (thd_alloc_service->thd_strdup_func((thd), (str)))
#define thd_strmake(thd,str,size) \
(thd_alloc_service->thd_strmake_func((thd), (str), (size)))
#define thd_memdup(thd,str,size) \
(thd_alloc_service->thd_memdup_func((thd), (str), (size)))
#define thd_make_lex_string(thd, lex_str, str, size, allocate_lex_string) \
(thd_alloc_service->thd_make_lex_string_func((thd), (lex_str), (str), \
(size), (allocate_lex_string)))
#else
/**
Allocate memory in the connection's local memory pool
@details
When properly used in place of @c my_malloc(), this can significantly
improve concurrency. Don't use this or related functions to allocate
large chunks of memory. Use for temporary storage only. The memory
will be freed automatically at the end of the statement; no explicit
code is required to prevent memory leaks.
@see alloc_root()
*/
void *thd_alloc(MYSQL_THD thd, unsigned int size);
/**
@see thd_alloc()
*/
void *thd_calloc(MYSQL_THD thd, unsigned int size);
/**
@see thd_alloc()
*/
char *thd_strdup(MYSQL_THD thd, const char *str);
/**
@see thd_alloc()
*/
char *thd_strmake(MYSQL_THD thd, const char *str, unsigned int size);
/**
@see thd_alloc()
*/
void *thd_memdup(MYSQL_THD thd, const void* str, unsigned int size);
/**
Create a LEX_STRING in this connection's local memory pool
@param thd user thread connection handle
@param lex_str pointer to LEX_STRING object to be initialized
@param str initializer to be copied into lex_str
@param size length of str, in bytes
@param allocate_lex_string flag: if TRUE, allocate new LEX_STRING object,
instead of using lex_str value
@return NULL on failure, or pointer to the LEX_STRING object
@see thd_alloc()
*/
MYSQL_LEX_STRING *thd_make_lex_string(MYSQL_THD thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
#endif
#ifdef __cplusplus
}
#endif
#define MYSQL_SERVICE_THD_ALLOC_INCLUDED
#endif

View File

@ -1,4 +1,5 @@
/* Copyright (C) 2004 MySQL AB #ifndef MYSQL_SERVICES_INCLUDED
/* Copyright (C) 2009 Sun Microsystems, Inc.
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
@ -13,18 +14,17 @@
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 */
#if defined(__GNUC__) && defined(USE_PRAGMA_IMPLEMENTATION) #ifdef __cplusplus
#pragma implementation extern "C" {
#endif #endif
#include "manager.h" #include <mysql/service_my_snprintf.h>
#include "command.h" #include <mysql/service_thd_alloc.h>
Command::Command() #ifdef __cplusplus
:guardian(Manager::get_guardian()), }
instance_map(Manager::get_instance_map()) #endif
{}
Command::~Command() #define MYSQL_SERVICES_INCLUDED
{} #endif

View File

@ -27,6 +27,8 @@
#define NAME_LEN (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN) #define NAME_LEN (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN)
#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN) #define USERNAME_LENGTH (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN)
#define MYSQL_AUTODETECT_CHARSET_NAME "auto"
#define SERVER_VERSION_LENGTH 60 #define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5 #define SQLSTATE_LENGTH 5
@ -144,6 +146,7 @@ enum enum_server_command
#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */ #define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
#define CLIENT_MULTI_STATEMENTS (1UL << 16) /* Enable/disable multi-stmt support */ #define CLIENT_MULTI_STATEMENTS (1UL << 16) /* Enable/disable multi-stmt support */
#define CLIENT_MULTI_RESULTS (1UL << 17) /* Enable/disable multi-results */ #define CLIENT_MULTI_RESULTS (1UL << 17) /* Enable/disable multi-results */
#define CLIENT_PS_MULTI_RESULTS (1UL << 18) /* Multi-results in PS-protocol */
#define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30) #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)
#define CLIENT_REMEMBER_OPTIONS (1UL << 31) #define CLIENT_REMEMBER_OPTIONS (1UL << 31)
@ -167,6 +170,7 @@ enum enum_server_command
CLIENT_SECURE_CONNECTION | \ CLIENT_SECURE_CONNECTION | \
CLIENT_MULTI_STATEMENTS | \ CLIENT_MULTI_STATEMENTS | \
CLIENT_MULTI_RESULTS | \ CLIENT_MULTI_RESULTS | \
CLIENT_PS_MULTI_RESULTS | \
CLIENT_SSL_VERIFY_SERVER_CERT | \ CLIENT_SSL_VERIFY_SERVER_CERT | \
CLIENT_REMEMBER_OPTIONS) CLIENT_REMEMBER_OPTIONS)
@ -203,6 +207,12 @@ enum enum_server_command
number of result set columns. number of result set columns.
*/ */
#define SERVER_STATUS_METADATA_CHANGED 1024 #define SERVER_STATUS_METADATA_CHANGED 1024
#define SERVER_QUERY_WAS_SLOW 2048
/**
To mark ResultSet containing output parameter values.
*/
#define SERVER_PS_OUT_PARAMS 4096
/** /**
Server status flags that must be cleared when starting Server status flags that must be cleared when starting
@ -254,24 +264,23 @@ typedef struct st_net {
unsigned int *return_status; unsigned int *return_status;
unsigned char reading_or_writing; unsigned char reading_or_writing;
char save_char; char save_char;
my_bool unused0; /* Please remove with the next incompatible ABI change. */
my_bool unused; /* Please remove with the next incompatible ABI change */
my_bool compress;
my_bool unused1; /* Please remove with the next incompatible ABI change. */ my_bool unused1; /* Please remove with the next incompatible ABI change. */
my_bool unused2; /* Please remove with the next incompatible ABI change */
my_bool compress;
my_bool unused3; /* Please remove with the next incompatible ABI change. */
/* /*
Pointer to query object in query cache, do not equal NULL (0) for Pointer to query object in query cache, do not equal NULL (0) for
queries in cache that have not stored its results yet queries in cache that have not stored its results yet
*/ */
#endif #endif
/* /*
'query_cache_query' should be accessed only via query cache Unused, please remove with the next incompatible ABI change.
functions and methods to maintain proper locking.
*/ */
unsigned char *query_cache_query; unsigned char *unused;
unsigned int last_errno; unsigned int last_errno;
unsigned char error; unsigned char error;
my_bool unused2; /* Please remove with the next incompatible ABI change. */ my_bool unused4; /* Please remove with the next incompatible ABI change. */
my_bool return_errno; my_bool unused5; /* Please remove with the next incompatible ABI change. */
/** Client library error message buffer. Actually belongs to struct MYSQL. */ /** Client library error message buffer. Actually belongs to struct MYSQL. */
char last_error[MYSQL_ERRMSG_SIZE]; char last_error[MYSQL_ERRMSG_SIZE];
/** Client library sqlstate buffer. Set along with the error message. */ /** Client library sqlstate buffer. Set along with the error message. */
@ -409,10 +418,6 @@ void my_net_set_write_timeout(NET *net, uint timeout);
void my_net_set_read_timeout(NET *net, uint timeout); void my_net_set_read_timeout(NET *net, uint timeout);
#endif #endif
/*
The following function is not meant for normal usage
Currently it's used internally by manager.c
*/
struct sockaddr; struct sockaddr;
int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen, int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen,
unsigned int timeout); unsigned int timeout);

View File

@ -1,3 +1,6 @@
#ifndef MYSQL_EMBED_INCLUDED
#define MYSQL_EMBED_INCLUDED
/* Copyright (C) 2000 MySQL 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
@ -28,3 +31,4 @@
#define DONT_USE_RAID #define DONT_USE_RAID
#endif /* EMBEDDED_LIBRARY */ #endif /* EMBEDDED_LIBRARY */
#endif /* MYSQL_EMBED_INCLUDED */

View File

@ -1,3 +1,6 @@
#ifndef RIJNDAEL_INCLUDED
#define RIJNDAEL_INCLUDED
/* Copyright (C) 2002 MySQL AB /* Copyright (C) 2002 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
@ -39,3 +42,5 @@ void rijndaelEncrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr,
const uint8 pt[16], uint8 ct[16]); const uint8 pt[16], uint8 ct[16]);
void rijndaelDecrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr, void rijndaelDecrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr,
const uint8 ct[16], uint8 pt[16]); const uint8 ct[16], uint8 pt[16]);
#endif /* RIJNDAEL_INCLUDED */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2004-2006 MySQL AB /* Copyright (C) 2009 Sun Microsystems, Inc.
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
@ -13,11 +13,12 @@
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 */
#ifndef INCLUDES_MYSQL_INSTANCE_MANAGER_MESSAGES_H #ifdef _WIN32
#define INCLUDES_MYSQL_INSTANCE_MANAGER_MESSAGES_H #define SERVICE_VERSION __declspec(dllexport) void *
#else
#define SERVICE_VERSION void *
#endif
const char *message(unsigned sql_errno); #define VERSION_my_snprintf 0x0100
#define VERSION_thd_alloc 0x0100
const char *errno_to_sqlstate(unsigned sql_errno);
#endif // INCLUDES_MYSQL_INSTANCE_MANAGER_MESSAGES_H

View File

@ -1,3 +1,6 @@
#ifndef SHA1_INCLUDED
#define SHA1_INCLUDED
/* Copyright (C) 2002, 2006 MySQL AB /* Copyright (C) 2002, 2006 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
@ -64,3 +67,5 @@ int mysql_sha1_input(SHA1_CONTEXT*, const uint8 *, unsigned int);
int mysql_sha1_result(SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE]); int mysql_sha1_result(SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE]);
C_MODE_END C_MODE_END
#endif /* SHA__INCLUDED */

View File

@ -1,3 +1,6 @@
#ifndef SQL_COMMON_INCLUDED
#define SQL_COMMON_INCLUDED
/* Copyright (C) 2003-2004, 2006 MySQL AB /* Copyright (C) 2003-2004, 2006 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
@ -48,3 +51,4 @@ void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate);
#define protocol_41(A) ((A)->server_capabilities & CLIENT_PROTOCOL_41) #define protocol_41(A) ((A)->server_capabilities & CLIENT_PROTOCOL_41)
#endif /* SQL_COMMON_INCLUDED */

View File

@ -1,3 +1,6 @@
#ifndef SSLOPT_CASE_INCLUDED
#define SSLOPT_CASE_INCLUDED
/* Copyright (C) 2000 MySQL 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
@ -26,3 +29,4 @@
opt_use_ssl= 1; opt_use_ssl= 1;
break; break;
#endif #endif
#endif /* SSLOPT_CASE_INCLUDED */

View File

@ -1,3 +1,6 @@
#ifndef SSLOPT_LONGOPTS_INCLUDED
#define SSLOPT_LONGOPTS_INCLUDED
/* Copyright (C) 2000 MySQL 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
@ -43,3 +46,4 @@
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif #endif
#endif /* HAVE_OPENSSL */ #endif /* HAVE_OPENSSL */
#endif /* SSLOPT_LONGOPTS_INCLUDED */

Some files were not shown because too many files have changed in this diff Show More