??xml version="1.0" encoding="utf-8" standalone="yes"?>蜜芽亚洲av无码一区二区三区,亚洲第一成年男人的天堂,国产专区一va亚洲v天堂http://m.tkk7.com/nijiaben/zh-cnFri, 04 Jul 2025 15:48:21 GMTFri, 04 Jul 2025 15:48:21 GMT60谈jvm中Instrumentation的实?/title><link>http://m.tkk7.com/nijiaben/archive/2013/04/12/397775.html</link><dc:creator>你假W?/dc:creator><author>你假W?/author><pubDate>Fri, 12 Apr 2013 14:38:00 GMT</pubDate><guid>http://m.tkk7.com/nijiaben/archive/2013/04/12/397775.html</guid><wfw:comment>http://m.tkk7.com/nijiaben/comments/397775.html</wfw:comment><comments>http://m.tkk7.com/nijiaben/archive/2013/04/12/397775.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/nijiaben/comments/commentRss/397775.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/nijiaben/services/trackbacks/397775.html</trackback:ping><description><![CDATA[      <span style="font-family: 微Y雅黑; text-indent: 32px; background-color: #ffffff;">惛_不少人听说过</span><span style="font-family: 微Y雅黑; text-indent: 32px; background-color: #ffffff;">javaagent</span><span style="font-family: 微Y雅黑; text-indent: 32px; background-color: #ffffff;">Q但是很h听说</span><span style="font-family: 微Y雅黑; text-indent: 32px; background-color: #ffffff;">Instrumentation</span><span style="font-family: 微Y雅黑; text-indent: 32px; background-color: #ffffff;">Q其?/span><span style="font-family: 微Y雅黑; text-indent: 32px; background-color: #ffffff;">Instrumentation</span><span style="font-family: 微Y雅黑; text-indent: 32px; background-color: #ffffff;">是</span><span style="font-family: 微Y雅黑; text-indent: 32px; background-color: #ffffff;">javaagent</span><span style="font-family: 微Y雅黑; text-indent: 32px; background-color: #ffffff;">的实现机Ӟ说到</span><span style="font-family: 微Y雅黑; text-indent: 32px; background-color: #ffffff;">Instrumentation</span><span style="font-family: 微Y雅黑; text-indent: 32px; background-color: #ffffff;">Q就必须想了?/span><span style="font-family: 微Y雅黑; text-indent: 32px; background-color: #ffffff;">java</span><span style="font-family: 微Y雅黑; text-indent: 32px; background-color: #ffffff;">?/span><span style="font-family: 微Y雅黑; text-indent: 32px; background-color: #ffffff;">attach</span><span style="font-family: 微Y雅黑; text-indent: 32px; background-color: #ffffff;">机制Q那先说下</span><span style="font-family: 微Y雅黑; text-indent: 32px; background-color: #ffffff;">attach</span><span style="font-family: 微Y雅黑; text-indent: 32px; background-color: #ffffff;">的实现?br /><img src="http://m.tkk7.com/images/blogjava_net/nijiaben/QQ20130412-2.png" border="0" alt="" width="827" height="512" /><br /></span><span style="background-color: #ffffff; font-family: 微Y雅黑;">        大家q行jstack的时候,是不是经常看C个线E?strong>Signal Dispatcher</strong></span><span style="background-color: #ffffff; font-family: 微Y雅黑;">?/span><strong style="line-height: 1.5; background-color: #ffffff; font-family: 微Y雅黑;"> Attach ListenerU程Q可能不知道是干嘛的吧,q两个线E是实现attach的关键所在,其中前者是在jvm启动的时候就会创建的Q后者只有接收过attachh的时候vm才会创徏Q顾名思义QSignal Dispatcher是分发信LQ?nbsp;Attach Listener 是处理attachh的,那么两者有什么关pdQ当我们执行attachҎ的时候,会向目标vm发出一个SIGQUIT 的信P目标vm收到q个信号之后׃创徏Attach ListenerU程了,当然jvm保证了不会多创徏?br /></strong><div style="padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; width: 1134.828125px; word-break: break-all;"><span style="color: #008080;"> 1</span>  path = findSocketFile(pid);<br /><span style="color: #008080;"> 2</span>         <span style="color: #0000ff;">if</span> (path == <span style="color: #0000ff;">null</span>) {<br /><span style="color: #008080;"> 3</span>             File f = <span style="color: #0000ff;">new</span> File(tmpdir, ".attach_pid" + pid);<br /><span style="color: #008080;"> 4</span>             createAttachFile(f.getPath());<br /><span style="color: #008080;"> 5</span>             <span style="color: #0000ff;">try</span> {<br /><span style="color: #008080;"> 6</span>                 sendQuitTo(pid);<br /><span style="color: #008080;"> 7</span> <br /><span style="color: #008080;"> 8</span>                 <span style="color: #008000;">//</span><span style="color: #008000;"> give the target VM time to start the attach mechanism</span><span style="color: #008000;"><br /></span><span style="color: #008080;"> 9</span>                 <span style="color: #0000ff;">int</span> i = 0;<br /><span style="color: #008080;">10</span>                 <span style="color: #0000ff;">long</span> delay = 200;<br /><span style="color: #008080;">11</span>                 <span style="color: #0000ff;">int</span> retries = (<span style="color: #0000ff;">int</span>)(attachTimeout() / delay);<br /><span style="color: #008080;">12</span>                 <span style="color: #0000ff;">do</span> {<br /><span style="color: #008080;">13</span>                     <span style="color: #0000ff;">try</span> {<br /><span style="color: #008080;">14</span>                         Thread.sleep(delay);<br /><span style="color: #008080;">15</span>                     } <span style="color: #0000ff;">catch</span> (InterruptedException x) { }<br /><span style="color: #008080;">16</span>                     path = findSocketFile(pid);<br /><span style="color: #008080;">17</span>                     i++;<br /><span style="color: #008080;">18</span>                 } <span style="color: #0000ff;">while</span> (i <= retries && path == <span style="color: #0000ff;">null</span>);<br /><span style="color: #008080;">19</span>                 <span style="color: #0000ff;">if</span> (path == <span style="color: #0000ff;">null</span>) {<br /><span style="color: #008080;">20</span>                     <span style="color: #0000ff;">throw</span> <span style="color: #0000ff;">new</span> AttachNotSupportedException(<br /><span style="color: #008080;">21</span>                         "Unable to open socket file: target process not responding " +<br /><span style="color: #008080;">22</span>                         "or HotSpot VM not loaded");<br /><span style="color: #008080;">23</span>                 }<br /><span style="color: #008080;">24</span>             } <span style="color: #0000ff;">finally</span> {<br /><span style="color: #008080;">25</span>                 f.delete();<br /><span style="color: #008080;">26</span>             }<br /><span style="color: #008080;">27</span>         }</div><span style="background-color: #ffffff; font-family: 微Y雅黑;">        Attach</span><span style="background-color: #ffffff; font-family: 微Y雅黑;">机制说得单点是提供Aq程可以q上Bq程Q当然是javaq程Q,创徏socketq行通信QA通过发命令给BQB然后对命令进行截取从自己的vm中获取信息发回给客户端vmQ但是ƈ不是随便发指令都会处理的Q那么attach Listener接收哪些命o呢,如下所C?br /></span><div style="padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; width: 1134.828125px; word-break: break-all;"><span style="color: #0000ff;">static</span> AttachOperationFunctionInfo funcs[] = {<br />  { "agentProperties",  get_agent_properties },<br />  { "datadump",         data_dump },<br />  { "dumpheap",         dump_heap },<br />  { "load",             JvmtiExport::load_agent_library },<br />  { "properties",       get_system_properties },<br />  { "threaddump",       thread_dump },<br />  { "inspectheap",      heap_inspection },<br />  { "setflag",          set_flag },<br />  { "printflag",        print_flag },<br />  { "jcmd",             jcmd },<br />  { NULL,               NULL }<br />};</div><strong style="line-height: 1.5; font-family: Helvetica, Tahoma, Arial, sans-serif; background-color: #ffffff;"><span style="font-family: 微Y雅黑;">         Instrumentation的实现其实主要用了loadq个指oQ它用来实现让target vm动态加载agentlibQInstrumentation的实现在一个名为libinstrument.dylib的动态lib库,linux下是libinstrument.soQ它是基于jvmti接口实现的,因此在对其进行load的时候会创徏一个agent实例Qƈ往jvmti环境注册一些回调方法,比如监听cL件加载的事gQvm初始化完成事件等Q执行Agent_OnAttach,q里会创Z个Instrumentation实例q返回给用户供大家扩展InstrumentationQ比如增加一些transform。ƈ会执行Instrumentation实例的loadClassAndCallAgentmainҎQ该Ҏ主要执行agent的MF文g里定义的 Agent-ClasscȝagentmainҎQ当vm初始化完毕之后,会调用loadClassAndCallPremainҎ,该方法主要执行agent的MF文g里定义的 Agent-Classcȝpre mainҎ。在c进行加载的时候会调用Instrumentation的transformҎQ可以看看参数里有个byte数组Q这个数l其实就是正在加载的class字节码,所以如果要字节码增强在q里可以入手啦Q甚臛_以实现偷天换?</span></strong><img src ="http://m.tkk7.com/nijiaben/aggbug/397775.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/nijiaben/" target="_blank">你假W?/a> 2013-04-12 22:38 <a href="http://m.tkk7.com/nijiaben/archive/2013/04/12/397775.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Flex+Hibernate无法U联操作解决Ҏhttp://m.tkk7.com/nijiaben/archive/2010/06/22/324136.html你假W?/dc:creator>你假W?/author>Tue, 22 Jun 2010 03:20:00 GMThttp://m.tkk7.com/nijiaben/archive/2010/06/22/324136.htmlhttp://m.tkk7.com/nijiaben/comments/324136.htmlhttp://m.tkk7.com/nijiaben/archive/2010/06/22/324136.html#Feedback0http://m.tkk7.com/nijiaben/comments/commentRss/324136.htmlhttp://m.tkk7.com/nijiaben/services/trackbacks/324136.html
       本文最初发表在http://www.lovestblog.cnQ{载请注明出处Q谢谢?/div>
 最q在忙一个项目,使用的是Flex+Spring+HibernateQ期间碰C个问题,有必要在此记录一下,也方便有怼问题的来者参考下
        问题描述Q有一个用戯和一个用戯情表Q这两个表是一个一对一的单向关联关p,卛_用户表中一个外键引用用戯情表Q我在UserInfo的映文件中使用的是many-to-oneQ设|了unique="true"表示一对一关系Q设|了cascade="save-update"表示的是在保存useInfo对象的时候会自动保存与之兌的userDetails临时对象Q即我希望的是先执行一个在用户详情表中的插入语句然后再执行一个在用户表中的插入语句,userInfo对象是从flex端传q来的,当然也设|了userDetails属性的|在userInfo的dao文g中saveҎ是这L
    public IvUserInfo save(IvUserInfo transientInstance) {
        log.debug(
"saving IvUserInfo instance");
        
try {
            getHibernateTemplate().save(transientInstance);
            log.debug(
"save successful");
        } 
catch (RuntimeException re) {
            log.error(
"save failed", re);
            
throw re;
        }
        
return transientInstance;
    }
