@@ -150,7 +150,12 @@ public function count($condition = null)
150150 return new WP_Error ('db_error ' , $ this ->app_db ->last_error );
151151 }
152152
153- return new WP_Error ('db_error ' , __ ('Result is empty ' , 'bit-integrations ' ));
153+ return new WP_Error (
154+ 'db_error ' ,
155+ (\function_exists ('is_textdomain_loaded ' ) && is_textdomain_loaded ('bit-integrations ' ))
156+ ? __ ('Result is empty ' , 'bit-integrations ' )
157+ : 'Result is empty '
158+ );
154159 }
155160
156161 return $ this ->app_db ->last_result ;
@@ -467,24 +472,33 @@ protected function execute($sql, $values = null)
467472 protected function getResult ($ db_response = null )
468473 {
469474 $ db_response = !empty ($ this ->db_response ) ? $ this ->db_response : $ db_response ;
475+
470476 if (!empty ($ this ->app_db ->last_error )) {
471477 return new WP_Error ('db_error ' , $ this ->app_db ->last_error );
472478 }
479+
473480 if (!$ db_response ) {
474481 if ($ this ->app_db ->num_rows > 0 ) {
475482 $ response = $ this ->app_db ->num_rows ;
476483 }
477484 if (is_wp_error ($ db_response )) {
478485 $ response = $ db_response ;
479486 }
480- $ response = new WP_Error ('result_empty ' , __ ('Result is empty ' , 'bit-integrations ' ));
487+
488+ $ response = new WP_Error (
489+ 'result_empty ' ,
490+ (\function_exists ('is_textdomain_loaded ' ) && is_textdomain_loaded ('bit-integrations ' ))
491+ ? __ ('Result is empty ' , 'bit-integrations ' )
492+ : 'Result is empty '
493+ );
481494 } elseif (\is_array ($ this ->app_db ->last_result ) && !empty ($ this ->app_db ->last_result )) {
482495 $ response = $ this ->app_db ->last_result ;
483496 } elseif ($ this ->app_db ->insert_id ) {
484497 $ response = $ this ->app_db ->insert_id ;
485498 } else {
486499 $ response = $ db_response ;
487500 }
501+
488502 $ this ->app_db ->flush ();
489503
490504 return $ response ;
0 commit comments