IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4277


Ignore:
Timestamp:
Jun 15, 2005, 2:06:07 PM (21 years ago)
Author:
jhoblitt
Message:

add [foo]PopFits src

Location:
trunk/glueforge/templates/psdb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/glueforge/templates/psdb/code.tt

    r4250 r4277  
    33#define [% namespace FILTER upper %]_TABLE_NAME "[% table_name %]"
    44#define [% namespace FILTER upper %]_INDEX_NAME "position"
     5#define MAX_STRING_LENGTH 1024
    56
    67[% INCLUDE alloc.tt %]
  • trunk/glueforge/templates/psdb/popfits.tt

    r4267 r4277  
    11bool [% namespace %]PopFits(psDB *dbh, psFits *fits, unsigned long long limit)
    22{
    3     return [% namespace %]SelectRowsFits(dbh, fits, NULL, limit);
     3    char            query[MAX_STRING_LENGTH];
     4
     5    if (!fooSelectRowsFits(dbh, fits, NULL, limit)) {
     6        // psError(); something bad happened
     7        return false;
     8    }
     9
     10    // remove limit rows from the end of the database
     11    if (snprintf(query, MAX_STRING_LENGTH,
     12                "DELETE FROM %s ORDER BY %s DESC LIMIT %lld",
     13                [% namespace FILTER upper %]_TABLE_NAME, [% namespace FILTER upper %]_INDEX_NAME, limit) < 0) {
     14        // psError(); something bad happened
     15        return false;
     16    }
     17           
     18    if (!p_psDBRunQuery(dbh, query)) {
     19        // psError(); something bad happened
     20        return false;
     21    }
     22
     23    return true;
    424}
Note: See TracChangeset for help on using the changeset viewer.