today stuff around marc. Will change soon as we will use MARC::record (see marcpm...
[koha.git] / C4 / test.pl
1 #!/usr/bin/perl
2 use strict;
3 require Exporter;
4 use C4::Database;
5 use C4::Catalogue;
6
7 my $dbh=&C4Connect;
8 $dbh->do("delete from marc_subfield_table");
9 $dbh->do("delete from marc_blob_subfield");
10 &addSubfield(1,'001','a',1,'1 - This is a value');
11 &addSubfield(1,'001','b',1,'2 - This is another value');
12 &addSubfield(1,'001','c',1,"3 - This is a value very very long. I try to make it longer than 255 char. I need to add something else. will it be long enough now... I'm not sure. That's why i continue to add a few word to this very important sentence. Now I hope it will be enough... Oh, not it need some more characters. So i add stupid strings : xxxxxxxxxxxxxxx dddddddddddddddddddd eeeeeeeeeeeeeeeeeeeeeee rrrrrrrrrrrrrrrrrrr ffffffffffffffffff");
13 &addSubfield(1,'001','d',1,"4 - This is another value very very long. I try to make it longer than 255 char. I need to add something else. will it be long enough now... I'm not sure. That's why i continue to add a few word to this very important sentence. Now I hope it will be enough... Oh, not it need some more characters. So i add stupid strings : xxxxxxxxxxxxxxx dddddddddddddddddddd eeeeeeeeeeeeeeeeeeeeeee rrrrrrrrrrrrrrrrrrr ffffffffffffffffff");
14 print "change 1\n";
15 &changeSubfield(1,"1new - this is a changed value");
16 print "change 2\n";
17 &changeSubfield(2,"2new - go from short to long subfield... uuuuuuuuuuuuuuuuuuuuuuuu yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy tttttttttttttttttttttttttttttttt rrrrrrrrrrrrrrrrrrrrrr eeeeeeeeeeeeeeeeeeeeeeeee zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq ssssssssssssssssssssssssss ddddddddddddddddddddddddddddddd fffffffffffffffffffffffff ggggggggggggggggggggggggg hhhhhhhhhhhhhhhhhhhhhhhhhh jjjjjjjjjjjjjjjjjjjjjkkkkkkkkkkkkkkkkkkkkkkkk");
18 print "change 3\n";
19 &changeSubfield(3,"3new - go from long to short subfield...");
20 print "change 4\n";
21 &changeSubfield(4,"4new - stay with blob subfield...uuuuuuuuuuuuuuuuuuuuuuuu yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy tttttttttttttttttttttttttttttttt rrrrrrrrrrrrrrrrrrrrrr eeeeeeeeeeeeeeeeeeeeeeeee zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq ssssssssssssssssssssssssss ddddddddddddddddddddddddddddddd fffffffffffffffffffffffff ggggggggggggggggggggggggg hhhhhhhhhhhhhhhhhhhhhhhhhh jjjjjjjjjjjjjjjjjjjjjkkkkkkkkkkkkkkkkkkkkkkkk");
22 my $x= &findSubfield(1,'001','a','',1);
23 print "subfieldid : $x\n";
24 my $record={};
25 #$marcstru->{bibid}=58973; # calculated auto_increment in addMarcBiblio
26 $record->{bibid}=58973;
27 $record->{tags}->{110}->{1}->{indicator}='##';
28 $record->{tags}->{110}->{1}->{subfields}->{a}->{1}='first text';
29 $record->{tags}->{110}->{1}->{subfields}->{a}->{2}='second text';
30 $record->{tags}->{110}->{1}->{subfields}->{b}->{3}='third text';
31
32 $record->{tags}->{120}->{1}->{indicator}='##';
33 $record->{tags}->{120}->{1}->{subfields}->{a}->{1}='last text ??';
34
35 $record->{tags}->{120}->{2}->{indicator}='01';
36 $record->{tags}->{120}->{2}->{subfields}->{n}->{1}='no, another text';
37 print "NEXT IS : ".nextsubfieldid($record->{tags}->{110}->{1}->{subfields})."\n";
38
39 &addMarcBiblio($record);