Main Page   File List   File Members  

prq_utils.h File Reference

Utility functions used when dealing with the PRepS query table. More...

#include <gtk/gtk.h>
#include <libpq-fe.h>

Go to the source code of this file.

Defines

#define __P(protos)    protos
#define SEVR_NUMS   "severity_nums"
#define STAT_NUMS   "status_nums"
#define TYPE_NUMS   "problem_type_nums"
#define SUB_IDS   "submitter_ids"
#define RESP_IDS   "responsible_ids"

Functions

GList* create_num_list (PGconn *conn, gint query_pk, const gchar *column)
 Create a list of numbers from a PostgreSQL int array field. More...

GList* create_txt_list (PGconn *conn, gint query_pk, const gchar *column)
 Create a list of text entries from a PostgreSQL text array field. More...

GString* create_int_arr_str (GList *list)
 Create an array string from a linked list of integers. More...

GString* create_txt_arr_str (GList *list)
 Create an array string from a linked list of integers. More...


Detailed Description

Utility functions used when dealing with the PRepS query table.

PRepS has a query table that stores the queries that the user can use to select which items to display. The functions defined here aid in dealing with that table.

Specifically, the query table makes use of PostgreSQL's array feature that allows for arrays of data to be stored in a column. These functions make it easier to access the 'array' columns in the query table.

Author(s):
Kenneth W. Sodemann (stufflehead@bigfoot.com)
Revision:
1.7
Date:
2000/11/13 16:22:35


Define Documentation

#define RESP_IDS   "responsible_ids"
 

Use in create_txt_list() calls to specify the 'responsible login-ids' column.

#define SEVR_NUMS   "severity_nums"
 

Use in create_num_list() calls to specifiy the 'severity numbers' column.

#define STAT_NUMS   "status_nums"
 

Use in create_num_list() calls to specify the 'status numbers' column.

#define SUB_IDS   "submitter_ids"
 

Use in create_txt_list() calls to specify the 'submitter login-ids' column.

#define TYPE_NUMS   "problem_type_nums"
 

Use in create_num_list() calls to specify the 'problem type numbers' column.


Function Documentation

create_int_arr_str ( GList * list )
 

Create an array string from a linked list of integers.

PostgreSQL allows for arrays of values to be stored in a column. This function takes a list of integers and creates a chacter string that represents the array in the format that PostgreSQL expects.

This function allocates a new GString. It is the callers responsiblity to destroy the GString (use g_string_free()).

Parameters:
list   A linked list of integers.

Returns:
The string representation of the array, using the syntax that PostgreSQL expects.

create_num_list ( PGconn * conn,
gint query_pk,
const gchar * column )
 

Create a list of numbers from a PostgreSQL int array field.

PostgreSQL allows for arrays of values to be stored in a column. This function takes the contents of one of those columns and returns its contents as a linked list of integers. Use this function for fields that contain arrays of integers.

It is the caller's responsibility to destroy the list.

Parameters:
conn   The database connection.
query_pk   The primary key of query we are interested in.
column   The name of the column we are interested in (defined above)

Returns:
A linked list of the integers in the array.

create_txt_arr_str ( GList * list )
 

Create an array string from a linked list of integers.

PostgreSQL allows for arrays of values to be stored in a column. This function takes a list of strings and creates a chacter string that represents the array in the format that PostgreSQL expects.

This function allocates a new GString. It is the callers responsiblity to destroy the GString (use g_string_free()).

Parameters:
list   A linked list of strings.

Returns:
The string representation of the array, using the syntax that PostgreSQL expects.

create_txt_list ( PGconn * conn,
gint query_pk,
const gchar * column )
 

Create a list of text entries from a PostgreSQL text array field.

PostgreSQL allows for arrays of values to be stored in a column. This function takes the contents of one of those columns and returns its contents as a linked list of integers. Use this function for fields that contain arrays of text.

This function g_malloc's gchar arrays and places them in a list. It is the caller's responsibility to properly g_free the gchar buffers, and destroy the list.

Parameters:
conn   The database connection.
query_pk   The primary key of query we are interested in.
column   The name of the column we are interested in.

Returns:
A linked list of the text strings in the array.


Generated at Sun Jan 7 09:55:03 2001 for libPRepS by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000