Kathryn Andersen
and 1 contributors

NAME

Marky::DbTable - Marky::DbTable - querying one database table

VERSION

version 0.035

SYNOPSIS

    use Marky::DbTable;;

DESCRIPTION

Bookmarking and Tutorial Library application. Querying one database table, returning result.

NAME

Marky::DbTable - querying one database table

VERSION

version 0.035

METHODS

new

Create a new object, setting global values for the object.

    my $obj = Marky::DbTable->new(
        database=>$database);

query_raw

Query the database, return an array of results.

$results = $dbtable->query_raw($sql);

query

Query the database, return results and query-tags.

$results = $dbtable->query( location=>$base_url, %args);

taglist

Query the database, return a taglist

tagcloud

Query the database, return a tagcloud.

total_records

Query the database, return the total number of records.

what_error

There was an error, what was it?

Helper Functions

These are functions which are NOT exported by this plugin.

_set_defaults

Set the defaults for the object if they are not defined already.

_connect

Connect to the database If we've already connected, do nothing.

Search the database; returns the total, the query, and the results for the current page.

$hashref = $dbtable->_search( q=>$query_string, tags=>$tags, p=>$p, n=>$items_per_page, sort_by=>$order_by, );

_process_request

Process the request, return HTML Note that if there are no query-strings, it will return ALL the results. It's so annoying to have a search-engine which barfs at empty searches.

$dbtable->_process_request(%args);

_process_taglist

Process the request, return HTML of all the tags.

$dbtable->_process_taglist(%args);

_process_tagcloud

Process the request, return HTML of all the tags.

$dbtable->_process_tagcloud(%args);

_total_records

Find the total records in the database.

$dbtable->_total_records();

_build_where

Build (part of) a WHERE condition

$where_cond = $dbtable->build_where( q=>$query_string, field=>$field_name, );

_query_to_sql

Convert a query string to an SQL select statement While this leverages on Select::Query, it does its own thing for a generic query and for a tags query

$sql = $dbtable->_query_to_sql( q=>$query_string, tags=>$tags, p=>$p, where=>$where, n=>$items_per_page, sort_by=>$order_by, sort_by2=>$order_by2, sort_by3=>$order_by3, );

_format_searchform

Format an array of results hashrefs into HTML

$result = $self->_format_searchform( total=>$total, tags_query=>$tags_query, location=>$action_url);

_format_pagination

Format the prev/next links.

$result = $self->_format_pagination( total=>$total, tags_query=>$tags_query, location=>$action_url);

_format_rows

Format an array of results hashrefs into HTML

$result = $self->_format_rows( rows=>$result_arrayref, total=>$total, tags_query=>$tags_query, tags_action=>$action_url);

_create_taglist

Count up all the tags in the results.

%all_tags = $self->_create_taglist( rows=>$result_arrayref);

_format_tagcloud

Format a hash of tags into HTML

$tagcloud = $dbtable->_format_tagcloud( all_tags=>\%all_tags, tags_query=>$tags_query, tags_action=>$action_url);

_format_taglist

Format a hash of tags into HTML

$taglist = $dbtable->_format_taglist( all_tags=>\%all_tags, tags_query=>$tags_query, tags_action=>$action_url);

_format_tag_collection

Format an array of tags into HTML

$taglist = $dbtable->_format_tag_collection( in_list=>0, all_tags=>\%all_tags, tags_array=>\@tags, tags_query=>$tags_query, tags_action=>$action_url);

_format_tag_query

Format a tag query into components which can be removed from the query

$tagq_str = $dbtable->_format_tag_query( tags_query=>$tags_query, tags_action=>$action_url);

_format_q_query

Format a q query into components which can be removed from the query

$tagq_str = $dbtable->_format_q_query( q=>$q, tags_query=>$tags_query, action=>$action_url);

AUTHOR

Kathryn Andersen <perlkat@katspace.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Kathryn Andersen.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.