// Generated by using Rcpp::compileAttributes() -> do not edit by hand
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#ifndef RCPP_RClickhouse_RCPPEXPORTS_H_GEN_
#define RCPP_RClickhouse_RCPPEXPORTS_H_GEN_

#include <Rcpp.h>

namespace RClickhouse {

    using namespace Rcpp;

    namespace {
        void validateSignature(const char* sig) {
            Rcpp::Function require = Rcpp::Environment::base_env()["require"];
            require("RClickhouse", Rcpp::Named("quietly") = true);
            typedef int(*Ptr_validate)(const char*);
            static Ptr_validate p_validate = (Ptr_validate)
                R_GetCCallable("RClickhouse", "_RClickhouse_RcppExport_validate");
            if (!p_validate(sig)) {
                throw Rcpp::function_not_exported(
                    "C++ function with signature '" + std::string(sig) + "' not found in RClickhouse");
            }
        }
    }

    inline DataFrame fetch(XPtr<Result> res, ssize_t n) {
        typedef SEXP(*Ptr_fetch)(SEXP,SEXP);
        static Ptr_fetch p_fetch = NULL;
        if (p_fetch == NULL) {
            validateSignature("DataFrame(*fetch)(XPtr<Result>,ssize_t)");
            p_fetch = (Ptr_fetch)R_GetCCallable("RClickhouse", "_RClickhouse_fetch");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_fetch(Shield<SEXP>(Rcpp::wrap(res)), Shield<SEXP>(Rcpp::wrap(n)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<DataFrame >(rcpp_result_gen);
    }

    inline void clearResult(XPtr<Result> res) {
        typedef SEXP(*Ptr_clearResult)(SEXP);
        static Ptr_clearResult p_clearResult = NULL;
        if (p_clearResult == NULL) {
            validateSignature("void(*clearResult)(XPtr<Result>)");
            p_clearResult = (Ptr_clearResult)R_GetCCallable("RClickhouse", "_RClickhouse_clearResult");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_clearResult(Shield<SEXP>(Rcpp::wrap(res)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
    }

    inline bool hasCompleted(XPtr<Result> res) {
        typedef SEXP(*Ptr_hasCompleted)(SEXP);
        static Ptr_hasCompleted p_hasCompleted = NULL;
        if (p_hasCompleted == NULL) {
            validateSignature("bool(*hasCompleted)(XPtr<Result>)");
            p_hasCompleted = (Ptr_hasCompleted)R_GetCCallable("RClickhouse", "_RClickhouse_hasCompleted");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_hasCompleted(Shield<SEXP>(Rcpp::wrap(res)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<bool >(rcpp_result_gen);
    }

    inline size_t getRowCount(XPtr<Result> res) {
        typedef SEXP(*Ptr_getRowCount)(SEXP);
        static Ptr_getRowCount p_getRowCount = NULL;
        if (p_getRowCount == NULL) {
            validateSignature("size_t(*getRowCount)(XPtr<Result>)");
            p_getRowCount = (Ptr_getRowCount)R_GetCCallable("RClickhouse", "_RClickhouse_getRowCount");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_getRowCount(Shield<SEXP>(Rcpp::wrap(res)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<size_t >(rcpp_result_gen);
    }

    inline size_t getRowsAffected(XPtr<Result> res) {
        typedef SEXP(*Ptr_getRowsAffected)(SEXP);
        static Ptr_getRowsAffected p_getRowsAffected = NULL;
        if (p_getRowsAffected == NULL) {
            validateSignature("size_t(*getRowsAffected)(XPtr<Result>)");
            p_getRowsAffected = (Ptr_getRowsAffected)R_GetCCallable("RClickhouse", "_RClickhouse_getRowsAffected");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_getRowsAffected(Shield<SEXP>(Rcpp::wrap(res)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<size_t >(rcpp_result_gen);
    }

    inline std::string getStatement(XPtr<Result> res) {
        typedef SEXP(*Ptr_getStatement)(SEXP);
        static Ptr_getStatement p_getStatement = NULL;
        if (p_getStatement == NULL) {
            validateSignature("std::string(*getStatement)(XPtr<Result>)");
            p_getStatement = (Ptr_getStatement)R_GetCCallable("RClickhouse", "_RClickhouse_getStatement");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_getStatement(Shield<SEXP>(Rcpp::wrap(res)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<std::string >(rcpp_result_gen);
    }

    inline std::vector<std::string> resultTypes(XPtr<Result> res) {
        typedef SEXP(*Ptr_resultTypes)(SEXP);
        static Ptr_resultTypes p_resultTypes = NULL;
        if (p_resultTypes == NULL) {
            validateSignature("std::vector<std::string>(*resultTypes)(XPtr<Result>)");
            p_resultTypes = (Ptr_resultTypes)R_GetCCallable("RClickhouse", "_RClickhouse_resultTypes");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_resultTypes(Shield<SEXP>(Rcpp::wrap(res)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<std::vector<std::string> >(rcpp_result_gen);
    }

    inline XPtr<Client> connect(String host, int port, String db, String user, String password, String compression) {
        typedef SEXP(*Ptr_connect)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_connect p_connect = NULL;
        if (p_connect == NULL) {
            validateSignature("XPtr<Client>(*connect)(String,int,String,String,String,String)");
            p_connect = (Ptr_connect)R_GetCCallable("RClickhouse", "_RClickhouse_connect");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_connect(Shield<SEXP>(Rcpp::wrap(host)), Shield<SEXP>(Rcpp::wrap(port)), Shield<SEXP>(Rcpp::wrap(db)), Shield<SEXP>(Rcpp::wrap(user)), Shield<SEXP>(Rcpp::wrap(password)), Shield<SEXP>(Rcpp::wrap(compression)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<XPtr<Client> >(rcpp_result_gen);
    }

    inline void disconnect(XPtr<Client> conn) {
        typedef SEXP(*Ptr_disconnect)(SEXP);
        static Ptr_disconnect p_disconnect = NULL;
        if (p_disconnect == NULL) {
            validateSignature("void(*disconnect)(XPtr<Client>)");
            p_disconnect = (Ptr_disconnect)R_GetCCallable("RClickhouse", "_RClickhouse_disconnect");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_disconnect(Shield<SEXP>(Rcpp::wrap(conn)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
    }

    inline XPtr<Result> select(XPtr<Client> conn, String query) {
        typedef SEXP(*Ptr_select)(SEXP,SEXP);
        static Ptr_select p_select = NULL;
        if (p_select == NULL) {
            validateSignature("XPtr<Result>(*select)(XPtr<Client>,String)");
            p_select = (Ptr_select)R_GetCCallable("RClickhouse", "_RClickhouse_select");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_select(Shield<SEXP>(Rcpp::wrap(conn)), Shield<SEXP>(Rcpp::wrap(query)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<XPtr<Result> >(rcpp_result_gen);
    }

    inline void insert(XPtr<Client> conn, String tableName, DataFrame df) {
        typedef SEXP(*Ptr_insert)(SEXP,SEXP,SEXP);
        static Ptr_insert p_insert = NULL;
        if (p_insert == NULL) {
            validateSignature("void(*insert)(XPtr<Client>,String,DataFrame)");
            p_insert = (Ptr_insert)R_GetCCallable("RClickhouse", "_RClickhouse_insert");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_insert(Shield<SEXP>(Rcpp::wrap(conn)), Shield<SEXP>(Rcpp::wrap(tableName)), Shield<SEXP>(Rcpp::wrap(df)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
    }

    inline bool validPtr(SEXP ptr) {
        typedef SEXP(*Ptr_validPtr)(SEXP);
        static Ptr_validPtr p_validPtr = NULL;
        if (p_validPtr == NULL) {
            validateSignature("bool(*validPtr)(SEXP)");
            p_validPtr = (Ptr_validPtr)R_GetCCallable("RClickhouse", "_RClickhouse_validPtr");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_validPtr(Shield<SEXP>(Rcpp::wrap(ptr)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<bool >(rcpp_result_gen);
    }

}

#endif // RCPP_RClickhouse_RCPPEXPORTS_H_GEN_
