Taxi::Mysql::Hit - extendable full-text index using mysql: query results |
Taxi::Mysql::Hit - extendable full-text index using mysql: query results
##======================================================================== ## PRELIMINARIES
use Taxi::Mysql::Hit;
##======================================================================== ## Constructors etc.
$hit = $CLASS_OR_OBJ->new(%args);
##======================================================================== ## Conventions
$q = $hit->{query}; ##-- source query, a Taxi::Mysql::Query::Base object $ix = $q->{index}; ##-- queried index, a Taxi::Mysql object
##======================================================================== ## Retrieval: SQL
undef = $hit->sql_prepare();
$colName = $hit->hitColumnName(); $tabName = $hit->hitTableName(); $colName = $hit->matchColumnName(); $tabName = $hit->matchTableName();
$matchcol_sql_frag = $hit->sql_matched_column(); $columns_sql_frag = $hit->sql_select_columns(); $tables_sql_frag = $hit->sql_from_tables(); $hitconds = $hit->sql_hit_conditions(); $where = $hit->sql_where(); $order = $hit->sql_order_by;
$sql = $hit->sql();
##======================================================================== ## Retrieval: open/close
$hit = $hit->open(); $hit = $hit->close();
##======================================================================== ## Retrieval: population
\@row = $hit->fetch1(); undef = $hit->populate();
Taxi::Mysql::Hit is a base class represening an elementary result unit returned by a Taxi user query.
Taxi::Mysql::Hit inherits from Taxi::Mysql::Bas.
$hit = $CLASS_OR_OBJ->new(%args);
Most users will not need to call this constructor directly. Use of the Taxi::Mysql::Query::Base API is preferred; see in particular the Taxi::Mysql::Query::Base methods open(), fetchHit(), fetchHitList(), and close().
Object structure / keyword %args:
{ ##-- source query [REQUIRED] query => $q, ##-- source Taxi::Mysql::Query object [handle source, should be open] qdata => \@qdata, ##-- source row as returned by $q->{sth}->fetchrow_arrayref();
##-- retrieval matched => $label, ##-- column label for boolean 'matched' column (default='matched') sth => $sth, ##-- statement handle for hit retrieval query
##-- cached data sth_NAME => $column_names, ##-- as returned by DBI data => [ \@row1, ... ], ##-- retrieved data as array-of-arrays }
undef = $hit->sql_prepare();
Prepares cached values for executing hit retrieval backend query. Caches values:
$hit->{hitColumnName} ##-- name of the source/dest hit id-column $hit->{matchColumnName} ##-- name of the source/dest match id-column [different from 'matched']
$colName = $hit->hitColumnName();
Returns user-specified name of the unique hit identifier (primary key). Default is the name of the first column in the (open) statement handle $hit->{query}{sth}.
$tabName = $hit->hitTableName();
Returns the SQL name of the table containing unique hit identifiers. Default returns the SQL name of $hit->{query}{default_table}.
$colName = $hit->matchColumnName();
Returns column name of the token (match) column. Default is the name of the second column in the (open) statement handle $hit->{query}{sth}.
$tabName = $hit->matchTableName();
Returns the SQL name of the token (match) table. Default returns the SQL name of $hit->{query}{default_table}.
$matchcol_sql_frag = $hit->sql_matched_column();
Assumes $hit->sql_prepare()
has been called.
Returns SELECT subclause for hit backend SQL boolean 'matched' column.
$columns_sql_frag = $hit->sql_select_columns();
Assumes $hit->sql_prepare()
has been called.
Returns SELECT column list for hit backend SQL.
Default version calls $ix->hitColumns()
and $hit->sql_matched_column().
$tables_sql_frag = $hit->sql_from_tables();
Assumes $hit->sql_prepare()
has been called.
Returns FROM tables list or hit backend SQL.
Default version calls $ix->hitFrom().
$hitconds = $hit->sql_hit_conditions();
Assumes $hit->sql_prepare()
has been called.
Returns WHERE conditions for hit backend SQL as a string.
Default version restricts hitTableName().hitColumnName()
to
the value of the first column fetched by the Taxi query.
$where = $hit->sql_where();
Assumes $hit->sql_prepare()
has been called.
Returns WHERE clause for hit backend SQL.
Calls $ix->hitJoins()
and $hit->sql_hit_conditions().
$order = $hit->sql_order_by;
Assumes $hit->sql_prepare()
has been called.
Returns ORDER BY clause for hit backend SQL.
$sql = $hit->sql();
Compute and return the hit backend SQL query string.
Implicitly calls $hit->sql_prepare()
if relevant values are uncached.
Calls $hit->sql_*() methods.
$hit = $hit->open();
Computes hit backend SQL and opens a backend statement handle for hit retrieval.
$hit = $hit->close();
Closes backend statement handle (if any), and clears hit-local caches.
\@row = $hit->fetch1();
Fetch a single row of data (a single token) from the hit's backend statement handle (which must be present and open) into $hit->{data}. Really just a wrapper for $hit->{sth}->fetchrow_arrayref().
undef = $hit->populate();
Fetch all remaining data rows from the hit's backend statement handle
(which must be present and open) into $hit->{data}.
Mostly just a wrapper for $hit->{sth}->etchall_arrayref().
Calls finish()
on statement handle on completion.
Perl by Larry Wall.
Bryan Jurish <moocow@ling.uni-potsdam.de>
Copyright (C) 2006 by Bryan Jurish
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.
perl(1)
Taxi::Mysql(3perl),
Taxi::Mysql::Query::Base(3perl),
Taxi::Mysql::HitList(3perl).
Taxi::Mysql::Hit - extendable full-text index using mysql: query results |