Return-Path: owner-postman Delivery-Date: Sun, 17 Apr 94 23:25:05 -0700 Return-Path: owner-postman Received: from localhost (localhost [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with SMTP id UAA07376 for postgres-redist; Sun, 17 Apr 1994 20:33:40 -0700 Resent-From: POSTGRES mailing list Resent-Message-Id: <199404180333.UAA07376@nobozo.CS.Berkeley.EDU> X-Authentication-Warning: nobozo.CS.Berkeley.EDU: Host localhost didn't use HELO protocol Sender: owner-postman@postgres.Berkeley.EDU X-Return-Path: owner-postman Received: from math.mps.ohio-state.edu (math.mps.ohio-state.edu [128.146.110.30]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with ESMTP id UAA07367 for ; Sun, 17 Apr 1994 20:33:39 -0700 Received: (from ren@localhost) by math.mps.ohio-state.edu (8.6.8/8.6.6) id XAA27402 for postgres@postgres.berkeley.edu; Sun, 17 Apr 1994 23:33:37 -0400 From: lmr Message-Id: <199404180333.XAA27402@math.mps.ohio-state.edu> Subject: How to manipulate binary data in postgres? To: postgres@postgres.Berkeley.EDU Date: Sun, 17 Apr 1994 23:33:36 -0400 (EDT) X-Mailer: ELM [version 2.4 PL23] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 1260 Resent-To: postgres-redist@postgres.Berkeley.EDU Resent-Date: Sun, 17 Apr 94 20:33:40 -0700 Resent-XMts: smtp Greeting! I have several questions about manipulating binary data in postgres. Please help me ! Any documentations, sample code and hints are welcomed. (1) For the circle example in The Postgres user manual (page16), the insertion is done as: append tutorial (a="(1.0, 1.0, 10.0)"::circle)\g I have no problem with this. I am not sure how we do this in a C program with a pointer. Specifically, suppose char *cir_ptr; .... strcpy(cir_ptr, "(1.0, 1.0, 10.0)"); Can we do PQexec("append tutorial (a=cir_ptr::circle"); //? ^^^^^^^ This example is not necessary but my binary data is not printable. I have to use pointer to address the memory location. If not, which is the correct way? (2) All I want is to do something like (in C program) define type my_bin (internallength=variable, input=my_bin_in, output=my_bin_out)\g create my_class(bin_data=my_bin)\g char* my_bin_ptr; /* fill data*/ insert data from my_bin_ptr and be able to retreve data into a specified memory location. I don't see how to do this part. Many thanks! -- Liming Ren | (614) 292-8989 | Dept. of Mathematics | 231 West 18th Avenue The Ohio State University | Columbus, Ohio43210