FIXED: There were many new bugs after my last changes *grrrrr*. fixed.

Works now properly, with both backends!
FIXED:          and another bug: recounting of numbers did not take care about
                the existing order! If you deleted note #12, then note #13 became
                not neccessarily #12! Instead it becames any other number (kind of
                randomly...).
CHANGED:        NOTEDB::binary set_del function changed, it does no more require
                a temporary file for number recount. Instead it uses get_all and
                stores all notes in RAM and then rewrites the database.
FIXED:          fixed the set_new call within note. It used 0 as the first param
                (number) which is not useful since we dont have support for auto-
                increment from all database backends.
FIXED:          fixed the function set_recountnum in NITEDB::mysql, it was also
                incorrect :-((( 0.8 seemed to be a very bad early alpha...........
FIXED:          there was a bug in NOTEDB::binary which caused not to recount note
                numbers after deleting one :-(
This commit is contained in:
TLINDEN
2012-02-10 20:13:09 +01:00
parent f54d187c47
commit c38665373c
7 changed files with 154 additions and 103 deletions

View File

@@ -1,7 +1,15 @@
#!/usr/bin/perl
# $Author: thomas $ $Id: note,v 1.13 2000/03/19 11:53:32 thomas Exp thomas $ $Revision: 1.13 $
# $Author: thomas $ $Id: note,v 1.15 2000/03/19 23:41:04 thomas Exp thomas $ $Revision: 1.15 $
#
# $Log: note,v $
# Revision 1.15 2000/03/19 23:41:04 thomas
# changed set_del, now no extra TEMP file is required!
# instead I get it from $this->get_all() !
#
# Revision 1.14 2000/03/19 22:51:49 thomas
# Bug in NOTEDB::binary fixed, recount of nubers was
# incorrect.
#
# Revision 1.13 2000/03/19 11:53:32 thomas
# edit bug fixed (ude => uen)
#
@@ -115,7 +123,7 @@ $TIME_COLOR = "black";
$TOPIC_COLOR = "BLACK";
$TOPIC = 1;
$TopicSep = '/';
$version = "0.8 r1.12";
$version = "0.9 r1.15";
if($TOPIC)
{
$CurDepth = 1; # the current depth inside the topic "directory" structure...
@@ -586,7 +594,7 @@ sub new
############################### DELETE ##################################
sub del
{
my($i,@count, $setnum, $pos, $ERR);
my($i,@count, $setnum, $pos, $ERR);
# delete a note
&num_bereich; # get @NumBlock from $number
foreach $_ (@NumBlock)
@@ -602,6 +610,8 @@ sub del
}
}
# recount the notenumbers:
$db->set_recountnums();
@NumBlock = ();
}
@@ -683,7 +693,7 @@ sub dump
sub import
{
my($num, $start, $complete, $dummi, $note, $date, $time);
my($num, $start, $complete, $dummi, $note, $date, $time, $number);
# open $dump_file and import it into the notedb
open (DUMP, "<$dump_file") or die "could not open $dump_file\n";
$complete=0;
@@ -702,7 +712,8 @@ sub import
else
{
# we got a complete record, save it!
$db->set_new(0,$note, $date);
$number = $db->get_nextnum();
$db->set_new($number,$note, $date);
print "note number $number from $dump_file inserted into notedb.\n";
$complete = 0;
$note = "";
@@ -724,7 +735,8 @@ sub import
if($note ne "" && $date ne "")
{
# the last record, if existent
$db->set_new(0,$note, $date);
$number = $db->get_nextnum();
$db->set_new($number,$note, $date);
print "note number $number from $dump_file inserted into notedb.\n";
}
}
@@ -1122,9 +1134,10 @@ sub ude
sub num_bereich
{
my($m,@LR,@Sorted_LR,$i);
# $number is the one we want to delete!
# $number is the one we want to delete!
# But does it contain kommas?
$m = 0;
@NumBlock = (); #reset
$m = 0;
if($number =~ /\,/)
{
# accept -d 3,4,7