Dumping variables..A sort of serialize - Mailing list pgsql-general

From Gurunandan R. Bhat
Subject Dumping variables..A sort of serialize
Date
Msg-id Pine.LNX.4.33.0110032208310.3819-100000@suman.greenfields.universe
Whole thread Raw
List pgsql-general
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



pgsql-general by date:

Previous
From: Mark Gordon
Date:
Subject: Scalability of postgresql.
Next
From: Keary Suska
Date:
Subject: Re: From Mysql to Postgre, how to do that?