Advertisement
Guest User

Untitled

a guest
Jan 25th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. bool AppControler::setUser(QString _Login, QString _Password){
  2.  
  3. QSqlDatabase* db=DataBaseSingle::GetDB();
  4. if(db){
  5. QSqlQuery q(*db);
  6. QString log=_Login;
  7. QString pas=_Password;
  8.  
  9. q.prepare("SELECT * FROM users WHERE login=? and password=? ");
  10.  
  11. q.bindValue(0,log);
  12. q.bindValue(1,pas);
  13. if(q.exec()){
  14.  
  15. if(q.size()>0){
  16. q.next();
  17.  
  18. if(activeUser){
  19. delete activeUser;
  20. }
  21.  
  22. activeUser=new user(q.value(0).toInt(),q.value(1).toString(),q.value(2).toString(),q.value(3).toString(),q.value(4).toString(),q.value(5).toString(),q.value(6).toString(), q.value(7).toInt());
  23. if(GetModuleData()){
  24.  
  25. if(UpdateUserModuleData()){
  26.  
  27. return true;
  28. }
  29. }
  30. }
  31.  
  32. }
  33. }
  34. return false;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement