agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: Paul M. Aoki <aoki@cs.berkeley.edu>
To: postgres@postgres.Berkeley.EDU
Cc: Norbik.B.Idris@cm.cf.ac.uk
Subject: [Norbik.B.Idris@cm.cf.ac.uk: C functions]
Date: Thu, 25 Aug 94 11:51:26 -0700
Message-ID: <199408251851.LAA25083@faerie.CS.Berkeley.EDU> (raw)

------- 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.
==============================================================================



reply

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: postgres@postgres.berkeley.edu
  Cc: aoki@cs.berkeley.edu, Norbik.B.Idris@cm.cf.ac.uk
  Subject: Re: [Norbik.B.Idris@cm.cf.ac.uk: C functions]
  In-Reply-To: <199408251851.LAA25083@faerie.CS.Berkeley.EDU>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox