00001 // 00002 // File: include/odbcpp/connection.h 00003 // Object: Define the connect object of the odbcpp library 00004 // Project: http://www.m2osw.com/odbcpp 00005 // Author: alexis_wilke@sourceforge.net 00006 // 00007 // Copyright (C) 2008 Made to Order Software Corp. 00008 // 00009 // This program is free software: you can redistribute it and/or modify 00010 // it under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation, either version 3 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // This program is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU General Public License 00020 // along with this program. If not, see <http://www.gnu.org/licenses/> 00021 // or <http://gpl3.m2osw.com/>. 00022 // 00023 #ifndef ODBCPP_CONNECTION 00024 #define ODBCPP_CONNECTION 00025 00026 #include "environment.h" 00027 00028 namespace odbcpp 00029 { 00030 00031 00032 00033 class connection : public handle 00034 { 00035 public: 00036 connection(environment& env); 00037 ~connection(); 00038 00039 bool is_connected() const { return f_connected; } 00040 void set_attr(SQLINTEGER attr, SQLINTEGER integer); 00041 void set_attr(SQLINTEGER attr, SQLPOINTER ptr, SQLINTEGER length); 00042 void connect(const std::string& dns, const std::string& login, const std::string& passwd); 00043 void disconnect(); 00044 void commit(); 00045 void rollback(); 00046 00047 private: 00048 smartptr<environment> f_environment; 00049 bool f_connected; 00050 }; 00051 00052 00053 } // namespace odbcpp 00054 00055 #endif // #ifndef ODBCPP_CONNECTION 00056