Skip to content

Instantly share code, notes, and snippets.

@icedac
Created May 26, 2015 16:05
Show Gist options
  • Save icedac/89f36dd4eb190cfd8b7b to your computer and use it in GitHub Desktop.
Save icedac/89f36dd4eb190cfd8b7b to your computer and use it in GitHub Desktop.
sql_code_gen/packet_code_gen xml
<xml>
<config>
<db name="test_db" version="9"/> <!-- increment version if backward compatibility broken -->
<output type="cpp" code="GameDB.h"/>
<output type="MySQL" code="GameDB_MySQL.sql"/>
</config>
<error>
<code value="0" name="SUCCESS" desc="success"/>
<code value="1" name="ERR_NOT_IMPLEMENTED"/>
<code value="2" name="ERR_GENERAL" desc="error"/>
<code value="4" name="ERR_DB_SERVER" desc="db error"/>
<code value="300" name="ERR_RESOURCE_NOT_FOUND"/>
</error>
<table name="tbl_account" primary_key="acct_id">
<uint64 name="acct_id" auto_increment="10000" comment="계정 Unique no"/>
<astring max_size="50" name="acct_name" key="true" />
<astring max_size="50" name="nickname" />
<timestamp name="creation_time" default_current_time="true" />
<postfix_rawcode type="MySQL" tag="testdata">
-- ----------------------------
-- Records of tbl_account
-- ----------------------------
INSERT INTO `tbl_account` VALUES ('100', 'icedac', '아이스닥', DEFAULT );
</postfix_rawcode>
</table>
<sp name="sp_get_account_by_name" comment="acct_name으로 계정 정보 얻기">
<in>
<astring max_size="50" name="acct_name" />
</in>
<out>
<uint name="result"/>
</out>
<result_set>
<!-- tbl_account -->
<uint64 name="acct_id" />
<astring max_size="50" name="acct_name" />
<astring max_size="50" name="nickname" />
<timestamp name="creation_time" />
</result_set>
<sql>
</sql>
<sql type="MySQL">
select count(*) into result from tbl_account where tbl_account.acct_name = acct_name;
if ( result = 0 ) then
call sp_new_account( acct_name, acct_name, result );
end if;
select * from tbl_account where tbl_account.acct_name = acct_name;
</sql>
</sp>
</xml>
<xml>
<namespace name="T_ms_db" version="1" />
<host name="TMS" processor="./MS_DB_Process.h" interface="./MS_DB_Interface.h" csharpcode="./MS_DB_Class.cs" handler="true"/>
<host name="TDB" processor="./DB_MS_Process.h" interface="./DB_MS_Interface.h" handler="true"/>
<option from="TMS" to="TDB" abbr="MD" codeshuffle="no" codestart="4000"/>
<option from="TDB" to="TMS" abbr="DM" codeshuffle="no" codestart="4500"/>
<error>
<code value="0" name="SUCCESS" desc="success"/>
<code value="1" name="ERR_NOT_IMPLEMENTED"/>
<code value="2" name="ERR_GENERAL" desc="error"/>
<code value="4" name="ERR_DB_SERVER" desc="db error"/>
<code value="300" name="ERR_RESOURCE_NOT_FOUND"/>
</error>
<packet name="GetAccountReq" from="TMS" to="TDB" ack="GetAccountRes">
<astring max_size="50" name="acct_name" key="true" />
</packet>
<packet name="GetAccountRes" from="TDB" to="TMS">
<uint32 name="result" />
<!-- tbl_account -->
<uint64 name="acct_id" />
<astring max_size="50" name="acct_name" />
<astring max_size="50" name="nickname" />
<timestamp name="creation_time" />
</packet>
</xml>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment