00001 // 00002 // File: include/odbcpp/environment.h 00003 // Object: Define the environment 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_ENVIRONMENT 00024 #define ODBCPP_ENVIRONMENT 00025 00026 #include "handle.h" 00027 #include <sqlext.h> 00028 00029 namespace odbcpp 00030 { 00031 00032 00033 00034 class environment : public handle 00035 { 00036 public: 00037 enum data_source_type_t { 00038 DATA_SOURCE_TYPE_ALL, 00039 DATA_SOURCE_TYPE_USER, 00040 DATA_SOURCE_TYPE_SYSTEM 00041 }; 00042 struct data_source_t { 00043 std::string f_server; 00044 std::string f_description; 00045 }; 00047 typedef std::vector<data_source_t> data_source_vector_t; 00048 00049 environment(SQLUINTEGER version = SQL_OV_ODBC3); 00050 00051 void set_attr(SQLINTEGER attr, SQLINTEGER integer); 00052 void set_attr(SQLINTEGER attr, SQLPOINTER ptr, SQLINTEGER length); 00053 void get_data_source(data_source_type_t type, data_source_vector_t& sources); 00054 void commit(); 00055 void rollback(); 00056 00057 private: 00058 }; 00059 00060 00061 } // namespace odbcpp 00062 00063 #endif // #ifndef ODBCPP_ENVIRONMENT