/*
 * pxtools.h
 *
 * Copyright (C) 2006  Joshua Hoblitt
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * program; see the file COPYING. If not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef PXTOOLS_H
#define PXTOOLS_H 1

# include <stdio.h>
# include <strings.h>  // for strcasecmp
# include <unistd.h>   // for unlink
# include <pslib.h>
# include <psmodules.h>
# include <ippdb.h>

# include "pxtoolsErrorCodes.h"
# include "pxio.h"
# include "pxdata.h"

// load these values from the db in the init stage
# define P2_TYPE_OBJECT 1
# define P2_STATE_READY 2
# define RECIPE "PHASE2"
# define MAX_ROWS 10e9

typedef struct {
    int mode;
    pmConfig *modules;
    psDB *dbh;
    psMetadata *args;
    psMetadata *where;
    int argc;
    char **argv;
} pxConfig;

pxConfig *pxConfigAlloc(void);
bool pxCreateTables (pxConfig *config);
bool pxDeleteTables (pxConfig *config);

bool pxSetFaultCode(psDB *dbh, const char *tableName, psMetadata *where, psS8 code);

psExit pxerrorGetExitStatus ();

#endif // PXTOOLS_H
