dbicx::testdatabase::subclass(3pm) [debian man page]
DBICx::TestDatabase::Subclass(3pm) User Contributed Perl Documentation DBICx::TestDatabase::Subclass(3pm)NAME
DBICx::TestDatabase::Subclass - a DBICx::TestDatabase you can add your own methods to
SYNOPSIS
Your test database subclass:
package MyApp::TestDatabase
use base qw(DBICx::TestDatabase::Subclass MyApp::Schema);
sub foo {
my $self = shift;
return $self->resultset('Foo')->create({ foo => 'bar' });
}
Later:
use MyApp::TestDatabase;
my $schema = MyApp::TestDatabase->connect;
my $foo_row = $schema->foo; # MyApp::TestDatabase::foo
my $bars = $schema->resultset('Bar'); # MyApp::Schema::resultset
DESCRIPTION
Sometimes DBICx::TestDatabase doesn't give you enough control over the object returned. This module lets you create a custom test database
class.
METHODS
connect
This method creates the temporary database and returns the connection. If your subclass needs to change the way connect works, do
something like this:
sub connect {
my ($class) = @_;
say 'This happens before we create the test database.';
my $schema = $class->next::method;
say '$schema is the temporary test database';
return $schema;
}
SEE ALSO
If you want a simple test database based on a DBIC schema, just use DBICx::TestDatabase.
AUTHOR
Jonathan Rockway "<jrockway@cpan.org>"
LICENSE
Copyright (c) 2007 Jonathan Rockway.
This program is free software. You may use, modify, and redistribute it under the same terms as Perl itself.
perl v5.10.1 2007-10-07 DBICx::TestDatabase::Subclass(3pm)
Check Out this Related Man Page
DBICx::TestDatabase(3pm) User Contributed Perl Documentation DBICx::TestDatabase(3pm)NAME
DBICx::TestDatabase - create a temporary database from a DBIx::Class::Schema
SYNOPSIS
Given a DBIx::Class::Schema at "MyApp::Schema", create a test database like this:
use DBICx::TestDatabase;
my $schema = DBICx::TestDatabase->new('MyApp::Schema');
Then you can use $schema normally:
$schema->resultset('Blah')->create({ blah => '123' });
When your program exits, the temporary database will go away.
DESCRIPTION
This module creates a temporary SQLite database, deploys your DBIC schema, and then connects to it. This lets you easily test your DBIC
schema. Since you have a fresh database for every test, you don't have to worry about cleaning up after your tests, ordering of tests
affecting failure, etc.
METHODS
new($schema)
Loads $schema and returns a connection to it.
connect
Alias for new.
ENVIRONMENT
You can control the behavior of this module at runtime by setting environment variables.
DBIC_KEEP_TEST
If this variable is true, then the test database will not be deleted at "END" time. Instead, a message containing the paths of the test
databases will be printed.
This is good if you want to look at the database your test generated, for debugging.
(Note that the database will never exist on disk if you don't set this to a true value.)
AUTHOR
Jonathan Rockway "<jrockway@cpan.org>"
LICENSE
Copyright (c) 2007 Jonathan Rockway.
This program is free software. You may use, modify, and redistribute it under the same terms as Perl itself.
perl v5.10.1 2010-12-15 DBICx::TestDatabase(3pm)
hi, please, help me
i need connect my program in C whit a SybaseIQ 12 database
i´m programming in solaris 5 (unix)
please, help me, because i don`t know what to do...
thanks..
jonathan (0 Replies)
i have a little pro*c code (as shown below)
to connect an oracle database. (in unix solaris platform)
in the preprocessor compilation step everything is ok.
but when i try to compile the code using cc i get the
error below:
ld:
Unresolved:
sqlcxt
i think there is a problem while linking... (3 Replies)
hi guys,
Unix dummy here.
I need help creating a script for class.
The assignment reads as follows:
create a script that will create a new schema in schema.txt, it must accept 7 arguments (the first being the name of the schema) the other 6 being the 6 field names. the schema has to be tested... (1 Reply)
How can
grep G.*schema
give me the result: ${Gacntg_dt}""'"'
doesn't G.*schema say give me an unlimited number of characters between G and schema?
:confused: (3 Replies)
Hi! Everyone
I am new to the shell scripting basically.I have been asked to create a shell script that connect to a oracle database to read data from a particular schema then spool it into a csv file then email to customer.
Can anybody let me know how to go about that.
I have create... (14 Replies)
Hi,
I have been trying to connect to sqlplus the same way I used to do in my earlier company but I get these error messages , please suggest way out -
user name - xyzuser
schema name - xyzschema
$ sqlplus xyzuser@xyzschema
ksh: sqlplus: not found.
$ sqlplus -s xyzuser@xyzschema... (5 Replies)
hi rhel6 gurus
i have set up a rhel6.2 db server.
i have data base admins needing to connect to this rhel6 derver via reflectionx. reflectionx is set correctly but when attempting to test connectivity by 'xclock' the following message pops up : -bash:xclock; command not found.
anyone out... (1 Reply)
Hi All
I am able to connect my oracle database with Perl and able to execute the queries.
There is one schema names master19 which contains 50 table.
I want to take backup of each table in and store at a given directory location in Perl
For example suppose if a table student is present in... (1 Reply)
Hi All
I am able to connect my oracle database with Perl and able to execute the queries.
There is one schema names master19 which contains 50 table.
I want to take backup of each table in and store at a given directory location in Perl
For example suppose if a table student is present in... (3 Replies)
Hi experts.
I have different database and schema and their passwords in one file.
In Unix : I want to create the script that connect the sqlplus and execute the select query one by one schema with different database.
Ex: password File Format
databse schemaname password
DB1 name1 ... (1 Reply)
I have 3 files, data file,schema file and a threshold file.
Data file contains data in which columns are distributed according to schema file. This data file doesn't contain any headers.
Three continuous columns in the data file represent single variable in schema file.
first column represent... (1 Reply)