この色 |
外部で使用可な関数(pxbaseクラスの関数) | |
この色 |
ユーティリティ関数(pxbaseクラスの関数では無い) | |
この色 |
内部で使用するサブ関数(pxbaseクラスの関数) | |
戻り値 | 関数名 | パラメーター |
---|---|---|
オブジェクト |
pxbase |
(String dbname,Connection con,String table) |
コンストラクタ。 データベース名、テーブル名をセットする。 データベース名はMySQL、PostgreSQLに対応。 例 String usr = \"postgres\"; String pwd = \"postgres\"; String table = \"testtable\"; String dbname = \"pxbasedb\"; String url = \"jdbc:postgresql://localhost/\"+dbname+\"?CaracterEncoding=utf8\"; Class.forName(\"org.postgresql.Driver\"); Connection db = DriverManager.getConnection(url, usr, pwd); pxbase base = new pxbase(\"PostgreSQL\",db,table); | ||
戻り値 | 関数名 | パラメーター |
ResultSet |
do_query |
(String sql,String func) |
SQL文を実行する。 失敗した場合はロールバックを行う。 select文以外はnullを返す。 例 ResultSet result = base.do_query(\"select * from \"+base.table+\",\"get_elements\"); | ||
戻り値 | 関数名 | パラメーター |
begin |
() | |
トランザクション処理の開始。 例 base.begin(); | ||
戻り値 | 関数名 | パラメーター |
commit |
() | |
トランザクション処理の終了。 例 base.commit(); | ||
戻り値 | 関数名 | パラメーター |
lock |
() | |
テーブルをwrite Lock(MySQL)する。 テーブルをshare row exclusive Lock(PostgeSQL)する。 例 base.lock(); | ||
戻り値 | 関数名 | パラメーター |
unlock |
() | |
テーブルロックを解除する(MySQL)。 例 base.unlock(); | ||
戻り値 | 関数名 | パラメーター |
int(num) |
num_rows |
(ResultSet result) |
ResultSetの行数を返す。 これを実行するとResultSetの最終行にカーソルが移動する。 例 int num = base.num_rows(result); | ||
戻り値 | 関数名 | パラメーター |
make_table |
(int flg) | |
テーブルを作成する。 flg=1: 既存のテーブルを削除する。 例 base.make_table(1); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
get_root |
() |
ルートのid番号を取得する。 例 int root = base.get_root(); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
get_doc_root |
() |
ドキュメントルートのid番号を取得する。 例 int doc_root = base.get_doc_root(); | ||
戻り値 | 関数名 | パラメーター |
boolean |
is_exist |
(int id) |
id番のノードが存在するかどうかチェックする。 例 boolean check = base.is_exist(id); | ||
戻り値 | 関数名 | パラメーター |
boolean |
is_element |
(int id) |
id番のノードが要素かどうかチェックする。 例 boolean check = base.is_element(id); | ||
戻り値 | 関数名 | パラメーター |
boolean |
is_text |
(int id) |
id番のノードがテキストノードかどうかチェックする。 例 boolean check = base.is_text(id); | ||
戻り値 | 関数名 | パラメーター |
boolean |
is_attrib |
(int id) |
id番のノードが属性ノードかどうかチェックする。 例 boolean check = base.is_attrib(id); | ||
戻り値 | 関数名 | パラメーター |
boolean |
is_comment |
(int id) |
id番のノードがコメントノードかどうかチェックする。 例 boolean check = base.is_comment(id); | ||
戻り値 | 関数名 | パラメーター |
boolean |
is_dtd |
(int id) |
id番のノードがDTDノードかどうかチェックする。 例 boolean check = base.is_dtd(id); | ||
戻り値 | 関数名 | パラメーター |
boolean |
is_pi |
(int id) |
id番のノードがPIノードかどうかチェックする。 例 boolean check = base.is_pi(id); | ||
戻り値 | 関数名 | パラメーター |
boolean |
is_xml |
(int id) |
id番のノードがXML宣言ノードかどうかチェックする。 例 boolean check = base.is_xml(id); | ||
戻り値 | 関数名 | パラメーター |
BaseArray(id) |
get_elements |
(int id,String path) |
id番の要素からの相対パス(path)に相当する要素の集合を配列に返す。 例 BaseArray node_array = base.get_elements(id,\"child1\"); | ||
戻り値 | 関数名 | パラメーター |
BaseArray(id) |
get_elements |
(int id,String path,String ns) |
id番の要素からの相対パス(path)、ネームスペースnsに相当する要素の集合を配列に返す。 例 BaseArray node_array = base.get_elements(id,\"child1\",\"ns1\"); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
get_first_element |
(int id,String path) |
id番の要素からの相対パス(path)に相当する最初の要素を返す。 例 int element = base.get_first_element(id,\"child1/grandchild1\"); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
get_first_element |
(int id,String path,String ns) |
id番の要素からの相対パス(path)、ネームスペースnsに相当する最初の要素を返す。 例 int element = base.get_first_element(id,\"child1/grandchild1\",\"ns1\"); | ||
戻り値 | 関数名 | パラメーター |
BaseArray(id) |
get_child_elements |
(int id,String child_name) |
id番の要素のchild_nameという名前の子要素の集合を配列に返す。 child_nameが*の場合全ての子要素の集合を配列に返す。 例 BaseArray node_array = base.get_child_elements(id,\"*\"); | ||
戻り値 | 関数名 | パラメーター |
BaseArray(id) |
get_child_elements |
(int id,String child_name,String ns) |
id番の要素のchild_nameという名前でネームスペースnsの子要素の集合を配列に返す。 child_nameが*の場合全ての子要素の集合を配列に返す。 例 BaseArray node_array = base.get_child_elements(id,\"*\",\"ns1\"); | ||
戻り値 | 関数名 | パラメーター |
BaseArray(id) |
get_comments |
(int parent) |
親がparent番の要素のコメントノードのidの集合を配列に返す。 例 BaseArray node_array = base.get_comments(parent); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
get_parent |
(int id) |
id番のノードの親のidを返す。 例 int parent = base.get_parent(element); | ||
戻り値 | 関数名 | パラメーター |
String |
get_text |
(int id) |
id番のテキストノードの値を返す。 例 String text = base.get_text(id); | ||
戻り値 | 関数名 | パラメーター |
BaseArray(id) |
get_text_nodes |
(int id) |
id番の要素を親にもつテキストノードのidの集合を配列に返す。 例 BaseArray node_array = base.get_text_nodes(id); | ||
戻り値 | 関数名 | パラメーター |
String |
get_value |
(int id) |
id番の要素の子テキストノードの値を結合して返す。 結合時にtrimを行い\\nを挿入する。 例 String value = base.get_value(id); | ||
戻り値 | 関数名 | パラメーター |
String |
get_child_value |
(int id,String child_name) |
id番の要素のchild_nameの名前の子要素の値を返す。 値はget_value関数を用いて取ってくる。 例 String value = base.get_child_value(id,\"child_name\"); | ||
戻り値 | 関数名 | パラメーター |
String |
get_child_value |
(int id,String child_name,String ns) |
id番の要素のchild_nameの名前でネームスペースがnsの子要素の値を返す。 値はget_value関数を用いて取ってくる。 例 String value = base.get_child_value(id,\"child_name1\",\"ns1\"); | ||
戻り値 | 関数名 | パラメーター |
String |
get_comment |
(int id) |
id番のコメントノードの値を返す。 例 String comment = base.get_comment(id); | ||
戻り値 | 関数名 | パラメーター |
String |
get_pi |
(int id) |
id番のPIノードの値を返す。 例 String pi = base.get_pi(id); | ||
戻り値 | 関数名 | パラメーター |
String |
get_xml |
(int id) |
id番のXML宣言ノードの値を返す。 例 String xml = base.get_xml(id); | ||
戻り値 | 関数名 | パラメーター |
String |
get_dtd |
(int id) |
id番のDTDノードの値を返す。 例 String dtd = base.get_dtd(id); | ||
戻り値 | 関数名 | パラメーター |
String |
get_node_name |
(int id) |
id番のノードのnameを返す。 例 String name = base.get_node_name(id); | ||
戻り値 | 関数名 | パラメーター |
int |
get_node_type |
(int id) |
id番のノードのtypeを返す。 例 int type = base.get_node_type(id); | ||
戻り値 | 関数名 | パラメーター |
String |
get_node_value |
(int id) |
id番のノードの値を返す。 例 String value = base.get_node_value(id); | ||
戻り値 | 関数名 | パラメーター |
int(pos) |
get_node_pos |
(int id) |
id番のノードのposを返す。 例 int pos = base.get_node_pos(id); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
get_node_parent |
(int id) |
id番のノードの親ノードのidを返す。 例 int parent = base.get_node_parent(id); | ||
戻り値 | 関数名 | パラメーター |
BaseArray(id) |
get_nodes |
(int type) |
typeのtypeを持つノードのidの集合を配列に返す。 例 BaseArray node_array = base.get_nodes(type); ELEMENT_TYPE = 1; ATTR_TYPE = 2; TEXT_TYPE = 3; DTD_TYPE = 4; PI_TYPE = 5; COMMENT_TYPE = 6; XML_TYPE = 7; | ||
戻り値 | 関数名 | パラメーター |
String |
get_attrib |
(int id,String attrib_name) |
id番の要素のattrib_nameの属性ノードの値を返す。 例 String attrib_value = base.get_attrib(id,\"attrib_name\"); | ||
戻り値 | 関数名 | パラメーター |
BaseArray(id) |
get_attribs |
(int id) |
id番の要素の子属性ノードのidの集合を配列に返す。 例 BaseArray node_array = base.get_attribs(id); | ||
戻り値 | 関数名 | パラメーター |
String |
get_ns |
(int id) |
id番の要素のネームスペースを返す。 例 String ns = base.get_ns(id); | ||
戻り値 | 関数名 | パラメーター |
String |
get_uri |
(String ns,int id) |
id番の要素のネームスペースのURIを返す。 例 String uri = base.get_uri(\"ns1\",id); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
del_child |
(int id) |
id番のノードを分離する。 id番のparentをnullに、posを1にする。 idを返す。 例 base.del_child(id); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
del_child_element |
(int id,String child_name) |
id番の要素のchild_nameの名前をもつ子要素を分離する。 分離したノードのidを返す。 分離にはdel_child関数を使用する。 例 int child = base.del_child_element(id,\"child_name\"); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
del_child_element |
(int id,String child_name,String ns) |
id番の要素のchild_nameの名前でネームスペースnsをもつ子要素を分離する。 分離したノードのidを返す。 分離にはdel_child関数を使用する。 例 int child = base.del_child_element(id,\"child_name\",\"ns1\"); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
del_attrib |
(int id,String attrib_name) |
id番の要素のattrib_nameの子属性ノードを分離する。 分離したノードのidを返す。 分離にはdel_child関数を使用する。 例 int attrib = base.del_attrib(id,\"attrib_name\"); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
del_text |
(int id) |
id番のテキストノードを分離する。 分離したノードのidを返す。 分離にはdel_child関数を使用する。 例 base.del_text(id); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
del_comment |
(int id) |
id番のコメントノードを分離する。 分離したノードのidを返す。 分離にはdel_child関数を使用する。 例 base.del_comment(id); | ||
戻り値 | 関数名 | パラメーター |
del_element_value |
(int id) | |
id番の要素の子テキストノードを全て削除する。 例 base.del_element_value(id); | ||
戻り値 | 関数名 | パラメーター |
del_node |
(int id,int flg) | |
flg=1の場合:id番のノード以下全ての子孫ノード(id番も含む)を削除する。 flg=1以外の場合:id番のノードを削除する。 例 base.del_node(id,0); | ||
戻り値 | 関数名 | パラメーター |
add_child |
(int id,int child_id) | |
id番の要素にchild_idの要素を子要素として加える。 例 base.add_child(id,child); | ||
戻り値 | 関数名 | パラメーター |
add_text |
(int id,int text_id) | |
id番の要素の子テキストノードとしてtext_idのノードを加える。 例 base.add_text(id,text_id); | ||
戻り値 | 関数名 | パラメーター |
add_attrib |
(int id,int attrib_id) | |
id番の要素の属性としてattrib_idのノードを加える。 例 base.add_attrib(id,attrib_id); | ||
戻り値 | 関数名 | パラメーター |
add_comment |
(int id,int comment_id) | |
id番の要素の子としてcomment_idのノードを加える。 例 base.add_comment(id,comment_id); | ||
戻り値 | 関数名 | パラメーター |
insert_child |
(int id,int child_id,int ref_id) | |
id番の要素の子要素としてchild_idの要素をref_idの要素の前に挿入する。 例 base.insert_child(id,child,ref); | ||
戻り値 | 関数名 | パラメーター |
insert_text |
(int id,int child_id,int ref_id) | |
id番の要素の子テキストノードとしてchild_idのノードをref_idのノードの前に挿入する。 例 base.insert_text(id,child,ref); | ||
戻り値 | 関数名 | パラメーター |
insert_attrib |
(int id,int child_id,int ref_id) | |
id番の要素の子属性ノードとしてchild_idのノードをref_idのノードの前に挿入する。 例 base.insert_attrib(id,child,ref); | ||
戻り値 | 関数名 | パラメーター |
insert_comment |
(int id,int child_id,int ref_id) | |
id番の要素の子コメントノードとしてchild_idのノードをref_idのノードの前に挿入する。 例 base.insert_comment(id,child,ref); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
make_element |
(String name) |
要素名name、ネームスペース\"\"の要素ノードを作成する。 要素ノードのidを返す。 例 int element = base.make_element(\"name\"); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
make_element |
(String name,String ns) |
要素名name、ネームスペースnsの要素ノードを作成する。 要素ノードのidを返す。 例 int element = base.make_element(\"name\",\"ns\"); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
make_text |
(String value) |
値がvalueのテキストノードを作成する。 要素ノードのidを返す。 例 int text = base.make_text(\"value\"); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
make_attrib |
(String attrib_name,String attrib_value) |
属性名name、値valueの属性ノードを作成する。 例 int attrib = base.make_attrib(\"attrib_name\",\"attrib_value\"); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
make_comment |
(String comment) |
値がcommentのコメントノードを作成する。 例 int comment = base.make_comment(\"<!-- コメント -->\"); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
make_doc_root |
(String name) |
名前がname、ネームスペース\"\"のドキュメントルート要素を作成する。 例 int doc_root = base.make_doc_root(\"node_name\"); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
make_doc_root |
(String name,String ns) |
名前がname、ネームスペースnsのドキュメントルート要素を作成する。 例 int doc_root = base.make_doc_root(\"node_name\",\"ns1\"); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
make_dtd |
(String dtd) |
値がdtdのDTDノードを作成する。 例 int dtd = base.make_dtd(dtd); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
make_xml |
(String xml) |
値がxmlのXML宣言ノードを作成する。 例 int xml = base.make_xml(xml); | ||
戻り値 | 関数名 | パラメーター |
int(id) |
make_pi |
(String target,String data) |
ターゲットがtargetでプログラムがdataのPIノードを作成する。 例 int pi = base.make_pi(\"php\",\"print \\\"test\\\";\"); | ||
戻り値 | 関数名 | パラメーター |
set_value |
(int id,String value) | |
id番の要素の値(子テキストノード)としてvalueをセットする。 子テキストノードが複数ある場合は残りを削除する。 子テキストノードがない場合は作成する。 例 base.set_value(id,\"value\"); | ||
戻り値 | 関数名 | パラメーター |
set_text |
(int id,String value) | |
id番のテキストノードの値をvalueにセットする。 例 base.set_text(id,\"value\"); | ||
戻り値 | 関数名 | パラメーター |
set_attrib |
(int id,String attrib_name,String attrib_value) | |
id番の要素に属性名name、値valueをせっとする。 属性名nameの属性がない場合は作成する。 例 base.set_attrib(id,\"attrib_name\",\"attrib_value\"); | ||
戻り値 | 関数名 | パラメーター |
set_node_name |
(int id,String name) | |
id番のノードの名前をnameにセットする。 例 base.set_node_name(id,\"new_name\"); | ||
戻り値 | 関数名 | パラメーター |
set_ns |
(int id,String ns) | |
id番のネームスペースをnsにセットする。 例 base.set_ns(id,\"ns1\"); | ||
戻り値 | 関数名 | パラメーター |
set_uri |
(String ns,String uri) | |
ネームスペースnsのURIをuriにセットする。 例 base.set_uri(\"ns1\",\"some-URI\"); | ||
戻り値 | 関数名 | パラメーター |
write_attribs |
(int id,FileWriter fp) | |
id番の要素の属性を書き出す。 fp=nullの場合はxml_buffに蓄積する。 例 base.write_attribs(id,fp); | ||
戻り値 | 関数名 | パラメーター |
write_comment |
(int id,FileWriter fp) | |
id番のコメントノードを書き出す。 fp=nullの場合はxml_buffに蓄積する。 例 base.write_comment(id,fp); | ||
戻り値 | 関数名 | パラメーター |
write_node |
(int id,FileWriter fp,int level) | |
id番のノード以下の子孫ノードを書き出す。 fp=nullの場合はxml_buffに蓄積する。 行の始めにlevelの数だけタブを挿入する。 例 base.write_node(doc_root,fp,0); | ||
戻り値 | 関数名 | パラメーター |
write_document |
(FileWriter fp,int flg) | |
ドキュメントを書き出す。 fp=nullの場合はxml_buffに蓄積する。 flg=1の場合はDTD、PIも書き出す。 例 FileWriter fw = new FileWriter(docBase+\"sample4.xml\"); base.write_document(fw,1); | ||
戻り値 | 関数名 | パラメーター |
press |
() | |
データーベースを圧縮する。 圧縮後はpxbase_pressを使用して処理する。 例 base.press(); | ||
戻り値 | 関数名 | パラメーター |
BaseArray |
split |
(String pat,String text) |
テキストをpatで分離する。 例 BaseArray text_array = base.sprit(\"\\n\",text); | ||
戻り値 | 関数名 | パラメーター |
fwrite |
(FileWriter fw,String text) | |
テキストをfwに書き出す。 例 base.fwrite(fw,text); | ||
戻り値 | 関数名 | パラメーター |
die |
(String text) | |
テキストをスローする。 例 base.die(\"エラーが発生しました。\\n\"); | ||
戻り値 | 関数名 | パラメーター |
String |
replace |
(String pat,String chg,String text) |
テキストのpatをchgに変換する。 例 String text = base.replace(\"\\n\",\"<br>\",text); | ||
戻り値 | 関数名 | パラメーター |
String |
addslashes |
(String text) |
文字列をスラッシュでクォートする 例 String text = base.addslashes(text); | ||
戻り値 | 関数名 | パラメーター |
String |
stripslashes |
(String text) |
文字列のクォートを外す 例 String text = base.stripslashes(text); | ||
戻り値 | 関数名 | パラメーター |
void |
get_encode |
(String xml) |
xml宣言から漢字コードを取得する。 例 get_encode(xml); | ||
戻り値 | 関数名 | パラメーター |
String |
get_xml_buff |
() |
xml_buffを取得する。 例 String xml = get_xml_buff(); |