You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
Merge 3.1 into 3.2
This commit is contained in:
14
.travis.yml
14
.travis.yml
@@ -23,17 +23,19 @@ before_install:
|
||||
- export SSLCERT=$PROJ_PATH/tmp
|
||||
matrix:
|
||||
allow_failures:
|
||||
# - env: DB=build
|
||||
# - env: SERVER_BRANCH=10.5
|
||||
# - env: SERVER_BRANCH=10.5 TEST_OPTION=--ps-protocol
|
||||
include:
|
||||
- env: DB=build
|
||||
- env: DB=build:10.6
|
||||
- env: SKYSQL=true
|
||||
- env: SKYSQL_HA=true MAXSCALE_TEST_DISABLE=true
|
||||
# disable for now - env: DB=mysql:8.0
|
||||
- env: DB=mariadb:10.1
|
||||
- env: DB=mariadb:10.2
|
||||
- env: DB=mariadb:10.3
|
||||
- env: DB=mariadb:10.4
|
||||
- env: DB=mariadb:10.5
|
||||
- env: DB=mariadb:10.5 MAXSCALE_VERSION=2.5.3 MAXSCALE_TEST_DISABLE=true
|
||||
- env: SERVER_BRANCH=10.2
|
||||
- env: SERVER_BRANCH=10.2 TEST_OPTION=--ps-protocol
|
||||
- env: SERVER_BRANCH=10.3
|
||||
@@ -44,8 +46,8 @@ matrix:
|
||||
- env: SERVER_BRANCH=10.5 TEST_OPTION=--ps-protocol
|
||||
|
||||
script:
|
||||
- if [ "$DB" = "build" ] ; then .travis/build/build.sh; fi
|
||||
- if [ "$DB" = "build" ] ; then docker build -t build:latest --label build .travis/build/; fi
|
||||
- if [ -z "$DB" ] && [ -z "$SKYSQL" ] ; then .travis/server-replace-submodule.sh; fi
|
||||
- if [ -n "$DB" ] || [ -n "$SKYSQL" ]; then .travis/script.sh; fi
|
||||
- if [[ "$DB" == build* ]] ; then .travis/build/build.sh; fi
|
||||
- if [[ "$DB" == build* ]] ; then docker build -t build:10.6 --label build .travis/build/; fi
|
||||
- if [ -z "$DB" ] && [ -z "$SKYSQL" ] && [ -z "$SKYSQL_HA" ] ; then .travis/server-replace-submodule.sh; fi
|
||||
- if [ -n "$DB" ] || [ -n "$SKYSQL" ] || [ -n "$SKYSQL_HA" ]; then .travis/script.sh; fi
|
||||
|
||||
|
@@ -1,8 +1,22 @@
|
||||
FROM debian:jessie
|
||||
# vim:set ft=dockerfile:
|
||||
FROM ubuntu:xenial
|
||||
|
||||
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
|
||||
RUN groupadd -r mysql && useradd -r -g mysql mysql
|
||||
|
||||
# https://bugs.debian.org/830696 (apt uses gpgv by default in newer releases, rather than gpg)
|
||||
RUN set -ex; \
|
||||
apt-get update; \
|
||||
if ! which gpg; then \
|
||||
apt-get install -y --no-install-recommends gnupg; \
|
||||
fi; \
|
||||
# Ubuntu includes "gnupg" (not "gnupg2", but still 2.x), but not dirmngr, and gnupg 2.x requires dirmngr
|
||||
# so, if we're not running gnupg 1.x, explicitly install dirmngr too
|
||||
if ! gpg --version | grep -q '^gpg (GnuPG) 1\.'; then \
|
||||
apt-get install -y --no-install-recommends dirmngr; \
|
||||
fi; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# add gosu for easy step-down from root
|
||||
ENV GOSU_VERSION 1.10
|
||||
RUN set -ex; \
|
||||
@@ -21,8 +35,9 @@ RUN set -ex; \
|
||||
\
|
||||
# verify the signature
|
||||
export GNUPGHOME="$(mktemp -d)"; \
|
||||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
|
||||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
|
||||
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
|
||||
command -v gpgconf > /dev/null && gpgconf --kill all || :; \
|
||||
rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc; \
|
||||
\
|
||||
chmod +x /usr/local/bin/gosu; \
|
||||
@@ -37,39 +52,44 @@ RUN mkdir /docker-entrypoint-initdb.d
|
||||
# install "apt-transport-https" for Percona's repo (switched to https-only)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
apt-transport-https ca-certificates \
|
||||
tzdata \
|
||||
pwgen \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN { \
|
||||
echo "mariadb-server-10.3" mysql-server/root_password password 'unused'; \
|
||||
echo "mariadb-server-10.3" mysql-server/root_password_again password 'unused'; \
|
||||
echo "mariadb-server-10.6" mysql-server/root_password password 'unused'; \
|
||||
echo "mariadb-server-10.6" mysql-server/root_password_again password 'unused'; \
|
||||
} | debconf-set-selections
|
||||
|
||||
RUN apt-get update -y
|
||||
RUN apt-get install -y software-properties-common wget
|
||||
RUN apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
|
||||
RUN echo 'deb http://yum.mariadb.org/galera/repo/deb jessie main' > /etc/apt/sources.list.d/galera-test-repo.list
|
||||
RUN apt-get update -y
|
||||
#RUN apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
|
||||
#RUN apt-key adv --recv-keys --keyserver ha.pool.sks-keyservers.net F1656F24C74CD1D8
|
||||
#RUN echo 'deb http://yum.mariadb.org/galera/repo/deb xenial main' > /etc/apt/sources.list.d/galera-test-repo.list
|
||||
#RUN apt-get update -y
|
||||
|
||||
RUN apt-get install -y curl libdbi-perl rsync socat galera3 libnuma1 libaio1 zlib1g-dev libreadline5 libjemalloc1 libsnappy1 libcrack2
|
||||
RUN apt-get install -y curl libdbi-perl rsync socat libnuma1 libaio1 zlib1g-dev libreadline5 libjemalloc1 libsnappy1v5 libcrack2
|
||||
|
||||
#RUN apt-get install -y galera3
|
||||
|
||||
COPY *.deb /root/
|
||||
RUN chmod 777 /root/*
|
||||
|
||||
RUN dpkg -R --install /root/mysql-common*
|
||||
RUN dpkg -R --install /root/mariadb-common*
|
||||
RUN dpkg --install /root/mysql-common*
|
||||
RUN dpkg --install /root/mariadb-common*
|
||||
RUN dpkg -R --unpack /root/
|
||||
RUN apt-get install -f -y
|
||||
|
||||
RUN ls -lrt /etc/mysql
|
||||
RUN ls -lrt /etc/mysql/mariadb.conf.d
|
||||
RUN rm -rf /var/lib/apt/lists/* \
|
||||
&& sed -ri 's/^user\s/#&/' /etc/mysql/my.cnf /etc/mysql/conf.d/* \
|
||||
&& rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /run/mysqld \
|
||||
&& chown -R mysql:mysql /var/lib/mysql /run/mysqld \
|
||||
&& chmod 777 /run/mysqld \
|
||||
&& sed -ri 's/^user\s/#&/' /etc/mysql/my.cnf /etc/mysql/mariadb.conf.d/*.cnf \
|
||||
&& rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \
|
||||
&& chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \
|
||||
&& chmod 777 /var/run/mysqld \
|
||||
&& find /etc/mysql/ -name '*.cnf' -print0 \
|
||||
| xargs -0 grep -lZE '^(bind-address|log)' \
|
||||
| xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/' \
|
||||
&& echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf
|
||||
&& echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/mariadb.conf.d/docker.cnf
|
||||
|
||||
VOLUME /var/lib/mysql
|
||||
|
||||
|
@@ -4,22 +4,22 @@ echo "**************************************************************************
|
||||
echo "* searching for last complete build"
|
||||
echo "**************************************************************************"
|
||||
|
||||
wget -q -o /dev/null index.html http://hasky.askmonty.org/archive/10.3/
|
||||
wget -q -o /dev/null index.html http://hasky.askmonty.org/archive/10.6/
|
||||
grep -o ">build-[0-9]*" index.html | grep -o "[0-9]*" | tac | while read -r line ; do
|
||||
|
||||
curl -s --head http://hasky.askmonty.org/archive/10.3/build-$line/kvm-deb-jessie-amd64/md5sums.txt | head -n 1 | grep "HTTP/1.[01] [23].." > /dev/null
|
||||
curl -s --head http://hasky.askmonty.org/archive/10.6/build-$line/kvm-deb-xenial-amd64/md5sums.txt | head -n 1 | grep "HTTP/1.[01] [23].." > /dev/null
|
||||
if [ $? = "0" ]; then
|
||||
echo "**************************************************************************"
|
||||
echo "* Processing $line"
|
||||
echo "**************************************************************************"
|
||||
wget -q -o /dev/null -O $line.html http://hasky.askmonty.org/archive/10.3/build-$line/kvm-deb-jessie-amd64/debs/binary/
|
||||
wget -q -o /dev/null -O $line.html http://hasky.askmonty.org/archive/10.6/build-$line/kvm-deb-xenial-amd64/debs/binary/
|
||||
grep -o ">[^\"]*\.deb" $line.html | grep -o "[^>]*\.deb" | while read -r file ; do
|
||||
if [[ "$file" =~ ^mariadb-plugin.* ]] ;
|
||||
then
|
||||
echo "skipped file: $file"
|
||||
else
|
||||
echo "download file: $file"
|
||||
wget -q -o /dev/null -O .travis/build/$file http://hasky.askmonty.org/archive/10.3/build-$line/kvm-deb-jessie-amd64/debs/binary/$file
|
||||
echo "download file: http://hasky.askmonty.org/archive/10.6/build-$line/kvm-deb-xenial-amd64/debs/binary/$file"
|
||||
wget -q -o /dev/null -O .travis/build/$file http://hasky.askmonty.org/archive/10.6/build-$line/kvm-deb-xenial-amd64/debs/binary/$file
|
||||
fi
|
||||
done
|
||||
|
||||
|
@@ -2,21 +2,21 @@
|
||||
set -eo pipefail
|
||||
shopt -s nullglob
|
||||
|
||||
# if command starts with an option, prepend mysqld
|
||||
if [ "${1:0:1}" = '-' ]; then
|
||||
set -- mysqld "$@"
|
||||
fi
|
||||
|
||||
# skip setup if they want an option that stops mysqld
|
||||
wantHelp=
|
||||
for arg; do
|
||||
case "$arg" in
|
||||
-'?'|--help|--print-defaults|-V|--version)
|
||||
wantHelp=1
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
# logging functions
|
||||
mysql_log() {
|
||||
local type="$1"; shift
|
||||
printf '%s [%s] [Entrypoint]: %s\n' "$(date --rfc-3339=seconds)" "$type" "$*"
|
||||
}
|
||||
mysql_note() {
|
||||
mysql_log Note "$@"
|
||||
}
|
||||
mysql_warn() {
|
||||
mysql_log Warn "$@" >&2
|
||||
}
|
||||
mysql_error() {
|
||||
mysql_log ERROR "$@" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# usage: file_env VAR [DEFAULT]
|
||||
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
|
||||
@@ -27,8 +27,7 @@ file_env() {
|
||||
local fileVar="${var}_FILE"
|
||||
local def="${2:-}"
|
||||
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
||||
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
mysql_error "Both $var and $fileVar are set (but are exclusive)"
|
||||
fi
|
||||
local val="$def"
|
||||
if [ "${!var:-}" ]; then
|
||||
@@ -40,89 +39,198 @@ file_env() {
|
||||
unset "$fileVar"
|
||||
}
|
||||
|
||||
_check_config() {
|
||||
toRun=( "$@" --verbose --help --log-bin-index="$(mktemp -u)" )
|
||||
# check to see if this file is being run or sourced from another script
|
||||
_is_sourced() {
|
||||
# https://unix.stackexchange.com/a/215279
|
||||
[ "${#FUNCNAME[@]}" -ge 2 ] \
|
||||
&& [ "${FUNCNAME[0]}" = '_is_sourced' ] \
|
||||
&& [ "${FUNCNAME[1]}" = 'source' ]
|
||||
}
|
||||
|
||||
# usage: docker_process_init_files [file [file [...]]]
|
||||
# ie: docker_process_init_files /always-initdb.d/*
|
||||
# process initializer files, based on file extensions
|
||||
docker_process_init_files() {
|
||||
# mysql here for backwards compatibility "${mysql[@]}"
|
||||
mysql=( docker_process_sql )
|
||||
|
||||
echo
|
||||
local f
|
||||
for f; do
|
||||
case "$f" in
|
||||
*.sh)
|
||||
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
|
||||
# https://github.com/docker-library/postgres/pull/452
|
||||
if [ -x "$f" ]; then
|
||||
mysql_note "$0: running $f"
|
||||
"$f"
|
||||
else
|
||||
mysql_note "$0: sourcing $f"
|
||||
. "$f"
|
||||
fi
|
||||
;;
|
||||
*.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;;
|
||||
*.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;;
|
||||
*.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;;
|
||||
*) mysql_warn "$0: ignoring $f" ;;
|
||||
esac
|
||||
echo
|
||||
done
|
||||
}
|
||||
|
||||
mysql_check_config() {
|
||||
local toRun=( "$@" --verbose --help --log-bin-index="$(mktemp -u)" ) errors
|
||||
if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then
|
||||
cat >&2 <<-EOM
|
||||
|
||||
ERROR: mysqld failed while attempting to check config
|
||||
command was: "${toRun[*]}"
|
||||
|
||||
$errors
|
||||
EOM
|
||||
exit 1
|
||||
mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors"
|
||||
fi
|
||||
}
|
||||
|
||||
# Fetch value from server config
|
||||
# We use mysqld --verbose --help instead of my_print_defaults because the
|
||||
# latter only show values present in config files, and not server defaults
|
||||
_get_config() {
|
||||
mysql_get_config() {
|
||||
local conf="$1"; shift
|
||||
"$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "'"$conf"'" { print $2; exit }'
|
||||
"$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null \
|
||||
| awk -v conf="$conf" '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }'
|
||||
# match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)"
|
||||
}
|
||||
|
||||
# allow the container to be started with `--user`
|
||||
if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then
|
||||
_check_config "$@"
|
||||
DATADIR="$(_get_config 'datadir' "$@")"
|
||||
mkdir -p "$DATADIR"
|
||||
chown -R mysql:mysql "$DATADIR"
|
||||
exec gosu mysql "$BASH_SOURCE" "$@"
|
||||
fi
|
||||
|
||||
if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
|
||||
# still need to check config, container may have started with --user
|
||||
_check_config "$@"
|
||||
# Get config
|
||||
DATADIR="$(_get_config 'datadir' "$@")"
|
||||
|
||||
if [ ! -d "$DATADIR/mysql" ]; then
|
||||
file_env 'MYSQL_ROOT_PASSWORD'
|
||||
if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then
|
||||
echo >&2 'error: database is uninitialized and password option is not specified '
|
||||
echo >&2 ' You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$DATADIR"
|
||||
|
||||
echo 'Initializing database'
|
||||
mysql_install_db --datadir="$DATADIR" --rpm
|
||||
echo 'Database initialized'
|
||||
|
||||
SOCKET="$(_get_config 'socket' "$@")"
|
||||
# Do a temporary startup of the MySQL server, for init purposes
|
||||
docker_temp_server_start() {
|
||||
"$@" --skip-networking --socket="${SOCKET}" &
|
||||
pid="$!"
|
||||
|
||||
mysql=( mysql --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" )
|
||||
|
||||
mysql_note "Waiting for server startup"
|
||||
local i
|
||||
for i in {30..0}; do
|
||||
if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then
|
||||
# only use the root password if the database has already been initializaed
|
||||
# so that it won't try to fill in a password file when it hasn't been set yet
|
||||
extraArgs=()
|
||||
if [ -z "$DATABASE_ALREADY_EXISTS" ]; then
|
||||
extraArgs+=( '--dont-use-mysql-root-password' )
|
||||
fi
|
||||
if docker_process_sql "${extraArgs[@]}" --database=mysql <<<'SELECT 1' &> /dev/null; then
|
||||
break
|
||||
fi
|
||||
echo 'MySQL init process in progress...'
|
||||
sleep 1
|
||||
done
|
||||
if [ "$i" = 0 ]; then
|
||||
echo >&2 'MySQL init process failed.'
|
||||
exit 1
|
||||
mysql_error "Unable to start server."
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then
|
||||
# sed is for https://bugs.mysql.com/bug.php?id=20545
|
||||
mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql
|
||||
# Stop the server. When using a local socket file mysqladmin will block until
|
||||
# the shutdown is complete.
|
||||
docker_temp_server_stop() {
|
||||
if ! mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}"; then
|
||||
mysql_error "Unable to shut down server."
|
||||
fi
|
||||
}
|
||||
|
||||
if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then
|
||||
export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)"
|
||||
echo "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD"
|
||||
# Verify that the minimally required password settings are set for new databases.
|
||||
docker_verify_minimum_env() {
|
||||
if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then
|
||||
mysql_error $'Database is uninitialized and password option is not specified\n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD'
|
||||
fi
|
||||
}
|
||||
|
||||
rootCreate=
|
||||
# default root to listen for connections from anywhere
|
||||
# creates folders for the database
|
||||
# also ensures permission for user mysql of run as root
|
||||
docker_create_db_directories() {
|
||||
local user; user="$(id -u)"
|
||||
|
||||
# TODO other directories that are used by default? like /var/lib/mysql-files
|
||||
# see https://github.com/docker-library/mysql/issues/562
|
||||
mkdir -p "$DATADIR"
|
||||
|
||||
if [ "$user" = "0" ]; then
|
||||
# this will cause less disk access than `chown -R`
|
||||
find "$DATADIR" \! -user mysql -exec chown mysql '{}' +
|
||||
fi
|
||||
}
|
||||
|
||||
# initializes the database directory
|
||||
docker_init_database_dir() {
|
||||
mysql_note "Initializing database files"
|
||||
installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal )
|
||||
if { mysql_install_db --help || :; } | grep -q -- '--skip-test-db'; then
|
||||
# 10.3+
|
||||
installArgs+=( --skip-test-db )
|
||||
fi
|
||||
# "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here)
|
||||
mysql_install_db "${installArgs[@]}" "${@:2}"
|
||||
mysql_note "Database files initialized"
|
||||
}
|
||||
|
||||
# Loads various settings that are used elsewhere in the script
|
||||
# This should be called after mysql_check_config, but before any other functions
|
||||
docker_setup_env() {
|
||||
# Get config
|
||||
declare -g DATADIR SOCKET
|
||||
DATADIR="$(mysql_get_config 'datadir' "$@")"
|
||||
SOCKET="$(mysql_get_config 'socket' "$@")"
|
||||
|
||||
# Initialize values that might be stored in a file
|
||||
file_env 'MYSQL_ROOT_HOST' '%'
|
||||
if [ ! -z "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then
|
||||
file_env 'MYSQL_DATABASE'
|
||||
file_env 'MYSQL_USER'
|
||||
file_env 'MYSQL_PASSWORD'
|
||||
file_env 'MYSQL_ROOT_PASSWORD'
|
||||
|
||||
declare -g DATABASE_ALREADY_EXISTS
|
||||
if [ -d "$DATADIR/mysql" ]; then
|
||||
DATABASE_ALREADY_EXISTS='true'
|
||||
fi
|
||||
}
|
||||
|
||||
# Execute sql script, passed via stdin
|
||||
# usage: docker_process_sql [--dont-use-mysql-root-password] [mysql-cli-args]
|
||||
# ie: docker_process_sql --database=mydb <<<'INSERT ...'
|
||||
# ie: docker_process_sql --dont-use-mysql-root-password --database=mydb <my-file.sql
|
||||
docker_process_sql() {
|
||||
passfileArgs=()
|
||||
if [ '--dont-use-mysql-root-password' = "$1" ]; then
|
||||
passfileArgs+=( "$1" )
|
||||
shift
|
||||
fi
|
||||
# args sent in can override this db, since they will be later in the command
|
||||
if [ -n "$MYSQL_DATABASE" ]; then
|
||||
set -- --database="$MYSQL_DATABASE" "$@"
|
||||
fi
|
||||
|
||||
mysql --defaults-extra-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@"
|
||||
}
|
||||
|
||||
# Initializes database with timezone info and root password, plus optional extra db/user
|
||||
docker_setup_db() {
|
||||
# Load timezone info into database
|
||||
if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then
|
||||
{
|
||||
# Aria in 10.4+ is slow due to "transactional" (crash safety)
|
||||
# https://jira.mariadb.org/browse/MDEV-23326
|
||||
# https://github.com/docker-library/mariadb/issues/262
|
||||
local tztables=( time_zone time_zone_leap_second time_zone_name time_zone_transition time_zone_transition_type )
|
||||
for table in "${tztables[@]}"; do
|
||||
echo "/*!100400 ALTER TABLE $table TRANSACTIONAL=0 */;"
|
||||
done
|
||||
|
||||
# sed is for https://bugs.mysql.com/bug.php?id=20545
|
||||
mysql_tzinfo_to_sql /usr/share/zoneinfo \
|
||||
| sed 's/Local time zone must be set--see zic manual page/FCTY/'
|
||||
|
||||
for table in "${tztables[@]}"; do
|
||||
echo "/*!100400 ALTER TABLE $table TRANSACTIONAL=1 */;"
|
||||
done
|
||||
} | docker_process_sql --dont-use-mysql-root-password --database=mysql
|
||||
# tell docker_process_sql to not use MYSQL_ROOT_PASSWORD since it is not set yet
|
||||
fi
|
||||
# Generate random root password
|
||||
if [ -n "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then
|
||||
export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)"
|
||||
mysql_note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD"
|
||||
fi
|
||||
# Sets root password and creates root users for non-localhost hosts
|
||||
local rootCreate=
|
||||
# default root to listen for connections from anywhere
|
||||
if [ -n "$MYSQL_ROOT_HOST" ] && [ "$MYSQL_ROOT_HOST" != 'localhost' ]; then
|
||||
# no, we don't care if read finds a terminating character in this heredoc
|
||||
# https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151
|
||||
read -r -d '' rootCreate <<-EOSQL || true
|
||||
@@ -131,61 +239,117 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
|
||||
EOSQL
|
||||
fi
|
||||
|
||||
"${mysql[@]}" <<-EOSQL
|
||||
# tell docker_process_sql to not use MYSQL_ROOT_PASSWORD since it is just now being set
|
||||
docker_process_sql --dont-use-mysql-root-password --database=mysql <<-EOSQL
|
||||
-- What's done in this file shouldn't be replicated
|
||||
-- or products like mysql-fabric won't work
|
||||
SET @@SESSION.SQL_LOG_BIN=0;
|
||||
|
||||
DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ;
|
||||
DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mariadb.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ;
|
||||
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ;
|
||||
-- 10.1: https://github.com/MariaDB/server/blob/d925aec1c10cebf6c34825a7de50afe4e630aff4/scripts/mysql_secure_installation.sh#L347-L365
|
||||
-- 10.5: https://github.com/MariaDB/server/blob/00c3a28820c67c37ebbca72691f4897b57f2eed5/scripts/mysql_secure_installation.sh#L351-L369
|
||||
DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' ;
|
||||
|
||||
GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ;
|
||||
FLUSH PRIVILEGES ;
|
||||
${rootCreate}
|
||||
DROP DATABASE IF EXISTS test ;
|
||||
FLUSH PRIVILEGES ;
|
||||
EOSQL
|
||||
|
||||
if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then
|
||||
mysql+=( -p"${MYSQL_ROOT_PASSWORD}" )
|
||||
# Creates a custom database and user if specified
|
||||
if [ -n "$MYSQL_DATABASE" ]; then
|
||||
mysql_note "Creating database ${MYSQL_DATABASE}"
|
||||
docker_process_sql --database=mysql <<<"CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;"
|
||||
fi
|
||||
|
||||
file_env 'MYSQL_DATABASE'
|
||||
if [ "$MYSQL_DATABASE" ]; then
|
||||
echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" | "${mysql[@]}"
|
||||
mysql+=( "$MYSQL_DATABASE" )
|
||||
if [ -n "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then
|
||||
mysql_note "Creating user ${MYSQL_USER}"
|
||||
docker_process_sql --database=mysql <<<"CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;"
|
||||
|
||||
if [ -n "$MYSQL_DATABASE" ]; then
|
||||
mysql_note "Giving user ${MYSQL_USER} access to schema ${MYSQL_DATABASE}"
|
||||
docker_process_sql --database=mysql <<<"GRANT ALL ON \`${MYSQL_DATABASE//_/\\_}\`.* TO '$MYSQL_USER'@'%' ;"
|
||||
fi
|
||||
|
||||
file_env 'MYSQL_USER'
|
||||
file_env 'MYSQL_PASSWORD'
|
||||
if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then
|
||||
echo "CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" | "${mysql[@]}"
|
||||
|
||||
if [ "$MYSQL_DATABASE" ]; then
|
||||
echo "GRANT ALL ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_USER'@'%' ;" | "${mysql[@]}"
|
||||
fi
|
||||
}
|
||||
|
||||
echo 'FLUSH PRIVILEGES ;' | "${mysql[@]}"
|
||||
_mysql_passfile() {
|
||||
# echo the password to the "file" the client uses
|
||||
# the client command will use process substitution to create a file on the fly
|
||||
# ie: --defaults-extra-file=<( _mysql_passfile )
|
||||
if [ '--dont-use-mysql-root-password' != "$1" ] && [ -n "$MYSQL_ROOT_PASSWORD" ]; then
|
||||
cat <<-EOF
|
||||
[client]
|
||||
password="${MYSQL_ROOT_PASSWORD}"
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
echo
|
||||
for f in /docker-entrypoint-initdb.d/*; do
|
||||
case "$f" in
|
||||
*.sh) echo "$0: running $f"; . "$f" ;;
|
||||
*.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;;
|
||||
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;;
|
||||
*) echo "$0: ignoring $f" ;;
|
||||
# check arguments for an option that would cause mysqld to stop
|
||||
# return true if there is one
|
||||
_mysql_want_help() {
|
||||
local arg
|
||||
for arg; do
|
||||
case "$arg" in
|
||||
-'?'|--help|--print-defaults|-V|--version)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
echo
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
if ! kill -s TERM "$pid" || ! wait "$pid"; then
|
||||
echo >&2 'MySQL init process failed.'
|
||||
exit 1
|
||||
_main() {
|
||||
# if command starts with an option, prepend mysqld
|
||||
if [ "${1:0:1}" = '-' ]; then
|
||||
set -- mysqld "$@"
|
||||
fi
|
||||
|
||||
# skip setup if they aren't running mysqld or want an option that stops mysqld
|
||||
if [ "$1" = 'mysqld' ] && ! _mysql_want_help "$@"; then
|
||||
mysql_note "Entrypoint script for MySQL Server ${MARIADB_VERSION} started."
|
||||
|
||||
mysql_check_config "$@"
|
||||
# Load various environment variables
|
||||
docker_setup_env "$@"
|
||||
docker_create_db_directories
|
||||
|
||||
# If container is started as root user, restart as dedicated mysql user
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
mysql_note "Switching to dedicated user 'mysql'"
|
||||
exec gosu mysql "$BASH_SOURCE" "$@"
|
||||
fi
|
||||
|
||||
# there's no database, so it needs to be initialized
|
||||
if [ -z "$DATABASE_ALREADY_EXISTS" ]; then
|
||||
docker_verify_minimum_env
|
||||
|
||||
# check dir permissions to reduce likelihood of half-initialized database
|
||||
ls /docker-entrypoint-initdb.d/ > /dev/null
|
||||
|
||||
docker_init_database_dir "$@"
|
||||
|
||||
mysql_note "Starting temporary server"
|
||||
docker_temp_server_start "$@"
|
||||
mysql_note "Temporary server started."
|
||||
|
||||
docker_setup_db
|
||||
docker_process_init_files /docker-entrypoint-initdb.d/*
|
||||
|
||||
mysql_note "Stopping temporary server"
|
||||
docker_temp_server_stop
|
||||
mysql_note "Temporary server stopped"
|
||||
|
||||
echo
|
||||
echo 'MySQL init process done. Ready for start up.'
|
||||
mysql_note "MySQL init process done. Ready for start up."
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
}
|
||||
|
||||
# If we are sourced from elsewhere, don't perform any further actions
|
||||
if ! _is_sourced; then
|
||||
_main "$@"
|
||||
fi
|
@@ -9,5 +9,6 @@ services:
|
||||
- $SSLCERT:/etc/sslcert
|
||||
- $ENTRYPOINT:/docker-entrypoint-initdb.d
|
||||
environment:
|
||||
MYSQL_DATABASE: test
|
||||
MYSQL_DATABASE: testc
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: 1
|
||||
MYSQL_INITDB_SKIP_TZINFO: 1
|
||||
|
36
.travis/maxscale-compose.yml
Normal file
36
.travis/maxscale-compose.yml
Normal file
@@ -0,0 +1,36 @@
|
||||
version: '2.1'
|
||||
services:
|
||||
db:
|
||||
image: $DB
|
||||
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --ssl-ca=/etc/sslcert/ca.crt --ssl-cert=/etc/sslcert/server.crt --ssl-key=/etc/sslcert/server.key --bind-address=0.0.0.0
|
||||
ports:
|
||||
- 3305:3306
|
||||
volumes:
|
||||
- $SSLCERT:/etc/sslcert
|
||||
- $ENTRYPOINT:/docker-entrypoint-initdb.d
|
||||
environment:
|
||||
MYSQL_DATABASE: testc
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: 1
|
||||
healthcheck:
|
||||
test: ["CMD", "mysql", "--protocol=tcp", "-ubob", "-h127.0.0.1"]
|
||||
timeout: 50s
|
||||
retries: 10
|
||||
interval: 5s
|
||||
|
||||
maxscale:
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
links:
|
||||
- "db:database"
|
||||
ports:
|
||||
- 4006:4006
|
||||
- 4008:4008
|
||||
- 4009:4009
|
||||
volumes:
|
||||
- $SSLCERT:/etc/sslcert
|
||||
build:
|
||||
context: .
|
||||
dockerfile: maxscale/Dockerfile
|
||||
args:
|
||||
MAXSCALE_VERSION: $MAXSCALE_VERSION
|
24
.travis/maxscale/Dockerfile
Normal file
24
.travis/maxscale/Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
||||
FROM centos:7
|
||||
|
||||
ARG MAXSCALE_VERSION
|
||||
ENV MAXSCALE_VERSION ${MAXSCALE_VERSION:-2.5.3}
|
||||
|
||||
COPY maxscale/mariadb.repo /etc/yum.repos.d/
|
||||
|
||||
RUN rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB \
|
||||
&& yum -y install https://downloads.mariadb.com/MaxScale/${MAXSCALE_VERSION}/centos/7/x86_64/maxscale-${MAXSCALE_VERSION}-2.rhel.7.x86_64.rpm \
|
||||
&& yum -y update
|
||||
|
||||
RUN yum -y install maxscale-${MAXSCALE_VERSION} MariaDB-client \
|
||||
&& yum clean all \
|
||||
&& rm -rf /tmp/*
|
||||
|
||||
COPY maxscale/docker-entrypoint.sh /
|
||||
COPY maxscale/maxscale.cnf /etc/
|
||||
RUN chmod 777 /etc/maxscale.cnf
|
||||
RUN chmod 777 /docker-entrypoint.sh
|
||||
|
||||
|
||||
EXPOSE 4006 4007 4008
|
||||
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
35
.travis/maxscale/docker-entrypoint.sh
Normal file
35
.travis/maxscale/docker-entrypoint.sh
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
echo 'creating configuration done'
|
||||
|
||||
sleep 15
|
||||
|
||||
#################################################################################################
|
||||
# wait for db availability for 60s
|
||||
#################################################################################################
|
||||
mysql=( mysql --protocol=tcp -ubob -hdb --port=3306 )
|
||||
for i in {60..0}; do
|
||||
if echo 'use test2' | "${mysql[@]}" &> /dev/null; then
|
||||
break
|
||||
fi
|
||||
echo 'DB init process in progress...'
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo 'use test2' | "${mysql[@]}"
|
||||
if [ "$i" = 0 ]; then
|
||||
echo 'DB init process failed.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 'maxscale launching ...'
|
||||
|
||||
tail -n 500 /etc/maxscale.cnf
|
||||
|
||||
/usr/bin/maxscale --user=root --nodaemon
|
||||
|
||||
cd /var/log/maxscale
|
||||
ls -lrt
|
||||
tail -n 500 /var/log/maxscale/maxscale.log
|
7
.travis/maxscale/mariadb.repo
Normal file
7
.travis/maxscale/mariadb.repo
Normal file
@@ -0,0 +1,7 @@
|
||||
# MariaDB 10.2 CentOS repository list - created 2017-06-05 08:06 UTC
|
||||
# http://downloads.mariadb.org/mariadb/repositories/
|
||||
[mariadb]
|
||||
name = MariaDB
|
||||
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
|
||||
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
|
||||
gpgcheck=1
|
121
.travis/maxscale/maxscale.cnf
Normal file
121
.travis/maxscale/maxscale.cnf
Normal file
@@ -0,0 +1,121 @@
|
||||
# MaxScale documentation:
|
||||
# https://mariadb.com/kb/en/mariadb-maxscale-24/
|
||||
|
||||
# Global parameters
|
||||
#
|
||||
# Complete list of configuration options:
|
||||
# https://mariadb.com/kb/en/mariadb-maxscale-24-mariadb-maxscale-configuration-guide/
|
||||
|
||||
[maxscale]
|
||||
threads=auto
|
||||
|
||||
# Server definitions
|
||||
#
|
||||
# Set the address of the server to the network
|
||||
# address of a MariaDB server.
|
||||
#
|
||||
|
||||
[server2]
|
||||
type=server
|
||||
address=database
|
||||
port=3306
|
||||
protocol=MariaDBBackend
|
||||
ssl=true
|
||||
ssl_ca_cert=/etc/sslcert/server.crt
|
||||
ssl_cert=/etc/sslcert/client.crt
|
||||
ssl_key=/etc/sslcert/client.key
|
||||
|
||||
|
||||
[server1]
|
||||
type=server
|
||||
address=db
|
||||
port=3306
|
||||
protocol=MariaDBBackend
|
||||
|
||||
|
||||
# Monitor for the servers
|
||||
#
|
||||
# This will keep MaxScale aware of the state of the servers.
|
||||
# MariaDB Monitor documentation:
|
||||
# https://mariadb.com/kb/en/mariadb-maxscale-24-mariadb-monitor/
|
||||
|
||||
[MariaDB-Monitor]
|
||||
type=monitor
|
||||
module=mariadbmon
|
||||
servers=server1
|
||||
user=boby
|
||||
password=hey
|
||||
monitor_interval=2000
|
||||
|
||||
[MariaDB-Monitor2]
|
||||
type=monitor
|
||||
module=mariadbmon
|
||||
servers=server2
|
||||
user=boby
|
||||
password=hey
|
||||
monitor_interval=2000
|
||||
|
||||
# Service definitions
|
||||
#
|
||||
# Service Definition for a read-only service and
|
||||
# a read/write splitting service.
|
||||
#
|
||||
|
||||
# ReadConnRoute documentation:
|
||||
# https://mariadb.com/kb/en/mariadb-maxscale-24-readconnroute/
|
||||
|
||||
[Read-Only-Service]
|
||||
type=service
|
||||
router=readconnroute
|
||||
servers=server1
|
||||
user=boby
|
||||
password=hey
|
||||
router_options=slave
|
||||
|
||||
# ReadWriteSplit documentation:
|
||||
# https://mariadb.com/kb/en/mariadb-maxscale-24-readwritesplit/
|
||||
|
||||
[Read-Write-Service]
|
||||
type=service
|
||||
router=readwritesplit
|
||||
servers=server1
|
||||
version_string=10.5.99-MariaDB-maxScale
|
||||
user=boby
|
||||
password=hey
|
||||
|
||||
[Read-Write-Service2]
|
||||
type=service
|
||||
router=readwritesplit
|
||||
version_string=10.5.99-MariaDB-maxScale
|
||||
servers=server2
|
||||
user=boby
|
||||
password=hey
|
||||
|
||||
# Listener definitions for the services
|
||||
#
|
||||
# These listeners represent the ports the
|
||||
# services will listen on.
|
||||
#
|
||||
|
||||
[Read-Only-Listener]
|
||||
type=listener
|
||||
service=Read-Only-Service
|
||||
protocol=MariaDBClient
|
||||
port=4008
|
||||
|
||||
[Read-Write-Listener]
|
||||
type=listener
|
||||
service=Read-Write-Service
|
||||
protocol=MariaDBClient
|
||||
port=4006
|
||||
|
||||
|
||||
[Read-Write-Listener2]
|
||||
type=listener
|
||||
service=Read-Write-Service2
|
||||
protocol=MariaDBClient
|
||||
port=4009
|
||||
ssl=true
|
||||
ssl_ca_cert=/etc/sslcert/ca.crt
|
||||
ssl_cert=/etc/sslcert/server.crt
|
||||
ssl_key=/etc/sslcert/server.key
|
@@ -6,49 +6,91 @@ set -e
|
||||
###################################################################################################################
|
||||
# test different type of configuration
|
||||
###################################################################################################################
|
||||
mysql=( mysql --protocol=tcp -ubob -h127.0.0.1 --port=3305 )
|
||||
export MYSQL_TEST_TRAVIS=1
|
||||
|
||||
if [ -n "$SKYSQL" ] || [ -n "$SKYSQL_HA" ]; then
|
||||
if [ -n "$SKYSQL" ]; then
|
||||
|
||||
if [ -z "$SKYSQL_TEST_HOST" ] ; then
|
||||
###################################################################################################################
|
||||
# test SKYSQL
|
||||
###################################################################################################################
|
||||
if [ -z "$SKYSQL_HOST" ] ; then
|
||||
echo "No SkySQL configuration found !"
|
||||
exit 1
|
||||
exit 0
|
||||
fi
|
||||
|
||||
export MYSQL_TEST_USER=$SKYSQL_TEST_USER
|
||||
export MYSQL_TEST_HOST=$SKYSQL_TEST_HOST
|
||||
export MYSQL_TEST_PASSWD=$SKYSQL_TEST_PASSWORD
|
||||
export MYSQL_TEST_PORT=$SKYSQL_TEST_PORT
|
||||
export MYSQL_TEST_DATABASE=$SKYSQL_TEST_DATABASE
|
||||
export MYSQL_TEST_USER=$SKYSQL_USER
|
||||
export MYSQL_TEST_HOST=$SKYSQL_HOST
|
||||
export MYSQL_TEST_PASSWD=$SKYSQL_PASSWORD
|
||||
export MYSQL_TEST_PORT=$SKYSQL_PORT
|
||||
export MYSQL_TEST_DATABASE=testc
|
||||
export MYSQL_TEST_TLS=1
|
||||
else
|
||||
export COMPOSE_FILE=.travis/docker-compose.yml
|
||||
|
||||
else
|
||||
|
||||
###################################################################################################################
|
||||
# test SKYSQL with replication
|
||||
###################################################################################################################
|
||||
if [ -z "$SKYSQL_HA" ] ; then
|
||||
echo "No SkySQL HA configuration found !"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
export MYSQL_TEST_USER=$SKYSQL_HA_USER
|
||||
export MYSQL_TEST_HOST=$SKYSQL_HA_HOST
|
||||
export MYSQL_TEST_PASSWD=$SKYSQL_HA_PASSWORD
|
||||
export MYSQL_TEST_PORT=$SKYSQL_HA_PORT
|
||||
export MYSQL_TEST_DATABASE=testc
|
||||
export MYSQL_TEST_TLS=1
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
export COMPOSE_FILE=.travis/docker-compose.yml
|
||||
export MYSQL_TEST_HOST=mariadb.example.com
|
||||
export MYSQL_TEST_DB=testc
|
||||
export MYSQL_TEST_USER=bob
|
||||
export MYSQL_TEST_PORT=3305
|
||||
|
||||
export MARIADB_PLUGIN_DIR=$PWD
|
||||
|
||||
if [ -n "$MAXSCALE_VERSION" ] ; then
|
||||
# maxscale ports:
|
||||
# - non ssl: 4006
|
||||
# - ssl: 4009
|
||||
export MYSQL_TEST_PORT=4006
|
||||
export MYSQL_TEST_SSL_PORT=4009
|
||||
export COMPOSE_FILE=.travis/maxscale-compose.yml
|
||||
docker-compose -f ${COMPOSE_FILE} build
|
||||
fi
|
||||
|
||||
mysql=( mysql --protocol=TCP -u${MYSQL_TEST_USER} -h${MYSQL_TEST_HOST} --port=${MYSQL_TEST_PORT} ${MYSQL_TEST_DB})
|
||||
|
||||
###################################################################################################################
|
||||
# launch docker server and maxscale
|
||||
###################################################################################################################
|
||||
export INNODB_LOG_FILE_SIZE=$(echo ${PACKET}| cut -d'M' -f 1)0M
|
||||
docker-compose -f ${COMPOSE_FILE} build
|
||||
docker-compose -f ${COMPOSE_FILE} up -d
|
||||
|
||||
|
||||
###################################################################################################################
|
||||
# wait for docker initialisation
|
||||
###################################################################################################################
|
||||
|
||||
for i in {60..0}; do
|
||||
for i in {30..0}; do
|
||||
if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then
|
||||
break
|
||||
fi
|
||||
echo 'data server still not active'
|
||||
sleep 1
|
||||
sleep 2
|
||||
done
|
||||
|
||||
docker-compose -f ${COMPOSE_FILE} logs
|
||||
|
||||
if [ "$i" = 0 ]; then
|
||||
echo 'SELECT 1' | "${mysql[@]}"
|
||||
if echo 'SELECT 1' | "${mysql[@]}" ; then
|
||||
break
|
||||
fi
|
||||
|
||||
docker-compose -f ${COMPOSE_FILE} logs
|
||||
if [ -n "$MAXSCALE_VERSION" ] ; then
|
||||
docker-compose -f ${COMPOSE_FILE} exec maxscale tail -n 500 /var/log/maxscale/maxscale.log
|
||||
fi
|
||||
echo >&2 'data server init process failed.'
|
||||
exit 1
|
||||
fi
|
||||
@@ -56,14 +98,6 @@ else
|
||||
#list ssl certificates
|
||||
ls -lrt ${SSLCERT}
|
||||
|
||||
|
||||
export MYSQL_TEST_HOST=mariadb.example.com
|
||||
export MYSQL_TEST_DB=ctest
|
||||
export MYSQL_TEST_USER=bob
|
||||
export MYSQL_TEST_PORT=3305
|
||||
export MYSQL_TEST_TRAVIS=1
|
||||
export MARIADB_PLUGIN_DIR=$PWD
|
||||
|
||||
fi
|
||||
|
||||
#build C connector
|
||||
|
@@ -1,6 +1,13 @@
|
||||
CREATE USER 'bob'@'localhost';
|
||||
GRANT ALL ON *.* TO 'bob'@'localhost' with grant option;
|
||||
|
||||
CREATE USER 'bob'@'%';
|
||||
GRANT ALL ON *.* TO 'bob'@'%' with grant option;
|
||||
|
||||
FLUSH PRIVILEGES;
|
||||
CREATE USER 'boby'@'%' identified by 'hey';
|
||||
GRANT ALL ON *.* TO 'boby'@'%' identified by 'hey' with grant option;
|
||||
|
||||
CREATE DATABASE ctest;
|
||||
CREATE USER 'boby'@'localhost' identified by 'hey';
|
||||
GRANT ALL ON *.* TO 'boby'@'localhost' identified by 'hey' with grant option;
|
||||
|
||||
CREATE DATABASE test2;
|
@@ -49,6 +49,9 @@ CHECK_INCLUDE_FILES (sys/un.h HAVE_SYS_UN_H)
|
||||
CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H)
|
||||
CHECK_INCLUDE_FILES (utime.h HAVE_UTIME_H)
|
||||
|
||||
IF(APPLE)
|
||||
SET(CMAKE_REQUIRED_DEFINITIONS -D_XOPEN_SOURCE=600)
|
||||
ENDIF()
|
||||
CHECK_INCLUDE_FILES (ucontext.h HAVE_FILE_UCONTEXT_H)
|
||||
IF(NOT HAVE_FILE_UCONTEXT_H)
|
||||
CHECK_INCLUDE_FILES (sys/ucontext.h HAVE_FILE_UCONTEXT_H)
|
||||
|
@@ -8,7 +8,7 @@
|
||||
FUNCTION(GET_FILE_VERSION FILE_NAME FILE_VERSION)
|
||||
|
||||
# if we build from a git repository, we calculate the file version:
|
||||
# Patch number is numer of commits for given file
|
||||
# Patch number is number of commits for given file
|
||||
IF(GIT_EXECUTABLE AND EXISTS ${CC_SOURCE_DIR}/.git)
|
||||
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} --git-dir=${CC_SOURCE_DIR}/.git --work-tree=${CC_SOURCE_DIR} rev-list HEAD --count -- ${FILE_NAME}
|
||||
OUTPUT_VARIABLE FV)
|
||||
|
@@ -52,6 +52,9 @@ struct my_context {
|
||||
|
||||
|
||||
#ifdef MY_CONTEXT_USE_UCONTEXT
|
||||
#if defined(__APPLE__) && !defined(_XOPEN_SOURCE)
|
||||
#define _XOPEN_SOURCE 600
|
||||
#endif
|
||||
#include <ucontext.h>
|
||||
|
||||
struct my_context {
|
||||
|
@@ -113,7 +113,7 @@ void ma_hash_result(MA_HASH_CTX *ctx, unsigned char *digest);
|
||||
|
||||
@param[in] hash algorithm
|
||||
|
||||
@retuns digest size or 0 on error
|
||||
@returns digest size or 0 on error
|
||||
*/
|
||||
static inline size_t ma_hash_digest_size(unsigned int hash_alg)
|
||||
{
|
||||
|
@@ -146,22 +146,6 @@ do {\
|
||||
#define my_afree(PTR) ma_free(PTR)
|
||||
#endif /* HAVE_ALLOCA */
|
||||
|
||||
#ifdef MSDOS
|
||||
#ifdef __ZTC__
|
||||
void * __CDECL halloc(long count,size_t length);
|
||||
void __CDECL hfree(void *ptr);
|
||||
#endif
|
||||
#if defined(USE_HALLOC)
|
||||
#if defined(_VCM_) || defined(M_IC80386)
|
||||
#undef USE_HALLOC
|
||||
#endif
|
||||
#endif
|
||||
#ifdef USE_HALLOC
|
||||
#define malloc(a) halloc((long) (a),1)
|
||||
#define free(a) hfree(a)
|
||||
#endif
|
||||
#endif /* MSDOS */
|
||||
|
||||
#ifndef errno
|
||||
#ifdef HAVE_ERRNO_AS_DEFINE
|
||||
#include <errno.h> /* errno is a define */
|
||||
|
@@ -16,7 +16,7 @@
|
||||
MA 02111-1301, USA */
|
||||
|
||||
/*
|
||||
A better inplementation of the UNIX ctype(3) library.
|
||||
A better implementation of the UNIX ctype(3) library.
|
||||
Notes: my_global.h should be included before ctype.h
|
||||
*/
|
||||
|
||||
|
@@ -426,7 +426,7 @@ typedef struct st_mysql_time
|
||||
#define SEC_PART_DIGITS 6
|
||||
#define MARIADB_INVALID_SOCKET -1
|
||||
|
||||
/* Ansynchronous API constants */
|
||||
/* Asynchronous API constants */
|
||||
#define MYSQL_WAIT_READ 1
|
||||
#define MYSQL_WAIT_WRITE 2
|
||||
#define MYSQL_WAIT_EXCEPT 4
|
||||
@@ -729,7 +729,7 @@ int STDCALL mysql_stmt_send_long_data_cont(my_bool *ret, MYSQL_STMT *stmt,
|
||||
int status);
|
||||
int STDCALL mysql_reset_connection(MYSQL *mysql);
|
||||
|
||||
/* API function calls (used by dynmic plugins) */
|
||||
/* API function calls (used by dynamic plugins) */
|
||||
struct st_mariadb_api {
|
||||
unsigned long long (STDCALL *mysql_num_rows)(MYSQL_RES *res);
|
||||
unsigned int (STDCALL *mysql_num_fields)(MYSQL_RES *res);
|
||||
|
@@ -52,12 +52,12 @@ ulong net_read_timeout= NET_READ_TIMEOUT;
|
||||
ulong net_write_timeout= NET_WRITE_TIMEOUT;
|
||||
ulong net_buffer_length= 8192; /* Default length. Enlarged if necessary */
|
||||
|
||||
#if !defined(_WIN32) && !defined(MSDOS)
|
||||
#if !defined(_WIN32)
|
||||
#include <sys/socket.h>
|
||||
#else
|
||||
#undef MYSQL_SERVER /* Win32 can't handle interrupts */
|
||||
#endif
|
||||
#if !defined(MSDOS) && !defined(_WIN32) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__)
|
||||
#if !defined(_WIN32) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__)
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
|
@@ -46,7 +46,7 @@
|
||||
void ma_randominit(struct rand_struct *rand_st,ulong seed1, ulong seed2)
|
||||
{ /* For mysql 3.21.# */
|
||||
#ifdef HAVE_purify
|
||||
memset((char*) rand_st, 0m sizeof(*rand_st)); /* Avoid UMC varnings */
|
||||
memset((char*) rand_st, 0m sizeof(*rand_st)); /* Avoid UMC warnings */
|
||||
#endif
|
||||
rand_st->max_value= 0x3FFFFFFFL;
|
||||
rand_st->max_value_dbl=(double) rand_st->max_value;
|
||||
@@ -81,7 +81,7 @@ void ma_hash_password(ulong *result, const char *password, size_t len)
|
||||
}
|
||||
|
||||
/*
|
||||
* Genererate a new message based on message and password
|
||||
* Generate a new message based on message and password
|
||||
* The same thing is done in client and server and the results are checked.
|
||||
*/
|
||||
|
||||
@@ -134,7 +134,7 @@ void ma_make_scrambled_password(char *to,const char *password)
|
||||
}
|
||||
|
||||
/*
|
||||
* Genererate a new message based on message and password
|
||||
* Generate a new message based on message and password
|
||||
* The same thing is done in client and server and the results are checked.
|
||||
*/
|
||||
char *ma_scramble_323(char *to, const char *message, const char *password)
|
||||
|
@@ -370,7 +370,7 @@ end:
|
||||
|
||||
Year must be < 10000, month < 12, day < 32
|
||||
|
||||
Years with 2 digits, are coverted to values 1970-2069 according to
|
||||
Years with 2 digits, are converted to values 1970-2069 according to
|
||||
usual rules:
|
||||
|
||||
00-69 is converted to 2000-2069.
|
||||
|
@@ -3751,7 +3751,7 @@ mariadb_dyncol_check(DYNAMIC_COLUMN *str)
|
||||
i++, header.entry+= header.entry_size)
|
||||
{
|
||||
DYNAMIC_COLUMN_VALUE store;
|
||||
// already checked by previouse pass
|
||||
/* already checked by previous pass */
|
||||
(*fmt->type_and_offset_read)(&header.type, &header.offset,
|
||||
header.entry + fmt->fixed_hdr_entry,
|
||||
header.offset_size);
|
||||
|
@@ -46,7 +46,7 @@
|
||||
#ifdef HAVE_PWD_H
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
#if !defined(MSDOS) && !defined(_WIN32)
|
||||
#if !defined(_WIN32)
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
@@ -131,7 +131,7 @@ my_string mysql_unix_port=0;
|
||||
|
||||
struct st_mariadb_methods MARIADB_DEFAULT_METHODS;
|
||||
|
||||
#if defined(MSDOS) || defined(_WIN32)
|
||||
#if defined(_WIN32)
|
||||
// socket_errno is defined in ma_global.h for all platforms
|
||||
#define perror(A)
|
||||
#else
|
||||
@@ -532,7 +532,7 @@ void read_user_name(char *name)
|
||||
return;
|
||||
}
|
||||
|
||||
#else /* If MSDOS || VMS */
|
||||
#else /* WIN32 */
|
||||
|
||||
void read_user_name(char *name)
|
||||
{
|
||||
@@ -1696,12 +1696,12 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
|
||||
return(mysql);
|
||||
|
||||
error:
|
||||
/* Free alloced memory */
|
||||
/* Free allocated memory */
|
||||
end_server(mysql);
|
||||
/* only free the allocated memory, user needs to call mysql_close */
|
||||
mysql_close_memory(mysql);
|
||||
if (!(client_flag & CLIENT_REMEMBER_OPTIONS) &&
|
||||
!mysql->options.extension->async_context)
|
||||
!(IS_MYSQL_ASYNC(mysql)))
|
||||
mysql_close_options(mysql);
|
||||
return(0);
|
||||
}
|
||||
@@ -1938,7 +1938,7 @@ mysql_select_db(MYSQL *mysql, const char *db)
|
||||
|
||||
/*************************************************************************
|
||||
** Send a QUIT to the server and close the connection
|
||||
** If handle is alloced by mysql connect free it.
|
||||
** If handle is allocated by mysql connect free it.
|
||||
*************************************************************************/
|
||||
|
||||
static void mysql_close_options(MYSQL *mysql)
|
||||
@@ -2949,7 +2949,7 @@ static size_t get_store_length(size_t length)
|
||||
#define MAX_STORE_SIZE 9
|
||||
unsigned char buffer[MAX_STORE_SIZE], *p;
|
||||
|
||||
/* We just store the length and substract offset of our buffer
|
||||
/* We just store the length and subtract offset of our buffer
|
||||
to determine the length */
|
||||
p= mysql_net_store_length(buffer, length);
|
||||
return p - buffer;
|
||||
|
@@ -2199,8 +2199,11 @@ static my_bool mysql_stmt_internal_reset(MYSQL_STMT *stmt, my_bool is_close)
|
||||
}
|
||||
if (!is_close)
|
||||
ret= madb_reset_stmt(stmt, MADB_RESET_SERVER);
|
||||
}
|
||||
stmt->state= MYSQL_STMT_PREPARED;
|
||||
}
|
||||
else
|
||||
stmt->state= MYSQL_STMT_INITTED;
|
||||
|
||||
stmt->upsert_status.affected_rows= mysql->affected_rows;
|
||||
stmt->upsert_status.last_insert_id= mysql->insert_id;
|
||||
stmt->upsert_status.server_status= mysql->server_status;
|
||||
|
@@ -1398,7 +1398,7 @@ static int my_verify_callback(gnutls_session_t ssl)
|
||||
(status & GNUTLS_CERT_SIGNER_NOT_FOUND))
|
||||
return 0;
|
||||
|
||||
/* gnutls default error mesage "certificate validation failed" isn't very
|
||||
/* gnutls default error message "certificate validation failed" isn't very
|
||||
descriptive, so we provide more information about the error here */
|
||||
type= gnutls_certificate_type_get(ssl);
|
||||
gnutls_certificate_verification_status_print(status, type, &out, 0);
|
||||
|
@@ -591,7 +591,7 @@ void schannel_free_store(HCERTSTORE store)
|
||||
|
||||
/*
|
||||
Verify server certificate against a wincrypt store
|
||||
@return 0 - success, otherwise error occured.
|
||||
@return 0 - success, otherwise error occurred.
|
||||
*/
|
||||
SECURITY_STATUS schannel_verify_server_certificate(
|
||||
const CERT_CONTEXT* cert,
|
||||
@@ -663,7 +663,7 @@ static SECURITY_STATUS load_private_key(CERT_CONTEXT* cert, char* private_key_st
|
||||
}
|
||||
|
||||
/*
|
||||
To accomodate for both "BEGIN PRIVATE KEY" vs "BEGIN RSA PRIVATE KEY"
|
||||
To accommodate for both "BEGIN PRIVATE KEY" vs "BEGIN RSA PRIVATE KEY"
|
||||
sections in PEM, we try to decode with PKCS_PRIVATE_KEY_INFO first,
|
||||
and, if it fails, with PKCS_RSA_PRIVATE_KEY flag.
|
||||
*/
|
||||
|
@@ -110,7 +110,7 @@ IF(GSSAPI_SOURCES)
|
||||
SOURCES ${GSSAPI_SOURCES}
|
||||
INCLUDES ${CC_SOURCE_DIR}/plugins/auth ${GSSAPI_INCS}
|
||||
LIBRARIES ${GSSAPI_LIBS})
|
||||
IF(APPLE)
|
||||
IF(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
SET_SOURCE_FILES_PROPERTIES(${GSSAPI_SOURCES} PROPERTY COMPILE_FLAGS "-Wno-deprecated-declarations")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
@@ -93,7 +93,7 @@ static int ma_sha256_scramble(unsigned char *scramble, size_t scramble_len,
|
||||
#endif
|
||||
size_t i;
|
||||
|
||||
/* check if all specified lenghts are valid */
|
||||
/* check if all specified lengtht are valid */
|
||||
if (!scramble_len || !source_len || !salt_len)
|
||||
return 1;
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#ifdef MYSQL_CLIENT
|
||||
#if defined(MYSQL_CLIENT) || defined(LIBMARIADB)
|
||||
#include <ma_crypt.h>
|
||||
#define crypto_hash_sha512(DST,SRC,SLEN) ma_hash(MA_HASH_SHA512, SRC, SLEN, DST)
|
||||
#else
|
||||
|
@@ -38,6 +38,7 @@ static int test_conc75(MYSQL *my)
|
||||
my_bool reconnect= 1;
|
||||
|
||||
SKIP_SKYSQL;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
mysql= mysql_init(NULL);
|
||||
|
||||
@@ -147,6 +148,7 @@ static int test_conc70(MYSQL *my)
|
||||
SKIP_CONNECTION_HANDLER;
|
||||
|
||||
SKIP_SKYSQL;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
mysql= mysql_init(NULL);
|
||||
|
||||
@@ -210,7 +212,7 @@ static int test_conc68(MYSQL *my)
|
||||
|
||||
SKIP_CONNECTION_HANDLER;
|
||||
SKIP_SKYSQL;
|
||||
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
mysql= mysql_init(NULL);
|
||||
|
||||
@@ -420,9 +422,26 @@ static int test_mysql_insert_id(MYSQL *mysql)
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "drop table if exists t2");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "drop table if exists t3");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "drop table if exists t4");
|
||||
check_mysql_rc(rc, mysql);
|
||||
/* table without auto_increment column */
|
||||
rc= mysql_query(mysql, "create table t1 (f1 int, f2 varchar(255), key(f1))");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "create table t2 (f1 int not null primary key auto_increment, f2 varchar(255))");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "create table t3 (f1 int not null primary key auto_increment, f2 varchar(255)) engine=MyISAM");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "create table t4 (f1 int not null primary key "
|
||||
"auto_increment, f2 varchar(200), unique (f2)) engine=MyISAM");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "FLUSH TABLES");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "START TRANSACTION");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "insert into t1 values (1,'a')");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
@@ -440,17 +459,12 @@ static int test_mysql_insert_id(MYSQL *mysql)
|
||||
Test for bug #34889: mysql_client_test::test_mysql_insert_id test fails
|
||||
sporadically
|
||||
*/
|
||||
rc= mysql_query(mysql, "create table t2 (f1 int not null primary key auto_increment, f2 varchar(255))");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "insert into t2 values (null,'b')");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "insert into t1 select 5,'c'");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 0, "");
|
||||
rc= mysql_query(mysql, "drop table t2");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "insert into t1 select null,'d'");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
@@ -470,9 +484,7 @@ static int test_mysql_insert_id(MYSQL *mysql)
|
||||
FAIL_UNLESS(res == 400, "");
|
||||
|
||||
/* table with auto_increment column */
|
||||
rc= mysql_query(mysql, "create table t2 (f1 int not null primary key auto_increment, f2 varchar(255)) engine=MyISAM");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "insert into t2 values (1,'a')");
|
||||
rc= mysql_query(mysql, "insert into t3 values (1,'a')");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 1, "");
|
||||
@@ -482,11 +494,11 @@ static int test_mysql_insert_id(MYSQL *mysql)
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 0, "");
|
||||
|
||||
rc= mysql_query(mysql, "insert into t2 values (null,'b')");
|
||||
rc= mysql_query(mysql, "insert into t3 values (null,'b')");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 2, "");
|
||||
rc= mysql_query(mysql, "insert into t2 select 5,'c'");
|
||||
rc= mysql_query(mysql, "insert into t3 select 5,'c'");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
/*
|
||||
@@ -495,16 +507,16 @@ static int test_mysql_insert_id(MYSQL *mysql)
|
||||
0. We try to be consistent with INSERT VALUES.
|
||||
*/
|
||||
FAIL_UNLESS(res == 5, "");
|
||||
rc= mysql_query(mysql, "insert into t2 select null,'d'");
|
||||
rc= mysql_query(mysql, "insert into t3 select null,'d'");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 6, "");
|
||||
/* with more than one row */
|
||||
rc= mysql_query(mysql, "insert into t2 values (10,'a'),(11,'b')");
|
||||
rc= mysql_query(mysql, "insert into t3 values (10,'a'),(11,'b')");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 11, "");
|
||||
rc= mysql_query(mysql, "insert into t2 select 12,'a' union select 13,'b'");
|
||||
rc= mysql_query(mysql, "insert into t3 select 12,'a' union select 13,'b'");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
/*
|
||||
@@ -513,34 +525,34 @@ static int test_mysql_insert_id(MYSQL *mysql)
|
||||
return 0. We try to be consistent with INSERT VALUES.
|
||||
*/
|
||||
FAIL_UNLESS(res == 13, "");
|
||||
rc= mysql_query(mysql, "insert into t2 values (null,'a'),(null,'b')");
|
||||
rc= mysql_query(mysql, "insert into t3 values (null,'a'),(null,'b')");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 14, "");
|
||||
rc= mysql_query(mysql, "insert into t2 select null,'a' union select null,'b'");
|
||||
rc= mysql_query(mysql, "insert into t3 select null,'a' union select null,'b'");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 16, "");
|
||||
rc= mysql_query(mysql, "insert into t2 select 12,'a' union select 13,'b'");
|
||||
rc= mysql_query(mysql, "insert into t3 select 12,'a' union select 13,'b'");
|
||||
FAIL_IF(!rc, "Error expected");
|
||||
rc= mysql_query(mysql, "insert ignore into t2 select 12,'a' union select 13,'b'");
|
||||
rc= mysql_query(mysql, "insert ignore into t3 select 12,'a' union select 13,'b'");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 0, "");
|
||||
rc= mysql_query(mysql, "insert into t2 values (12,'a'),(13,'b')");
|
||||
rc= mysql_query(mysql, "insert into t3 values (12,'a'),(13,'b')");
|
||||
FAIL_IF(!rc, "Error expected");
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 0, "");
|
||||
rc= mysql_query(mysql, "insert ignore into t2 values (12,'a'),(13,'b')");
|
||||
rc= mysql_query(mysql, "insert ignore into t3 values (12,'a'),(13,'b')");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 0, "");
|
||||
/* mixing autogenerated and explicit values */
|
||||
rc= mysql_query(mysql, "insert into t2 values (null,'e'),(12,'a'),(13,'b')");
|
||||
rc= mysql_query(mysql, "insert into t3 values (null,'e'),(12,'a'),(13,'b')");
|
||||
FAIL_IF(!rc, "Error expected");
|
||||
rc= mysql_query(mysql, "insert into t2 values (null,'e'),(12,'a'),(13,'b'),(25,'g')");
|
||||
rc= mysql_query(mysql, "insert into t3 values (null,'e'),(12,'a'),(13,'b'),(25,'g')");
|
||||
FAIL_IF(!rc, "Error expected");
|
||||
rc= mysql_query(mysql, "insert into t2 values (null,last_insert_id(300))");
|
||||
rc= mysql_query(mysql, "insert into t3 values (null,last_insert_id(300))");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
/*
|
||||
@@ -550,20 +562,15 @@ static int test_mysql_insert_id(MYSQL *mysql)
|
||||
diag("res: %lld", res);
|
||||
FAIL_UNLESS(res == 20, "");
|
||||
/* If first autogenerated number fails and 2nd works: */
|
||||
rc= mysql_query(mysql, "drop table t2");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "create table t2 (f1 int not null primary key "
|
||||
"auto_increment, f2 varchar(200), unique (f2)) engine=MyISAM");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "insert into t2 values (null,'e')");
|
||||
rc= mysql_query(mysql, "insert into t4 values (null,'e')");
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 1, "");
|
||||
rc= mysql_query(mysql, "insert ignore into t2 values (null,'e'),(null,'a'),(null,'e')");
|
||||
rc= mysql_query(mysql, "insert ignore into t4 values (null,'e'),(null,'a'),(null,'e')");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 2, "");
|
||||
/* If autogenerated fails and explicit works: */
|
||||
rc= mysql_query(mysql, "insert ignore into t2 values (null,'e'),(12,'c'),(null,'d')");
|
||||
rc= mysql_query(mysql, "insert ignore into t4 values (null,'e'),(12,'c'),(null,'d')");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
/*
|
||||
@@ -572,24 +579,24 @@ static int test_mysql_insert_id(MYSQL *mysql)
|
||||
*/
|
||||
FAIL_UNLESS(res == 13, "");
|
||||
/* UPDATE may update mysql_insert_id() if it uses LAST_INSERT_ID(#) */
|
||||
rc= mysql_query(mysql, "update t2 set f1=14 where f1=12");
|
||||
rc= mysql_query(mysql, "update t4 set f1=14 where f1=12");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 0, "");
|
||||
rc= mysql_query(mysql, "update t2 set f1=0 where f1=14");
|
||||
rc= mysql_query(mysql, "update t4 set f1=0 where f1=14");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 0, "");
|
||||
rc= mysql_query(mysql, "update t2 set f2=last_insert_id(372) where f1=0");
|
||||
rc= mysql_query(mysql, "update t4 set f2=last_insert_id(372) where f1=0");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 372, "");
|
||||
/* check that LAST_INSERT_ID() does not update mysql_insert_id(): */
|
||||
rc= mysql_query(mysql, "insert into t2 values (null,'g')");
|
||||
rc= mysql_query(mysql, "insert into t4 values (null,'g')");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 15, "");
|
||||
rc= mysql_query(mysql, "update t2 set f2=(@li:=last_insert_id()) where f1=15");
|
||||
rc= mysql_query(mysql, "update t4 set f2=(@li:=last_insert_id()) where f1=15");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 0, "");
|
||||
@@ -598,13 +605,13 @@ static int test_mysql_insert_id(MYSQL *mysql)
|
||||
mysql_insert_id() returns the id of the row, instead of not being
|
||||
affected.
|
||||
*/
|
||||
rc= mysql_query(mysql, "insert into t2 values (null,@li) on duplicate key "
|
||||
rc= mysql_query(mysql, "insert into t4 values (null,@li) on duplicate key "
|
||||
"update f2=concat('we updated ',f2)");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_insert_id(mysql);
|
||||
FAIL_UNLESS(res == 15, "");
|
||||
|
||||
rc= mysql_query(mysql, "drop table t1,t2");
|
||||
rc= mysql_query(mysql, "drop table t1,t2,t3,t4");
|
||||
check_mysql_rc(rc, mysql);
|
||||
return OK;
|
||||
}
|
||||
|
@@ -535,6 +535,8 @@ static int test_bug30472(MYSQL *mysql)
|
||||
char character_set_results_4[MY_CS_NAME_SIZE];
|
||||
char collation_connnection_4[MY_CS_NAME_SIZE];
|
||||
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
if (mysql_get_server_version(mysql) < 50100 || !is_mariadb)
|
||||
{
|
||||
diag("Test requires MySQL Server version 5.1 or above");
|
||||
|
@@ -35,6 +35,7 @@ static int test_conc66(MYSQL *my)
|
||||
char query[1024];
|
||||
|
||||
SKIP_SKYSQL;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
if (!is_mariadb)
|
||||
return SKIP;
|
||||
@@ -91,6 +92,7 @@ static int test_bug20023(MYSQL *mysql)
|
||||
int rc;
|
||||
|
||||
SKIP_SKYSQL;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
if (!is_mariadb)
|
||||
return SKIP;
|
||||
@@ -391,7 +393,7 @@ static int test_bug31669(MYSQL *mysql)
|
||||
memset(buff, 'a', sizeof(buff));
|
||||
|
||||
rc= mysql_change_user(mysql, buff, buff, buff);
|
||||
FAIL_UNLESS(rc, "Error epected");
|
||||
FAIL_UNLESS(rc, "Error expected");
|
||||
|
||||
rc = mysql_change_user(mysql, username, password, schema);
|
||||
check_mysql_rc(rc, mysql);
|
||||
@@ -527,9 +529,11 @@ static int test_opt_reconnect(MYSQL *mysql)
|
||||
|
||||
static int test_compress(MYSQL *mysql)
|
||||
{
|
||||
// maxscale doesn't support compression
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
int rc;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
mysql= mysql_init(NULL);
|
||||
FAIL_IF(!mysql, "not enough memory");
|
||||
@@ -564,6 +568,7 @@ static int test_reconnect(MYSQL *mysql)
|
||||
MYSQL *mysql1;
|
||||
int rc;
|
||||
my_bool reconnect;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
mysql1= mysql_init(NULL);
|
||||
FAIL_IF(!mysql1, "not enough memory");
|
||||
@@ -582,7 +587,6 @@ static int test_reconnect(MYSQL *mysql)
|
||||
socketname, 0)))
|
||||
{
|
||||
diag("connection failed");
|
||||
mysql_close(mysql);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@@ -612,6 +616,7 @@ int test_conc21(MYSQL *mysql)
|
||||
char tmp[256];
|
||||
unsigned int check_server_version= 0;
|
||||
int major=0, minor= 0, patch=0;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
rc= mysql_query(mysql, "SELECT @@version");
|
||||
check_mysql_rc(rc, mysql);
|
||||
@@ -679,6 +684,7 @@ int test_connection_timeout2(MYSQL *unused __attribute__((unused)))
|
||||
MYSQL *mysql;
|
||||
|
||||
SKIP_SKYSQL;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
mysql= mysql_init(NULL);
|
||||
mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (unsigned int *)&timeout);
|
||||
@@ -746,6 +752,8 @@ static int test_conc118(MYSQL *mysql)
|
||||
{
|
||||
int rc;
|
||||
my_bool reconnect= 1;
|
||||
SKIP_SKYSQL;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect);
|
||||
|
||||
@@ -1140,6 +1148,7 @@ static int test_auth256(MYSQL *my)
|
||||
MYSQL_RES *res;
|
||||
my_ulonglong num_rows= 0;
|
||||
char query[1024];
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
if (IS_SKYSQL(hostname))
|
||||
return SKIP;
|
||||
@@ -1429,6 +1438,8 @@ static int test_conc315(MYSQL *mysql)
|
||||
{
|
||||
int rc;
|
||||
const char *csname;
|
||||
SKIP_SKYSQL;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
if (!is_mariadb)
|
||||
return SKIP;
|
||||
@@ -1566,6 +1577,9 @@ static int test_conc332(MYSQL *unused __attribute__((unused)))
|
||||
MYSQL *mysql= mysql_init(NULL);
|
||||
int server_status1, server_status2;
|
||||
|
||||
SKIP_SKYSQL;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, "utf8mb4");
|
||||
|
||||
my_test_connect(mysql, hostname, username, password, schema,
|
||||
@@ -1676,6 +1690,7 @@ static int test_conc366(MYSQL *mysql)
|
||||
MYSQL *my;
|
||||
|
||||
SKIP_SKYSQL;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
if (!is_mariadb)
|
||||
{
|
||||
@@ -1763,6 +1778,9 @@ static int test_conc443(MYSQL *my __attribute__((unused)))
|
||||
int rc;
|
||||
|
||||
MYSQL *mysql= mysql_init(NULL);
|
||||
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
mysql_options(mysql, MYSQL_INIT_COMMAND, "set @a:=3");
|
||||
mysql_options(mysql, MYSQL_OPT_RECONNECT, &x);
|
||||
|
||||
@@ -1803,6 +1821,9 @@ static int test_default_auth(MYSQL *my __attribute__((unused)))
|
||||
{
|
||||
MYSQL *mysql;
|
||||
|
||||
SKIP_SKYSQL;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
if (!is_mariadb)
|
||||
return SKIP;
|
||||
|
||||
|
@@ -157,15 +157,11 @@ static int test_server_errors(MYSQL *mysql)
|
||||
static int test_bug16143(MYSQL *mysql)
|
||||
{
|
||||
MYSQL_STMT *stmt;
|
||||
|
||||
stmt= mysql_stmt_init(mysql);
|
||||
FAIL_IF(!stmt, mysql_error(mysql));
|
||||
|
||||
/* Check mysql_stmt_sqlstate return "no error" */
|
||||
FAIL_UNLESS(strcmp(mysql_stmt_sqlstate(stmt), "00000") == 0, "Expected SQLstate 000000");
|
||||
|
||||
mysql_stmt_close(stmt);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -179,14 +175,18 @@ static int test_cuted_rows(MYSQL *mysql)
|
||||
if (!is_mariadb)
|
||||
return SKIP;
|
||||
|
||||
mysql_query(mysql, "DROP TABLE if exists t1");
|
||||
rc= mysql_query(mysql, "DROP TABLE if exists t1");
|
||||
check_mysql_rc(rc, mysql);
|
||||
mysql_query(mysql, "DROP TABLE if exists t2");
|
||||
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "CREATE TABLE t1(c1 tinyint)");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "CREATE TABLE t2(c1 int not null)");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "FLUSH TABLES");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "START TRANSACTION");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "INSERT INTO t1 values(10), (NULL), (NULL)");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
@@ -39,6 +39,7 @@ static int test_bug28075(MYSQL *mysql)
|
||||
int rc;
|
||||
|
||||
SKIP_SKYSQL;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
rc= mysql_dump_debug_info(mysql);
|
||||
check_mysql_rc(rc, mysql);
|
||||
@@ -173,6 +174,7 @@ static int bug31418_impl()
|
||||
static int test_bug31418(MYSQL *unused __attribute__((unused)))
|
||||
{
|
||||
int i;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
if (!is_mariadb)
|
||||
return SKIP;
|
||||
@@ -811,7 +813,9 @@ static int test_conc49(MYSQL *mysql)
|
||||
int i;
|
||||
FILE *fp;
|
||||
|
||||
SKIP_LOAD_INFILE_DISABLE;
|
||||
SKIP_SKYSQL;
|
||||
|
||||
fp= fopen("./sample.csv", "w");
|
||||
for (i=1; i < 4; i++)
|
||||
fprintf(fp, "\"%d\", \"%d\", \"%d\"\r\n", i, i, i);
|
||||
@@ -985,6 +989,7 @@ static int test_conc117(MYSQL *unused __attribute__((unused)))
|
||||
{
|
||||
my_bool reconnect= 1;
|
||||
MYSQL *my= mysql_init(NULL);
|
||||
SKIP_MAXSCALE;
|
||||
FAIL_IF(!my_test_connect(my, hostname, username, password, schema,
|
||||
port, socketname, 0), mysql_error(my));
|
||||
|
||||
@@ -1002,6 +1007,7 @@ static int test_read_timeout(MYSQL *unused __attribute__((unused)))
|
||||
{
|
||||
int timeout= 5, rc;
|
||||
MYSQL *my= mysql_init(NULL);
|
||||
SKIP_MAXSCALE;
|
||||
mysql_options(my, MYSQL_OPT_READ_TIMEOUT, &timeout);
|
||||
FAIL_IF(!my_test_connect(my, hostname, username, password, schema,
|
||||
port, socketname, 0), mysql_error(my));
|
||||
@@ -1206,12 +1212,12 @@ static int test_server_status(MYSQL *mysql)
|
||||
{
|
||||
int rc;
|
||||
unsigned int server_status;
|
||||
MYSQL_STMT *stmt;
|
||||
// MYSQL_STMT *stmt;
|
||||
|
||||
if (mysql_get_server_version(mysql) < 100200)
|
||||
return SKIP;
|
||||
|
||||
stmt= mysql_stmt_init(mysql);
|
||||
// stmt= mysql_stmt_init(mysql);
|
||||
|
||||
rc= mysql_autocommit(mysql, 1);
|
||||
mariadb_get_infov(mysql, MARIADB_CONNECTION_SERVER_STATUS, &server_status);
|
||||
@@ -1252,7 +1258,7 @@ static int test_server_status(MYSQL *mysql)
|
||||
rc= mysql_select_db(mysql, schema);
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
mysql_stmt_close(stmt);
|
||||
// mysql_stmt_close(stmt);
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -1478,7 +1484,7 @@ struct my_tests_st my_tests[] = {
|
||||
{"test_conc117", test_conc117, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc_114", test_conc_114, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_connect_attrs", test_connect_attrs, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc49", test_conc49, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc49", test_conc49, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
{"test_bug28075", test_bug28075, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_bug28505", test_bug28505, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_debug_example", test_debug_example, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
|
@@ -73,6 +73,21 @@ if (IS_SKYSQL(hostname)) \
|
||||
#define SKIP_NOTLS
|
||||
#endif
|
||||
|
||||
#define IS_MAXSCALE() (getenv("MAXSCALE_TEST_DISABLE")!=NULL)
|
||||
#define SKIP_MAXSCALE \
|
||||
if (IS_MAXSCALE()) \
|
||||
{ \
|
||||
diag("test disabled with maxscale"); \
|
||||
return SKIP; \
|
||||
}
|
||||
|
||||
#define SKIP_LOAD_INFILE_DISABLE \
|
||||
if (!((mysql->server_capabilities & CLIENT_LOCAL_FILES) && \
|
||||
(mysql->options.client_flag & CLIENT_LOCAL_FILES))) { \
|
||||
diag("Load local infile not supported"); \
|
||||
return SKIP; \
|
||||
}
|
||||
|
||||
#define MAX_KEY MAX_INDEXES
|
||||
#define MAX_KEY_LENGTH_DECIMAL_WIDTH 4 /* strlen("4096") */
|
||||
|
||||
@@ -183,6 +198,7 @@ static const char *schema = 0;
|
||||
static char *hostname = 0;
|
||||
static char *password = 0;
|
||||
static unsigned int port = 0;
|
||||
static unsigned int ssl_port = 0;
|
||||
static char *socketname = 0;
|
||||
static char *username = 0;
|
||||
static int force_tls= 0;
|
||||
@@ -423,6 +439,7 @@ void get_options(int argc, char **argv)
|
||||
break;
|
||||
case 'P':
|
||||
port= atoi(optarg);
|
||||
ssl_port=port;
|
||||
break;
|
||||
case 'S':
|
||||
socketname= optarg;
|
||||
@@ -518,7 +535,7 @@ MYSQL *test_connect(struct my_tests_st *test)
|
||||
static int reset_connection(MYSQL *mysql) {
|
||||
int rc;
|
||||
|
||||
if (is_mariadb)
|
||||
if (is_mariadb && !IS_MAXSCALE())
|
||||
rc= mysql_change_user(mysql, username, password, schema);
|
||||
else
|
||||
rc= mysql_reset_connection(mysql);
|
||||
@@ -565,6 +582,15 @@ void get_envvars() {
|
||||
port= atoi(envvar);
|
||||
diag("port: %d", port);
|
||||
}
|
||||
if (!ssl_port)
|
||||
{
|
||||
if ((envvar= getenv("MYSQL_TEST_SSL_PORT")))
|
||||
ssl_port= atoi(envvar);
|
||||
else
|
||||
ssl_port = port;
|
||||
diag("ssl_port: %d", ssl_port);
|
||||
}
|
||||
|
||||
if (!force_tls && (envvar= getenv("MYSQL_TEST_TLS")))
|
||||
force_tls= atoi(envvar);
|
||||
if (!socketname)
|
||||
|
@@ -56,6 +56,8 @@ static int test_conc83(MYSQL *unused __attribute__((unused)))
|
||||
|
||||
const char *query= "SELECT 1,2,3 FROM DUAL";
|
||||
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
stmt= mysql_stmt_init(mysql);
|
||||
|
||||
mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect);
|
||||
@@ -458,6 +460,12 @@ static int test_prepare_syntax(MYSQL *mysql)
|
||||
"id int, name varchar(50), extra int)");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "FLUSH TABLES");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "START TRANSACTION");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
strcpy(query, "INSERT INTO test_prepare_syntax VALUES(?");
|
||||
stmt= mysql_stmt_init(mysql);
|
||||
FAIL_IF(!stmt, mysql_error(mysql));
|
||||
@@ -2537,6 +2545,12 @@ static int test_pure_coverage(MYSQL *mysql)
|
||||
rc= mysql_query(mysql, "CREATE TABLE test_pure(c1 int, c2 varchar(20))");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "FLUSH TABLES");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "START TRANSACTION");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
stmt= mysql_stmt_init(mysql);
|
||||
FAIL_IF(!stmt, mysql_error(mysql));
|
||||
rc= mysql_stmt_prepare(stmt, SL("insert into test_pure(c67788) values(10)"));
|
||||
@@ -3805,6 +3819,12 @@ static int test_null(MYSQL *mysql)
|
||||
rc= mysql_query(mysql, "CREATE TABLE test_null(col1 int, col2 varchar(50))");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "FLUSH TABLES");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "START TRANSACTION");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
/* insert by prepare, wrong column name */
|
||||
strcpy(query, "INSERT INTO test_null(col3, col2) VALUES(?, ?)");
|
||||
stmt= mysql_stmt_init(mysql);
|
||||
|
@@ -522,6 +522,8 @@ static int test_bug12744(MYSQL *mysql)
|
||||
MYSQL_STMT *stmt = NULL;
|
||||
int rc;
|
||||
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
stmt = mysql_stmt_init(mysql);
|
||||
FAIL_IF(!stmt, mysql_error(mysql));
|
||||
rc= mysql_stmt_prepare(stmt, "SET @a:=1", 9);
|
||||
@@ -918,7 +920,7 @@ static int test_bug1664(MYSQL *mysql)
|
||||
|
||||
/*
|
||||
Now we are sending other long data. It should not be
|
||||
concatened to previous.
|
||||
concatenated to previous.
|
||||
*/
|
||||
|
||||
data= (char *)"SomeOtherData";
|
||||
@@ -2067,6 +2069,7 @@ static int test_bug36004(MYSQL *mysql)
|
||||
{
|
||||
int rc, warning_count= 0;
|
||||
MYSQL_STMT *stmt;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
|
||||
if (mysql_get_server_version(mysql) < 60000) {
|
||||
@@ -2729,6 +2732,7 @@ static int test_bug5315(MYSQL *mysql)
|
||||
MYSQL_STMT *stmt;
|
||||
const char *stmt_text;
|
||||
int rc;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
if (!is_mariadb)
|
||||
return SKIP;
|
||||
@@ -3037,7 +3041,6 @@ static int test_bug7990(MYSQL *mysql)
|
||||
*/
|
||||
FAIL_UNLESS(rc && mysql_stmt_errno(stmt) && mysql_errno(mysql), "Error expected");
|
||||
mysql_stmt_close(stmt);
|
||||
FAIL_UNLESS(!mysql_errno(mysql), "errno != 0");
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -3053,7 +3056,7 @@ static int test_bug8330(MYSQL *mysql)
|
||||
long lval[2]= {1,2};
|
||||
|
||||
stmt_text= "drop table if exists t1";
|
||||
/* in case some previos test failed */
|
||||
/* in case some previous test failed */
|
||||
rc= mysql_real_query(mysql, SL(stmt_text));
|
||||
check_mysql_rc(rc, mysql);
|
||||
stmt_text= "create table t1 (a int, b int)";
|
||||
@@ -3785,6 +3788,7 @@ static int test_bug53311(MYSQL *mysql)
|
||||
MYSQL_STMT *stmt;
|
||||
int i;
|
||||
const char *query= "INSERT INTO bug53311 VALUES (1)";
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
rc= mysql_options(mysql, MYSQL_OPT_RECONNECT, "1");
|
||||
check_mysql_rc(rc, mysql);
|
||||
@@ -4547,7 +4551,7 @@ static int test_conc217(MYSQL *mysql)
|
||||
FAIL_IF(rc==0, "Expected error\n");
|
||||
rc= mysql_query(mysql, "drop table if exists t_count");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_stmt_close(stmt);
|
||||
mysql_stmt_close(stmt);
|
||||
check_mysql_rc(rc, mysql);
|
||||
return OK;
|
||||
}
|
||||
@@ -4908,7 +4912,7 @@ static int test_conc334(MYSQL *mysql)
|
||||
result= mysql_stmt_result_metadata(stmt);
|
||||
if (!result)
|
||||
{
|
||||
diag("Coudn't retrieve result set");
|
||||
diag("Couldn't retrieve result set");
|
||||
mysql_stmt_close(stmt);
|
||||
return FAIL;
|
||||
}
|
||||
|
@@ -949,6 +949,9 @@ DROP TABLE IF EXISTS test_multi_tab";
|
||||
uint rows[]= {0, 0, 2, 1, 3, 2, 2, 1, 1, 0, 0, 1, 0};
|
||||
my_bool reconnect= 1;
|
||||
|
||||
SKIP_SKYSQL;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
/*
|
||||
First test that we get an error for multi statements
|
||||
(Because default connection is not opened with CLIENT_MULTI_STATEMENTS)
|
||||
|
@@ -140,7 +140,7 @@ static int test_ssl(MYSQL *mysql)
|
||||
create_ssl_user("ssluser", 0);
|
||||
|
||||
FAIL_IF(!mysql_real_connect(my, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0), mysql_error(my));
|
||||
ssl_port, socketname, 0), mysql_error(my));
|
||||
|
||||
mariadb_get_infov(my, MARIADB_CONNECTION_TLS_VERSION_ID, &iversion);
|
||||
diag("iversion: %d", iversion);
|
||||
@@ -221,7 +221,7 @@ static int test_ssl_cipher(MYSQL *unused __attribute__((unused)))
|
||||
mysql_ssl_set(my,0, 0, sslca, 0, 0);
|
||||
|
||||
FAIL_IF(!mysql_real_connect(my, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0), mysql_error(my));
|
||||
ssl_port, socketname, 0), mysql_error(my));
|
||||
|
||||
rc= mysql_query(my, "SHOW session status like 'Ssl_version'");
|
||||
check_mysql_rc(rc, my);
|
||||
@@ -254,7 +254,7 @@ static int test_conc95(MYSQL *unused __attribute__((unused)))
|
||||
NULL);
|
||||
|
||||
if (!mysql_real_connect(mysql, hostname, "ssluser1", sslpw, schema,
|
||||
port, socketname, 0))
|
||||
ssl_port, socketname, 0))
|
||||
{
|
||||
diag("could not establish x509 connection. Error: %s", mysql_error(mysql));
|
||||
mysql_close(mysql);
|
||||
@@ -283,7 +283,7 @@ static int test_multi_ssl_connections(MYSQL *unused __attribute__((unused)))
|
||||
my= mysql_init(NULL);
|
||||
FAIL_IF(!my,"mysql_init() failed");
|
||||
FAIL_IF(!mysql_real_connect(my, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0), mysql_error(my));
|
||||
ssl_port, socketname, 0), mysql_error(my));
|
||||
|
||||
rc= mysql_query(my, "SHOW STATUS LIKE 'Ssl_accepts'");
|
||||
check_mysql_rc(rc, my);
|
||||
@@ -301,7 +301,7 @@ static int test_multi_ssl_connections(MYSQL *unused __attribute__((unused)))
|
||||
mysql_ssl_set(mysql[i], 0, 0, sslca, 0, 0);
|
||||
|
||||
mysql_real_connect(mysql[i], hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0);
|
||||
ssl_port, socketname, 0);
|
||||
if (mysql_errno(mysql[i]))
|
||||
{
|
||||
diag("loop: %d error: %d %s", i, mysql_errno(mysql[i]), mysql_error(mysql[i]));
|
||||
@@ -345,7 +345,7 @@ DWORD WINAPI ssl_thread(void *dummy)
|
||||
mysql_ssl_set(mysql, 0, 0, sslca, 0, 0);
|
||||
|
||||
if(!mysql_real_connect(mysql, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0))
|
||||
ssl_port, socketname, 0))
|
||||
{
|
||||
diag(">Error: %s", mysql_error(mysql));
|
||||
goto end;
|
||||
@@ -435,7 +435,7 @@ static int test_phpbug51647(MYSQL *unused __attribute__((unused)))
|
||||
sslca, 0, 0);
|
||||
|
||||
FAIL_IF(!mysql_real_connect(mysql, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0), mysql_error(mysql));
|
||||
ssl_port, socketname, 0), mysql_error(mysql));
|
||||
diag("%s", mysql_get_ssl_cipher(mysql));
|
||||
mysql_close(mysql);
|
||||
|
||||
@@ -459,7 +459,7 @@ static int test_password_protected(MYSQL *unused __attribute__((unused)))
|
||||
mysql_options(mysql, MARIADB_OPT_TLS_PASSPHRASE, "qwerty");
|
||||
|
||||
FAIL_IF(!mysql_real_connect(mysql, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0), mysql_error(mysql));
|
||||
ssl_port, socketname, 0), mysql_error(mysql));
|
||||
diag("%s", mysql_get_ssl_cipher(mysql));
|
||||
mysql_close(mysql);
|
||||
|
||||
@@ -480,7 +480,7 @@ static int test_conc50(MYSQL *unused __attribute__((unused)))
|
||||
mysql_ssl_set(mysql, NULL, NULL, "./non_exisiting_cert.pem", NULL, NULL);
|
||||
|
||||
mysql_real_connect(mysql, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0);
|
||||
ssl_port, socketname, 0);
|
||||
diag("Error: %d %s", mysql_errno(mysql), mysql_error(mysql));
|
||||
FAIL_IF(mysql_errno(mysql) != 2026, "Expected errno 2026");
|
||||
mysql_close(mysql);
|
||||
@@ -509,7 +509,7 @@ static int test_conc50_1(MYSQL *unused __attribute__((unused)))
|
||||
mysql_ssl_set(mysql, NULL, NULL, sslca, NULL, NULL);
|
||||
|
||||
mysql_real_connect(mysql, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0);
|
||||
ssl_port, socketname, 0);
|
||||
if (mysql_errno(mysql))
|
||||
diag("Error: %d %s", mysql_errno(mysql), mysql_error(mysql));
|
||||
FAIL_IF(mysql_errno(mysql), "No error expected");
|
||||
@@ -532,7 +532,7 @@ static int test_conc50_2(MYSQL *unused __attribute__((unused)))
|
||||
mysql_ssl_set(mysql, NULL, NULL, "./non_exisiting_cert.pem", NULL, NULL);
|
||||
|
||||
mysql_real_connect(mysql, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0);
|
||||
ssl_port, socketname, 0);
|
||||
FAIL_IF(mysql_errno(mysql) != 2026, "Expected errno 2026");
|
||||
mysql_close(mysql);
|
||||
|
||||
@@ -555,7 +555,7 @@ static int test_conc127(MYSQL *unused __attribute__((unused)))
|
||||
mysql_ssl_set(mysql, NULL, NULL, "./non_exisiting.pem", NULL, NULL);
|
||||
|
||||
mysql_real_connect(mysql, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0);
|
||||
ssl_port, socketname, 0);
|
||||
diag("Error: %s", mysql_error(mysql));
|
||||
FAIL_IF(mysql_errno(mysql) == 0, "Error expected (invalid certificate)");
|
||||
mysql_close(mysql);
|
||||
@@ -576,7 +576,7 @@ static int test_conc50_3(MYSQL *unused __attribute__((unused)))
|
||||
FAIL_IF(!mysql, "Can't allocate memory");
|
||||
|
||||
mysql_real_connect(mysql, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0);
|
||||
ssl_port, socketname, 0);
|
||||
FAIL_IF(!mysql_errno(mysql), "Error expected, SSL connection required!");
|
||||
mysql_close(mysql);
|
||||
|
||||
@@ -586,7 +586,7 @@ static int test_conc50_3(MYSQL *unused __attribute__((unused)))
|
||||
mysql_ssl_set(mysql, NULL, NULL, sslca, NULL, NULL);
|
||||
|
||||
mysql_real_connect(mysql, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0);
|
||||
ssl_port, socketname, 0);
|
||||
diag("Error: %s<", mysql_error(mysql));
|
||||
FAIL_IF(mysql_errno(mysql), "No error expected");
|
||||
mysql_close(mysql);
|
||||
@@ -607,7 +607,7 @@ static int test_conc50_4(MYSQL *unused __attribute__((unused)))
|
||||
mysql_ssl_set(mysql, NULL, sslca, NULL, NULL, NULL);
|
||||
|
||||
mysql_real_connect(mysql, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0);
|
||||
ssl_port, socketname, 0);
|
||||
FAIL_IF(!mysql_errno(mysql) , "Error expected");
|
||||
mysql_close(mysql);
|
||||
|
||||
@@ -634,7 +634,7 @@ static int verify_ssl_server_cert(MYSQL *unused __attribute__((unused)))
|
||||
mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, &verify);
|
||||
|
||||
mysql_real_connect(mysql, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0);
|
||||
ssl_port, socketname, 0);
|
||||
|
||||
FAIL_IF(!mysql_errno(mysql), "Expected error");
|
||||
diag("Error (expected): %s", mysql_error(mysql));
|
||||
@@ -656,7 +656,7 @@ static int test_bug62743(MYSQL *unused __attribute__((unused)))
|
||||
mysql_ssl_set(mysql, "dummykey", NULL, NULL, NULL, NULL);
|
||||
|
||||
mysql_real_connect(mysql, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0);
|
||||
ssl_port, socketname, 0);
|
||||
diag("Error: %s", mysql_error(mysql));
|
||||
FAIL_IF(mysql_errno(mysql) != 2026, "Expected errno 2026");
|
||||
mysql_close(mysql);
|
||||
@@ -667,7 +667,7 @@ static int test_bug62743(MYSQL *unused __attribute__((unused)))
|
||||
mysql_ssl_set(mysql, sslkey, NULL, NULL, NULL, NULL);
|
||||
|
||||
mysql_real_connect(mysql, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0);
|
||||
ssl_port, socketname, 0);
|
||||
diag("Error with key: %s", mysql_error(mysql));
|
||||
FAIL_IF(mysql_errno(mysql) != 2026, "Expected errno 2026");
|
||||
mysql_close(mysql);
|
||||
@@ -679,7 +679,7 @@ static int test_bug62743(MYSQL *unused __attribute__((unused)))
|
||||
sslcert, NULL, NULL, NULL);
|
||||
|
||||
mysql_real_connect(mysql, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0);
|
||||
ssl_port, socketname, 0);
|
||||
FAIL_IF(mysql_errno(mysql) != 0, "Expected no error");
|
||||
mysql_close(mysql);
|
||||
|
||||
@@ -689,7 +689,7 @@ static int test_bug62743(MYSQL *unused __attribute__((unused)))
|
||||
mysql_ssl_set(mysql, sslkey, "blablubb", NULL, NULL, NULL);
|
||||
|
||||
mysql_real_connect(mysql, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0);
|
||||
ssl_port, socketname, 0);
|
||||
diag("Error with cert: %s", mysql_error(mysql));
|
||||
FAIL_IF(mysql_errno(mysql) == 0, "Expected error");
|
||||
mysql_close(mysql);
|
||||
@@ -716,7 +716,7 @@ DWORD WINAPI thread_conc102(void)
|
||||
mysql_ssl_set(mysql,0, 0, sslca, 0, 0);
|
||||
|
||||
if(!mysql_real_connect(mysql, hostname, username, password, schema,
|
||||
port, socketname, 0))
|
||||
ssl_port, socketname, 0))
|
||||
{
|
||||
diag(">Error: %s", mysql_error(mysql));
|
||||
goto end;
|
||||
@@ -813,12 +813,12 @@ static int test_ssl_fp(MYSQL *unused __attribute__((unused)))
|
||||
mysql_options(my, MARIADB_OPT_SSL_FP, bad_cert_finger_print);
|
||||
|
||||
FAIL_IF(mysql_real_connect(my, hostname, username, password, schema,
|
||||
port, socketname, 0), mysql_error(my));
|
||||
ssl_port, socketname, 0), mysql_error(my));
|
||||
|
||||
mysql_options(my, MARIADB_OPT_SSL_FP, ssl_cert_finger_print);
|
||||
|
||||
FAIL_IF(!mysql_real_connect(my, hostname, username, password, schema,
|
||||
port, socketname, 0), mysql_error(my));
|
||||
ssl_port, socketname, 0), mysql_error(my));
|
||||
|
||||
FAIL_IF(check_cipher(my) != 0, "Invalid cipher");
|
||||
|
||||
@@ -854,7 +854,7 @@ static int test_ssl_fp_list(MYSQL *unused __attribute__((unused)))
|
||||
mysql_options(my, MARIADB_OPT_SSL_FP_LIST, CERT_PATH "/server-cert.sha1");
|
||||
|
||||
if(!mysql_real_connect(my, hostname, username, password, schema,
|
||||
port, socketname, 0))
|
||||
ssl_port, socketname, 0))
|
||||
{
|
||||
diag("Error: %s", mysql_error(my));
|
||||
mysql_close(my);
|
||||
@@ -880,7 +880,7 @@ static int test_ssl_version(MYSQL *unused __attribute__((unused)))
|
||||
|
||||
mysql_ssl_set(my,0, 0, sslca, 0, 0);
|
||||
FAIL_IF(!mysql_real_connect(my, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0), mysql_error(my));
|
||||
ssl_port, socketname, 0), mysql_error(my));
|
||||
|
||||
diag("cipher: %s", mysql_get_ssl_cipher(my));
|
||||
mariadb_get_infov(my, MARIADB_CONNECTION_TLS_VERSION_ID, &iversion);
|
||||
@@ -911,7 +911,7 @@ static int test_schannel_cipher(MYSQL *unused __attribute__((unused)))
|
||||
mysql_ssl_set(my,0, 0, sslca, 0, 0);
|
||||
mysql_options(my, MARIADB_OPT_TLS_CIPHER_STRENGTH, &cipher_strength);
|
||||
FAIL_IF(!mysql_real_connect(my, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0), mysql_error(my));
|
||||
ssl_port, socketname, 0), mysql_error(my));
|
||||
|
||||
diag("cipher: %s", mysql_get_ssl_cipher(my));
|
||||
|
||||
@@ -969,7 +969,7 @@ static int test_cipher_mapping(MYSQL *unused __attribute__((unused)))
|
||||
|
||||
mysql->options.use_ssl= 1;
|
||||
FAIL_IF(!mysql_real_connect(mysql, hostname, username, password, schema,
|
||||
port, socketname, 0), mysql_error(mysql));
|
||||
ssl_port, socketname, 0), mysql_error(mysql));
|
||||
if (!(cipher= mysql_get_ssl_cipher(mysql)) ||
|
||||
strcmp(ciphers[i], cipher) != 0)
|
||||
{
|
||||
@@ -1038,14 +1038,14 @@ static int test_openssl_1(MYSQL *mysql)
|
||||
my= mysql_init(NULL);
|
||||
mysql_ssl_set(my, NULL, NULL, NULL, NULL, "AES128-SHA");
|
||||
FAIL_IF(!mysql_real_connect(my, hostname, "ssluser1", NULL, schema,
|
||||
port, socketname, 0), mysql_error(my));
|
||||
ssl_port, socketname, 0), mysql_error(my));
|
||||
FAIL_IF(!mysql_get_ssl_cipher(my), "No TLS connection");
|
||||
mysql_close(my);
|
||||
|
||||
my= mysql_init(NULL);
|
||||
mysql_options(my, MYSQL_OPT_SSL_ENFORCE, &val);
|
||||
FAIL_IF(!mysql_real_connect(my, hostname, "ssluser1", NULL, schema,
|
||||
port, socketname, 0), mysql_error(my));
|
||||
ssl_port, socketname, 0), mysql_error(my));
|
||||
FAIL_IF(!mysql_get_ssl_cipher(my), "No TLS connection");
|
||||
mysql_close(my);
|
||||
|
||||
@@ -1059,7 +1059,7 @@ static int test_openssl_1(MYSQL *mysql)
|
||||
my= mysql_init(NULL);
|
||||
mysql_options(my, MYSQL_OPT_SSL_ENFORCE, &val);
|
||||
mysql_real_connect(my, hostname, "ssluser2", NULL, schema,
|
||||
port, socketname, 0);
|
||||
ssl_port, socketname, 0);
|
||||
if (!mysql_error(my) &&
|
||||
strcmp(mysql_get_ssl_cipher(my), "AES256-SHA"))
|
||||
{
|
||||
@@ -1075,7 +1075,7 @@ static int test_openssl_1(MYSQL *mysql)
|
||||
my= mysql_init(NULL);
|
||||
mysql_ssl_set(my, NULL, NULL, NULL, NULL, "AES256-SHA");
|
||||
FAIL_IF(!mysql_real_connect(my, hostname, "ssluser2", NULL, schema,
|
||||
port, socketname, 0), mysql_error(my));
|
||||
ssl_port, socketname, 0), mysql_error(my));
|
||||
FAIL_IF(strcmp("AES256-SHA", mysql_get_ssl_cipher(my)) != 0, "expected cipher AES256-SHA");
|
||||
mysql_close(my);
|
||||
}
|
||||
@@ -1085,7 +1085,7 @@ static int test_openssl_1(MYSQL *mysql)
|
||||
my= mysql_init(NULL);
|
||||
mysql_ssl_set(my, NULL, NULL, NULL, NULL, "AES128-SHA");
|
||||
FAIL_IF(mysql_real_connect(my, hostname, "ssluser2", NULL, schema,
|
||||
port, socketname, 0), "Error expected");
|
||||
ssl_port, socketname, 0), "Error expected");
|
||||
mysql_close(my);
|
||||
|
||||
|
||||
@@ -1100,7 +1100,7 @@ static int test_openssl_1(MYSQL *mysql)
|
||||
my= mysql_init(NULL);
|
||||
mysql_ssl_set(my, NULL, NULL, NULL, NULL, "AES256-SHA");
|
||||
FAIL_IF(mysql_real_connect(my, hostname, "ssluser3", NULL, schema,
|
||||
port, socketname, 0), "Error expected");
|
||||
ssl_port, socketname, 0), "Error expected");
|
||||
mysql_close(my);
|
||||
|
||||
/* ssluser3 connect with cipher and certs */
|
||||
@@ -1111,7 +1111,7 @@ static int test_openssl_1(MYSQL *mysql)
|
||||
NULL,
|
||||
"AES256-SHA");
|
||||
FAIL_IF(!mysql_real_connect(my, hostname, "ssluser3", NULL, schema,
|
||||
port, socketname, 0), mysql_error(my));
|
||||
ssl_port, socketname, 0), mysql_error(my));
|
||||
|
||||
mysql_close(my);
|
||||
|
||||
@@ -1124,7 +1124,7 @@ static int test_openssl_1(MYSQL *mysql)
|
||||
my= mysql_init(NULL);
|
||||
mysql_ssl_set(my, NULL, NULL, NULL, NULL, "AES256-SHA");
|
||||
FAIL_IF(mysql_real_connect(my, hostname, "ssluser4", NULL, schema,
|
||||
port, socketname, 0), "Error expected");
|
||||
ssl_port, socketname, 0), "Error expected");
|
||||
mysql_close(my);
|
||||
|
||||
/* ssluser4 connect with cipher and certs */
|
||||
@@ -1135,7 +1135,7 @@ static int test_openssl_1(MYSQL *mysql)
|
||||
NULL,
|
||||
"AES256-SHA");
|
||||
FAIL_IF(!mysql_real_connect(my, hostname, "ssluser4", NULL, schema,
|
||||
port, socketname, 0), mysql_error(my));
|
||||
ssl_port, socketname, 0), mysql_error(my));
|
||||
mysql_close(my);
|
||||
}
|
||||
diag("drop users");
|
||||
@@ -1163,7 +1163,7 @@ static int test_ssl_timeout(MYSQL *unused __attribute__((unused)))
|
||||
mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, &read_timeout);
|
||||
mysql->options.use_ssl= 1;
|
||||
FAIL_IF(!mysql_real_connect(mysql, hostname, username, password, schema,
|
||||
port, socketname, 0), mysql_error(mysql));
|
||||
ssl_port, socketname, 0), mysql_error(mysql));
|
||||
diag("cipher: %s\n", mysql_get_ssl_cipher(mysql));
|
||||
rc= mysql_query(mysql, "SELECT SLEEP(600)");
|
||||
if (!rc)
|
||||
@@ -1200,7 +1200,7 @@ static int test_conc286(MYSQL *unused __attribute__((unused)))
|
||||
mysql_options(my, MARIADB_OPT_SSL_FP, ssl_cert_finger_print);
|
||||
|
||||
FAIL_IF(!mysql_real_connect(my, hostname, username, password, schema,
|
||||
port, socketname, 0), mysql_error(my));
|
||||
ssl_port, socketname, 0), mysql_error(my));
|
||||
|
||||
FAIL_IF(check_cipher(my) != 0, "Invalid cipher");
|
||||
|
||||
@@ -1276,7 +1276,7 @@ static int test_mdev14101(MYSQL *my __attribute__((unused)))
|
||||
mysql_options(mysql, MYSQL_OPT_SSL_ENFORCE, &val);
|
||||
mysql_options(mysql, MARIADB_OPT_TLS_VERSION, combinations[i].opt_tls_version);
|
||||
FAIL_IF(!mysql_real_connect(mysql, hostname, username, password, schema,
|
||||
port, socketname, 0), mysql_error(mysql));
|
||||
ssl_port, socketname, 0), mysql_error(mysql));
|
||||
mariadb_get_infov(mysql, MARIADB_CONNECTION_TLS_VERSION, &tls_version);
|
||||
diag("options: %s", combinations[i].opt_tls_version);
|
||||
diag("protocol: %s expected: %s", tls_version, combinations[i].expected);
|
||||
@@ -1296,7 +1296,7 @@ static int test_conc386(MYSQL *mysql)
|
||||
NULL,
|
||||
NULL);
|
||||
FAIL_IF(!mysql_real_connect(mysql, hostname, username, password, schema,
|
||||
port, socketname, 0), mysql_error(mysql));
|
||||
ssl_port, socketname, 0), mysql_error(mysql));
|
||||
FAIL_IF(check_cipher(mysql) != 0, "Invalid cipher");
|
||||
mysql_close(mysql);
|
||||
return OK;
|
||||
@@ -1316,7 +1316,7 @@ static int test_ssl_verify(MYSQL *my __attribute__((unused)))
|
||||
mysql_options(mysql, MYSQL_OPT_SSL_ENFORCE, &enforce);
|
||||
mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, &verify);
|
||||
FAIL_IF(mysql_real_connect(mysql, hostname, username, password, schema,
|
||||
port, socketname, 0), "Error expected");
|
||||
ssl_port, socketname, 0), "Error expected");
|
||||
diag("error expected: %s\n", mysql_error(mysql));
|
||||
mysql_close(mysql);
|
||||
|
||||
@@ -1338,13 +1338,13 @@ static int test_ssl_verify(MYSQL *my __attribute__((unused)))
|
||||
mysql_ssl_set(mysql,0, 0, sslca, 0, 0);
|
||||
mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, &verify);
|
||||
FAIL_IF(!mysql_real_connect(mysql, hostname, username, password, schema,
|
||||
port, socketname, 0), mysql_error(mysql));
|
||||
ssl_port, socketname, 0), mysql_error(mysql));
|
||||
mysql_close(mysql);
|
||||
|
||||
mysql= mysql_init(NULL);
|
||||
mysql_options(mysql, MYSQL_OPT_SSL_ENFORCE, &enforce);
|
||||
FAIL_IF(!mysql_real_connect(mysql, hostname, username, password, schema,
|
||||
port, socketname, 0), mysql_error(mysql));
|
||||
ssl_port, socketname, 0), mysql_error(mysql));
|
||||
|
||||
diag("cipher: %s", mysql_get_ssl_cipher(mysql));
|
||||
mysql_close(mysql);
|
||||
|
@@ -161,7 +161,7 @@ static int test_view_2where(MYSQL *mysql)
|
||||
MYSQL_STMT *stmt;
|
||||
int rc, i;
|
||||
MYSQL_BIND my_bind[8];
|
||||
char parms[8][100];
|
||||
char params[8][100];
|
||||
ulong length[8];
|
||||
const char *query=
|
||||
"select relid, report, handle, log_group, username, variant, type, "
|
||||
@@ -208,9 +208,9 @@ static int test_view_2where(MYSQL *mysql)
|
||||
check_mysql_rc(rc, mysql);
|
||||
memset(my_bind, '\0', sizeof(MYSQL_BIND));
|
||||
for (i=0; i < 8; i++) {
|
||||
strcpy(parms[i], "1");
|
||||
strcpy(params[i], "1");
|
||||
my_bind[i].buffer_type = MYSQL_TYPE_VAR_STRING;
|
||||
my_bind[i].buffer = (char *)&parms[i];
|
||||
my_bind[i].buffer = (char *)¶ms[i];
|
||||
my_bind[i].buffer_length = 1;
|
||||
my_bind[i].is_null = 0;
|
||||
length[i] = 1;
|
||||
@@ -245,7 +245,7 @@ static int test_view_star(MYSQL *mysql)
|
||||
MYSQL_STMT *stmt;
|
||||
int rc, i;
|
||||
MYSQL_BIND my_bind[8];
|
||||
char parms[8][100];
|
||||
char params[8][100];
|
||||
ulong length[8];
|
||||
const char *query= "SELECT * FROM vt1 WHERE a IN (?,?)";
|
||||
|
||||
@@ -259,9 +259,9 @@ static int test_view_star(MYSQL *mysql)
|
||||
check_mysql_rc(rc, mysql);
|
||||
memset(my_bind, '\0', sizeof(MYSQL_BIND));
|
||||
for (i= 0; i < 2; i++) {
|
||||
sprintf((char *)&parms[i], "%d", i);
|
||||
sprintf((char *)¶ms[i], "%d", i);
|
||||
my_bind[i].buffer_type = MYSQL_TYPE_VAR_STRING;
|
||||
my_bind[i].buffer = (char *)&parms[i];
|
||||
my_bind[i].buffer = (char *)¶ms[i];
|
||||
my_bind[i].buffer_length = 100;
|
||||
my_bind[i].is_null = 0;
|
||||
my_bind[i].length = &length[i];
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 7.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 216 KiB |
Reference in New Issue
Block a user