From: Jim Parker <hopeye@cfl.rr.com>
To: valval@porta.net
Cc: interfaces <pgsql-interfaces@postgresql.org>
Subject: Re: ECPG examples
Date: Fri, 27 Jun 2003 11:18:35 -0400
Message-ID: <20030627111835.C354@shamrock.cfl.rr.com\000> (raw)
In-Reply-To: <199901022201.35635.valval@porta.net>
References: <199901022201.35635.valval@porta.net>
Here are some example files I wrote with the help of the book:
Neil Matthew, and Richard Stones; "Profesional Linux Programming";
Wrox Press Ltd., Birmingham, UK; 2000
cheers,
Jim Parker
BTW I appologize to the list for the number and length of the files.
If someone could add them to a tutorial or other documentation, that
would be great. The ECPG docs are limited at best :-(
On 1999.01.02 22:01 Christian Valverde wrote:
> im trying to build some objects to interact with QT dialog i just maid
> .
> please could anypne point me a site where to see examples on ECPG
> im actually interested in examples of reciving data fron databases . i
> already
> send data to pg but cant receive data form pg .
> --
> nver let the bed bug bite
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
Attachments:
[text/x-makefile] Makefile (901B, ../20030627111835.C354@shamrock.cfl.rr.com%5C000/2-Makefile)
download | inline:
#
# Makefile for GtkCAD database module
#
all:
# The compiler of choice
CC = gcc
# Installation directory
INSTDIR = .
# Include file(s):
INCLUDE = -I../include
PG_INC = -I/usr/include/postgresql
GTK_INC = -I/usr/include/gtk-1.2
# Options for development
CFLAGS = -g -Wall -ansi `gtk-config --cflags`
# Options for release
# CFLAGS = -O2 -Wall -ansi `gtk-config --cflags`
# GTK+ library
GTKLIB = `gtk-config --libs`
# LIBRARIES
LIBS = -lecpg -lpq `gtk-config --libs`
# Test object files
#
OBJS = test_db_ecpg.o \
test_createdb_ecpg.o \
test_get_ecpg.o \
test_edit_ecpg.o \
test_insert_ecpg.o
# Suffix rule to make a .c file from a .pgc file
%.c: %.pgc
ecpg -t $(PG_INC) -o $@ $<
# Suffix rule to make a object file from a .c file
%.o: %.c
$(CC) -c $(PG_INC) $(CFLAGS) -o $@ $<
# Make the executable
test_db: $(OBJS)
$(CC) $(LIBS) -o test_db $(OBJS)
clean:
rm ./*.o
rm test_db
[text/x-c] test.h (2.4K, ../20030627111835.C354@shamrock.cfl.rr.com%5C000/3-test.h)
download | inline:
/* GtkCAD - A free modular CAD/CAE/CAM software
*
* Copyright (C) 2000-2002 H. James Parker <hopeye@cfl.rr.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later
* version.
*
* This library 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 Library General Public License for more details.
*
* You should have received a copy of the GNU Library General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* --- test.h ---
*
* Change Log:
*
* 13 Mar 02 - Created file;
*/
/*
* --- Include files
*/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
/*
* --- Define Statements
*/
#define SUCCESS 0
#define FAILURE 1
#define SMALL 1.0
#define NORMAL 2.0
#define BIG 3.0
/*
* --- Data structures
*/
typedef struct {
int color;
int size;
int part;
int group;
int layer;
} typCurrent;
typedef struct {
int id;
float x;
float y;
float z;
int saved;
int modified;
int deleted;
} typPoint;
/*
* --- Function prototypes
*/
int db_get_points (void);
int db_process_point_query (void);
int db_find_point (int point_id);
int db_add_point (typPoint *point);
int db_edit_point (typPoint *point);
int db_delete_point (int point_id);
int db_connect_ecpg (char *database);
int db_cleanup (void);
int db_createdb (char *dbname);
int db_save (void);
int db_selectdb (void);
GSList *insert_point (GSList *list, gint id , gfloat x, gfloat y, gfloat z,
int saved, int modified, int deleted);
/*
* --- Internal Global Variables
*/
extern typPoint point;
extern typCurrent currentType;
extern GSList *points;
extern GSList *pnode;
extern typPoint *point_t;
extern char server[50];
extern char database[25];
extern char connection[25];
extern char login[25];
extern char password[25];
[application/octet-stream] test_createdb_ecpg.pgc (2.3K, ../20030627111835.C354@shamrock.cfl.rr.com%5C000/4-test_createdb_ecpg.pgc)
download
[application/octet-stream] test_db_ecpg.pgc (5.8K, ../20030627111835.C354@shamrock.cfl.rr.com%5C000/5-test_db_ecpg.pgc)
download
[application/octet-stream] test_edit_ecpg.pgc (2.3K, ../20030627111835.C354@shamrock.cfl.rr.com%5C000/6-test_edit_ecpg.pgc)
download
[application/octet-stream] test_get_ecpg.pgc (2.6K, ../20030627111835.C354@shamrock.cfl.rr.com%5C000/7-test_get_ecpg.pgc)
download
[application/octet-stream] test_insert_ecpg.pgc (2.4K, ../20030627111835.C354@shamrock.cfl.rr.com%5C000/8-test_insert_ecpg.pgc)
download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: hopeye@cfl.rr.com, valval@porta.net
Subject: Re: ECPG examples
In-Reply-To: <20030627111835.C354@shamrock.cfl.rr.com\000>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox