diff --git a/include/ma_priv.h b/include/ma_priv.h new file mode 100644 index 00000000..7d300947 --- /dev/null +++ b/include/ma_priv.h @@ -0,0 +1,31 @@ +/**************************************************************************** + Copyright (C) 2020 MariaDB Corporation + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not see + or write to the Free Software Foundation, Inc., + 51 Franklin St., Fifth Floor, Boston, MA 02110, USA + + Part of this code includes code from the PHP project which + is freely available from http://www.php.net + *****************************************************************************/ +#ifndef MA_PRIV_H +#define MA_PRIV_H + +void free_rows(MYSQL_DATA *cur); +int ma_multi_command(MYSQL *mysql, enum enum_multi_status status); +MYSQL_FIELD * unpack_fields(MYSQL_DATA *data, + MA_MEM_ROOT *alloc,uint fields, + my_bool default_value); + +#endif diff --git a/libmariadb/mariadb_lib.c b/libmariadb/mariadb_lib.c index c156ecb5..1063f14e 100644 --- a/libmariadb/mariadb_lib.c +++ b/libmariadb/mariadb_lib.c @@ -27,6 +27,7 @@ #include #include #include +#include "ma_priv.h" #include "ma_context.h" #include "mysql.h" #include "mariadb_version.h" @@ -771,7 +772,7 @@ static size_t rset_field_offsets[]= { MYSQL_FIELD * unpack_fields(MYSQL_DATA *data,MA_MEM_ROOT *alloc,uint fields, - my_bool default_value, my_bool long_flag_protocol __attribute__((unused))) + my_bool default_value) { MYSQL_ROWS *row; MYSQL_FIELD *field,*result; @@ -2195,9 +2196,7 @@ get_info: if (!(fields=mysql->methods->db_read_rows(mysql,(MYSQL_FIELD*) 0,8))) return(-1); if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc, - (uint) field_count,1, - (my_bool) test(mysql->server_capabilities & - CLIENT_LONG_FLAG)))) + (uint) field_count, 1))) return(-1); mysql->status=MYSQL_STATUS_GET_RESULT; mysql->field_count=field_count; @@ -2528,9 +2527,7 @@ mysql_list_fields(MYSQL *mysql, const char *table, const char *wild) result->eof=1; result->field_count = (uint) query->rows; result->fields= unpack_fields(query,&result->field_alloc, - result->field_count,1, - (my_bool) test(mysql->server_capabilities & - CLIENT_LONG_FLAG)); + result->field_count, 1); if (result->fields) return(result); @@ -2555,9 +2552,8 @@ mysql_list_processes(MYSQL *mysql) field_count=(uint) net_field_length(&pos); if (!(fields = mysql->methods->db_read_rows(mysql,(MYSQL_FIELD*) 0,5))) return(NULL); - if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,field_count,0, - (my_bool) test(mysql->server_capabilities & - CLIENT_LONG_FLAG)))) + if (!(mysql->fields=unpack_fields(fields, &mysql->field_alloc, + field_count, 0))) return(NULL); mysql->status=MYSQL_STATUS_GET_RESULT; mysql->field_count=field_count; diff --git a/libmariadb/mariadb_stmt.c b/libmariadb/mariadb_stmt.c index cf35e373..86e39cae 100644 --- a/libmariadb/mariadb_stmt.c +++ b/libmariadb/mariadb_stmt.c @@ -55,6 +55,8 @@ #include #include #include +#include "ma_priv.h" + #define UPDATE_STMT_ERROR(stmt)\ SET_CLIENT_STMT_ERROR((stmt), (stmt)->mysql->net.last_errno, (stmt)->mysql->net.sqlstate, (stmt)->mysql->net.last_error) @@ -75,10 +77,6 @@ typedef struct MA_MEM_ROOT fields_ma_alloc_root; } MADB_STMT_EXTENSION; -MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, uint fields); -void free_rows(MYSQL_DATA *cur); -int ma_multi_command(MYSQL *mysql, enum enum_multi_status status); -MYSQL_FIELD * unpack_fields(MYSQL_DATA *data,MA_MEM_ROOT *alloc,uint fields, my_bool default_value, my_bool long_flag_protocol); static my_bool net_stmt_close(MYSQL_STMT *stmt, my_bool remove); static my_bool is_not_null= 0; @@ -1598,8 +1596,7 @@ my_bool mthd_stmt_get_result_metadata(MYSQL_STMT *stmt) if (!(result= stmt->mysql->methods->db_read_rows(stmt->mysql, (MYSQL_FIELD *)0, 7))) return(1); if (!(stmt->fields= unpack_fields(result,fields_ma_alloc_root, - stmt->field_count, 0, - stmt->mysql->server_capabilities & CLIENT_LONG_FLAG))) + stmt->field_count, 0))) return(1); return(0); }