本文整理汇总了C++中ADB::query方法的典型用法代码示例。如果您正苦于以下问题:C++ ADB::query方法的具体用法?C++ ADB::query怎么用?C++ ADB::query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ADB
的用法示例。
在下文中一共展示了ADB::query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setLoginID
void LogCall::setLoginID(const char * newLoginID)
{
QApplication::setOverrideCursor(waitCursor);
if (strlen(newLoginID) < 32) {
strcpy(myLoginID, newLoginID);
loginID->setText(myLoginID);
if (strlen(myLoginID)) {
// Now, get the customer ID for this login ID
char *query = new char[32768];
ADB DB;
DB.query("select CustomerID from Logins where LoginID = '%s'", myLoginID);
if (DB.rowCount == 1) {
DB.getrow();
myCustID = atol(DB.curRow["CustomerID"]);
// Load the customer's name so we can verify who we're talking
// to.
CustomersDB CDB;
CDB.get(myCustID);
strcpy(custName, (const char *) CDB.getStr("FullName"));
sprintf(query, "Customer ID %ld selected (%s)", myCustID, custName);
statusLabel->setText(query);
} else {
myCustID = 0;
statusLabel->setText("No customer selected");
}
} else {
myCustID = 0;
statusLabel->setText("No customer selected");
}
}
QApplication::restoreOverrideCursor();
}
示例2: fillDepositList
void MakeDeposits::fillDepositList()
{
QApplication::setOverrideCursor(waitCursor);
ADB DB;
char tmpStr[1024];
float totalFunds = 0.00;
strcpy(tmpStr, cfgVal("UndepositedFundsAccount"));
emit(setStatus("Creating undeposited funds list..."));
DB.query("select GL.InternalID, GL.TransDate, GL.Amount, AcctsRecv.RefNo, AcctsRecv.CustomerID, Customers.FullName from GL, AcctsRecv, Customers where GL.IntAccountNo = %d and GL.TransType = 2 and AcctsRecv.InternalID = GL.TransTypeLink and AcctsRecv.RefNo > 0 and Customers.CustomerID = AcctsRecv.CustomerID and GL.Cleared = 0", atoi(cfgVal("UndepositedFundsAcct")));
//DB.query("select * from GL where AccountNo = %d and LinkedTrans = 0", atoi(tmpStr));
if (DB.rowCount) while (DB.getrow()) {
(void) new Q3ListViewItem(paymentList,
DB.curRow["TransDate"],
DB.curRow["CustomerID"],
DB.curRow["FullName"],
DB.curRow["RefNo"],
DB.curRow["Amount"],
DB.curRow["InternalID"]
);
totalFunds += atof(DB.curRow["Amount"]);
}
sprintf(tmpStr, "$%.2f", totalFunds);
undepositedAmount->setText(tmpStr);
emit(setStatus(""));
QApplication::restoreOverrideCursor();
}
示例3: refreshReport
void UnreleasedDomainsReport::refreshReport()
{
repBody->clear();
ADB DB;
DB.query("select Domains.CustomerID, Domains.LoginID, DomainTypes.DomainType, Domains.DomainName from Domains, DomainTypes where Domains.Active <> 0 and Domains.Released = '' and DomainTypes.InternalID = Domains.DomainType");
if (DB.rowCount) while (DB.getrow()) {
(void) new Q3ListViewItem(repBody, DB.curRow["CustomerID"], DB.curRow["LoginID"], DB.curRow["DomainType"], DB.curRow["DomainName"]);
}
}
示例4: refreshList
void UserPrivs::refreshList()
{
ADB DB;
char levelStr[1024];
AccessLevels level;
Q3ListViewItem *curItem;
bool foundSel = false;
userList->clear();
DB.query("select * from Staff");
if (DB.rowCount) {
while(DB.getrow()) {
level = (AccessLevels) atoi(DB.curRow["AccessLevel"]);
switch(level) {
case Admin:
strcpy(levelStr, "Administrator");
break;
case Manager:
strcpy(levelStr, "Manager");
break;
case Staff:
strcpy(levelStr, "Support Staff");
break;
default:
strcpy(levelStr, "Unknown");
break;
}
curItem = new Q3ListViewItem(userList, DB.curRow["LoginID"], levelStr, DB.curRow["InternalID"]);
// Is this the user we previously had hilighted? If so,
// hilight it now.
if (myCurrentID == atol(DB.curRow["InternalID"])) {
foundSel = true;
userList->setCurrentItem(curItem);
userList->setSelected(curItem, true);
userList->ensureItemVisible(curItem);
}
}
}
// If we didn't find our previously hilighted entry, hilight the
// first entry in the list.
if (!foundSel) {
// None selected, hilight the first one in the list.
if (userList->firstChild()) {
userList->setCurrentItem(userList->firstChild());
userList->setSelected(userList->firstChild(), true);
userList->ensureItemVisible(userList->firstChild());
}
}
}
示例5: setGLAccount
/**
* setGLAccount()
*
* Overrides the GL Account that we post to - not the AcctsRecv side
* but the billable side of the transaction.
*
* Returns 1 if successful, 0 if not.
*/
int AcctsRecv::setGLAccount(int intAcctNo)
{
int retVal = 0;
ADB DB;
DB.query("select IntAccountNo from Accounts where IntAccountNo = '%d'", intAcctNo);
if (DB.rowCount) {
myIntAcctNo = intAcctNo;
retVal = 1;
}
return retVal;
}
示例6: fillTable
/**
* CustomLoginFlagEditor::fillTable()
*
* Fills the table with the flags and values for the user.
*/
void CustomLoginFlagEditor::fillTable()
{
ADB db;
long loginType;
Q3Dict<QString> flagDict;
// Get the login type.
db.query("select LoginType from Logins where LoginID = '%s'", myLoginID);
if (!db.rowCount) return;
db.getrow();
loginType = atoi(db.curRow["LoginType"]);
// Get the available login flags for this login type
db.query("select Tag, Value from LoginTypeFlags where LoginTypeID = %ld", loginType);
if (!db.rowCount) return;
// Load the dictionary
while(db.getrow()) {
flagDict.insert(db.curRow["Tag"], new QString(db.curRow["Value"]));
}
// Get whatever data is in the LoginFlagValues that is custom for this user.
db.query("select * from LoginFlagValues where LoginID = '%s'", myLoginID);
if (db.rowCount) while (db.getrow()) {
flagDict.replace(db.curRow["LoginFlag"], new QString(db.curRow["FlagValue"]));
}
// Now put the stuff from our flagDict into the grid
Q3DictIterator<QString> it(flagDict);
for( ; it.current(); ++it ) {
flagTable->insertRows(flagTable->numRows(), 1);
flagTable->setText(flagTable->numRows()-1, 0, it.currentKey());
flagTable->setText(flagTable->numRows()-1, 1, it.current()->ascii());
}
// Set column 0(1) to be read only
flagTable->setColumnReadOnly(0, true);
flagTable->adjustColumn(1);
}
示例7: loadCities
void TE_Cities::loadCities()
{
QApplication::setOverrideCursor(Qt::waitCursor);
ADB DB;
DB.query("select distinct City, State from Addresses where RefFrom = %d", REF_CUSTOMER);
if (DB.rowCount) while (DB.getrow()) {
(void) new Q3ListViewItem(cityList, DB.curRow["City"], DB.curRow["State"]);
}
QApplication::restoreOverrideCursor();
}
示例8: refreshList
void BillingCycles::refreshList(int)
{
ADB DB;
Q3ListViewItem *curItem = NULL;
// Save the state of the list.
list->clear();
DB.query("select CycleID, CycleType, Description from BillingCycles order by CycleID");
if (DB.rowCount) while(DB.getrow()) {
curItem = new Q3ListViewItem(list, DB.curRow["CycleID"], DB.curRow["CycleType"], DB.curRow["Description"]);
}
list->repaint();
}
示例9: refreshReport
void LoginTypeReport::refreshReport()
{
emit(setStatus("Generating report..."));
QApplication::setOverrideCursor(waitCursor);
ADB DB;
char modDate[128];
char isActive[128];
char isPrimary[128];
QDateTime tmpQDT;
bool showIt = false;
repBody->clear();
DB.query("select Logins.LoginID, Customers.FullName, Logins.LastModified, Logins.Active, Logins.CustomerID, Customers.PrimaryLogin from Logins, Customers where Logins.LoginType = %d and Customers.CustomerID = Logins.CustomerID", loginType);
if (DB.rowCount) while (DB.getrow()) {
if (!strcmp(DB.curRow["LoginID"], DB.curRow["PrimaryLogin"])) strcpy(isPrimary, "Yes");
else strcpy(isPrimary, "No");
if (atoi(DB.curRow["Active"])) strcpy(isActive, "Yes");
else strcpy(isActive, "No");
tmpQDT = DB.curRow.col("LastModified")->toQDateTime();
sprintf(modDate, "%04d-%02d-%02d", tmpQDT.date().year(), tmpQDT.date().month(), tmpQDT.date().day());
showIt = false;
if ((atoi(DB.curRow["Active"])) && showActive) showIt = true;
if ((!atoi(DB.curRow["Active"])) && showInactive) showIt = true;
if (showIt) {
(void) new Q3ListViewItem(repBody,
DB.curRow["LoginID"],
DB.curRow["FullName"],
modDate,
isActive,
isPrimary,
DB.curRow["CustomerID"]
);
};
}
emit(setStatus(""));
QApplication::restoreOverrideCursor();
}
示例10: refreshReport
void RatePlanReport::refreshReport()
{
QApplication::setOverrideCursor(waitCursor);
repBody->clear();
char tmpActiveStr[1024];
char tmpInactiveStr[1024];
char *query = new char[65536];
ADB DB;
ADB DB2;
// Get a list of the rate plans. Then we'll count the customers that
// are assigned that rate plan.
DB.query("select InternalID, PlanTag, Description from RatePlans");
if (DB.rowCount) {
while (DB.getrow()) {
// Now, get the number of active customers associated with this
// rate plan.
DB2.query("select CustomerID from Customers where RatePlan = %s and Active <> 0", DB.curRow["InternalID"]);
sprintf(tmpActiveStr, "%6ld", DB2.rowCount);
// Now, get the number of INactive customers associated with this
// rate plan.
DB2.query("select CustomerID from Customers where RatePlan = %s and Active = 0", DB.curRow["InternalID"]);
sprintf(tmpInactiveStr, "%6ld", DB2.rowCount);
// Now, add the entry into the list, including the last column,
// which is not shown, containing the internal ID so we can
// zoom in on it.
(void) new Q3ListViewItem(repBody, DB.curRow["PlanTag"], DB.curRow["Description"], tmpActiveStr, tmpInactiveStr, DB.curRow["InternalID"]);
}
} else {
(void) new Q3ListViewItem(repBody, "No rate plans found!!!");
}
delete query;
QApplication::restoreOverrideCursor();
}
示例11: saveBillingCycleChange
void ChangeBillingCycle::saveBillingCycleChange()
{
CustomersDB CDB;
ADB DB;
QApplication::setOverrideCursor(waitCursor);
CDB.get(myCustID);
DB.query("select InternalID from BillingCycles where CycleID = '%s'", (const char *) cycleList->text(cycleList->currentItem()));
DB.getrow();
CDB.setValue("BillingCycleDate", effectiveDate->date().toString("yyyy-MM-dd").ascii());
CDB.setValue("BillingCycle", atol(DB.curRow["InternalID"]));
CDB.upd();
QApplication::restoreOverrideCursor();
emit(customerUpdated(myCustID));
QMessageBox::information(this, "Rerate warning", "Note that billing cycle changes are not\nrerated automatically. You will need to\nmake any necessary adjustments to the\ncustomers register manually.");
close();
}
示例12: refreshReport
void DNS_UnmanagedReport::refreshReport()
{
repBody->clear();
ADB DB;
ADB DB2;
ADB dnsDB(cfgVal("DNSSQLDB"), cfgVal("DNSSQLUser"), cfgVal("DNSSQLPass"), cfgVal("DNSSQLHost"));
char domainName[1024];
char origin[1024];
char domainType[1024];
char isActive[1024];
long counter = 0;
DB.query("select * from Domains where Active <> 0");
if (DB.rowCount) while (DB.getrow()) {
emit(setProgress(++counter, DB.rowCount));
strcpy(domainType, "Unknown");
strcpy(isActive, "");
// Copy the domain name into a temp string and create the origin
// for our remote query.
strcpy(domainName, DB.curRow["DomainName"]);
strcpy(origin, domainName);
strcat(origin, ".");
dnsDB.query("select soa.id, ZoneInfo.CustomerID from soa, ZoneInfo where soa.id = ZoneInfo.zoneid and soa.origin = '%s' and ZoneInfo.CustomerID = %ld", origin, atol(DB.curRow["CustomerID"]));
if (!dnsDB.rowCount) {
// Get the type of domain it is
DB2.query("select DomainTypes.DomainType, Domains.InternalID from DomainTypes, Domains where Domains.DomainName = '%s' and DomainTypes.InternalID = Domains.DomainType", domainName);
if (DB2.rowCount) {
DB2.getrow();
strcpy(domainType, DB2.curRow["DomainType"]);
}
// Check to see if it is active
if (atoi(DB.curRow["Active"])) strcpy(isActive, "Yes");
else strcpy(isActive, "No");
(void) new Q3ListViewItem(repBody, domainName, DB.curRow["LoginID"], domainType, DB.curRow["CustomerID"], isActive);
}
}
}
示例13: tmplist
void parseFile(const char *SrcFile, const char *DstFile, long CustomerID, const char *LoginID, const char *DomainName)
{
FParser parser;
FILE *dfp;
char tmpstr[1024];
QString tmpDst;
Q3StrList tmplist(TRUE);
QString qst;
QString tmpqstr2;
char contactName[256];
char phoneNumber[32];
char theDate[64];
QDate theQDate;
theQDate = QDate::currentDate();
strcpy(theDate, theQDate.toString());
ADB DB;
CustomersDB CDB;
LoginsDB LDB;
AddressesDB addrDB;
ADBTable LTDB;
CDB.get(CustomerID);
LDB.get(CustomerID, LoginID);
LTDB.setTableName("LoginTypes");
LTDB.get(LDB.getLong("LoginType"));
strcpy(tmpstr, CDB.getStr("BillingAddress"));
addrDB.get(REF_CUSTOMER, CustomerID, tmpstr);
// Since there is no default phone number, grab the first one from
// the database.
strcpy(phoneNumber, "");
DB.query("select PhoneNumber from CustomerContacts where Active <> 0 and CustomerID = %ld", CustomerID);
if (DB.rowCount) {
DB.getrow();
strcpy(phoneNumber, DB.curRow["PhoneNumber"]);
}
// fprintf(stderr, "parseFile: Reading File '%s'\n", SrcFile);
// If strlen(DstFile) == 0, then generate a temp file name for it.
if (!strlen(DstFile)) {
tmpDst = makeTmpFileName("/tmp/parsefileXXXXXX");
} else {
tmpDst = DstFile;
}
// Check to see if we have a contact name.
if (strlen((const char *)CDB.getStr("ContactName"))) {
strcpy(contactName, CDB.getStr("ContactName"));
} else {
strcpy(contactName, CDB.getStr("FullName"));
}
parser.set("DomainName", DomainName);
parser.set("CompanyName", CDB.getStr("FullName"));
parser.set("ContactName", contactName);
parser.set("LoginID", LoginID);
parser.set("NICName", contactName);
parser.set("Addr1", addrDB.Address1);
parser.set("Addr2", addrDB.Address2);
parser.set("City", addrDB.City);
parser.set("State", addrDB.State);
parser.set("ZIP", addrDB.ZIP);
parser.set("DayPhone", phoneNumber);
parser.set("EvePhone", phoneNumber);
parser.set("CurrentDate", theDate);
parser.set("LoginType", LTDB.getStr("LoginType"));
parser.set("LoginTypeD", LTDB.getStr("Description"));
// Read in the entire source file.
dfp = fopen(tmpDst.toAscii().constData(), "w");
parser.parseFile(SrcFile, dfp);
fclose(dfp);
}
示例14: setCustomerID
void DomainAliases::setCustomerID(long custID)
{
QApplication::setOverrideCursor(Qt::waitCursor);
myCustID = custID;
char AddrPart[1024];
char DomainPart[1024];
__gnu_cxx::StrSplitMap parts;
ADB domainDB;
ADB mailDB(cfgVal("MailSQLDB"), cfgVal("MailSQLUser"), cfgVal("MailSQLPass"), cfgVal("MailSQLHost"));
aliasList->clear();
if (mailDB.Connected()) {
if (!myCustID) mailDB.query("select * from Virtual");
else {
char sqlstr[65536];
sprintf(sqlstr, "select * from Virtual where CustomerID = %ld", myCustID);
// Now, walk through the domains for this customer and get any
// mailboxes from other customers that might be mapped.
domainDB.query("select Domains.DomainName from Domains, DomainTypes where Domains.CustomerID = %ld and Domains.Active > 0 and Domains.DomainType = DomainTypes.InternalID and DomainTypes.AllowAliases > 0 order by DomainName", myCustID);
if (domainDB.rowCount) while (domainDB.getrow()) {
strcat(sqlstr, " or Address LIKE '%%@");
strcat(sqlstr, domainDB.curRow["DomainName"]);
strcat(sqlstr, "'");
}
mailDB.query(sqlstr);
}
if (mailDB.rowCount) while (mailDB.getrow()) {
char mbstr[1024];
StrSplit(mailDB.curRow["Address"], "@", parts);
strcpy(AddrPart, parts[0].c_str());
strcpy(DomainPart, parts[1].c_str());
if (!strlen(AddrPart)) strcpy(AddrPart, "[Any Address]");
// Check to see if the mailbox is a different customer, if so
// note that in the list
strcpy(mbstr, mailDB.curRow["Mailbox"]);
if (atol(mailDB.curRow["CustomerID"]) != custID) {
strcat(mbstr, " (");
strcat(mbstr, mailDB.curRow["CustomerID"]);
strcat(mbstr, ")");
}
// Add it to the list now.
// Make sure it isn't the "special" mapped so Postfix knows
// how to handle the domain and not give "mail loops back to
// myself" errors.
if (strcmp(mailDB.curRow["Mailbox"], mailDB.curRow["Address"])) {
(void) new Q3ListViewItem(aliasList,
AddrPart,
DomainPart,
mbstr,
mailDB.curRow["AliasDate"],
mailDB.curRow["AddedBy"],
mailDB.curRow["VirtualID"]
);
}
}
}
// Now that the list is populated, populate the list of domains
// for this customer.
domainList->clear();
if (!myCustID) domainDB.query("select Domains.DomainName from Domains, DomainTypes where Domains.Active > 0 and Domains.DomainType = DomainTypes.InternalID and DomainTypes.AllowAliases > 0 order by DomainName");
else domainDB.query("select Domains.DomainName from Domains, DomainTypes where Domains.CustomerID = %ld and Domains.Active > 0 and Domains.DomainType = DomainTypes.InternalID and DomainTypes.AllowAliases > 0 order by DomainName", myCustID);
if (domainDB.rowCount) while (domainDB.getrow()) {
domainList->insertItem(domainDB.curRow["DomainName"]);
}
// Now populate the list of logins.
loginList->clear();
if (!myCustID) domainDB.query("select * from Logins where Active > 0 order by LoginID");
else domainDB.query("select * from Logins where CustomerID = %ld and Active > 0 order by LoginID", myCustID);
if (domainDB.rowCount) while (domainDB.getrow()) {
loginList->insertItem(domainDB.curRow["LoginID"]);
}
// If we don't have a customer ID, disable the Auto button
if (!myCustID) autoButton->setEnabled(false);
else autoButton->setEnabled(true);
QApplication::restoreOverrideCursor();
}
示例15: refreshCheckList
void DomainChecklist::refreshCheckList(void)
{
ADB DB;
DomainsDB DDB;
char tmpst[64];
DDB.get(myDomainID);
myCustID = DDB.getLong("CustomerID");
customerID->setText(DDB.getStr("CustomerID"));
loginID->setText(DDB.getStr("LoginID"));
domainName->setText(DDB.getStr("DomainName"));
if (strlen(DDB.getStr("LocalSubmit"))) {
hostmasterSubmit->setChecked(TRUE);
hostmasterSubmit->setEnabled(FALSE);
hostmastDate->setText(DDB.getStr("LocalSubmit"));
} else {
hostmasterSubmit->setChecked(FALSE);
hostmasterSubmit->setEnabled(TRUE);
hostmastDate->setText("");
}
if (strlen(DDB.getStr("NICSubmit"))) {
internicSubmit->setChecked(TRUE);
internicSubmit->setEnabled(FALSE);
nicReqDate->setText(DDB.getStr("NICSubmit"));
} else {
internicSubmit->setChecked(FALSE);
internicSubmit->setEnabled(TRUE);
nicReqDate->setText("");
}
if (strlen(DDB.getStr("DNSUpdated"))) {
dnsDone->setChecked(TRUE);
dnsDone->setEnabled(FALSE);
dnsDate->setText(DDB.getStr("DNSUpdated"));
} else {
dnsDone->setChecked(FALSE);
dnsDone->setEnabled(TRUE);
dnsDate->setText("");
}
if (strlen(DDB.getStr("MailSystemUpdated"))) {
mailDone->setChecked(TRUE);
mailDone->setEnabled(FALSE);
mailDate->setText(DDB.getStr("MailSystemUpdated"));
} else {
mailDone->setChecked(FALSE);
mailDone->setEnabled(TRUE);
mailDate->setText("");
}
if (strlen(DDB.getStr("VirtServerSetup"))) {
vserverDone->setChecked(TRUE);
vserverDone->setEnabled(FALSE);
vserverDate->setText(DDB.getStr("VirtServerSetup"));
} else {
vserverDone->setChecked(FALSE);
vserverDone->setEnabled(TRUE);
vserverDate->setText("");
}
if (strlen(DDB.getStr("NICCompleted"))) {
internicDone->setChecked(TRUE);
internicDone->setEnabled(FALSE);
nicDoneDate->setText(DDB.getStr("NICCompleted"));
} else {
internicDone->setChecked(FALSE);
internicDone->setEnabled(TRUE);
nicDoneDate->setText("");
}
if (strlen(DDB.getStr("Released"))) {
domainDone->setChecked(TRUE);
domainDone->setEnabled(FALSE);
doneDate->setText(DDB.getStr("Released"));
} else {
domainDone->setChecked(FALSE);
domainDone->setEnabled(TRUE);
doneDate->setText("");
}
ipAddress->setText(DDB.getStr("IPAddress"));
nicAdminID->setText(DDB.getStr("NICAdminID"));
nicBillID->setText(DDB.getStr("NICBillID"));
strcpy(tmpst, DDB.getStr("Server"));
serverList->clear();
DB.query("select distinct Server from Domains order by Server");
if (DB.rowCount) while (DB.getrow()) {
serverList->insertItem(DB.curRow["Server"]);
if (!strcmp(tmpst, DB.curRow["Server"])) {
serverList->setCurrentItem(serverList->count() - 1);
}
}
strcpy(tmpst, DDB.getStr("SubServer"));
processList->clear();
DB.query("select distinct SubServer from Domains order by SubServer");
//.........这里部分代码省略.........