Taxi::Mysql::Table - extendable full-text index using mysql: table specifications


(Back to Top)


NAME

Taxi::Mysql::Table - extendable full-text index using mysql: table specifications

(Back to Top)


SYNOPSIS

 ##========================================================================
 ## PRELIMINARIES
 use Taxi::Mysql::Table;
 ##========================================================================
 ## Constructors etc.
 $tbl = $CLASS_OR_OBJ->new($table_name,%args);
 ##========================================================================
 ## Initialization and Compilation
 $tab = $tab->initialize();
 $tab = $tab->compile($index);
 ##========================================================================
 ## Properties
 $sqlname = $tab->sqlName();
 ##========================================================================
 ## db wrappers
 $bool = $tbl->dbExists($ix);
 $bool = $tbl->dbClear($ix);
 $bool = $tbl->dbDrop($ix);
 $bool = $tbl->dbCreate($ix);
 ##========================================================================
 ## SQL: Table Creation
 $sql = $tab->createSql();
 ##========================================================================
 ## SQL: Data loading
 $sql = $tab->loadDataInfileSql(%args);
 ##========================================================================
 ## SQL: Data export
 $sql = $tab->exportDataSql(%args);
 $sql = $tab->selectAllSql(%args);

(Back to Top)


DESCRIPTION

Taxi::Mysql::Table is a class for representing a relational table in a Taxi::Mysql index. Nearly all user-customizable features of a Taxi::Mysql index are implemented by keyword flags in the specific Taxi::Mysql::Table object instances which make up the index's table inventory.

Constructors etc.

new
 $tbl = $CLASS_OR_OBJ->new($table_name,%args);

Initialization and Compilation

initialize
 $tab = $tab->initialize();
compile
 $tab = $tab->compile($index);

Properties

sqlName
 $sqlname = $tab->sqlName();

Returns SQL-safe name of $tab.

db wrappers

dbExists
 $bool = $tbl->dbExists($ix);

Returns true iff table exists in the backend for index $ix.

dbClear
 $bool = $tbl->dbClear($ix);

Clears table data.

dbDrop
 $bool = $tbl->dbDrop($ix);

Drops table.

dbCreate
 $bool = $tbl->dbCreate($ix);

Creates table in the backend DB for index $ix. Requires that the table has been compiled.

SQL: Table Creation

createSql
 $sql = $tab->createSql();

Returns SQL code for creating the backend table. Requires that the table has been compiled.

SQL: Data loading

loadDataInfileSql
 $sql = $tab->loadDataInfileSql(%args);

Reurns SQL code for populating the table from a text data file. Recognized %args:

 file       => $filename,  ##-- may be relative to cwd (default="${table_sqlname}.txt")
 replace    => $bool,      ##-- replace duplicate unique-key rows (default=no): overrides 'ignore'
 ignore     => $bool,      ##-- ignore duplicate unique-key rows  (default=no)
 delay      => $bool,      ##-- 'LOW PRIORITY': delay until no other clients are reading the table
 concurrent => $bool,      ##-- 'CONCURRENT': other threads might still be able to retrieve data: overrides 'delay'
 local      => $bool,      ##-- if true, all data is sent over the net (default=false)
 fields     => $sql,       ##-- SQL 'FIELDS' fragment
 lines      => $sql,       ##-- SQL 'LINES' fragment
 skip       => $n,         ##-- number of lines to skip (default=0)
 columns    => \@names,    ##-- list of column names to load (default=map {$_->{name}} $tab->{colsa})
 set        => $sql,       ##-- SQL 'SET' fragment

Default %args can be set in $tab->{loadDataArgs}.

SQL: Data export

exportDataSql
 $sql = $tab->exportDataSql(%args);

Server-side data export to text file. Exported file will have owner and group of backend server. See Taxi::Mysql::Handle::sqlExportDataFile() for client-side export.

Known %args:

 file    => $filename, ##-- may be relative to cwd (default="${table_sqlname}.txt")
 fields  => $sql,      ##-- SQL 'FIELDS' fragment
 lines   => $sql,      ##-- SQL 'LINES' fragment
 columns => \@names,   ##-- list of column names to load (default=map {$_->{name}} $tab->{colsa})

Default %args can be set in $tab->{exportDataArgs}.

selectAllSql
 $sql = $tab->selectAllSql(%args);

Returns SQL code for selecting all rows from $tab. Known %args:

 columns=>\@names, ##-- list of column names to export (default=map {$_->{name}} $tab->{colsa})

(Back to Top)


ACKNOWLEDGEMENTS

Perl by Larry Wall.

(Back to Top)


AUTHOR

Bryan Jurish <moocow@ling.uni-potsdam.de>

(Back to Top)


COPYRIGHT AND LICENSE

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.

(Back to Top)


SEE ALSO

perl(1), Taxi::Mysql(3perl), Taxi::Mysql::Handle(3perl), Taxi::Mysql::Query(3perl), Taxi::Mysql::Hit(3perl), Taxi::Mysql::Format(3perl).

(Back to Top)

 Taxi::Mysql::Table - extendable full-text index using mysql: table specifications