[CONC-182] Cleanup export headers Created: 2016-05-15  Updated: 2016-05-15

Status: Open
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Vladislav Vaintroub Assignee: Georg Richter
Resolution: Unresolved Votes: 0
Labels: None


 Description   

The purpose of this task is to cleanup export headers (mysql.h in first place) such that it does only includes structures needed by the API (MYSQL, MYSQL_BIND, MYSQL_STMT, MYSQL_ROW, perhaps couple of others), minimum needed defines, and reduce the number of additional #includes to the minimum. This helps to avoid conflicts when including mariadb headers elsewhere. The extraneous stuff should be either moved to internal headers, or completely removed

Brief inspection of hings that should not be there (no client needs it)
https://github.com/MariaDB/mariadb-connector-c/blob/master/include/mysql.h

  1. #include "mariadb_com.h"
    #include "mariadb_version.h"
    #include "ma_list.h"
    #include "mariadb_ctype.h"
    

  1. Internal use Structs MA_USED_MEM; MA_MEM_ROOT;
  2. something that should not be there at all

    extern unsigned int mysql_port;
    extern char *mysql_unix_port;
    

  1. something for internal consumption

    extern unsigned int mariadb_deinitialize_ssl;
    #define IS_PRI_KEY(n)	((n) & PRI_KEY_FLAG)
    #define IS_NOT_NULL(n)	((n) & NOT_NULL_FLAG)
    #define IS_BLOB(n)	((n) & BLOB_FLAG)
    #define INTERNAL_NUM_FIELD(f)...
    #define SET_CLIENT_ERROR(a, b, c, d)
    /* For mysql_async.c */
    #define set_mariadb_error(A,B,C) SET_CLIENT_ERROR((A),(B),(C),0)
    #define unknown_sqlstate SQLSTATE_UNKNOWN
    #define CLEAR_CLIENT_ERROR(a)
    #define MYSQL_COUNT_ERROR
    enum mysql_status 
    #define AUTO_SEC_PART_DIGITS 31
    #define SEC_PART_DIGITS 6
    #define MARIADB_INVALID_SOCKET -1
    /* Local infile support functions */
    #define LOCAL_INFILE_ERROR_LEN 512
     
    void my_set_error(MYSQL *mysql, unsigned int error_nr, 
                      const char *sqlstate, const char *format, ...);
    struct st_mariadb_api 
    struct st_mariadb_methods
    #define HAVE_MYSQL_REAL_CONNECT
    



 Comments   
Comment by Vladislav Vaintroub [ 2016-05-15 ]

removing macros from the "unneeded list" that are documented in https://dev.mysql.com/doc/refman/5.7/en/c-api-data-structures.html - IS_NOT_NULL, IS_PRI_KEY, IS_BLOB

Generated at Thu Feb 08 03:03:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.