29#include <com/sun/star/sdbc/DataType.hpp>
41using ::osl::MutexGuard;
43OUString OPreparedStatement::getImplementationName()
45 return "com.sun.star.sdbcx.mysqlc.PreparedStatement";
50 return {
"com.sun.star.sdbc.PreparedStatement" };
67 m_binds.push_back(MYSQL_BIND{});
71 m_binds.back().buffer =
nullptr;
103 MYSQL_RES* pRes = mysql_stmt_result_metadata(
m_pStmt);
117 SAL_WARN(
"connectivity.mysqlc",
"failed to close mysql prepared statement");
134 mysql_sqlstate(pMysql), mysql_errno(pMysql),
138 int nFail = mysql_stmt_execute(
m_pStmt);
143 mysql_sqlstate(pMysql), mysql_errno(pMysql),
159 mysql_sqlstate(pMysql), mysql_errno(pMysql),
163 int nFail = mysql_stmt_execute(
m_pStmt);
169 mysql_sqlstate(pMysql), mysql_errno(pMysql),
173 sal_Int32 affectedRows = mysql_stmt_affected_rows(
m_pStmt);
184 const sal_Int32
nIndex = parameter - 1;
187 stringie.getLength());
209 mysql_sqlstate(pMysql), mysql_errno(pMysql),
213 int nFail = mysql_stmt_execute(
m_pStmt);
219 mysql_sqlstate(pMysql), mysql_errno(pMysql),
233 const sal_Int32
nIndex = parameter - 1;
245 const sal_Int32
nIndex = parameter - 1;
257 MYSQL_TIME my_time = {};
259 my_time.year =
aData.Year;
260 my_time.month =
aData.Month;
261 my_time.day =
aData.Day;
263 const sal_Int32
nIndex = parameter - 1;
275 MYSQL_TIME my_time = {};
277 my_time.hour = aVal.Hours;
278 my_time.minute = aVal.Minutes;
279 my_time.second = aVal.Seconds;
281 const sal_Int32
nIndex = parameter - 1;
293 MYSQL_TIME my_time = {};
295 my_time.hour = aVal.Hours;
296 my_time.minute = aVal.Minutes;
297 my_time.second = aVal.Seconds;
298 my_time.year = aVal.Year;
299 my_time.month = aVal.Month;
300 my_time.day = aVal.Day;
302 const sal_Int32
nIndex = parameter - 1;
314 const sal_Int32
nIndex = parameter - 1;
326 const sal_Int32
nIndex = parameter - 1;
338 const sal_Int32
nIndex = parameter - 1;
350 const sal_Int32
nIndex = parameter - 1;
362 const sal_Int32
nIndex = parameter - 1;
405 sal_Int32 targetSqlType, sal_Int32 )
411 const sal_Int32
nIndex = parameterIndex - 1;
412 if (!
value.hasValue())
420 switch (targetSqlType)
422 case DataType::DECIMAL:
423 case DataType::NUMERIC:
432 else if (
value >>= sValue)
436 std::stringstream
sStream{ std::string(sAscii) };
452 "OPreparedStatement::setObjectWithInfo", *
this);
483 const sal_Int32
nIndex = parameter - 1;
495 const sal_Int32
nIndex = parameter - 1;
511 "OPreparedStatement::setCharacterStream", *
this);
576 throw SQLException(
"Parameter index out of range", *
this, OUString(), 1,
Any());
constexpr OUStringLiteral sStream
void SAL_CALL clearWarnings() override
void SAL_CALL acquire() noexcept override
Any SAL_CALL queryInterface(const css::uno::Type &rType) override
rtl::Reference< OConnection > m_xConnection
css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
void SAL_CALL close() override
void SAL_CALL release() noexcept override
OConnection * getOwnConnection() const
void SAL_CALL setArray(sal_Int32 parameter, const Reference< css::sdbc::XArray > &x) override
void SAL_CALL setObject(sal_Int32 parameter, const Any &x) override
void SAL_CALL release() noexcept override
virtual ~OPreparedStatement() override
void SAL_CALL setBoolean(sal_Int32 parameter, sal_Bool x) override
OPreparedStatement(OConnection *_pConnection, MYSQL_STMT *pStmt)
void SAL_CALL setRef(sal_Int32 parameter, const Reference< css::sdbc::XRef > &x) override
void SAL_CALL setByte(sal_Int32 parameter, sal_Int8 x) override
void SAL_CALL setBlob(sal_Int32 parameter, const Reference< css::sdbc::XBlob > &x) override
void SAL_CALL setDate(sal_Int32 parameter, const css::util::Date &x) override
Reference< css::sdbc::XResultSet > SAL_CALL executeQuery() override
void SAL_CALL setFloat(sal_Int32 parameter, float x) override
std::vector< BindMetaData > m_bindMetas
void checkParameterIndex(sal_Int32 parameter)
void SAL_CALL setClob(sal_Int32 parameter, const Reference< css::sdbc::XClob > &x) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
void SAL_CALL setObjectWithInfo(sal_Int32 parameter, const Any &x, sal_Int32 targetSqlType, sal_Int32 scale) override
void SAL_CALL setObjectNull(sal_Int32 parameter, sal_Int32 sqlType, const OUString &typeName) override
void SAL_CALL setCharacterStream(sal_Int32 parameter, const Reference< css::io::XInputStream > &x, sal_Int32 length) override
Reference< XResultSetMetaData > m_xMetaData
void SAL_CALL setNull(sal_Int32 parameter, sal_Int32 sqlType) override
virtual sal_Bool SAL_CALL supportsService(OUString const &ServiceName) override
void SAL_CALL setBytes(sal_Int32 parameter, const css::uno::Sequence< sal_Int8 > &x) override
css::uno::Sequence< Type > SAL_CALL getTypes() override
void SAL_CALL setString(sal_Int32 parameter, const OUString &x) override
sal_Int32 SAL_CALL executeUpdate() override
Any SAL_CALL queryInterface(const Type &rType) override
Reference< css::sdbc::XConnection > SAL_CALL getConnection() override
unsigned int m_paramCount
void SAL_CALL setBinaryStream(sal_Int32 parameter, const Reference< css::io::XInputStream > &x, sal_Int32 length) override
std::vector< MYSQL_BIND > m_binds
Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData() override
sal_Bool SAL_CALL execute() override
void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any &rValue) override
void SAL_CALL clearParameters() override
void SAL_CALL setLong(sal_Int32 parameter, sal_Int64 x) override
void SAL_CALL setTimestamp(sal_Int32 parameter, const css::util::DateTime &x) override
void SAL_CALL setDouble(sal_Int32 parameter, double x) override
void SAL_CALL setTime(sal_Int32 parameter, const css::util::Time &x) override
void SAL_CALL setInt(sal_Int32 parameter, sal_Int32 x) override
void SAL_CALL close() override
void SAL_CALL setShort(sal_Int32 parameter, sal_Int16 x) override
void SAL_CALL acquire() noexcept override
mutable::osl::Mutex m_aMutex
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
OBroadcastHelper & rBHelper
#define SAL_WARN(area, stream)
constexpr OUStringLiteral aData
void checkDisposed(bool _bThrow)
@ PROPERTY_ID_FETCHDIRECTION
@ PROPERTY_ID_RESULTSETTYPE
@ PROPERTY_ID_RESULTSETCONCURRENCY
@ PROPERTY_ID_USEBOOKMARKS
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &_rLeft, const css::uno::Sequence< T > &_rRight)
concat two sequences
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
void throwInvalidArgumentException(const char *_pAsciiFeatureName, const css::uno::Reference< XInterface > &_rxContext)
void resetSqlVar(void **target, T *pValue, enum_field_types type, sal_Int32 nSize=0)
void throwSQLExceptionWithMsg(const char *msg, const char *SQLSTATE, unsigned int errorNum, const css::uno::Reference< css::uno::XInterface > &_context, const rtl_TextEncoding encoding)
void throwFeatureNotImplementedException(const char *_pAsciiFeatureName, const css::uno::Reference< XInterface > &_rxContext)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)