ErrorCode _CCONV FSBase::backupIncremental(const char * path, unsigned * amountChanged) { if (path == nullptr) return INVALIDARG; StringParser otherParser; if (!otherParser.initialize(path)) otherParser.setServer(path); if (otherParser.getServer().empty()) return INVALIDARG; if (!createDir(otherParser.getServer())) return FAILEDTOGETWINDIR; fstream file; string data; ErrorCode retVal = getLogFileData(otherParser.getServer(), file, data); if (failed(retVal)) return retVal; PathTimeLog log(parser.getServer(), data); if (log.isCorrupted()) return LOG_CORRUPTED; unsigned amountBackup = 0; retVal = backupAux(parser.getServer(), otherParser.getServer(), &log.getLastBackupTime(), amountBackup); if (failed(retVal)) return retVal; replaceRecordInData(parser.getServer(), log.getNowTime(), data); retVal = setLogFileData(otherParser.getServer(), file, data); if (amountChanged != nullptr) *amountChanged = amountBackup; return retVal; }
ErrorCode _CCONV FSBase::backupFull(const char * path, unsigned * amountChanged) { if (path == nullptr) return INVALIDARG; StringParser otherParser; if (!otherParser.initialize(path)) otherParser.setServer(path); if (otherParser.getServer().empty()) return INVALIDARG; if (!createDir(otherParser.getServer())) return FAILEDTOGETWINDIR; unsigned amountBackup = 0; ErrorCode res = backupAux(parser.getServer(), otherParser.getServer(), NULL, amountBackup); if (amountChanged != nullptr) *amountChanged = amountBackup; return res; }
string mergeServerDbTable(const StringParser & parser) { string ret = d_makeWithQuotes(parser.getServer()); if (!parser.getDbName().empty()) { ret += string(",") + d_makeWithQuotes(parser.getDbName()) + ',' + d_makeWithQuotes(parser.getTableName()); } return ret; }
SQLRETURN connectToDb(HENV henv, const StringParser & parser, HDBC & hdbc) { SQLRETURN retcode = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc); check_rc(retcode, retcode); //for massive copy //retcode = SQLSetConnectAttr(hdbc, SQL_COPT_SS_BCP, (void *)SQL_BCP_ON, SQL_IS_INTEGER); //check_rc(retcode, "SQLSetConnectAttr(hdbc1) Failed\n\n"); string szDSN = "Driver={SQL Server Native Client 11.0};Server=" + parser.getServer() + ";Database=" + parser.getDbName() + ";UID=" + parser.getLogin() + ";PWD=" + parser.getPass(); retcode = connect(hdbc, (SQLCHAR*)szDSN.c_str()); if (!MYSQLSUCCESS(retcode)) { SQLFreeHandle(SQL_HANDLE_DBC, hdbc); return retcode; } //retcode = SQLSetConnectAttr(hdbc, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER)TRUE, 0); return retcode; }