/* * mSQL Driver Implementation * Exports the public methods used to create and instance of the driver under unix. * Copyright (C) 2003 Johnathan Ingram, jingram@rogueware.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US * */ #include #include #include "baseConnection.h" #include "msqlConnection.h" using namespace std; //Stop the C++ name mangling extern "C" { /* Create an instance of the driver. * @param argc Number of parameters and values. * @param argv Parameters that can be used to instantiate the driver with. * * @return Return the instance or NULL if an error occured. */ void* createDriverInstance(int argc, const char** argv) { try { MsqlConnection *msqlConnection = NULL; msqlConnection = new MsqlConnection(argc, argv); return (void*)msqlConnection; } catch(...) { return NULL; } } /* Destroy an instance of the driver. * * @return Return NULL for success or the the pointer to the instance for failure. * * @param driver The pointer to the driver instance. */ void* destroyDriverInstance( void* driver) { MsqlConnection *msqlConnection = (MsqlConnection*)driver; if (msqlConnection) { // Make sure we have the correct driver. if (strcmp( msqlConnection->driverName.c_str(), MSQL_DRIVERNAME) != 0) return driver; // Free the driver. delete msqlConnection; } return NULL; } /* Get the author of the driver. * * @return Return the author. */ const char* getAuthor() { return "Johnathan Ingram, jingram@rogueware.org"; } /* Get the vendor information of the driver. * * @return Return the vendor. */ const char* getVendor() { return "Rogueware, www.rogueware.org, GNU"; } /* Get the copyright information of the driver. * * @return Return the copyright information. */ const char* getCopyright() { return "Copyright (C) 2003 Johnathan Ingram, jingram@rogueware.org"; } /* Get the driver type * * @return Return the driver type. */ const char* getDriverType() { return "RDMS"; } /* Get the name of the driver. * * @return Return the driver name. */ const char* getDriverName() { return MSQL_DRIVERNAME; } /* Get the description of the driver. * * @return Return the driver description. */ const char* getDriverDesc() { return "Mini SQL Version 3 Database Driver (mSQL) "; } /* Returns the version of DbConnect this driver was compiled with. * * @return Return the DbConnect version. */ const char* getDbConnectVersion() { return DBCONNECTVER; } } // extern "C"