Dumping variables..A sort of serialize

From: "Gurunandan R(dot) Bhat" <grbhat(at)exocore(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Dumping variables..A sort of serialize
Date: 2001-10-03 17:07:27
Message-ID: Pine.LNX.4.33.0110032237050.3819-100000@suman.greenfields.universe
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hi,

I am currently struggling to write a "serialize"-like function
that would dump a row of a table into a string-like object in a way that
would allow me to reconstruct the original row (or its individual
elements) from this object.

The tentative plan I have is something like this:

1) Write a C-function declared something like so:

Datum serialise(PG_FUNCTION_ARGS)

2) Inside the function, get the pointer to the row using:

TupleTableSlot *row = PG_GETARGPOINTER(0);

3) Use GetAttributeByName to get the "Datum" value corresponding
to each of the attributes.

This is where I am stuck. What I want to do now is to use this datum value
returned by GetAttributeByName to get at the "glob of memory" occupied by
the attribute and "memmove" it into an area declared as text. I could then
store this text as a row in a table. Is this at all possible or am I
talking through my hat ;)

I am sorry I dont understand the backend variable storage and
types too well and would be grateful for some help.

Regards and Thanks,
Gurunandan

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-10-03 17:28:13 Rounding issue with current_time
Previous Message Bruce Momjian 2001-10-03 16:05:34 Re: Unicode combining characters