<html>
<head>
<base href="https://bugs.documentfoundation.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - SQL... dialog Status: "Commands out of sync" when connecting to MySQL using direct (native) connector"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=103685#c8">Comment # 8</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - SQL... dialog Status: "Commands out of sync" when connecting to MySQL using direct (native) connector"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=103685">bug 103685</a>
from <span class="vcard"><a class="email" href="mailto:serval2412@yahoo.fr" title="Julien Nabet <serval2412@yahoo.fr>"> <span class="fn">Julien Nabet</span></a>
</span></b>
<pre>The call to getResultSet() is really just to update the status, not for using a
rs.
Some code pointer:
DirectSQLDialog::implExecuteStatement from
<a href="https://opengrok.libreoffice.org/xref/core/dbaccess/source/ui/dlg/directsql.cxx#179">https://opengrok.libreoffice.org/xref/core/dbaccess/source/ui/dlg/directsql.cxx#179</a>
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
<a href="https://opengrok.libreoffice.org/xref/core/mysqlc/source/mysqlc_statement.cxx#135">https://opengrok.libreoffice.org/xref/core/mysqlc/source/mysqlc_statement.cxx#135</a>
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)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>