#2 2

Nyitott
eb szeretne 1 commit-ot egyesíteni innen: eb/2 ide: eb/master
3 módosított fájl, 9 hozzáadás és 13 törlés
  1. 1 5
      conexao.cc
  2. 1 1
      conexao.hh
  3. 7 7
      pesquisar.cc

+ 1 - 5
conexao.cc

@@ -75,12 +75,11 @@ bool conexao::remover(string isbn){
   }
 }
 
-bool conexao::pesquisar(string x, string y){
+void conexao::pesquisar(string x, string y){
   try{
     CONN = mysql_init(NULL);
     if(!mysql_real_connect(CONN, HOSTNAME, USERNAME, PASSWORD, DATABASE, PORT, SOCKET, 0)){
       cout << mysql_error(CONN) << endl;
-      return false;
     }
     string str;
     if (y == "isbn") {
@@ -93,7 +92,6 @@ bool conexao::pesquisar(string x, string y){
     const char* c = str.c_str();
     if(mysql_query(CONN, c)){
       cout << mysql_error(CONN) << endl;
-      return false;
     }
     RES = mysql_use_result(CONN);
     while((ROW = mysql_fetch_row(RES)) != NULL){
@@ -107,10 +105,8 @@ bool conexao::pesquisar(string x, string y){
     }
     mysql_free_result(RES);
     mysql_close(CONN);
-    return true;
   } catch(char *e){
     cout << e << endl;
-    return false;
   }
 }
 

+ 1 - 1
conexao.hh

@@ -21,7 +21,7 @@ public:
   bool cadastrar(string isbn, string titulo, string autor, string editora, string preco, string ano, string edicao);
   bool imprimir();
   bool remover(string isbn);
-  bool pesquisar(string x, string y);
+  void pesquisar(string x, string y);
   bool modificar(string x, string y, string z);
   bool verificar(string x, string y);
 };

+ 7 - 7
pesquisar.cc

@@ -18,37 +18,37 @@ void pesquisar(conexao c){
     case '1':
       isbn = digitarstring("ISBN");
       b = c.verificar(isbn, "isbn");
-      b = c.pesquisar(isbn, "isbn");
+      c.pesquisar(isbn, "isbn");
       break;
     case '2':
       titulo = digitarstring("título");
       b = c.verificar(titulo, "titulo");
-      b = c.pesquisar(titulo, "titulo");
+      c.pesquisar(titulo, "titulo");
       break;
     case '3':
       autor = digitarstring("autor");
       b = c.verificar(autor, "autor");
-      b = c.pesquisar(autor, "autor");
+      c.pesquisar(autor, "autor");
       break;
     case '4':
       editora = digitarstring("editora");
       b = c.verificar(editora, "editora");
-      b = c.pesquisar(editora, "editora");
+      c.pesquisar(editora, "editora");
       break;
     case '5':
       preco = digitarnumero("preço");
       b = c.verificar(preco, "preco");
-      b = c.pesquisar(preco, "preco");
+      c.pesquisar(preco, "preco");
       break;
     case '6':
       ano = digitarnumero("ano");
       b = c.verificar(ano, "ano");
-      b = c.pesquisar(ano, "ano");    
+      c.pesquisar(ano, "ano");    
       break;
     case '7':
       edicao = digitarstring("edição");
       b = c.verificar(edicao, "edicao");
-      b = c.pesquisar(edicao, "edicao");
+      c.pesquisar(edicao, "edicao");
       break;
     case '8':
       break;