Bug #81658 [Opn]: mysql_option MYSQL_OPT_LOAD_DATA_LOCAL_DIR not available in mariadb libraries

From: Date: Fri, 26 Nov 2021 09:08:11 +0000
Subject: Bug #81658 [Opn]: mysql_option MYSQL_OPT_LOAD_DATA_LOCAL_DIR not available in mariadb libraries
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237989@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81658&edit=1

 ID:                 81658
 User updated by:    yury at codescar dot eu
 Reported by:        yury at codescar dot eu
 Summary:            mysql_option MYSQL_OPT_LOAD_DATA_LOCAL_DIR not
                     available in mariadb libraries
 Status:             Open
 Type:               Bug
 Package:            Compile Failure
-Operating System:   Debian 10
+Operating System:   Debian 10 (OS irrelevant)
-PHP Version:        8.1.0RC6
+PHP Version:        8.1.0
 Block user comment: N
 Private report:     N

 New Comment:

Problem is OS irrelevant, it has to do with mariadb libraries


Previous Comments:
------------------------------------------------------------------------
[2021-11-26 09:03:15] oliver at erply dot com

Having the same issue with only difference, building on CentOS.

------------------------------------------------------------------------
[2021-11-26 05:49:25] yury at codescar dot eu

>>That versioning is a mess, but can't we just do
>>  #ifdef MYSQL_OPT_LOAD_DATA_LOCAL_DIR
>>here?

MYSQL_OPT_LOAD_DATA_LOCAL_DIR is defined as member of enum mysql_option
(https://github.com/mysql/mysql-server/blob/3290a66c89eb1625a7058e0ef732432b6952b435/include/mysql.h#L213),
so I think the preprocessor won't know anything about it.

------------------------------------------------------------------------
[2021-11-25 14:24:16] cmb@php.net

That versioning is a mess, but can't we just do

    #ifdef MYSQL_OPT_LOAD_DATA_LOCAL_DIR

here?

------------------------------------------------------------------------
[2021-11-25 13:27:21] yury at codescar dot eu

Description:
------------
Compiling PHP 8.1.0 (https://www.php.net/distributions/php-8.1.0.tar.bz2) on Debian 10 with
libmariadb packages (10.3.31 version) instead of mysqlnd, fails with error:

> /tmp/php-8.1.0/ext/mysqli/mysqli.c:600:59: error: 'MYSQL_OPT_LOAD_DATA_LOCAL_DIR'
> undeclared (first use in this function); did you mean 'MYSQL_OPT_READ_TIMEOUT'?
  REGISTER_LONG_CONSTANT("MYSQLI_OPT_LOAD_DATA_LOCAL_DIR", MYSQL_OPT_LOAD_DATA_LOCAL_DIR,
CONST_CS | CONST_PERSISTENT);

This option was introduced in MySQL 8.0 (https://dev.mysql.com/doc/c-api/8.0/en/mysql-options.html)
so there is a check in the previous line
(https://github.com/php/php-src/blob/php-8.1.0/ext/mysqli/mysqli.c#L599)

> #if MYSQL_VERSION_ID >= 80021 || defined(MYSQLI_USE_MYSQLND)"

Unfortunately, it appears that with libmaria packages (10.3.31)
mysql_get_client_version() returns a value of 100331 (as you can see from the compiling
and running the test script).

Test script:
---------------
#include <stdlib.h>
#include <stdio.h>
#include <mysql.h>

int main(int argc, char **argv)
{
  printf("MySQL Client Version %lu\n", mysql_get_client_version());

  return EXIT_SUCCESS;
}

Compile: gcc -o testscript test.c mysql_config --cflags --libs
Execute: "MySQL Client Version 100331"

Expected result:
----------------
Being able to compile PHP 8.1.0 with MySQL extensions being compiled against the MariaDB Client
Library



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=81658&edit=1


Thread (12 messages)

« previous php.bugs (#237989) next »