Changeset 17024 for lang/actionscript
- Timestamp:
- 08/03/08 21:38:59 (4 months ago)
- Location:
- lang/actionscript/todoshare
- Files:
-
- 4 added
- 5 modified
- 1 moved
-
CodeDbTest.cgi (added)
-
backupDB.cgi (modified) (1 diff)
-
bin-debug/TodoShare.swf (modified) (previous)
-
bin-debug/db (added)
-
bin-debug/test/ajaxButtonTest.html (added)
-
bin-debug/test/db.sql (added)
-
db/db.sql (moved) (moved from lang/actionscript/todoshare/test/db.sql) (1 diff)
-
jsonDB.html (modified) (2 diffs)
-
perl/JSON2.pm (modified) (1 diff)
-
perl/Obj.pm (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/actionscript/todoshare/backupDB.cgi
r16062 r17024 17 17 my $e=shift; 18 18 print " "; 19 print toJSON(["MAKEREL",$e->{obj},$e->{name},$e->{val} ]);19 print toJSON(["MAKEREL",$e->{obj},$e->{name},$e->{val},$e->{t},$e->{role}]); 20 20 print ",\n"; 21 21 }); -
lang/actionscript/todoshare/db/db.sql
r16697 r17024 16 16 val varchar(255), 17 17 t varchar(32), 18 role varchar(32) 18 role varchar(32), 19 19 ); 20 20 21 create table relation_arcl ( 22 obj varchar(255), 23 name varchar(255), 24 val varchar(255), 25 t varchar(32), 26 role varchar(32), 27 ); 21 28 22 29 -
lang/actionscript/todoshare/jsonDB.html
r16711 r17024 6 6 function exe() { 7 7 var cmd=$("cmd").value; 8 $("res").value="Sending.."; 8 9 //alert(cmd); 9 10 new Ajax.Request("db.cgi", { … … 33 34 }] 34 35 </textarea> 35 <button onclick="exe();return false;" onsubmit="return false;">AJax</button> 36 <input type=submit> 36 <button onclick="exe();return false;" onsubmit="return false;">=></button> 37 37 <textarea rows=10 cols=40 id=res></textarea> 38 38 </form> 39 39 <BR> 40 40 <textarea rows=10 cols=40 name=cmd> 41 ["DELREL","ねこ","色","三毛"] 42 ["SELARCHIVE",["PROGN"],["FINDREL","猫","色","三毛"]] 41 43 ["DELREL","obj://gorira","type","animal"] 42 44 ["GET",{ "from":"relation", -
lang/actionscript/todoshare/perl/JSON2.pm
r16016 r17024 15 15 sub fromJSON { 16 16 my $j=shift; 17 #my $json=new JSON(); 17 JSON->new->utf8(1)->decode($j); 18 #my $json=new JSON()->utf8(0); 18 19 #$json->decode($j); 19 decode_json($j);20 #decode_json($j); 20 21 } 21 22 -
lang/actionscript/todoshare/perl/Obj.pm
r16772 r17024 35 35 } else {$prefix="";} 36 36 $prefix. time ; 37 } 38 sub setUTF { 39 my $href=shift; 40 for (values %$href) { 41 utf8::decode($_); 42 } 37 43 } 38 44 sub exe { … … 58 64 for (my $i=0; $i<$num_rows; $i++) { 59 65 my $a = $sth->fetchrow_hashref; 66 &setUTF($a); 60 67 $a->{_class}=$data->{from}; 61 68 push @{$res}, $a; … … 257 264 for (my $i=0; $i<$num_rows; $i++) { 258 265 my $a = $sth->fetchrow_hashref; 266 &setUTF($a); 259 267 push @{$res}, $a; 260 268 } … … 320 328 for (my $i=0; $i<$num_rows; $i++) { 321 329 my $a = $sth->fetchrow_hashref; 330 &setUTF($a); 322 331 push @{$res}, $a; 323 332 } … … 340 349 return ["EXISTS"]; 341 350 } 351 #my $t=$cmd->[4]; 352 #my $role= 342 353 return &exe(["INSERT",$relName, { 343 354 obj => $cmd->[1], … … 349 360 } elsif ($cmd->[0] eq 'DELREL') { 350 361 # ["DELREL" , obj, name, val] 362 my $backupQ=["FINDREL",$cmd->[1],$cmd->[2],$cmd->[3]]; 363 my $res=&exe($backupQ); 364 return ["SELARCHIVE", 365 ["PROGN", 366 map ["MAKEREL",$_->{obj},$_->{name},$_->{val},$_->{t},$_->{role}], 367 @$res 368 ], 369 $backupQ 370 ]; 351 371 my $where={}; 352 372 $where->{obj} = $cmd->[1]; 353 $where->{name}= $cmd->[2] ;354 $where->{val} = $cmd->[3] ;373 $where->{name}= $cmd->[2] if ($cmd->[2] and not &isAny($cmd->[2])); 374 $where->{val} = $cmd->[3] if ($cmd->[2] and not &isAny($cmd->[3])); 355 375 $where->{role}=&Session::getRole; 356 376 return &exe(["DELETE",$relName,$where]); … … 463 483 sub log { 464 484 my ($cmd,$query)=@_; 465 print STDERR "\n$query";485 print STDERR ("\n$query utfFlg=".utf8::is_utf8($query)); 466 486 push @logBuf,$query; 467 487 } … … 469 489 join "\n",@logBuf; 470 490 } 471 491 sub doQuery { 492 my $query=shift; 493 my $sth = $db->prepare($query); 494 my $eres=$sth->execute; 495 my $res; 496 if (!$eres) { 497 $res=["Fail",$query,$sth->errstr]; 498 } else { 499 my $num_rows = $sth->rows; 500 $res=[]; 501 for (my $i=0; $i<$num_rows; $i++) { 502 my $a = $sth->fetchrow_hashref; 503 push @{$res}, $a; 504 } 505 } 506 $sth->finish; 507 return array($res); 508 } 472 509 473 510 1;
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)