Re: [NOVICE] [GENERAL] DB insert Error

2006-08-17 Thread Jasbinder Bali
My program started working. Its inserting records now. I've done no significant changes in my C code. Thanks alot for your help.   Jasbinder  On 8/17/06, Michael Fuhr <[EMAIL PROTECTED]> wrote: On Thu, Aug 17, 2006 at 10:19:57AM -0400, Jasbinder Bali wrote:> but i don't see any record getting inser

Re: [NOVICE] [GENERAL] DB insert Error

2006-08-17 Thread Michael Fuhr
On Thu, Aug 17, 2006 at 10:19:57AM -0400, Jasbinder Bali wrote: > but i don't see any record getting inserted in the table.. > Why is that happenening. How exactly are you determining that the record isn't being inserted? Are you sure you're connected to the right database and querying tables in t

Re: [NOVICE] [GENERAL] DB insert Error

2006-08-17 Thread Jasbinder Bali
but i don't see any record getting inserted in the table..Why is that happenening.On 8/17/06, Michael Meskes < [EMAIL PROTECTED]> wrote:On Wed, Aug 16, 2006 at 11:40:40AM -0400, Jasbinder Bali wrote: > [2998]: ECPGexecute line 97 Ok: INSERT 0 1This is a backend message saying that the insert comman

Re: [NOVICE] [GENERAL] DB insert Error

2006-08-17 Thread Michael Meskes
On Wed, Aug 16, 2006 at 11:40:40AM -0400, Jasbinder Bali wrote: > [2998]: ECPGexecute line 97 Ok: INSERT 0 1 This is a backend message saying that the insert command was executed error free and inserted one record. Michael -- Michael Meskes Email: Michael at Fam-Meskes dot De, Michael at Meske

Re: [NOVICE] [GENERAL] DB insert Error

2006-08-16 Thread Harpreet Dhaliwal
Also, I think you should check the special characters in the text that you are trying to store.   I realize from one of your emails that when u run the same query using the PGAdmin query tool, only a part of the the varchar gets stores and rest it trimmed.   This has something to do with the specia

Re: [NOVICE] [GENERAL] DB insert Error

2006-08-16 Thread Michael Fuhr
On Wed, Aug 16, 2006 at 04:11:23PM -0400, Jasbinder Bali wrote: > I'm sending u the main() function that has the ECPG Insert statement and > commit in it. The program you posted isn't a simplified example as I requested. The idea is that anybody should be able to compile the code and run it; that'

Re: [NOVICE] [GENERAL] DB insert Error

2006-08-16 Thread Jasbinder Bali
This is the create table statement..CREATE TABLE raw_email(  id int4 NOT NULL,  raw_email varchar,  parsed_flag bool NOT NULL DEFAULT false,  CONSTRAINT pk_rawemail PRIMARY KEY (id)) WITHOUT OIDS; ALTER TABLE raw_email OWNER TO postgres;On 8/16/06, Michael Fuhr <[EMAIL PROTECTED]> wrote: On Wed, Au

Re: [NOVICE] [GENERAL] DB insert Error

2006-08-16 Thread Jasbinder Bali
I'm sending u the main() function that has the ECPG Insert statement and commit in it.---START---#include < stdio.h>#include #include #include EXEC SQL INCLUDE sqlca; #define MP 10#define MSG_LEN 102400

Re: [NOVICE] [GENERAL] DB insert Error

