1Padre::DB::History(3) User Contributed Perl DocumentationPadre::DB::History(3)
2
3
4

NAME

6       Padre::DB::History - Padre::DB class for the history table
7

SYNOPSIS

9       TO BE COMPLETED
10

DESCRIPTION

12       TO BE COMPLETED
13

INTERFACE

15   Methods
16       recent
17
18         # Get the values for a "Recent Files" menu
19         my @files = Padre::DB::History->recent('files', 10);
20
21       The "recent" method is non-ORLite method that is used to retrieve the
22       most recent distinct values for a particular history category.
23
24       It takes a compulsory parameter of the history type to retrieve, and an
25       optional positive integer for the maximum number of distinct values to
26       retrieve (10 by default).
27
28       Returns a list of zero or more 'name' values in array context.
29
30       Returns a reference to an array of zero or more 'name' values in scalar
31       context.
32
33       Throws an exception if the history query fails.
34
35       previous
36
37         # Get the single most recent file
38         my $file = Padre::DB::History->previous('files');
39
40       The "previous" method is the single-value form of the "recent" method.
41
42       It takes a compulsory parameter of the history type to retrieve.
43
44       Returns the single most recent value as a string.
45
46       Returns "undef" if there are no values.
47
48       Throws an exception if the history query fails.
49
50       select
51
52         # Get all objects in list context
53         my @list = Padre::DB::History->select;
54
55         # Get a subset of objects in scalar context
56         my $array_ref = Padre::DB::History->select(
57             'where id > ? order by id',
58             1000,
59         );
60
61       The "select" method executes a typical SQL "SELECT" query on the
62       history table.
63
64       It takes an optional argument of a SQL phrase to be added after the
65       "FROM history" section of the query, followed by variables to be bound
66       to the placeholders in the SQL phrase. Any SQL that is compatible with
67       SQLite can be used in the parameter.
68
69       Returns a list of Padre::DB::History objects when called in list
70       context, or a reference to an ARRAY of Padre::DB::History objects when
71       called in scalar context.
72
73       Throws an exception on error, typically directly from the DBI layer.
74
75       count
76
77         # How many objects are in the table
78         my $rows = Padre::DB::History->count;
79
80         # How many objects
81         my $small = Padre::DB::History->count(
82             'where id > ?',
83             1000,
84         );
85
86       The "count" method executes a "SELECT COUNT(*)" query on the history
87       table.
88
89       It takes an optional argument of a SQL phrase to be added after the
90       "FROM history" section of the query, followed by variables to be bound
91       to the placeholders in the SQL phrase. Any SQL that is compatible with
92       SQLite can be used in the parameter.
93
94       Returns the number of objects that match the condition.
95
96       Throws an exception on error, typically directly from the DBI layer.
97
98       new
99
100       TO BE COMPLETED
101
102       The "new" constructor is used to create a new abstract object that is
103       not (yet) written to the database.
104
105       Returns a new Padre::DB::History object.
106
107       create
108
109         my $object = Padre::DB::History->create(
110
111             id => 'value',
112
113             type => 'value',
114
115             name => 'value',
116
117         );
118
119       The "create" constructor is a one-step combination of "new" and
120       "insert" that takes the column parameters, creates a new
121       Padre::DB::History object, inserts the appropriate row into the history
122       table, and then returns the object.
123
124       If the primary key column "id" is not provided to the constructor (or
125       it is false) the object returned will have "id" set to the new unique
126       identifier.
127
128       Returns a new history object, or throws an exception on error,
129       typically from the DBI layer.
130
131       insert
132
133         $object->insert;
134
135       The "insert" method commits a new object (created with the "new"
136       method) into the database.
137
138       If a the primary key column "id" is not provided to the constructor (or
139       it is false) the object returned will have "id" set to the new unique
140       identifier.
141
142       Returns the object itself as a convenience, or throws an exception on
143       error, typically from the DBI layer.
144
145       delete
146
147         # Delete a single instantiated object
148         $object->delete;
149
150         # Delete multiple rows from the history table
151         Padre::DB::History->delete('where id > ?', 1000);
152
153       The "delete" method can be used in a class form and an instance form.
154
155       When used on an existing Padre::DB::History instance, the "delete"
156       method removes that specific instance from the "history", leaving the
157       object intact for you to deal with post-delete actions as you wish.
158
159       When used as a class method, it takes a compulsory argument of a SQL
160       phrase to be added after the "DELETE FROM history" section of the
161       query, followed by variables to be bound to the placeholders in the SQL
162       phrase. Any SQL that is compatible with SQLite can be used in the
163       parameter.
164
165       Returns true on success or throws an exception on error, or if you
166       attempt to call delete without a SQL condition phrase.
167
168       truncate
169
170         # Delete all records in the history table
171         Padre::DB::History->truncate;
172
173       To prevent the common and extremely dangerous error case where deletion
174       is called accidentally without providing a condition, the use of the
175       "delete" method without a specific condition is forbidden.
176
177       Instead, the distinct method "truncate" is provided to delete all
178       records in a table with specific intent.
179
180       Returns true, or throws an exception on error.
181
182   Accessors
183       id
184
185         if ( $object->id ) {
186             print "Object has been inserted\n";
187         } else {
188             print "Object has not been inserted\n";
189         }
190
191       Returns true, or throws an exception on error.
192
193         REMAINING ACCESSORS TO BE COMPLETED
194
195   SQL
196       The history table was originally created with the following SQL
197       command.
198
199         CREATE TABLE history (id INTEGER PRIMARY KEY, type VARCHAR(100), name VARCHAR(100))
200

SUPPORT

202       Padre::DB::History is part of the Padre::DB API.
203
204       See the documentation for Padre::DB for more information.
205

AUTHOR

207       Adam Kennedy
208
210       Copyright 2008-2010 The Padre development team as listed in Padre.pm.
211
212       This program is free software; you can redistribute it and/or modify it
213       under the same terms as Perl itself.
214
215       The full text of the license can be found in the LICENSE file included
216       with this module.
217
218
219
220perl v5.12.1                      2010-06-11             Padre::DB::History(3)
Impressum