IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 6, 2006, 6:46:10 PM (21 years ago)
Author:
jhoblitt
Message:

fix tests to work with per table data
minor pslib 0.9.0 compatibility fixes

File:
1 edited

Legend:

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

    r5907 r5950  
    77int main ()
    88{
    9     psDB            *dbh;
    10     [% indented(table.object_name, "*object") %];
     9[% FOREACH table = tables -%]
     10    {
     11        psDB            *dbh;
     12        [% indented(table.object_name, "*object") %];
    1113
    12     dbh = psDBInit("localhost", "test", NULL, "test");
    13     if (!dbh) {
    14         exit(EXIT_FAILURE);
    15     }
     14        dbh = psDBInit("localhost", "test", NULL, "test");
     15        if (!dbh) {
     16            exit(EXIT_FAILURE);
     17        }
    1618
    17     object = [% table.object_name %]Alloc(
     19        object = [% table.object_name %]Alloc(
    1820[%- SET i = 0 -%]
    1921[%- FOREACH item = table.columns -%]
     
    2123[%- END -%]
    2224);
    23     if (!object) {
    24         exit(EXIT_FAILURE);
     25        if (!object) {
     26            exit(EXIT_FAILURE);
     27        }
     28
     29        if (![% table.namespace %]InsertObject(dbh, object)) {
     30            exit(EXIT_FAILURE);
     31        }
     32
     33        psFree(object);
     34        psDBCleanup(dbh);
    2535    }
    2636
    27     if (![% table.namespace %]InsertObject(dbh, object)) {
    28         exit(EXIT_FAILURE);
    29     }
    30 
    31     psFree(object);
    32     psDBCleanup(dbh);
    33 
     37[% END -%]
    3438    exit(EXIT_SUCCESS);
    3539}
Note: See TracChangeset for help on using the changeset viewer.