2006-08-16 Thread Michael Fuhr
On Wed, Aug 16, 2006 at 02:42:46PM -0400, Jasbinder Bali wrote: > Tried everthing but nothing seems to work. > :( Could you provide a simplified but complete example that shows what you're doing? That is, all SQL statements and C code necessary to create a table and whatever functions you're usin

Re: [NOVICE] [GENERAL] DB insert Error

2006-08-16 Thread Jasbinder Bali
Tried everthing but nothing seems to work.:(On 8/16/06, Jasbinder Bali <[EMAIL PROTECTED]> wrote: Also, i tried to mannualy run the insert query in the query tool insert into raw_email ( id  , raw_email  ) values ( 1 ,  'From [EMAIL PROTE

Re: [NOVICE] [GENERAL] DB insert Error

2006-08-16 Thread Guy Rouillier
Harpreet Dhaliwal wrote: > Forgot to write that that was my question. > I mean can we call a stored procedure as an action of a trigger? Sure, here's a working example from a running application: CREATE OR REPLACE FUNCTION assign_detail_device_type_seq() RETURNS trigger AS $$ BEGIN IF

Re: [NOVICE] [GENERAL] DB insert Error

2006-08-16 Thread Michael Fuhr
On Wed, Aug 16, 2006 at 02:59:23AM -0400, Harpreet Dhaliwal wrote: > I mean can we call a stored procedure as an action of a trigger? You'll need to write a trigger function that calls the non-trigger function (what you're referring to as "stored procedure"). Example: CREATE FUNCTION trigger_fun

Re: [NOVICE] [GENERAL] DB insert Error

2006-08-16 Thread Jasbinder Bali
I did commit the transaction by writing EXEC SQL COMMIT; right after the insert statement.Then also its not inserting the record and says:[2998]: ECPGexecute line 97 Ok: INSERT 0 1and SQLCODE is still 0 ~JasOn 8/16/06, Michael Fuhr <[EMAIL PROTECTED]> wrote: On Wed, Aug 16, 2006 at 01:46:30AM -0400

Re: [NOVICE] [GENERAL] DB insert Error

2006-08-16 Thread Jasbinder Bali
Also, i tried to mannualy run the insert query in the query toolinsert into raw_email ( id  , raw_email  ) values ( 1 ,  'From [EMAIL PROTECTED] Tue Apr 15 20:24:47 2003X-MultiHeader: oneX-MultiHeader: twoX-MultiHeader: threeFrom: Simon C

Re: [NOVICE] [GENERAL] DB insert Error

2006-08-16 Thread Harpreet Dhaliwal
Forgot to write that that was my question. I mean can we call a stored procedure as an action of a trigger?  On 8/16/06, Harpreet Dhaliwal <[EMAIL PROTECTED]> wrote: Its actually something like the trigger should start a C function after insert and the C function has the ECPG code for some more i

Re: [NOVICE] [GENERAL] DB insert Error

2006-08-15 Thread Harpreet Dhaliwal
Its actually something like the trigger should start a C function after insert and the C function has the ECPG code for some more inserts. Its similar to the way we dynamically load a shared library while executing a stored procedure, as in , executing a fucntion in C file using stored procedure/ f

Re: [NOVICE] [GENERAL] DB insert Error

2006-08-15 Thread Michael Fuhr
On Wed, Aug 16, 2006 at 01:46:30AM -0400, Jasbinder Bali wrote: > I changed the datatype from varchar[] to varchar > ECPGdebug(1,stderr) says > [2998]: ECPGexecute line 97 Ok: INSERT 0 1 > > Its not inserting any record even though sqlcode is 0. Are you committing the transaction? See the bottom

Re: [GENERAL] DB insert Error

2006-08-15 Thread Jasbinder Bali
Also, My insert statement is   EXEC SQL INSERT INTO raw_email (id,raw_email) VALUES (1,:ch);    On 8/16/06, Michael Fuhr <[EMAIL PROTECTED]> wrote: On Wed, Aug 16, 2006 at 01:20:08AM -0400, Jasbinder Bali wrote:> This is how the array is formed in my C code > --

Re: [GENERAL] DB insert Error

2006-08-15 Thread Jasbinder Bali
I changed the datatype from varchar[] to varchar ECPGdebug(1,stderr) says [2998]: ECPGexecute line 97 Ok: INSERT 0 1  Its not inserting any record even though sqlcode is 0.   ~Jas  On 8/16/06, Michael Fuhr <[EMAIL PROTECTED]> wrote: On Wed, Aug 16, 2006 at 01:20:08AM -0400, Jasbinder Bali wrote:>

Re: [GENERAL] DB insert Error

2006-08-15 Thread Michael Fuhr
On Wed, Aug 16, 2006 at 01:20:08AM -0400, Jasbinder Bali wrote: > This is how the array is formed in my C code > --- > FILE *fp; > > while(!feof(fp)) > {ch[i]=fgetc(fp); > if(ch[i]=='\n') lines++;

Re: [GENERAL] DB insert Error

2006-08-15 Thread Jasbinder Bali
This is how the array is formed in my C code ---  FILE   *fp;   while(!feof(fp))  {ch[i]=fgetc(fp);   if(ch[i]=='\n') lines++;   i++;  }    ch[i-1]='\0';    fclose(fp);---

Re: [GENERAL] DB insert Error

2006-08-15 Thread Michael Fuhr
On Wed, Aug 16, 2006 at 12:38:42AM -0400, Jasbinder Bali wrote: > table definition of raw_email table is as follows > > CREATE TABLE raw_email ( > idint4 NOT NULL, > raw_email varchar[], > parsed_flag bool NOT NULL DEFAULT false, > CONSTRAINT pk_rawemail PRIMARY KEY (id)

Re: [GENERAL] DB insert Error

2006-08-15 Thread Jasbinder Bali
table definition of raw_email table is as follows   CREATE TABLE raw_email ( idint4 NOT NULL, raw_email  varchar[], parsed_flag bool NOT NULL DEFAULT false, CONSTRAINT  pk_rawemail PRIMARY KEY (id)) WITHOUT OIDS;   i have very much declared raw_email field as varchar and n

Re: [GENERAL] DB insert Error

2006-08-15 Thread Michael Fuhr
On Tue, Aug 15, 2006 at 11:55:58PM -0400, Jasbinder Bali wrote: > I'm using ECPG and trying to do follwoing insert in one of the talbes. > > insert into raw_email ( id , raw_email ) values ( 1 , :ch); > > ch is an array and defined as follows: > > EXEC SQL BEGIN DECLARE SECTION; >char ch[M

[GENERAL] DB insert Error

2006-08-15 Thread Jasbinder Bali
Hi, I'm using ECPG and trying to do follwoing insert in one of the talbes.    insert into raw_email ( id  , raw_email  ) values ( 1 , :ch);   ch is an array and defined as follows:    EXEC SQL BEGIN DECLARE SECTION;    char ch[MSG_LEN];EXEC SQL END DECLARE SECTION;  contents of array ch is actually