#ifndef __PREPS_SQLSTR_H #define __PREPS_SQLSTR_H /*------------------------------------------------------------------------- * Copyright (c) 2004-2005 Kenneth W. Sodemann (stuffle@mac.com) *------------------------------------------------------------------------- * sqlstr * * Synopsis: * Builds common SQL strings used by several windows. * * $Id: sqlstr.h,v 1.6 2005/04/03 23:00:00 stuffle Exp $ * * 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; either version 2 of the License, or * (at your option) any later version. * * 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 this program; if not, write to * Free Software Foundation, Inc. * 59 Temple Place, Suite 330 * Boston, MA 02111-1307 USA * *------------------------------------------------------------------------- */ #include #include #define SQLSTR_PK_POS 0 #define SQLSTR_NAME_POS 1 #define SQLSTR_ACTIVE_POS 2 #define SQLSTR_DEFSEVR_POS 3 #define SQLSTR_DEFOPENVER_POS 3 typedef enum { ACTIVE_ITEMS_ONLY, /* only active items */ ACTIVE_ITEMS_PLUS_IN_USE, /* active items plus item used on current PR */ ALL_ITEMS /* all, regardless of status */ } queryLevel; /*------------------------------------------------------------------------- * Function: * prj_sql_str * * Synopsis: * Build a string to return the specified projects. * * Inputs: * str : The string buffer to use. * lvl : Determine the project that is returned by status * (active, active plus current pr, all) * leader : If true, the resulting SQL will return projects for * which the current user is the leader. * submitter : If true, the resulting SQL will return projects for * which the current user is specified as a submitter. * grp_member : If true, the resulting SQL will return projects for * which the current user is specified as a project member. * admin : If true, the resulting SQL will return ALL projects if * the current user has admin access. * client : A pointer to the GConf client, used to get user defined * options for the SQL. * pk_num : PK of the current PR. Only used if lvl is set to * ACTIVE_ITEMS_PLUS_IN_USE. Otherwise you can just pass it * whatever you want. * * Outputs: * The SQL string in the str buffer. * * Return Value: * None. *------------------------------------------------------------------------- */ void prj_sql_str (GString *str, queryLevel lvl, gboolean leader, gboolean submitter, gboolean grp_member, gboolean admin, GConfClient *client, gint pk_num); /*------------------------------------------------------------------------- * Function: * prj_ver_sql_str * * Synopsis: * Build a string to return the specified projects. * * Inputs: * str : The string buffer to use. * lvl : Determine the project that is returned by status * (active, active plus current pr, all) * prj_pk : The project number (PK or project table) of the project * for which versions shall be fetched. * ver_num : Version number of the current version. In combination * with the project number, this forms the primary key for * the current version. Only used if lvl is set to * ACTIVE_ITEMS_PLUS_IN_USE. Otherwise you can just pass it * whatever you want. * * Outputs: * The SQL string in the str buffer. * * Return Value: * None. *------------------------------------------------------------------------- */ void prj_ver_sql_str (GString *str, queryLevel lvl, gint prj_pk, gint ver_num); /*------------------------------------------------------------------------- * Functions: * pr_type_sql_str * stat_sql_str * sevr_sql_str * * Synopsis: * Build a string to return the specified attribute. * * Inputs: * str : The string buffer to use. * lvl : Determines which attributes to fetch. * client : A pointer to the GConf client, used to get user defined * options for the SQL. * pk_num : PK of the current PR. Only used if lvl is set to * ACTIVE_ITEMS_PLUS_IN_USE. Otherwise you can just pass it * whatever you want. * * Outputs: * The SQL string in the str buffer. * * Return Value: * None. *------------------------------------------------------------------------- */ void pr_type_sql_str (GString *str, queryLevel lvl, GConfClient *client, gint pk_num); void stat_sql_str (GString *str, queryLevel lvl, GConfClient *client, gint pk_num); void sevr_sql_str (GString *str, queryLevel lvl, GConfClient *client, gint pk_num); #endif