Note that there are some explanatory texts on larger screens.

plurals
  1. POusing Qt Stored procedure in Firebird
    primarykey
    data
    text
    <p>Good Afternoon, I'm starting in the world of Qt and a Firebird database.And finish the driver installation process and perform operations onthe database insert, update and consultation. When I started to make stored procedures and run them from Qt did not work. Does not fail and always us that everything was made ​​perfect, but the database does not run. I am programming in Linux using Qt 2.0.1 and Firebird 2.1 I create a simple stored procedure test which makes it an insert into a table. It works by running the console but when trying to run fromQt does not work and gives me no errors.The SQL code is:</p> <pre><code>SET TERM ^ ;CREATE PROCEDURE AGREEGAR_UNO AS BEGIN insert into JUEGO(CODIGO,ESCRUTINIO,ESTADO,FECHA,HORAINICIO) values (next value for GNECODIGOJUEGO,'111,123,154,169,178','Hi', current_date, current_time);END^SET TERM ; ^ GRANT EXECUTE ON PROCEDURE AGREEGAR_UNO TO SYSDBA; </code></pre> <p>The following code will use to connect to firebird from Qt</p> <pre><code>bool VentanaPrueba::conectar() { this-&gt;db= QSqlDatabase::addDatabase("QIBASE","Data"); this-&gt;db.setDatabaseName("./BD/Data.fdb"); this-&gt;db.setPassword("password"); this-&gt;db.setUserName("SYSDBA"); if(!db.open()) { return false; } else return true; } </code></pre> <p>And this is the code that is responsible for calling the procedure</p> <pre><code>void VentanaPrueba::procedimiento() { if (!this-&gt;db.isOpen()) this-&gt;conectar(); if(this-&gt;db.isOpen()) { QSqlQuery procedimiento = QSqlQuery::QSqlQuery(this-&gt;db); bool bandera = procedimiento.prepare("EXECUTE PROCEDURE AGREEGAR_UNO"); QString err = procedimiento.lastError().text(); bool respuesta= procedimiento.exec(); //this-&gt;db.commit(); if(!respuesta) { this-&gt;db.close(); }else { procedimiento.finish(); this-&gt;db.commit(); this-&gt;db.close(); } }else{ //error } } </code></pre> <p>Thank you very much for your help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload