Created
March 18, 2020 03:42
-
-
Save cuongld2/e7c93328de19416a4c29240c099dbec3 to your computer and use it in GitHub Desktop.
Define sql queries
This file contains 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
package common.db.blog; | |
import common.db.Base; | |
import java.util.List; | |
import java.util.Map; | |
public class BlogSimple extends Blog { | |
private Base base = new Base(); | |
public List<Map<String, Object>> getAllUserInfo() throws Exception { | |
String query = "select * from user_info"; | |
return base.executeQuery(blogDbConnect.getSession(), query); | |
} | |
public void clearUserInfoByUsername(String username) { | |
String query = String.format("delete from user_info where username = '%s'", username); | |
base.queryNoReturn(blogDbConnect.getSession(), query); | |
} | |
public void clearBlogByTitle(String title){ | |
String query = String.format("delete from blog where title = '%s'", title); | |
base.queryNoReturn(blogDbConnect.getSession(), query); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment