Skip to content

Commit

Permalink
Merge c85435b into eda7798
Browse files Browse the repository at this point in the history
  • Loading branch information
zussel committed Jul 8, 2019
2 parents eda7798 + c85435b commit 32dd5fe
Show file tree
Hide file tree
Showing 148 changed files with 4,901 additions and 3,377 deletions.
557 changes: 128 additions & 429 deletions .travis.yml

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions CMakeLists.txt
Expand Up @@ -47,9 +47,7 @@ ELSEIF(MSVC)
ENDIF()


MESSAGE(STATUS "Architecture: ${CMAKE_SYSTEM_PROCESSOR}")
MESSAGE(STATUS "Architecture System: ${CMAKE_SYSTEM_NAME}")

MESSAGE(STATUS "Architecture: ${CMAKE_SYSTEM_PROCESSOR} ${CMAKE_SYSTEM_NAME}")

SET(SYSTEM_NAME_LOWER)
STRING(TOLOWER ${CMAKE_SYSTEM_NAME} SYSTEM_NAME_LOWER)
Expand Down Expand Up @@ -112,6 +110,7 @@ SET(BACKENDS
SQLite3
MySQL
ODBC
PostgreSQL
)

FOREACH(backend ${BACKENDS})
Expand All @@ -137,7 +136,7 @@ FOREACH(backend ${BACKENDS})
ENDFOREACH(backend)

IF (SQLITE3_FOUND)
MESSAGE(STATUS "Adding SQLite3 include directory")
MESSAGE(STATUS "Adding SQLite3 include directory: ${SQLITE3_INCLUDE_DIR}")
INCLUDE_DIRECTORIES(${SQLITE3_INCLUDE_DIR})
ELSE ()
MESSAGE(STATUS "Not adding SQLite3 include directory")
Expand Down
6 changes: 3 additions & 3 deletions appveyor.yml
Expand Up @@ -61,7 +61,7 @@ before_build:
cd "$env:APPVEYOR_BUILD_FOLDER"
mkdir build
cd build
cmake -G "$env:generator" -DMATADOR_ODBC=true -DMSSQL_CONNECTION_STRING:STRING="mssql://sa:Password12!@(local)\\SQL2014/matador_test" -DMATADOR_SQLITE3=true -DMATADOR_MYSQL=true -DMYSQL_CONNECTION_STRING:STRING="mysql://root:Password12!@localhost/matador_test" ..
cmake -G "$env:generator" -DMATADOR_ODBC=true -DMATADOR_POSTGRESQL=false -DMSSQL_CONNECTION_STRING:STRING="mssql://sa:Password12!@(local)\\SQL2014/matador_test" -DMATADOR_SQLITE3=true -DMATADOR_MYSQL=true -DMYSQL_CONNECTION_STRING:STRING="mysql://root:Password12!@localhost/matador_test" ..
# cmake -G "$env:generator" -DMATADOR_ODBC=true -DMSSQL_CONNECTION_STRING:STRING="mssql://sa:Password12!@(local)\\SQL2014/matador_test" -DMATADOR_SQLITE3=true -DMATADOR_MYSQL=false ..
build_script:
Expand All @@ -80,13 +80,13 @@ after_build:
artifacts:
- path: Package/matador*.exe
name: installer
- path: Package/calc*.zip
- path: Package/matador*.zip
name: zipper

deploy:
provider: GitHub
auth_token:
secure: "kz/25t/c0oeOJ3Ux3r+Sy5F4G7YgPmjSrTpgZ73IQDY4N9mYNqH4kAv4+0I0oeh6"
secure: ubPcMpzrx0ulil7eJMpQbO94ufnvHXeeHoXpxr8RAMQXRMShsvlPj4ZE94cZ4T7j
artifact: installer,zipper
draft: false
prerelease: false
Expand Down
64 changes: 0 additions & 64 deletions cmake/FindODBC.cmake

This file was deleted.

64 changes: 32 additions & 32 deletions cmake/FindSQLite3.cmake
Expand Up @@ -6,46 +6,46 @@

