Sha256: d9050e53843c36899b3f14ca477fd6d5ed06d94ad8c8aeafced070ee761c088b
Contents?: true
Size: 1.43 KB
Versions: 27
Compression:
Stored size: 1.43 KB
Contents
#include <stdio.h> #include <bzs/db/protocol/tdap/client/database.h> #include <bzs/db/protocol/tdap/client/table.h> #include <bzs/db/protocol/tdap/client/dbDef.h> using namespace bzs::db::protocol::tdap::client; using namespace bzs::db::protocol::tdap; /** @brief drop database example This program drop "test" database. */ /** show database operation error */ void showError(const _TCHAR* caption, const _TCHAR* tableName, short statusCode) { _TCHAR tmp[1024] = { 0x00 }; nstable::tdapErr(0x00, statusCode, tableName, tmp); _tprintf(_T("[ERROR] %s No.%ld %s\n"), caption, statusCode, tmp); } /** Open database */ bool openDbExclusive(database* db, const _TCHAR* uri) { db->open(uri, TYPE_SCHEMA_BDF, TD_OPEN_EXCLUSIVE); if (db->stat() != 0) { showError(_T("open daatabase"), NULL, db->stat()); return false; } return true; } #pragma argsused int _tmain(int argc, _TCHAR* argv[]) { int result = 1; static const _TCHAR* uri = _T("tdap://localhost/test?dbfile=test.bdf"); database* db = database::create(); if (openDbExclusive(db, uri)) { db->drop(); if (db->stat() != 0) showError(_T("drop daatabase"), NULL, db->stat()); result = db->stat(); if (result == 0) _tprintf(_T("Drop daatabase success. \n")); db->close(); } database::destroy(db); return result; }
Version data entries
27 entries across 27 versions & 1 rubygems