2012-02-10 20:30:38 +01:00
|
|
|
#
|
2012-02-10 20:13:09 +01:00
|
|
|
# Perl module for note
|
2012-02-10 20:24:51 +01:00
|
|
|
# mysql database backend. see docu: perldoc NOTEDB::mysql
|
2012-02-10 20:13:09 +01:00
|
|
|
#
|
|
|
|
|
|
2012-02-10 20:12:25 +01:00
|
|
|
|
2012-02-10 20:30:38 +01:00
|
|
|
package NOTEDB::mysql;
|
2012-02-10 20:12:25 +01:00
|
|
|
|
2012-02-10 20:31:48 +01:00
|
|
|
$NOTEDB::mysql::VERSION = "1.51";
|
2012-02-10 20:12:25 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
use DBI;
|
|
|
|
|
use strict;
|
2012-02-10 20:30:38 +01:00
|
|
|
#use Data::Dumper;
|
2012-02-10 20:24:51 +01:00
|
|
|
use NOTEDB;
|
2012-02-10 20:12:25 +01:00
|
|
|
|
2012-02-10 20:30:38 +01:00
|
|
|
use Exporter ();
|
|
|
|
|
use vars qw(@ISA @EXPORT);
|
|
|
|
|
@ISA = qw(NOTEDB Exporter);
|
|
|
|
|
|
2012-02-10 20:12:25 +01:00
|
|
|
|
|
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
|
2012-02-10 20:30:38 +01:00
|
|
|
sub new {
|
|
|
|
|
my($this, %param) = @_;
|
2012-02-10 20:24:51 +01:00
|
|
|
|
|
|
|
|
my $class = ref($this) || $this;
|
|
|
|
|
my $self = {};
|
|
|
|
|
bless($self,$class);
|
|
|
|
|
|
2012-02-10 20:30:38 +01:00
|
|
|
my $dbname = $param{dbname} || "note";
|
|
|
|
|
my $dbhost = $param{dbhost} || "localhost";
|
|
|
|
|
my $dbuser = $param{dbuser} || "";
|
|
|
|
|
my $dbpasswd = $param{dbpasswd} || "";
|
|
|
|
|
my $dbport = $param{dbport} || "";
|
|
|
|
|
my $fnum = "number";
|
|
|
|
|
my $fnote = "note";
|
|
|
|
|
my $fdate = "date";
|
2012-02-10 20:31:48 +01:00
|
|
|
my $ftopic = "topic";
|
2012-02-10 20:30:38 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
my $database;
|
|
|
|
|
if ($dbport) {
|
2012-02-10 20:31:48 +01:00
|
|
|
$database = "DBI:mysql:$dbname;host=$dbhost:$dbport";
|
2012-02-10 20:24:51 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2012-02-10 20:31:48 +01:00
|
|
|
$database = "DBI:mysql:$dbname;host=$dbhost";
|
2012-02-10 20:24:51 +01:00
|
|
|
}
|
|
|
|
|
|
2012-02-10 20:31:48 +01:00
|
|
|
$self->{table} = "note";
|
2012-02-10 20:24:51 +01:00
|
|
|
|
2012-02-10 20:31:48 +01:00
|
|
|
$self->{sql_getsingle} = "SELECT $fnote,$fdate,$ftopic FROM $self->{table} WHERE $fnum = ?";
|
|
|
|
|
$self->{sql_all} = "SELECT $fnum,$fnote,$fdate,$ftopic FROM $self->{table}";
|
2012-02-10 20:24:51 +01:00
|
|
|
$self->{sql_nextnum} = "SELECT max($fnum) FROM $self->{table}";
|
|
|
|
|
$self->{sql_incrnum} = "SELECT $fnum FROM $self->{table} ORDER BY $fnum";
|
|
|
|
|
$self->{sql_setnum} = "UPDATE $self->{table} SET $fnum = ? WHERE $fnum = ?";
|
2012-02-10 20:31:48 +01:00
|
|
|
$self->{sql_edit} = "UPDATE $self->{table} SET $fnote = ?, $fdate = ?, $ftopic = ? WHERE $fnum = ?";
|
|
|
|
|
$self->{sql_insertnew} = "INSERT INTO $self->{table} VALUES (?, ?, ?, ?)";
|
2012-02-10 20:24:51 +01:00
|
|
|
$self->{sql_del} = "DELETE FROM $self->{table} WHERE $fnum = ?";
|
|
|
|
|
$self->{sql_del_all} = "DELETE FROM $self->{table}";
|
|
|
|
|
|
|
|
|
|
$self->{DB} = DBI->connect($database, $dbuser, $dbpasswd) or die DBI->errstr();
|
|
|
|
|
|
|
|
|
|
return $self;
|
2012-02-10 20:12:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub DESTROY
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
# clean the desk!
|
|
|
|
|
my $this = shift;
|
|
|
|
|
$this->{DB}->disconnect;
|
2012-02-10 20:12:25 +01:00
|
|
|
}
|
|
|
|
|
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
|
|
|
|
|
sub lock {
|
2012-02-10 20:24:51 +01:00
|
|
|
my($this) = @_;
|
|
|
|
|
# LOCK the database!
|
|
|
|
|
my $lock = $this->{DB}->prepare("LOCK TABLES $this->{table} WRITE")
|
|
|
|
|
|| die $this->{DB}->errstr();
|
|
|
|
|
$lock->execute() || die $this->{DB}->errstr();
|
2012-02-10 20:12:25 +01:00
|
|
|
}
|
|
|
|
|
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
|
|
|
|
|
sub unlock {
|
2012-02-10 20:24:51 +01:00
|
|
|
my($this) = @_;
|
|
|
|
|
my $unlock = $this->{DB}->prepare("UNLOCK TABLES") || die $this->{DB}->errstr;
|
|
|
|
|
$unlock->execute() || die $this->{DB}->errstr();
|
2012-02-10 20:13:28 +01:00
|
|
|
}
|
|
|
|
|
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
|
|
|
|
|
sub version {
|
2012-02-10 20:24:51 +01:00
|
|
|
my $this = shift;
|
|
|
|
|
return $this->{version};
|
2012-02-10 20:13:28 +01:00
|
|
|
}
|
2012-02-10 20:12:25 +01:00
|
|
|
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
|
|
|
|
|
sub get_single {
|
2012-02-10 20:24:51 +01:00
|
|
|
my($this, $num) = @_;
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
|
2012-02-10 20:31:48 +01:00
|
|
|
my($note, $date, $topic);
|
2012-02-10 20:24:51 +01:00
|
|
|
my $statement = $this->{DB}->prepare($this->{sql_getsingle}) || die $this->{DB}->errstr();
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
$statement->execute($num) || die $this->{DB}->errstr();
|
2012-02-10 20:31:48 +01:00
|
|
|
$statement->bind_columns(undef, \($note, $date, $topic)) || die $this->{DB}->errstr();
|
2012-02-10 20:12:25 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
while($statement->fetch) {
|
2012-02-10 20:31:48 +01:00
|
|
|
$note = $this->ude($note);
|
|
|
|
|
if ($topic) {
|
|
|
|
|
$note = "$topic\n" . $note;
|
|
|
|
|
}
|
|
|
|
|
return $note, $this->ude($date);
|
2012-02-10 20:24:51 +01:00
|
|
|
}
|
2012-02-10 20:12:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub get_all
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my $this = shift;
|
2012-02-10 20:31:48 +01:00
|
|
|
my($num, $note, $date, %res, $topic);
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
if ($this->unchanged) {
|
|
|
|
|
return %{$this->{cache}};
|
|
|
|
|
}
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
my $statement = $this->{DB}->prepare($this->{sql_all}) or die $this->{DB}->errstr();
|
2012-02-10 20:12:25 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
$statement->execute or die $this->{DB}->errstr();
|
2012-02-10 20:31:48 +01:00
|
|
|
$statement->bind_columns(undef, \($num, $note, $date, $topic)) or die $this->{DB}->errstr();
|
2012-02-10 20:12:25 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
while($statement->fetch) {
|
|
|
|
|
$res{$num}->{'note'} = $this->ude($note);
|
|
|
|
|
$res{$num}->{'date'} = $this->ude($date);
|
2012-02-10 20:31:48 +01:00
|
|
|
if ($topic) {
|
|
|
|
|
$res{$num}->{'note'} = "$topic\n" . $res{$num}->{'note'};
|
|
|
|
|
}
|
2012-02-10 20:24:51 +01:00
|
|
|
}
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
$this->cache(%res);
|
|
|
|
|
return %res;
|
2012-02-10 20:12:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub get_nextnum
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my $this = shift;
|
|
|
|
|
my($num);
|
|
|
|
|
if ($this->unchanged) {
|
|
|
|
|
$num = 1;
|
|
|
|
|
foreach (keys %{$this->{cache}}) {
|
|
|
|
|
$num++;
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
}
|
2012-02-10 20:24:51 +01:00
|
|
|
return $num;
|
|
|
|
|
}
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
my $statement = $this->{DB}->prepare($this->{sql_nextnum}) || die $this->{DB}->errstr();
|
2012-02-10 20:12:25 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
$statement->execute || die $this->{DB}->errstr();
|
|
|
|
|
$statement->bind_columns(undef, \($num)) || die $this->{DB}->errstr();
|
2012-02-10 20:12:25 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
while($statement->fetch) {
|
|
|
|
|
return $num+1;
|
|
|
|
|
}
|
2012-02-10 20:12:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub get_search
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my($this, $searchstring) = @_;
|
2012-02-10 20:31:48 +01:00
|
|
|
my($num, $note, $date, %res, $match, $use_cache, $topic);
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
my $regex = $this->generate_search($searchstring);
|
|
|
|
|
eval $regex;
|
|
|
|
|
if ($@) {
|
|
|
|
|
print "invalid expression: \"$searchstring\"!\n";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$match = 0;
|
|
|
|
|
|
|
|
|
|
if ($this->unchanged) {
|
|
|
|
|
foreach my $num (keys %{$this->{cache}}) {
|
|
|
|
|
$_ = $this->{cache}{$num}->{note};
|
|
|
|
|
eval $regex;
|
|
|
|
|
if ($match) {
|
|
|
|
|
$res{$num}->{note} = $this->{cache}{$num}->{note};
|
|
|
|
|
$res{$num}->{date} = $this->{cache}{$num}->{date}
|
|
|
|
|
}
|
|
|
|
|
$match = 0;
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
}
|
2012-02-10 20:24:51 +01:00
|
|
|
return %res;
|
|
|
|
|
}
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
my $statement = $this->{DB}->prepare($this->{sql_all}) or die $this->{DB}->errstr();
|
|
|
|
|
|
|
|
|
|
$statement->execute or die $this->{DB}->errstr();
|
2012-02-10 20:31:48 +01:00
|
|
|
$statement->bind_columns(undef, \($num, $note, $date, $topic)) or die $this->{DB}->errstr();
|
2012-02-10 20:24:51 +01:00
|
|
|
|
|
|
|
|
while($statement->fetch) {
|
|
|
|
|
$note = $this->ude($note);
|
|
|
|
|
$date = $this->ude($date);
|
2012-02-10 20:31:48 +01:00
|
|
|
if ($topic) {
|
|
|
|
|
$note = "$topic\n" . $note;
|
|
|
|
|
}
|
2012-02-10 20:24:51 +01:00
|
|
|
$_ = $note;
|
|
|
|
|
eval $regex;
|
|
|
|
|
if($match) {
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
$res{$num}->{'note'} = $note;
|
|
|
|
|
$res{$num}->{'date'} = $date;
|
2012-02-10 20:12:25 +01:00
|
|
|
}
|
2012-02-10 20:24:51 +01:00
|
|
|
$match = 0;
|
|
|
|
|
}
|
|
|
|
|
return %res;
|
2012-02-10 20:12:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub set_edit
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my($this, $num, $note, $date) = @_;
|
|
|
|
|
|
|
|
|
|
$this->lock;
|
|
|
|
|
my $statement = $this->{DB}->prepare($this->{sql_edit}) or die $this->{DB}->errstr();
|
|
|
|
|
$note =~ s/'/\'/g;
|
|
|
|
|
$note =~ s/\\/\\\\/g;
|
|
|
|
|
$statement->execute($this->uen($note), $this->uen($date), $num)
|
|
|
|
|
or die $this->{DB}->errstr();
|
|
|
|
|
$this->unlock;
|
|
|
|
|
$this->changed;
|
2012-02-10 20:12:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub set_new
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my($this, $num, $note, $date) = @_;
|
|
|
|
|
$this->lock;
|
|
|
|
|
my $statement = $this->{DB}->prepare($this->{sql_insertnew}) || die $this->{DB}->errstr();
|
|
|
|
|
|
2012-02-10 20:31:48 +01:00
|
|
|
my ($topic, $note) = $this->get_topic($note);
|
|
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
$note =~ s/'/\'/g;
|
|
|
|
|
$note =~ s/\\/\\\\/g;
|
2012-02-10 20:31:48 +01:00
|
|
|
$topic =~ s/\\/\\\\/g;
|
|
|
|
|
$statement->execute($num, $this->uen($note), $this->uen($date), $topic) || die $this->{DB}->errstr();
|
2012-02-10 20:24:51 +01:00
|
|
|
$this->unlock;
|
|
|
|
|
$this->changed;
|
2012-02-10 20:12:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub set_del
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my($this, $num) = @_;
|
|
|
|
|
my($note, $date, $T);
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
$this->lock;
|
|
|
|
|
($note, $date) = $this->get_single($num);
|
2012-02-10 20:12:25 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
return "ERROR" if ($date !~ /^\d/);
|
2012-02-10 20:12:25 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
# delete record!
|
|
|
|
|
my $statement = $this->{DB}->prepare($this->{sql_del}) || die $this->{DB}->errstr();
|
|
|
|
|
$statement->execute($num) || die $this->{DB}->errstr();
|
|
|
|
|
$this->unlock;
|
|
|
|
|
$this->changed;
|
|
|
|
|
return;
|
2012-02-10 20:12:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-02-10 20:14:24 +01:00
|
|
|
sub set_del_all
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my($this) = @_;
|
|
|
|
|
$this->lock;
|
|
|
|
|
my $statement = $this->{DB}->prepare($this->{sql_del_all}) || die $this->{DB}->errstr();
|
|
|
|
|
$statement->execute() || die $this->{DB}->errstr();
|
|
|
|
|
$this->unlock;
|
|
|
|
|
$this->changed;
|
|
|
|
|
return;
|
2012-02-10 20:14:24 +01:00
|
|
|
}
|
|
|
|
|
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
sub set_recountnums {
|
2012-02-10 20:24:51 +01:00
|
|
|
my $this = shift;
|
|
|
|
|
|
|
|
|
|
$this->lock;
|
|
|
|
|
|
|
|
|
|
my(@count, $i, $num, $setnum, $pos);
|
|
|
|
|
$setnum = 1;
|
|
|
|
|
$pos=0; $i=0; @count = ();
|
|
|
|
|
|
|
|
|
|
my $statement = $this->{DB}->prepare($this->{sql_incrnum}) || die $this->{DB}->errstr();
|
|
|
|
|
$statement->execute || die $this->{DB}->errstr();
|
|
|
|
|
$statement->bind_columns(undef, \($num)) || die $this->{DB}->errstr();
|
|
|
|
|
# store real id's in an array!
|
|
|
|
|
while($statement->fetch) {
|
|
|
|
|
$count[$i] = $num;
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
# now recount them!
|
|
|
|
|
my $sub_statement = $this->{DB}->prepare($this->{sql_setnum}) || die $this->{DB}->errstr();
|
|
|
|
|
for($pos=0;$pos<$i;$pos++) {
|
|
|
|
|
$setnum = $pos +1;
|
|
|
|
|
$sub_statement->execute($setnum,$count[$pos]) || die $this->{DB}->errstr();
|
|
|
|
|
}
|
|
|
|
|
$this->unlock;
|
|
|
|
|
$this->changed;
|
2012-02-10 20:13:09 +01:00
|
|
|
}
|
2012-02-10 20:12:25 +01:00
|
|
|
|
2012-02-10 20:30:38 +01:00
|
|
|
sub import_data {
|
|
|
|
|
my ($this, $data) = @_;
|
|
|
|
|
foreach my $num (keys %{$data}) {
|
|
|
|
|
my $pos = $this->get_nextnum();
|
2012-02-10 20:31:48 +01:00
|
|
|
$this->set_new($pos, $data->{$num}->{note}, $data->{$num}->{date});
|
2012-02-10 20:30:38 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-10 20:13:28 +01:00
|
|
|
sub uen
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my $this = shift;
|
|
|
|
|
my($T);
|
|
|
|
|
if($NOTEDB::crypt_supported == 1) {
|
|
|
|
|
eval {
|
|
|
|
|
$T = pack("u", $this->{cipher}->encrypt($_[0]));
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$T = $_[0];
|
|
|
|
|
}
|
|
|
|
|
chomp $T;
|
|
|
|
|
return $T;
|
2012-02-10 20:13:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub ude
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my $this = shift;
|
|
|
|
|
my($T);
|
|
|
|
|
if($NOTEDB::crypt_supported == 1) {
|
|
|
|
|
eval {
|
|
|
|
|
$T = $this->{cipher}->decrypt(unpack("u",$_[0]))
|
|
|
|
|
};
|
|
|
|
|
return $T;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return $_[0];
|
|
|
|
|
}
|
2012-02-10 20:13:28 +01:00
|
|
|
}
|
|
|
|
|
|
2012-02-10 20:31:48 +01:00
|
|
|
sub get_topic {
|
|
|
|
|
my ($this, $data) = @_;
|
|
|
|
|
if ($data =~ /^\//) {
|
|
|
|
|
my($topic, $note) = split /\n/, $data, 2;
|
|
|
|
|
return ($topic, $note);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return ("", $data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-10 20:12:25 +01:00
|
|
|
1; # keep this!
|
|
|
|
|
|
|
|
|
|
__END__
|
|
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
|
|
NOTEDB::mysql - module lib for accessing a notedb from perl
|
|
|
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
|
|
# include the module
|
|
|
|
|
use NOTEDB;
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
|
2012-02-10 20:12:25 +01:00
|
|
|
# create a new NOTEDB object (the last 4 params are db table/field names)
|
|
|
|
|
$db = new NOTEDB("mysql","note","localhost","username","password","note","number","note","date");
|
|
|
|
|
|
|
|
|
|
# get a single note
|
|
|
|
|
($note, $date) = $db->get_single(1);
|
|
|
|
|
|
|
|
|
|
# search for a certain note
|
|
|
|
|
%matching_notes = $db->get_search("somewhat");
|
|
|
|
|
# format of returned hash:
|
|
|
|
|
#$matching_notes{$numberofnote}->{'note' => 'something', 'date' => '23.12.2000 10:33:02'}
|
|
|
|
|
|
|
|
|
|
# get all existing notes
|
|
|
|
|
%all_notes = $db->get_all();
|
|
|
|
|
# format of returnes hash like the one from get_search above
|
|
|
|
|
|
|
|
|
|
# get the next noteid available
|
|
|
|
|
$next_num = $db->get_nextnum();
|
|
|
|
|
|
|
|
|
|
# recount all noteids starting by 1 (usefull after deleting one!)
|
|
|
|
|
$db->set_recountnums();
|
|
|
|
|
|
|
|
|
|
# modify a certain note
|
|
|
|
|
$db->set_edit(1, "any text", "23.12.2000 10:33:02");
|
|
|
|
|
|
|
|
|
|
# create a new note
|
|
|
|
|
$db->set_new(5, "any new text", "23.12.2000 10:33:02");
|
|
|
|
|
|
|
|
|
|
# delete a certain note
|
|
|
|
|
$db->set_del(5);
|
|
|
|
|
|
2012-02-10 20:13:51 +01:00
|
|
|
# turn on encryption. CryptMethod must be IDEA, DES or BLOWFISH
|
|
|
|
|
$db->use_crypt("passphrase", "CryptMethod");
|
|
|
|
|
|
|
|
|
|
# turn off encryption. This is the default.
|
|
|
|
|
$db->no_crypt();
|
|
|
|
|
|
2012-02-10 20:12:25 +01:00
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
|
|
|
|
|
You can use this module for accessing a note database. There are currently
|
|
|
|
|
two versions of this module, one version for a SQL database and one for a
|
|
|
|
|
binary file (note's own database-format).
|
|
|
|
|
However, both versions provides identical interfaces, which means, you do
|
|
|
|
|
not need to change your code, if you want to switch to another database format.
|
|
|
|
|
|
|
|
|
|
Currently, NOTEDB module is only used by note itself. But feel free to use it
|
|
|
|
|
within your own project! Perhaps someone want to implement a webinterface to
|
|
|
|
|
note...
|
|
|
|
|
|
|
|
|
|
=head1 USAGE
|
|
|
|
|
|
|
|
|
|
please see the section SYNOPSIS, it says it all.
|
|
|
|
|
|
|
|
|
|
=head1 AUTHOR
|
|
|
|
|
|
|
|
|
|
Thomas Linden <tom@daemon.de>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=cut
|