set(PROGRAMFILES $ENV{ProgramFiles})
if (DEFINED ENV{ProgramW6432})
set(PROGRAMFILES $ENV{ProgramW6432})
set(PROGRAMFILES $ENV{ProgramW6432})
endif()

IF (WIN32)
FIND_PATH( SQLITE3_INCLUDE_DIR sqlite3.h
$ENV{PROGRAMFILES}/SQLite/include/
${PROGRAMFILES}/SQLite/include/
DOC "The directory where sqlite3.h resides"
)
FIND_PATH( SQLITE3_INCLUDE_DIR sqlite3.h
$ENV{PROGRAMFILES}/SQLite/include/
${PROGRAMFILES}/SQLite/include/
DOC "The directory where sqlite3.h resides"
)

FIND_LIBRARY( SQLITE3_LIBRARY
NAMES sqlite3
PATHS
$ENV{PROGRAMFILES}/SQLite/lib/
${PROGRAMFILES}/SQLite/lib/
DOC "The SQLite3 library"
)
FIND_LIBRARY( SQLITE3_LIBRARY
NAMES sqlite3
PATHS
$ENV{PROGRAMFILES}/SQLite/lib/
${PROGRAMFILES}/SQLite/lib/
DOC "The SQLite3 library"
)
ELSE (WIN32)
FIND_PATH( SQLITE3_INCLUDE_DIR sqlite3.h
/usr/include
/usr/local/include
/sw/include
/opt/local/include
DOC "The directory where sqlite3.h resides")
FIND_LIBRARY( SQLITE3_LIBRARY
NAMES sqlite3
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
DOC "The SQLite3 library")
FIND_PATH( SQLITE3_INCLUDE_DIR sqlite3.h
/usr/include
/usr/local/include
/sw/include
/opt/local/include
DOC "The directory where sqlite3.h resides")
FIND_LIBRARY( SQLITE3_LIBRARY
NAMES sqlite3
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
DOC "The SQLite3 library")
ENDIF (WIN32)

IF (SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY)
SET( SQLITE3_FOUND TRUE CACHE STRING "Set to TRUE if SQLite3 is found, FALSE otherwise")
SET( SQLITE3_FOUND TRUE CACHE STRING "Set to TRUE if SQLite3 is found, FALSE otherwise")
ELSE (SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY)
SET( SQLITE3_FOUND FALSE CACHE STRING "Set to TRUE if SQLite3 is found, FALSE otherwise")
SET( SQLITE3_FOUND FALSE CACHE STRING "Set to TRUE if SQLite3 is found, FALSE otherwise")
ENDIF (SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY)

MARK_AS_ADVANCED( SQLITE3_FOUND )
MARK_AS_ADVANCED( SQLITE3_FOUND )
4 changes: 2 additions & 2 deletions include/matador/db/mssql/mssql_statement.hpp
Expand Up @@ -140,8 +140,8 @@ class mssql_statement : public detail::statement_impl

bool bind_null_ = false;

