JdbcFactory jdbc = new JdbcFactory(); String sqld = "select id from hnebony_user where username REGEXP '" + usernamebefor + "[1-9][0-9]+' and telephone='' LIMIT 0,1 for update"; Connection conn = jdbc.conn; try { conn.setAutoCommit(false); Statement stat = conn.createStatement(); ResultSet re = stat.executeQuery(sqld); int id = 0; while(re.next()){ id = re.getInt(1); System.out.println(id); } String sql = "update hnebony_user set telephone='" + phone + "',active_time='" + date + "',callingID='" + mac + "',address='" + ip + "',IDcard='" + wxbz + "',name='" + weizhiId + "',pause_time='" + datelift + "',modified_by='" + shebei + "' where id=" + id; stat.execute(sql); conn.commit(); re.close(); stat.close(); conn.close(); return 1; } catch (SQLException e) { e.printStackTrace(); }
mysql 锁行查询吗_MySQL数据库查询锁行代码示例
最新推荐文章于 2024-08-15 14:33:17 发布