Sure. DBIx::TextIndex ships with MySQL support (only); I'm trying to adapt it to work with PostgreSQL. However, the way the author implemented the database-specific support was to accept a parameter, "db => $dbname", and construct a partial file path, essentially via
$db = "DBIx/TextIndex/${db}.pm" require $db;
Thus, any db-specific code must reside in that file. In particular, it's intended that functions defined in that file return valid SQL statements as text for certain operations like CREATE TABLE, UPDATE, SELECT, etc.

The problem comes from the MySQL-centric code ... several of the internal operations involve putting a row in a table via "REPLACE INTO", which has no corresponding statement in most other RDBMS, including PostgreSQL. I really have to perform a DELETE and INSERT at that point, or a SELECT followed by an UPDATE (if successful) or an INSERT (if not). And I can't do the delete in the function that returns the SQL code, because the caller doesn't provide any info about parameters at that point; instead, it takes the SQL and executes it in a loop.

The code in TextIndex expects only a single SQL statement to be returned. Thus, I need to provide a function to override the TextIndex function, so that it gets both the DELETE statement and the INSERT statement, prepares both, and executes both in a loop.

The problem is that the function I'm overriding makes use of a lexical defined elsewhere in the package. At this point I think my only options are to rewrite the whole package or writing a new class that inherits from the old.
--
Jeff Boes
Database Engineer
Nexcerpt, Inc.
vox 269.226.9550 ext 24
fax 269.349.9076
 http://www.nexcerpt.com
...Nexcerpt...Connecting People With Expertise


In reply to Re: Re: How to override methods which use my() variables? by Mur
in thread How to override methods which use my() variables? by Mur

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.