The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DBIx::Table::TestDataGenerator::Query - query database and handle SQL commands

DESCRIPTION

The class provides methods querying the target database for data and the ones handling SQL commands (indirectly via DBIx::Class modules).

SUBROUTINES/METHODS

num_records

Arguments:

  • schema: DBIx::Class schema

  • table: name of the target table

Returns the number of records in the target table.

max_value

Arguments:

  • schema: DBIx::Class schema

  • col_name: name of the target column

  • result_class: result class involving the target column

Returns the maximum value of the passed in column.

max_length

Arguments:

  • schema: DBIx::Class schema

  • col_name: name of the target column

  • result_class: result class involving the target column

Returns the maximum length of the passed in column.

insert_statement

Arguments:

  • table: name of the target table

  • colname_array_ref: reference to the complete array of column names of the target table

Returns a string defining a parametrized insert statement for the target table.

prepare_insert

Arguments:

  • dbh: DBI database handle

  • table: name of the target table

  • colname_array_ref: reference to the complete array of column names of the target table

Prepares an insert statement.

execute_insert

Arguments:

  • sth_insert: handle of a prepared insert statement

  • all_vals: the values to be used for the insert statement

Executes an insert statement.

execute_new_row

Arguments:

  • schema: DBIx::Class schema

  • table: name of the target table

  • cols_and_values: reference to a hash having as keys column names of the target table and as values corresponding values.

Adds a new row to the target table. Is used in case we have an auto-increment column, there is a self-reference and the root nodes are identified by having "pkey = referenced pkey". In this case, we need to know the value of the auto-increment column for the new record and this can easily be determined from the DBIx::Class::Row object itself. For performance reasons, we don't use Row objects for the other inserts, in those cases, we use plain DBI.

commit

Argument: DBI database handle.

Executes a commit.

disconnect

Argument: DBI database handle.

Disconnects from the target database.

AUTHOR

Jose Diaz Seng, <josediazseng at gmx.de>

COPYRIGHT AND LICENSE

Copyright (C) 2012-2013, Jose Diaz Seng.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.