| DBD-iPod documentation | Contained in the DBD-iPod distribution. |
DBD::iPod::dr - Database driver for the iPod
Don't use this class directly, See DBD::iPod.
This is the actual driver implementation that sets up the connection to the iPod. You don't need to use it directly.
Author <allenday@ucla.edu>
DBD::_::dr, Mac::iPod::GNUpod.
GPL
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a '_'. Methods are in alphabetical order for the most part.
Usage : DBI->connect('dbi:iPod:');
DBI->connect('dbi:iPod:/mnt/ipod'); #same as above
DBI->connect('dbi:iPod:/mnt/ipod2'); alternate mountpoint
Function: connect to the iPod and read the iTunesDB in it.
Returns : a DBI::db object
Args : DSN to be used for connection, See L<DBI>.
DBI.
This method does not flush buffered writes to the iPod, synchronize the iTunesDB, or anything else. It is a DBI method only.
DBI. Returns "iPod".
| DBD-iPod documentation | Contained in the DBD-iPod distribution. |
package DBD::iPod::dr; use strict; use base qw(DBD::_::dr); our $VERSION = '0.01'; our $REVISION = '0.01'; use vars qw($imp_data_size); use DBI; use Mac::iPod::GNUpod; $imp_data_size = 0;
sub connect { my ($drh, $dbname, $user, $pass, $attr) = @_; my ($dbh, $ipod); my(undef,undef,$path) = split ':', $dbname; $path ||= '/mnt/ipod'; $user ||= ''; $pass ||= ''; $dbh = DBI::_new_dbh($drh, { 'Name' => $dbname, 'USER' => $user, 'CURRENT_USER' => $user, 'Password' => $pass, }); # Create a Mac::iPod::GNUpod instance, and store it. We can reuse # this for multiple queries. $ipod = Mac::iPod::GNUpod->new(mountpoint => $path); $ipod->read_itunes(); $dbh->STORE('driver_ipod' => $ipod); return $dbh; }
sub disconnect_all { 1 }
sub data_sources { return "iPod" } 1; __END__