agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: lmr <ren@math.ohio-state.edu>
To: postgres@postgres.Berkeley.EDU
Subject: How to manipulate binary data in postgres?
Date: Sun, 17 Apr 1994 23:33:36 -0400 (EDT)
Message-ID: <199404180333.XAA27402@math.mps.ohio-state.edu> (raw)

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




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: ren@math.ohio-state.edu
  Subject: Re: How to manipulate binary data in postgres?
  In-Reply-To: <199404180333.XAA27402@math.mps.ohio-state.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