recordtest.cxx

来自「vovida的软交换」· CXX 代码 · 共 47 行

CXX
47
字号
#include "AccountRecord.hxx"
#include "RecordTypes.h"
#include <iostream>

int main(void) { 
  
    DBConnection* dbconn = NULL;

    cout << "Creating test record\n";
    Record* rec = Record::createNewRecord(ACCOUNT_RECORD);
    cout << "Created record :\n";

    rec->displayRecord();
        
    cout << "Checking record type ...\n";
    cout << "Record Type : " << rec->getRecordTypeAsString();
    cout << " (" << rec->getRecordType() << ")\n\n";

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

    //rec->displayRecord();

    // Now check and cast to a TestRecord

    AccountRecord* testRecord;
    if (rec->getRecordType() != ACCOUNT_RECORD) { 
	return 0; // This shouldn't happen
    }
    testRecord = (AccountRecord*)rec;

    // Now set the data 
    
    testRecord->setUserName("suhac");
    testRecord->setGroupName("nPlusOne");
    testRecord->setCentrexID(1);
    testRecord->setAuthType("Access List");
    testRecord->setPassword("v01pfun");
    testRecord->setStaticReg("212.20.231.138");
                                        
    rec->displayRecord();
    // Could now do an amend
    rec->amendRecord(dbconn);

    return 0;
}

⌨️ 快捷键说明

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