Home >Database >Mysql Tutorial >mysql如何向mongodb转化

mysql如何向mongodb转化

WBOY
WBOYOriginal
2016-06-06 09:41:241521browse

mysqlmongodb

/**
* 校验用户名是否注册
* @param loginname
* @return
* @throws SQLException
*/
public boolean ajaxValidateLoginname(String loginname) throws SQLException {
String sql = "select count(1) from t_user where loginname=?";
Number number = (Number)qr.query(sql, new ScalarHandler(), loginname);
return number.intValue() == 0;
}

<code>/** * 校验Email是否注册 * @param email * @return * @throws SQLException */public boolean ajaxValidateEmail(String email) throws SQLException {    String sql = "select count(1) from t_user where email=?";    Number number = (Number)qr.query(sql, new ScalarHandler(), email);    return number.intValue() == 0;}/** * 用户名注册校验 * @param loginname * @return */public boolean ajaxValidateLoginname(String loginname) {    try {        return userDao.ajaxValidateLoginname(loginname);    } catch (SQLException e) {        throw new RuntimeException(e);    }}/** * Email校验 * @param email * @return */public boolean ajaxValidateEmail(String email) {    try {        return userDao.ajaxValidateEmail(email);    } catch (SQLException e) {        throw new RuntimeException(e);    }}这是用mysql语法写的,如果用的是mongo该怎么写呢,求教</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn