XAS::Model::Schema - A class for the XAS environment
use XAS::Model::Schema; use XAS::Mode::Database; XAS::Model::Database->schema('XAS::Model::Database::Testing'); my $schema = XAS::Model::Schema->opendb('testing');
This module loads database connection information from a file. This file may be located in the users home directory or in the XAS config directory. With the usual convention of the user specific file will override the global generic file. This file is named database.ini.
Format of the configuration file is as follows:
[progress] - corresponds to what is given to opendb() dbname = monitor - name of the database dsn = SQLite - corresponds to the dbd driver user = username - the user context to use password = password - the password for that context
When using ODBC with a user level DSN or a dynamic connection, you should add the following items:
driver = SQL Server server = localhost,1234 - (host,port)
When using PostgresSQL (Pg), you can add the following items:
port = 5432 host = localhost sslmode = something options = something
Or a service name, which is not compatible with the above.
service = service name
There can be multiple stanzas, the first one that matches is used.
This method makes the connection to the database. It takes these parameters:
The name of the database. This is defined in the database.ini file.
This method converts the internal DBIx::Class exceptions into a XAS exception. It takes these parameters:
The error string supplied by DBIx::Class
This method is an override for the one provided by DBIx::Class::Schema::Config. It sets various defaults to be used when connecting to certain databases. There are defaults for SQLite, PostgreSQL and ODBC connections. The following parameters are supplied from DBIx::Class::Schema::Config.
Kevin L. Esteb, <kevin@kesteb.us>
Copyright (c) 2012-2015 Kevin L. Esteb
This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.
To install XAS::Model, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XAS::Model
CPAN shell
perl -MCPAN -e shell install XAS::Model
For more information on module installation, please visit the detailed CPAN module installation guide.