Sql文整理 小函数

private void showSql(String strIn)
    {
     String strOut = "";
     strOut = strIn.toUpperCase();
     strOut = strOut.replaceAll(" and ","\n\t and ");
     strOut = strOut.replaceAll(" on ","\n\t on ");
     strOut = strOut.replaceAll(" inner join ","\n inner join ");
     strOut = strOut.replaceAll(" left outer join ","\n left outer join ");
     strOut = strOut.replaceAll(" left join ","\n left join ");
     
     strOut = strOut.replaceAll(" AND ","\n\t AND ");
     strOut = strOut.replaceAll(" ON ","\n\t on ");
     strOut = strOut.replaceAll(" INNER JOIN ","\n inner join ");
     strOut = strOut.replaceAll(" LEFT OUTER JOIN ","\n left outer join ");
     strOut = strOut.replaceAll(" LEFT JOIN ","\n left join ");
     System.out.println(strOut);
     return ;
    }

你可能感兴趣的:(sql)