00001 /* 00002 * Copyright 2004-2006 Intel Corporation 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef _OASYS_SQL_IMPLEMENTATION_H_ 00018 #define _OASYS_SQL_IMPLEMENTATION_H_ 00019 00020 00021 #include <string.h> 00022 #include "Serialize.h" 00023 00024 namespace oasys { 00025 00029 class SQLImplementation { 00030 public: 00034 SQLImplementation(const char* binary_datatype, 00035 const char* boolean_datatype) 00036 : binary_datatype_(binary_datatype), 00037 boolean_datatype_(boolean_datatype) {} 00038 00042 virtual int connect(const char* dbname) = 0; 00043 00047 virtual int close() = 0; 00048 00052 virtual bool has_table(const char* tablename) = 0; 00053 00058 virtual int exec_query(const char* query) = 0; 00059 00063 virtual int num_tuples() = 0; 00064 00068 const char* binary_datatype() { return binary_datatype_; } 00069 00073 const char* boolean_datatype() { return boolean_datatype_; } 00074 00078 virtual const char* escape_string(const char* from) = 0; 00079 00083 virtual const u_char* escape_binary(const u_char* from, int len) = 0; 00084 00089 virtual const u_char* unescape_binary(const u_char* from) = 0; 00090 00094 virtual const char* get_value(int tuple_no, int field_no) = 0; 00095 00096 virtual ~SQLImplementation(); 00097 00098 protected: 00099 const char* binary_datatype_; 00100 const char* boolean_datatype_; 00101 00102 private: 00103 SQLImplementation(); 00104 }; 00105 00106 } // namespace oasys 00107 00108 #endif /* _OASYS_SQL_IMPLEMENTATION_H_ */