[Libreoffice-bugs] [Bug 103685] SQL... dialog Status: "Commands out of sync" when connecting to MySQL using direct (native) connector

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Wed Sep 20 08:05:54 UTC 2017


https://bugs.documentfoundation.org/show_bug.cgi?id=103685

--- Comment #8 from Julien Nabet <serval2412 at yahoo.fr> ---
The call to getResultSet() is really just to update the status, not for using a
rs.

Some code pointer:
DirectSQLDialog::implExecuteStatement from
https://opengrok.libreoffice.org/xref/core/dbaccess/source/ui/dlg/directsql.cxx#179
197                  if (_rStatement.toAsciiUpperCase().startsWith("SELECT") &&
m_pShowOutput->IsChecked())
198                  {
199                      // execute it as a query
200                      xResultSet = xStatement->executeQuery(_rStatement);
...
226                  } else {
227                      // execute it
228                      xStatement->execute(_rStatement);
229                  }

Location where mysql c++ connector is called for execute
https://opengrok.libreoffice.org/xref/core/mysqlc/source/mysqlc_statement.cxx#135
135  sal_Bool SAL_CALL OCommonStatement::execute(const rtl::OUString& sql)
136  {
137      MutexGuard aGuard(m_aMutex);
138      checkDisposed(rBHelper.bDisposed);
139      const rtl::OUString sSqlStatement =
m_pConnection->transFormPreparedStatement( sql );
140  
141      bool success = false;
142      try {
143          success =
cppStatement->execute(rtl::OUStringToOString(sSqlStatement,
m_pConnection->getConnectionSettings().encoding).getStr());
144      } catch (const sql::SQLException &e) {
145          mysqlc_sdbc_driver::translateAndThrow(e, *this,
m_pConnection->getConnectionEncoding());
146      }
147      return success;
148  }

and in case of executeQuery
150  Reference< XResultSet > SAL_CALL OCommonStatement::executeQuery(const
rtl::OUString& sql)
151  {
152      MutexGuard aGuard(m_aMutex);
153      checkDisposed(rBHelper.bDisposed);
154      const rtl::OUString sSqlStatement =
m_pConnection->transFormPreparedStatement(sql);
155  
156      Reference< XResultSet > xResultSet;
157      try {
158          std::unique_ptr< sql::ResultSet >
rset(cppStatement->executeQuery(rtl::OUStringToOString(sSqlStatement,
m_pConnection->getConnectionEncoding()).getStr()));
159          xResultSet = new OResultSet(this, rset.get(),
m_pConnection->getConnectionEncoding());
160          rset.release();
161      } catch (const sql::SQLException &e) {
162          mysqlc_sdbc_driver::translateAndThrow(e, *this,
m_pConnection->getConnectionEncoding());
163      }
164      return xResultSet;
165  }

In executeQuery, we retrieve a rs that we can release, it's not the case for
execute.

I'll check if we could call something else than getResultSet() (a method to
close/reset the statement so the status is set to MYSQL_STATUS_READY) because
it's the only thing lacking here ; there's no error in the whole mysql c++
connector and mariadb c connector (unless I missed it)

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20170920/718cc980/attachment.html>


More information about the Libreoffice-bugs mailing list