|
|
|
@ -1,7 +1,12 @@
|
|
|
|
|
package Schema;
|
|
|
|
|
|
|
|
|
|
import android.content.DialogInterface;
|
|
|
|
|
import android.gesture.Prediction;
|
|
|
|
|
|
|
|
|
|
import androidx.appcompat.app.AlertDialog;
|
|
|
|
|
|
|
|
|
|
import com.example.cmknowledgegraph.LoginActivity;
|
|
|
|
|
|
|
|
|
|
import java.sql.Connection;
|
|
|
|
|
import java.sql.PreparedStatement;
|
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
@ -33,4 +38,39 @@ public class OperaSchema {
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 注册方法,参数是手机号,昵称,密码
|
|
|
|
|
* @return 注册成功返回true,失败返回false
|
|
|
|
|
*/
|
|
|
|
|
public static boolean register(String tel,String nickname,String password){
|
|
|
|
|
|
|
|
|
|
Connection conn=InitSchema.getConnect();
|
|
|
|
|
PreparedStatement pstmt;
|
|
|
|
|
ResultSet rst;
|
|
|
|
|
try {
|
|
|
|
|
pstmt=conn.prepareStatement("select paw\n" +
|
|
|
|
|
"from UserInfo\n" +
|
|
|
|
|
"where tel='"+tel+"'");
|
|
|
|
|
rst=pstmt.executeQuery();
|
|
|
|
|
if(rst==null){//注册成功
|
|
|
|
|
//注册成功提醒
|
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
|
|
|
|
|
builder.setTitle("登陆提醒");// 设置标题
|
|
|
|
|
builder.setMessage("注册成功");// 为对话框设置内容
|
|
|
|
|
builder.create().show();// 使用show()方法显示对话框
|
|
|
|
|
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface arg0, int arg1) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
//点击确定返回登录界面
|
|
|
|
|
finish();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|