root/lang/javascript/nohada/jsonDB.html

Revision 26686, 1.9 kB (checked in by hoge1e3, 5 years ago)
  • Property svn:mime-type set to text/html; charset=utf-8
Line 
1<html>
2<meta http-equiv="Content-type" content="text/html; charset=utf-8">
3<title>Database Console</title>
4<script src="js/prototype.js"></script>
5<script>
6function exe() {
7   var cmd=$("cmd").value;
8   $("res").value="Sending..";
9   //alert(cmd);
10   new Ajax.Request("index.cgi", {
11                method: "put",
12                parameters: 'cmd='+encodeURIComponent(cmd) ,
13                onSuccess:function(httpObj){
14                   //alert(httpObj);
15                   //alert(httpObj.responseText);
16                   $("res").value=httpObj.responseText;
17                   lastResult=httpObj.responseText.evalJSON(  );
18                   
19                },
20                onFailure:function(httpObj) {
21                   $("res").value=httpObj.responseText;
22                }
23   });
24}
25function ev() {
26   ans=eval($("cmd").value);
27   $("cmd").value=Object.toJSON(ans);
28}
29</script>
30<body>
31
32<!--form action="db.cgi" method="POST"-->
33<textarea rows=10 cols=40 id=cmd>
34["GET3",{
35   "id":["*"],
36   "category":["*"],
37   "content":["like","%る%"]
38}]
39</textarea>
40<button onclick="ev();return false;" onsubmit="return false;">&lt;=Eval</button>
41<button onclick="exe();return false;" onsubmit="return false;">=&gt;</button>
42<textarea rows=10 cols=40 id=res></textarea><BR>
43※変数 lastResult= 最後のクエリ結果<BR>
44※変数 ans= 最後のEval結果<BR>
45<!--/form-->
46<BR>
47<textarea rows=10 cols=40 name=cmd>
48["GET3",{
49   "id":["*"],
50   "category":["*"],
51   "content":["like","%る%"]
52}]
53["MAKEREL","りんご","色","赤"]
54["DELREL","ねこ","色","三毛"]
55["INSERT3",
56  {"strength":"1", "category":"animal", "content":"ごりら"}
57]
58["DELETE3","obj://gorira"]
59["DELREL","obj://gorira","type","animal"]
60["FINDREL","りんご",["*"],["*"]]
61["PROGN",["MAKEREL","りんご","色","赤"],["DELREL","ねこ","色","三毛"]]
62//---not implemented
63["SELARCHIVE",["PROGN"],["FINDREL","猫","色","三毛"]]
64//----depricated
65["INSERT2","obj://gorira",
66  {"strength":"1", "type":"animal"}
67]
68["GET2",["content"],
69       {"content":["like","%る%"]}
70]
71</textarea></br>
72</body></html>
Note: See TracBrowser for help on using the browser.