1
0

Accepting request 544049 from server:database

- Use more cmake macros
- Run spec-cleaner
- 0334aa48.patch: Backported implementation and testcase for
  skipping particular paramset in bulk operation/. This is needed
  to get current stable MariaDB connector/ODBC actually compilable.
- Install missing header (bsc#1067904)
- mariadb-connector-c is now a provider of the libmariadb library
  for mariadb and others
- add compatibility symlinks
- change LIBDIR, INCLUDEDIR and PLUGINDIR paths to be the same as
  it was in the mariadb package (compatibility reasons)
- add baselibs.conf
- add %{mariadb_version} macro that should correspond with the
  current version of the mariadb package
- refresh absolute_path_fix.patch and private_library.patch

OBS-URL: https://build.opensuse.org/request/show/544049
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mariadb-connector-c?expand=0&rev=9
This commit is contained in:
Dominique Leuenberger 2017-11-30 11:43:48 +00:00 committed by Git OBS Bridge
parent aa53767dea
commit 5d9785ed7e
6 changed files with 302 additions and 41 deletions

180
0334aa48.patch Normal file
View File

@ -0,0 +1,180 @@
commit 0334aa4811ae751d3362facad136c25b9765693a
Author: Lawrin Novitsky <lawrin.novitsky@mariadb.com>
Date: Mon Aug 14 17:23:42 2017 +0200
Implementation and testcase for CONC-275 - skipping particular paramset in bulk operation - with help of special indicator value STMT_INDICATOR_IGNORE_ROW set in any column of the row.
The revision also adds some (mainly VS specific) file/dirs definitions to .gitignore to make 'gid status' usable on Windows, and the typo in bulk1 testsuite
diff --git a/include/mariadb_stmt.h b/include/mariadb_stmt.h
index 9e67ad8..5e1c711 100644
--- a/include/mariadb_stmt.h
+++ b/include/mariadb_stmt.h
@@ -81,7 +81,8 @@ enum enum_indicator_type
STMT_INDICATOR_NONE=0,
STMT_INDICATOR_NULL=1,
STMT_INDICATOR_DEFAULT=2,
- STMT_INDICATOR_IGNORE=3
+ STMT_INDICATOR_IGNORE=3,
+ STMT_INDICATOR_IGNORE_ROW=4
};
/*
diff --git a/libmariadb/mariadb_stmt.c b/libmariadb/mariadb_stmt.c
index aba845e..869c6ea 100644
--- a/libmariadb/mariadb_stmt.c
+++ b/libmariadb/mariadb_stmt.c
@@ -797,7 +797,21 @@ mem_error:
}
/* }}} */
-/* {{{ mysqlnd_stmt_execute_generate_bulk_request */
+/* {{{ mysql_stmt_skip_paramset */
+my_bool mysql_stmt_skip_paramset(MYSQL_STMT *stmt, uint row)
+{
+ uint i;
+ for (i=0; i < stmt->param_count; i++)
+ {
+ if (ma_get_indicator(stmt, i, row) == STMT_INDICATOR_IGNORE_ROW)
+ return '\1';
+ }
+
+ return '\0';
+}
+/* }}} */
+
+/* {{{ mysql_stmt_execute_generate_bulk_request */
unsigned char* mysql_stmt_execute_generate_bulk_request(MYSQL_STMT *stmt, size_t *request_len)
{
/* execute packet has the following format:
@@ -820,6 +834,7 @@ unsigned char* mysql_stmt_execute_generate_bulk_request(MYSQL_STMT *stmt, size_t
STMT_INDICATOR_NULL 1
STMT_INDICATOR_DEFAULT 2
STMT_INDICATOR_IGNORE 3
+ STMT_INDICATOR_SKIP_SET 4
n data from bind buffer
*/
@@ -894,6 +909,9 @@ unsigned char* mysql_stmt_execute_generate_bulk_request(MYSQL_STMT *stmt, size_t
/* calculate data size */
for (j=0; j < stmt->array_size; j++)
{
+ if (mysql_stmt_skip_paramset(stmt, j))
+ continue;
+
for (i=0; i < stmt->param_count; i++)
{
size_t size= 0;
diff --git a/unittest/libmariadb/bulk1.c b/unittest/libmariadb/bulk1.c
index e5f6ec9..c6623ce 100644
--- a/unittest/libmariadb/bulk1.c
+++ b/unittest/libmariadb/bulk1.c
@@ -588,7 +588,7 @@ static int test_conc243(MYSQL *mysql)
if (strcmp(row[0], "Monty") || strcmp(row[1], "Widenius"))
{
mysql_free_result(result);
- diag("Wrong walues");
+ diag("Wrong values");
return FAIL;
}
mysql_free_result(result);
@@ -767,6 +767,92 @@ static int test_char_conv2(MYSQL *mysql)
return OK;
}
+
+static int bulk_skip_row(MYSQL *mysql)
+{
+ MYSQL_STMT *stmt;
+ MYSQL_BIND bind[3];
+ MYSQL_RES *result;
+ MYSQL_ROW row;
+
+ struct st_data {
+ unsigned long id;
+ char id_ind;
+ char forename[30];
+ char forename_ind;
+ char surname[30];
+ char surname_ind;
+ };
+
+ struct st_data data[]={
+ { 0, STMT_INDICATOR_NULL, "Monty", STMT_INDICATOR_NTS, "Widenius", STMT_INDICATOR_IGNORE_ROW },
+ { 0, STMT_INDICATOR_IGNORE_ROW, "David", STMT_INDICATOR_NTS, "Axmark", STMT_INDICATOR_NTS },
+ { 0, STMT_INDICATOR_NULL, "default", STMT_INDICATOR_DEFAULT, "N.N.", STMT_INDICATOR_NTS },
+ };
+
+ unsigned int array_size= 3;
+ size_t row_size= sizeof(struct st_data);
+ int rc;
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS bulk_example2");
+ check_mysql_rc(rc, mysql);
+
+ rc= mysql_query(mysql, "CREATE TABLE bulk_example2 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,"\
+ "forename CHAR(30) NOT NULL DEFAULT 'unknown', surname CHAR(30))");
+ check_mysql_rc(rc, mysql);
+
+ stmt= mysql_stmt_init(mysql);
+ rc= mysql_stmt_prepare(stmt, "INSERT INTO bulk_example2 VALUES (?,?,?)", -1);
+ check_stmt_rc(rc, stmt);
+
+ memset(bind, 0, sizeof(MYSQL_BIND) * 3);
+
+ /* We autogenerate id's, so all indicators are STMT_INDICATOR_NULL */
+ bind[0].u.indicator= &data[0].id_ind;
+ bind[0].buffer_type= MYSQL_TYPE_LONG;
+
+ bind[1].buffer= &data[0].forename;
+ bind[1].buffer_type= MYSQL_TYPE_STRING;
+ bind[1].u.indicator= &data[0].forename_ind;
+
+ bind[2].buffer_type= MYSQL_TYPE_STRING;
+ bind[2].buffer= &data[0].surname;
+ bind[2].u.indicator= &data[0].surname_ind;
+
+ /* set array size */
+ mysql_stmt_attr_set(stmt, STMT_ATTR_ARRAY_SIZE, &array_size);
+
+ /* set row size */
+ mysql_stmt_attr_set(stmt, STMT_ATTR_ROW_SIZE, &row_size);
+
+ /* bind parameter */
+ mysql_stmt_bind_param(stmt, bind);
+
+ /* execute */
+ rc= mysql_stmt_execute(stmt);
+ check_stmt_rc(rc, stmt);
+
+ mysql_stmt_close(stmt);
+
+ rc= mysql_query(mysql, "SELECT forename, surname FROM bulk_example2");
+ check_mysql_rc(rc, mysql);
+
+ result= mysql_store_result(mysql);
+ FAIL_IF(!result || mysql_num_rows(result) != 1, "Invalid resultset");
+
+ row = mysql_fetch_row(result);
+ if (strcmp(row[0], "unknown") || strcmp(row[1], "N.N."))
+ {
+ mysql_free_result(result);
+ diag("Wrong values");
+ return FAIL;
+ }
+ mysql_free_result(result);
+ rc= mysql_query(mysql, "DROP TABLE bulk_example2");
+ check_mysql_rc(rc, mysql);
+ return OK;
+}
+
struct my_tests_st my_tests[] = {
{"check_bulk", check_bulk, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_char_conv1", test_char_conv1, TEST_CONNECTION_NEW, 0, NULL, NULL},
@@ -780,6 +866,7 @@ struct my_tests_st my_tests[] = {
{"bulk3", bulk3, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"bulk4", bulk4, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"bulk_null", bulk_null, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
+ {"bulk_skip_row", bulk_skip_row, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{NULL, NULL, 0, 0, NULL, NULL}
};

View File

@ -13,7 +13,7 @@ Index: mariadb-connector-c-3.0.2-src/mariadb_config/mariadb_config.c.in
-#define INCLUDE "-I@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDEDIR@ -I@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDEDIR@/mysql"
-#define LIBS "-L@CMAKE_INSTALL_PREFIX@/@INSTALL_LIBDIR@/ -lmariadb "\
+#define INCLUDE "-I@INSTALL_INCLUDEDIR@ -I@INSTALL_INCLUDEDIR@/mariadb"
+#define LIBS "-L@INSTALL_LIBDIR@/mariadb -lmariadb" \
+#define LIBS "-L@INSTALL_LIBDIR@ -lmariadb "\
"@extra_dynamic_LDFLAGS@"
#define LIBS_SYS "@extra_dynamic_LDFLAGS@"
#define CFLAGS INCLUDE
@ -23,3 +23,26 @@ Index: mariadb-connector-c-3.0.2-src/mariadb_config/mariadb_config.c.in
#define SOCKET "@MARIADB_UNIX_ADDR@"
#define PORT "@MARIADB_PORT@"
#define TLS_LIBRARY_VERSION "@TLS_LIBRARY_VERSION@"
Index: mariadb-connector-c-3.0.2-src/mariadb_config/libmariadb.pc.in
===================================================================
--- mariadb-connector-c-3.0.2-src.orig/mariadb_config/libmariadb.pc.in
+++ mariadb-connector-c-3.0.2-src/mariadb_config/libmariadb.pc.in
@@ -6,14 +6,14 @@
# Dan Nicholsons Guide to pkg-config (http://www.freedesktop.org/wiki/Software/pkg-config/)
#
-includedir=@PREFIX_INSTALL_DIR@/@INCLUDE_INSTALL_DIR@/@SUFFIX_INSTALL_DIR@
-libdir=@PREFIX_INSTALL_DIR@/@INCLUDE_INSTALL_DIR@/@SUFFIX_INSTALL_DIR@
+includedir=@INCLUDE_INSTALL_DIR@
+libdir=@INCLUDE_INSTALL_DIR@
prefix=@PREFIX_INSTALL_DIR@
Name: libmariadb
Version: @LIBMARIADB_VERSION@
Description: MariaDB Connector/C dynamic library
-Cflags: -I@PREFIX_INSTALL_DIR@/@INCLUDE_INSTALL_DIR@/@SUFFIX_INSTALL_DIR@ @CMAKE_C_FLAGS@
-Libs: -L@PREFIX_INSTALL_DIR@/@LIB_INSTALL_DIR@/@SUFFIX_INSTALL_DIR@ -lmariadb @extra_dynamic_LDFLAGS@
+Cflags: -I@INCLUDE_INSTALL_DIR@ @CMAKE_C_FLAGS@
+Libs: -L@LIB_INSTALL_DIR@ -lmariadb @extra_dynamic_LDFLAGS@

3
baselibs.conf Normal file
View File

@ -0,0 +1,3 @@
libmariadb3
provides "libmysqlclient.so.18"
provides "libmysqlclient.so.18(libmysqlclient_18)"

View File

@ -1,3 +1,34 @@
-------------------------------------------------------------------
Sun Nov 19 07:41:13 UTC 2017 - mpluskal@suse.com
- Use more cmake macros
- Run spec-cleaner
-------------------------------------------------------------------
Fri Nov 17 14:20:39 UTC 2017 - adam.majer@suse.de
- 0334aa48.patch: Backported implementation and testcase for
skipping particular paramset in bulk operation/. This is needed
to get current stable MariaDB connector/ODBC actually compilable.
-------------------------------------------------------------------
Mon Nov 13 17:54:46 UTC 2017 - mpluskal@suse.com
- Install missing header (bsc#1067904)
-------------------------------------------------------------------
Thu Nov 2 17:07:25 UTC 2017 - kstreitova@suse.com
- mariadb-connector-c is now a provider of the libmariadb library
for mariadb and others
- add compatibility symlinks
- change LIBDIR, INCLUDEDIR and PLUGINDIR paths to be the same as
it was in the mariadb package (compatibility reasons)
- add baselibs.conf
- add %{mariadb_version} macro that should correspond with the
current version of the mariadb package
- refresh absolute_path_fix.patch and private_library.patch
-------------------------------------------------------------------
Fri Sep 29 11:05:34 UTC 2017 - kstreitova@suse.com

View File

@ -16,14 +16,14 @@
#
%bcond_with sqlite3
%define sover 3
%define libname libmariadb
# equivalent mariadb version
%define mariadb_version 10.2.10
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif
%bcond_with sqlite3
Name: mariadb-connector-c
Version: 3.0.2
Release: 0
@ -35,18 +35,19 @@ Source: https://downloads.mariadb.com/Connectors/c/connector-c-%{version
Source1: https://downloads.mariadb.com/Connectors/c/connector-c-%{version}/%{name}-%{version}-src.tar.gz.asc
# Imported from keyserver based on keyid @ https://mariadb.com/kb/en/mariadb-enterprise/mariadb-enterprise-installation-guide/
Source2: mariadb.keyring
Source3: baselibs.conf
Patch1: mariadb-connector-c-2.3.1_unresolved_symbols.patch
Patch3: absolute_path_fix.patch
Patch4: private_library.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Patch5: 0334aa48.patch
BuildRequires: cmake
BuildRequires: curl-devel
BuildRequires: pkgconfig
BuildRequires: pkgconfig(krb5)
BuildRequires: pkgconfig(krb5-gssapi)
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(zlib)
%if %{with sqlite3}
BuildRequires: sqlite3-devel
BuildRequires: pkgconfig(sqlite3)
%endif
%description
@ -65,7 +66,12 @@ This package holds the runtime components.
%package -n %{libname}_plugins
Summary: Plugins for the MariaDB C Connector
# We need "Conflicts" because we moved some plugins here:
# dialog.so was in mariadb-client package
# mysql_clear_password.so was in mariadb package
Group: System/Libraries
Conflicts: mariadb <= 10.1.25
Conflicts: mariadb-client <= 10.1.25
%description -n %{libname}_plugins
MariaDB Connector is used to connect applications developed in
@ -84,10 +90,18 @@ C or C++ to MariaDB and MySQL databases.
This package holds the runtime components with private API.
%package -n %{libname}-devel
Requires: %{libname}%{sover} = %{version}
Requires: pkgconfig(openssl)
Summary: Development files for the MariaDB Connector C API
Group: Development/Libraries/C and C++
Requires: %{libname}%{sover} = %{version}
Requires: pkgconfig(openssl)
# mysql-devel needs to be provided as some pkgs still depend on it
Provides: mysql-devel = %{mariadb_version}
Obsoletes: mysql-devel < %{mariadb_version}
Provides: libmysqlclient-devel = %{mariadb_version}
Obsoletes: libmysqlclient-devel < %{mariadb_version}
# libmysqlclient_r.so was in libmysqlclient_r18 subpackage, now it's here
Provides: libmysqlclient_r18 = %{mariadb_version}
Obsoletes: libmysqlclient_r18 < %{mariadb_version}
%description -n %{libname}-devel
MariaDB Connector is used to connect applications developed in
@ -100,6 +114,7 @@ This package holds the development files.
%patch1 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
%cmake \
@ -108,48 +123,57 @@ This package holds the development files.
%endif
-DWITH_EXTERNAL_ZLIB:BOOL=ON \
-DMARIADB_UNIX_ADDR:STRING=%{_rundir}/mysql/mysql.sock \
-DINSTALL_LIBDIR:STRING=%{_libdir}/mariadb \
-DINSTALL_PLUGINDIR:STRING=%{_libdir}/mariadb/plugin/ \
-DINSTALL_LIBDIR:STRING=%{_libdir} \
-DINSTALL_INCLUDEDIR:STRING=%{_includedir}/mysql \
-DINSTALL_PLUGINDIR:STRING=%{_libdir}/mysql/plugin/ \
-DWITH_MYSQLCOMPAT=ON \
-DWITH_SSL=OPENSSL
make %{?_smp_mflags}
-DWITH_SSL=OPENSSL
%make_jobs
%install
%cmake_install
# remove static linked libraries
rm %{buildroot}%{_libdir}/mariadb/libmariadbclient.a
rm %{buildroot}%{_libdir}/mariadb/libmysqlclient.a
rm %{buildroot}%{_libdir}/mariadb/libmysqlclient_r.a
rm %{buildroot}%{_libdir}/libmariadbclient.a
rm %{buildroot}%{_libdir}/libmysqlclient.a
rm %{buildroot}%{_libdir}/libmysqlclient_r.a
%files -n %{libname}%{sover}
%defattr(-,root,root)
%doc README COPYING.LIB
%{_libdir}/mariadb/libmariadb.so.%{sover}
# add a compatibility symlink
ln -s mariadb_config %{buildroot}%{_bindir}/mysql_config
ln -s mariadb_version.h %{buildroot}%{_includedir}/mysql/mysql_version.h
%files -n %{libname}_plugins
%dir %{_libdir}/mariadb/
%dir %{_libdir}/mariadb/plugin/
%{_libdir}/mariadb/plugin/dialog.so
%{_libdir}/mariadb/plugin/mysql_clear_password.so
%{_libdir}/mariadb/plugin/auth_gssapi_client.so
%{_libdir}/mariadb/plugin/remote_io.so
%{_libdir}/mariadb/plugin/sha256_password.so
%files -n %{libname}private
%{_libdir}/mariadb/libmariadbprivate.so
%files -n %{libname}-devel
%defattr(-,root,root)
%{_bindir}/mariadb_config
%{_includedir}/mariadb/
%{_libdir}/mariadb/libmariadb.so
%{_libdir}/mariadb/libmysqlclient.so
%{_libdir}/mariadb/libmysqlclient_r.so
# install some extra required header file
install -Dpm 0644 build/include/ma_config.h \
%{buildroot}%{_includedir}/mysql/my_config.h
%post -n %{libname}%{sover} -p /sbin/ldconfig
%post -n %{libname}private -p /sbin/ldconfig
%postun -n %{libname}%{sover} -p /sbin/ldconfig
%postun -n %{libname}private -p /sbin/ldconfig
%files -n %{libname}%{sover}
%doc README COPYING.LIB
%{_libdir}/libmariadb.so.%{sover}
%files -n %{libname}_plugins
%dir %{_libdir}/mysql/
%dir %{_libdir}/mysql/plugin/
%{_libdir}/mysql/plugin/dialog.so
%{_libdir}/mysql/plugin/mysql_clear_password.so
%{_libdir}/mysql/plugin/auth_gssapi_client.so
%{_libdir}/mysql/plugin/remote_io.so
%{_libdir}/mysql/plugin/sha256_password.so
%files -n %{libname}private
%{_libdir}/libmariadbprivate.so
%files -n %{libname}-devel
%{_bindir}/mariadb_config
%{_bindir}/mysql_config
%dir %{_includedir}/mysql
%{_includedir}/mysql/*
%{_libdir}/libmariadb.so
%{_libdir}/libmysqlclient.so
%{_libdir}/libmysqlclient_r.so
%changelog

View File

@ -53,9 +53,9 @@ Index: mariadb-connector-c-3.0.2-src/mariadb_config/mariadb_config.c.in
+++ mariadb-connector-c-3.0.2-src/mariadb_config/mariadb_config.c.in
@@ -8,6 +8,8 @@ static char *mariadb_progname;
#define INCLUDE "-I@INSTALL_INCLUDEDIR@ -I@INSTALL_INCLUDEDIR@/mariadb"
#define LIBS "-L@INSTALL_LIBDIR@/mariadb -lmariadb" \
#define LIBS "-L@INSTALL_LIBDIR@ -lmariadb "\
"@extra_dynamic_LDFLAGS@"
+#define PRIVATE_LIBS "-L@INSTALL_LIBDIR@/mariadb -lmariadbprivate" \
+#define PRIVATE_LIBS "-L@INSTALL_LIBDIR@ -lmariadbprivate " \
+ "@extra_dynamic_LDFLAGS@"
#define LIBS_SYS "@extra_dynamic_LDFLAGS@"
#define CFLAGS INCLUDE