Tag: cws_src680_sqlite User: aklitzing Date: 2006/08/19 17:24:09 Modified: dba/connectivity/source/drivers/sqlite3/sqDatabaseMetaData.cxx dba/connectivity/source/drivers/sqlite3/sqPreparedStatement.cxx dba/connectivity/source/drivers/sqlite3/sqPreparedStatement.hxx dba/connectivity/source/drivers/sqlite3/sqQueryPrepared.cpp dba/connectivity/source/drivers/sqlite3/sqQueryPrepared.h
Log: * Only some changes File Changes: Directory: /dba/connectivity/source/drivers/sqlite3/ ==================================================== File [changed]: sqDatabaseMetaData.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/sqlite3/sqDatabaseMetaData.cxx?r1=1.1.2.6&r2=1.1.2.7 Delta lines: +46 -69 --------------------- --- sqDatabaseMetaData.cxx 19 Aug 2006 18:23:28 -0000 1.1.2.6 +++ sqDatabaseMetaData.cxx 20 Aug 2006 00:24:06 -0000 1.1.2.7 @@ -4,9 +4,9 @@ * * $RCSfile: sqDatabaseMetaData.cxx,v $ * - * $Revision: 1.1.2.6 $ + * $Revision: 1.1.2.7 $ * - * last change: $Author: aklitzing $ $Date: 2006/08/19 18:23:28 $ + * last change: $Author: aklitzing $ $Date: 2006/08/20 00:24:06 $ * * Original contributor: André Klitzing * @@ -78,74 +78,62 @@ // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTablesInSelect( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- // ------------------------------------------------------------------------- @@ -186,7 +174,7 @@ // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException) { - return sal_False; + return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException) @@ -196,32 +184,27 @@ // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; // 0 means no limit } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException) { - return sal_False; + return sal_True; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException) { - ::rtl::OUString aVal; - return aVal; + return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException) { - // normally this is " - ::rtl::OUString aVal = ::rtl::OUString::createFromAscii("\""); - return aVal; + return ::rtl::OUString::createFromAscii("\""); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException) { - ::rtl::OUString aVal; - return aVal; + return ::rtl::OUString(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException) @@ -231,18 +214,17 @@ // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::isCatalogAtStart( ) throw(SQLException, RuntimeException) { - sal_Bool bValue = sal_False; - return bValue; + return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException) { - return sal_True; + return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException) { - return sal_True; + return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException) @@ -337,20 +319,17 @@ // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatements( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException) @@ -400,12 +379,12 @@ // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException) { - return sal_False; + return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException) { - return sal_False; + return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException) @@ -425,7 +404,7 @@ // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException) { - return sal_False; + return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException) @@ -450,7 +429,7 @@ // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException) { - return sal_False; + return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException) @@ -485,7 +464,7 @@ // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException) { - return sal_False; + return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException) @@ -495,7 +474,7 @@ // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException) { - return sal_False; + return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException) @@ -581,14 +560,12 @@ // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException) { - ::rtl::OUString aValue; - return aValue; + return ::rtl::OUString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException) { - ::rtl::OUString aValue; - return aValue; + return ::rtl::OUString(); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException) @@ -644,7 +621,7 @@ // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException) { - return sal_False; + return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException) @@ -669,36 +646,36 @@ // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException) { - sal_Int32 nValue = 0; // 0 means no limit - return nValue; + return 0; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException) { - return sal_False; + //return sal_False; + return setType == com::sun::star::sdbc::ResultSetType::SCROLL_INSENSITIVE || + setType == com::sun::star::sdbc::ResultSetType::FORWARD_ONLY || + setType == com::sun::star::sdbc::ResultSetType::SCROLL_SENSITIVE; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(SQLException, RuntimeException) { - return sal_False; + //return sal_False; + return setType == com::sun::star::sdbc::ResultSetConcurrency::READ_ONLY; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) File [changed]: sqPreparedStatement.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/sqlite3/sqPreparedStatement.cxx?r1=1.1.2.3&r2=1.1.2.4 Delta lines: +18 -28 --------------------- --- sqPreparedStatement.cxx 19 Aug 2006 18:23:29 -0000 1.1.2.3 +++ sqPreparedStatement.cxx 20 Aug 2006 00:24:06 -0000 1.1.2.4 @@ -4,9 +4,9 @@ * * $RCSfile: sqPreparedStatement.cxx,v $ * - * $Revision: 1.1.2.3 $ + * $Revision: 1.1.2.4 $ * - * last change: $Author: aklitzing $ $Date: 2006/08/19 18:23:29 $ + * last change: $Author: aklitzing $ $Date: 2006/08/20 00:24:06 $ * * Original contributor: André Klitzing * @@ -73,7 +73,6 @@ ,m_aTypeInfo(_TypeInfo) ,m_bPrepared(sal_False) ,m_pQuery(query) - ,m_nNumParams(0) { } @@ -138,44 +137,47 @@ } // ------------------------------------------------------------------------- -sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeException) +Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - return m_pQuery->execute() == SQLITE_OK; + return (Reference< XConnection >)m_pConnection; } // ------------------------------------------------------------------------- -sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException) +Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - // same as in statement with the difference that this statement also can contain parameter - return 0; + Reference<XResultSet> xRS = NULL; + xRS = new OResultSet(this, m_pQuery); + + return xRS; } + // ------------------------------------------------------------------------- -Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException) +sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - return (Reference< XConnection >)m_pConnection; + return m_pQuery->execute() == SQLITE_OK; } + // ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException) +sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - Reference<XResultSet> xRS = NULL; - xRS = new OResultSet(this, m_pQuery); - - return xRS; + // same as in statement with the difference that this statement also can contain parameter + return 0; } + // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) @@ -366,10 +368,7 @@ void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, RuntimeException) { - m_pQuery->reset(); - int params = m_pQuery->getParamCount(); - for(int i=1; i < params; ++i) // SQLite starts with 1, not 0 - m_pQuery->setNull(i); // unbound parameters are interpreted as NULL in SQLite + m_pQuery->clearParams(); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::clearBatch( ) throw(SQLException, RuntimeException) @@ -403,12 +402,3 @@ OStatement_Base::setFastPropertyValue_NoBroadcast(nHandle,rValue); } } -// ----------------------------------------------------------------------------- -void OPreparedStatement::checkParameterIndex(sal_Int32 _parameterIndex) -{ - if( !_parameterIndex || _parameterIndex > m_nNumParams) - throw SQLException(); -} -// ----------------------------------------------------------------------------- - - File [changed]: sqPreparedStatement.hxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/sqlite3/sqPreparedStatement.hxx?r1=1.1.2.2&r2=1.1.2.3 Delta lines: +2 -7 ------------------- --- sqPreparedStatement.hxx 18 Aug 2006 19:00:00 -0000 1.1.2.2 +++ sqPreparedStatement.hxx 20 Aug 2006 00:24:06 -0000 1.1.2.3 @@ -4,9 +4,9 @@ * * $RCSfile: sqPreparedStatement.hxx,v $ * - * $Revision: 1.1.2.2 $ + * $Revision: 1.1.2.3 $ * - * last change: $Author: aklitzing $ $Date: 2006/08/18 19:00:00 $ + * last change: $Author: aklitzing $ $Date: 2006/08/20 00:24:06 $ * * Original contributor: André Klitzing * @@ -94,14 +94,9 @@ // for each row returned by // DatabaseMetaData.getTypeInfo. - sal_Int32 m_nNumParams; // Number of parameter markers - // for the prepared statement - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData; sal_Bool m_bPrepared; sqQueryPreparedCursor* m_pQuery; - - void checkParameterIndex(sal_Int32 _parameterIndex); protected: virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, File [changed]: sqQueryPrepared.cpp Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/sqlite3/sqQueryPrepared.cpp?r1=1.1.2.5&r2=1.1.2.6 Delta lines: +7 -2 ------------------- --- sqQueryPrepared.cpp 19 Aug 2006 18:23:29 -0000 1.1.2.5 +++ sqQueryPrepared.cpp 20 Aug 2006 00:24:06 -0000 1.1.2.6 @@ -4,9 +4,9 @@ * * $RCSfile: sqQueryPrepared.cpp,v $ * - * $Revision: 1.1.2.5 $ + * $Revision: 1.1.2.6 $ * - * last change: $Author: aklitzing $ $Date: 2006/08/19 18:23:29 $ + * last change: $Author: aklitzing $ $Date: 2006/08/20 00:24:06 $ * * Original contributor: André Klitzing * @@ -269,6 +269,11 @@ // ----------------------------------- BIND-Functions + +int sqQueryPrepared::clearParams() +{ + return sqlite3_clear_bindings(m_stmt); +} int sqQueryPrepared::getParamCount() const { File [changed]: sqQueryPrepared.h Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/sqlite3/sqQueryPrepared.h?r1=1.1.2.5&r2=1.1.2.6 Delta lines: +8 -3 ------------------- --- sqQueryPrepared.h 19 Aug 2006 18:23:29 -0000 1.1.2.5 +++ sqQueryPrepared.h 20 Aug 2006 00:24:07 -0000 1.1.2.6 @@ -4,9 +4,9 @@ * * $RCSfile: sqQueryPrepared.h,v $ * - * $Revision: 1.1.2.5 $ + * $Revision: 1.1.2.6 $ * - * last change: $Author: aklitzing $ $Date: 2006/08/19 18:23:29 $ + * last change: $Author: aklitzing $ $Date: 2006/08/20 00:24:07 $ * * Original contributor: André Klitzing * @@ -320,12 +320,17 @@ //! \return integer, first is 1. If there is no parameter with given name it will return 0 int getParamIndex(const char* name) const; + //! \fn int clearParams() + //! \brief set all the parameters in the prepared statement back to NULL + //! \return result-code of sqlite3 + int clearParams(); + //! \fn int setText(int index, const char* value, int byteSize = -1, void(*DTor)(void*) = SQLITE_TRANSIENT) //! \brief bind a char-text to the given parameter //! \param index number of the parameter, first is 1 //! \param value the text that you want to bind //! \param byteSize the size of your value in BYTES (not char-length), default is -1 so SQLite reads to the next NULL-termination - //! \param DTor you can SQLite a destructor that will be called if SQLite is finished, default is that the string will be copied + //! \param DTor you can give SQLite a destructor that will be called if SQLite is finished, default is that the string will be copied //! \return result-code of sqlite3 int setText(int index, const char* value, int byteSize = -1, void(*DTor)(void*) = SQLITE_TRANSIENT); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
