⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 accountrecordtest.cxx

📁 vovida的软交换
💻 CXX
字号:
#include "AccountRecord.hxx"
#include "RecordTypes.h"
#include "ConnectionManager.hxx"
#include "DBConnThread.hxx"
#include "DBInfo.h"
#include "cpLog.h"

#include <iostream>

int main(void) { 
  
  cpLogSetPriority(LOG_DEBUG);
  
  DBConnection* dbconn = NULL;
  
    ConnectionManager *myDBManager = ConnectionManager::getInstance();
    DBConnThread *dbthread = new DBConnThread(myDBManager);
    dbthread->run();

    DBInfo dbInfo;
    
    dbInfo.dbBackend = "PGSQL";
    dbInfo.database = "vocal";
    dbInfo.host = "telcodev.ednet.co.uk";
    dbInfo.user = "vocal";
    dbInfo.password = "vocal";
    
    dbconn = myDBManager->searchDBConPool(dbInfo);
    
    cout << "Creating test record\n";
    Record* rec = Record::createNewRecord(ACCOUNT_RECORD);
    cout << "Created record :\n";
    
    cout << "Checking record type ...\n";
    cout << "Record Type : " << Record::stringRecordType(rec->getRecordType());
    cout << " (" << rec->getRecordType() << ")\n\n";

    cout << "Setting key to 'suhac' and populate record\n";
    rec->populateRecord("suhac", dbconn);

    // Now check and cast to an AccountRecord

    AccountRecord* testRecord;
    if (rec->getRecordType() != ACCOUNT_RECORD) { 
	return 0; // This shouldn't happen
    }
    testRecord = (AccountRecord*)rec;
                                   
    rec->displayRecord();
    // Could now do an amend
    
    testRecord->setKey("colinc");
    testRecord->setCentrexID(3);
    
    rec->insertRecord(dbconn);

    dbthread->shutdown();
    dbthread->join();
        
    delete dbthread;
    delete myDBManager;
    
    return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -