Ignore:
Timestamp:
Feb 12, 2000, 6:55:04 PM (26 years ago)
Author:
bird
Message:

Some new reports.
General bugfixes and new features.

Location:
trunk/tools/database
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/database

    • Property svn:ignore set to
      *.html
      *.gif
      html/*
  • trunk/tools/database/db.cpp

    r2761 r2765  
    1 /* $Id: db.cpp,v 1.6 2000-02-11 23:54:25 bird Exp $ *
     1/* $Id: db.cpp,v 1.7 2000-02-12 17:55:03 bird Exp $ *
    22 *
    33 * DB - contains all database routines.
     
    360360}
    361361
    362 #if 0
     362#if 1
    363363/**
    364364 * Find occurences of a function, given by internal name.
     
    436436                        {
    437437                            /* get the functions aliases to the functions we have allready found. */
    438                             strcpy(&szQuery[0], "SELECT refcode, dll, aliasfn FROM function WHERE (");
     438                            strcpy(&szQuery[0], "SELECT refcode, dll, aliasfn FROM function WHERE aliasfn IN (");
    439439                            for (i = 0; i < pFnFindBuf->cFns; i++)
    440440                            {
    441                                 if (i != 0) strcat(&szQuery[0], "OR ");
    442                                 sprintf(&szQuery[strlen(szQuery)], "aliasfn = %ld ", pFnFindBuf->alRefCode[i]);
     441                                if (i != 0) strcat(&szQuery[0], ", ");
     442                                sprintf(&szQuery[strlen(szQuery)], "%ld", pFnFindBuf->alRefCode[i]);
    443443                            }
    444444                            sprintf(&szQuery[strlen(szQuery)], ") AND dll <> %ld", lDll);
     
    716716    int   i,k,rc;
    717717    unsigned long ulRc = 0;
    718     BOOL          f = FALSE;
    719718
    720719    for (k = 0; k < pFnDesc->cRefCodes; k++)
    721720    {
     721        BOOL    f = FALSE;
     722
    722723        /* set updated flag */
    723724        sprintf(pszQuery, "UPDATE function SET updated = updated + 1 WHERE refcode = %ld",
     
    14201421    BOOL        fRet = FALSE;
    14211422    void       *pres;
    1422     char        szQuery[128];
     1423    char        szQuery[256];
    14231424
    14241425    /* not updated names */
    1425     sprintf(&szQuery[0], "SELECT name, intname FROM function WHERE dll = %ld AND updated = 0",
     1426    sprintf(&szQuery[0], "SELECT f1.name, f1.intname, f1.updated, f1.aliasfn, d.name, f2.name, f2.intname AS last "
     1427                         "FROM function f1 LEFT OUTER JOIN function f2 ON f1.aliasfn = f2.refcode "
     1428                         "     LEFT JOIN dll d ON f2.dll = d.refcode "
     1429                         "WHERE f1.dll = %ld AND f1.updated = 0",
    14261430            lDll);
    14271431    pres = dbExecuteQuery(szQuery);
     
    14381442
    14391443    /* warn about updated > 1 too */
    1440     sprintf(&szQuery[0], "SELECT updated, name, intname FROM function WHERE dll = %ld AND updated > 1",
     1444    sprintf(&szQuery[0], "SELECT f1.name, f1.intname, f1.updated, f1.aliasfn, d.name, f2.name, f2.intname AS last "
     1445                         "FROM function f1 LEFT OUTER JOIN function f2 ON f1.aliasfn = f2.refcode "
     1446                         "     LEFT JOIN dll d ON f2.dll = d.refcode "
     1447                         "WHERE f1.dll = %ld AND f1.updated > 1",
    14411448            lDll);
    14421449    pres = dbExecuteQuery(szQuery);
     
    14561463
    14571464    return fRet;
     1465}
     1466
     1467
     1468/**
     1469 * Counts the function for the given DLL which has been updated.
     1470 * @returns   -1 on error, number of updated function on success.
     1471 * @param     lDll         Dll reference number.
     1472 */
     1473signed long _System dbGetNumberOfUpdatedFunction(signed long lDll)
     1474{
     1475    int         rc;
     1476    char        szQuery[128];
     1477    MYSQL_RES * pres;
     1478
     1479    sprintf(&szQuery[0], "SELECT count(*) FROM function WHERE dll = (%ld) AND updated > 0\n", lDll);
     1480    rc   = mysql_query(pmysql, &szQuery[0]);
     1481    pres = mysql_store_result(pmysql);
     1482    if (rc >= 0 && pres != NULL && mysql_num_rows(pres) == 1)
     1483        rc = (int)getvalue(0, mysql_fetch_row(pres));
     1484    else
     1485        rc = -1;
     1486    mysql_free_result(pres);
     1487    return (signed long)rc;
    14581488}
    14591489
Note: See TracChangeset for help on using the changeset viewer.