├── cmake
├── ConfigureFile.cmake
├── SetValueMacro.cmake
├── SearchLibrary.cmake
├── resources
│ └── macos
│ │ ├── README.html
│ │ └── WELCOME.html.in
├── COPYING-CMAKE-SCRIPTS
├── connector_c.cmake
├── symlink.cmake
├── ConnectorName.cmake
└── build_depends.cmake
├── src
├── maconncpp.def.in
├── stringinfo.h
├── Identifier.h
├── CArray.cpp
├── Charset.cpp
├── parameters
│ ├── ParameterHolder.cpp
│ ├── OffsetTimeParameter.h
│ ├── ZonedDateTimeParameter.h
│ ├── BooleanParameter.h
│ ├── SerializableParameter.h
│ ├── IntParameter.h
│ ├── ShortParameter.h
│ ├── BigDecimalParameter.h
│ ├── FloatParameter.h
│ ├── LongParameter.h
│ ├── DefaultParameter.h
│ ├── DoubleParameter.h
│ ├── LocalTimeParameter.h
│ ├── ReaderParameter.h
│ ├── ULongParameter.h
│ ├── ByteParameter.h
│ ├── NullParameter.h
│ ├── ByteArrayParameter.h
│ ├── StreamParameter.h
│ ├── StringParameter.h
│ ├── TimestampParameter.h
│ ├── ParameterHolder.h
│ ├── TimeParameter.h
│ ├── DateParameter.h
│ └── NullParameter.cpp
├── util
│ ├── StateChange.h
│ ├── ServerStatus.h
│ ├── LogQueryTool.h
│ ├── ServerPrepareStatementCache.h
│ └── String.h
├── Identifier.cpp
├── StringImp.cpp
├── credential
│ ├── Credential.h
│ ├── CredentialPluginLoader.h
│ ├── Credential.cpp
│ └── CredentialPlugin.h
├── PrepareResult.h
├── Charset.h
├── logger
│ ├── LoggerFactory.h
│ ├── NoLogger.h
│ ├── Logger.h
│ ├── NoLogger.cpp
│ └── LoggerFactory.cpp
├── options
│ └── DriverPropertyInfo.h
├── Dll.c
├── MariaDbSavepoint.h
├── io
│ ├── SocketHandlerFunction.h
│ └── PacketInputStream.h
├── StringImp.h
├── com
│ ├── ColumnNameMap.h
│ ├── Packet.cpp
│ ├── CmdInformationSingle.h
│ ├── CmdInformationMultiple.h
│ ├── CmdInformationBatch.h
│ └── Packet.h
├── cache
│ ├── CallableStatementCacheKey.cpp
│ ├── CallableStatementCacheKey.h
│ ├── CallableStatementCache.cpp
│ └── CallableStatementCache.h
├── SimpleParameterMetaData.h
├── Version.h.in
├── MariaDbDriver.h
├── Consts.cpp
├── CallableParameterMetaData.h
├── protocol
│ └── MasterProtocol.h
├── MariaDbConnCpp.h
├── MariaDbSavepoint.cpp
├── Parameters.h
├── pool
│ └── GlobalStateInfo.h
├── MariaDbParameterMetaData.h
├── MariaDBWarning.h
├── SqlStates.h
└── ColumnDefinition.cpp
├── .gitmodules
├── wininstall
├── mdb-connector-cpp.png
├── mdb-dialog-popup.png
└── binaries_dir.xml.in
├── appveyor-download.bat
├── benchmark
├── installation.sh
├── launch.sh
└── build.sh
├── .travis.yml
├── .gitignore
├── include
├── conncpp
│ ├── compat
│ │ ├── Array.hpp
│ │ ├── Struct.hpp
│ │ ├── Object.hpp
│ │ ├── Executor.hpp
│ │ └── SQLType.hpp
│ ├── Savepoint.hpp
│ ├── Warning.hpp
│ ├── buildconf.hpp
│ ├── DriverManager.hpp
│ ├── Types.hpp
│ ├── Driver.hpp
│ └── ParameterMetaData.hpp
└── conncpp.hpp
├── BUILD.md
├── test
├── unit
│ ├── bugs
│ │ └── CMakeLists.txt
│ ├── classes
│ │ └── art_resultset.h
│ ├── performance
│ │ ├── CMakeLists.txt
│ │ └── perf_statement.h
│ └── example
│ │ └── CMakeLists.txt
├── CJUnitTestsPort
│ ├── compliance
│ │ ├── UnbufferedRsStmtTest.h
│ │ └── UnbufferedRsStmtTest.cpp
│ └── regression
│ │ ├── PreparedStatementRegressionTest.cpp
│ │ └── PreparedStatementRegressionTest.h
├── common
│ └── singleton.h
└── framework
│ ├── test_container.cpp
│ └── test_container.h
└── install_test
└── CMakeLists.txt.in
/cmake/ConfigureFile.cmake:
--------------------------------------------------------------------------------
1 | CONFIGURE_FILE(${FILE_IN} ${FILE_OUT} @ONLY)
2 |
--------------------------------------------------------------------------------
/src/maconncpp.def.in:
--------------------------------------------------------------------------------
1 | LIBRARY @LIBRARY_NAME@.dll
2 | EXPORTS
3 | DllMain
4 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "libmariadb"]
2 | path = libmariadb
3 | url = https://github.com/MariaDB/mariadb-connector-c.git
4 |
--------------------------------------------------------------------------------
/wininstall/mdb-connector-cpp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mariadb-corporation/mariadb-connector-cpp/HEAD/wininstall/mdb-connector-cpp.png
--------------------------------------------------------------------------------
/wininstall/mdb-dialog-popup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mariadb-corporation/mariadb-connector-cpp/HEAD/wininstall/mdb-dialog-popup.png
--------------------------------------------------------------------------------
/wininstall/binaries_dir.xml.in:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/stringinfo.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 |
4 | #ifdef APSTUDIO_INVOKED
5 | #ifndef APSTUDIO_READONLY_SYMBOLS
6 | #define _APS_NEXT_RESOURCE_VALUE 101
7 | #define _APS_NEXT_COMMAND_VALUE 40001
8 | #define _APS_NEXT_CONTROL_VALUE 1001
9 | #define _APS_NEXT_SYMED_VALUE 101
10 | #endif
11 | #endif
12 |
--------------------------------------------------------------------------------
/cmake/SetValueMacro.cmake:
--------------------------------------------------------------------------------
1 | # Macro that checks if variable is defined, otherwise checks env for same name, otherwise uses default value
2 | MACRO(SET_VALUE _variable _default_value _descr)
3 | IF (NOT ${_variable})
4 | IF(DEFINED ENV{${_variable}})
5 | SET(${_variable} $ENV{${_variable}} CACHE STRING "${_descr}")
6 | ELSE()
7 | SET(${_variable} ${_default_value} CACHE STRING "${_descr}")
8 | ENDIF()
9 | ENDIF()
10 | ENDMACRO(SET_VALUE)
11 |
12 |
--------------------------------------------------------------------------------
/appveyor-download.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | set archive=http://ftp.hosteurope.de/mirror/archive.mariadb.org/mariadb-%DB%/winx64-packages/mariadb-%DB%-winx64.msi
3 | set last=http://mirror.i3d.net/pub/mariadb/mariadb-%DB%/winx64-packages/mariadb-%DB%-winx64.msi
4 |
5 | curl -fLsS -o server.msi %archive%
6 |
7 | if %ERRORLEVEL% == 0 goto end
8 |
9 | curl -fLsS -o server.msi %last%
10 | if %ERRORLEVEL% == 0 goto end
11 |
12 | echo Failure Reason Given is %errorlevel%
13 | exit /b %errorlevel%
14 |
15 | :end
16 | echo "File found".
17 |
--------------------------------------------------------------------------------
/benchmark/installation.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -ex
4 |
5 | # Check out the library.
6 | git clone https://github.com/google/benchmark.git
7 | # Go to the library root directory
8 | cd benchmark
9 | # Make a build directory to place the build output.
10 | cmake -E make_directory "build"
11 | # Generate build system files with cmake, and download any dependencies.
12 | cmake -E chdir "build" cmake -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on -DCMAKE_BUILD_TYPE=Release ../
13 | # or, starting with CMake 3.13, use a simpler form:
14 | # cmake -DCMAKE_BUILD_TYPE=Release -S . -B "build"
15 | # Build the library.
16 | cmake --build "build" --config Release
17 |
18 |
--------------------------------------------------------------------------------
/cmake/SearchLibrary.cmake:
--------------------------------------------------------------------------------
1 | INCLUDE(CheckFunctionExists)
2 | INCLUDE(CheckLibraryExists)
3 |
4 | FUNCTION(SEARCH_LIBRARY library_name function liblist)
5 | IF(${${library_name}})
6 | RETURN()
7 | ENDIF()
8 | CHECK_FUNCTION_EXISTS(${function} ${function}_IS_SYS_FUNC)
9 | # check if function is part of libc
10 | IF(HAVE_${function}_IS_SYS_FUNC)
11 | SET(${library_name} "" PARENT_SCOPE)
12 | RETURN()
13 | ENDIF()
14 | FOREACH(lib ${liblist})
15 | CHECK_LIBRARY_EXISTS(${lib} ${function} "" HAVE_${function}_IN_${lib})
16 | IF(HAVE_${function}_IN_${lib})
17 | SET(${library_name} ${lib} PARENT_SCOPE)
18 | SET(HAVE_${library_name} 1 PARENT_SCOPE)
19 | RETURN()
20 | ENDIF()
21 | ENDFOREACH()
22 | ENDFUNCTION()
23 |
24 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: c
2 | version: ~> 1.0
3 | sudo: true
4 |
5 | cache:
6 | apt: true
7 | ccache: true
8 |
9 | env:
10 | global: local=0 PROFILE=default DB=testcpp CLEAR_TEXT=0
11 |
12 | import: mariadb-corporation/connector-test-machine:common-build.yml@master
13 |
14 | jobs:
15 | allow_failures:
16 | - env: srv=build
17 | - os: osx
18 | - os: linux
19 | arch: s390x
20 | dist: focal
21 | include:
22 | - stage: Community
23 | os: osx
24 | compiler: clang
25 | before_script:
26 | - brew install openssl
27 | - brew install libiodbc
28 | name: "osx"
29 | - os: linux
30 | arch: s390x
31 | dist: focal
32 | env: srv=mariadb v=10.11 local=1
33 | name: "s390x"
34 |
35 | script: ./travis.sh
36 |
--------------------------------------------------------------------------------
/benchmark/launch.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -ex
4 |
5 | sudo cpupower frequency-set --governor performance || true
6 |
7 | g++ main-benchmark.cc -std=c++11 -isystem benchmark/include -Lbenchmark/build/src -L/usr/local/lib/mariadb/ -lbenchmark -lpthread -lmariadbcpp -o main-benchmark
8 | ./main-benchmark --benchmark_repetitions=30 --benchmark_time_unit=us --benchmark_min_warmup_time=10 --benchmark_counters_tabular=true --benchmark_format=json --benchmark_out=mariadb.json
9 |
10 | g++ main-benchmark.cc -std=c++11 -isystem benchmark/include -Lbenchmark/build/src -lbenchmark -lpthread -DMYSQL -lmysqlcppconn -o main-benchmark
11 | ./main-benchmark --benchmark_repetitions=30 --benchmark_time_unit=us --benchmark_min_warmup_time=10 --benchmark_counters_tabular=true --benchmark_format=json --benchmark_out=mysql.json
12 |
13 |
14 | pip3 install -r benchmark/requirements.txt
15 | benchmark/tools/compare.py -a --no-utest benchmarksfiltered ./mysql.json MySQL ./mariadb.json MariaDB
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | CMakeCache.txt
2 | CMakeFiles
3 | cmake_install.cmake
4 |
5 | Testing
6 | CTestTestfile.cmake
7 |
8 | ma_odbc_version.h
9 | wininstall/mariadb_conncpp.xml
10 | marconncpp.def
11 | maconncpp.rc
12 |
13 | *.vcxproj
14 | *.vcxproj.*
15 | *.sln
16 | *.suo
17 | *.sdf
18 | *.dir
19 | Debug
20 | Win32
21 | ipch
22 |
23 | *.msi
24 | *.wixobj
25 | *.wixpdb
26 |
27 | *.*~
28 | *.swp
29 | *.diff
30 | *.bak
31 | *.so
32 | *.dylib
33 | .idea/
34 | Makefile
35 | CPackConfig.cmake
36 | CPackSourceConfig.cmake
37 | benchmark/benchmark/
38 | benchmark/mysql-connector-cpp/
39 | benchmark/mariadb.json
40 | benchmark/mysql.json
41 | benchmark/main-benchmark
42 |
43 | # Prerequisites
44 | *.d
45 |
46 | # Compiled Object files
47 | *.slo
48 | *.lo
49 | *.o
50 | *.obj
51 |
52 | # Precompiled Headers
53 | *.gch
54 | *.pch
55 |
56 | # Compiled Dynamic libraries
57 | *.so
58 | *.dylib
59 | *.dll
60 |
61 | # Fortran module files
62 | *.mod
63 | *.smod
64 |
65 | # Compiled Static libraries
66 | *.lai
67 | *.la
68 | *.a
69 | *.lib
70 |
71 | # Executables
72 | *.exe
73 | *.out
74 | *.app
75 |
--------------------------------------------------------------------------------
/cmake/resources/macos/README.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 | Readme for MariaDB Connector/C++
9 |
10 |
11 | MariaDB Connector/C++ files will be installed in /Library/MariaDB/MariaDB-Connector-Cpp.
12 | Warning:The driver library requires latest versions of openssl libraries, that are not available natively, and can be obtained with Homebrew
13 | Homebrew installation instructions can be found here. The short version at the moment is to run the following command in the terminal:
14 |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
15 | The command to install openssl is:
brew install openssl@1.1
16 |
17 | - brew install openssl
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/cmake/resources/macos/WELCOME.html.in:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 | Welcome to MariaDB Connector/C++ Installer
9 |
10 |
11 | This is going to install MariaDB Connector/C++ 64bit version @CPACK_PACKAGE_VERSION@ - a database driver that implements JDBC-based API.
12 | Warning: The driver library requires the latest version of the openssl libraries.These are not natively available in macOS, but can be obtained using Homebrew
13 | Homebrew installation instructions can be found here. The short version at the moment is to run the following command in the terminal:
14 |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
15 | The command to install openssl is:
brew install openssl@1.1
16 |
17 |
18 |
--------------------------------------------------------------------------------
/benchmark/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -ex
4 |
5 | sudo apt-get update
6 | sudo apt-get -f -y install build-essential cmake
7 | sudo apt-get -f -y install libmariadb3 libmariadb-dev
8 | sudo apt-get -f -y install linux-tools-common linux-gcp linux-tools-$(uname -r)
9 | cmake . -DCONC_WITH_MSI=OFF -DCONC_WITH_UNIT_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DWITH_SSL=OPENSSL
10 | sudo cmake --build . --config Release --target install
11 | sudo make install
12 | echo $LD_LIBRARY_PATH
13 | export LD_LIBRARY_PATH=/usr/local/lib
14 | sudo install /usr/local/lib/mariadb/libmariadbcpp.so /usr/lib
15 | sudo install -d /usr/lib/mariadb
16 | sudo install -d /usr/lib/mariadb/plugin
17 |
18 | sudo ldconfig -n /usr/local/lib/mariadb || true
19 | sudo ldconfig -l -v /usr/lib/libmariadbcpp.so || true
20 |
21 | ls -lrt /usr/lib/libmar*
22 |
23 | #ldconfig -p
24 |
25 | #install mysql
26 | #git clone --recurse-submodules https://github.com/mysql/mysql-connector-cpp.git
27 | #cd mysql-connector-cpp
28 | #git checkout 8.0
29 | #
30 | #sudo apt-get install libboost-all-dev
31 | #
32 | #cmake . -DCMAKE_BUILD_TYPE=Release -DWITH_JDBC=ON -DWITH_BOOST=/usr/include/boost
33 | #sudo cmake --build . --target install --config Release
34 |
35 |
36 | sudo apt-get -y install libmysqlcppconn-dev
37 |
--------------------------------------------------------------------------------
/include/conncpp/compat/Array.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MariaDB C++ Connector
4 | *
5 | * Copyright (c) 2020 MariaDB Ab.
6 | *
7 | * This library is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Library General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * This library is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Library General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Library General Public
18 | * License along with this library; if not see
19 | * or write to the Free Software Foundation, Inc.,
20 | * 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
21 | *
22 | */
23 |
24 | #ifndef _ARRAY_H_
25 | #define _ARRAY_H_
26 | /* Stub class for the interface, that is used in one of methods for the non-implemented functionality. */
27 | namespace sql
28 | {
29 | class Array{
30 | Array(const Array&);
31 | void operator=(Array &);
32 | public:
33 | Array() {}
34 | virtual ~Array(){}
35 | };
36 | }
37 | #endif
38 |
--------------------------------------------------------------------------------
/include/conncpp/compat/Struct.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MariaDB C++ Connector
4 | *
5 | * Copyright (c) 2020 MariaDB Ab.
6 | *
7 | * This library is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Library General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * This library is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Library General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Library General Public
18 | * License along with this library; if not see
19 | * or write to the Free Software Foundation, Inc.,
20 | * 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
21 | *
22 | */
23 |
24 | #ifndef _STRUCT_H_
25 | #define _STRUCT_H_
26 | /* Stub class for the interface, that is used in one of methods for the non-implemented functionality. */
27 | namespace sql
28 | {
29 | class Struct{
30 | Struct(const Struct&);
31 | void operator=(Struct &);
32 | public:
33 | Struct() {}
34 | virtual ~Struct(){}
35 | };
36 | }
37 | #endif
38 |
--------------------------------------------------------------------------------
/include/conncpp/compat/Object.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MariaDB C++ Connector
4 | *
5 | * Copyright (c) 2020 MariaDB Ab.
6 | *
7 | * This library is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Library General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * This library is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Library General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Library General Public
18 | * License along with this library; if not see
19 | * or write to the Free Software Foundation, Inc.,
20 | * 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
21 | *
22 | */
23 |
24 | #ifndef _OBJECT_H_
25 | #define _OBJECT_H_
26 |
27 | /* Stub class for the interface, that is used in one of methods for the non-implemented functionality. */
28 | namespace sql
29 | {
30 | class Object{
31 | Object(const Object&);
32 | void operator=(Object &);
33 | public:
34 | Object() {}
35 | virtual ~Object(){}
36 | };
37 | }
38 | #endif
39 |
--------------------------------------------------------------------------------
/include/conncpp/compat/Executor.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MariaDB C++ Connector
4 | *
5 | * Copyright (c) 2020 MariaDB Ab.
6 | *
7 | * This library is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Library General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * This library is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Library General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Library General Public
18 | * License along with this library; if not see
19 | * or write to the Free Software Foundation, Inc.,
20 | * 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
21 | *
22 | */
23 |
24 | #ifndef _EXECUTOR_H_
25 | #define _EXECUTOR_H_
26 | /* Stub class for the interface, that is used in one of methods for the non-implemented functionality. */
27 | namespace sql
28 | {
29 | class Executor{
30 | Executor(const Executor&);
31 | void operator=(Executor &);
32 | public:
33 | Executor() {}
34 | virtual ~Executor(){}
35 | };
36 | }
37 | #endif
38 |
--------------------------------------------------------------------------------
/include/conncpp/compat/SQLType.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MariaDB C++ Connector
4 | *
5 | * Copyright (c) 2020 MariaDB Ab.
6 | *
7 | * This library is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Library General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or (at your option) any later version.
11 | *
12 | * This library is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Library General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Library General Public
18 | * License along with this library; if not see
19 | * or write to the Free Software Foundation, Inc.,
20 | * 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
21 | *
22 | */
23 |
24 | #ifndef _SQLTYPE_H_
25 | #define _SQLTYPE_H_
26 |
27 | namespace sql
28 | {
29 | class SQLType{
30 | SQLType(const SQLType&);
31 | void operator=(SQLType &);
32 | public:
33 | SQLType() {}
34 | virtual ~SQLType(){}
35 |
36 | virtual SQLString getName()=0;
37 | virtual SQLString getVendor()=0;
38 | virtual int SQLString getVendorTypeNumber()=0;
39 | };
40 | }
41 | #endif
42 |
--------------------------------------------------------------------------------
/src/Identifier.h:
--------------------------------------------------------------------------------
1 | /************************************************************************************
2 | Copyright (C) 2020 MariaDB Corporation AB
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not see
16 | or write to the Free Software Foundation, Inc.,
17 | 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
18 | *************************************************************************************/
19 |
20 |
21 | #ifndef _IDENTIFIER_H_
22 | #define _IDENTIFIER_H_
23 |
24 | #include "Consts.h"
25 |
26 | namespace sql
27 | {
28 | namespace mariadb
29 | {
30 |
31 | struct Identifier {
32 |
33 | SQLString schema;
34 | SQLString name;
35 | SQLString toString() const;
36 | };
37 |
38 | }
39 | }
40 | #endif
--------------------------------------------------------------------------------
/src/CArray.cpp:
--------------------------------------------------------------------------------
1 | /************************************************************************************
2 | Copyright (C) 2020 MariaDB Corporation AB
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not see
16 | or write to the Free Software Foundation, Inc.,
17 | 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
18 | *************************************************************************************/
19 |
20 | #include "buildconf.hpp"
21 | #include "CArrayImp.h"
22 |
23 | namespace sql
24 | {
25 | // Instantiating template classes that have to be exported
26 | template struct MARIADB_EXPORTED CArray;
27 | template struct MARIADB_EXPORTED CArray;
28 | template struct MARIADB_EXPORTED CArray;
29 | }
30 |
--------------------------------------------------------------------------------
/src/Charset.cpp:
--------------------------------------------------------------------------------
1 | /************************************************************************************
2 | Copyright (C) 2020 MariaDB Corporation AB
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not see
16 | or write to the Free Software Foundation, Inc.,
17 | 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
18 | *************************************************************************************/
19 |
20 |
21 | #include "Charset.h"
22 |
23 | namespace sql
24 | {
25 | namespace mariadb
26 | {
27 |
28 | Charset::Charset(const SQLString& name) : csName(name)
29 | {}
30 |
31 | Charset::~Charset()
32 | {}
33 |
34 | namespace StandardCharsets
35 | {
36 | const Charset UTF_8("utf8mb4");
37 |
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/parameters/ParameterHolder.cpp:
--------------------------------------------------------------------------------
1 | /************************************************************************************
2 | Copyright (C) 2020 MariaDB Corporation AB
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not see
16 | or write to the Free Software Foundation, Inc.,
17 | 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
18 | *************************************************************************************/
19 |
20 |
21 | #include "ParameterHolder.h"
22 |
23 | namespace sql
24 | {
25 | namespace mariadb
26 | {
27 | char ParameterHolder::BINARY_INTRODUCER[]= {'_','b','i','n','a','r','y',' ','\'','\0'};
28 | char ParameterHolder::QUOTE= '\'';
29 |
30 | ParameterHolder::~ParameterHolder()
31 | {
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/cmake/COPYING-CMAKE-SCRIPTS:
--------------------------------------------------------------------------------
1 | Redistribution and use in source and binary forms, with or without
2 | modification, are permitted provided that the following conditions
3 | are met:
4 |
5 | 1. Redistributions of source code must retain the copyright
6 | notice, this list of conditions and the following disclaimer.
7 | 2. Redistributions in binary form must reproduce the copyright
8 | notice, this list of conditions and the following disclaimer in the
9 | documentation and/or other materials provided with the distribution.
10 | 3. The name of the author may not be used to endorse or promote products
11 | derived from this software without specific prior written permission.
12 |
13 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 |
--------------------------------------------------------------------------------
/cmake/connector_c.cmake:
--------------------------------------------------------------------------------
1 | INCLUDE(FindGit)
2 |
3 | IF(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/libmariadb/CMakeLists.txt AND GIT_EXECUTABLE)
4 | EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule init
5 | WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
6 | EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update
7 | WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
8 | ENDIF()
9 | IF(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/libmariadb/CMakeLists.txt)
10 | MESSAGE(FATAL_ERROR "No MariaDB Connector/C! Run
11 | git submodule init
12 | git submodule update
13 | Then restart the build.
14 | ")
15 | ENDIF()
16 |
17 | SET(OPT CONC_)
18 |
19 | IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
20 | SET(CONC_WITH_RTC ON)
21 | ENDIF()
22 |
23 | SET(CONC_WITH_SIGNCODE ${SIGNCODE})
24 | SET(SIGN_OPTIONS ${SIGNTOOL_PARAMETERS})
25 |
26 | IF(TARGET zlib)
27 | GET_PROPERTY(ZLIB_LIBRARY_LOCATION TARGET zlib PROPERTY LOCATION)
28 | ELSE()
29 | SET(ZLIB_LIBRARY_LOCATION ${ZLIB_LIBRARY})
30 | ENDIF()
31 |
32 | SET(CONC_WITH_CURL OFF)
33 | SET(CONC_WITH_MYSQLCOMPAT ON)
34 |
35 | IF (INSTALL_LAYOUT STREQUAL "RPM")
36 | SET(CONC_INSTALL_LAYOUT "RPM")
37 | ELSE()
38 | SET(CONC_INSTALL_LAYOUT "DEFAULT")
39 | ENDIF()
40 |
41 | SET(PLUGIN_INSTALL_DIR ${INSTALL_PLUGINDIR})
42 | SET(MARIADB_UNIX_ADDR ${MYSQL_UNIX_ADDR})
43 |
44 | MESSAGE("== Configuring MariaDB Connector/C")
45 | ADD_SUBDIRECTORY(libmariadb EXCLUDE_FROM_ALL)
46 |
--------------------------------------------------------------------------------
/cmake/symlink.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2013-2016 MariaDB Corporation AB
3 | #
4 | # Redistribution and use is allowed according to the terms of the New
5 | # BSD license.
6 | # For details see the COPYING-CMAKE-SCRIPTS file.
7 | #
8 | MACRO(create_symlink symlink_name target install_path)
9 | # According to cmake documentation symlinks work on unix systems only
10 | IF(UNIX)
11 | # Get target components
12 | ADD_CUSTOM_COMMAND(
13 | OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${symlink_name}
14 | COMMAND ${CMAKE_COMMAND} ARGS -E remove -f ${symlink_name}
15 | COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink $ ${symlink_name}
16 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
17 | DEPENDS ${target}
18 | )
19 |
20 | ADD_CUSTOM_TARGET(SYM_${symlink_name}
21 | ALL
22 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${symlink_name})
23 | SET_TARGET_PROPERTIES(SYM_${symlink_name} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
24 |
25 | IF(CMAKE_GENERATOR MATCHES "Xcode")
26 | # For Xcode, replace project config with install config
27 | STRING(REPLACE "${CMAKE_CFG_INTDIR}"
28 | "\${CMAKE_INSTALL_CONFIG_NAME}" output ${CMAKE_CURRENT_BINARY_DIR}/${symlink_name})
29 | ENDIF()
30 |
31 | # presumably this will be used for libmysql*.so symlinks
32 | INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${symlink_name} DESTINATION ${install_path}
33 | COMPONENT Development)
34 | ENDIF()
35 | ENDMACRO()
36 |
--------------------------------------------------------------------------------
/src/util/StateChange.h:
--------------------------------------------------------------------------------
1 | /************************************************************************************
2 | Copyright (C) 2020 MariaDB Corporation AB
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not see
16 | or write to the Free Software Foundation, Inc.,
17 | 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
18 | *************************************************************************************/
19 |
20 |
21 | #ifndef _STATECHANGE_H_
22 | #define _STATECHANGE_H_
23 |
24 | #include "Consts.h"
25 |
26 | namespace sql
27 | {
28 | namespace mariadb
29 | {
30 | enum StateChange {
31 |
32 | SESSION_TRACK_SYSTEM_VARIABLES = 0,
33 | SESSION_TRACK_SCHEMA = 1,
34 | SESSION_TRACK_STATE_CHANGE = 2,
35 | SESSION_TRACK_GTIDS = 3,
36 | SESSION_TRACK_TRANSACTION_CHARACTERISTICS = 4,
37 | SESSION_TRACK_TRANSACTION_STATE = 5
38 | };
39 |
40 | }
41 | }
42 | #endif
43 |
--------------------------------------------------------------------------------
/src/Identifier.cpp:
--------------------------------------------------------------------------------
1 | /************************************************************************************
2 | Copyright (C) 2020 MariaDB Corporation AB
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not see
16 | or write to the Free Software Foundation, Inc.,
17 | 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
18 | *************************************************************************************/
19 |
20 |
21 | #include "Identifier.h"
22 |
23 | namespace sql
24 | {
25 | namespace mariadb
26 | {
27 |
28 | /**
29 | * Identifier string value.
30 | *
31 | * @return the datas.
32 | */
33 | SQLString Identifier::toString() const
34 | {
35 | if (!schema.empty())
36 | {
37 | SQLString result(schema);
38 | return result.append('.').append(name);
39 | }
40 | return name;
41 | }
42 |
43 |
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/StringImp.cpp:
--------------------------------------------------------------------------------
1 | /************************************************************************************
2 | Copyright (C) 2020 MariaDB Corporation AB
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not see
16 | or write to the Free Software Foundation, Inc.,
17 | 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
18 | *************************************************************************************/
19 |
20 | #include "StringImp.h"
21 |
22 | namespace sql
23 | {
24 | std::string& StringImp::get(SQLString& str) {
25 | return str.theString->realStr;
26 | }
27 |
28 |
29 | const std::string& StringImp::get(const SQLString& str) {
30 | return str.theString->realStr;
31 | }
32 |
33 |
34 | StringImp::StringImp(const char* str) : realStr(str) {
35 | }
36 |
37 |
38 | StringImp::StringImp(const char* str, std::size_t count) : realStr(str, count) {
39 | }
40 | }
41 |
42 |
--------------------------------------------------------------------------------
/src/credential/Credential.h:
--------------------------------------------------------------------------------
1 | /************************************************************************************
2 | Copyright (C) 2020 MariaDB Corporation AB
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not see
16 | or write to the Free Software Foundation, Inc.,
17 | 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
18 | *************************************************************************************/
19 |
20 |
21 | #ifndef _CREDENTIAL_H_
22 | #define _CREDENTIAL_H_
23 |
24 | #include "SQLString.hpp"
25 |
26 | namespace sql
27 | {
28 | namespace mariadb
29 | {
30 |
31 | class Credential {
32 | SQLString user;
33 | SQLString password;
34 |
35 | public:
36 | Credential(const SQLString& user, const SQLString& password);
37 | const SQLString& getUser() const;
38 | void setUser(const SQLString& user);
39 | const SQLString& getPassword() const;
40 | };
41 | }
42 | }
43 | #endif
--------------------------------------------------------------------------------
/include/conncpp/Savepoint.hpp:
--------------------------------------------------------------------------------
1 | /************************************************************************************
2 | Copyright (C) 2020 MariaDB Corporation AB
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not see
16 | or write to the Free Software Foundation, Inc.,
17 | 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
18 | *************************************************************************************/
19 |
20 |
21 | #ifndef _SAVEPOINT_H_
22 | #define _SAVEPOINT_H_
23 |
24 | #include "SQLString.hpp"
25 |
26 | namespace sql
27 | {
28 |
29 | class Savepoint
30 | {
31 | Savepoint(const Savepoint &);
32 | void operator=(Savepoint &);
33 |
34 | public:
35 | Savepoint() {}
36 | virtual ~Savepoint(){}
37 |
38 | virtual int32_t getSavepointId() const=0;
39 | virtual const SQLString& getSavepointName() const=0;
40 | virtual SQLString toString() const=0;
41 | };
42 |
43 | }
44 | #endif
45 |
--------------------------------------------------------------------------------
/src/PrepareResult.h:
--------------------------------------------------------------------------------
1 | /************************************************************************************
2 | Copyright (C) 2020 MariaDB Corporation AB
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not see
16 | or write to the Free Software Foundation, Inc.,
17 | 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
18 | *************************************************************************************/
19 |
20 |
21 | #ifndef _PREPARERESULT_H_
22 | #define _PREPARERESULT_H_
23 |
24 | #include "SQLString.hpp"
25 |
26 | namespace sql
27 | {
28 | namespace mariadb
29 | {
30 | class PrepareResult {
31 | PrepareResult(const PrepareResult &)=delete;
32 | void operator=(PrepareResult &)= delete;
33 | public:
34 | PrepareResult() {}
35 | virtual ~PrepareResult(){}
36 |
37 | virtual const SQLString& getSql() const=0;
38 | virtual size_t getParamCount() const=0;
39 | };
40 | }
41 | }
42 | #endif
43 |
--------------------------------------------------------------------------------
/src/Charset.h:
--------------------------------------------------------------------------------
1 | /************************************************************************************
2 | Copyright (C) 2020 MariaDB Corporation AB
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not see
16 | or write to the Free Software Foundation, Inc.,
17 | 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
18 | *************************************************************************************/
19 |
20 |
21 | #ifndef _CHARSET_H_
22 | #define _CHARSET_H_
23 |
24 | #include "StringImp.h"
25 |
26 | namespace sql
27 | {
28 | namespace mariadb
29 | {
30 |
31 | class Charset{
32 | //MariaDbCharset native;
33 | SQLString csName;
34 | Charset(const Charset&)=delete;
35 | void operator=(Charset &)=delete;
36 | public:
37 | Charset() {}
38 | Charset(const SQLString& name);
39 | ~Charset();
40 | };
41 |
42 | namespace StandardCharsets
43 | {
44 | extern const Charset UTF_8;
45 | };
46 |
47 | }
48 | }
49 | #endif
50 |
--------------------------------------------------------------------------------
/src/logger/LoggerFactory.h:
--------------------------------------------------------------------------------
1 | /************************************************************************************
2 | Copyright (C) 2020 MariaDB Corporation AB
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not see
16 | or write to the Free Software Foundation, Inc.,
17 | 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
18 | *************************************************************************************/
19 |
20 |
21 | #ifndef _LOGGERFACTORY_H_
22 | #define _LOGGERFACTORY_H_
23 |
24 | #include
25 |
26 | #include "Logger.h"
27 | #include "Consts.h"
28 |
29 | namespace sql
30 | {
31 | namespace mariadb
32 | {
33 | class LoggerFactory
34 | {
35 | static std::shared_ptr NO_LOGGER;
36 | static bool hasToLog;
37 | static bool initLoggersIfNeeded();
38 | public:
39 | static void init(bool mustLog);
40 | static Shared::Logger getLogger(const std::type_info &typeId);
41 | };
42 | }
43 | }
44 | #endif
--------------------------------------------------------------------------------
/src/options/DriverPropertyInfo.h:
--------------------------------------------------------------------------------
1 | /************************************************************************************
2 | Copyright (C) 2020, 2022 MariaDB Corporation AB
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not see
16 | or write to the Free Software Foundation, Inc.,
17 | 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
18 | *************************************************************************************/
19 |
20 | #ifndef _DRIVERPROPERTYINFO_H_
21 | #define _DRIVERPROPERTYINFO_H_
22 | namespace sql
23 | {
24 | namespace mariadb
25 | {
26 | struct DriverPropertyInfo {
27 | std::vector choices;
28 | SQLString description;
29 | SQLString name;
30 | SQLString value;
31 | bool required;
32 | DriverPropertyInfo(const SQLString& Name, const SQLString& Value) : name(Name), value(Value), required(false) {}
33 | };
34 | }
35 | }
36 | #endif
37 |
--------------------------------------------------------------------------------
/src/Dll.c:
--------------------------------------------------------------------------------
1 | /************************************************************************************
2 | Copyright (C) 2013,2019 MariaDB Corporation AB
3 | This library is free software; you can redistribute it and/or
4 | modify it under the terms of the GNU Library General Public
5 | License as published by the Free Software Foundation; either
6 | version 2.1 of the License, or (at your option) any later version.
7 | This library is distributed in the hope that it will be useful,
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 | Library General Public License for more details.
11 | You should have received a copy of the GNU Library General Public
12 | License along with this library; if not see
13 | or write to the Free Software Foundation, Inc.,
14 | 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
15 | *************************************************************************************/
16 | #include
17 |
18 | #include "mysql.h"
19 |
20 | BOOL __stdcall DllMain ( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
21 | {
22 | switch (fdwReason) {
23 | case DLL_PROCESS_ATTACH:
24 | mysql_library_init(0, NULL, NULL);
25 | break;
26 | case DLL_PROCESS_DETACH:
27 | mysql_library_end();
28 | break;
29 | case DLL_THREAD_ATTACH:
30 | mysql_thread_init();
31 | break;
32 | case DLL_THREAD_DETACH:
33 | mysql_thread_end();
34 | break;
35 | }
36 | return TRUE;
37 | }
38 |
--------------------------------------------------------------------------------
/src/MariaDbSavepoint.h:
--------------------------------------------------------------------------------
1 | /************************************************************************************
2 | Copyright (C) 2020 MariaDB Corporation AB
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not see
16 | or write to the Free Software Foundation, Inc.,
17 | 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
18 | *************************************************************************************/
19 |
20 |
21 | #ifndef _MARIADBSAVEPOINT_H_
22 | #define _MARIADBSAVEPOINT_H_
23 |
24 | #include "Consts.h"
25 |
26 | namespace sql
27 | {
28 | namespace mariadb
29 | {
30 |
31 | class MariaDbSavepoint : public Savepoint {
32 |
33 | int32_t savepointId;
34 | const SQLString name;
35 |
36 | public:
37 | MariaDbSavepoint(const SQLString& name,int32_t savepointId);
38 | int32_t getSavepointId() const;
39 | const SQLString& getSavepointName() const;
40 | SQLString toString() const;
41 | };
42 |
43 | }
44 | }
45 | #endif
46 |
--------------------------------------------------------------------------------
/cmake/ConnectorName.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2013-2022 MariaDB Corporation AB
3 | #
4 | # Redistribution and use is allowed according to the terms of the New
5 | # BSD license.
6 | # For details see the COPYING-CMAKE-SCRIPTS file.
7 | #
8 | MACRO(GET_CONNECTOR_PACKAGE_NAME name base_name)
9 | # check if we have 64bit
10 | IF(SIZEOF_VOIDP EQUAL 8)
11 | SET(IS64 1)
12 | ENDIF()
13 |
14 | SET (PLATFORM_NAME ${SYSTEM_NAME})
15 | SET (MACHINE_NAME ${CMAKE_SYSTEM_PROCESSOR})
16 | SET (CONCAT_SIGN "-")
17 |
18 | IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
19 | SET(PLATFORM_NAME "win")
20 | SET(CONCAT_SIGN "")
21 | IF(IS64)
22 | IF(CMAKE_C_COMPILER_ARCHITECTURE_ID)
23 | STRING(TOLOWER "${CMAKE_C_COMPILER_ARCHITECTURE_ID}" MACHINE_NAME)
24 | ELSE()
25 | SET(MACHINE_NAME x64)
26 | ENDIF()
27 | ELSE()
28 | SET(MACHINE_NAME "32")
29 | ENDIF()
30 | ENDIF()
31 |
32 | # Get revision number
33 | IF(WITH_REVNO)
34 | EXECUTE_PROCESS(COMMAND git log -n 1 --pretty="%h"
35 | OUTPUT_VARIABLE revno)
36 | STRING(REPLACE "\n" "" revno ${revno})
37 | ENDIF()
38 |
39 | IF(${revno})
40 | SET(product_name "${base_name}-${CPACK_PACKAGE_VERSION}-r${revno}-${PLATFORM_NAME}${CONCAT_SIGN}${MACHINE_NAME}")
41 | ELSE()
42 | IF(PACKAGE_PLATFORM_SUFFIX)
43 | SET(product_name "${base_name}-${CPACK_PACKAGE_VERSION}${QUALITY_SUFFIX}-${PACKAGE_PLATFORM_SUFFIX}")
44 | ELSE()
45 | SET(product_name "${base_name}-${CPACK_PACKAGE_VERSION}${QUALITY_SUFFIX}-${PLATFORM_NAME}${CONCAT_SIGN}${MACHINE_NAME}")
46 | ENDIF()
47 | ENDIF()
48 |
49 | STRING(TOLOWER ${product_name} ${name})
50 | ENDMACRO()
51 |
--------------------------------------------------------------------------------
/src/io/SocketHandlerFunction.h:
--------------------------------------------------------------------------------
1 | /************************************************************************************
2 | Copyright (C) 2020 MariaDB Corporation AB
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not see
16 | or write to the Free Software Foundation, Inc.,
17 | 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
18 | *************************************************************************************/
19 |
20 |
21 | #ifndef _SOCKETHANDLERFUNCTION_H_
22 | #define _SOCKETHANDLERFUNCTION_H_
23 |
24 | namespace sql
25 | {
26 | namespace mariadb
27 | {
28 |
29 | class Socket;
30 |
31 | class SocketHandlerFunction
32 | {
33 | SocketHandlerFunction(const SocketHandlerFunction &);
34 | void operator=(SocketHandlerFunction &);
35 |
36 | public:
37 | SocketHandlerFunction() {}
38 | virtual ~SocketHandlerFunction(){}
39 |
40 | virtual Socket* apply(Shared::Options &options, const SQLString& host)=0;
41 | };
42 |
43 | }
44 | }
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/src/credential/CredentialPluginLoader.h:
--------------------------------------------------------------------------------
1 | /************************************************************************************
2 | Copyright (C) 2020 MariaDB Corporation AB
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not see
16 | or write to the Free Software Foundation, Inc.,
17 | 51 Franklin St., Fifth Floor, Boston, MA 02110, USA
18 | *************************************************************************************/
19 |
20 |
21 | #ifndef _CREDENTIALPLUGINLOADER_H_
22 | #define _CREDENTIALPLUGINLOADER_H_
23 |
24 | #include