Return-Path: owner-postman
Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.9/8.6.3) with SMTP id LAA26002 for postgres-redist; Thu, 25 Aug 1994 11:51:37 -0700
Resent-From: POSTGRES mailing list <postman@postgres.Berkeley.EDU>
Resent-Message-Id: <199408251851.LAA26002@nobozo.CS.Berkeley.EDU>
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: owner-postman
Received: from faerie.CS.Berkeley.EDU (faerie.CS.Berkeley.EDU [128.32.37.53]) by nobozo.CS.Berkeley.EDU (8.6.9/8.6.3) with ESMTP id LAA25992 for <postgres@postgres.Berkeley.EDU>; Thu, 25 Aug 1994 11:51:37 -0700
Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by faerie.CS.Berkeley.EDU (8.6.9/8.1B) with SMTP id LAA25083; Thu, 25 Aug 1994 11:51:32 -0700
Message-Id: <199408251851.LAA25083@faerie.CS.Berkeley.EDU>
X-Authentication-Warning: faerie.CS.Berkeley.EDU: Host localhost.Berkeley.EDU didn't use HELO protocol
From: aoki@cs.berkeley.edu (Paul M. Aoki)
To: postgres@postgres.Berkeley.EDU
Cc: Norbik.B.Idris@cm.cf.ac.uk
Reply-To: aoki@cs.berkeley.edu (Paul M. Aoki)
Subject: [Norbik.B.Idris@cm.cf.ac.uk: C functions]
Date: Thu, 25 Aug 94 11:51:26 -0700
X-Sender: aoki@postgres.Berkeley.EDU
Resent-To: postgres-redist@postgres.Berkeley.EDU
X-Mts: smtp
Resent-Date: Thu, 25 Aug 94 11:51:37 -0700
Resent-XMts: smtp

------- Forwarded Message

 From:  N B Idris <Norbik.B.Idris@cm.cf.ac.uk>
 To:  postman@postgres.Berkeley.EDU
 Cc:  Norbik.B.Idris@cm.cf.ac.uk
 Subject:  C functions
 Date:  Thu, 25 Aug 94 19:50:18 BST

 In writing a user defined C function which is callable via a define function command,
 can we have within the C function :
  
 	a) Basic I/O functions such as scanf/printf?
 
 	b) System calls eg. system("shelltool routine2");
 	   where parameter "routine2" is another executable program to be invoked
 	   within the new shelltool called?
 
 I wrote such a C function which does not cause any problem to postgres, i.e. all
 db retrievel etc. are working alright.  However, all statements of the form (a) 
 and (b) above, which exist in the routine seem to be (happily) ignored by postgres.
 
 I am working on version 4.1 using Sunsparc IPX.
 
 My define command is :
 ---------------------
 	define function just_compute
 		(language = "c", returntype = int4)
 		arg is (int4,int4,int4)
 		as "/home/thrall2/scmnbi/C-PROGRAMS/compute.o" \g
 
 and my compute.c program:
 ------------------------
 
 	#include <stdio.h>
 
 		long int 	a, z, n;
 
 
 	int just_compute(a,z,n)
 	{
 		long int	x;
 
 		x= a + z + n;
 		printf("x here = %d\n",x);   <-----SEEMED IGNORED!
 		 
 		simple_system_call();
 		return(x);
 
 	}
 
 	simple_system_call()
 	{
 		int	j, t=3;	
 
 	  	for (j=1; j<=t; j++)
 		    {
 			system("shelltool routine2"); 	   <----- IGNORED!
 			/*routine2 is another xcutable */
 		    };
 	}
 
 and I used it as:
 ----------------
 
 * retrieve (employee.all) where get_shares(30,40,50) < employee.empno \g
 
 Query sent to backend is "retrieve (employee.all) where get_shares(30,40,50) < employee.empno "
 -----------------------------------------------------------------------
 | address     | empno       | ssno        | name        | project_done|
 -----------------------------------------------------------------------
 | birmingham  | 2000        | 3003        | brown       | Nato 5      |
 -----------------------------------------------------------------------
 | wolverhampton| 2001        | 3004        | carnduff    | Nato 6      |
 -----------------------------------------------------------------------
 | worcester   | 2002        | 3005        | jones       | Nato 7      |
 -----------------------------------------------------------------------
 
 Go 
 
 This retrievel is OK, but....
 THE MAIN QUESTION : What happens to those ignored statements?
 
 Thanks in anticipation.
 
 norbik.
 
   

------- End of Forwarded Message
--
  Paul M. Aoki          |  University of California at Berkeley
  aoki@CS.Berkeley.EDU  |  Dept. of EECS, Computer Science Division (#1776) 
                        |  Berkeley, CA 94720-1776

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"

   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================
