#include <pslib.h>
#include <[% pkg_name %].h>
#include <stdlib.h>

#define TMP_FILENAME "./blargh"

int main ()
{
[% FOREACH table = tables -%]
    {
        psDB            *dbh;
        psFits          *fits;

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        fits = psFitsOpen(TMP_FILENAME, "w");
        if (!fits) {
            exit(EXIT_FAILURE);
        }

        if (![% table.namespace %]SelectRowsFits(dbh, fits, NULL, 1)) {
            exit(EXIT_FAILURE);
        }

        psFree(fits);
        psDBCleanup(dbh);
    }

[% END -%]
    exit(EXIT_SUCCESS);
}
