1ORLite::Mirror(3) User Contributed Perl Documentation ORLite::Mirror(3)
2
3
4
6 ORLite::Mirror - Extend ORLite to support remote SQLite databases
7
9 # Regular ORLite on a readonly SQLite database
10 use ORLite 'path/mydb.sqlite';
11
12 # The equivalent for a remote (optionally compressed) SQLite database
13 use ORLite::Mirror 'http://myserver/path/mydb.sqlite.gz';
14
15 # All available additional options specified
16 use ORLite::Mirror {
17 url => 'http://myserver/path/mydb.sqlite.gz',
18 maxage => 3600,
19 show_progress => 1,
20 env_proxy => 1,
21 prune => 1,
22 index => [
23 'table1.column1',
24 'table1.column2',
25 ],
26 };
27
29 ORLite provides a readonly ORM API when it loads a readonly SQLite
30 database from your local system.
31
32 By combining this capability with LWP, ORLite::Mirror goes one step
33 better and allows you to load a SQLite database from any arbitrary URI
34 in readonly form as well.
35
36 As demonstrated in the synopsis above, you using ORLite::Mirror in the
37 same way, but provide a URL instead of a file name.
38
39 If the URL explicitly ends with a '.gz' or '.bz2' then ORLite::Mirror
40 will decompress the file before loading it.
41
43 ORLite::Mirror adds an extensive set of options to those provided by
44 the underlying ORLite library.
45
46 url
47 The compulsory "url" parameter should be a string containing the remote
48 location of the SQLite database we will be mirroring.
49
50 ORLite::Mirror supports downloading the database compressed, and then
51 transparently decompressing the file locally. Compression support is
52 controlled by the extension on the remote database.
53
54 The extensions ".gz" (for gunzip) and ".bz2" (for bunzip2) are
55 currently supported.
56
57 maxage
58 The optional "maxage" parameter controls how often ORLite::Mirror
59 should check the remote server to see if the data has been updated.
60
61 This allows programs using the database to start quickly the majority
62 of the time, but continue to receive automatic updates periodically.
63
64 The value is the number of integer seconds we should avoid checking the
65 remote server for. The default is 86400 seconds (one 24 hour day).
66
67 show_progress
68 The optional "show_progress" parameter will be passed through to the
69 underlying LWP::UserAgent that will fetch the remote database file.
70
71 When set to true, it causes a progress bar to be displayed on the
72 terminal as the database file is downloaded.
73
74 env_proxy
75 The optional "env_proxy" parameter will be passed through to the
76 underlying LWP::UserAgent that will fetch the remote database file.
77
78 When set to true, it causes LWP::UserAgent to read the location of a
79 proxy server from the environment.
80
81 prune
82 The optional "prune" parameter should be used when the surrounding
83 program wants to avoid leaving files on the host system.
84
85 It causes any files or directories created during the operation of
86 ORLite::Mirror to be deleted on program exit at "END"-time.
87
88 index
89 One challenge when distributing SQLite database is the quantity of data
90 store on disk to support the indexes on your database.
91
92 For a moderately indexed database where all primary and foreign key
93 columns have indexes, the amount of data in the indexes can be nearly
94 as large as the data stored for the tables themselves.
95
96 Because each user of the database module will be interested in
97 different things, the indexes that the original creator chooses to
98 place on the database may not even be used at all and other valuable
99 indexes may not exist at all.
100
101 To allow sufficiently flexibility, we recommend that SQLite database be
102 distributed without any indexes. This greatly reduces the file size and
103 download time for the database file.
104
105 The optional "index" parameter should then be used by each different
106 consumer of that module to index just the columns that are of specific
107 interest and will be used in the queries that will be run on the
108 database.
109
110 The value should be set to an "ARRAY" reference containing a list of
111 column names in "tablename.columnname" form.
112
113 index => [
114 'table1.column1',
115 'table1.column2',
116 ],
117
119 Bugs should be reported via the CPAN bug tracker at
120
121 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ORLite-Mirror>
122
123 For other issues, contact the author.
124
126 Adam Kennedy <adamk@cpan.org>
127
129 Copyright 2008 - 2012 Adam Kennedy.
130
131 This program is free software; you can redistribute it and/or modify it
132 under the same terms as Perl itself.
133
134 The full text of the license can be found in the LICENSE file included
135 with this module.
136
137
138
139perl v5.36.0 2022-07-22 ORLite::Mirror(3)