Examples of SqlXmlObject


Examples of org.nutz.dao.convent.tools.pojo.SqlXmlObject

    nodeList=doc.getElementsByTagName("update");//�õ����б�ǩΪupdate��node
    buildeXmlObject(nodeList);
  }
  private static void buildeXmlObject(NodeList nodeList) {
    for(int i=0;i<nodeList.getLength();i++){//��������sqlnode
      SqlXmlObject sqlObject = new SqlXmlObject();//����һ������
      Node node=nodeList.item(i);//�õ����е�һ��
      NamedNodeMap nodeMap=node.getAttributes();
      String sqlId=nodeMap.getNamedItem("id").getNodeValue();//�õ�id����
     
      NodeList list=node.getChildNodes();//�õ�sql node���ӽڵ�
      String sqlContent=list.item(0).getNodeValue();//�õ����е�sql
      if(sqlContent==null||"".equals(sqlContent.trim())){
        if(list.getLength()>0){
          sqlContent=list.item(1).getNodeValue();
        }
        if(sqlContent==null||"".equals(sqlContent.trim())){
          throw new RuntimeException("��sqlIdΪ"+sqlId+"��û���ҵ���Ч��sql���!");
        }
      }
      String[] sqls=sqlContent.trim().split("\n");//�����н��зָ�
      StringBuffer newSql=new StringBuffer();//����һ���µ��ַ������洢�޸ĺ��sql���
      for(int j=0;j<sqls.length;j++){
        newSql.append(fiterSql(sqls[j]));
      }
      sqlObject.setSqlId(sqlId);
      sqlObject.setSqlContent(newSql.toString().trim());
      //���ж��Ƿ��Ѿ�����,����о��׳��쳣
      Object sqlObj=sqlMap.get(sqlId);
      if(sqlObj!=null){
        throw new RuntimeException("�Ѿ����ڱ��Ϊ"+sqlId+"��sql���!");
      }
View Full Code Here

Examples of org.nutz.dao.convent.tools.pojo.SqlXmlObject

   * ���������õ�sql���Ὣibatis��#name#��ʽ��Ϊ?
   * @param sqlId sql���ı��
   * @return sql���
   */
  public static String getSql(String sqlId){
    SqlXmlObject sqlObj= (SqlXmlObject) sqlMap.get(sqlId);
    if(sqlObj==null){
      throw new RuntimeException("û���ҵ�sql���Ϊ:"+sqlId+"��sql���");
    }
    return sqlObj.getSqlContent().replaceAll("#[a-zA-Z]+[1-9]?#", "?");
  }
View Full Code Here

Examples of org.nutz.dao.convent.tools.pojo.SqlXmlObject

   * ���ԭʼ��sql���
   * @param sqlId sql���ı��
   * @return sql���
   */
  public static String getFormerSql(String sqlId){
    SqlXmlObject sqlObj= (SqlXmlObject) sqlMap.get(sqlId);
    if(sqlObj==null){
      throw new RuntimeException("û���ҵ�sql���Ϊ:"+sqlId+"��sql���");
    }
    return sqlObj.getSqlContent();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.