后面发现执行的sql语句只有一条插入语句,是在用戯中的一个插入,׃外键的关联作用,是用戯的这条插入也无法执行Q这是问题所在了?/div>
        问题解决Q这个问题我也没有具体研IHibernate的源码,我先写了个测试类Q发C仅在java中执行操作的话是可以正确执行两条插入语句的,但是通过flex传过来就有问题了Q那说明是flex端传参数q来的问题,于是我试着修改UserInfo的saveҎQ?/div>

public IvUserInfo save(IvUserInfo transientInstance) {
        log.debug(
"saving IvUserInfo instance");
        
try {
            IvUserDetails ud
=new IvUserDetails();
            ud.setQq(transientInstance.getIvUserDetails().getQq());

            transientInstance.setIvUserDetails(ud);
            getHibernateTemplate().save(transientInstance);
            log.debug(
"save successful");
        } 
catch (RuntimeException re) {
            log.error(
"save failed", re);
            
throw re;
        }
        
return transientInstance;
    }
q样一来问题解决了Q顺利执行了两条插入语句?/div>
       如果朋友知道具体原因的话希望l我留言了,同时也希望该记录能帮助碰到此c问题的朋友?/div>


]]>dom4j在指定位|新增节?/title><link>http://m.tkk7.com/nijiaben/archive/2010/04/01/317153.html</link><dc:creator>你假W?/dc:creator><author>你假W?/author><pubDate>Thu, 01 Apr 2010 04:14:00 GMT</pubDate><guid>http://m.tkk7.com/nijiaben/archive/2010/04/01/317153.html</guid><wfw:comment>http://m.tkk7.com/nijiaben/comments/317153.html</wfw:comment><comments>http://m.tkk7.com/nijiaben/archive/2010/04/01/317153.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://m.tkk7.com/nijiaben/comments/commentRss/317153.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/nijiaben/services/trackbacks/317153.html</trackback:ping><description><![CDATA[         Ƣ迎光ͽW者博?a target="_blank">http://www.lovestblog.cn</a> <br />         最q两天本人在为本博实现rss发布和订阅,本来是想在前端实现xml的生成和修改Q因为用as3的E4X操作xml比较方便Q但是后面发C能ؓ元素讄CDATA|于是只好作ŞQ便只能依靠后台的java来实现此功能了,当然操作xml的话Q我首先惛_了dom4jQdom4j操作xmlq是比较方便的,卛_以轻村֮现我们的CDATA讄Q也可以为我们Q意位|插入元素提供了实现Q对于在指定位置新增节点开始我有点蒙了Q后面通过|上搜烦资源加之自己的一些理解,而实C此功能,下面展示了部分代码供今后参考吧Q?<br /> <div id="csiwygi" class="dp-highlighter"> <ol class="dp-j"> <li><span><span id="ymwcisk" class="keyword"> <div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><img id="Codehighlighter1_58_2931_Open_Image" onclick="this.style.display='none'; Codehighlighter1_58_2931_Open_Text.style.display='none'; Codehighlighter1_58_2931_Closed_Image.style.display='inline'; Codehighlighter1_58_2931_Closed_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" alt="" /><img style="display: none" id="Codehighlighter1_58_2931_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_58_2931_Closed_Text.style.display='none'; Codehighlighter1_58_2931_Open_Image.style.display='inline'; Codehighlighter1_58_2931_Open_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" alt="" /><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">static</span><span style="color: #000000"> </span><span style="color: #0000ff">int</span><span style="color: #000000"> createXMLFile(String filename,List list)</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_58_2931_Closed_Text"><img src="http://m.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_58_2931_Open_Text"><span style="color: #000000">{   <br /> <img id="Codehighlighter1_74_98_Open_Image" onclick="this.style.display='none'; Codehighlighter1_74_98_Open_Text.style.display='none'; Codehighlighter1_74_98_Closed_Image.style.display='inline'; Codehighlighter1_74_98_Closed_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" /><img style="display: none" id="Codehighlighter1_74_98_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_74_98_Closed_Text.style.display='none'; Codehighlighter1_74_98_Open_Image.style.display='inline'; Codehighlighter1_74_98_Open_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" alt="" />           </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_74_98_Closed_Text">/** */</span><span id="Codehighlighter1_74_98_Open_Text"><span style="color: #008000">/**</span><span style="color: #008000"> q回操作l果, 0表失? 1表成?nbsp;</span><span style="color: #008000">*/</span></span><span style="color: #000000">  <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />           </span><span style="color: #0000ff">int</span><span style="color: #000000"> returnValue </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">;   </span><span style="color: #000000"> <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />           Document document </span><span style="color: #000000">=</span><span style="color: #000000"> DocumentHelper.createDocument();   </span><span style="color: #000000"><br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />           Element rssElement </span><span style="color: #000000">=</span><span style="color: #000000"> document.addElement(</span><span style="color: #000000">"</span><span style="color: #000000">rss</span><span style="color: #000000">"</span><span style="color: #000000">);   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />           rssElement.addAttribute(</span><span style="color: #000000">"</span><span style="color: #000000">version</span><span style="color: #000000">"</span><span style="color: #000000">, </span><span style="color: #000000">"</span><span style="color: #000000">2.0</span><span style="color: #000000">"</span><span style="color: #000000">);   </span><span style="color: #000000">  <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />           Element channelElement </span><span style="color: #000000">=</span><span style="color: #000000"> rssElement.addElement(</span><span style="color: #000000">"</span><span style="color: #000000">channel</span><span style="color: #000000">"</span><span style="color: #000000">);   </span><span style="color: #000000"><br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />           Element titleElement </span><span style="color: #000000">=</span><span style="color: #000000"> channelElement.addElement(</span><span style="color: #000000">"</span><span style="color: #000000">title</span><span style="color: #000000">"</span><span style="color: #000000">);   </span><span style="color: #000000"><br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />           titleElement.setText(</span><span style="color: #000000">"</span><span style="color: #000000">你假W?nijiaben)心情技术博?/span><span style="color: #000000">"</span><span style="color: #000000">);    <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />              <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />           Element linkElement </span><span style="color: #000000">=</span><span style="color: #000000"> channelElement.addElement(</span><span style="color: #000000">"</span><span style="color: #000000">link</span><span style="color: #000000">"</span><span style="color: #000000">);   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />           linkElement.setText(</span><span style="color: #000000">"</span><span style="color: #000000">http://www.lovestblog.cn</span><span style="color: #000000">"</span><span style="color: #000000">);   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />              <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />           Element descriptionElement </span><span style="color: #000000">=</span><span style="color: #000000"> channelElement.addElement(</span><span style="color: #000000">"</span><span style="color: #000000">description</span><span style="color: #000000">"</span><span style="color: #000000">);   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />           descriptionElement.setText(</span><span style="color: #000000">"</span><span style="color: #000000">专注于Java,Flex技术开发研I?/span><span style="color: #000000">"</span><span style="color: #000000">);   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />              <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />           Element languageElement </span><span style="color: #000000">=</span><span style="color: #000000"> channelElement.addElement(</span><span style="color: #000000">"</span><span style="color: #000000">language</span><span style="color: #000000">"</span><span style="color: #000000">);   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />           languageElement.setText(</span><span style="color: #000000">"</span><span style="color: #000000">zh-cn</span><span style="color: #000000">"</span><span style="color: #000000">);   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />              <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />           Element lastBuildDateElement </span><span style="color: #000000">=</span><span style="color: #000000"> channelElement.addElement(</span><span style="color: #000000">"</span><span style="color: #000000">lastBuildDate</span><span style="color: #000000">"</span><span style="color: #000000">);   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />           lastBuildDateElement.setText(</span><span style="color: #0000ff">new</span><span style="color: #000000"> java.text.SimpleDateFormat(</span><span style="color: #000000">"</span><span style="color: #000000">yyyy-mm-dd hh:mm:ss</span><span style="color: #000000">"</span><span style="color: #000000">,Locale.CHINA).format(((ArticleInfo)(list.get(</span><span style="color: #000000">0</span><span style="color: #000000">))).getCreateTime()));             <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                    <br /> <img id="Codehighlighter1_1487_2496_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1487_2496_Open_Text.style.display='none'; Codehighlighter1_1487_2496_Closed_Image.style.display='inline'; Codehighlighter1_1487_2496_Closed_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" /><img style="display: none" id="Codehighlighter1_1487_2496_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1487_2496_Closed_Text.style.display='none'; Codehighlighter1_1487_2496_Open_Image.style.display='inline'; Codehighlighter1_1487_2496_Open_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" alt="" />           </span><span style="color: #0000ff">for</span><span style="color: #000000">(</span><span style="color: #0000ff">int</span><span style="color: #000000"> i</span><span style="color: #000000">=</span><span style="color: #000000">list.size()</span><span style="color: #000000">-</span><span style="color: #000000">1</span><span style="color: #000000">;i</span><span style="color: #000000">></span><span style="color: #000000">0</span><span style="color: #000000">;i</span><span style="color: #000000">--</span><span style="color: #000000">)</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_1487_2496_Closed_Text"><img src="http://m.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_1487_2496_Open_Text"><span style="color: #000000">{   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />               ArticleInfo ainfo</span><span style="color: #000000">=</span><span style="color: #000000">(ArticleInfo)(list.get(i));   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />               Element itemElement </span><span style="color: #000000">=</span><span style="color: #000000"> channelElement.addElement(</span><span style="color: #000000">"</span><span style="color: #000000">item</span><span style="color: #000000">"</span><span style="color: #000000">);   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />               Element title1Element </span><span style="color: #000000">=</span><span style="color: #000000"> itemElement.addElement(</span><span style="color: #000000">"</span><span style="color: #000000">title</span><span style="color: #000000">"</span><span style="color: #000000">);   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />               title1Element.setText(ainfo.getTitle());   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />               Element description1Element </span><span style="color: #000000">=</span><span style="color: #000000"> itemElement.addElement(</span><span style="color: #000000">"</span><span style="color: #000000">description</span><span style="color: #000000">"</span><span style="color: #000000">);   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />               </span><span style="color: #0000ff">int</span><span style="color: #000000"> maxLen</span><span style="color: #000000">=</span><span style="color: #000000">5000</span><span style="color: #000000">;   <br /> <img id="Codehighlighter1_1941_2022_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1941_2022_Open_Text.style.display='none'; Codehighlighter1_1941_2022_Closed_Image.style.display='inline'; Codehighlighter1_1941_2022_Closed_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" /><img style="display: none" id="Codehighlighter1_1941_2022_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1941_2022_Closed_Text.style.display='none'; Codehighlighter1_1941_2022_Open_Image.style.display='inline'; Codehighlighter1_1941_2022_Open_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" alt="" />               </span><span style="color: #0000ff">if</span><span style="color: #000000">(ainfo.getRssContent().length()</span><span style="color: #000000"><</span><span style="color: #000000">5000</span><span style="color: #000000">)</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_1941_2022_Closed_Text"><img src="http://m.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_1941_2022_Open_Text"><span style="color: #000000">{   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                   maxLen</span><span style="color: #000000">=</span><span style="color: #000000">ainfo.getRssContent().length();   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" />               }</span></span><span style="color: #000000">   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />               description1Element.addCDATA(ainfo.getRssContent().substring(</span><span style="color: #000000">0</span><span style="color: #000000">, maxLen));          <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />               Element pubDate</span><span style="color: #000000">=</span><span style="color: #000000">itemElement.addElement(</span><span style="color: #000000">"</span><span style="color: #000000">pubDate</span><span style="color: #000000">"</span><span style="color: #000000">);   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />               pubDate.setText(</span><span style="color: #0000ff">new</span><span style="color: #000000"> java.text.SimpleDateFormat(</span><span style="color: #000000">"</span><span style="color: #000000">yyyy-mm-dd hh:mm:ss</span><span style="color: #000000">"</span><span style="color: #000000">,Locale.CHINA).format(ainfo.getCreateTime()));                     <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />               Element link1Element</span><span style="color: #000000">=</span><span style="color: #000000">itemElement.addElement(</span><span style="color: #000000">"</span><span style="color: #000000">link</span><span style="color: #000000">"</span><span style="color: #000000">);   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />               link1Element.setText(</span><span style="color: #000000">"</span><span style="color: #000000">http://www.lovestblog.cn</span><span style="color: #000000">"</span><span style="color: #000000">);   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" />           }</span></span><span style="color: #000000">   <br /> <img id="Codehighlighter1_2515_2808_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2515_2808_Open_Text.style.display='none'; Codehighlighter1_2515_2808_Closed_Image.style.display='inline'; Codehighlighter1_2515_2808_Closed_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" /><img style="display: none" id="Codehighlighter1_2515_2808_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_2515_2808_Closed_Text.style.display='none'; Codehighlighter1_2515_2808_Open_Image.style.display='inline'; Codehighlighter1_2515_2808_Open_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" alt="" />           </span><span style="color: #0000ff">try</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_2515_2808_Closed_Text"><img src="http://m.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_2515_2808_Open_Text"><span style="color: #000000">{   <br /> <img id="Codehighlighter1_2535_2559_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2535_2559_Open_Text.style.display='none'; Codehighlighter1_2535_2559_Closed_Image.style.display='inline'; Codehighlighter1_2535_2559_Closed_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" /><img style="display: none" id="Codehighlighter1_2535_2559_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_2535_2559_Closed_Text.style.display='none'; Codehighlighter1_2535_2559_Open_Image.style.display='inline'; Codehighlighter1_2535_2559_Open_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" alt="" />               </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_2535_2559_Closed_Text">/** */</span><span id="Codehighlighter1_2535_2559_Open_Text"><span style="color: #008000">/**</span><span style="color: #008000"> document中的内容写入文g?nbsp;</span><span style="color: #008000">*/</span></span><span style="color: #000000">  <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />               XMLWriter writer </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> XMLWriter(</span><span style="color: #0000ff">new</span><span style="color: #000000"> FileOutputStream(path</span><span style="color: #000000">+</span><span style="color: #000000">filename));   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />               writer.write(document);   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />               writer.close();   <br /> <img id="Codehighlighter1_2743_2758_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2743_2758_Open_Text.style.display='none'; Codehighlighter1_2743_2758_Closed_Image.style.display='inline'; Codehighlighter1_2743_2758_Closed_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" /><img style="display: none" id="Codehighlighter1_2743_2758_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_2743_2758_Closed_Text.style.display='none'; Codehighlighter1_2743_2758_Open_Image.style.display='inline'; Codehighlighter1_2743_2758_Open_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" alt="" />               </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_2743_2758_Closed_Text">/** */</span><span id="Codehighlighter1_2743_2758_Open_Text"><span style="color: #008000">/**</span><span style="color: #008000"> 执行成功,需q回1 </span><span style="color: #008000">*/</span></span><span style="color: #000000">  <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />               returnValue </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">;   <br /> <img id="Codehighlighter1_2828_2884_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2828_2884_Open_Text.style.display='none'; Codehighlighter1_2828_2884_Closed_Image.style.display='inline'; Codehighlighter1_2828_2884_Closed_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" /><img style="display: none" id="Codehighlighter1_2828_2884_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_2828_2884_Closed_Text.style.display='none'; Codehighlighter1_2828_2884_Open_Image.style.display='inline'; Codehighlighter1_2828_2884_Open_Text.style.display='inline';" align="top" src="http://m.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" alt="" />           }</span></span><span style="color: #0000ff">catch</span><span style="color: #000000">(Exception ex)</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_2828_2884_Closed_Text"><img src="http://m.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_2828_2884_Open_Text"><span style="color: #000000">{   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />               ex.printStackTrace();   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" />           }</span></span><span style="color: #000000">   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />           </span><span style="color: #0000ff">return</span><span style="color: #000000"> returnValue;   <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" alt="" />        }</span></span><span style="color: #000000">  <br /> <img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span></div> </span></span></li> </ol> </div> <img src ="http://m.tkk7.com/nijiaben/aggbug/317153.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/nijiaben/" target="_blank">你假W?/a> 2010-04-01 12:14 <a href="http://m.tkk7.com/nijiaben/archive/2010/04/01/317153.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MySQL select语句之from从句http://m.tkk7.com/nijiaben/archive/2009/09/24/296301.html你假W?/dc:creator>你假W?/author>Thu, 24 Sep 2009 07:51:00 GMThttp://m.tkk7.com/nijiaben/archive/2009/09/24/296301.htmlhttp://m.tkk7.com/nijiaben/comments/296301.htmlhttp://m.tkk7.com/nijiaben/archive/2009/09/24/296301.html#Feedback0http://m.tkk7.com/nijiaben/comments/commentRss/296301.htmlhttp://m.tkk7.com/nijiaben/services/trackbacks/296301.html          本文最新发布于http://www.lovestblog.cn,Ƣ迎转蝲该文Q但h明文章出处,谢谢合作?nbsp;

          mysql的from从句用来指定参与查询的表Q当然也可以是生成的中间表,在表前我们有旉要指定数据库Q这主要是用在我们需要访问当前数据库之外的数据库中的表的情况Q在q中情况下我们采?."操作W来q行Q如userdb.userQ其实userdb为数据库名,user名,q是对mysql数据库而言的,对于DB2和Oracle׃是通过指定数据库名了,而是指定sql用户了,q就是说不同sql用户可以建立相同名字的表Q但是同一个sql用户只能建立唯一名字的表。这是它们在这表规范上面的区别。对于列规范Qmysql可以在需要查询的列则可以采用如下形式q行讉KQ?#8220;数据库名.表名.列名”。对于多个表的规范,也就是涉及查询多个表的情况下Q执行的q程是采用笛卡尔U的形式q行的。也是说生成的中间表的列数Z个表中列数的dQ而行的L{于一个表中的行的数量与另外一个表中行的数量的乘积?br />        对于from从句中用假名的情况Q比如select u.id,name,age,a.account from utb as u,atb as a where u.id=a.user_idQ在我们使用假名之后Q那么在该sql语句的Q何地斚w只能使用假名Q不能用真实的表名Q同时上面的as关键字也是可以省略的Q也是说对于上面的语句不能用atb来取代aQutb来取代u了。虽然from从句不是我们指定的第一条语句,但是l对是第一个被处理的语句,所以在声明假名前用假名不会导致错误。如果一条from从句引用C个有着相同名称的表Q则必须使用假名。如Q?br />

