| 7 |
############################################ |
############################################ |
| 8 |
# |
# |
| 9 |
# $Log$ |
# $Log$ |
| 10 |
|
# Revision 1.12 2002/12/12 02:50:15 joko |
| 11 |
|
# + this now (unfortunately) needs DBI for some helper functions |
| 12 |
|
# + TODO: these have to be refactored to another scope! (soon!) |
| 13 |
|
# |
| 14 |
|
# Revision 1.11 2002/12/11 06:53:19 joko |
| 15 |
|
# + updated pod |
| 16 |
|
# |
| 17 |
|
# Revision 1.10 2002/12/07 03:37:23 joko |
| 18 |
|
# + updated pod |
| 19 |
|
# |
| 20 |
# Revision 1.9 2002/12/01 22:15:45 joko |
# Revision 1.9 2002/12/01 22:15:45 joko |
| 21 |
# - sub createDb: moved to handler |
# - sub createDb: moved to handler |
| 22 |
# |
# |
| 60 |
|
|
| 61 |
=head1 NAME |
=head1 NAME |
| 62 |
|
|
| 63 |
Data::Storage - Interface for accessing various Storage implementations for Perl in an independent way |
Data::Storage - Interface for accessing various Storage implementations for Perl in an independent way |
| 64 |
|
|
| 65 |
|
|
| 66 |
=head1 AIMS |
=head1 AIMS |
| 174 |
|
|
| 175 |
=head2 NOTE |
=head2 NOTE |
| 176 |
|
|
| 177 |
This module heavily relies on DBI and Tangram, but adds a lot of additional bugs and quirks. |
This module heavily relies on DBI and Tangram, but adds a lot of additional bugs and quirks. |
| 178 |
Please look at their documentation and/or this code for additional information. |
Please look at their documentation and/or this code for additional information. |
| 179 |
|
|
| 180 |
|
|
| 181 |
=head1 REQUIREMENTS |
=head1 REQUIREMENTS |
| 203 |
use Data::Storage::Locator; |
use Data::Storage::Locator; |
| 204 |
use Data::Dumper; |
use Data::Dumper; |
| 205 |
|
|
| 206 |
|
# TODO: wipe out! |
| 207 |
|
use DBI; |
| 208 |
|
|
| 209 |
# TODO: actually implement level (integrate with Log::Dispatch) |
# TODO: actually implement level (integrate with Log::Dispatch) |
| 210 |
my $TRACELEVEL = 0; |
my $TRACELEVEL = 0; |
| 211 |
|
|
| 371 |
return $database_name; |
return $database_name; |
| 372 |
} |
} |
| 373 |
|
|
| 374 |
|
sub testAvailability { |
| 375 |
|
my $self = shift; |
| 376 |
|
my $status = $self->testDsn(); |
| 377 |
|
$self->{locator}->{status}->{available} = $status; |
| 378 |
|
return $status; |
| 379 |
|
} |
| 380 |
|
|
| 381 |
|
sub isConnected { |
| 382 |
|
my $self = shift; |
| 383 |
|
# TODO: REVIEW! |
| 384 |
|
return 1 if $self->{STORAGEHANDLE}; |
| 385 |
|
} |
| 386 |
|
|
| 387 |
sub testDsn { |
sub testDsn { |
| 388 |
my $self = shift; |
my $self = shift; |
| 389 |
my $dsn = $self->{locator}->{dbi}->{dsn}; |
my $dsn = $self->{locator}->{dbi}->{dsn}; |
| 401 |
} |
} |
| 402 |
} |
} |
| 403 |
|
|
|
sub testAvailability { |
|
|
my $self = shift; |
|
|
my $status = $self->testDsn(); |
|
|
$self->{locator}->{status}->{available} = $status; |
|
|
return $status; |
|
|
} |
|
|
|
|
|
|
|
| 404 |
sub dropDb { |
sub dropDb { |
| 405 |
my $self = shift; |
my $self = shift; |
| 406 |
my $dsn = $self->{locator}->{dbi}->{dsn}; |
my $dsn = $self->{locator}->{dbi}->{dsn}; |
| 428 |
return $ok; |
return $ok; |
| 429 |
} |
} |
| 430 |
|
|
|
sub isConnected { |
|
|
my $self = shift; |
|
|
return 1 if $self->{STORAGEHANDLE}; |
|
|
} |
|
|
|
|
| 431 |
1; |
1; |
| 432 |
__END__ |
__END__ |
| 433 |
|
|
| 434 |
|
|
| 435 |
=head1 DESCRIPTION |
=head1 DESCRIPTION |
| 436 |
|
|
| 437 |
Data::Storage is a module for accessing various "data structures" stored inside |
=head2 Data::Storage |
|
various "data containers". It sits on top of DBI and/or Tangram. |
|
| 438 |
|
|
| 439 |
|
Data::Storage is a module for accessing various "data structures / kinds of structured data" stored inside |
| 440 |
|
various "data containers". |
| 441 |
|
We tried to use the AdapterPattern (http://c2.com/cgi/wiki?AdapterPattern) to implement a wrapper-layer |
| 442 |
|
around core CPAN modules (Tangram, DBI). |
| 443 |
|
|
| 444 |
|
=head2 Why? |
| 445 |
|
|
| 446 |
|
You will get a better code-structure (not bad for later maintenance) in growing Perl code projects, |
| 447 |
|
especially when using multiple database connections at the same time. |
| 448 |
|
You will be able to switch between different _kinds_ of implementations used for storing data. |
| 449 |
|
Your code will use the very same API to access these storage layers. |
| 450 |
|
... implementation has to be changed for now |
| 451 |
|
Maybe you will be able to switch "on-the-fly" without changing any bits in code in the future.... |
| 452 |
|
... but that's not the focus |
| 453 |
|
|
| 454 |
=head1 AUTHORS / COPYRIGHT |
=head2 What else? |
| 455 |
|
|
| 456 |
The Data::Storage module is Copyright (c) 2002 Andreas Motl. |
Having this, we were able to do implement a generic data synchronization module more easy, |
| 457 |
All rights reserved. |
please look at Data::Transfer. |
| 458 |
|
|
| 459 |
You may distribute it under the terms of either the GNU General Public |
|
| 460 |
License or the Artistic License, as specified in the Perl README file. |
=head1 AUTHORS / COPYRIGHT |
| 461 |
|
|
| 462 |
|
The Data::Storage module is Copyright (c) 2002 Andreas Motl. |
| 463 |
|
All rights reserved. |
| 464 |
|
You may distribute it under the terms of either the GNU General Public |
| 465 |
|
License or the Artistic License, as specified in the Perl README file. |
| 466 |
|
|
| 467 |
|
|
| 468 |
=head1 ACKNOWLEDGEMENTS |
=head1 ACKNOWLEDGEMENTS |
| 469 |
|
|
| 470 |
Larry Wall for Perl, Tim Bunce for DBI, Jean-Louis Leroy for Tangram and Set::Object, |
Larry Wall for Perl, Tim Bunce for DBI, Jean-Louis Leroy for Tangram and Set::Object, |
| 471 |
Sam Vilain for Class::Tangram, Jochen Wiedmann and Jeff Zucker for DBD::CSV and related, |
Sam Vilain for Class::Tangram, Jochen Wiedmann and Jeff Zucker for DBD::CSV & Co., |
| 472 |
Adam Spiers for MySQL::Diff and all contributors. |
Adam Spiers for MySQL::Diff and all contributors. |
| 473 |
|
|
| 474 |
|
|
| 475 |
=head1 SUPPORT / WARRANTY |
=head1 SUPPORT / WARRANTY |
| 476 |
|
|
| 477 |
Data::Storage is free software. IT COMES WITHOUT WARRANTY OF ANY KIND. |
Data::Storage is free software. IT COMES WITHOUT WARRANTY OF ANY KIND. |
| 478 |
|
|
| 479 |
|
|
| 480 |
=head1 TODO |
=head1 TODO |
| 545 |
- .pst - files (Outlook Post Storage?) |
- .pst - files (Outlook Post Storage?) |
| 546 |
- XML (e.g. via XML::Simple?) |
- XML (e.g. via XML::Simple?) |
| 547 |
- Move to t3, look at InCASE |
- Move to t3, look at InCASE |
| 548 |
|
- some kind of security layer for methods/objects |
| 549 |
|
- acls (stored via tangram/ldap?) for functions, methods and objects (entity- & data!?) |
| 550 |
|
- where are the hooks needed then? |
| 551 |
|
- is Data::Storage & Co. okay, or do we have to touch the innards of DBI and/or Tangram? |
| 552 |
|
- an attempt to start could be: |
| 553 |
|
- 'sub getACLByObjectId($id, $context)' |
| 554 |
|
- 'sub getACLByMethodname($id, $context)' |
| 555 |
|
- 'sub getACLByName($id, $context)' |
| 556 |
|
( would require a kinda registry to look up these very names pointing to arbitrary locations (code, data, ...) ) |
| 557 |
|
|
| 558 |
|
|
| 559 |
|
|
| 560 |
=head3 LINKS / REFERENCES |
=head3 LINKS / REFERENCES |