1Padre::DB::Plugin(3)  User Contributed Perl Documentation Padre::DB::Plugin(3)
2
3
4

NAME

6       Padre::DB::Plugin - Padre::DB class for the "plugin" table
7

SYNOPSIS

9       TO BE COMPLETED
10

DESCRIPTION

12       TO BE COMPLETED
13

METHODS

15   select
16         # Get all objects in list context
17         my @list = Padre::DB::Plugin->select;
18
19         # Get a subset of objects in scalar context
20         my $array_ref = Padre::DB::Plugin->select(
21             'where name > ? order by name',
22             1000,
23         );
24
25       The "select" method executes a typical SQL "SELECT" query on the
26       "plugin" table.
27
28       It takes an optional argument of a SQL phrase to be added after the
29       "FROM plugin" section of the query, followed by variables to be bound
30       to the placeholders in the SQL phrase. Any SQL that is compatible with
31       SQLite can be used in the parameter.
32
33       Returns a list of "Padre::DB::Plugin" objects when called in list
34       context, or a reference to an ARRAY of "Padre::DB::Plugin" objects when
35       called in scalar context.
36
37       Throws an exception on error, typically directly from the DBI layer.
38
39   count
40         # How many objects are in the table
41         my $rows = Padre::DB::Plugin->count;
42
43         # How many objects
44         my $small = Padre::DB::Plugin->count(
45             'where name > ?',
46             1000,
47         );
48
49       The "count" method executes a "SELECT COUNT(*)" query on the "plugin"
50       table.
51
52       It takes an optional argument of a SQL phrase to be added after the
53       "FROM plugin" section of the query, followed by variables to be bound
54       to the placeholders in the SQL phrase. Any SQL that is compatible with
55       SQLite can be used in the parameter.
56
57       Returns the number of objects that match the condition.
58
59       Throws an exception on error, typically directly from the DBI layer.
60
61   new
62       TO BE COMPLETED
63
64       The "new" constructor is used to create a new abstract object that is
65       not (yet) written to the database.
66
67       Returns a new "Padre::DB::Plugin" object.
68
69   create
70         my $object = Padre::DB::Plugin->create(
71             name    => 'value',
72             version => 'value',
73             enabled => 'value',
74             config  => 'value',
75         );
76
77       The "create" constructor is a one-step combination of "new" and
78       "insert" that takes the column parameters, creates a new
79       "Padre::DB::Plugin" object, inserts the appropriate row into the
80       "plugin" table, and then returns the object.
81
82       If the primary key column "name" is not provided to the constructor (or
83       it is false) the object returned will have "name" set to the new unique
84       identifier.
85
86       Returns a new "plugin" object, or throws an exception on error,
87       typically from the DBI layer.
88
89   insert
90         $object->insert;
91
92       The "insert" method commits a new object (created with the "new"
93       method) into the database.
94
95       If a the primary key column "name" is not provided to the constructor
96       (or it is false) the object returned will have "name" set to the new
97       unique identifier.
98
99       Returns the object itself as a convenience, or throws an exception on
100       error, typically from the DBI layer.
101
102   delete
103         # Delete a single instantiated object
104         $object->delete;
105
106         # Delete multiple rows from the plugin table
107         Padre::DB::Plugin->delete('where name > ?', 1000);
108
109       The "delete" method can be used in a class form and an instance form.
110
111       When used on an existing "Padre::DB::Plugin" instance, the "delete"
112       method removes that specific instance from the "plugin", leaving the
113       object intact for you to deal with post-delete actions as you wish.
114
115       When used as a class method, it takes a compulsory argument of a SQL
116       phrase to be added after the "DELETE FROM plugin" section of the query,
117       followed by variables to be bound to the placeholders in the SQL
118       phrase. Any SQL that is compatible with SQLite can be used in the
119       parameter.
120
121       Returns true on success or throws an exception on error, or if you
122       attempt to call delete without a SQL condition phrase.
123
124   truncate
125         # Delete all records in the plugin table
126         Padre::DB::Plugin->truncate;
127
128       To prevent the common and extremely dangerous error case where deletion
129       is called accidentally without providing a condition, the use of the
130       "delete" method without a specific condition is forbidden.
131
132       Instead, the distinct method "truncate" is provided to delete all
133       records in a table with specific intent.
134
135       Returns true, or throws an exception on error.
136

INTERFACE

138   Accessors
139       name
140
141         if ( $object->name ) {
142             print "Object has been inserted\n";
143         } else {
144             print "Object has not been inserted\n";
145         }
146
147       Returns true, or throws an exception on error.
148
149         REMAINING ACCESSORS TO BE COMPLETED
150
151   SQL
152       The "plugin" table was originally created with the following SQL
153       command.
154
155         CREATE TABLE plugin (
156               name VARCHAR(255) PRIMARY KEY,
157               version VARCHAR(255),
158               enabled BOOLEAN,
159               config TEXT
160         )
161

SUPPORT

163       "Padre::DB::Plugin" is part of the Padre::DB API.
164
165       See the documentation for Padre::DB for more information.
166

AUTHOR

168       Adam Kennedy
169
171       Copyright 2008-2010 The Padre development team as listed in Padre.pm.
172
173       This program is free software; you can redistribute it and/or modify it
174       under the same terms as Perl itself.
175
176       The full text of the license can be found in the LICENSE file included
177       with this module.
178
179
180
181perl v5.12.1                      2010-06-11              Padre::DB::Plugin(3)
Impressum