SQLHANDLE stmt_;
SQLHANDLE db_;
SQLHANDLE stmt_ = nullptr;
SQLHANDLE db_ = nullptr;
};

}
Expand Down
8 changes: 6 additions & 2 deletions include/matador/db/mysql/mysql_connection.hpp
Expand Up @@ -46,6 +46,7 @@ namespace matador {
namespace mysql {

class mysql_statement;
class mysql_result;

/**
* @class mysql_database
Expand Down Expand Up @@ -81,7 +82,7 @@ class OOS_MYSQL_API mysql_connection : public connection_impl
void close() override;

detail::result_impl* execute(const matador::sql &stmt) override;
detail::result_impl* execute(const std::string &stmt) override;
detail::result_impl* execute(const std::string &sql) override;
detail::statement_impl* prepare(const matador::sql &stmt) override;

void begin() override;
Expand All @@ -97,7 +98,10 @@ class OOS_MYSQL_API mysql_connection : public connection_impl
basic_dialect* dialect() override;

private:
MYSQL mysql_;
mysql_result* execute_internal(const std::string &stmt);

private:
MYSQL mysql_ = MYSQL();
std::string db_;
bool is_open_;
mysql_dialect dialect_;
Expand Down
16 changes: 4 additions & 12 deletions include/matador/db/mysql/mysql_result.hpp
Expand Up @@ -83,19 +83,11 @@ class mysql_result : public detail::result_impl
bool finalize_fetch() override;

private:
// struct result_deleter
// {
// void operator()(MYSQL_RES *res) const {
// if (res) {
// mysql_free_result(res);
// }
// }
// };
size_type affected_rows_;
size_type rows_;
size_type fields_;
size_type affected_rows_ = 0;
size_type rows_ = 0;
size_type fields_ = 0;
MYSQL_ROW row_;
MYSQL_RES *res_;
MYSQL_RES *res_ = nullptr;
};

}
Expand Down
2 changes: 1 addition & 1 deletion include/matador/db/mysql/mysql_statement.hpp
Expand Up @@ -20,7 +20,6 @@

#include "matador/sql/statement_impl.hpp"

#include "matador/utils/identifier.hpp"
#include "matador/utils/varchar.hpp"

#include "matador/db/mysql/mysql_result_info.hpp"
Expand All @@ -41,6 +40,7 @@ namespace matador {
class varchar_base;
class time;
class date;
class basic_identifier;

namespace mysql {

Expand Down
105 changes: 105 additions & 0 deletions include/matador/db/postgresql/postgresql_connection.hpp
@@ -0,0 +1,105 @@
//
// Created by sascha on 24.05.19.
//

#ifndef MATADOR_POSTGRESQL_CONNECTION_HPP
#define MATADOR_POSTGRESQL_CONNECTION_HPP

#ifdef _MSC_VER
#ifdef matador_postgresql_EXPORTS
#define MATADOR_POSTGRESQL_API __declspec(dllexport)
#else
#define MATADOR_POSTGRESQL_API __declspec(dllimport)
#endif
#pragma warning(disable: 4355)
#else
#define MATADOR_POSTGRESQL_API
#endif

#include "matador/sql/connection_impl.hpp"
#include "matador/sql/types.hpp"

#include "matador/db/postgresql/postgresql_dialect.hpp"

#include <libpq-fe.h>

namespace matador {

namespace postgresql {

class postgresql_statement;
class postgresql_result;

/**
* @class mysql_database
* @brief The mysql sql backend
*
* This class is the sqlite sql backend
* class. It provides the mysql version 4 and higher
*/
class MATADOR_POSTGRESQL_API postgresql_connection : public connection_impl
{
public:
postgresql_connection();
~postgresql_connection() override;

/**
* Returns true if the sql is open
*
* @return True on open sql connection.
*/
bool is_open() const override;

virtual unsigned long last_inserted_id();

/**
* Return the raw pointer to the sqlite3
* database struct.
*
* @return The raw sqlite3 pointer.
*/
// MYSQL* handle();

void open(const std::string &db) override;
void close() override;

detail::result_impl* execute(const matador::sql &stmt) override;
detail::result_impl* execute(const std::string &stmt) override;
detail::statement_impl* prepare(const matador::sql &stmt) override;

void begin() override;
void commit() override;
void rollback() override;

std::string type() const override;
std::string version() const override;

bool exists(const std::string &table_name) override;
std::vector<field> describe(const std::string &table) override;

basic_dialect* dialect() override;

PGconn* handle() const;

private:
postgresql_result* execute_internal(const std::string &stmt);

private:
std::string db_;
bool is_open_;
postgresql_dialect dialect_;
PGconn *conn_ = nullptr;
};

}

}

extern "C"
{
MATADOR_POSTGRESQL_API matador::connection_impl* create_database();

MATADOR_POSTGRESQL_API void destroy_database(matador::connection_impl *db);
}

#endif //MATADOR_POSTGRESQL_CONNECTION_HPP

0 comments on commit 32dd5fe

Please sign in to comment.