1select p.playerno
2from players as p,players as par
3where par.fn="jp" and par.ln="l" and p.birth_date<par.birth_date


       对于多个表间的连接处理可能会D有相同的l果Q即有重复的l果Qsqlq不会自动从最l结果中删除重复的行Q这是如果我们不希望在结果中出现重复的行Q那么我们可以在select后直接指定distinct。如Q?br />

1select distinct T.playerno 
2from teams as T,penalties as pen 
3where T.playerno=pen.playerno?/span>

 

        接下来说说连接哈Q对于内q接Q如果是两个表的话,取两个表的一个交集,如果是左外连接的话,那就是左边的表全取,双没有的用null替代Q弱国是叛_q接的话Q那是双的表全取Q左Ҏ有的用null表示。下面看看一个具体的例子Q?br />

1--表stu        --表exam 
2id name        id grade 
31, Jack         156 
42, Tom         276
53, Kity         1189
64, nono 

 

内连?Q显CZ表id匚w的)

1select stu.id,exam.id,stu.name, exam.grade from stu (inner) join exam on stu.id=exam.id 
2-------------------------------- 
31 1 Jack 56 
42 2 Tom 76 

 

左连接(昄join 左边的表的所有数据,exam只有两条记录Q所以stu.id,grade 都用NULL 昄Q?

1select stu.id,exam.id,stu.name, exam.grade from stu left (outer) join exam on stu.id=exam.id 
21 1 Jack 56 
32 2 Tom 76 
43 NULL Kity NULL 
54 NULL nono NULL 

 

双接(与作q接相反Q显Cjoin双表的所有数据)

1select stu.id,exam.id,stu.name, exam.grade from stu right join exam on stu.id=exam.id 
21 1 Jack 56 
32 2 Tom 76 
4NULL 11 NULL 89 

 

内连接取交集Q外q接分左和右Q?
左连接左边的全取Q?
双接右边的全取

      对于q接的列的名U相同的话,那么可以使用using来替代条Ӟ如上面的内连接可以这h写:
    

1  select stu.id,exam.id,stu.name, exam.grade from stu inner join exam using(id)?/span>

      对于左外q接使用的情况一般是当左表的q接列中存在未出现在双的连接列中的值时Q左外连接才有用?br />       q有个全外连接的Q也是说只要在两个表中出现的记录都会在中间表中出现Q当双有而左表没有或当左表有而右表没有的时候用null表示。具体语法如下:select stu.id,exam.id,stu.name, exam.grade from stu full join exam using(id)?br />       交叉q接Q就是显C求表的W卡积Qselect * from teams cross join penalties.q句完全{h于select teams.*,penalties.* from teams,penalties.
      联合q接Qselect * from teams union join penalties,q个其实很容易理解,产生l果所包含的列Z个表所有的列和Q对于数据的列出Q首先列出左表的数据Q对于属于右表的列,用null表示Q接下来列出双的数据,对于属于左表的列用null表示?br />        自然q接Qselect * from teams nature inner join penalties where division='first'Q此句完全等同与select t.playerno,t.teamno,t.division,pen.paymentno,pen.payment_date,pen.amount from teams  as t inner join penalties as pen on t.playerno=pen.playerno where dividion='first'.相比q道,我们无须昄指出必须要连接到哪些列,sql会自动查找两表中是否有相同名U的?且假设他们必dq接条g中用。此处的on或using从句是多余的Q因此不允许使用?/p>

       下面看个例子创徏一个称为towns的虚拟表Q?br />

1select *
2from (select 'Stratford' as town,4 as number 
3       union
4       select 'Plymouth',6
5       union
6       select 'Inglewood',1                 
7       union
8       select 'Douglas',2) as towns
9order by town;


l果为:

1town             number
2----------------------
3Douglas              2
4Inglewood           1
5Plymouth            6
6Stratford            4


 



]]>
SQL标量函数APIhttp://m.tkk7.com/nijiaben/archive/2009/09/23/296186.html你假W?/dc:creator>你假W?/author>Wed, 23 Sep 2009 08:54:00 GMThttp://m.tkk7.com/nijiaben/archive/2009/09/23/296186.htmlhttp://m.tkk7.com/nijiaben/comments/296186.htmlhttp://m.tkk7.com/nijiaben/archive/2009/09/23/296186.html#Feedback1http://m.tkk7.com/nijiaben/comments/commentRss/296186.htmlhttp://m.tkk7.com/nijiaben/services/trackbacks/296186.htmlhttp://www.lovestblog.cnQ请转蝲的该文者注明文章出处,谢谢合作?
     下面单介l几U标量函敎ͼ也是常用的,我们可以通过cMselect abs(-123);的语句来看到我们标量函数的效果?
      absQ该函数q回一个数D辑ּ的绝对倹{如abs(-123);

     adddateQ该函数一个时间间?参数2)d到时x时戳表达?参数1)中,与此函数同功能的q有date_add。如adddate('2009-01-01',4);l果?009-01-05。adddate(2009-01-01,interval 5 month);l果?009-06-01。adddate(timestamp('2009-01-01'),interval 5 month);l果?009-06-01 00:00:00。adddate('2009-01-01 12:00:00',interval 5 day);l果?009-01-06 12:00:00?

      addtimeQ把两个旉表达式加h。如addtime('100:00:00','200:02:04');l果?00:02:04?

      asciiQ该函数q回一个字W串表达式的W一个字W的ASCII倹{?

      binQ该函数参数的数D{换ؓ二进制倹{?

      bit_countQ该函数昄表示参数的值的位数。如bit_count(3)l果??

      bit_lengthQ该函数q回字符串值的位长度。如bit_length(bin(2));l果?6

      ceilingQ该函数q回大于或等于参数值的最大整数。如ceiling(11.11);->12。ceicling(-11.11);->-11

      charQ该函数q回数值参数的字符串字W?与此函数同功能的q有chr函数。如char(82)+char(105)+char(99)+char(107);->'Rich'

      character_lengthQ该函数q回一个字W串表达式的长度Q此Ҏ同功能的q有char_length函数?

      charsetQ该函数q回字符串参数的字符集的名称?

      coalesceQ该函数接受多个参数Q返回第一个非null值的参数的倹{如coalesce(null,null,'ljp');->'ljp';

      concatQ该函数合ƈ两个字符串的倹{?

      convQ该函数一基数为参?的|参数1Q{换ؓ另一个以参数3为基数的倹{如conv(1110,10,16)表示以10q制的数1110转换?6q制gؓ456。后面两个参数必M?~36之间Q否则结果ؓnullQ此外参?的值应该匹配参?的基敎ͼ否则l果??

      convertQ该函数转换参数1的数据类型ؓ参数2指定的类型。参?必须是一U数据类型,包括binary,char,date,datetime,time,signed,signed integer,unsigned,unsigned integer,varchar。如convert('12.56',unsigned integer);->13?

      databaseQ该函数昄当前数据库的名称?

      dateQ该函数参数变换ؓ一个日期倹{如date('2009-01-01 12:00:00');->'2009-01-01'?

      datediffQ该函数计算两个日期或时间戳表达式间的天数。第一个参数减ȝ二个参数?

      date_subQ该函数从一个日期或旉戌辑ּQ参CQ中减去一个时间间隔(参数2Q,与才函数同功能的q有subdate函数?

      dayQ该函数从一个日期或旉戌辑ּ中返回月的天敎ͼl果L介于1~31之间的整敎ͼ与此函数同功能的q有dayofmonth?

      daynameQ该函数从一个日期或旉戌辑ּ中返回一周中某天的名U?

      dayofweekQ该函数q回一个日期或旉戌辑ּ中返回某周的天数的序受该l果L介于1~7之间的整数?

      dayofyearQ该函数q回一个日期或旉戌辑ּ中返回一q中某日的序受?

      defaultQ该函数q回参数指定的某列的默认倹{?

      floorQ该函数q回于或等于参数值的最整敎ͼ与ceiling相对?

      expQ该函数q回e的xơ幕的结果?

      formatQ该函数一个数值的格式讄为nn,nnn,nnn.nnn的格式。第二个参数表示数点后的数字个数?

      greatestQ该函数q回一pd参数中的最大|和least相对?

      hexQ如果参Cؓ数字Q那么就q回该数字的十六q制表示Q如果是字符Ԍ那么返回每个字W对应的ASCII码?

      ifQ如果第一个参数gؓtrueQ那么函数返回第二个参数的|否则q回W三个参数的倹{如if((1>2),"ljp","st");返回st?

      ifnullQ如果参?的gؓnullQ那么返回参?的|否则q回参数1的倹{如ifnull(null,"ljp");q回"ljp"?

      insertQ参?的值放在参?中由参数2指定的位|,参数3表示参数1中从参数2指定的位|开始接下来的几个字W将被参?取代。如insert('abcdefgh',4,3,'zzz');->'abczzzgh'。insert('abcdefgh',,4,2,'zzz');->'abczzzfgh'。insert('abcdefgh',4,0,'zzz');->'abczzzdefgh'。insert('abcdefgh',4,-1,'zzz');->'abczzz'。insert('abcdefgh',1,5,'zzz');->'zzzfgh'?

      instrQ该函数q回参数1内参?的v始位|。如果ؓ扑ֈQ则q回0。如instr('12345',4);->4?

      intervalQ该函数W一个参数指定要插入的|接下来的参数l成一个升序序列,看第一个参数该插入哪个位置。该函数是q回该位|。如interval(5,0,1,2,3,6,7);->4表示要把5攑֜W四个位|?此位|上gؓ3)之后?

      isnullQ如果参数gؓnullQ那么返?Q否则返??

      last_dayQ该函数q回参数指定的日期或旉戌辑ּ中月的最后一天,如last_day('2009-01-09');->'2009-01-31'?

      lcaseQ该函数参数的值的所有大写字母{换ؓ写字母Q与lower同义Q与ucase相对?

      leftQ该函数q回一个字W串值参?的左侧部分,该部分的长度q二个参数指定。如left("hello world",3);->'hel'?

      lengthQ该函数q回一个字W串值的字节长度。如length(null);->null?

      lnQ该函数q回参数的自然对敎ͼ与log同义?

      localtimeQ该函数q回pȝ日期和时_localtimestamp与只同义?

      locateQ该函数q回参数1在参?内的L位置。如果参?在参?内未出现Q则q回0。参?表示开始搜索的位置。注意instr函数的区别,instr函数是返回参?内参?的开始位|?

      log2Q返回参C2为底的对数。如log2(64);->6

      log10Q返回参C10为底的对数?

      lpadQ参?的值填充在参数1的左侧,直到该值的总长度等于参?的长度。如果最大长度小于参?的长度,则参?在左侧被截取。如lpad('data',6,'base');->'badata'。lpad('data',2,'base');->'da'?

      ltrimQ该函数删除出现在参数前的所有空白,rtrim表示删除参数末尾的所以空白?

      makedateQ参?表示天数Q他们被d到参?中。如makedate(2009,10);->'2009-01-10'?

      maketimeQ三参数分别表示时Q分钟,U钟。其中分钟和U钟必须?~59之间Q否则会q回null?

      midQ该函数提取参数1中的部分字符串|参数2标识开始位|,参数3标识字符数。如mid('database',5);->'base'。mid('database',5,2);->'ba'。mid('database',-6);-> 'tabase'。mid('database',-6,3);->'tab'?

      minuteQ该函数从一个时间或旉戌辑ּ中返回分钟数?

      modQ该函数q回两参数相除的余数。如mod(15.4,4,4);->2.2

      monthQ返回时间戳中的月䆾敎ͼg?~12之间?

      monthnameQ该函数从一个日期或旉戌辑ּ中返回月的名U。如monthname('2009-01-01');->‘April’?

      nowQ返回系l日期和旉?

      nullifQ如果参?的值等于参?的|那么函数q回null。否则返回参?的倹{?

      octQ该函数q回八进制参?的十q制数。如oct(8);->10

      ordQ该函数q回参数指定的字W串表达式的W一个字W的字符集位|。如ord('Das');->68?

      period_addQ该函数月数添加到一个指定的日期Q日期格式必MؓYYYYMM或YYMM。结果格式ؓYYYYMM。如period_add('200901',3);->200904?

       period_diffQ该函数q回两个日期间的月数。如period_diff('200908','200901');->7

       PIQ返回圆周率?

       powerQ返回参?的参?ơ幂?

       quarterQ该函数从一个日期或旉戌辑ּ中返回季度倹{结果的值L介于1~4之间。不q和我们日常生活中的季度不同1~3月ؓ1Q?~6月ؓ2Q?~9月ؓ3Q?0~12月ؓ4?

       randQ该函数q回0.0?.0之间的一个随机数。参数表CZ一个随机值的计算L。用相同的参数值重复调用该函数Q结果L相同的。如cast(rand()*1000 as unsigned integer);

       repeatQ该函数参?的值重复参?l定的次数?

       replaceQ该函数使参?指定的字W串中由参数2指定的值替换ؓ参数3指定的倹{如replace('data','a','e');->'dete'?

       reverseQ该函数颠倒一个字W串g的字W的序?

       rightQ该函数q回参数1的右侧部分。该部分长度q二个参数指定?

       roundQ该函数一个数字的_ֺ舍入到指定的位数。如round(123.4,-1);->100;round(183.4,-2);->200?

       rpadQ将参数3的值填充到参数1的右侧,知道值的总长度等于参?指定的长度,与lpad相对。rpad('data',2,'base')->'da'?

       secondQ该函数q回一个时间或旉戌辑ּ中的U数?

       sec_to_timeQ该函数秒数变换ؓ旉。如sec_to_time((24*60*60)-1);->23:59:59

       signQ该函数q回一个数值的字符。sign(50);->1;sign(0)->0;sign(-50)->-1;

       spaceQ该函数生成一个空DQ空gCؓ参数指定的倹{?

       sqrtQ返回参数的qx根倹{?

       strcmpQ该函数比较两个字符串表辑ּ的倹{如果参数值相{,那么l果?Q如果参?的D,那么q回-1Q否则结果ؓ1?

       substringQ该函数从参?中减去部分字W串|参数2l出起始点,参数3l出子付数。如substring('database',5,2);->'ba'?

       substring_indexQ该函数查找参数2表示的值在参数1中的W参?此出现。如果参?为正表示从左侧查找,q回从左侧开始找到的该次出现。如果参?Q则从右侧开始查找。如substring_index('database','a',3);->'datab';substring_index('database','a',-3);->'tabase';substring_index('database','data',1);->'';substring_index('database','data',-1);->'base'  
   
       subtimeQ该函数对两个时间表辑ּ执行相减操作q返回一个新旉Qtimediff与此函数功能怼?

       timeQ该函数q回一个时间或旉戌辑ּ的时间部分。如time('12:13');->12:13:00

       time_to_secQ该函数时间变换ؓU数。如time_to_sec('00:16:40');->1000

       timestampdiffQ该函数计算两个日期或时间戳表达式间的时间。参?表示旉间隔单元Q如dayQmonthQyearQquarterQweekQhourQminuteQsecondQfrac_secondQ参?和参?形成两个表达式。如timestampdiff(day,'2009-01-01','2009-01-04');->4.

       timestampQ该函数参?变换Z个时间戳Q如果指定了参数2Q则它应该是一个时间表辑ּQ且会被d到参?的g?

       timestampaddQ该函数时间间隔添加到一个日期或旉戌辑ּ。参?表示旉间隔的单元,参数2表示天数或月数等Q参?表示旉间隔d到的表达式。如timestampadd(DAY,2,'2009-01-01');->'2009-01-03';timestampadd(MONTH,2,'2009-01-01');->"2009-03-01"?

       trimQ该函数删除参数1表示的字W串g开始和最后的所有空根{?

       truncateQ该函数数字截断到指定的小C敎ͼ注意和round的区别,round是四舍五入,而truncate是截断。如truncate(123.45,-1);->120。truncate(123.375,1);->123.3?

       unhexQ与hex相对Q将十六q制表示的参数{换ؓ相应的字W。如unhex(hex('hello'))'->hello

       ucaseQ类似upperQ都是将参数中的所有小写字母{换ؓ大写字母?

       weekQ该函数从一个日期或旉戌辑ּ中返回周敎ͼcM的函数还有weekofyear。结果介?~53之间的一个整数。如week('2009-06-07');->23

       weekdayQ该函数q回一周中的天数。结果ؓ介于0~6之间的数?表示星期一?

       yearQ该函数从一个日期或旉戌辑ּ中返回年数?
       yearweekQ如果指定参?Q则该函C一个时间戳或日期表辑ּ中返回格式ؓYYYYWW的年份及周数。周数的范围?1~52之间。如yearweek('2009-07-06');->200927


]]>
Flex OsWorkflow AIR版本(在原有基上增加了导入文g功能Q还有变直线为折U的功能)http://m.tkk7.com/nijiaben/archive/2009/09/05/294005.html你假W?/dc:creator>你假W?/author>Sat, 05 Sep 2009 10:28:00 GMThttp://m.tkk7.com/nijiaben/archive/2009/09/05/294005.htmlhttp://m.tkk7.com/nijiaben/comments/294005.htmlhttp://m.tkk7.com/nijiaben/archive/2009/09/05/294005.html#Feedback1http://m.tkk7.com/nijiaben/comments/commentRss/294005.htmlhttp://m.tkk7.com/nijiaben/services/trackbacks/294005.html 1. 导出文g请选择文g-->>导出选项Q导出文件保存时h务必加上xml的后~
2. 鼠标Ud直线上的时候,直线会初始化昄为绿Ԍ按住鼠标不放Q拖动鼠标,会在直U上出现一个拐点,该拐点可以随便拖动,双击拐点会自动删除该拐点Q也可用框选选中拐点q行删除Q选中的拐点,初始颜色Ԍ您可以自p|,Ud时直U会恢复为粉U色
3. 可用框选选中lgq行删除Q如果ؓ半透明状态,则表明ؓ选中Q您同时可以按住ctrl键,选中其他没有被选中的组Ӟ从而进行进行加?br /> 4. 如果您本选中了某lgQ然后按住ctrl键再其框选,则该lg会被取消选中
5. 点击鼠标右键有备选菜单进行操?br /> 6. 下面的Outline是时生成的xml文gQ您可以在不导出文g的情况下查看现有的xml文g
7. 选择子元素步骤操作之后,只有当鼠标在开始节Ҏ步骤节点下面的action列表中点L才会新增一个action操作
8. 合ƈ节点只能有一个无条gq接q行q出Q合分支节点只能q出无条件连接,且可多个

9.Ҏ导入的文件生成得程图不具备定位的功能,因ؓ我觉得是多余的,只要它们之间的关pL得话,那你再在界面上进行拖拉成你喜Ƣ得样式可以了Q所以当你导入文件的时候,看到的会是每个节炚w机选择位置?br />
     以上是我在此版本中进行的pȝ说明Q请见关?-》系l说明?br />
再您下蝲我附件的同时Q请先到http://get.adobe.com/cn/air/处下载AdobeAIRInstaller.exe文gq行安装Q您系l能q行AIR文g的安装,附g为AIR格式文g?
/Files/nijiaben/OsWorkflow.rar

]]>
OsWorkflow工作设计器flex版本l于完工?/title><link>http://m.tkk7.com/nijiaben/archive/2009/07/31/289331.html</link><dc:creator>你假W?/dc:creator><author>你假W?/author><pubDate>Fri, 31 Jul 2009 15:52:00 GMT</pubDate><guid>http://m.tkk7.com/nijiaben/archive/2009/07/31/289331.html</guid><wfw:comment>http://m.tkk7.com/nijiaben/comments/289331.html</wfw:comment><comments>http://m.tkk7.com/nijiaben/archive/2009/07/31/289331.html#Feedback</comments><slash:comments>44</slash:comments><wfw:commentRss>http://m.tkk7.com/nijiaben/comments/commentRss/289331.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/nijiaben/services/trackbacks/289331.html</trackback:ping><description><![CDATA[            Ƣ迎大家提出意见Q多余的话就不多说了Q花?0天的作品Q辛苦啊׃?00多kQ所以大家在看到下面效果前,先给大家几张截图哈,如果感兴再L鼓一下那东西c也Ƣ迎各位到我个h博客上留a哈,<a >http://www.lovestblog.cn</a><br /> <img border="0" alt="" src="http://m.tkk7.com/images/blogjava_net/nijiaben/1.jpg" width="1276" height="723" /><br /> <br /> <img border="0" alt="" src="http://m.tkk7.com/images/blogjava_net/nijiaben/4.jpg" width="761" height="727" /><img border="0" alt="" src="http://m.tkk7.com/images/blogjava_net/nijiaben/5.jpg" width="1008" height="747" /><img border="0" alt="" src="http://m.tkk7.com/images/blogjava_net/nijiaben/6.jpg" width="1117" height="718" /><br /> q里好像不能插入flashQ如果大家有兴趣的话Q可以去<a target="_blank">http://www.lovestblog.cn/articlePicture/84/84.1.swf</a>体验下真实的效果?br /> <img src ="http://m.tkk7.com/nijiaben/aggbug/289331.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/nijiaben/" target="_blank">你假W?/a> 2009-07-31 23:52 <a href="http://m.tkk7.com/nijiaben/archive/2009/07/31/289331.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Flex版OSWorkflow界面展示(山寨?http://m.tkk7.com/nijiaben/archive/2009/07/24/288272.html你假W?/dc:creator>你假W?/author>Fri, 24 Jul 2009 15:30:00 GMThttp://m.tkk7.com/nijiaben/archive/2009/07/24/288272.htmlhttp://m.tkk7.com/nijiaben/comments/288272.htmlhttp://m.tkk7.com/nijiaben/archive/2009/07/24/288272.html#Feedback2http://m.tkk7.com/nijiaben/comments/commentRss/288272.htmlhttp://m.tkk7.com/nijiaben/services/trackbacks/288272.htmlhttp://www.lovestblog.cn本来也打开源的Q但是确实有Ҏ心,怕放上来Q被高h们唾骂,怕承受不了巨大的打击Q就q是先放放了Q再者也没时间去优化代码Q所以等有时间了再整理下再拿出来挨批了,呵呵Q好了说了那么多废话了,q是把这个工作流的一个截图拿出来晒晒吧,{全部完成之后在拿出来,希望能听到大家宝늚意见?


]]>
归ƈ排序http://m.tkk7.com/nijiaben/archive/2009/05/29/278925.html你假W?/dc:creator>你假W?/author>Fri, 29 May 2009 08:55:00 GMThttp://m.tkk7.com/nijiaben/archive/2009/05/29/278925.htmlhttp://m.tkk7.com/nijiaben/comments/278925.htmlhttp://m.tkk7.com/nijiaben/archive/2009/05/29/278925.html#Feedback0http://m.tkk7.com/nijiaben/comments/commentRss/278925.htmlhttp://m.tkk7.com/nijiaben/services/trackbacks/278925.htmlhttp://www.lovestblog.cn
        下面单的说说归ƈ排序Q所谓归q排序就是说把输入数l分成两l当然也可以大于2l,一般我们是{量的分?l,通过递归我们可以把长度ؓn的数l分成n个数l,我们通过一定的关键字比较把两两l合成一个有序的数组Q然后回溯到原数l大的有序数组Q具体的我就不多说了Q因为比较简单,到网上可以找些相x章看看什么是归ƈ排序Q归q排序算法可以再O(nlogn)的时间内寚w度ؓn的序列完成排序,至于合ƈ两个有序数组Q假如这两个数组的长度分别ؓm和nQ那么我们只需要O(n+m)的时间久可以完成对这两个有序数组的合qӞ下面q是代码说明之:
package org.rjb.Sort;
/**
 * 归ƈ排序Q升序排列)
 * 
@author ljp
 *
 
*/

public class MergeSort {
    
/**
     * 对原始数l进行^{划分ؓ两个子数l?br />      * 
@param nums
     
*/

    
public static void sort(int[] nums){
        
int n=nums.length;
        
if(n<=1)
            
return;
        
int nums1[]=new int[n/2];
        
int nums2[]=new int[n-n/2];
        
for(int i=0,j=nums1.length;j<nums.length;i++,j++){
            
if(i<nums1.length){
                nums1[i]
=nums[i];
            }

            nums2[i]
=nums[j];
        }

        
//递归对子数组q行划分
        sort(nums1);
        sort(nums2);
        
//把子数组排序后的l果q行合ƈ
        merge(nums,nums1,nums2);
    }

    
/**
     * 合ƈ两个有序的子数组Z个有序的数组
     * 
@param nums 合ƈ之后的数l?br />      * @param num1 有序的子数组
     * 
@param num2 有序的子数组
     
*/

    
public static void merge(int[] nums,int num1[],int num2[]){
        
int n1=num1.length-1;
        
int n2=num2.length-1;
        
int k=0;
        
int k1=0,k2=0;
        
while(k1<=n1||k2<=n2){
            
int e=0;
            
if(k1>n1){//如果W一个数l已l全部比较完了,那么我们只要直接复制W二个数l的条目到合q数l中卛_
                e=num2[k2++];
            }
else if(k2>n2){//如果W二个数l已l全部比较完了,那么我们只要直接复制W一个数l的条目到合q数l中卛_
                e=num1[k1++];
            }
else if(num1[k1]>num2[k2]){//把比较的两个条目中关键值小的放到合q数l中
                e=num2[k2++];
            }
else{
                e
=num1[k1++];
            }

            nums[k
++]=e;
        }

    }

    
/**
     * d?br />      * 
@param args
     
*/

    
public static void main(String args[]){
        
int[] nums={10,2,3,7,4,9,1};
        sort(nums);
        
for(int i=0;i<nums.length;i++){
            System.out.print(nums[i]
+" ");
        }
System.out.println();
    }

}



]]>
地堆排?/title><link>http://m.tkk7.com/nijiaben/archive/2009/05/28/278353.html</link><dc:creator>你假W?/dc:creator><author>你假W?/author><pubDate>Thu, 28 May 2009 14:14:00 GMT</pubDate><guid>http://m.tkk7.com/nijiaben/archive/2009/05/28/278353.html</guid><wfw:comment>http://m.tkk7.com/nijiaben/comments/278353.html</wfw:comment><comments>http://m.tkk7.com/nijiaben/archive/2009/05/28/278353.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/nijiaben/comments/commentRss/278353.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/nijiaben/services/trackbacks/278353.html</trackback:ping><description><![CDATA[     摘要:        本文最先发布在我的个h博客http://www.lovestblog.cn         文字转蝲自http://jaskell.blogbus.com/logs/3272503.htmlQ代码是自己写的一个测试类?  &nbs...  <a href='http://m.tkk7.com/nijiaben/archive/2009/05/28/278353.html'>阅读全文</a><img src ="http://m.tkk7.com/nijiaben/aggbug/278353.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/nijiaben/" target="_blank">你假W?/a> 2009-05-28 22:14 <a href="http://m.tkk7.com/nijiaben/archive/2009/05/28/278353.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>лǵվܻԴȤ</p> <a href="http://m.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> վ֩ģ壺 <a href="http://kmyake.com" target="_blank">wwwһwww</a>| <a href="http://sjmthanks.com" target="_blank">һѹۿwwwƵ</a>| <a href="http://331927.com" target="_blank">ɫרһ</a>| <a href="http://skcncar.com" target="_blank">þþƷƷ޾Ʒ</a>| <a href="http://ynkmht.com" target="_blank">ŷŮƵ</a>| <a href="http://doctor5470.com" target="_blank">ƷרëƬ</a>| <a href="http://fns92.com" target="_blank">ѨƬ߹ۿͬѧ </a>| <a href="http://416164.com" target="_blank">Ļ߾ƷӰ </a>| <a href="http://pohezi.com" target="_blank">ɫͼۺվ</a>| <a href="http://7299jj.com" target="_blank">պһҳƷ</a>| <a href="http://006dh.com" target="_blank">ѱ̬Ƶַվ </a>| <a href="http://https357171.com" target="_blank">޹˾þһ</a>| <a href="http://fjwkjx.com" target="_blank"></a>| <a href="http://yaboxxx125.com" target="_blank">ҹ717</a>| <a href="http://350725.com" target="_blank">޾Ʒþþþþ</a>| <a href="http://zhaosifuwang.com" target="_blank">רAVվ</a>| <a href="http://arkinbokis.com" target="_blank">91Ʒ</a>| <a href="http://ryhjled.com" target="_blank">˿Ƶ</a>| <a href="http://65123456.com" target="_blank">aëƬƵ</a>| <a href="http://scdsrq.com" target="_blank">vaѾƷ</a>| <a href="http://okgou58.com" target="_blank">žƵƵѹۿ</a>| <a href="http://youkabaitiao.com" target="_blank">˳վ</a>| <a href="http://sdzhly.com" target="_blank">˳ɫ777777Ʒ</a>| <a href="http://youtobey.com" target="_blank">һ</a>| <a href="http://dzyong.com" target="_blank">˳ɵӰ߹ۿ</a>| <a href="http://wogool.com" target="_blank">޳aƬ߹ۿapp</a>| <a href="http://simupiao.com" target="_blank">þþƷAV鶹 </a>| <a href="http://zzmm88.com" target="_blank">һƵ</a>| <a href="http://ynkaishan.com" target="_blank">רר</a>| <a href="http://ekyzs.com" target="_blank">޸߾Ʒ</a>| <a href="http://88ww99.com" target="_blank">У԰޴ɫС˵ϼ</a>| <a href="http://3688008.com" target="_blank">ůһ</a>| <a href="http://455zx.com" target="_blank">ŮڵƵվ </a>| <a href="http://ai-xian.com" target="_blank">?vŮ˵߹ۿ</a>| <a href="http://pjwys.com" target="_blank">ĻӰĻַ8848aa</a>| <a href="http://junyehome.com" target="_blank">պһëƬ</a>| <a href="http://www3ratcom.com" target="_blank">պëƬ</a>| <a href="http://sd-ll.com" target="_blank">ִִӲֳ</a>| <a href="http://9522952.com" target="_blank">vƬ߹ۿڵ</a>| <a href="http://100357.com" target="_blank">޳˰aa߹ۿ</a>| <a href="http://88ww99.com" target="_blank">Ƶ߾Ʒ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>