[fdo-dev] [RDBI] redefine_def and cursor_def structures

Gavin Cramer gavin.cramer at autodesk.com
Tue Aug 8 11:59:30 EDT 2006

In the case of storage formats that need conversion (geometry being the
only one so far, I believe), the driver does on-the-fly conversion using
internal buffers.  You are looking at structures to keep track of these
conversions.  They would only be needed for databases that support
built-in geometry formats.

This conversion must be between FGF (FDO's geometry format) and whatever
the targetted database uses.  For binds, FGF -> built-in conversion is
done.  For defines, built-in -> FGF is done.  For MySQL, we used OGC
WKB.  The FdoGeometry API already had WKB conversion, which is why the
MySQL driver's "Geometry.c" does not need much code.


-----Original Message-----
From: Mateusz Loskot [mailto:mateusz at loskot.net] 
Sent: Tuesday, August 08, 2006 10:40 AM
To: dev at fdo.osgeo.org
Subject: [fdo-dev] [RDBI] redefine_def and cursor_def structures


Could anyone help me to understand purpose of memebers of RDBI base

1) What's the idea behind redefine_def structure?
What are original, substitution and geometry members for?

typedef struct _mysql_redefine_def
    void *original;
    void *substitution;
    void *geometry; /* geometry to be deleted, since the client won't */
    int  orig_type;
} mysql_define_def;

2) I understand cursor_def as a structure representing the area of query
and its results. Am I correct?
I understand all *_count and statement members but I have troubles with
getting the idea of defines, binds, redefines and rebinds members.
Could you give me some light on these?

typedef struct _mysql_cursor_def
    MYSQL_STMT *statement;
    int define_count;
    MYSQL_BIND *defines;
    int bind_count;
    MYSQL_BIND *binds;
    mysql_define_def *redefines; /* array of size define_count, NULL
entries for non-geometries */
    mysql_define_def *rebinds; /* array of size bind_count, NULL entries
for non-geometries */
} mysql_cursor_def;

I tried to revealed the idea from analysing FDO source code but I'm
still not sure.
I analysed functions: adjust_defines and adjust_binds from fdordbms
sources, Src/MySQL/Driver/execute.c file.
Technically, I understand their code but I can't understand the idea in
bigger picture.

Currently, I see binds, defines, rebinds and redefines as buffers for
the same data chunks for in different representations.
For example the same geometry is stored in RDBMS-specific bytes stream
format (e.g. as BLOB chunk) and unified geometry format (OGC WKB?).
But it's still too vague for me to find out how to implement it for
PostGIS. So, I'd really appreciate some explanation.

I'm asking in terms of re-implementing those structures for PostGIS.
Thanks in advance for your help.

Best regards
Mateusz Loskot

To unsubscribe, e-mail: dev-unsubscribe at fdo.osgeo.org
For additional commands, e-mail: dev-help at fdo.osgeo.org

More information about the Fdo-internals mailing list