1Padre::DB::Bookmark(3)User Contributed Perl DocumentationPadre::DB::Bookmark(3)
2
3
4
6 Padre::DB::Bookmark - Padre::DB class for the bookmark table
7
9 TO BE COMPLETED
10
12 TO BE COMPLETED
13
15 Methods
16 select
17
18 # Get all objects in list context
19 my @list = Padre::DB::Bookmark->select;
20
21 # Get a subset of objects in scalar context
22 my $array_ref = Padre::DB::Bookmark->select(
23 'where name > ? order by name',
24 1000,
25 );
26
27 The "select" method executes a typical SQL "SELECT" query on the
28 bookmark table.
29
30 It takes an optional argument of a SQL phrase to be added after the
31 "FROM bookmark" section of the query, followed by variables to be bound
32 to the placeholders in the SQL phrase. Any SQL that is compatible with
33 SQLite can be used in the parameter.
34
35 Returns a list of Padre::DB::Bookmark objects when called in list
36 context, or a reference to an ARRAY of Padre::DB::Bookmark objects when
37 called in scalar context.
38
39 Throws an exception on error, typically directly from the DBI layer.
40
41 count
42
43 # How many objects are in the table
44 my $rows = Padre::DB::Bookmark->count;
45
46 # How many objects
47 my $small = Padre::DB::Bookmark->count(
48 'where name > ?',
49 1000,
50 );
51
52 The "count" method executes a "SELECT COUNT(*)" query on the bookmark
53 table.
54
55 It takes an optional argument of a SQL phrase to be added after the
56 "FROM bookmark" section of the query, followed by variables to be bound
57 to the placeholders in the SQL phrase. Any SQL that is compatible with
58 SQLite can be used in the parameter.
59
60 Returns the number of objects that match the condition.
61
62 Throws an exception on error, typically directly from the DBI layer.
63
64 new
65
66 TO BE COMPLETED
67
68 The "new" constructor is used to create a new abstract object that is
69 not (yet) written to the database.
70
71 Returns a new Padre::DB::Bookmark object.
72
73 create
74
75 my $object = Padre::DB::Bookmark->create(
76
77 name => 'value',
78
79 file => 'value',
80
81 line => 'value',
82
83 );
84
85 The "create" constructor is a one-step combination of "new" and
86 "insert" that takes the column parameters, creates a new
87 Padre::DB::Bookmark object, inserts the appropriate row into the
88 bookmark table, and then returns the object.
89
90 If the primary key column "name" is not provided to the constructor (or
91 it is false) the object returned will have "name" set to the new unique
92 identifier.
93
94 Returns a new bookmark object, or throws an exception on error,
95 typically from the DBI layer.
96
97 insert
98
99 $object->insert;
100
101 The "insert" method commits a new object (created with the "new"
102 method) into the database.
103
104 If a the primary key column "name" is not provided to the constructor
105 (or it is false) the object returned will have "name" set to the new
106 unique identifier.
107
108 Returns the object itself as a convenience, or throws an exception on
109 error, typically from the DBI layer.
110
111 delete
112
113 # Delete a single instantiated object
114 $object->delete;
115
116 # Delete multiple rows from the bookmark table
117 Padre::DB::Bookmark->delete('where name > ?', 1000);
118
119 The "delete" method can be used in a class form and an instance form.
120
121 When used on an existing Padre::DB::Bookmark instance, the "delete"
122 method removes that specific instance from the "bookmark", leaving the
123 object intact for you to deal with post-delete actions as you wish.
124
125 When used as a class method, it takes a compulsory argument of a SQL
126 phrase to be added after the "DELETE FROM bookmark" section of the
127 query, followed by variables to be bound to the placeholders in the SQL
128 phrase. Any SQL that is compatible with SQLite can be used in the
129 parameter.
130
131 Returns true on success or throws an exception on error, or if you
132 attempt to call delete without a SQL condition phrase.
133
134 truncate
135
136 # Delete all records in the bookmark table
137 Padre::DB::Bookmark->truncate;
138
139 To prevent the common and extremely dangerous error case where deletion
140 is called accidentally without providing a condition, the use of the
141 "delete" method without a specific condition is forbidden.
142
143 Instead, the distinct method "truncate" is provided to delete all
144 records in a table with specific intent.
145
146 Returns true, or throws an exception on error.
147
148 Accessors
149 name
150
151 if ( $object->name ) {
152 print "Object has been inserted\n";
153 } else {
154 print "Object has not been inserted\n";
155 }
156
157 Returns true, or throws an exception on error.
158
159 REMAINING ACCESSORS TO BE COMPLETED
160
161 SQL
162 The bookmark table was originally created with the following SQL
163 command.
164
165 CREATE TABLE bookmark (
166 name VARCHAR(255) NOT NULL PRIMARY KEY,
167 file VARCHAR(255) NOT NULL,
168 line INTEGER NOT NULL
169 )
170
172 Padre::DB::Bookmark is part of the Padre::DB API.
173
174 See the documentation for Padre::DB for more information.
175
177 Adam Kennedy
178
180 Copyright 2008-2010 The Padre development team as listed in Padre.pm.
181
182 This program is free software; you can redistribute it and/or modify it
183 under the same terms as Perl itself.
184
185 The full text of the license can be found in the LICENSE file included
186 with this module.
187
188
189
190perl v5.12.1 2010-06-11 Padre::DB::Bookmark(3)