MCPcopy Index your code
hub / github.com/epcdiy/timemachineplus / exeSql

Method exeSql

src/main/java/MySQLHelper.java:87–118  ·  view source on GitHub ↗
(String sql)

Source from the content-addressed store, hash-verified

85
86
87 public boolean exeSql(String sql)
88 {
89 try {
90 if(!conn.isValid(1000))
91 {
92 if(!init())
93 {
94 return false;
95 }
96 }
97 conn.setAutoCommit(true);
98 PreparedStatement pst = conn.prepareStatement(sql);// 准备执行语句
99 pst.execute();
100 pst.close();
101 return true;
102 } catch (SQLException e)
103 {
104 StringWriter sw = new StringWriter();
105 PrintWriter pw = new PrintWriter(sw);
106 e.printStackTrace(pw);
107 logger.error(e.toString());
108 if(sql.length()>256)
109 {
110 logger.error(sql.substring(0, 256)+"...");
111 }
112 else
113 {
114 logger.error(sql);
115 }
116 }
117 return false;
118 }
119
120 public boolean importSql(String filePath)
121 {

Callers 6

exeCopyMethod · 0.80
XCopyMethod · 0.80
beginbackupMethod · 0.80
finishbackupMethod · 0.80
deleteByBackuprootidMethod · 0.80
removeWastedDataMethod · 0.80

Calls 2

initMethod · 0.95
closeMethod · 0.80

Tested by

no test coverage detected