Skip to content

Commit

Permalink
Added support for all (?) events
Browse files Browse the repository at this point in the history
- All (MariaDB and MySQL) events are now supported
- Added new api functions:
  - mariadb_rpl_error: returns error message
  - mariadb_rpl_errno: returns error number
  - mariadb_rpl_extract_rows: extract values of
    ROW_EVENTS
- Added decryption support
- Added uncompression
  -
  • Loading branch information
9EOR9 committed Sep 26, 2022
1 parent 9c2e470 commit 4dca917
Show file tree
Hide file tree
Showing 10 changed files with 1,679 additions and 197 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "external/crypto_wrapper"]
path = external/crypto_wrapper
url = https://github.com/9EOR9/crypto_wrapper
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ MACRO(ADD_OPTION _name _text _default)
ENDIF()
ENDMACRO()

ADD_OPTION(WITH_CRYPTO "build with cryptograpy support" OFF)

### Options ###
IF(NOT WIN32)
ADD_OPTION(WITH_MYSQLCOMPAT "creates libmysql* symbolic links" OFF)
Expand Down Expand Up @@ -314,6 +316,9 @@ IF(NOT WITH_SSL STREQUAL "OFF")
IF(WIN32)
CHECK_INCLUDE_FILES (${OPENSSL_INCLUDE_DIR}/openssl/applink.c HAVE_OPENSSL_APPLINK_C)
ENDIF()
IF(WITH_CRYPTO)
SET(WITH_CRYPTO=openssl)
ENDIF()
INCLUDE_DIRECTORIES(BEFORE ${OPENSSL_INCLUDE_DIR})


Expand All @@ -340,6 +345,9 @@ IF(NOT WITH_SSL STREQUAL "OFF")
SET(SSL_LIBRARIES ${GNUTLS_LIBRARY})
SET(TLS_LIBRARY_VERSION "GnuTLS ${GNUTLS_VERSION_STRING}")
INCLUDE_DIRECTORIES(${GNUTLS_INCLUDE_DIR})
IF(WITH_CRYPTO)
SET(WITH_CRYPTO=nettle)
ENDIF()
ELSE()
MESSAGE(FATAL_ERROR "GnuTLS not found")
ENDIF()
Expand All @@ -353,13 +361,22 @@ IF(NOT WITH_SSL STREQUAL "OFF")
INCLUDE_DIRECTORIES("${CC_SOURCE_DIR}/plugins/pvio/")
SET(SSL_LIBRARIES secur32)
SET(TLS_LIBRARY_VERSION "Schannel ${CMAKE_SYSTEM_VERSION}")
IF(WITH_CRYPTO)
SET(WITH_CRYPTO=schannel)
ENDIF()
ENDIF()
ENDIF()
MESSAGE1(TLS_LIBRARY_VERSION "TLS library/version: ${TLS_LIBRARY_VERSION}")

MARK_AS_ADVANCED(SSL_SOURCES)
ENDIF()

IF(WITH_CRYPTO)
ADD_DEFINITIONS(-DHAVE_CRYPTO=1)
ADD_SUBDIRECTORY(${CC_SOURCE_DIR}/external/crypto_wrapper)
INCLUDE_DIRECTORIES(${CC_SOURCE_DIR}/external/crypto_wrapper/include)
ENDIF()

SET(ENABLED_LOCAL_INFILE "AUTO" CACHE STRING "If we should should enable LOAD DATA LOCAL by default (OFF/ON/AUTO)")
MARK_AS_ADVANCED(ENABLED_LOCAL_INFILE)
IF (ENABLED_LOCAL_INFILE MATCHES "^(0|FALSE)$")
Expand Down
1 change: 1 addition & 0 deletions external/crypto_wrapper
Submodule crypto_wrapper added at 006ee6
64 changes: 64 additions & 0 deletions include/ma_decimal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* Copyright (C) 2000 Sergei Golubchik
*/

#ifndef _decimal_h
#define _decimal_h

typedef enum {TRUNCATE=0, HALF_EVEN, HALF_UP, CEILING, FLOOR} decimal_round_mode;
typedef int32 decimal_digit;

typedef struct st_decimal {
int intg, frac, len;
my_bool sign;
decimal_digit *buf;
} decimal;

int decimal2string(decimal *from, char *to, int *to_len);
int bin2decimal(const char *from, decimal *to, int precision, int scale);

int decimal_size(int precision, int scale);
int decimal_bin_size(int precision, int scale);
int decimal_result_size(decimal *from1, decimal *from2, char op, int param);


/* set a decimal to zero */

#define decimal_make_zero(dec) do { \
(dec)->buf[0]=0; \
(dec)->intg=1; \
(dec)->frac=0; \
(dec)->sign=0; \
} while(0)

/*
returns the length of the buffer to hold string representation
of the decimal (including decimal dot, possible sign and \0)
*/

#define decimal_string_size(dec) ((dec)->intg + (dec)->frac + ((dec)->frac > 0) + 2)

/* negate a decimal */
#define decimal_neg(dec) do { (dec)->sign^=1; } while(0)

/*
conventions:
decimal_smth() == 0 -- everything's ok
decimal_smth() <= 1 -- result is usable, but precision loss is possible
decimal_smth() <= 2 -- result can be unusable, most significant digits
could've been lost
decimal_smth() > 2 -- no result was generated
*/

#define E_DEC_OK 0
#define E_DEC_TRUNCATED 1
#define E_DEC_OVERFLOW 2
#define E_DEC_DIV_ZERO 4
#define E_DEC_BAD_NUM 8
#define E_DEC_OOM 16

#define E_DEC_ERROR 31
#define E_DEC_FATAL_ERROR 30

#endif

1 change: 1 addition & 0 deletions include/ma_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ typedef char bool; /* Ordinary boolean values 0 1 */
/* Optimized store functions for Intel x86 */
#define int1store(T,A) *((int8*) (T)) = (A)
#define uint1korr(A) (*(((uint8*)(A))))
#define sint1korr(A) (*(((int8*)(A))))
#if defined(__i386__) || defined(_WIN32)
#define sint2korr(A) (*((int16 *) (A)))
#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
Expand Down
Loading

0 comments on commit 4dca917

Please sign in to comment.