1. XML Query 사용법

조회 수 3073 추천 수 0 2011.05.10 14:09:31
SMaker *.22.160.117
제목 작성자 날짜
1. XML Query 사용법 (current) SMaker 2011.05.10 14:09:31
복원
<div class="eArea xe_content xe_dr_txt"><p><a href="http://doc.xpressengine.com/classXmlQueryParser.html" target="_blank">http://doc.xpressengine.com/classXmlQueryParser.html</a>&nbsp;(클래스 구조)</p></div><ul class="toc"><li class="toc3"><a href="#1249368742400-1">개요</a></li><li class="toc3"><a href="#1249368742400-2">사용법</a></li><li class="toc3"><a href="#h1249628444840">XML sample</a></li><li class="toc3"><a href="#Selectquery%EC%98%88%EC%A0%9C">Select query 예제</a></li><li class="toc3"><a href="#h1249627751923">Join Select 예제</a></li><li class="toc3"><a href="#h1249627778964">Letf Join Select 예제</a></li><li class="toc3"><a href="#1249368742400-5">Insert 예제</a></li><li class="toc3"><a href="#1249368742400-6">update 예제</a></li><li class="toc3"><a href="#1249368742400-7">delete 예제</a></li><li class="toc3"><a href="#1249368742400-7">Select Click Count 예제</a></li></ul><h3 id="1249368742400-1">개요</h3><div class="eArea xe_content xe_dr_txt"><ol>
<li>XpressEngine는 query문을 직접 사용하지 않습니다.</li>
<li>이는 다양한 DBMS를 지원하기 위해서입니다.</li>
<li>XML Query문의 확장자는 .xml 입니다.</li></ol></div><h3 id="1249368742400-2">사용법</h3><div class="eArea xe_content xe_dr_txt"><p>모듈 또는 애드온, 플러그인등에서 아래와 같이 사용할 수 있습니다.<br><br>&nbsp;&nbsp; 1. $args-&gt;name = "zero";<br>&nbsp;&nbsp; 2. $output = executeQuery("member.getMemberInfo", $args);<br><br>XML Query를 호출하여 실제 DB의 데이터를 받거나 조작하기 위해서 사용되는 executeQuery() 함수는 DB::executeQuery()의 alias입니다.<br><br>&nbsp;&nbsp; 1. function executeQuery($xml_query_name, $args = null);<br><br>첫번째 인자로 실행하고자 하는 xml query의 이름을 받게 됩니다.<br>이름은 모듈명.쿼리ID 로 이루어집니다.<br><br>$args는 null일수도 있고 해당 xml query에서 필요시 stdclass의 variables type으로 변수의 key, value를 설정후 인자로 넘기게 됩니다.<br><br>결과는 Object class의 객체로 return 됩니다.<br>쿼리 실패는 $output-&gt;toBool()이 false일 경우이고 true라면 쿼리는 정상적으로 실행이 된 것을 의미합니다.<br>select문의 결과 데이터는 $output-&gt;data 변수에 담겨져 return 됩니다.</p></div><h3 id="h1249628444840">XML sample</h3><div class="eArea xe_content xe_dr_txt"><ol class="code">
<li>&lt;query id="쿼리아이디" action="select|update|delete|insert"&gt;<br>&nbsp;&nbsp;&nbsp; &lt;tables&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;table name="원테이블이름" alias="alias" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp; &lt;/tables&gt;<br><br>&nbsp;&nbsp;&nbsp; &lt;columns&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;column name="컬럼명" alias="alias" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp; &lt;/columns&gt;<br><br>&nbsp;&nbsp;&nbsp; &lt;conditions&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group pipe="연결연산자"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/group&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp; &lt;/conditions&gt;<br><br>&nbsp;&nbsp;&nbsp; &lt;navigation&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;index var="이름" default="기본값" order="desc|asc" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;list_count var="변수명" default="기본값" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page_count var="변수명" default="기본값" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page var="변수명" default="변수명" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/navigation&gt;<br><br>&nbsp;&nbsp;&nbsp; &lt;groups&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group column="GroupBy 대상" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/groups&gt;<br>&lt;/query&gt;</li></ol></div><div class="eArea xe_content xe_dr_txt eFocus"><ul><li>
<p>&lt;query&gt; 의 attribute</p>
<ul><li>id : 쿼리를 찾을 수 있는 아이디입니다. module.query_id 로 query xml 파일을 찾고 사용하게 됩니다.<br>action : select, update, delete, insert 4가지 종류가 있습니다.</li></ul>
<p>&nbsp;</p></li><li>&lt;tables&gt;
<ul><li>테이블 조인시 여러개의 &lt;table&gt; 을 사용할 수 있습니다.<br>name : 원테이블 명 (제로보드XE에서 prefix는 무시) alias : join또는 다른 용도로 원테이블명을 바꾸어 사용할 경우</li></ul></li><li>&lt;columns&gt;
<ul><li>처리하고자 하는 컬럼명을 입력하시면 됩니다. name : 컬럼명 alias : 다른 이름으로 바꾸어 결과를 만들고자 할 경우 지정</li></ul></li><li>&lt;conditions&gt;
<ul><li>조건절을 구성합니다.</li><li>조건절을 여러개의 그룹으로 사용하고자 할 때에는 &lt;group&gt; 태그를 이용해서 묶어 주실 수 있습니다.</li></ul></li><li>&lt;group&gt; ... &lt;/group&gt;
<ul><li>조건절을 그룹으로 사용할 경우 pipe="and|or" 를 이용하여 그룹끼리의 조건을 지정할 수 있습니다.</li></ul></li><li>&lt;condition&gt;
<ul><li>
<p>operation : 아래와 같은 연산자로 처리가 됩니다.</p>
<div style="background-color: rgb(249, 249, 216);" class="section">equal : column = (var|default)<br>more : column &gt;= (var|default)<br>excess : column &gt; (var|default)<br>less : column &lt;= (var|default)<br>below : column &lt; (var|default)<br>notequal : column != (var|default)<br>notnull : column is not null<br>null : column is null<br>like_prefix : column like '%var|default'<br>like_tail : column like 'var|default%'<br>like : column like '%var|default%'<br>in : column in (var|default)<br>notin : column not in (var|default)<br></div>
<p>&nbsp;</p></li><li>column : 컬럼명을 지정할 수 있습니다.</li><li>var : executeQuery()함수에서 2번째 인자의 key값을 지정할 수 있습니다.</li><li>
<p>filter : var 값의 조건을 filtering합니다. 아래와 같은 filter를 지원합니다.</p>
<div style="background-color: rgb(249, 249, 216);" class="section">email, email_address : 메일 형식<br>homepage : http|https://등의 홈페이지 형식<br>userid, user_id : 제로보드XE의 사용자 아이디 형식 (첫글자는 영문, 2번째부터는 숫자+영문+_)<br>number : 숫자만 허용<br>alpha : 영문자만 허용<br>alpha_number : 숫자+영문자만 허용</div></li><li>
<p>default : var값이 null일 경우 default값으로 대체됩니다. 아래와 같은 함수값을 가질 수도 있습니다.</p>
<div style="background-color: rgb(249, 249, 216);" class="section">ipaddress() : 접속자의 ip 주소<br>unixtime() : unix time (php의 time()함수)<br>curdate() : YYYYMMDDHHIISS<br>plus(int count) : column = column + count<br>minus(int count) : column = column - count</div></li><li>notnull : not null check를 하게 됩니다. minlength : 최소길이 체크 maxlength : 최대길이 체크 pipe : and|or등의 조건을 지정할 수 있습니다.</li></ul></li><li>
<p>&lt;navigation&gt; : navigation은 정렬순서(order by) 또는 페이징을 지원합니다.</p>
<ul><li>
<p>&lt;index&gt; 정렬할 컬럼과 정렬방법을 지정할 수 있습니다.</p>
<div style="background-color: rgb(249, 249, 216);" class="section">var : 대상 컬럼명을 담은 변수명<br>default : var값이 없을 경우 기본으로 정렬할 컬럼명 지정<br>order : asc|desc</div></li><li>
<p>&lt;list_count&gt; 페이징을 한 결과를 받을 수 있습니다.</p>
<div style="background-color: rgb(249, 249, 216);" class="section">var : 목록의 rows를 지정<br>default : var값이 없을 경우 기본 rows 값</div></li><li>
<p>&lt;page_count&gt; 페이징 계산시에 하단 페이지 네비게이션의 수를 지정</p>
<div style="background-color: rgb(249, 249, 216);" class="section">var : 페이징 네비게이션의 수<br>default : var값이 없을 경우 기본 페이징 네비게이션의 수</div></li><li>
<p>&lt;page&gt; 현재 몇번째 페이지인지를 지정할 수 있습니다.</p>
<div style="background-color: rgb(249, 249, 216);" class="section">var : 현재 몇번째 페이지인지를 지정할 변수<br>default : var값이 지정되지 않았을 경우 페이지 번호</div></li></ul>
<p>&nbsp;</p></li><li>&lt;groups&gt; : group by 절을 사용할 수 있습니다.</li></ul></div><h3 id="Selectquery예제">Select query 예제</h3><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>member.getMemberList : member테이블에서 특정 조건을 가진 회원들을 페이징을 하면서 select</p>
<ol class="code">
<li>&lt;query id="getMemberList" action="select"&gt;<br>&lt;tables&gt;<br>&nbsp;&nbsp; &lt;table name="member" /&gt;<br>&lt;/tables&gt;</li>
<li><br>&lt;columns&gt;<br>&nbsp;&nbsp; &lt;column name="*" /&gt;<br>&lt;/columns&gt;</li>
<li><br>&lt;conditions&gt;<br>&nbsp; &nbsp; &lt;condition operation="equal" column="is_admin" var="is_admin" /&gt;<br>&nbsp;&nbsp; &lt;condition operation="equal" column="denied" var="is_denied" pipe="and" /&gt;<br>&nbsp;&nbsp; &lt;group pipe="and"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_id" var="s_user_id" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_name" var="s_user_name" pipe="or" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="nick_name" var="s_nick_name" pipe="or" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="email_address" var="s_email_address" pipe="or" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="regdate" var="s_regdate" pipe="or" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="last_login" var="s_last_login" pipe="or" /&gt;<br>&nbsp; &nbsp; &lt;/group&gt;<br>&lt;/conditions&gt;<br><br>&lt;navigation&gt;<br>&nbsp; &nbsp; &lt;index var="sort_index" default="member_srl" order="desc" /&gt;<br>&nbsp; &nbsp; &lt;list_count var="list_count" default="20" /&gt;<br>&nbsp; &nbsp; &lt;page_count var="page_count" default="10" /&gt;<br>&nbsp; &nbsp; &lt;page var="page" default="1" /&gt;<br>&lt;/navigation&gt;<br>&lt;/query&gt;</li></ol></li>
<li>document.getMonthlyArchivedList : 모듈을 '년월'일을 기준으로 group by 한 결과를 가져옴</li></ul></div><div class="eArea xe_content xe_dr_txt"><ol style="margin-left: 2em;" class="code">
<li>&lt;query id="getMonthlyArchivedList" action="select"&gt;<br>&lt;tables&gt;<br>&nbsp; &nbsp; &lt;table name="documents" /&gt;<br>&lt;/tables&gt;<br><br>&lt;columns&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="substr(regdate,1,6)" alias="month"/&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="count(*)" alias="count" /&gt;<br>&lt;/columns&gt;<br><br>&lt;conditions&gt;<br>&nbsp;&nbsp; &lt;condition operation="in" column="module_srl" var="module_srl" filter="number" /&gt;<br>&lt;/conditions&gt;<br><br>&lt;groups&gt;<br>&nbsp; &nbsp; &lt;group column="substr(regdate,1,6)" /&gt;<br>&lt;/groups&gt;<br>&lt;/query&gt;</li></ol></div><h3 id="h1249627751923">Join Select 예제</h3><div class="eArea xe_content xe_dr_txt"><p>document.getTrashList 예제입니다.</p></div><div class="eArea xe_content xe_dr_txt"><p></p>
<div>&lt;query id="getTrashList" action="select"&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;tables&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="documents" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_trash" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;columns&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="documents.*" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.trash_srl" alias="trash_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.module_srl" alias="module_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.trash_date" alias="trash_date" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.description" alias="trash_description" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.ipaddress" alias="trash_ipaddress" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.user_id" alias="trash_user_id" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.user_name" alias="trash_user_name" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.nick_name" alias="trash_nick_name" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.member_srl" alias="trash_member_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;conditions&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_trash.document_srl" default="documents.document_srl" notnull="notnull" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="in" column="document_trash.module_srl" var="module_srl" filter="number" pipe="and" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_trash.member_srl" var="member_srl" filter="number" pipe="and" /&gt;</div>
<div><br></div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;group pipe="and"&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.title" var="s_title" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.content" var="s_content" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.user_name" var="s_user_name" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.user_id" var="s_user_id" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.nick_name" var="s_nick_name" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.email_address" var="s_email_addres" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.homepage" var="s_homepage" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.tags" var="s_tags" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="documents.is_secret" var="s_is_secret" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="documents.member_srl" var="s_member_srl" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.readed_count" var="s_readed_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.voted_count" var="s_voted_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.comment_count" var="s_comment_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.trackback_count" var="s_trackback_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.uploaded_count" var="s_uploaded_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.regdate" var="s_regdate" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.last_update" var="s_last_update" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.ipaddress" var="s_ipaddress" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;/group&gt;</div>
<div><br></div>
<div><br></div>
<div>&nbsp;&nbsp; &nbsp;&lt;/conditions&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;navigation&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;index var="sort_index" default="documents.list_order" order="order_type" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;list_count var="list_count" default="20" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;page_count var="page_count" default="10" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;page var="page" default="1" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/navigation&gt;</div>
<div>&lt;/query&gt;</div>
<p></p></div><h3 id="h1249627778964">Letf Join Select 예제</h3><div class="eArea xe_content xe_dr_txt"><p></p>
<div>&lt;query id="getDocumentsExtraVars" action="select"&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;tables&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_extra_keys" alias="extra_keys" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_extra_vars" alias="extra_vars" type="left join"&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;conditions&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="extra_keys.module_srl" default="extra_vars.module_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="in" column="extra_vars.document_srl" var="document_srl" pipe="and" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="extra_keys.eid" default="extra_vars.eid" pipe="and" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/conditions&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;/table&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;columns&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.module_srl" alias="module_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_name" alias="name" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_type" alias="type" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_is_required" alias="is_required" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_search" alias="search" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_default" alias="default" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_desc" alias="desc" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_idx" alias="idx" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.document_srl" alias="document_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.lang_code" alias="lang_code" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.value" alias="value" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.eid" alias="eid" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;navigation&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;index var="sort_index" default="extra_keys.var_idx" order="asc" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/navigation&gt;</div>
<div>&lt;/query&gt;</div>
<div><br></div>
<p></p></div><h3 id="1249368742400-5">Insert 예제</h3><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.insertCategory : 문서 카테고리 추가</p>
<ol class="code">
<li>&lt;query id="insertCategory" action="insert"&gt;<br>&lt;tables&gt;<br>&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>&lt;/tables&gt;<br><br>&lt;columns&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="module_srl" var="module_srl" filter="number" default="0" notnull="notnull" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" notnull="notnull" minlength="2" maxlength="250" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="document_count" var="document_count" default="0" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="regdate" var="regdate" default="curdate()" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" default="0" /&gt;<br>&lt;/columns&gt;<br>&lt;/query&gt;</li></ol></li></ul></div><h3 id="1249368742400-6">update 예제</h3><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.updateCategory : 특정 카테고리의 제목이나 순서, 최근 수정일을 변경</p>
<ol class="code">
<li>&lt;query id="updateCategory" action="update"&gt;<br>&lt;tables&gt;<br>&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>&lt;/tables&gt;<br><br>&lt;columns&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<br>&lt;/columns&gt;<br><br>&lt;conditions&gt;<br>&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>&lt;/conditions&gt;<br>&lt;/query&gt;</li></ol></li></ul></div><h3 id="1249368742400-7">delete 예제</h3><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.deleteCategory : 특정 카테고리를 삭제</p>
<ol class="code">
<li>&lt;query id="deleteCategory" action="delete"&gt;<br>&lt;tables&gt;<br>&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>&lt;/tables&gt;<br><br>&lt;conditions&gt;<br>&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>&lt;/conditions&gt;<br>&lt;/query&gt;</li></ol></li></ul></div><h3 id="1249368742400-7">Select Click Count 예제</h3><div class="eArea xe_content xe_dr_txt"><p>Select 시 조회수 등의 정수의 숫자 컬럼을 +1 하는 기능입니다.</p>
<p>Cubrid의 경우에는 incr()이라는 함수를 사용하고 다른 데이타베이스의 경우 해당 컬럼을 Select후 Update 합니다.</p>
<p>XE Core 1.2.6 이상 버전에서&nbsp;지원하고 있습니다.</p>
<p></p>
<p>document.getDocument XML Query에 Click Count 를 적용해 본 예제입니다.</p>
<p>select시 정수 숫자 컬럼 node에 attribute는 click_count, 값은 Argument로 매핑되는 변수명을 기입합니다.</p>
<p></p></div><div class="eArea xe_content xe_dr_txt"><p>&lt;query id="getDocument" action="select"&gt;<br>&nbsp;&nbsp; &nbsp;&lt;tables&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="documents" /&gt;<br>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</p>
<p>&nbsp;&nbsp; &nbsp;&lt;columns&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_srl" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="module_srl" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="category_srl" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="lang_code" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="is_notice" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="is_secret" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title_bold" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title_color" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="content" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="readed_count" <b><span style="color: rgb(255, 0, 0);">click_count="incr_readed_count"</span></b>/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="voted_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="blamed_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="comment_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="trackback_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="uploaded_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="password" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="user_id" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="user_name" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="nick_name" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="member_srl" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="email_address" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="homepage" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="tags" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="regdate" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="last_update" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="last_updater" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="ipaddress" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="list_order" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="update_order" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="allow_comment" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="lock_comment" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="allow_trackback" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="notify_message" /&gt;<br>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;<br>&nbsp;&nbsp; &nbsp;&lt;conditions&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" /&gt;<br>&nbsp;&nbsp; &nbsp;&lt;/conditions&gt;<br>&lt;/query&gt;</p>
<p></p></div><div class="eArea xe_content xe_dr_txt"><p>click_count 의 매핑변수 값이 true이면 해당 컬럼을 +1 증가합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p></p>
<div>$args-&gt;document_srl = $this-&gt;document_srl;</div>
<div>$args-&gt;<span style="color: rgb(255, 0, 0);">incr_readed_count</span> =<span style="color: rgb(255, 0, 0);"> true</span>;</div>
<div>$output = executeQuery('document.getDocument', $args);</div>
<div><br></div>
<p></p></div>
라르게덴 2011.02.20 00:28:28
복원
<div class="eArea xe_content xe_dr_txt"><p><a href="http://doc.xpressengine.com/classXmlQueryParser.html" target="_blank">http://doc.xpressengine.com/classXmlQueryParser.html</a>&nbsp;(클래스 구조)</p></div><ul class="toc"><li class="toc3"><a href="#1249368742400-1">개요</a></li><li class="toc3"><a href="#1249368742400-2">사용법</a></li><li class="toc3"><a href="#h1249628444840">XML sample</a></li><li class="toc3"><a href="#Selectquery%EC%98%88%EC%A0%9C">Select query 예제</a></li><li class="toc3"><a href="#h1249627751923">Join Select 예제</a></li><li class="toc3"><a href="#h1249627778964">Letf Join Select 예제</a></li><li class="toc3"><a href="#1249368742400-5">Insert 예제</a></li><li class="toc3"><a href="#1249368742400-6">update 예제</a></li><li class="toc3"><a href="#1249368742400-7">delete 예제</a></li><li class="toc3"><a href="#1249368742400-7">Select Click Count 예제</a></li></ul><h3 id="1249368742400-1">개요</h3><div class="eArea xe_content xe_dr_txt"><ol>
<li>XpressEngine는 query문을 직접 사용하지 않습니다.</li>
<li>이는 다양한 DBMS를 지원하기 위해서입니다.</li>
<li>XML Query문의 확장자는 .xml 입니다.</li></ol></div><h3 id="1249368742400-2">사용법</h3><div class="eArea xe_content xe_dr_txt"><p>모듈 또는 애드온, 플러그인등에서 아래와 같이 사용할 수 있습니다.<br><br>&nbsp;&nbsp; 1. $args-&gt;name = "zero";<br>&nbsp;&nbsp; 2. $output = executeQuery("member.getMemberInfo", $args);<br><br>XML Query를 호출하여 실제 DB의 데이터를 받거나 조작하기 위해서 사용되는 executeQuery() 함수는 DB::executeQuery()의 alias입니다.<br><br>&nbsp;&nbsp; 1. function executeQuery($xml_query_name, $args = null);<br><br>첫번째 인자로 실행하고자 하는 xml query의 이름을 받게 됩니다.<br>이름은 모듈명.쿼리ID 로 이루어집니다.<br><br>$args는 null일수도 있고 해당 xml query에서 필요시 stdclass의 variables type으로 변수의 key, value를 설정후 인자로 넘기게 됩니다.<br><br>결과는 Object class의 객체로 return 됩니다.<br>쿼리 실패는 $output-&gt;toBool()이 false일 경우이고 true라면 쿼리는 정상적으로 실행이 된 것을 의미합니다.<br>select문의 결과 데이터는 $output-&gt;data 변수에 담겨져 return 됩니다.</p></div><h3 id="h1249628444840">XML sample</h3><div class="eArea xe_content xe_dr_txt"><ol class="code">
<li>&lt;query id="쿼리아이디" action="select|update|delete|insert"&gt;<br>&nbsp;&nbsp;&nbsp; &lt;tables&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;table name="원테이블이름" alias="alias" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp; &lt;/tables&gt;<br><br>&nbsp;&nbsp;&nbsp; &lt;columns&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;column name="컬럼명" alias="alias" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp; &lt;/columns&gt;<br><br>&nbsp;&nbsp;&nbsp; &lt;conditions&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group pipe="연결연산자"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/group&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp; &lt;/conditions&gt;<br><br>&nbsp;&nbsp;&nbsp; &lt;navigation&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;index var="이름" default="기본값" order="desc|asc" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;list_count var="변수명" default="기본값" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page_count var="변수명" default="기본값" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page var="변수명" default="변수명" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/navigation&gt;<br><br>&nbsp;&nbsp;&nbsp; &lt;groups&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group column="GroupBy 대상" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/groups&gt;<br>&lt;/query&gt;</li></ol></div><div class="eArea xe_content xe_dr_txt eFocus"><ul>
<li>
<p>&lt;query&gt; 의 attribute</p>
<ul>
<li>id : 쿼리를 찾을 수 있는 아이디입니다. module.query_id 로 query xml 파일을 찾고 사용하게 됩니다.<br>action : select, update, delete, insert 4가지 종류가 있습니다.</li></ul>
<p>&nbsp;</p></li>
<li>&lt;tables&gt;
<ul>
<li>테이블 조인시 여러개의 &lt;table&gt; 을 사용할 수 있습니다.<br>name : 원테이블 명 (제로보드XE에서 prefix는 무시) alias : join또는 다른 용도로 원테이블명을 바꾸어 사용할 경우</li></ul></li>
<li>&lt;columns&gt;
<ul>
<li>처리하고자 하는 컬럼명을 입력하시면 됩니다. name : 컬럼명 alias : 다른 이름으로 바꾸어 결과를 만들고자 할 경우 지정</li></ul></li>
<li>&lt;conditions&gt;
<ul>
<li>조건절을 구성합니다.</li>
<li>조건절을 여러개의 그룹으로 사용하고자 할 때에는 &lt;group&gt; 태그를 이용해서 묶어 주실 수 있습니다.</li></ul></li>
<li>&lt;group&gt; ... &lt;/group&gt;
<ul>
<li>조건절을 그룹으로 사용할 경우 pipe="and|or" 를 이용하여 그룹끼리의 조건을 지정할 수 있습니다.</li></ul></li>
<li>&lt;condition&gt;
<ul>
<li>
<p>operation : 아래와 같은 연산자로 처리가 됩니다.</p>
<div style="background-color: rgb(249, 249, 216);" class="section">equal : column = (var|default)<br>more : column &gt;= (var|default)<br>excess : column &gt; (var|default)<br>less : column &lt;= (var|default)<br>below : column &lt; (var|default)<br>notequal : column != (var|default)<br>notnull : column is not null<br>null : column is null<br>like_prefix : column like '%var|default'<br>like_tail : column like 'var|default%'<br>like : column like '%var|default%'<br>in : column in (var|default)</div>
<p>&nbsp;</p></li>
<li>column : 컬럼명을 지정할 수 있습니다.</li>
<li>var : executeQuery()함수에서 2번째 인자의 key값을 지정할 수 있습니다.</li>
<li>
<p>filter : var 값의 조건을 filtering합니다. 아래와 같은 filter를 지원합니다.</p>
<div style="background-color: rgb(249, 249, 216);" class="section">email, email_address : 메일 형식<br>homepage : http|https://등의 홈페이지 형식<br>userid, user_id : 제로보드XE의 사용자 아이디 형식 (첫글자는 영문, 2번째부터는 숫자+영문+_)<br>number : 숫자만 허용<br>alpha : 영문자만 허용<br>alpha_number : 숫자+영문자만 허용</div></li>
<li>
<p>default : var값이 null일 경우 default값으로 대체됩니다. 아래와 같은 함수값을 가질 수도 있습니다.</p>
<div style="background-color: rgb(249, 249, 216);" class="section">ipaddress() : 접속자의 ip 주소<br>unixtime() : unix time (php의 time()함수)<br>curdate() : YYYYMMDDHHIISS<br>plus(int count) : column = column + count<br>minus(int count) : column = column - count</div></li>
<li>notnull : not null check를 하게 됩니다. minlength : 최소길이 체크 maxlength : 최대길이 체크 pipe : and|or등의 조건을 지정할 수 있습니다.</li></ul></li>
<li>
<p>&lt;navigation&gt; : navigation은 정렬순서(order by) 또는 페이징을 지원합니다.</p>
<ul>
<li>
<p>&lt;index&gt; 정렬할 컬럼과 정렬방법을 지정할 수 있습니다.</p>
<div style="background-color: rgb(249, 249, 216);" class="section">var : 대상 컬럼명을 담은 변수명<br>default : var값이 없을 경우 기본으로 정렬할 컬럼명 지정<br>order : asc|desc</div></li>
<li>
<p>&lt;list_count&gt; 페이징을 한 결과를 받을 수 있습니다.</p>
<div style="background-color: rgb(249, 249, 216);" class="section">var : 목록의 rows를 지정<br>default : var값이 없을 경우 기본 rows 값</div></li>
<li>
<p>&lt;page_count&gt; 페이징 계산시에 하단 페이지 네비게이션의 수를 지정</p>
<div style="background-color: rgb(249, 249, 216);" class="section">var : 페이징 네비게이션의 수<br>default : var값이 없을 경우 기본 페이징 네비게이션의 수</div></li>
<li>
<p>&lt;page&gt; 현재 몇번째 페이지인지를 지정할 수 있습니다.</p>
<div style="background-color: rgb(249, 249, 216);" class="section">var : 현재 몇번째 페이지인지를 지정할 변수<br>default : var값이 지정되지 않았을 경우 페이지 번호</div></li></ul>
<p>&nbsp;</p></li>
<li>&lt;groups&gt; : group by 절을 사용할 수 있습니다.</li></ul></div><h3 id="Selectquery예제">Select query 예제</h3><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>member.getMemberList : member테이블에서 특정 조건을 가진 회원들을 페이징을 하면서 select</p>
<ol class="code">
<li>&lt;query id="getMemberList" action="select"&gt;<br>&lt;tables&gt;<br>&nbsp;&nbsp; &lt;table name="member" /&gt;<br>&lt;/tables&gt;</li>
<li><br>&lt;columns&gt;<br>&nbsp;&nbsp; &lt;column name="*" /&gt;<br>&lt;/columns&gt;</li>
<li><br>&lt;conditions&gt;<br>&nbsp; &nbsp; &lt;condition operation="equal" column="is_admin" var="is_admin" /&gt;<br>&nbsp;&nbsp; &lt;condition operation="equal" column="denied" var="is_denied" pipe="and" /&gt;<br>&nbsp;&nbsp; &lt;group pipe="and"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_id" var="s_user_id" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_name" var="s_user_name" pipe="or" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="nick_name" var="s_nick_name" pipe="or" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="email_address" var="s_email_address" pipe="or" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="regdate" var="s_regdate" pipe="or" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="last_login" var="s_last_login" pipe="or" /&gt;<br>&nbsp; &nbsp; &lt;/group&gt;<br>&lt;/conditions&gt;<br><br>&lt;navigation&gt;<br>&nbsp; &nbsp; &lt;index var="sort_index" default="member_srl" order="desc" /&gt;<br>&nbsp; &nbsp; &lt;list_count var="list_count" default="20" /&gt;<br>&nbsp; &nbsp; &lt;page_count var="page_count" default="10" /&gt;<br>&nbsp; &nbsp; &lt;page var="page" default="1" /&gt;<br>&lt;/navigation&gt;<br>&lt;/query&gt;</li></ol></li>
<li>document.getMonthlyArchivedList : 모듈을 '년월'일을 기준으로 group by 한 결과를 가져옴</li></ul></div><div class="eArea xe_content xe_dr_txt"><ol style="margin-left: 2em;" class="code">
<li>&lt;query id="getMonthlyArchivedList" action="select"&gt;<br>&lt;tables&gt;<br>&nbsp; &nbsp; &lt;table name="documents" /&gt;<br>&lt;/tables&gt;<br><br>&lt;columns&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="substr(regdate,1,6)" alias="month"/&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="count(*)" alias="count" /&gt;<br>&lt;/columns&gt;<br><br>&lt;conditions&gt;<br>&nbsp;&nbsp; &lt;condition operation="in" column="module_srl" var="module_srl" filter="number" /&gt;<br>&lt;/conditions&gt;<br><br>&lt;groups&gt;<br>&nbsp; &nbsp; &lt;group column="substr(regdate,1,6)" /&gt;<br>&lt;/groups&gt;<br>&lt;/query&gt;</li></ol></div><h3 id="h1249627751923">Join Select 예제</h3><div class="eArea xe_content xe_dr_txt"><p>document.getTrashList 예제입니다.</p></div><div class="eArea xe_content xe_dr_txt"><p></p>
<div>&lt;query id="getTrashList" action="select"&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;tables&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="documents" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_trash" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;columns&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="documents.*" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.trash_srl" alias="trash_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.module_srl" alias="module_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.trash_date" alias="trash_date" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.description" alias="trash_description" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.ipaddress" alias="trash_ipaddress" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.user_id" alias="trash_user_id" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.user_name" alias="trash_user_name" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.nick_name" alias="trash_nick_name" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.member_srl" alias="trash_member_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;conditions&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_trash.document_srl" default="documents.document_srl" notnull="notnull" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="in" column="document_trash.module_srl" var="module_srl" filter="number" pipe="and" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_trash.member_srl" var="member_srl" filter="number" pipe="and" /&gt;</div>
<div><br></div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;group pipe="and"&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.title" var="s_title" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.content" var="s_content" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.user_name" var="s_user_name" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.user_id" var="s_user_id" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.nick_name" var="s_nick_name" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.email_address" var="s_email_addres" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.homepage" var="s_homepage" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.tags" var="s_tags" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="documents.is_secret" var="s_is_secret" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="documents.member_srl" var="s_member_srl" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.readed_count" var="s_readed_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.voted_count" var="s_voted_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.comment_count" var="s_comment_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.trackback_count" var="s_trackback_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.uploaded_count" var="s_uploaded_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.regdate" var="s_regdate" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.last_update" var="s_last_update" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.ipaddress" var="s_ipaddress" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;/group&gt;</div>
<div><br></div>
<div><br></div>
<div>&nbsp;&nbsp; &nbsp;&lt;/conditions&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;navigation&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;index var="sort_index" default="documents.list_order" order="order_type" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;list_count var="list_count" default="20" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;page_count var="page_count" default="10" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;page var="page" default="1" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/navigation&gt;</div>
<div>&lt;/query&gt;</div>
<p></p></div><h3 id="h1249627778964">Letf Join Select 예제</h3><div class="eArea xe_content xe_dr_txt"><p></p>
<div>&lt;query id="getDocumentsExtraVars" action="select"&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;tables&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_extra_keys" alias="extra_keys" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_extra_vars" alias="extra_vars" type="left join"&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;conditions&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="extra_keys.module_srl" default="extra_vars.module_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="in" column="extra_vars.document_srl" var="document_srl" pipe="and" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="extra_keys.eid" default="extra_vars.eid" pipe="and" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/conditions&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;/table&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;columns&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.module_srl" alias="module_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_name" alias="name" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_type" alias="type" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_is_required" alias="is_required" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_search" alias="search" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_default" alias="default" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_desc" alias="desc" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_idx" alias="idx" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.document_srl" alias="document_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.lang_code" alias="lang_code" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.value" alias="value" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.eid" alias="eid" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;navigation&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;index var="sort_index" default="extra_keys.var_idx" order="asc" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/navigation&gt;</div>
<div>&lt;/query&gt;</div>
<div><br></div>
<p></p></div><h3 id="1249368742400-5">Insert 예제</h3><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.insertCategory : 문서 카테고리 추가</p>
<ol class="code">
<li>&lt;query id="insertCategory" action="insert"&gt;<br>&lt;tables&gt;<br>&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>&lt;/tables&gt;<br><br>&lt;columns&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="module_srl" var="module_srl" filter="number" default="0" notnull="notnull" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" notnull="notnull" minlength="2" maxlength="250" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="document_count" var="document_count" default="0" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="regdate" var="regdate" default="curdate()" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" default="0" /&gt;<br>&lt;/columns&gt;<br>&lt;/query&gt;</li></ol></li></ul></div><h3 id="1249368742400-6">update 예제</h3><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.updateCategory : 특정 카테고리의 제목이나 순서, 최근 수정일을 변경</p>
<ol class="code">
<li>&lt;query id="updateCategory" action="update"&gt;<br>&lt;tables&gt;<br>&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>&lt;/tables&gt;<br><br>&lt;columns&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<br>&lt;/columns&gt;<br><br>&lt;conditions&gt;<br>&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>&lt;/conditions&gt;<br>&lt;/query&gt;</li></ol></li></ul></div><h3 id="1249368742400-7">delete 예제</h3><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.deleteCategory : 특정 카테고리를 삭제</p>
<ol class="code">
<li>&lt;query id="deleteCategory" action="delete"&gt;<br>&lt;tables&gt;<br>&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>&lt;/tables&gt;<br><br>&lt;conditions&gt;<br>&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>&lt;/conditions&gt;<br>&lt;/query&gt;</li></ol></li></ul></div><h3 id="1249368742400-7">Select Click Count 예제</h3><div class="eArea xe_content xe_dr_txt"><p>Select 시 조회수 등의 정수의 숫자 컬럼을 +1 하는 기능입니다.</p>
<p>Cubrid의 경우에는 incr()이라는 함수를 사용하고 다른 데이타베이스의 경우 해당 컬럼을 Select후 Update 합니다.</p>
<p>XE Core 1.2.6 이상 버전에서&nbsp;지원하고 있습니다.</p>
<p></p>
<p>document.getDocument XML Query에 Click Count 를 적용해 본 예제입니다.</p>
<p>select시 정수 숫자 컬럼 node에 attribute는 click_count, 값은 Argument로 매핑되는 변수명을 기입합니다.</p>
<p></p></div><div class="eArea xe_content xe_dr_txt"><p>&lt;query id="getDocument" action="select"&gt;<br>&nbsp;&nbsp; &nbsp;&lt;tables&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="documents" /&gt;<br>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</p>
<p>&nbsp;&nbsp; &nbsp;&lt;columns&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_srl" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="module_srl" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="category_srl" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="lang_code" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="is_notice" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="is_secret" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title_bold" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title_color" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="content" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="readed_count" <b><span style="color: rgb(255, 0, 0);">click_count="incr_readed_count"</span></b>/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="voted_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="blamed_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="comment_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="trackback_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="uploaded_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="password" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="user_id" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="user_name" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="nick_name" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="member_srl" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="email_address" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="homepage" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="tags" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="regdate" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="last_update" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="last_updater" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="ipaddress" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="list_order" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="update_order" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="allow_comment" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="lock_comment" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="allow_trackback" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="notify_message" /&gt;<br>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;<br>&nbsp;&nbsp; &nbsp;&lt;conditions&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" /&gt;<br>&nbsp;&nbsp; &nbsp;&lt;/conditions&gt;<br>&lt;/query&gt;</p>
<p></p></div><div class="eArea xe_content xe_dr_txt"><p>click_count 의 매핑변수 값이 true이면 해당 컬럼을 +1 증가합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p></p>
<div>$args-&gt;document_srl = $this-&gt;document_srl;</div>
<div>$args-&gt;<span style="color: rgb(255, 0, 0);">incr_readed_count</span> =<span style="color: rgb(255, 0, 0);"> true</span>;</div>
<div>$output = executeQuery('document.getDocument', $args);</div>
<div><br></div>
<p></p></div>
라르게덴 2010.10.31 20:20:53
복원
<div class="eArea xe_content xe_dr_txt"><p><a href="http://doc.xpressengine.com/classXmlQueryParser.html" target="_blank">http://doc.xpressengine.com/classXmlQueryParser.html</a>&nbsp;(클래스 구조)</p></div><ul class="toc"><li class="toc3"><a href="#1249368742400-1">개요</a></li><li class="toc3"><a href="#1249368742400-2">사용법</a></li><li class="toc3"><a href="#h1249628444840">XML sample</a></li><li class="toc3"><a href="#Selectquery%EC%98%88%EC%A0%9C">Select query 예제</a></li><li class="toc3"><a href="#h1249627751923">Join Select 예제</a></li><li class="toc3"><a href="#h1249627778964">Letf Join Select 예제</a></li><li class="toc3"><a href="#1249368742400-5">Insert 예제</a></li><li class="toc3"><a href="#1249368742400-6">update 예제</a></li><li class="toc3"><a href="#1249368742400-7">delete 예제</a></li><li class="toc3"><a href="#1249368742400-7">Select Click Count 예제</a></li></ul><h3 id="1249368742400-1">개요</h3><div class="eArea xe_content xe_dr_txt"><ol>
<li>XpressEngine는 query문을 직접 사용하지 않습니다.</li>
<li>이는 다양한 DBMS를 지원하기 위해서입니다.</li>
<li>XML Query문의 확장자는 .xml 입니다.</li></ol></div><h3 id="1249368742400-2">사용법</h3><div class="eArea xe_content xe_dr_txt"><p>모듈 또는 애드온, 플러그인등에서 아래와 같이 사용할 수 있습니다.<br><br>&nbsp;&nbsp; 1. $args-&gt;name = "zero";<br>&nbsp;&nbsp; 2. $output = executeQuery("member.getMemberInfo", $args);<br><br>XML Query를 호출하여 실제 DB의 데이터를 받거나 조작하기 위해서 사용되는 executeQuery() 함수는 DB::executeQuery()의 alias입니다.<br><br>&nbsp;&nbsp; 1. function executeQuery($xml_query_name, $args = null);<br><br>첫번째 인자로 실행하고자 하는 xml query의 이름을 받게 됩니다.<br>이름은 모듈명.쿼리ID 로 이루어집니다.<br><br>$args는 null일수도 있고 해당 xml query에서 필요시 stdclass의 variables type으로 변수의 key, value를 설정후 인자로 넘기게 됩니다.<br><br>결과는 Object class의 객체로 return 됩니다.<br>쿼리 실패는 $output-&gt;toBool()이 false일 경우이고 true라면 쿼리는 정상적으로 실행이 된 것을 의미합니다.<br>select문의 결과 데이터는 $output-&gt;data 변수에 담겨져 return 됩니다.</p></div><h3 id="h1249628444840">XML sample</h3><div class="eArea xe_content xe_dr_txt"><ol class="code">
<li>&lt;query id="쿼리아이디" action="select|update|delete|insert"&gt;<br>&nbsp;&nbsp;&nbsp; &lt;tables&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;table name="원테이블이름" alias="alias" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp; &lt;/tables&gt;<br><br>&nbsp;&nbsp;&nbsp; &lt;columns&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;column name="컬럼명" alias="alias" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp; &lt;/columns&gt;<br><br>&nbsp;&nbsp;&nbsp; &lt;conditions&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group pipe="연결연산자"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/group&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp; &lt;/conditions&gt;<br><br>&nbsp;&nbsp;&nbsp; &lt;navigation&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;index var="이름" default="기본값" order="desc|asc" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;list_count var="변수명" default="기본값" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page_count var="변수명" default="기본값" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page var="변수명" default="변수명" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/navigation&gt;<br><br>&nbsp;&nbsp;&nbsp; &lt;groups&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group column="GroupBy 대상" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/groups&gt;<br>&lt;/query&gt;</li></ol></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>&lt;query&gt; 의 attribute</p>
<ul>
<li>id : 쿼리를 찾을 수 있는 아이디입니다. module.query_id 로 query xml 파일을 찾고 사용하게 됩니다.<br>action : select, update, delete, insert 4가지 종류가 있습니다.</li></ul>
<p>&nbsp;</p></li>
<li>&lt;tables&gt;
<ul>
<li>테이블 조인시 여러개의 &lt;table&gt; 을 사용할 수 있습니다.<br>name : 원테이블 명 (제로보드XE에서 prefix는 무시) alias : join또는 다른 용도로 원테이블명을 바꾸어 사용할 경우</li></ul></li>
<li>&lt;columns&gt;
<ul>
<li>처리하고자 하는 컬럼명을 입력하시면 됩니다. name : 컬럼명 alias : 다른 이름으로 바꾸어 결과를 만들고자 할 경우 지정</li></ul></li>
<li>&lt;conditions&gt;
<ul>
<li>조건절을 구성합니다.</li>
<li>조건절을 여러개의 그룹으로 사용하고자 할 때에는 &lt;group&gt; 태그를 이용해서 묶어 주실 수 있습니다.</li></ul></li>
<li>&lt;group&gt; ... &lt;/group&gt;
<ul>
<li>조건절을 그룹으로 사용할 경우 pipe="and|or" 를 이용하여 그룹끼리의 조건을 지정할 수 있습니다.</li></ul></li>
<li>&lt;condition&gt;
<ul>
<li>
<p>operation : 아래와 같은 연산자로 처리가 됩니다.</p>
<div style="background-color: rgb(249, 249, 216);" class="section">equal : column = (var|default)<br>more : column &gt;= (var|default)<br>excess : column &gt; (var|default)<br>less : column &lt;= (var|default)<br>below : column &lt; (var|default)<br>notequal : column != (var|default)<br>notnull : column is not null<br>null : column is null<br>like_prefix : column like '%var|default'<br>like_tail : column like 'var|default%'<br>like : column like '%var|default%'<br>in : column in (var|default)</div>
<p>&nbsp;</p></li>
<li>column : 컬럼명을 지정할 수 있습니다.</li>
<li>var : executeQuery()함수에서 2번째 인자의 key값을 지정할 수 있습니다.</li>
<li>
<p>filter : var 값의 조건을 filtering합니다. 아래와 같은 filter를 지원합니다.</p>
<div style="background-color: rgb(249, 249, 216);" class="section">email, email_address : 메일 형식<br>homepage : http|https://등의 홈페이지 형식<br>userid, user_id : 제로보드XE의 사용자 아이디 형식 (첫글자는 영문, 2번째부터는 숫자+영문+_)<br>number : 숫자만 허용<br>alpha : 영문자만 허용<br>alpha_number : 숫자+영문자만 허용</div></li>
<li>
<p>default : var값이 null일 경우 default값으로 대체됩니다. 아래와 같은 함수값을 가질 수도 있습니다.</p>
<div style="background-color: rgb(249, 249, 216);" class="section">ipaddress() : 접속자의 ip 주소<br>unixtime() : unix time (php의 time()함수)<br>curdate() : YYYYMMDDHHIISS<br>plus(int count) : column = column + count<br>minus(int count) : column = column - count</div></li>
<li>notnull : not null check를 하게 됩니다. minlength : 최소길이 체크 maxlength : 최대길이 체크 pipe : and|or등의 조건을 지정할 수 있습니다.</li></ul></li>
<li>
<p>&lt;navigation&gt; : navigation은 정렬순서(order by) 또는 페이징을 지원합니다.</p>
<ul>
<li>
<p>&lt;index&gt; 정렬할 컬럼과 정렬방법을 지정할 수 있습니다.</p>
<div style="background-color: rgb(249, 249, 216);" class="section">var : 대상 컬럼명을 담은 변수명<br>default : var값이 없을 경우 기본으로 정렬할 컬럼명 지정<br>order : asc|desc</div></li>
<li>
<p>&lt;list_count&gt; 페이징을 한 결과를 받을 수 있습니다.</p>
<div style="background-color: rgb(249, 249, 216);" class="section">var : 목록의 rows를 지정<br>default : var값이 없을 경우 기본 rows 값</div></li>
<li>
<p>&lt;page_count&gt; 페이징 계산시에 하단 페이지 네비게이션의 수를 지정</p>
<div style="background-color: rgb(249, 249, 216);" class="section">var : 페이징 네비게이션의 수<br>default : var값이 없을 경우 기본 페이징 네비게이션의 수</div></li>
<li>
<p>&lt;page&gt; 현재 몇번째 페이지인지를 지정할 수 있습니다.</p>
<div style="background-color: rgb(249, 249, 216);" class="section">var : 현재 몇번째 페이지인지를 지정할 변수<br>default : var값이 지정되지 않았을 경우 페이지 번호</div></li></ul>
<p>&nbsp;</p></li>
<li>&lt;groups&gt; : group by 절을 사용할 수 있습니다.</li></ul></div><h3 id="Selectquery예제">Select query 예제</h3><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>member.getMemberList : member테이블에서 특정 조건을 가진 회원들을 페이징을 하면서 select</p>
<ol class="code">
<li>&lt;query id="getMemberList" action="select"&gt;<br>&lt;tables&gt;<br>&nbsp;&nbsp; &lt;table name="member" /&gt;<br>&lt;/tables&gt;</li>
<li><br>&lt;columns&gt;<br>&nbsp;&nbsp; &lt;column name="*" /&gt;<br>&lt;/columns&gt;</li>
<li><br>&lt;conditions&gt;<br>&nbsp; &nbsp; &lt;condition operation="equal" column="is_admin" var="is_admin" /&gt;<br>&nbsp;&nbsp; &lt;condition operation="equal" column="denied" var="is_denied" pipe="and" /&gt;<br>&nbsp;&nbsp; &lt;group pipe="and"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_id" var="s_user_id" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_name" var="s_user_name" pipe="or" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="nick_name" var="s_nick_name" pipe="or" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="email_address" var="s_email_address" pipe="or" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="regdate" var="s_regdate" pipe="or" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="last_login" var="s_last_login" pipe="or" /&gt;<br>&nbsp; &nbsp; &lt;/group&gt;<br>&lt;/conditions&gt;<br><br>&lt;navigation&gt;<br>&nbsp; &nbsp; &lt;index var="sort_index" default="member_srl" order="desc" /&gt;<br>&nbsp; &nbsp; &lt;list_count var="list_count" default="20" /&gt;<br>&nbsp; &nbsp; &lt;page_count var="page_count" default="10" /&gt;<br>&nbsp; &nbsp; &lt;page var="page" default="1" /&gt;<br>&lt;/navigation&gt;<br>&lt;/query&gt;</li></ol></li>
<li>document.getMonthlyArchivedList : 모듈을 '년월'일을 기준으로 group by 한 결과를 가져옴</li></ul></div><div class="eArea xe_content xe_dr_txt"><ol style="margin-left: 2em;" class="code">
<li>&lt;query id="getMonthlyArchivedList" action="select"&gt;<br>&lt;tables&gt;<br>&nbsp; &nbsp; &lt;table name="documents" /&gt;<br>&lt;/tables&gt;<br><br>&lt;columns&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="substr(regdate,1,6)" alias="month"/&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="count(*)" alias="count" /&gt;<br>&lt;/columns&gt;<br><br>&lt;conditions&gt;<br>&nbsp;&nbsp; &lt;condition operation="in" column="module_srl" var="module_srl" filter="number" /&gt;<br>&lt;/conditions&gt;<br><br>&lt;groups&gt;<br>&nbsp; &nbsp; &lt;group column="substr(regdate,1,6)" /&gt;<br>&lt;/groups&gt;<br>&lt;/query&gt;</li></ol></div><h3 id="h1249627751923">Join Select 예제</h3><div class="eArea xe_content xe_dr_txt"><p>document.getTrashList 예제입니다.</p></div><div class="eArea xe_content xe_dr_txt"><p></p>
<div>&lt;query id="getTrashList" action="select"&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;tables&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="documents" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_trash" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;columns&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="documents.*" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.trash_srl" alias="trash_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.module_srl" alias="module_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.trash_date" alias="trash_date" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.description" alias="trash_description" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.ipaddress" alias="trash_ipaddress" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.user_id" alias="trash_user_id" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.user_name" alias="trash_user_name" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.nick_name" alias="trash_nick_name" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.member_srl" alias="trash_member_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;conditions&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_trash.document_srl" default="documents.document_srl" notnull="notnull" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="in" column="document_trash.module_srl" var="module_srl" filter="number" pipe="and" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_trash.member_srl" var="member_srl" filter="number" pipe="and" /&gt;</div>
<div><br></div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;group pipe="and"&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.title" var="s_title" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.content" var="s_content" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.user_name" var="s_user_name" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.user_id" var="s_user_id" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.nick_name" var="s_nick_name" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.email_address" var="s_email_addres" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.homepage" var="s_homepage" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.tags" var="s_tags" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="documents.is_secret" var="s_is_secret" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="documents.member_srl" var="s_member_srl" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.readed_count" var="s_readed_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.voted_count" var="s_voted_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.comment_count" var="s_comment_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.trackback_count" var="s_trackback_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.uploaded_count" var="s_uploaded_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.regdate" var="s_regdate" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.last_update" var="s_last_update" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.ipaddress" var="s_ipaddress" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;/group&gt;</div>
<div><br></div>
<div><br></div>
<div>&nbsp;&nbsp; &nbsp;&lt;/conditions&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;navigation&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;index var="sort_index" default="documents.list_order" order="order_type" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;list_count var="list_count" default="20" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;page_count var="page_count" default="10" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;page var="page" default="1" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/navigation&gt;</div>
<div>&lt;/query&gt;</div>
<p></p></div><h3 id="h1249627778964">Letf Join Select 예제</h3><div class="eArea xe_content xe_dr_txt"><p></p>
<div>&lt;query id="getDocumentsExtraVars" action="select"&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;tables&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_extra_keys" alias="extra_keys" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_extra_vars" alias="extra_vars" type="left join"&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;conditions&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="extra_keys.module_srl" default="extra_vars.module_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="in" column="extra_vars.document_srl" var="document_srl" pipe="and" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="extra_keys.eid" default="extra_vars.eid" pipe="and" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/conditions&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;/table&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;columns&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.module_srl" alias="module_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_name" alias="name" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_type" alias="type" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_is_required" alias="is_required" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_search" alias="search" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_default" alias="default" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_desc" alias="desc" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_idx" alias="idx" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.document_srl" alias="document_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.lang_code" alias="lang_code" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.value" alias="value" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.eid" alias="eid" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;navigation&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;index var="sort_index" default="extra_keys.var_idx" order="asc" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/navigation&gt;</div>
<div>&lt;/query&gt;</div>
<div><br></div>
<p></p></div><h3 id="1249368742400-5">Insert 예제</h3><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.insertCategory : 문서 카테고리 추가</p>
<ol class="code">
<li>&lt;query id="insertCategory" action="insert"&gt;<br>&lt;tables&gt;<br>&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>&lt;/tables&gt;<br><br>&lt;columns&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="module_srl" var="module_srl" filter="number" default="0" notnull="notnull" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" notnull="notnull" minlength="2" maxlength="250" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="document_count" var="document_count" default="0" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="regdate" var="regdate" default="curdate()" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" default="0" /&gt;<br>&lt;/columns&gt;<br>&lt;/query&gt;</li></ol></li></ul></div><h3 id="1249368742400-6">update 예제</h3><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.updateCategory : 특정 카테고리의 제목이나 순서, 최근 수정일을 변경</p>
<ol class="code">
<li>&lt;query id="updateCategory" action="update"&gt;<br>&lt;tables&gt;<br>&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>&lt;/tables&gt;<br><br>&lt;columns&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<br>&lt;/columns&gt;<br><br>&lt;conditions&gt;<br>&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>&lt;/conditions&gt;<br>&lt;/query&gt;</li></ol></li></ul></div><h3 id="1249368742400-7">delete 예제</h3><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.deleteCategory : 특정 카테고리를 삭제</p>
<ol class="code">
<li>&lt;query id="deleteCategory" action="delete"&gt;<br>&lt;tables&gt;<br>&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>&lt;/tables&gt;<br><br>&lt;conditions&gt;<br>&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>&lt;/conditions&gt;<br>&lt;/query&gt;</li></ol></li></ul></div><h3 id="1249368742400-7">Select Click Count 예제</h3><div class="eArea xe_content xe_dr_txt"><p>Select 시 조회수 등의 정수의 숫자 컬럼을 +1 하는 기능입니다.</p>
<p>Cubrid의 경우에는 incr()이라는 함수를 사용하고 다른 데이타베이스의 경우 해당 컬럼을 Select후 Update 합니다.</p>
<p>XE Core 1.2.6 이상 버전에서&nbsp;지원하고 있습니다.</p>
<p></p>
<p>document.getDocument XML Query에 Click Count 를 적용해 본 예제입니다.</p>
<p>select시 정수 숫자 컬럼 node에 attribute는 click_count, 값은 Argument로 매핑되는 변수명을 기입합니다.</p>
<p></p></div><div class="eArea xe_content xe_dr_txt"><p>&lt;query id="getDocument" action="select"&gt;<br>&nbsp;&nbsp; &nbsp;&lt;tables&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="documents" /&gt;<br>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</p>
<p>&nbsp;&nbsp; &nbsp;&lt;columns&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_srl" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="module_srl" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="category_srl" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="lang_code" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="is_notice" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="is_secret" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title_bold" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title_color" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="content" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="readed_count" <b><span style="color: rgb(255, 0, 0);">click_count="incr_readed_count"</span></b>/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="voted_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="blamed_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="comment_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="trackback_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="uploaded_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="password" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="user_id" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="user_name" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="nick_name" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="member_srl" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="email_address" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="homepage" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="tags" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="regdate" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="last_update" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="last_updater" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="ipaddress" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="list_order" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="update_order" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="allow_comment" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="lock_comment" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="allow_trackback" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="notify_message" /&gt;<br>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;<br>&nbsp;&nbsp; &nbsp;&lt;conditions&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" /&gt;<br>&nbsp;&nbsp; &nbsp;&lt;/conditions&gt;<br>&lt;/query&gt;</p>
<p></p></div><div class="eArea xe_content xe_dr_txt"><p>click_count 의 매핑변수 값이 true이면 해당 컬럼을 +1 증가합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p></p>
<div>$args-&gt;document_srl = $this-&gt;document_srl;</div>
<div>$args-&gt;<span style="color: rgb(255, 0, 0);">incr_readed_count</span> =<span style="color: rgb(255, 0, 0);"> true</span>;</div>
<div>$output = executeQuery('document.getDocument', $args);</div>
<div><br></div>
<p></p></div><p>.<br></p>
라르게덴 2010.10.31 20:20:14
복원
<div class="eArea xe_content xe_dr_txt"><p><a href="http://doc.xpressengine.com/classXmlQueryParser.html" target="_blank">http://doc.xpressengine.com/classXmlQueryParser.html</a>&nbsp;(클래스 구조)</p></div><ul class="toc"><li class="toc3"><a href="#1249368742400-1">개요</a></li><li class="toc3"><a href="#1249368742400-2">사용법</a></li><li class="toc3"><a href="#h1249628444840">XML sample</a></li><li class="toc3"><a href="#Selectquery예제">Select query 예제</a></li><li class="toc3"><a href="#h1249627751923">Join Select 예제</a></li><li class="toc3"><a href="#h1249627778964">Letf Join Select 예제</a></li><li class="toc3"><a href="#1249368742400-5">Insert 예제</a></li><li class="toc3"><a href="#1249368742400-6">update 예제</a></li><li class="toc3"><a href="#1249368742400-7">delete 예제</a></li><li class="toc3"><a href="#1249368742400-7">Select Click Count 예제</a></li></ul><h3 id="1249368742400-1">개요</h3><div class="eArea xe_content xe_dr_txt"><ol>
<li>XpressEngine는 query문을 직접 사용하지 않습니다.</li>
<li>이는 다양한 DBMS를 지원하기 위해서입니다.</li>
<li>XML Query문의 확장자는 .xml 입니다.</li></ol></div><h3 id="1249368742400-2">사용법</h3><div class="eArea xe_content xe_dr_txt"><p>모듈 또는 애드온, 플러그인등에서 아래와 같이 사용할 수 있습니다.<br><br>&nbsp;&nbsp; 1. $args-&gt;name = "zero";<br>&nbsp;&nbsp; 2. $output = executeQuery("member.getMemberInfo", $args);<br><br>XML Query를 호출하여 실제 DB의 데이터를 받거나 조작하기 위해서 사용되는 executeQuery() 함수는 DB::executeQuery()의 alias입니다.<br><br>&nbsp;&nbsp; 1. function executeQuery($xml_query_name, $args = null);<br><br>첫번째 인자로 실행하고자 하는 xml query의 이름을 받게 됩니다.<br>이름은 모듈명.쿼리ID 로 이루어집니다.<br><br>$args는 null일수도 있고 해당 xml query에서 필요시 stdclass의 variables type으로 변수의 key, value를 설정후 인자로 넘기게 됩니다.<br><br>결과는 Object class의 객체로 return 됩니다.<br>쿼리 실패는 $output-&gt;toBool()이 false일 경우이고 true라면 쿼리는 정상적으로 실행이 된 것을 의미합니다.<br>select문의 결과 데이터는 $output-&gt;data 변수에 담겨져 return 됩니다.</p></div><h3 id="h1249628444840">XML sample</h3><div class="eArea xe_content xe_dr_txt"><ol class="code">
<li>&lt;query id="쿼리아이디" action="select|update|delete|insert"&gt;<br>&nbsp;&nbsp;&nbsp; &lt;tables&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;table name="원테이블이름" alias="alias" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp; &lt;/tables&gt;<br><br>&nbsp;&nbsp;&nbsp; &lt;columns&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;column name="컬럼명" alias="alias" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp; &lt;/columns&gt;<br><br>&nbsp;&nbsp;&nbsp; &lt;conditions&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group pipe="연결연산자"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/group&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp; &lt;/conditions&gt;<br><br>&nbsp;&nbsp;&nbsp; &lt;navigation&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;index var="이름" default="기본값" order="desc|asc" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;list_count var="변수명" default="기본값" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page_count var="변수명" default="기본값" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page var="변수명" default="변수명" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/navigation&gt;<br><br>&nbsp;&nbsp;&nbsp; &lt;groups&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group column="GroupBy 대상" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/groups&gt;<br>&lt;/query&gt;</li></ol></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>&lt;query&gt; 의 attribute</p>
<ul>
<li>id : 쿼리를 찾을 수 있는 아이디입니다. module.query_id 로 query xml 파일을 찾고 사용하게 됩니다.<br>action : select, update, delete, insert 4가지 종류가 있습니다.</li></ul>
<p>&nbsp;</p></li>
<li>&lt;tables&gt;
<ul>
<li>테이블 조인시 여러개의 &lt;table&gt; 을 사용할 수 있습니다.<br>name : 원테이블 명 (제로보드XE에서 prefix는 무시) alias : join또는 다른 용도로 원테이블명을 바꾸어 사용할 경우</li></ul></li>
<li>&lt;columns&gt;
<ul>
<li>처리하고자 하는 컬럼명을 입력하시면 됩니다. name : 컬럼명 alias : 다른 이름으로 바꾸어 결과를 만들고자 할 경우 지정</li></ul></li>
<li>&lt;conditions&gt;
<ul>
<li>조건절을 구성합니다.</li>
<li>조건절을 여러개의 그룹으로 사용하고자 할 때에는 &lt;group&gt; 태그를 이용해서 묶어 주실 수 있습니다.</li></ul></li>
<li>&lt;group&gt; ... &lt;/group&gt;
<ul>
<li>조건절을 그룹으로 사용할 경우 pipe="and|or" 를 이용하여 그룹끼리의 조건을 지정할 수 있습니다.</li></ul></li>
<li>&lt;condition&gt;
<ul>
<li>
<p>operation : 아래와 같은 연산자로 처리가 됩니다.</p>
<div style="BACKGROUND-COLOR: rgb(249,249,216)" class="section">equal : column = (var|default)<br>more : column &gt;= (var|default)<br>excess : column &gt; (var|default)<br>less : column &lt;= (var|default)<br>below : column &lt; (var|default)<br>notequal : column != (var|default)<br>notnull : column is not null<br>null : column is null<br>like_prefix : column like '%var|default'<br>like_tail : column like 'var|default%'<br>like : column like '%var|default%'<br>in : column in (var|default)</div>
<p>&nbsp;</p></li>
<li>column : 컬럼명을 지정할 수 있습니다.</li>
<li>var : executeQuery()함수에서 2번째 인자의 key값을 지정할 수 있습니다.</li>
<li>
<p>filter : var 값의 조건을 filtering합니다. 아래와 같은 filter를 지원합니다.</p>
<div style="BACKGROUND-COLOR: rgb(249,249,216)" class="section">email, email_address : 메일 형식<br>homepage : http|https://등의 홈페이지 형식<br>userid, user_id : 제로보드XE의 사용자 아이디 형식 (첫글자는 영문, 2번째부터는 숫자+영문+_)<br>number : 숫자만 허용<br>alpha : 영문자만 허용<br>alpha_number : 숫자+영문자만 허용</div></li>
<li>
<p>default : var값이 null일 경우 default값으로 대체됩니다. 아래와 같은 함수값을 가질 수도 있습니다.</p>
<div style="BACKGROUND-COLOR: rgb(249,249,216)" class="section">ipaddress() : 접속자의 ip 주소<br>unixtime() : unix time (php의 time()함수)<br>curdate() : YYYYMMDDHHIISS<br>plus(int count) : column = column + count<br>minus(int count) : column = column - count</div></li>
<li>notnull : not null check를 하게 됩니다. minlength : 최소길이 체크 maxlength : 최대길이 체크 pipe : and|or등의 조건을 지정할 수 있습니다.</li></ul></li>
<li>
<p>&lt;navigation&gt; : navigation은 정렬순서(order by) 또는 페이징을 지원합니다.</p>
<ul>
<li>
<p>&lt;index&gt; 정렬할 컬럼과 정렬방법을 지정할 수 있습니다.</p>
<div style="BACKGROUND-COLOR: rgb(249,249,216)" class="section">var : 대상 컬럼명을 담은 변수명<br>default : var값이 없을 경우 기본으로 정렬할 컬럼명 지정<br>order : asc|desc</div></li>
<li>
<p>&lt;list_count&gt; 페이징을 한 결과를 받을 수 있습니다.</p>
<div style="BACKGROUND-COLOR: rgb(249,249,216)" class="section">var : 목록의 rows를 지정<br>default : var값이 없을 경우 기본 rows 값</div></li>
<li>
<p>&lt;page_count&gt; 페이징 계산시에 하단 페이지 네비게이션의 수를 지정</p>
<div style="BACKGROUND-COLOR: rgb(249,249,216)" class="section">var : 페이징 네비게이션의 수<br>default : var값이 없을 경우 기본 페이징 네비게이션의 수</div></li>
<li>
<p>&lt;page&gt; 현재 몇번째 페이지인지를 지정할 수 있습니다.</p>
<div style="BACKGROUND-COLOR: rgb(249,249,216)" class="section">var : 현재 몇번째 페이지인지를 지정할 변수<br>default : var값이 지정되지 않았을 경우 페이지 번호</div></li></ul>
<p>&nbsp;</p></li>
<li>&lt;groups&gt; : group by 절을 사용할 수 있습니다.</li></ul></div><h3 id="Selectquery예제">Select query 예제</h3><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>member.getMemberList : member테이블에서 특정 조건을 가진 회원들을 페이징을 하면서 select</p>
<ol class="code">
<li>&lt;query id="getMemberList" action="select"&gt;<br>&lt;tables&gt;<br>&nbsp;&nbsp; &lt;table name="member" /&gt;<br>&lt;/tables&gt;</li>
<li><br>&lt;columns&gt;<br>&nbsp;&nbsp; &lt;column name="*" /&gt;<br>&lt;/columns&gt;</li>
<li><br>&lt;conditions&gt;<br>&nbsp; &nbsp; &lt;condition operation="equal" column="is_admin" var="is_admin" /&gt;<br>&nbsp;&nbsp; &lt;condition operation="equal" column="denied" var="is_denied" pipe="and" /&gt;<br>&nbsp;&nbsp; &lt;group pipe="and"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_id" var="s_user_id" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_name" var="s_user_name" pipe="or" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="nick_name" var="s_nick_name" pipe="or" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="email_address" var="s_email_address" pipe="or" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="regdate" var="s_regdate" pipe="or" /&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="last_login" var="s_last_login" pipe="or" /&gt;<br>&nbsp; &nbsp; &lt;/group&gt;<br>&lt;/conditions&gt;<br><br>&lt;navigation&gt;<br>&nbsp; &nbsp; &lt;index var="sort_index" default="member_srl" order="desc" /&gt;<br>&nbsp; &nbsp; &lt;list_count var="list_count" default="20" /&gt;<br>&nbsp; &nbsp; &lt;page_count var="page_count" default="10" /&gt;<br>&nbsp; &nbsp; &lt;page var="page" default="1" /&gt;<br>&lt;/navigation&gt;<br>&lt;/query&gt;</li></ol></li>
<li>document.getMonthlyArchivedList : 모듈을 '년월'일을 기준으로 group by 한 결과를 가져옴</li></ul></div><div class="eArea xe_content xe_dr_txt"><ol style="MARGIN-LEFT: 2em" class="code">
<li>&lt;query id="getMonthlyArchivedList" action="select"&gt;<br>&lt;tables&gt;<br>&nbsp; &nbsp; &lt;table name="documents" /&gt;<br>&lt;/tables&gt;<br><br>&lt;columns&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="substr(regdate,1,6)" alias="month"/&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="count(*)" alias="count" /&gt;<br>&lt;/columns&gt;<br><br>&lt;conditions&gt;<br>&nbsp;&nbsp; &lt;condition operation="in" column="module_srl" var="module_srl" filter="number" /&gt;<br>&lt;/conditions&gt;<br><br>&lt;groups&gt;<br>&nbsp; &nbsp; &lt;group column="substr(regdate,1,6)" /&gt;<br>&lt;/groups&gt;<br>&lt;/query&gt;</li></ol></div><h3 id="h1249627751923">Join Select 예제</h3><div class="eArea xe_content xe_dr_txt"><p>document.getTrashList 예제입니다.</p></div><div class="eArea xe_content xe_dr_txt"><p></p>
<div>&lt;query id="getTrashList" action="select"&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;tables&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="documents" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_trash" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;columns&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="documents.*" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.trash_srl" alias="trash_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.module_srl" alias="module_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.trash_date" alias="trash_date" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.description" alias="trash_description" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.ipaddress" alias="trash_ipaddress" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.user_id" alias="trash_user_id" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.user_name" alias="trash_user_name" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.nick_name" alias="trash_nick_name" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.member_srl" alias="trash_member_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;conditions&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_trash.document_srl" default="documents.document_srl" notnull="notnull" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="in" column="document_trash.module_srl" var="module_srl" filter="number" pipe="and" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_trash.member_srl" var="member_srl" filter="number" pipe="and" /&gt;</div>
<div><br></div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;group pipe="and"&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.title" var="s_title" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.content" var="s_content" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.user_name" var="s_user_name" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.user_id" var="s_user_id" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.nick_name" var="s_nick_name" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.email_address" var="s_email_addres" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.homepage" var="s_homepage" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.tags" var="s_tags" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="documents.is_secret" var="s_is_secret" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="documents.member_srl" var="s_member_srl" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.readed_count" var="s_readed_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.voted_count" var="s_voted_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.comment_count" var="s_comment_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.trackback_count" var="s_trackback_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.uploaded_count" var="s_uploaded_count" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.regdate" var="s_regdate" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.last_update" var="s_last_update" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.ipaddress" var="s_ipaddress" pipe="or" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;/group&gt;</div>
<div><br></div>
<div><br></div>
<div>&nbsp;&nbsp; &nbsp;&lt;/conditions&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;navigation&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;index var="sort_index" default="documents.list_order" order="order_type" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;list_count var="list_count" default="20" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;page_count var="page_count" default="10" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;page var="page" default="1" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/navigation&gt;</div>
<div>&lt;/query&gt;</div>
<p></p></div><h3 id="h1249627778964">Letf Join Select 예제</h3><div class="eArea xe_content xe_dr_txt"><p></p>
<div>&lt;query id="getDocumentsExtraVars" action="select"&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;tables&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_extra_keys" alias="extra_keys" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_extra_vars" alias="extra_vars" type="left join"&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;conditions&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="extra_keys.module_srl" default="extra_vars.module_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="in" column="extra_vars.document_srl" var="document_srl" pipe="and" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="extra_keys.eid" default="extra_vars.eid" pipe="and" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/conditions&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;/table&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;columns&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.module_srl" alias="module_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_name" alias="name" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_type" alias="type" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_is_required" alias="is_required" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_search" alias="search" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_default" alias="default" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_desc" alias="desc" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_idx" alias="idx" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.document_srl" alias="document_srl" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.lang_code" alias="lang_code" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.value" alias="value" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.eid" alias="eid" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;navigation&gt;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;index var="sort_index" default="extra_keys.var_idx" order="asc" /&gt;</div>
<div>&nbsp;&nbsp; &nbsp;&lt;/navigation&gt;</div>
<div>&lt;/query&gt;</div>
<div><br></div>
<p></p></div><h3 id="1249368742400-5">Insert 예제</h3><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.insertCategory : 문서 카테고리 추가</p>
<ol class="code">
<li>&lt;query id="insertCategory" action="insert"&gt;<br>&lt;tables&gt;<br>&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>&lt;/tables&gt;<br><br>&lt;columns&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="module_srl" var="module_srl" filter="number" default="0" notnull="notnull" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" notnull="notnull" minlength="2" maxlength="250" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="document_count" var="document_count" default="0" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="regdate" var="regdate" default="curdate()" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" default="0" /&gt;<br>&lt;/columns&gt;<br>&lt;/query&gt;</li></ol></li></ul></div><h3 id="1249368742400-6">update 예제</h3><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.updateCategory : 특정 카테고리의 제목이나 순서, 최근 수정일을 변경</p>
<ol class="code">
<li>&lt;query id="updateCategory" action="update"&gt;<br>&lt;tables&gt;<br>&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>&lt;/tables&gt;<br><br>&lt;columns&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<br>&lt;/columns&gt;<br><br>&lt;conditions&gt;<br>&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>&lt;/conditions&gt;<br>&lt;/query&gt;</li></ol></li></ul></div><h3 id="1249368742400-7">delete 예제</h3><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.deleteCategory : 특정 카테고리를 삭제</p>
<ol class="code">
<li>&lt;query id="deleteCategory" action="delete"&gt;<br>&lt;tables&gt;<br>&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>&lt;/tables&gt;<br><br>&lt;conditions&gt;<br>&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>&lt;/conditions&gt;<br>&lt;/query&gt;</li></ol></li></ul></div><h3 id="1249368742400-7">Select Click Count 예제</h3><div class="eArea xe_content xe_dr_txt"><p>Select 시 조회수 등의 정수의 숫자 컬럼을 +1 하는 기능입니다.</p>
<p>Cubrid의 경우에는 incr()이라는 함수를 사용하고 다른 데이타베이스의 경우 해당 컬럼을 Select후 Update 합니다.</p>
<p>XE Core 1.2.6 이상 버전에서&nbsp;지원하고 있습니다.</p>
<p></p>
<p>document.getDocument XML Query에 Click Count 를 적용해 본 예제입니다.</p>
<p>select시 정수 숫자 컬럼 node에 attribute는 click_count, 값은 Argument로 매핑되는 변수명을 기입합니다.</p>
<p></p></div><div class="eArea xe_content xe_dr_txt"><p>&lt;query id="getDocument" action="select"&gt;<br>&nbsp;&nbsp; &nbsp;&lt;tables&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="documents" /&gt;<br>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</p>
<p>&nbsp;&nbsp; &nbsp;&lt;columns&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_srl" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="module_srl" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="category_srl" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="lang_code" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="is_notice" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="is_secret" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title_bold" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title_color" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="content" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="readed_count" <b><span style="COLOR: rgb(255,0,0)">click_count="incr_readed_count"</span></b>/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="voted_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="blamed_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="comment_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="trackback_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="uploaded_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="password" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="user_id" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="user_name" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="nick_name" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="member_srl" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="email_address" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="homepage" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="tags" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="regdate" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="last_update" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="last_updater" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="ipaddress" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="list_order" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="update_order" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="allow_comment" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="lock_comment" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="allow_trackback" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="notify_message" /&gt;<br>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;<br>&nbsp;&nbsp; &nbsp;&lt;conditions&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" /&gt;<br>&nbsp;&nbsp; &nbsp;&lt;/conditions&gt;<br>&lt;/query&gt;</p>
<p></p></div><div class="eArea xe_content xe_dr_txt"><p>click_count 의 매핑변수 값이 true이면 해당 컬럼을 +1 증가합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p></p>
<div>$args-&gt;document_srl = $this-&gt;document_srl;</div>
<div>$args-&gt;<span style="COLOR: rgb(255,0,0)">incr_readed_count</span> =<span style="COLOR: rgb(255,0,0)"> true</span>;</div>
<div>$output = executeQuery('document.getDocument', $args);</div>
<div><br></div>
<p></p></div>
하늘03 2010.06.03 18:35:09
복원
<div class="eArea xe_content xe_dr_txt"><P><A href="http://doc.xpressengine.com/classXmlQueryParser.html" target=_blank>http://doc.xpressengine.com/classXmlQueryParser.html</A>&nbsp;(클래스 구조)</P></div><div class="eArea xe_content xe_dr_index"><UL class=toc>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#1249368742400-1">개요</A></LI>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#1249368742400-2">사용법</A></LI>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#h1249628444840">XML sample</A></LI>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#Selectquery예제">Select query 예제</A></LI>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#h1249627751923">Join Select 예제</A></LI>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#h1249627778964">Letf Join Select 예제</A></LI>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#1249368742400-5">Insert 예제</A></LI>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#1249368742400-6">update 예제</A></LI>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#1249368742400-7">delete 예제</A></LI>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#1249368742400-7">Select Click Count 예제</A></LI></UL></div><div class="eArea xe_content xe_dr_hx"><H3 id=1249368742400-1>개요</H3></div><div class="eArea xe_content xe_dr_txt"><OL>
<LI>XpressEngine는 query문을 직접 사용하지 않습니다.</LI>
<LI>이는 다양한 DBMS를 지원하기 위해서입니다.</LI>
<LI>XML Query문의 확장자는 .xml 입니다.</LI></OL></div><div class="eArea xe_content xe_dr_hx"><H3 id=1249368742400-2>사용법</H3></div><div class="eArea xe_content xe_dr_txt"><P>모듈 또는 애드온, 플러그인등에서 아래와 같이 사용할 수 있습니다.<BR><BR>&nbsp;&nbsp; 1. $args-&gt;name = "zero";<BR>&nbsp;&nbsp; 2. $output = executeQuery("member.getMemberInfo", $args);<BR><BR>XML Query를 호출하여 실제 DB의 데이터를 받거나 조작하기 위해서 사용되는 executeQuery() 함수는 DB::executeQuery()의 alias입니다.<BR><BR>&nbsp;&nbsp; 1. function executeQuery($xml_query_name, $args = null);<BR><BR>첫번째 인자로 실행하고자 하는 xml query의 이름을 받게 됩니다.<BR>이름은 모듈명.쿼리ID 로 이루어집니다.<BR><BR>$args는 null일수도 있고 해당 xml query에서 필요시 stdclass의 variables type으로 변수의 key, value를 설정후 인자로 넘기게 됩니다.<BR><BR>결과는 Object class의 객체로 return 됩니다.<BR>쿼리 실패는 $output-&gt;toBool()이 false일 경우이고 true라면 쿼리는 정상적으로 실행이 된 것을 의미합니다.<BR>select문의 결과 데이터는 $output-&gt;data 변수에 담겨져 return 됩니다.</P></div><div class="eArea xe_content xe_dr_hx"><H3 id=h1249628444840>XML sample</H3></div><div class="eArea xe_content xe_dr_txt"><OL class=code>
<LI>&lt;query id="쿼리아이디" action="select|update|delete|insert"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;tables&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;table name="원테이블이름" alias="alias" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<BR>&nbsp;&nbsp;&nbsp; &lt;/tables&gt;<BR><BR>&nbsp;&nbsp;&nbsp; &lt;columns&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;column name="컬럼명" alias="alias" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<BR>&nbsp;&nbsp;&nbsp; &lt;/columns&gt;<BR><BR>&nbsp;&nbsp;&nbsp; &lt;conditions&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group pipe="연결연산자"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/group&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<BR>&nbsp;&nbsp;&nbsp; &lt;/conditions&gt;<BR><BR>&nbsp;&nbsp;&nbsp; &lt;navigation&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;index var="이름" default="기본값" order="desc|asc" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;list_count var="변수명" default="기본값" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page_count var="변수명" default="기본값" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page var="변수명" default="변수명" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/navigation&gt;<BR><BR>&nbsp;&nbsp;&nbsp; &lt;groups&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group column="GroupBy 대상" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/groups&gt;<BR>&lt;/query&gt;</LI></OL></div><div class="eArea xe_content xe_dr_txt"><UL>
<LI>
<P>&lt;query&gt; 의 attribute</P>
<UL>
<LI>id : 쿼리를 찾을 수 있는 아이디입니다. module.query_id 로 query xml 파일을 찾고 사용하게 됩니다.<BR>action : select, update, delete, insert 4가지 종류가 있습니다.</LI></UL>
<P>&nbsp;</P></LI>
<LI>&lt;tables&gt;
<UL>
<LI>테이블 조인시 여러개의 &lt;table&gt; 을 사용할 수 있습니다.<BR>name : 원테이블 명 (제로보드XE에서 prefix는 무시) alias : join또는 다른 용도로 원테이블명을 바꾸어 사용할 경우</LI></UL></LI>
<LI>&lt;columns&gt;
<UL>
<LI>처리하고자 하는 컬럼명을 입력하시면 됩니다. name : 컬럼명 alias : 다른 이름으로 바꾸어 결과를 만들고자 할 경우 지정</LI></UL></LI>
<LI>&lt;conditions&gt;
<UL>
<LI>조건절을 구성합니다.</LI>
<LI>조건절을 여러개의 그룹으로 사용하고자 할 때에는 &lt;group&gt; 태그를 이용해서 묶어 주실 수 있습니다.</LI></UL></LI>
<LI>&lt;group&gt; ... &lt;/group&gt;
<UL>
<LI>조건절을 그룹으로 사용할 경우 pipe="and|or" 를 이용하여 그룹끼리의 조건을 지정할 수 있습니다.</LI></UL></LI>
<LI>&lt;condition&gt;
<UL>
<LI>
<P>operation : 아래와 같은 연산자로 처리가 됩니다.</P>
<DIV style="BACKGROUND-COLOR: rgb(249,249,216)" class=section>equal : column = (var|default)<BR>more : column &gt;= (var|default)<BR>excess : column &gt; (var|default)<BR>less : column &lt;= (var|default)<BR>below : column &lt; (var|default)<BR>notequal : column != (var|default)<BR>notnull : column is not null<BR>null : column is null<BR>like_prefix : column like '%var|default'<BR>like_tail : column like 'var|default%'<BR>like : column like '%var|default%'<BR>in : column in (var|default)</DIV>
<P>&nbsp;</P></LI>
<LI>column : 컬럼명을 지정할 수 있습니다.</LI>
<LI>var : executeQuery()함수에서 2번째 인자의 key값을 지정할 수 있습니다.</LI>
<LI>
<P>filter : var 값의 조건을 filtering합니다. 아래와 같은 filter를 지원합니다.</P>
<DIV style="BACKGROUND-COLOR: rgb(249,249,216)" class=section>email, email_address : 메일 형식<BR>homepage : http|https://등의 홈페이지 형식<BR>userid, user_id : 제로보드XE의 사용자 아이디 형식 (첫글자는 영문, 2번째부터는 숫자+영문+_)<BR>number : 숫자만 허용<BR>alpha : 영문자만 허용<BR>alpha_number : 숫자+영문자만 허용</DIV></LI>
<LI>
<P>default : var값이 null일 경우 default값으로 대체됩니다. 아래와 같은 함수값을 가질 수도 있습니다.</P>
<DIV style="BACKGROUND-COLOR: rgb(249,249,216)" class=section>ipaddress() : 접속자의 ip 주소<BR>unixtime() : unix time (php의 time()함수)<BR>curdate() : YYYYMMDDHHIISS<BR>plus(int count) : column = column + count<BR>minus(int count) : column = column - count</DIV></LI>
<LI>notnull : not null check를 하게 됩니다. minlength : 최소길이 체크 maxlength : 최대길이 체크 pipe : and|or등의 조건을 지정할 수 있습니다.</LI></UL></LI>
<LI>
<P>&lt;navigation&gt; : navigation은 정렬순서(order by) 또는 페이징을 지원합니다.</P>
<UL>
<LI>
<P>&lt;index&gt; 정렬할 컬럼과 정렬방법을 지정할 수 있습니다.</P>
<DIV style="BACKGROUND-COLOR: rgb(249,249,216)" class=section>var : 대상 컬럼명을 담은 변수명<BR>default : var값이 없을 경우 기본으로 정렬할 컬럼명 지정<BR>order : asc|desc</DIV></LI>
<LI>
<P>&lt;list_count&gt; 페이징을 한 결과를 받을 수 있습니다.</P>
<DIV style="BACKGROUND-COLOR: rgb(249,249,216)" class=section>var : 목록의 rows를 지정<BR>default : var값이 없을 경우 기본 rows 값</DIV></LI>
<LI>
<P>&lt;page_count&gt; 페이징 계산시에 하단 페이지 네비게이션의 수를 지정</P>
<DIV style="BACKGROUND-COLOR: rgb(249,249,216)" class=section>var : 페이징 네비게이션의 수<BR>default : var값이 없을 경우 기본 페이징 네비게이션의 수</DIV></LI>
<LI>
<P>&lt;page&gt; 현재 몇번째 페이지인지를 지정할 수 있습니다.</P>
<DIV style="BACKGROUND-COLOR: rgb(249,249,216)" class=section>var : 현재 몇번째 페이지인지를 지정할 변수<BR>default : var값이 지정되지 않았을 경우 페이지 번호</DIV></LI></UL>
<P>&nbsp;</P></LI>
<LI>&lt;groups&gt; : group by 절을 사용할 수 있습니다.</LI></UL></div><div class="eArea xe_content xe_dr_hx"><H3 id=Selectquery예제>Select query 예제</H3></div><div class="eArea xe_content xe_dr_txt"><UL>
<LI>
<P>member.getMemberList : member테이블에서 특정 조건을 가진 회원들을 페이징을 하면서 select</P>
<OL class=code>
<LI>&lt;query id="getMemberList" action="select"&gt;<BR>&lt;tables&gt;<BR>&nbsp;&nbsp; &lt;table name="member" /&gt;<BR>&lt;/tables&gt;</LI>
<LI><BR>&lt;columns&gt;<BR>&nbsp;&nbsp; &lt;column name="*" /&gt;<BR>&lt;/columns&gt;</LI>
<LI><BR>&lt;conditions&gt;<BR>&nbsp; &nbsp; &lt;condition operation="equal" column="is_admin" var="is_admin" /&gt;<BR>&nbsp;&nbsp; &lt;condition operation="equal" column="denied" var="is_denied" pipe="and" /&gt;<BR>&nbsp;&nbsp; &lt;group pipe="and"&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_id" var="s_user_id" /&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_name" var="s_user_name" pipe="or" /&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="nick_name" var="s_nick_name" pipe="or" /&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="email_address" var="s_email_address" pipe="or" /&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="regdate" var="s_regdate" pipe="or" /&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="last_login" var="s_last_login" pipe="or" /&gt;<BR>&nbsp; &nbsp; &lt;/group&gt;<BR>&lt;/conditions&gt;<BR><BR>&lt;navigation&gt;<BR>&nbsp; &nbsp; &lt;index var="sort_index" default="member_srl" order="desc" /&gt;<BR>&nbsp; &nbsp; &lt;list_count var="list_count" default="20" /&gt;<BR>&nbsp; &nbsp; &lt;page_count var="page_count" default="10" /&gt;<BR>&nbsp; &nbsp; &lt;page var="page" default="1" /&gt;<BR>&lt;/navigation&gt;<BR>&lt;/query&gt;</LI></OL></LI>
<LI>document.getMonthlyArchivedList : 모듈을 '년월'일을 기준으로 group by 한 결과를 가져옴</LI></UL></div><div class="eArea xe_content xe_dr_txt"><OL style="MARGIN-LEFT: 2em" class=code>
<LI>&lt;query id="getMonthlyArchivedList" action="select"&gt;<BR>&lt;tables&gt;<BR>&nbsp; &nbsp; &lt;table name="documents" /&gt;<BR>&lt;/tables&gt;<BR><BR>&lt;columns&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="substr(regdate,1,6)" alias="month"/&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="count(*)" alias="count" /&gt;<BR>&lt;/columns&gt;<BR><BR>&lt;conditions&gt;<BR>&nbsp;&nbsp; &lt;condition operation="in" column="module_srl" var="module_srl" filter="number" /&gt;<BR>&lt;/conditions&gt;<BR><BR>&lt;groups&gt;<BR>&nbsp; &nbsp; &lt;group column="substr(regdate,1,6)" /&gt;<BR>&lt;/groups&gt;<BR>&lt;/query&gt;</LI></OL></div><div class="eArea xe_content xe_dr_hx"><H3 id=h1249627751923>Join Select 예제</H3></div><div class="eArea xe_content xe_dr_txt"><P>document.getTrashList 예제입니다.</P></div><div class="eArea xe_content xe_dr_txt"><P></P>
<DIV>&lt;query id="getTrashList" action="select"&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;tables&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="documents" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_trash" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;columns&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="documents.*" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.trash_srl" alias="trash_srl" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.module_srl" alias="module_srl" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.trash_date" alias="trash_date" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.description" alias="trash_description" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.ipaddress" alias="trash_ipaddress" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.user_id" alias="trash_user_id" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.user_name" alias="trash_user_name" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.nick_name" alias="trash_nick_name" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.member_srl" alias="trash_member_srl" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;conditions&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_trash.document_srl" default="documents.document_srl" notnull="notnull" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="in" column="document_trash.module_srl" var="module_srl" filter="number" pipe="and" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_trash.member_srl" var="member_srl" filter="number" pipe="and" /&gt;</DIV>
<DIV><BR></DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;group pipe="and"&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.title" var="s_title" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.content" var="s_content" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.user_name" var="s_user_name" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.user_id" var="s_user_id" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.nick_name" var="s_nick_name" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.email_address" var="s_email_addres" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.homepage" var="s_homepage" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.tags" var="s_tags" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="documents.is_secret" var="s_is_secret" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="documents.member_srl" var="s_member_srl" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.readed_count" var="s_readed_count" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.voted_count" var="s_voted_count" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.comment_count" var="s_comment_count" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.trackback_count" var="s_trackback_count" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.uploaded_count" var="s_uploaded_count" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.regdate" var="s_regdate" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.last_update" var="s_last_update" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.ipaddress" var="s_ipaddress" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;/group&gt;</DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;/conditions&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;navigation&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;index var="sort_index" default="documents.list_order" order="order_type" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;list_count var="list_count" default="20" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;page_count var="page_count" default="10" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;page var="page" default="1" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;/navigation&gt;</DIV>
<DIV>&lt;/query&gt;</DIV>
<P></P></div><div class="eArea xe_content xe_dr_hx"><H3 id=h1249627778964>Letf Join Select 예제</H3></div><div class="eArea xe_content xe_dr_txt"><P></P>
<DIV>&lt;query id="getDocumentsExtraVars" action="select"&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;tables&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_extra_keys" alias="extra_keys" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_extra_vars" alias="extra_vars" type="left join"&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;conditions&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="extra_keys.module_srl" default="extra_vars.module_srl" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="in" column="extra_vars.document_srl" var="document_srl" pipe="and" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="extra_keys.eid" default="extra_vars.eid" pipe="and" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/conditions&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;/table&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;columns&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.module_srl" alias="module_srl" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_name" alias="name" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_type" alias="type" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_is_required" alias="is_required" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_search" alias="search" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_default" alias="default" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_desc" alias="desc" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_idx" alias="idx" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.document_srl" alias="document_srl" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.lang_code" alias="lang_code" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.value" alias="value" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.eid" alias="eid" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;navigation&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;index var="sort_index" default="extra_keys.var_idx" order="asc" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;/navigation&gt;</DIV>
<DIV>&lt;/query&gt;</DIV>
<DIV><BR></DIV>
<P></P></div><div class="eArea xe_content xe_dr_hx"><H3 id=1249368742400-5>Insert 예제</H3></div><div class="eArea xe_content xe_dr_txt"><UL>
<LI>
<P>document.insertCategory : 문서 카테고리 추가</P>
<OL class=code>
<LI>&lt;query id="insertCategory" action="insert"&gt;<BR>&lt;tables&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<BR>&lt;/tables&gt;<BR><BR>&lt;columns&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="module_srl" var="module_srl" filter="number" default="0" notnull="notnull" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" notnull="notnull" minlength="2" maxlength="250" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="document_count" var="document_count" default="0" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="regdate" var="regdate" default="curdate()" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" default="0" /&gt;<BR>&lt;/columns&gt;<BR>&lt;/query&gt;</LI></OL></LI></UL></div><div class="eArea xe_content xe_dr_hx"><H3 id=1249368742400-6>update 예제</H3></div><div class="eArea xe_content xe_dr_txt"><UL>
<LI>
<P>document.updateCategory : 특정 카테고리의 제목이나 순서, 최근 수정일을 변경</P>
<OL class=code>
<LI>&lt;query id="updateCategory" action="update"&gt;<BR>&lt;tables&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<BR>&lt;/tables&gt;<BR><BR>&lt;columns&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<BR>&lt;/columns&gt;<BR><BR>&lt;conditions&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<BR>&lt;/conditions&gt;<BR>&lt;/query&gt;</LI></OL></LI></UL></div><div class="eArea xe_content xe_dr_hx"><H3 id=1249368742400-7>delete 예제</H3></div><div class="eArea xe_content xe_dr_txt"><UL>
<LI>
<P>document.deleteCategory : 특정 카테고리를 삭제</P>
<OL class=code>
<LI>&lt;query id="deleteCategory" action="delete"&gt;<BR>&lt;tables&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<BR>&lt;/tables&gt;<BR><BR>&lt;conditions&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<BR>&lt;/conditions&gt;<BR>&lt;/query&gt;</LI></OL></LI></UL></div><div class="eArea xe_content xe_dr_hx"><H3 id=1249368742400-7>Select Click Count 예제</H3></div><div class="eArea xe_content xe_dr_txt"><P>Select 시 조회수 등의 정수의 숫자 컬럼을 +1 하는 기능입니다.</P>
<P>Cubrid의 경우에는 incr()이라는 함수를 사용하고 다른 데이타베이스의 경우 해당 컬럼을 Select후 Update 합니다.</P>
<P>XE Core 1.2.6 이상 버전에서&nbsp;지원하고 있습니다.</P>
<P></P>
<P>document.getDocument XML Query에 Click Count 를 적용해 본 예제입니다.</P>
<P>select시 정수 숫자 컬럼 node에 attribute는 click_count, 값은 Argument로 매핑되는 변수명을 기입합니다.</P>
<P></P></div><div class="eArea xe_content xe_dr_txt"><P>&lt;query id="getDocument" action="select"&gt;<BR>&nbsp;&nbsp; &nbsp;&lt;tables&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="documents" /&gt;<BR>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</P>
<P>&nbsp;&nbsp; &nbsp;&lt;columns&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_srl" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="module_srl" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="category_srl" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="lang_code" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="is_notice" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="is_secret" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title_bold" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title_color" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="content" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="readed_count" <B><SPAN style="COLOR: rgb(255,0,0)">click_count="incr_readed_count"</SPAN></B>/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="voted_count" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="blamed_count" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="comment_count" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="trackback_count" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="uploaded_count" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="password" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="user_id" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="user_name" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="nick_name" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="member_srl" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="email_address" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="homepage" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="tags" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="regdate" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="last_update" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="last_updater" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="ipaddress" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="list_order" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="update_order" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="allow_comment" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="lock_comment" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="allow_trackback" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="notify_message" /&gt;<BR>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;<BR>&nbsp;&nbsp; &nbsp;&lt;conditions&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" /&gt;<BR>&nbsp;&nbsp; &nbsp;&lt;/conditions&gt;<BR>&lt;/query&gt;</P>
<P></P></div><div class="eArea xe_content xe_dr_txt"><P>click_count 의 매핑변수 값이 true이면 해당 컬럼을 +1 증가합니다.</P></div><div class="eArea xe_content xe_dr_txt"><P></P>
<DIV>$args-&gt;document_srl = $this-&gt;document_srl;</DIV>
<DIV>$args-&gt;<SPAN style="COLOR: rgb(255,0,0)">incr_readed_count</SPAN> =<SPAN style="COLOR: rgb(255,0,0)"> true</SPAN>;</DIV>
<DIV>$output = executeQuery('document.getDocument', $args);</DIV>
<DIV><BR></DIV>
<P></P></div>
미니미 2009.12.07 19:20:26
복원
<div class="eArea xe_content xe_dr_txt"><P><A href="http://doc.xpreessengine.com/classXmlQueryParser.html" target=_blank>http://doc.xpreessengine.com/classXmlQueryParser.html</A>&nbsp;(클래스 구조)</P></div><div class="eArea xe_content xe_dr_index"><UL class=toc>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#1249368742400-1">개요</A></LI>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#1249368742400-2">사용법</A></LI>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#h1249628444840">XML sample</A></LI>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#Selectquery예제">Select query 예제</A></LI>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#h1249627751923">Join Select 예제</A></LI>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#h1249627778964">Letf Join Select 예제</A></LI>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#1249368742400-5">Insert 예제</A></LI>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#1249368742400-6">update 예제</A></LI>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#1249368742400-7">delete 예제</A></LI>
<LI class=toc3><A href="./?document_srl=18180631&amp;mid=wiki&amp;act=dispWikiEditPage&amp;entry=1.+XML+Query+%EC%82%AC%EC%9A%A9%EB%B2%95#1249368742400-7">Select Click Count 예제</A></LI></UL></div><div class="eArea xe_content xe_dr_hx"><H3 id=1249368742400-1>개요</H3></div><div class="eArea xe_content xe_dr_txt"><OL>
<LI>XpressEngine는 query문을 직접 사용하지 않습니다.</LI>
<LI>이는 다양한 DBMS를 지원하기 위해서입니다.</LI>
<LI>XML Query문의 확장자는 .xml 입니다.</LI></OL></div><div class="eArea xe_content xe_dr_hx"><H3 id=1249368742400-2>사용법</H3></div><div class="eArea xe_content xe_dr_txt"><P>모듈 또는 애드온, 플러그인등에서 아래와 같이 사용할 수 있습니다.<BR><BR>&nbsp;&nbsp; 1. $args-&gt;name = "zero";<BR>&nbsp;&nbsp; 2. $output = executeQuery("member.getMemberInfo", $args);<BR><BR>XML Query를 호출하여 실제 DB의 데이터를 받거나 조작하기 위해서 사용되는 executeQuery() 함수는 DB::executeQuery()의 alias입니다.<BR><BR>&nbsp;&nbsp; 1. function executeQuery($xml_query_name, $args = null);<BR><BR>첫번째 인자로 실행하고자 하는 xml query의 이름을 받게 됩니다.<BR>이름은 모듈명.쿼리ID 로 이루어집니다.<BR><BR>$args는 null일수도 있고 해당 xml query에서 필요시 stdclass의 variables type으로 변수의 key, value를 설정후 인자로 넘기게 됩니다.<BR><BR>결과는 Object class의 객체로 return 됩니다.<BR>쿼리 실패는 $output-&gt;toBool()이 false일 경우이고 true라면 쿼리는 정상적으로 실행이 된 것을 의미합니다.<BR>select문의 결과 데이터는 $output-&gt;data 변수에 담겨져 return 됩니다.</P></div><div class="eArea xe_content xe_dr_hx"><H3 id=h1249628444840>XML sample</H3></div><div class="eArea xe_content xe_dr_txt"><OL class=code>
<LI>&lt;query id="쿼리아이디" action="select|update|delete|insert"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;tables&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;table name="원테이블이름" alias="alias" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<BR>&nbsp;&nbsp;&nbsp; &lt;/tables&gt;<BR><BR>&nbsp;&nbsp;&nbsp; &lt;columns&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;column name="컬럼명" alias="alias" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<BR>&nbsp;&nbsp;&nbsp; &lt;/columns&gt;<BR><BR>&nbsp;&nbsp;&nbsp; &lt;conditions&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group pipe="연결연산자"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/group&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<BR>&nbsp;&nbsp;&nbsp; &lt;/conditions&gt;<BR><BR>&nbsp;&nbsp;&nbsp; &lt;navigation&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;index var="이름" default="기본값" order="desc|asc" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;list_count var="변수명" default="기본값" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page_count var="변수명" default="기본값" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page var="변수명" default="변수명" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/navigation&gt;<BR><BR>&nbsp;&nbsp;&nbsp; &lt;groups&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group column="GroupBy 대상" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/groups&gt;<BR>&lt;/query&gt;</LI></OL></div><div class="eArea xe_content xe_dr_txt"><UL>
<LI>
<P>&lt;query&gt; 의 attribute</P>
<UL>
<LI>id : 쿼리를 찾을 수 있는 아이디입니다. module.query_id 로 query xml 파일을 찾고 사용하게 됩니다.<BR>action : select, update, delete, insert 4가지 종류가 있습니다.</LI></UL>
<P>&nbsp;</P></LI>
<LI>&lt;tables&gt;
<UL>
<LI>테이블 조인시 여러개의 &lt;table&gt; 을 사용할 수 있습니다.<BR>name : 원테이블 명 (제로보드XE에서 prefix는 무시) alias : join또는 다른 용도로 원테이블명을 바꾸어 사용할 경우</LI></UL></LI>
<LI>&lt;columns&gt;
<UL>
<LI>처리하고자 하는 컬럼명을 입력하시면 됩니다. name : 컬럼명 alias : 다른 이름으로 바꾸어 결과를 만들고자 할 경우 지정</LI></UL></LI>
<LI>&lt;conditions&gt;
<UL>
<LI>조건절을 구성합니다.</LI>
<LI>조건절을 여러개의 그룹으로 사용하고자 할 때에는 &lt;group&gt; 태그를 이용해서 묶어 주실 수 있습니다.</LI></UL></LI>
<LI>&lt;group&gt; ... &lt;/group&gt;
<UL>
<LI>조건절을 그룹으로 사용할 경우 pipe="and|or" 를 이용하여 그룹끼리의 조건을 지정할 수 있습니다.</LI></UL></LI>
<LI>&lt;condition&gt;
<UL>
<LI>
<P>operation : 아래와 같은 연산자로 처리가 됩니다.</P>
<DIV style="BACKGROUND-COLOR: rgb(249,249,216)" class=section>equal : column = (var|default)<BR>more : column &gt;= (var|default)<BR>excess : column &gt; (var|default)<BR>less : column &lt;= (var|default)<BR>below : column &lt; (var|default)<BR>notequal : column != (var|default)<BR>notnull : column is not null<BR>null : column is null<BR>like_prefix : column like '%var|default'<BR>like_tail : column like 'var|default%'<BR>like : column like '%var|default%'<BR>in : column in (var|default)</DIV>
<P>&nbsp;</P></LI>
<LI>column : 컬럼명을 지정할 수 있습니다.</LI>
<LI>var : executeQuery()함수에서 2번째 인자의 key값을 지정할 수 있습니다.</LI>
<LI>
<P>filter : var 값의 조건을 filtering합니다. 아래와 같은 filter를 지원합니다.</P>
<DIV style="BACKGROUND-COLOR: rgb(249,249,216)" class=section>email, email_address : 메일 형식<BR>homepage : http|https://등의 홈페이지 형식<BR>userid, user_id : 제로보드XE의 사용자 아이디 형식 (첫글자는 영문, 2번째부터는 숫자+영문+_)<BR>number : 숫자만 허용<BR>alpha : 영문자만 허용<BR>alpha_number : 숫자+영문자만 허용</DIV></LI>
<LI>
<P>default : var값이 null일 경우 default값으로 대체됩니다. 아래와 같은 함수값을 가질 수도 있습니다.</P>
<DIV style="BACKGROUND-COLOR: rgb(249,249,216)" class=section>ipaddress() : 접속자의 ip 주소<BR>unixtime() : unix time (php의 time()함수)<BR>curdate() : YYYYMMDDHHIISS<BR>plus(int count) : column = column + count<BR>minus(int count) : column = column - count</DIV></LI>
<LI>notnull : not null check를 하게 됩니다. minlength : 최소길이 체크 maxlength : 최대길이 체크 pipe : and|or등의 조건을 지정할 수 있습니다.</LI></UL></LI>
<LI>
<P>&lt;navigation&gt; : navigation은 정렬순서(order by) 또는 페이징을 지원합니다.</P>
<UL>
<LI>
<P>&lt;index&gt; 정렬할 컬럼과 정렬방법을 지정할 수 있습니다.</P>
<DIV style="BACKGROUND-COLOR: rgb(249,249,216)" class=section>var : 대상 컬럼명을 담은 변수명<BR>default : var값이 없을 경우 기본으로 정렬할 컬럼명 지정<BR>order : asc|desc</DIV></LI>
<LI>
<P>&lt;list_count&gt; 페이징을 한 결과를 받을 수 있습니다.</P>
<DIV style="BACKGROUND-COLOR: rgb(249,249,216)" class=section>var : 목록의 rows를 지정<BR>default : var값이 없을 경우 기본 rows 값</DIV></LI>
<LI>
<P>&lt;page_count&gt; 페이징 계산시에 하단 페이지 네비게이션의 수를 지정</P>
<DIV style="BACKGROUND-COLOR: rgb(249,249,216)" class=section>var : 페이징 네비게이션의 수<BR>default : var값이 없을 경우 기본 페이징 네비게이션의 수</DIV></LI>
<LI>
<P>&lt;page&gt; 현재 몇번째 페이지인지를 지정할 수 있습니다.</P>
<DIV style="BACKGROUND-COLOR: rgb(249,249,216)" class=section>var : 현재 몇번째 페이지인지를 지정할 변수<BR>default : var값이 지정되지 않았을 경우 페이지 번호</DIV></LI></UL>
<P>&nbsp;</P></LI>
<LI>&lt;groups&gt; : group by 절을 사용할 수 있습니다.</LI></UL></div><div class="eArea xe_content xe_dr_hx"><H3 id=Selectquery예제>Select query 예제</H3></div><div class="eArea xe_content xe_dr_txt"><UL>
<LI>
<P>member.getMemberList : member테이블에서 특정 조건을 가진 회원들을 페이징을 하면서 select</P>
<OL class=code>
<LI>&lt;query id="getMemberList" action="select"&gt;<BR>&lt;tables&gt;<BR>&nbsp;&nbsp; &lt;table name="member" /&gt;<BR>&lt;/tables&gt;</LI>
<LI><BR>&lt;columns&gt;<BR>&nbsp;&nbsp; &lt;column name="*" /&gt;<BR>&lt;/columns&gt;</LI>
<LI><BR>&lt;conditions&gt;<BR>&nbsp; &nbsp; &lt;condition operation="equal" column="is_admin" var="is_admin" /&gt;<BR>&nbsp;&nbsp; &lt;condition operation="equal" column="denied" var="is_denied" pipe="and" /&gt;<BR>&nbsp;&nbsp; &lt;group pipe="and"&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_id" var="s_user_id" /&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_name" var="s_user_name" pipe="or" /&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="nick_name" var="s_nick_name" pipe="or" /&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="email_address" var="s_email_address" pipe="or" /&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="regdate" var="s_regdate" pipe="or" /&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="last_login" var="s_last_login" pipe="or" /&gt;<BR>&nbsp; &nbsp; &lt;/group&gt;<BR>&lt;/conditions&gt;<BR><BR>&lt;navigation&gt;<BR>&nbsp; &nbsp; &lt;index var="sort_index" default="member_srl" order="desc" /&gt;<BR>&nbsp; &nbsp; &lt;list_count var="list_count" default="20" /&gt;<BR>&nbsp; &nbsp; &lt;page_count var="page_count" default="10" /&gt;<BR>&nbsp; &nbsp; &lt;page var="page" default="1" /&gt;<BR>&lt;/navigation&gt;<BR>&lt;/query&gt;</LI></OL></LI>
<LI>document.getMonthlyArchivedList : 모듈을 '년월'일을 기준으로 group by 한 결과를 가져옴</LI></UL></div><div class="eArea xe_content xe_dr_txt"><OL style="MARGIN-LEFT: 2em" class=code>
<LI>&lt;query id="getMonthlyArchivedList" action="select"&gt;<BR>&lt;tables&gt;<BR>&nbsp; &nbsp; &lt;table name="documents" /&gt;<BR>&lt;/tables&gt;<BR><BR>&lt;columns&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="substr(regdate,1,6)" alias="month"/&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="count(*)" alias="count" /&gt;<BR>&lt;/columns&gt;<BR><BR>&lt;conditions&gt;<BR>&nbsp;&nbsp; &lt;condition operation="in" column="module_srl" var="module_srl" filter="number" /&gt;<BR>&lt;/conditions&gt;<BR><BR>&lt;groups&gt;<BR>&nbsp; &nbsp; &lt;group column="substr(regdate,1,6)" /&gt;<BR>&lt;/groups&gt;<BR>&lt;/query&gt;</LI></OL></div><div class="eArea xe_content xe_dr_hx"><H3 id=h1249627751923>Join Select 예제</H3></div><div class="eArea xe_content xe_dr_txt"><P>document.getTrashList 예제입니다.</P></div><div class="eArea xe_content xe_dr_txt"><P></P>
<DIV>&lt;query id="getTrashList" action="select"&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;tables&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="documents" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_trash" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;columns&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="documents.*" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.trash_srl" alias="trash_srl" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.module_srl" alias="module_srl" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.trash_date" alias="trash_date" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.description" alias="trash_description" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.ipaddress" alias="trash_ipaddress" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.user_id" alias="trash_user_id" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.user_name" alias="trash_user_name" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.nick_name" alias="trash_nick_name" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.member_srl" alias="trash_member_srl" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;conditions&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_trash.document_srl" default="documents.document_srl" notnull="notnull" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="in" column="document_trash.module_srl" var="module_srl" filter="number" pipe="and" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_trash.member_srl" var="member_srl" filter="number" pipe="and" /&gt;</DIV>
<DIV><BR></DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;group pipe="and"&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.title" var="s_title" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.content" var="s_content" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.user_name" var="s_user_name" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.user_id" var="s_user_id" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.nick_name" var="s_nick_name" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.email_address" var="s_email_addres" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.homepage" var="s_homepage" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.tags" var="s_tags" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="documents.is_secret" var="s_is_secret" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="documents.member_srl" var="s_member_srl" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.readed_count" var="s_readed_count" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.voted_count" var="s_voted_count" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.comment_count" var="s_comment_count" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.trackback_count" var="s_trackback_count" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.uploaded_count" var="s_uploaded_count" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.regdate" var="s_regdate" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.last_update" var="s_last_update" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.ipaddress" var="s_ipaddress" pipe="or" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;/group&gt;</DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;/conditions&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;navigation&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;index var="sort_index" default="documents.list_order" order="order_type" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;list_count var="list_count" default="20" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;page_count var="page_count" default="10" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;page var="page" default="1" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;/navigation&gt;</DIV>
<DIV>&lt;/query&gt;</DIV>
<P></P></div><div class="eArea xe_content xe_dr_hx"><H3 id=h1249627778964>Letf Join Select 예제</H3></div><div class="eArea xe_content xe_dr_txt"><P></P>
<DIV>&lt;query id="getDocumentsExtraVars" action="select"&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;tables&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_extra_keys" alias="extra_keys" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_extra_vars" alias="extra_vars" type="left join"&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;conditions&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="extra_keys.module_srl" default="extra_vars.module_srl" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="in" column="extra_vars.document_srl" var="document_srl" pipe="and" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="extra_keys.eid" default="extra_vars.eid" pipe="and" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/conditions&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;/table&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;columns&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.module_srl" alias="module_srl" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_name" alias="name" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_type" alias="type" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_is_required" alias="is_required" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_search" alias="search" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_default" alias="default" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_desc" alias="desc" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_idx" alias="idx" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.document_srl" alias="document_srl" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.lang_code" alias="lang_code" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.value" alias="value" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.eid" alias="eid" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;navigation&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;index var="sort_index" default="extra_keys.var_idx" order="asc" /&gt;</DIV>
<DIV>&nbsp;&nbsp; &nbsp;&lt;/navigation&gt;</DIV>
<DIV>&lt;/query&gt;</DIV>
<DIV><BR></DIV>
<P></P></div><div class="eArea xe_content xe_dr_hx"><H3 id=1249368742400-5>Insert 예제</H3></div><div class="eArea xe_content xe_dr_txt"><UL>
<LI>
<P>document.insertCategory : 문서 카테고리 추가</P>
<OL class=code>
<LI>&lt;query id="insertCategory" action="insert"&gt;<BR>&lt;tables&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<BR>&lt;/tables&gt;<BR><BR>&lt;columns&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="module_srl" var="module_srl" filter="number" default="0" notnull="notnull" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" notnull="notnull" minlength="2" maxlength="250" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="document_count" var="document_count" default="0" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="regdate" var="regdate" default="curdate()" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" default="0" /&gt;<BR>&lt;/columns&gt;<BR>&lt;/query&gt;</LI></OL></LI></UL></div><div class="eArea xe_content xe_dr_hx"><H3 id=1249368742400-6>update 예제</H3></div><div class="eArea xe_content xe_dr_txt"><UL>
<LI>
<P>document.updateCategory : 특정 카테고리의 제목이나 순서, 최근 수정일을 변경</P>
<OL class=code>
<LI>&lt;query id="updateCategory" action="update"&gt;<BR>&lt;tables&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<BR>&lt;/tables&gt;<BR><BR>&lt;columns&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" /&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<BR>&lt;/columns&gt;<BR><BR>&lt;conditions&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<BR>&lt;/conditions&gt;<BR>&lt;/query&gt;</LI></OL></LI></UL></div><div class="eArea xe_content xe_dr_hx"><H3 id=1249368742400-7>delete 예제</H3></div><div class="eArea xe_content xe_dr_txt"><UL>
<LI>
<P>document.deleteCategory : 특정 카테고리를 삭제</P>
<OL class=code>
<LI>&lt;query id="deleteCategory" action="delete"&gt;<BR>&lt;tables&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<BR>&lt;/tables&gt;<BR><BR>&lt;conditions&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<BR>&lt;/conditions&gt;<BR>&lt;/query&gt;</LI></OL></LI></UL></div><div class="eArea xe_content xe_dr_hx"><H3 id=1249368742400-7>Select Click Count 예제</H3></div><div class="eArea xe_content xe_dr_txt"><P>Select 시 조회수 등의 정수의 숫자 컬럼을 +1 하는 기능입니다.</P>
<P>Cubrid의 경우에는 incr()이라는 함수를 사용하고 다른 데이타베이스의 경우 해당 컬럼을 Select후 Update 합니다.</P>
<P>XE Core 1.2.6 이상 버전에서&nbsp;지원하고 있습니다.</P>
<P></P>
<P>document.getDocument XML Query에 Click Count 를 적용해 본 예제입니다.</P>
<P>select시 정수 숫자 컬럼 node에 attribute는 click_count, 값은 Argument로 매핑되는 변수명을 기입합니다.</P>
<P></P></div><div class="eArea xe_content xe_dr_txt"><P>&lt;query id="getDocument" action="select"&gt;<BR>&nbsp;&nbsp; &nbsp;&lt;tables&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="documents" /&gt;<BR>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</P>
<P>&nbsp;&nbsp; &nbsp;&lt;columns&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_srl" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="module_srl" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="category_srl" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="lang_code" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="is_notice" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="is_secret" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title_bold" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title_color" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="content" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="readed_count" <B><SPAN style="COLOR: rgb(255,0,0)">click_count="incr_readed_count"</SPAN></B>/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="voted_count" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="blamed_count" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="comment_count" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="trackback_count" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="uploaded_count" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="password" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="user_id" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="user_name" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="nick_name" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="member_srl" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="email_address" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="homepage" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="tags" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="regdate" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="last_update" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="last_updater" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="ipaddress" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="list_order" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="update_order" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="allow_comment" &nbsp;/&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="lock_comment" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="allow_trackback" /&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="notify_message" /&gt;<BR>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;<BR>&nbsp;&nbsp; &nbsp;&lt;conditions&gt;<BR>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" /&gt;<BR>&nbsp;&nbsp; &nbsp;&lt;/conditions&gt;<BR>&lt;/query&gt;</P>
<P></P></div><div class="eArea xe_content xe_dr_txt"><P>click_count 의 매핑변수 값이 true이면 해당 컬럼을 +1 증가합니다.</P></div><div class="eArea xe_content xe_dr_txt"><P></P>
<DIV>$args-&gt;document_srl = $this-&gt;document_srl;</DIV>
<DIV>$args-&gt;<SPAN style="COLOR: rgb(255,0,0)">incr_readed_count</SPAN> =<SPAN style="COLOR: rgb(255,0,0)"> true</SPAN>;</DIV>
<DIV>$output = executeQuery('document.getDocument', $args);</DIV>
<DIV><BR></DIV>
<P></P></div>
미니미 2009.12.07 19:19:01
복원
<div class="eArea xe_content xe_dr_txt"><p><a href="http://doc.zeroboard.com/classXmlQueryParser.html" class="external" title="http://doc.zeroboard.com/classXmlQueryParser.html">http://doc.zeroboard.com/classXmlQueryParser.html</a> (클래스 구조)</p></div><div class="eArea xe_content xe_dr_index"><ul class="toc"><li class="toc3"><a href="#1249368742400-1">개요</a></li><li class="toc3"><a href="#1249368742400-2">사용법</a></li><li class="toc3"><a href="#h1249628444840">XML sample</a></li><li class="toc3"><a href="#Selectquery예제">Select query 예제</a></li><li class="toc3"><a href="#h1249627751923">Join Select 예제</a></li><li class="toc3"><a href="#h1249627778964">Letf Join Select 예제</a></li><li class="toc3"><a href="#1249368742400-5">Insert 예제</a></li><li class="toc3"><a href="#1249368742400-6">update 예제</a></li><li class="toc3"><a href="#1249368742400-7">delete 예제</a></li><li class="toc3"><a href="#1249368742400-7">Select Click Count 예제</a></li></ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-1">개요</h3></div><div class="eArea xe_content xe_dr_txt"><ol>
<li>XpressEngine는 query문을 직접 사용하지 않습니다.</li>
<li>이는 다양한 DBMS를 지원하기 위해서입니다.</li>
<li>XML Query문의 확장자는 .xml 입니다.</li>
</ol></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-2">사용법</h3></div><div class="eArea xe_content xe_dr_txt"><p>모듈 또는 애드온, 플러그인등에서 아래와 같이 사용할 수 있습니다.<br><br>&nbsp;&nbsp; 1. $args-&gt;name = "zero";<br>&nbsp;&nbsp; 2. $output = executeQuery("member.getMemberInfo", $args);<br><br>XML Query를 호출하여 실제 DB의 데이터를 받거나 조작하기 위해서 사용되는 executeQuery() 함수는 DB::executeQuery()의 alias입니다.<br><br>&nbsp;&nbsp; 1. function executeQuery($xml_query_name, $args = null);<br><br>첫번째 인자로 실행하고자 하는 xml query의 이름을 받게 됩니다.<br>이름은 모듈명.쿼리ID 로 이루어집니다.<br><br>$args는 null일수도 있고 해당 xml query에서 필요시 stdclass의 variables type으로 변수의 key, value를 설정후 인자로 넘기게 됩니다.<br><br>결과는 Object class의 객체로 return 됩니다.<br>쿼리 실패는 $output-&gt;toBool()이 false일 경우이고 true라면 쿼리는 정상적으로 실행이 된 것을 의미합니다.<br>select문의 결과 데이터는 $output-&gt;data 변수에 담겨져 return 됩니다.</p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1249628444840">XML sample</h3></div><div class="eArea xe_content xe_dr_txt"><ol class="code">
<li>&lt;query id="쿼리아이디" action="select|update|delete|insert"&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;tables&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;table name="원테이블이름" alias="alias" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp; &lt;/tables&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;columns&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;column name="컬럼명" alias="alias" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp; &lt;/columns&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;conditions&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group pipe="연결연산자"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/group&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp; &lt;/conditions&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;navigation&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;index var="이름" default="기본값" order="desc|asc" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;list_count var="변수명" default="기본값" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page_count var="변수명" default="기본값" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page var="변수명" default="변수명" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/navigation&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;groups&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group column="GroupBy 대상" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/groups&gt;<br>
&lt;/query&gt;</li>
</ol></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>&lt;query&gt; 의 attribute</p>
<ul>
<li>id : 쿼리를 찾을 수 있는 아이디입니다. module.query_id 로 query xml 파일을 찾고 사용하게 됩니다.<br>
action : select, update, delete, insert 4가지 종류가 있습니다.</li>
</ul>
<p>&nbsp;</p>
</li>
<li>&lt;tables&gt;
<ul>
<li>테이블 조인시 여러개의 &lt;table&gt; 을 사용할 수 있습니다.<br>
name : 원테이블 명 (제로보드XE에서 prefix는 무시) alias : join또는 다른 용도로 원테이블명을 바꾸어 사용할 경우</li>
</ul>
</li>
<li>&lt;columns&gt;
<ul>
<li>처리하고자 하는 컬럼명을 입력하시면 됩니다. name : 컬럼명 alias : 다른 이름으로 바꾸어 결과를 만들고자 할 경우 지정</li>
</ul>
</li>
<li>&lt;conditions&gt;
<ul>
<li>조건절을 구성합니다.</li>
<li>조건절을 여러개의 그룹으로 사용하고자 할 때에는 &lt;group&gt; 태그를 이용해서 묶어 주실 수 있습니다.</li>
</ul>
</li>
<li>&lt;group&gt; ... &lt;/group&gt;
<ul>
<li>조건절을 그룹으로 사용할 경우 pipe="and|or" 를 이용하여 그룹끼리의 조건을 지정할 수 있습니다.</li>
</ul>
</li>
<li>&lt;condition&gt;
<ul>
<li>
<p>operation : 아래와 같은 연산자로 처리가 됩니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">equal : column = (var|default)<br>
more : column &gt;= (var|default)<br>
excess : column &gt; (var|default)<br>
less : column &lt;= (var|default)<br>
below : column &lt; (var|default)<br>
notequal : column != (var|default)<br>
notnull : column is not null<br>
null : column is null<br>
like_prefix : column like '%var|default'<br>
like_tail : column like 'var|default%'<br>
like : column like '%var|default%'<br>
in : column in (var|default)</div>
<p>&nbsp;</p>
</li>
<li>column : 컬럼명을 지정할 수 있습니다.</li>
<li>var : executeQuery()함수에서 2번째 인자의 key값을 지정할 수 있습니다.</li>
<li>
<p>filter : var 값의 조건을 filtering합니다. 아래와 같은 filter를 지원합니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">email, email_address : 메일 형식<br>
homepage : http|https://등의 홈페이지 형식<br>
userid, user_id : 제로보드XE의 사용자 아이디 형식 (첫글자는 영문, 2번째부터는 숫자+영문+_)<br>
number : 숫자만 허용<br>
alpha : 영문자만 허용<br>
alpha_number : 숫자+영문자만 허용</div>
</li>
<li>
<p>default : var값이 null일 경우 default값으로 대체됩니다. 아래와 같은 함수값을 가질 수도 있습니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">ipaddress() : 접속자의 ip 주소<br>
unixtime() : unix time (php의 time()함수)<br>
curdate() : YYYYMMDDHHIISS<br>
plus(int count) : column = column + count<br>
minus(int count) : column = column - count</div>
</li>
<li>notnull : not null check를 하게 됩니다. minlength : 최소길이 체크 maxlength : 최대길이 체크 pipe : and|or등의 조건을 지정할 수 있습니다.</li>
</ul>
</li>
<li>
<p>&lt;navigation&gt; : navigation은 정렬순서(order by) 또는 페이징을 지원합니다.</p>
<ul>
<li>
<p>&lt;index&gt; 정렬할 컬럼과 정렬방법을 지정할 수 있습니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">var : 대상 컬럼명을 담은 변수명<br>
default : var값이 없을 경우 기본으로 정렬할 컬럼명 지정<br>
order : asc|desc</div>
</li>
<li>
<p>&lt;list_count&gt; 페이징을 한 결과를 받을 수 있습니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">var : 목록의 rows를 지정<br>
default : var값이 없을 경우 기본 rows 값</div>
</li>
<li>
<p>&lt;page_count&gt; 페이징 계산시에 하단 페이지 네비게이션의 수를 지정</p>
<div class="section" style="background-color: rgb(249, 249, 216);">var : 페이징 네비게이션의 수<br>
default : var값이 없을 경우 기본 페이징 네비게이션의 수</div>
</li>
<li>
<p>&lt;page&gt; 현재 몇번째 페이지인지를 지정할 수 있습니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">var : 현재 몇번째 페이지인지를 지정할 변수<br>
default : var값이 지정되지 않았을 경우 페이지 번호</div>
</li>
</ul>
<p>&nbsp;</p>
</li>
<li>&lt;groups&gt; : group by 절을 사용할 수 있습니다.</li>
</ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="Selectquery예제">Select query 예제</h3></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>member.getMemberList : member테이블에서 특정 조건을 가진 회원들을 페이징을 하면서 select</p>
<ol class="code">
<li>&lt;query id="getMemberList" action="select"&gt;<br>
&lt;tables&gt;<br>
&nbsp;&nbsp; &lt;table name="member" /&gt;<br>
&lt;/tables&gt;</li>
<li><br>
&lt;columns&gt;<br>
&nbsp;&nbsp; &lt;column name="*" /&gt;<br>
&lt;/columns&gt;</li>
<li><br>
&lt;conditions&gt;<br>
&nbsp; &nbsp; &lt;condition operation="equal" column="is_admin" var="is_admin" /&gt;<br>
&nbsp;&nbsp; &lt;condition operation="equal" column="denied" var="is_denied" pipe="and" /&gt;<br>
&nbsp;&nbsp; &lt;group pipe="and"&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_id" var="s_user_id" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_name" var="s_user_name" pipe="or" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="nick_name" var="s_nick_name" pipe="or" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="email_address" var="s_email_address" pipe="or" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="regdate" var="s_regdate" pipe="or" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="last_login" var="s_last_login" pipe="or" /&gt;<br>
&nbsp; &nbsp; &lt;/group&gt;<br>
&lt;/conditions&gt;<br>
<br>
&lt;navigation&gt;<br>
&nbsp; &nbsp; &lt;index var="sort_index" default="member_srl" order="desc" /&gt;<br>
&nbsp; &nbsp; &lt;list_count var="list_count" default="20" /&gt;<br>
&nbsp; &nbsp; &lt;page_count var="page_count" default="10" /&gt;<br>
&nbsp; &nbsp; &lt;page var="page" default="1" /&gt;<br>
&lt;/navigation&gt;<br>
&lt;/query&gt;</li>
</ol>
</li>
<li>document.getMonthlyArchivedList : 모듈을 '년월'일을 기준으로 group by 한 결과를 가져옴</li>
</ul></div><div class="eArea xe_content xe_dr_txt"><ol class="code" style="margin-left: 2em;">
<li>&lt;query id="getMonthlyArchivedList" action="select"&gt;<br>
&lt;tables&gt;<br>
&nbsp; &nbsp; &lt;table name="documents" /&gt;<br>
&lt;/tables&gt;<br>
<br>
&lt;columns&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="substr(regdate,1,6)" alias="month"/&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="count(*)" alias="count" /&gt;<br>
&lt;/columns&gt;<br>
<br>
&lt;conditions&gt;<br>
&nbsp;&nbsp; &lt;condition operation="in" column="module_srl" var="module_srl" filter="number" /&gt;<br>
&lt;/conditions&gt;<br>
<br>
&lt;groups&gt;<br>
&nbsp; &nbsp; &lt;group column="substr(regdate,1,6)" /&gt;<br>
&lt;/groups&gt;<br>
&lt;/query&gt;</li>
</ol></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1249627751923">Join Select 예제</h3></div><div class="eArea xe_content xe_dr_txt"><p>document.getTrashList 예제입니다.</p></div><div class="eArea xe_content xe_dr_txt"><p></p><div>&lt;query id="getTrashList" action="select"&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;tables&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="documents" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_trash" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;columns&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="documents.*" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.trash_srl" alias="trash_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.module_srl" alias="module_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.trash_date" alias="trash_date" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.description" alias="trash_description" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.ipaddress" alias="trash_ipaddress" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.user_id" alias="trash_user_id" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.user_name" alias="trash_user_name" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.nick_name" alias="trash_nick_name" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.member_srl" alias="trash_member_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;conditions&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_trash.document_srl" default="documents.document_srl" notnull="notnull" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="in" column="document_trash.module_srl" var="module_srl" filter="number" pipe="and" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_trash.member_srl" var="member_srl" filter="number" pipe="and" /&gt;</div><div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;group pipe="and"&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.title" var="s_title" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.content" var="s_content" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.user_name" var="s_user_name" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.user_id" var="s_user_id" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.nick_name" var="s_nick_name" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.email_address" var="s_email_addres" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.homepage" var="s_homepage" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.tags" var="s_tags" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="documents.is_secret" var="s_is_secret" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="documents.member_srl" var="s_member_srl" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.readed_count" var="s_readed_count" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.voted_count" var="s_voted_count" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.comment_count" var="s_comment_count" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.trackback_count" var="s_trackback_count" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.uploaded_count" var="s_uploaded_count" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.regdate" var="s_regdate" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.last_update" var="s_last_update" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.ipaddress" var="s_ipaddress" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;/group&gt;</div><div><br></div><div><br></div><div>&nbsp;&nbsp; &nbsp;&lt;/conditions&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;navigation&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;index var="sort_index" default="documents.list_order" order="order_type" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;list_count var="list_count" default="20" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;page_count var="page_count" default="10" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;page var="page" default="1" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/navigation&gt;</div><div>&lt;/query&gt;</div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1249627778964">Letf Join Select 예제</h3></div><div class="eArea xe_content xe_dr_txt"><p></p><div>&lt;query id="getDocumentsExtraVars" action="select"&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;tables&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_extra_keys" alias="extra_keys" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_extra_vars" alias="extra_vars" type="left join"&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;conditions&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="extra_keys.module_srl" default="extra_vars.module_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="in" column="extra_vars.document_srl" var="document_srl" pipe="and" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="extra_keys.eid" default="extra_vars.eid" pipe="and" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/conditions&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;/table&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;columns&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.module_srl" alias="module_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_name" alias="name" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_type" alias="type" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_is_required" alias="is_required" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_search" alias="search" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_default" alias="default" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_desc" alias="desc" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_idx" alias="idx" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.document_srl" alias="document_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.lang_code" alias="lang_code" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.value" alias="value" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.eid" alias="eid" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;navigation&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;index var="sort_index" default="extra_keys.var_idx" order="asc" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/navigation&gt;</div><div>&lt;/query&gt;</div><div><br></div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-5">Insert 예제</h3></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.insertCategory : 문서 카테고리 추가</p>
<ol class="code">
<li>&lt;query id="insertCategory" action="insert"&gt;<br>
&lt;tables&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>
&lt;/tables&gt;<br>
<br>
&lt;columns&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="module_srl" var="module_srl" filter="number" default="0" notnull="notnull" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" notnull="notnull" minlength="2" maxlength="250" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="document_count" var="document_count" default="0" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="regdate" var="regdate" default="curdate()" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" default="0" /&gt;<br>
&lt;/columns&gt;<br>
&lt;/query&gt;</li>
</ol>
</li>
</ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-6">update 예제</h3></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.updateCategory : 특정 카테고리의 제목이나 순서, 최근 수정일을 변경</p>
<ol class="code">
<li>&lt;query id="updateCategory" action="update"&gt;<br>
&lt;tables&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>
&lt;/tables&gt;<br>
<br>
&lt;columns&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<br>
&lt;/columns&gt;<br>
<br>
&lt;conditions&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>
&lt;/conditions&gt;<br>
&lt;/query&gt;</li>
</ol>
</li>
</ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-7">delete 예제</h3></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.deleteCategory : 특정 카테고리를 삭제</p>
<ol class="code">
<li>&lt;query id="deleteCategory" action="delete"&gt;<br>
&lt;tables&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>
&lt;/tables&gt;<br>
<br>
&lt;conditions&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>
&lt;/conditions&gt;<br>
&lt;/query&gt;</li>
</ol>
</li>
</ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-7">Select Click Count 예제</h3></div><div class="eArea xe_content xe_dr_txt"><p>Select 시 조회수 등의 정수의 숫자 컬럼을 +1 하는 기능입니다.</p><p>Cubrid의 경우에는 incr()이라는 함수를 사용하고 다른 데이타베이스의 경우 해당 컬럼을 Select후 Update 합니다.</p><p>XE Core 1.2.6 이상 버전에서&nbsp;지원하고 있습니다.</p><p></p><p>document.getDocument XML Query에 Click Count 를 적용해 본 예제입니다.</p><p>select시 정수 숫자 컬럼 node에 attribute는 click_count, 값은 Argument로 매핑되는 변수명을 기입합니다.</p><p></p></div><div class="eArea xe_content xe_dr_txt"><p>&lt;query id="getDocument" action="select"&gt;<br>&nbsp;&nbsp; &nbsp;&lt;tables&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="documents" /&gt;<br>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</p><p>&nbsp;&nbsp; &nbsp;&lt;columns&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_srl" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="module_srl" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="category_srl" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="lang_code" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="is_notice" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="is_secret" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title_bold" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="title_color" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="content" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="readed_count" <b><span style="color: rgb(255, 0, 0); ">click_count="incr_readed_count"</span></b>/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="voted_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="blamed_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="comment_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="trackback_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="uploaded_count" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="password" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="user_id" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="user_name" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="nick_name" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="member_srl" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="email_address" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="homepage" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="tags" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="regdate" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="last_update" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="last_updater" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="ipaddress" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="list_order" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="update_order" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="allow_comment" &nbsp;/&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="lock_comment" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="allow_trackback" /&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="notify_message" /&gt;<br>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;<br>&nbsp;&nbsp; &nbsp;&lt;conditions&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" /&gt;<br>&nbsp;&nbsp; &nbsp;&lt;/conditions&gt;<br>&lt;/query&gt;</p><p></p></div><div class="eArea xe_content xe_dr_txt"><p>click_count 의 매핑변수 값이 true이면 해당 컬럼을 +1 증가합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p></p><div>$args-&gt;document_srl = $this-&gt;document_srl;</div><div>$args-&gt;<span style="color: rgb(255, 0, 0); ">incr_readed_count</span> =<span style="color: rgb(255, 0, 0); "> true</span>;</div><div>$output = executeQuery('document.getDocument', $args);</div><div><br></div><p></p></div>
sol 2009.10.14 13:56:20
복원
<div class="eArea xe_content xe_dr_txt"><p><a href="http://doc.zeroboard.com/classXmlQueryParser.html" class="external" title="http://doc.zeroboard.com/classXmlQueryParser.html">http://doc.zeroboard.com/classXmlQueryParser.html</a> (클래스 구조)</p></div><div class="eArea xe_content xe_dr_index"><ul class="toc"><li class="toc3"><a href="#1249368742400-1">개요</a></li><li class="toc3"><a href="#1249368742400-2">사용법</a></li><li class="toc3"><a href="#h1249628444840">XML sample</a></li><li class="toc3"><a href="#Selectquery%EC%98%88%EC%A0%9C">Select query 예제</a></li><li class="toc3"><a href="#h1249627751923">Join Select 예제</a></li><li class="toc3"><a href="#h1249627778964">Letf Join Select 예제</a></li><li class="toc3"><a href="#1249368742400-5">Insert 예제</a></li><li class="toc3"><a href="#1249368742400-6">update 예제</a></li><li class="toc3"><a href="#1249368742400-7">delete 예제</a></li></ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-1">개요</h3></div><div class="eArea xe_content xe_dr_txt"><ol>
<li>XpressEngine는 query문을 직접 사용하지 않습니다.</li>
<li>이는 다양한 DBMS를 지원하기 위해서입니다.</li>
<li>XML Query문의 확장자는 .xml 입니다.</li>
</ol></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-2">사용법</h3></div><div class="eArea xe_content xe_dr_txt"><p>모듈 또는 애드온, 플러그인등에서 아래와 같이 사용할 수 있습니다.<br><br>&nbsp;&nbsp; 1. $args-&gt;name = "zero";<br>&nbsp;&nbsp; 2. $output = executeQuery("member.getMemberInfo", $args);<br><br>XML Query를 호출하여 실제 DB의 데이터를 받거나 조작하기 위해서 사용되는 executeQuery() 함수는 DB::executeQuery()의 alias입니다.<br><br>&nbsp;&nbsp; 1. function executeQuery($xml_query_name, $args = null);<br><br>첫번째 인자로 실행하고자 하는 xml query의 이름을 받게 됩니다.<br>이름은 모듈명.쿼리ID 로 이루어집니다.<br><br>$args는 null일수도 있고 해당 xml query에서 필요시 stdclass의 variables type으로 변수의 key, value를 설정후 인자로 넘기게 됩니다.<br><br>결과는 Object class의 객체로 return 됩니다.<br>쿼리 실패는 $output-&gt;toBool()이 false일 경우이고 true라면 쿼리는 정상적으로 실행이 된 것을 의미합니다.<br>select문의 결과 데이터는 $output-&gt;data 변수에 담겨져 return 됩니다.</p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1249628444840">XML sample</h3></div><div class="eArea xe_content xe_dr_txt"><ol class="code">
<li>&lt;query id="쿼리아이디" action="select|update|delete|insert"&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;tables&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;table name="원테이블이름" alias="alias" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp; &lt;/tables&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;columns&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;column name="컬럼명" alias="alias" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp; &lt;/columns&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;conditions&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group pipe="연결연산자"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/group&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp; &lt;/conditions&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;navigation&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;index var="이름" default="기본값" order="desc|asc" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;list_count var="변수명" default="기본값" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page_count var="변수명" default="기본값" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page var="변수명" default="변수명" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/navigation&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;groups&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group column="GroupBy 대상" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/groups&gt;<br>
&lt;/query&gt;</li>
</ol></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>&lt;query&gt; 의 attribute</p>
<ul>
<li>id : 쿼리를 찾을 수 있는 아이디입니다. module.query_id 로 query xml 파일을 찾고 사용하게 됩니다.<br>
action : select, update, delete, insert 4가지 종류가 있습니다.</li>
</ul>
<p>&nbsp;</p>
</li>
<li>&lt;tables&gt;
<ul>
<li>테이블 조인시 여러개의 &lt;table&gt; 을 사용할 수 있습니다.<br>
name : 원테이블 명 (제로보드XE에서 prefix는 무시) alias : join또는 다른 용도로 원테이블명을 바꾸어 사용할 경우</li>
</ul>
</li>
<li>&lt;columns&gt;
<ul>
<li>처리하고자 하는 컬럼명을 입력하시면 됩니다. name : 컬럼명 alias : 다른 이름으로 바꾸어 결과를 만들고자 할 경우 지정</li>
</ul>
</li>
<li>&lt;conditions&gt;
<ul>
<li>조건절을 구성합니다.</li>
<li>조건절을 여러개의 그룹으로 사용하고자 할 때에는 &lt;group&gt; 태그를 이용해서 묶어 주실 수 있습니다.</li>
</ul>
</li>
<li>&lt;group&gt; ... &lt;/group&gt;
<ul>
<li>조건절을 그룹으로 사용할 경우 pipe="and|or" 를 이용하여 그룹끼리의 조건을 지정할 수 있습니다.</li>
</ul>
</li>
<li>&lt;condition&gt;
<ul>
<li>
<p>operation : 아래와 같은 연산자로 처리가 됩니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">equal : column = (var|default)<br>
more : column &gt;= (var|default)<br>
excess : column &gt; (var|default)<br>
less : column &lt;= (var|default)<br>
below : column &lt; (var|default)<br>
notequal : column != (var|default)<br>
notnull : column is not null<br>
null : column is null<br>
like_prefix : column like '%var|default'<br>
like_tail : column like 'var|default%'<br>
like : column like '%var|default%'<br>
in : column in (var|default)</div>
<p>&nbsp;</p>
</li>
<li>column : 컬럼명을 지정할 수 있습니다.</li>
<li>var : executeQuery()함수에서 2번째 인자의 key값을 지정할 수 있습니다.</li>
<li>
<p>filter : var 값의 조건을 filtering합니다. 아래와 같은 filter를 지원합니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">email, email_address : 메일 형식<br>
homepage : http|https://등의 홈페이지 형식<br>
userid, user_id : 제로보드XE의 사용자 아이디 형식 (첫글자는 영문, 2번째부터는 숫자+영문+_)<br>
number : 숫자만 허용<br>
alpha : 영문자만 허용<br>
alpha_number : 숫자+영문자만 허용</div>
</li>
<li>
<p>default : var값이 null일 경우 default값으로 대체됩니다. 아래와 같은 함수값을 가질 수도 있습니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">ipaddress() : 접속자의 ip 주소<br>
unixtime() : unix time (php의 time()함수)<br>
curdate() : YYYYMMDDHHIISS<br>
plus(int count) : column = column + count<br>
minus(int count) : column = column - count</div>
</li>
<li>notnull : not null check를 하게 됩니다. minlength : 최소길이 체크 maxlength : 최대길이 체크 pipe : and|or등의 조건을 지정할 수 있습니다.</li>
</ul>
</li>
<li>
<p>&lt;navigation&gt; : navigation은 정렬순서(order by) 또는 페이징을 지원합니다.</p>
<ul>
<li>
<p>&lt;index&gt; 정렬할 컬럼과 정렬방법을 지정할 수 있습니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">var : 대상 컬럼명을 담은 변수명<br>
default : var값이 없을 경우 기본으로 정렬할 컬럼명 지정<br>
order : asc|desc</div>
</li>
<li>
<p>&lt;list_count&gt; 페이징을 한 결과를 받을 수 있습니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">var : 목록의 rows를 지정<br>
default : var값이 없을 경우 기본 rows 값</div>
</li>
<li>
<p>&lt;page_count&gt; 페이징 계산시에 하단 페이지 네비게이션의 수를 지정</p>
<div class="section" style="background-color: rgb(249, 249, 216);">var : 페이징 네비게이션의 수<br>
default : var값이 없을 경우 기본 페이징 네비게이션의 수</div>
</li>
<li>
<p>&lt;page&gt; 현재 몇번째 페이지인지를 지정할 수 있습니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">var : 현재 몇번째 페이지인지를 지정할 변수<br>
default : var값이 지정되지 않았을 경우 페이지 번호</div>
</li>
</ul>
<p>&nbsp;</p>
</li>
<li>&lt;groups&gt; : group by 절을 사용할 수 있습니다.</li>
</ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="Selectquery예제">Select query 예제</h3></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>member.getMemberList : member테이블에서 특정 조건을 가진 회원들을 페이징을 하면서 select</p>
<ol class="code">
<li>&lt;query id="getMemberList" action="select"&gt;<br>
&lt;tables&gt;<br>
&nbsp;&nbsp; &lt;table name="member" /&gt;<br>
&lt;/tables&gt;</li>
<li><br>
&lt;columns&gt;<br>
&nbsp;&nbsp; &lt;column name="*" /&gt;<br>
&lt;/columns&gt;</li>
<li><br>
&lt;conditions&gt;<br>
&nbsp; &nbsp; &lt;condition operation="equal" column="is_admin" var="is_admin" /&gt;<br>
&nbsp;&nbsp; &lt;condition operation="equal" column="denied" var="is_denied" pipe="and" /&gt;<br>
&nbsp;&nbsp; &lt;group pipe="and"&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_id" var="s_user_id" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_name" var="s_user_name" pipe="or" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="nick_name" var="s_nick_name" pipe="or" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="email_address" var="s_email_address" pipe="or" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="regdate" var="s_regdate" pipe="or" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="last_login" var="s_last_login" pipe="or" /&gt;<br>
&nbsp; &nbsp; &lt;/group&gt;<br>
&lt;/conditions&gt;<br>
<br>
&lt;navigation&gt;<br>
&nbsp; &nbsp; &lt;index var="sort_index" default="member_srl" order="desc" /&gt;<br>
&nbsp; &nbsp; &lt;list_count var="list_count" default="20" /&gt;<br>
&nbsp; &nbsp; &lt;page_count var="page_count" default="10" /&gt;<br>
&nbsp; &nbsp; &lt;page var="page" default="1" /&gt;<br>
&lt;/navigation&gt;<br>
&lt;/query&gt;</li>
</ol>
</li>
<li>document.getMonthlyArchivedList : 모듈을 '년월'일을 기준으로 group by 한 결과를 가져옴</li>
</ul></div><div class="eArea xe_content xe_dr_txt"><ol class="code" style="margin-left: 2em;">
<li>&lt;query id="getMonthlyArchivedList" action="select"&gt;<br>
&lt;tables&gt;<br>
&nbsp; &nbsp; &lt;table name="documents" /&gt;<br>
&lt;/tables&gt;<br>
<br>
&lt;columns&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="substr(regdate,1,6)" alias="month"/&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="count(*)" alias="count" /&gt;<br>
&lt;/columns&gt;<br>
<br>
&lt;conditions&gt;<br>
&nbsp;&nbsp; &lt;condition operation="in" column="module_srl" var="module_srl" filter="number" /&gt;<br>
&lt;/conditions&gt;<br>
<br>
&lt;groups&gt;<br>
&nbsp; &nbsp; &lt;group column="substr(regdate,1,6)" /&gt;<br>
&lt;/groups&gt;<br>
&lt;/query&gt;</li>
</ol></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1249627751923">Join Select 예제</h3></div><div class="eArea xe_content xe_dr_txt"><p>document.getTrashList 예제입니다.</p></div><div class="eArea xe_content xe_dr_txt"><p></p><div>&lt;query id="getTrashList" action="select"&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;tables&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="documents" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_trash" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;columns&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="documents.*" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.trash_srl" alias="trash_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.module_srl" alias="module_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.trash_date" alias="trash_date" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.description" alias="trash_description" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.ipaddress" alias="trash_ipaddress" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.user_id" alias="trash_user_id" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.user_name" alias="trash_user_name" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.nick_name" alias="trash_nick_name" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.member_srl" alias="trash_member_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;conditions&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_trash.document_srl" default="documents.document_srl" notnull="notnull" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="in" column="document_trash.module_srl" var="module_srl" filter="number" pipe="and" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_trash.member_srl" var="member_srl" filter="number" pipe="and" /&gt;</div><div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;group pipe="and"&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.title" var="s_title" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.content" var="s_content" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.user_name" var="s_user_name" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.user_id" var="s_user_id" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.nick_name" var="s_nick_name" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.email_address" var="s_email_addres" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.homepage" var="s_homepage" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.tags" var="s_tags" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="documents.is_secret" var="s_is_secret" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="documents.member_srl" var="s_member_srl" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.readed_count" var="s_readed_count" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.voted_count" var="s_voted_count" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.comment_count" var="s_comment_count" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.trackback_count" var="s_trackback_count" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.uploaded_count" var="s_uploaded_count" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.regdate" var="s_regdate" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.last_update" var="s_last_update" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.ipaddress" var="s_ipaddress" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;/group&gt;</div><div><br></div><div><br></div><div>&nbsp;&nbsp; &nbsp;&lt;/conditions&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;navigation&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;index var="sort_index" default="documents.list_order" order="order_type" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;list_count var="list_count" default="20" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;page_count var="page_count" default="10" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;page var="page" default="1" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/navigation&gt;</div><div>&lt;/query&gt;</div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1249627778964">Letf Join Select 예제</h3></div><div class="eArea xe_content xe_dr_txt"><p></p><div>&lt;query id="getDocumentsExtraVars" action="select"&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;tables&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_extra_keys" alias="extra_keys" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_extra_vars" alias="extra_vars" type="left join"&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;conditions&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="extra_keys.module_srl" default="extra_vars.module_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="in" column="extra_vars.document_srl" var="document_srl" pipe="and" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="extra_keys.eid" default="extra_vars.eid" pipe="and" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/conditions&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;/table&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;columns&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.module_srl" alias="module_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_name" alias="name" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_type" alias="type" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_is_required" alias="is_required" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_search" alias="search" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_default" alias="default" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_desc" alias="desc" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_idx" alias="idx" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.document_srl" alias="document_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.lang_code" alias="lang_code" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.value" alias="value" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.eid" alias="eid" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;navigation&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;index var="sort_index" default="extra_keys.var_idx" order="asc" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/navigation&gt;</div><div>&lt;/query&gt;</div><div><br></div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-5">Insert 예제</h3></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.insertCategory : 문서 카테고리 추가</p>
<ol class="code">
<li>&lt;query id="insertCategory" action="insert"&gt;<br>
&lt;tables&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>
&lt;/tables&gt;<br>
<br>
&lt;columns&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="module_srl" var="module_srl" filter="number" default="0" notnull="notnull" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" notnull="notnull" minlength="2" maxlength="250" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="document_count" var="document_count" default="0" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="regdate" var="regdate" default="curdate()" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" default="0" /&gt;<br>
&lt;/columns&gt;<br>
&lt;/query&gt;</li>
</ol>
</li>
</ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-6">update 예제</h3></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.updateCategory : 특정 카테고리의 제목이나 순서, 최근 수정일을 변경</p>
<ol class="code">
<li>&lt;query id="updateCategory" action="update"&gt;<br>
&lt;tables&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>
&lt;/tables&gt;<br>
<br>
&lt;columns&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<br>
&lt;/columns&gt;<br>
<br>
&lt;conditions&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>
&lt;/conditions&gt;<br>
&lt;/query&gt;</li>
</ol>
</li>
</ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-7">delete 예제</h3></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.deleteCategory : 특정 카테고리를 삭제</p>
<ol class="code">
<li>&lt;query id="deleteCategory" action="delete"&gt;<br>
&lt;tables&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>
&lt;/tables&gt;<br>
<br>
&lt;conditions&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>
&lt;/conditions&gt;<br>
&lt;/query&gt;</li>
</ol>
</li>
</ul></div>
sol 2009.08.24 16:49:43
복원
<div class="eArea xe_content xe_dr_txt"><p><a href="http://doc.zeroboard.com/classXmlQueryParser.html" class="external" title="http://doc.zeroboard.com/classXmlQueryParser.html">http://doc.zeroboard.com/classXmlQueryParser.html</a> (클래스 구조)</p></div><div class="eArea xe_content xe_dr_index"><ul class="toc"><li class="toc3"><a href="#1249368742400-1">개요</a></li><li class="toc3"><a href="#1249368742400-2">사용법</a></li><li class="toc3"><a href="#h1249628444840">XML sample</a></li><li class="toc3"><a href="#Selectquery예제">Select query 예제</a></li><li class="toc3"><a href="#h1249627751923">Join Select 예제</a></li><li class="toc3"><a href="#h1249627778964">Letf Join Select 예제</a></li><li class="toc3"><a href="#1249368742400-5">Insert 예제</a></li><li class="toc3"><a href="#1249368742400-6">update 예제</a></li><li class="toc3"><a href="#1249368742400-7">delete 예제</a></li></ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-1">개요</h3></div><div class="eArea xe_content xe_dr_txt"><ol>
<li>XpressEngine는 query문을 직접 사용하지 않습니다.</li>
<li>이는 다양한 DBMS를 지원하기 위해서입니다.</li>
<li>XML Query문의 확장자는 .xml 입니다.</li>
</ol></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-2">사용법</h3></div><div class="eArea xe_content xe_dr_txt"><p>모듈 또는 애드온, 플러그인등에서 아래와 같이 사용할 수 있습니다.</p></div><div class="eArea xe_content xe_dr_txt"><ol class="code" style="margin-left: 2em;">
<li>$args-&gt;name = "zero";</li>
<li>$output = executeQuery("member.getMemberInfo", $args);</li>
</ol></div><div class="eArea xe_content xe_dr_txt"><p>XML Query를 호출하여 실제 DB의 데이터를 받거나 조작하기 위해서 사용되는 <a href="http://doc.zeroboard.com/func_8inc_8php.html#a53bc375f79153665cca63971699aef4" class="ext-link">executeQuery()</a> 함수는 <a href="http://doc.zeroboard.com/classDB.html#f6ba2792ca4134604d82f17055a2ad5d" class="ext-link">DB::executeQuery()</a>의 alias입니다.</p></div><div class="eArea xe_content xe_dr_txt"><ol class="code" style="margin-left: 2em;">
<li>function executeQuery($xml_query_name, $args = null);</li>
</ol></div><div class="eArea xe_content xe_dr_txt"><p>첫번째 인자로 실행하고자 하는 xml query의 이름을 받게 됩니다.<br>
이름은 <strong>모듈명.쿼리ID</strong> 로 이루어집니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>$args는 null일수도 있고 해당 xml query에서 필요시 stdclass의 variables type으로 변수의 key, value를 설정후 인자로 넘기게 됩니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>결과는 Object class의 객체로 return 됩니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>쿼리 실패는 $output-&gt;toBool()이 false일 경우이고 true라면 쿼리는 정상적으로 실행이 된 것을 의미합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>select문의 결과 데이터는 $output-&gt;data 변수에 담겨져 return 됩니다.</p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1249628444840">XML sample</h3></div><div class="eArea xe_content xe_dr_txt"><ol class="code">
<li>&lt;query id="쿼리아이디" action="select|update|delete|insert"&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;tables&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;table name="원테이블이름" alias="alias" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp; &lt;/tables&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;columns&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;column name="컬럼명" alias="alias" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp; &lt;/columns&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;conditions&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group pipe="연결연산자"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/group&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp; &lt;/conditions&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;navigation&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;index var="이름" default="기본값" order="desc|asc" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;list_count var="변수명" default="기본값" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page_count var="변수명" default="기본값" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page var="변수명" default="변수명" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/navigation&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;groups&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group column="GroupBy 대상" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/groups&gt;<br>
&lt;/query&gt;</li>
</ol></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>&lt;query&gt; 의 attribute</p>
<ul>
<li>id : 쿼리를 찾을 수 있는 아이디입니다. module.query_id 로 query xml 파일을 찾고 사용하게 됩니다.<br>
action : select, update, delete, insert 4가지 종류가 있습니다.</li>
</ul>
<p>&nbsp;</p>
</li>
<li>&lt;tables&gt;
<ul>
<li>테이블 조인시 여러개의 &lt;table&gt; 을 사용할 수 있습니다.<br>
name : 원테이블 명 (제로보드XE에서 prefix는 무시) alias : join또는 다른 용도로 원테이블명을 바꾸어 사용할 경우</li>
</ul>
</li>
<li>&lt;columns&gt;
<ul>
<li>처리하고자 하는 컬럼명을 입력하시면 됩니다. name : 컬럼명 alias : 다른 이름으로 바꾸어 결과를 만들고자 할 경우 지정</li>
</ul>
</li>
<li>&lt;conditions&gt;
<ul>
<li>조건절을 구성합니다.</li>
<li>조건절을 여러개의 그룹으로 사용하고자 할 때에는 &lt;group&gt; 태그를 이용해서 묶어 주실 수 있습니다.</li>
</ul>
</li>
<li>&lt;group&gt; ... &lt;/group&gt;
<ul>
<li>조건절을 그룹으로 사용할 경우 pipe="and|or" 를 이용하여 그룹끼리의 조건을 지정할 수 있습니다.</li>
</ul>
</li>
<li>&lt;condition&gt;
<ul>
<li>
<p>operation : 아래와 같은 연산자로 처리가 됩니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">equal : column = (var|default)<br>
more : column &gt;= (var|default)<br>
excess : column &gt; (var|default)<br>
less : column &lt;= (var|default)<br>
below : column &lt; (var|default)<br>
notequal : column != (var|default)<br>
notnull : column is not null<br>
null : column is null<br>
like_prefix : column like '%var|default'<br>
like_tail : column like 'var|default%'<br>
like : column like '%var|default%'<br>
in : column in (var|default)</div>
<p>&nbsp;</p>
</li>
<li>column : 컬럼명을 지정할 수 있습니다.</li>
<li>var : executeQuery()함수에서 2번째 인자의 key값을 지정할 수 있습니다.</li>
<li>
<p>filter : var 값의 조건을 filtering합니다. 아래와 같은 filter를 지원합니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">email, email_address : 메일 형식<br>
homepage : http|https://등의 홈페이지 형식<br>
userid, user_id : 제로보드XE의 사용자 아이디 형식 (첫글자는 영문, 2번째부터는 숫자+영문+_)<br>
number : 숫자만 허용<br>
alpha : 영문자만 허용<br>
alpha_number : 숫자+영문자만 허용</div>
</li>
<li>
<p>default : var값이 null일 경우 default값으로 대체됩니다. 아래와 같은 함수값을 가질 수도 있습니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">ipaddress() : 접속자의 ip 주소<br>
unixtime() : unix time (php의 time()함수)<br>
curdate() : YYYYMMDDHHIISS<br>
plus(int count) : column = column + count<br>
minus(int count) : column = column - count</div>
</li>
<li>notnull : not null check를 하게 됩니다. minlength : 최소길이 체크 maxlength : 최대길이 체크 pipe : and|or등의 조건을 지정할 수 있습니다.</li>
</ul>
</li>
<li>
<p>&lt;navigation&gt; : navigation은 정렬순서(order by) 또는 페이징을 지원합니다.</p>
<ul>
<li>
<p>&lt;index&gt; 정렬할 컬럼과 정렬방법을 지정할 수 있습니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">var : 대상 컬럼명을 담은 변수명<br>
default : var값이 없을 경우 기본으로 정렬할 컬럼명 지정<br>
order : asc|desc</div>
</li>
<li>
<p>&lt;list_count&gt; 페이징을 한 결과를 받을 수 있습니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">var : 목록의 rows를 지정<br>
default : var값이 없을 경우 기본 rows 값</div>
</li>
<li>
<p>&lt;page_count&gt; 페이징 계산시에 하단 페이지 네비게이션의 수를 지정</p>
<div class="section" style="background-color: rgb(249, 249, 216);">var : 페이징 네비게이션의 수<br>
default : var값이 없을 경우 기본 페이징 네비게이션의 수</div>
</li>
<li>
<p>&lt;page&gt; 현재 몇번째 페이지인지를 지정할 수 있습니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">var : 현재 몇번째 페이지인지를 지정할 변수<br>
default : var값이 지정되지 않았을 경우 페이지 번호</div>
</li>
</ul>
<p>&nbsp;</p>
</li>
<li>&lt;groups&gt; : group by 절을 사용할 수 있습니다.</li>
</ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="Selectquery예제">Select query 예제</h3></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>member.getMemberList : member테이블에서 특정 조건을 가진 회원들을 페이징을 하면서 select</p>
<ol class="code">
<li>&lt;query id="getMemberList" action="select"&gt;<br>
&lt;tables&gt;<br>
&nbsp;&nbsp; &lt;table name="member" /&gt;<br>
&lt;/tables&gt;</li>
<li><br>
&lt;columns&gt;<br>
&nbsp;&nbsp; &lt;column name="*" /&gt;<br>
&lt;/columns&gt;</li>
<li><br>
&lt;conditions&gt;<br>
&nbsp; &nbsp; &lt;condition operation="equal" column="is_admin" var="is_admin" /&gt;<br>
&nbsp;&nbsp; &lt;condition operation="equal" column="denied" var="is_denied" pipe="and" /&gt;<br>
&nbsp;&nbsp; &lt;group pipe="and"&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_id" var="s_user_id" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_name" var="s_user_name" pipe="or" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="nick_name" var="s_nick_name" pipe="or" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="email_address" var="s_email_address" pipe="or" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="regdate" var="s_regdate" pipe="or" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="last_login" var="s_last_login" pipe="or" /&gt;<br>
&nbsp; &nbsp; &lt;/group&gt;<br>
&lt;/conditions&gt;<br>
<br>
&lt;navigation&gt;<br>
&nbsp; &nbsp; &lt;index var="sort_index" default="member_srl" order="desc" /&gt;<br>
&nbsp; &nbsp; &lt;list_count var="list_count" default="20" /&gt;<br>
&nbsp; &nbsp; &lt;page_count var="page_count" default="10" /&gt;<br>
&nbsp; &nbsp; &lt;page var="page" default="1" /&gt;<br>
&lt;/navigation&gt;<br>
&lt;/query&gt;</li>
</ol>
</li>
<li>document.getMonthlyArchivedList : 모듈을 '년월'일을 기준으로 group by 한 결과를 가져옴</li>
</ul></div><div class="eArea xe_content xe_dr_txt"><ol class="code" style="margin-left: 2em;">
<li>&lt;query id="getMonthlyArchivedList" action="select"&gt;<br>
&lt;tables&gt;<br>
&nbsp; &nbsp; &lt;table name="documents" /&gt;<br>
&lt;/tables&gt;<br>
<br>
&lt;columns&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="substr(regdate,1,6)" alias="month"/&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="count(*)" alias="count" /&gt;<br>
&lt;/columns&gt;<br>
<br>
&lt;conditions&gt;<br>
&nbsp;&nbsp; &lt;condition operation="in" column="module_srl" var="module_srl" filter="number" /&gt;<br>
&lt;/conditions&gt;<br>
<br>
&lt;groups&gt;<br>
&nbsp; &nbsp; &lt;group column="substr(regdate,1,6)" /&gt;<br>
&lt;/groups&gt;<br>
&lt;/query&gt;</li>
</ol></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1249627751923">Join Select 예제</h3></div><div class="eArea xe_content xe_dr_txt"><p>document.getTrashList 예제입니다.</p></div><div class="eArea xe_content xe_dr_txt"><p></p><div>&lt;query id="getTrashList" action="select"&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;tables&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="documents" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_trash" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;columns&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="documents.*" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.trash_srl" alias="trash_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.module_srl" alias="module_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.trash_date" alias="trash_date" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.description" alias="trash_description" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.ipaddress" alias="trash_ipaddress" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.user_id" alias="trash_user_id" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.user_name" alias="trash_user_name" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.nick_name" alias="trash_nick_name" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="document_trash.member_srl" alias="trash_member_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;conditions&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_trash.document_srl" default="documents.document_srl" notnull="notnull" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="in" column="document_trash.module_srl" var="module_srl" filter="number" pipe="and" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="document_trash.member_srl" var="member_srl" filter="number" pipe="and" /&gt;</div><div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;group pipe="and"&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.title" var="s_title" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.content" var="s_content" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.user_name" var="s_user_name" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.user_id" var="s_user_id" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.nick_name" var="s_nick_name" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.email_address" var="s_email_addres" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.homepage" var="s_homepage" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like" column="documents.tags" var="s_tags" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="documents.is_secret" var="s_is_secret" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="documents.member_srl" var="s_member_srl" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.readed_count" var="s_readed_count" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.voted_count" var="s_voted_count" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.comment_count" var="s_comment_count" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.trackback_count" var="s_trackback_count" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="more" column="documents.uploaded_count" var="s_uploaded_count" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.regdate" var="s_regdate" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.last_update" var="s_last_update" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="like_prefix" column="documents.ipaddress" var="s_ipaddress" pipe="or" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;/group&gt;</div><div><br></div><div><br></div><div>&nbsp;&nbsp; &nbsp;&lt;/conditions&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;navigation&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;index var="sort_index" default="documents.list_order" order="order_type" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;list_count var="list_count" default="20" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;page_count var="page_count" default="10" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;page var="page" default="1" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/navigation&gt;</div><div>&lt;/query&gt;</div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1249627778964">Letf Join Select 예제</h3></div><div class="eArea xe_content xe_dr_txt"><p></p><div>&lt;query id="getDocumentsExtraVars" action="select"&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;tables&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_extra_keys" alias="extra_keys" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;table name="document_extra_vars" alias="extra_vars" type="left join"&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;conditions&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="extra_keys.module_srl" default="extra_vars.module_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="in" column="extra_vars.document_srl" var="document_srl" pipe="and" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition operation="equal" column="extra_keys.eid" default="extra_vars.eid" pipe="and" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/conditions&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;/table&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/tables&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;columns&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.module_srl" alias="module_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_name" alias="name" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_type" alias="type" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_is_required" alias="is_required" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_search" alias="search" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_default" alias="default" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_desc" alias="desc" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.var_idx" alias="idx" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.document_srl" alias="document_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.lang_code" alias="lang_code" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_vars.value" alias="value" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;column name="extra_keys.eid" alias="eid" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/columns&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;navigation&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;index var="sort_index" default="extra_keys.var_idx" order="asc" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/navigation&gt;</div><div>&lt;/query&gt;</div><div><br></div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-5">Insert 예제</h3></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.insertCategory : 문서 카테고리 추가</p>
<ol class="code">
<li>&lt;query id="insertCategory" action="insert"&gt;<br>
&lt;tables&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>
&lt;/tables&gt;<br>
<br>
&lt;columns&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="module_srl" var="module_srl" filter="number" default="0" notnull="notnull" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" notnull="notnull" minlength="2" maxlength="250" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="document_count" var="document_count" default="0" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="regdate" var="regdate" default="curdate()" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" default="0" /&gt;<br>
&lt;/columns&gt;<br>
&lt;/query&gt;</li>
</ol>
</li>
</ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-6">update 예제</h3></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.updateCategory : 특정 카테고리의 제목이나 순서, 최근 수정일을 변경</p>
<ol class="code">
<li>&lt;query id="updateCategory" action="update"&gt;<br>
&lt;tables&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>
&lt;/tables&gt;<br>
<br>
&lt;columns&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<br>
&lt;/columns&gt;<br>
<br>
&lt;conditions&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>
&lt;/conditions&gt;<br>
&lt;/query&gt;</li>
</ol>
</li>
</ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-7">delete 예제</h3></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.deleteCategory : 특정 카테고리를 삭제</p>
<ol class="code">
<li>&lt;query id="deleteCategory" action="delete"&gt;<br>
&lt;tables&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>
&lt;/tables&gt;<br>
<br>
&lt;conditions&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>
&lt;/conditions&gt;<br>
&lt;/query&gt;</li>
</ol>
</li>
</ul></div>
sol 2009.08.07 16:02:13
복원
<div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-0">&nbsp;Xml Query Parser</h3></div><div class="eArea xe_content xe_dr_txt"><p><a href="http://doc.zeroboard.com/classXmlQueryParser.html" class="external" title="http://doc.zeroboard.com/classXmlQueryParser.html">http://doc.zeroboard.com/classXmlQueryParser.html</a> (클래스 구조)</p></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-1">개요</h3></div><div class="eArea xe_content xe_dr_txt"><ol>
<li>XpressEngine는 query문을 직접 사용하지 않습니다.</li>
<li>이는 다양한 DBMS를 지원하기 위해서입니다.</li>
<li>XML Query문의 확장자는 .xml 입니다.</li>
</ol></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-2">사용법</h3></div><div class="eArea xe_content xe_dr_txt"><p>모듈 또는 애드온, 플러그인등에서 아래와 같이 사용할 수 있습니다.</p></div><div class="eArea xe_content xe_dr_txt"><ol class="code" style="margin-left: 2em;">
<li>$args-&gt;name = "zero";</li>
<li>$output = executeQuery("member.getMemberInfo", $args);</li>
</ol></div><div class="eArea xe_content xe_dr_txt"><p>XML Query를 호출하여 실제 DB의 데이터를 받거나 조작하기 위해서 사용되는 <a href="http://doc.zeroboard.com/func_8inc_8php.html#a53bc375f79153665cca63971699aef4" class="ext-link">executeQuery()</a> 함수는 <a href="http://doc.zeroboard.com/classDB.html#f6ba2792ca4134604d82f17055a2ad5d" class="ext-link">DB::executeQuery()</a>의 alias입니다.</p></div><div class="eArea xe_content xe_dr_txt"><ol class="code" style="margin-left: 2em;">
<li>function executeQuery($xml_query_name, $args = null);</li>
</ol></div><div class="eArea xe_content xe_dr_txt"><p>첫번째 인자로 실행하고자 하는 xml query의 이름을 받게 됩니다.<br>
이름은 <strong>모듈명.쿼리ID</strong> 로 이루어집니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>$args는 null일수도 있고 해당 xml query에서 필요시 stdclass의 variables type으로 변수의 key, value를 설정후 인자로 넘기게 됩니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>결과는 Object class의 객체로 return 됩니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>쿼리 실패는 $output-&gt;toBool()이 false일 경우이고 true라면 쿼리는 정상적으로 실행이 된 것을 의미합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>select문의 결과 데이터는 $output-&gt;data 변수에 담겨져 return 됩니다.</p></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-3">XML sample</h3></div><div class="eArea xe_content xe_dr_txt"><ol class="code">
<li>&lt;query id="쿼리아이디" action="select|update|delete|insert"&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;tables&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;table name="원테이블이름" alias="alias" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp; &lt;/tables&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;columns&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;column name="컬럼명" alias="alias" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp; &lt;/columns&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;conditions&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group pipe="연결연산자"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition operation="조건걸" column="Column명" var="변수명" filter="필터형식" default="기본값" notnull="notnull" minlength="최소길이" maxlength="최대길이" pipe="연결연산자" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/group&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp; &lt;/conditions&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;navigation&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;index var="이름" default="기본값" order="desc|asc" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;list_count var="변수명" default="기본값" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page_count var="변수명" default="기본값" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page var="변수명" default="변수명" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/navigation&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;groups&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;group column="GroupBy 대상" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/groups&gt;<br>
&lt;/query&gt;</li>
</ol></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>&lt;query&gt; 의 attribute</p>
<ul>
<li>id : 쿼리를 찾을 수 있는 아이디입니다. module.query_id 로 query xml 파일을 찾고 사용하게 됩니다.<br>
action : select, update, delete, insert 4가지 종류가 있습니다.</li>
</ul>
<p>&nbsp;</p>
</li>
<li>&lt;tables&gt;
<ul>
<li>테이블 조인시 여러개의 &lt;table&gt; 을 사용할 수 있습니다.<br>
name : 원테이블 명 (제로보드XE에서 prefix는 무시) alias : join또는 다른 용도로 원테이블명을 바꾸어 사용할 경우</li>
</ul>
</li>
<li>&lt;columns&gt;
<ul>
<li>처리하고자 하는 컬럼명을 입력하시면 됩니다. name : 컬럼명 alias : 다른 이름으로 바꾸어 결과를 만들고자 할 경우 지정</li>
</ul>
</li>
<li>&lt;conditions&gt;
<ul>
<li>조건절을 구성합니다.</li>
<li>조건절을 여러개의 그룹으로 사용하고자 할 때에는 &lt;group&gt; 태그를 이용해서 묶어 주실 수 있습니다.</li>
</ul>
</li>
<li>&lt;group&gt; ... &lt;/group&gt;
<ul>
<li>조건절을 그룹으로 사용할 경우 pipe="and|or" 를 이용하여 그룹끼리의 조건을 지정할 수 있습니다.</li>
</ul>
</li>
<li>&lt;condition&gt;
<ul>
<li>
<p>operation : 아래와 같은 연산자로 처리가 됩니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">equal : column = (var|default)<br>
more : column &gt;= (var|default)<br>
excess : column &gt; (var|default)<br>
less : column &lt;= (var|default)<br>
below : column &lt; (var|default)<br>
notequal : column != (var|default)<br>
notnull : column is not null<br>
null : column is null<br>
like_prefix : column like '%var|default'<br>
like_tail : column like 'var|default%'<br>
like : column like '%var|default%'<br>
in : column in (var|default)</div>
<p>&nbsp;</p>
</li>
<li>column : 컬럼명을 지정할 수 있습니다.</li>
<li>var : executeQuery()함수에서 2번째 인자의 key값을 지정할 수 있습니다.</li>
<li>
<p>filter : var 값의 조건을 filtering합니다. 아래와 같은 filter를 지원합니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">email, email_address : 메일 형식<br>
homepage : http|https://등의 홈페이지 형식<br>
userid, user_id : 제로보드XE의 사용자 아이디 형식 (첫글자는 영문, 2번째부터는 숫자+영문+_)<br>
number : 숫자만 허용<br>
alpha : 영문자만 허용<br>
alpha_number : 숫자+영문자만 허용</div>
</li>
<li>
<p>default : var값이 null일 경우 default값으로 대체됩니다. 아래와 같은 함수값을 가질 수도 있습니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">ipaddress() : 접속자의 ip 주소<br>
unixtime() : unix time (php의 time()함수)<br>
curdate() : YYYYMMDDHHIISS<br>
plus(int count) : column = column + count<br>
minus(int count) : column = column - count</div>
</li>
<li>notnull : not null check를 하게 됩니다. minlength : 최소길이 체크 maxlength : 최대길이 체크 pipe : and|or등의 조건을 지정할 수 있습니다.</li>
</ul>
</li>
<li>
<p>&lt;navigation&gt; : navigation은 정렬순서(order by) 또는 페이징을 지원합니다.</p>
<ul>
<li>
<p>&lt;index&gt; 정렬할 컬럼과 정렬방법을 지정할 수 있습니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">var : 대상 컬럼명을 담은 변수명<br>
default : var값이 없을 경우 기본으로 정렬할 컬럼명 지정<br>
order : asc|desc</div>
</li>
<li>
<p>&lt;list_count&gt; 페이징을 한 결과를 받을 수 있습니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">var : 목록의 rows를 지정<br>
default : var값이 없을 경우 기본 rows 값</div>
</li>
<li>
<p>&lt;page_count&gt; 페이징 계산시에 하단 페이지 네비게이션의 수를 지정</p>
<div class="section" style="background-color: rgb(249, 249, 216);">var : 페이징 네비게이션의 수<br>
default : var값이 없을 경우 기본 페이징 네비게이션의 수</div>
</li>
<li>
<p>&lt;page&gt; 현재 몇번째 페이지인지를 지정할 수 있습니다.</p>
<div class="section" style="background-color: rgb(249, 249, 216);">var : 현재 몇번째 페이지인지를 지정할 변수<br>
default : var값이 지정되지 않았을 경우 페이지 번호</div>
</li>
</ul>
<p>&nbsp;</p>
</li>
<li>&lt;groups&gt; : group by 절을 사용할 수 있습니다.</li>
</ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="Selectquery예제">Select query 예제</h3></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>member.getMemberList : member테이블에서 특정 조건을 가진 회원들을 페이징을 하면서 select</p>
<ol class="code">
<li>&lt;query id="getMemberList" action="select"&gt;<br>
&lt;tables&gt;<br>
&nbsp;&nbsp; &lt;table name="member" /&gt;<br>
&lt;/tables&gt;</li>
<li><br>
&lt;columns&gt;<br>
&nbsp;&nbsp; &lt;column name="*" /&gt;<br>
&lt;/columns&gt;</li>
<li><br>
&lt;conditions&gt;<br>
&nbsp; &nbsp; &lt;condition operation="equal" column="is_admin" var="is_admin" /&gt;<br>
&nbsp;&nbsp; &lt;condition operation="equal" column="denied" var="is_denied" pipe="and" /&gt;<br>
&nbsp;&nbsp; &lt;group pipe="and"&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_id" var="s_user_id" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="user_name" var="s_user_name" pipe="or" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="nick_name" var="s_nick_name" pipe="or" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like" column="email_address" var="s_email_address" pipe="or" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="regdate" var="s_regdate" pipe="or" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition operation="like_prefix" column="last_login" var="s_last_login" pipe="or" /&gt;<br>
&nbsp; &nbsp; &lt;/group&gt;<br>
&lt;/conditions&gt;<br>
<br>
&lt;navigation&gt;<br>
&nbsp; &nbsp; &lt;index var="sort_index" default="member_srl" order="desc" /&gt;<br>
&nbsp; &nbsp; &lt;list_count var="list_count" default="20" /&gt;<br>
&nbsp; &nbsp; &lt;page_count var="page_count" default="10" /&gt;<br>
&nbsp; &nbsp; &lt;page var="page" default="1" /&gt;<br>
&lt;/navigation&gt;<br>
&lt;/query&gt;</li>
</ol>
</li>
<li>document.getMonthlyArchivedList : 모듈을 '년월'일을 기준으로 group by 한 결과를 가져옴</li>
</ul></div><div class="eArea xe_content xe_dr_txt"><ol class="code" style="margin-left: 2em;">
<li>&lt;query id="getMonthlyArchivedList" action="select"&gt;<br>
&lt;tables&gt;<br>
&nbsp; &nbsp; &lt;table name="documents" /&gt;<br>
&lt;/tables&gt;<br>
<br>
&lt;columns&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="substr(regdate,1,6)" alias="month"/&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="count(*)" alias="count" /&gt;<br>
&lt;/columns&gt;<br>
<br>
&lt;conditions&gt;<br>
&nbsp;&nbsp; &lt;condition operation="in" column="module_srl" var="module_srl" filter="number" /&gt;<br>
&lt;/conditions&gt;<br>
<br>
&lt;groups&gt;<br>
&nbsp; &nbsp; &lt;group column="substr(regdate,1,6)" /&gt;<br>
&lt;/groups&gt;<br>
&lt;/query&gt;</li>
</ol></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-5">Insert 예제</h3></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.insertCategory : 문서 카테고리 추가</p>
<ol class="code">
<li>&lt;query id="insertCategory" action="insert"&gt;<br>
&lt;tables&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>
&lt;/tables&gt;<br>
<br>
&lt;columns&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="module_srl" var="module_srl" filter="number" default="0" notnull="notnull" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" notnull="notnull" minlength="2" maxlength="250" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="document_count" var="document_count" default="0" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="regdate" var="regdate" default="curdate()" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" default="0" /&gt;<br>
&lt;/columns&gt;<br>
&lt;/query&gt;</li>
</ol>
</li>
</ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-6">update 예제</h3></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.updateCategory : 특정 카테고리의 제목이나 순서, 최근 수정일을 변경</p>
<ol class="code">
<li>&lt;query id="updateCategory" action="update"&gt;<br>
&lt;tables&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>
&lt;/tables&gt;<br>
<br>
&lt;columns&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="title" var="title" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="list_order" var="list_order" /&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;column name="last_update" var="last_update" default="curdate()" /&gt;<br>
&lt;/columns&gt;<br>
<br>
&lt;conditions&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>
&lt;/conditions&gt;<br>
&lt;/query&gt;</li>
</ol>
</li>
</ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="1249368742400-7">delete 예제</h3></div><div class="eArea xe_content xe_dr_txt"><ul>
<li>
<p>document.deleteCategory : 특정 카테고리를 삭제</p>
<ol class="code">
<li>&lt;query id="deleteCategory" action="delete"&gt;<br>
&lt;tables&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;table name="document_categories" /&gt;<br>
&lt;/tables&gt;<br>
<br>
&lt;conditions&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" /&gt;<br>
&lt;/conditions&gt;<br>
&lt;/query&gt;</li>
</ol>
</li>
</ul></div>
sol 2009.08.04 15:54:23