README
1NAME
2 Class::DBI::DATA::Schema - Execute Class::DBI SQL from DATA sections
3
4SYNOPSIS
5 package Film.pm;
6 use base 'Class::DBI';
7 # ... normal Class::DBI setup
8
9 use 'Class::DBI::DATA::Schema';
10
11 Film->run_data_sql;
12
13 __DATA__
14 CREATE TABLE IF NOT EXISTS film (....);
15 REPLACE INTO film VALUES (...);
16 REPLACE INTO film VALUES (...);
17
18DESCRIPTION
19 This is an extension to Class::DBI which injects a method into your
20 class to find and execute all SQL statements in the DATA section of the
21 package.
22
23METHODS
24 run_data_sql
25 Film->run_data_sql;
26
27 Using this module will export a run_data_sql method into your class.
28 This method will find SQL statements in the DATA section of the class it
29 is called from, and execute them against the database that that class is
30 set up to use.
31
32 It is safe to import this method into a Class::DBI subclass being used
33 as the superclass for a range of classes.
34
35 WARNING: this does not do anything fancy to work out what is SQL. It
36 merely assumes that everything in the DATA section is SQL, and applies
37 each thing it finds (separated by semi-colons) in turn to your database.
38 Similarly there is no security checking, or validation of the DATA in
39 any way.
40
41TRANSLATION and CACHING
42 There are undocumented arguments that will allow this module to
43 translate the SQL from one database schema to another, and also to cache
44 the result of that translation. People are relying on these, so they're
45 not going to go away, but you're going to need to read the source to
46 work out how to use them.
47
48SEE ALSO
49 Class::DBI.
50
51AUTHOR
52 Tony Bowden
53
54BUGS and QUERIES
55 Please direct all correspondence regarding this module to:
56 bug-Class-DBI-DATA-Schema@rt.cpan.org
57
58COPYRIGHT
59 Copyright (C) 2003-2005 Kasei
60
61 This program is free software; you can redistribute it and/or modify it under
62 the terms of the GNU General Public License; either version 2 of the License,
63 or (at your option) any later version.
64
65 This program is distributed in the hope that it will be useful, but WITHOUT
66 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
67 FOR A PARTICULAR PURPOSE.
68
69