3 #ifndef __EIENDB_COMMON_HPP__ 4 #define __EIENDB_COMMON_HPP__ 20 #if defined(__GNUC__) || _MSC_VER > 1200 21 template <
size_t _N >
30 template <
typename _Ty >
31 size_t addRow( std::vector<_Ty>
const & values )
34 typename std::vector<_Ty>::const_iterator it;
35 for ( it = values.begin(); it != values.end(); ++it )
37 newRow.push_back(*it);
39 size_t index = _dataRows.size();
40 _dataRows.push_back(newRow);
44 #if defined(__GNUC__) || _MSC_VER > 1200 45 template <
typename _Ty,
size_t _N >
50 for ( i = 0; i < _N; ++i )
52 newRow.push_back(values[i]);
54 size_t index = _dataRows.size();
55 _dataRows.push_back(newRow);
60 virtual bool dataSeek(
size_t index )
override;
61 virtual bool fetchRow(
winux::Mixed * fields,
int type = 0 )
override;
65 virtual bool free()
override {
return true; }
66 virtual size_t fieldsCount()
override {
return _fieldNames.size(); }
67 virtual size_t rowsCount()
override {
return _dataRows.size(); }
68 virtual winux::String fieldType(
size_t fieldIndex )
override;
73 std::vector<winux::MixedArray> _dataRows;
104 bool onErrorNext =
false,
105 bool storeError =
true,
106 ProgressCallback progress = NULL,
160 void backupTableStructure(
winux::String const & tableName );
165 void backupTableData(
winux::String const & tableName,
bool noDeleteFrom =
false, ProgressCallback progress = NULL,
void * param = NULL );
168 void backupDb(
bool backupStructure =
true,
bool noDeleteFrom =
false, ProgressCallback progress = NULL,
void * param = NULL );
211 operator bool()
const {
return (
bool)_cnn && (bool)*_cnn.get(); }
222 void _doCreateConnection();
229 #endif // __EIENDB_COMMON_HPP__
SQL脚本执行器。执行多条语句,保存结果和错误信息。
bool(* ProgressCallback)(SqlScript *script, size_t iCurSql, winux::String const &errStr, void *param)
SqlScript的进度回调函数指针类型
std::map< String, Mixed > StringMixedMap
IDbConnection * cnn()
获取Connection指针
MemoryResult(winux::String(&fields)[_N])
winux::StringArray const & sqls()
SQL语句数组
#define DISABLE_OBJECT_COPY(clsname)
winux::Mixed const & config() const
获取配置参数的引用
size_t addRow(_Ty(&values)[_N])
std::vector< Mixed > MixedArray
virtual size_t fieldsCount() override
获取结果里的字段数
size_t rowIndex
行索引 vaild if type=bptBackupData
virtual size_t rowsCount() override
获取结果里的记录数
数据库备份器。把数据备份成SQL脚本,方便跨数据库转移。
virtual bool free() override
释放Result资源
virtual winux::String fieldName(size_t fieldIndex) override
获取结果集中指定字段的名称
winux::StringArray const & errors()
错误信息数组
XStringArray< tchar > StringArray
size_t addRow(std::vector< _Ty > const &values)
添加一数据行,返回索引值
size_t rowsCount
行数 vaild if type=bptBackupData