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

From: Date: Thu, 25 Nov 2021 14:24:16 +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-237980@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
 Updated by:         cmb@php.net
 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
 PHP Version:        8.1.0RC6
 Block user comment: N
 Private report:     N

 New Comment:

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

    #ifdef MYSQL_OPT_LOAD_DATA_LOCAL_DIR

here?


Previous Comments:
------------------------------------------------------------------------
[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 (#237980) next »