-
-
Save fafonso/1081c9a49a76e9981c2ec448b88cccb1 to your computer and use it in GitHub Desktop.
Running SQL queries from liferay's groovy console
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.sql.Connection; | |
| import java.sql.ResultSet; | |
| import java.sql.SQLException; | |
| import java.sql.Statement; | |
| import com.liferay.portal.kernel.dao.jdbc.DataAccess; | |
| Connection con = null; | |
| Statement st = null; | |
| try { | |
| con = DataAccess.getUpgradeOptimizedConnection(); | |
| st = con.createStatement(); | |
| ResultSet rs = st.executeQuery("select count(1) from Address where uuid_ is null or uuid_ = ''"); | |
| rs.next(); | |
| println(rs.getInt(1)); | |
| } | |
| finally { | |
| DataAccess.cleanUp(con, st); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment