Lines 873-885
Link Here
|
873 |
sal_Bool bPositionByBookmark; |
873 |
sal_Bool bPositionByBookmark; |
874 |
if ( bPositionByBookmark = NULL != getOdbcFunction(ODBC3SQLBulkOperations) ) |
874 |
if ( bPositionByBookmark = NULL != getOdbcFunction(ODBC3SQLBulkOperations) ) |
875 |
{ |
875 |
{ |
876 |
nRet = N3SQLBulkOperations(m_aStatementHandle, SQL_ADD); |
876 |
fillNeededData(nRet = N3SQLBulkOperations(m_aStatementHandle, SQL_ADD)); |
877 |
} |
877 |
} |
878 |
else |
878 |
else |
879 |
{ |
879 |
{ |
880 |
if(isBeforeFirst()) |
880 |
if(isBeforeFirst()) |
881 |
next(); // must be done |
881 |
next(); // must be done |
882 |
nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_ADD,SQL_LOCK_NO_CHANGE); |
882 |
fillNeededData(nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_ADD,SQL_LOCK_NO_CHANGE)); |
883 |
} |
883 |
} |
884 |
try |
884 |
try |
885 |
{ |
885 |
{ |
Lines 933-973
Link Here
|
933 |
|
933 |
|
934 |
|
934 |
|
935 |
SQLRETURN nRet; |
935 |
SQLRETURN nRet; |
936 |
nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE); |
936 |
fillNeededData(nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE)); |
937 |
if( nRet == SQL_NEED_DATA) |
|
|
938 |
{ |
939 |
void* pColumnIndex = 0; |
940 |
nRet = N3SQLParamData(m_aStatementHandle,&pColumnIndex); |
941 |
|
942 |
do |
943 |
{ |
944 |
if (nRet != SQL_SUCCESS && nRet != SQL_SUCCESS_WITH_INFO && nRet != SQL_NEED_DATA) |
945 |
break; |
946 |
|
947 |
sal_Int32 nColumnIndex ( reinterpret_cast<sal_Int32>(pColumnIndex)); |
948 |
Sequence< sal_Int8 > aSeq; |
949 |
switch(m_aRow[nColumnIndex].getTypeKind()) |
950 |
{ |
951 |
case DataType::BINARY: |
952 |
case DataType::VARBINARY: |
953 |
case DataType::LONGVARBINARY: |
954 |
aSeq = m_aRow[nColumnIndex]; |
955 |
N3SQLPutData (m_aStatementHandle, aSeq.getArray(), aSeq.getLength()); |
956 |
break; |
957 |
case DataType::LONGVARCHAR: |
958 |
{ |
959 |
::rtl::OUString sRet; |
960 |
sRet = m_aRow[nColumnIndex].getString(); |
961 |
N3SQLPutData (m_aStatementHandle, (SQLPOINTER)sRet.getStr(), sizeof(sal_Unicode)*sRet.getLength()); |
962 |
break; |
963 |
} |
964 |
default: |
965 |
OSL_ENSURE(0,"Not supported at the moment!"); |
966 |
} |
967 |
nRet = N3SQLParamData(m_aStatementHandle,&pColumnIndex); |
968 |
} |
969 |
while (nRet == SQL_NEED_DATA); |
970 |
} |
971 |
OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this); |
937 |
OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this); |
972 |
// now unbind all columns so we can fetch all columns again with SQLGetData |
938 |
// now unbind all columns so we can fetch all columns again with SQLGetData |
973 |
nRet = N3SQLFreeStmt(m_aStatementHandle,SQL_UNBIND); |
939 |
nRet = N3SQLFreeStmt(m_aStatementHandle,SQL_UNBIND); |
Lines 1094-1108
Link Here
|
1094 |
// ------------------------------------------------------------------------- |
1060 |
// ------------------------------------------------------------------------- |
1095 |
void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) |
1061 |
void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) |
1096 |
{ |
1062 |
{ |
1097 |
SQLSMALLINT nOdbcType = static_cast<SQLSMALLINT>(OTools::jdbcTypeToOdbc(m_aRow[columnIndex].getTypeKind())); |
1063 |
sal_Int32 nType = m_aRow[columnIndex].getTypeKind(); |
|
|
1064 |
SQLSMALLINT nOdbcType = static_cast<SQLSMALLINT>(OTools::jdbcTypeToOdbc(nType)); |
1098 |
m_aRow[columnIndex] = x; |
1065 |
m_aRow[columnIndex] = x; |
|
|
1066 |
m_aRow[columnIndex].setTypeKind(nType); // OJ: otherwise longvarchar will be recognized by fillNeededData |
1099 |
updateValue(columnIndex,nOdbcType,(void*)&x); |
1067 |
updateValue(columnIndex,nOdbcType,(void*)&x); |
1100 |
} |
1068 |
} |
1101 |
// ------------------------------------------------------------------------- |
1069 |
// ------------------------------------------------------------------------- |
1102 |
void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) |
1070 |
void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) |
1103 |
{ |
1071 |
{ |
1104 |
SQLSMALLINT nOdbcType = static_cast<SQLSMALLINT>(OTools::jdbcTypeToOdbc(m_aRow[columnIndex].getTypeKind())); |
1072 |
sal_Int32 nType = m_aRow[columnIndex].getTypeKind(); |
|
|
1073 |
SQLSMALLINT nOdbcType = static_cast<SQLSMALLINT>(OTools::jdbcTypeToOdbc(nType)); |
1105 |
m_aRow[columnIndex] = x; |
1074 |
m_aRow[columnIndex] = x; |
|
|
1075 |
m_aRow[columnIndex].setTypeKind(nType); // OJ: otherwise longvarbinary will be recognized by fillNeededData |
1106 |
updateValue(columnIndex,nOdbcType,(void*)&x); |
1076 |
updateValue(columnIndex,nOdbcType,(void*)&x); |
1107 |
} |
1077 |
} |
1108 |
// ------------------------------------------------------------------------- |
1078 |
// ------------------------------------------------------------------------- |
Lines 1669-1673
Link Here
|
1669 |
move(_eCursorPosition,_nOffset,_bRetrieveData); |
1639 |
move(_eCursorPosition,_nOffset,_bRetrieveData); |
1670 |
} |
1640 |
} |
1671 |
// ----------------------------------------------------------------------------- |
1641 |
// ----------------------------------------------------------------------------- |
|
|
1642 |
void OResultSet::fillNeededData(SQLRETURN _nRet) |
1643 |
{ |
1644 |
SQLRETURN nRet = _nRet; |
1645 |
if( nRet == SQL_NEED_DATA) |
1646 |
{ |
1647 |
void* pColumnIndex = 0; |
1648 |
nRet = N3SQLParamData(m_aStatementHandle,&pColumnIndex); |
1649 |
|
1650 |
do |
1651 |
{ |
1652 |
if (nRet != SQL_SUCCESS && nRet != SQL_SUCCESS_WITH_INFO && nRet != SQL_NEED_DATA) |
1653 |
break; |
1672 |
|
1654 |
|
|
|
1655 |
sal_Int32 nColumnIndex ( reinterpret_cast<sal_Int32>(pColumnIndex)); |
1656 |
Sequence< sal_Int8 > aSeq; |
1657 |
switch(m_aRow[nColumnIndex].getTypeKind()) |
1658 |
{ |
1659 |
case DataType::BINARY: |
1660 |
case DataType::VARBINARY: |
1661 |
case DataType::LONGVARBINARY: |
1662 |
aSeq = m_aRow[nColumnIndex]; |
1663 |
N3SQLPutData (m_aStatementHandle, aSeq.getArray(), aSeq.getLength()); |
1664 |
break; |
1665 |
case DataType::LONGVARCHAR: |
1666 |
{ |
1667 |
::rtl::OUString sRet; |
1668 |
sRet = m_aRow[nColumnIndex].getString(); |
1669 |
N3SQLPutData (m_aStatementHandle, (SQLPOINTER)sRet.getStr(), sizeof(sal_Unicode)*sRet.getLength()); |
1670 |
break; |
1671 |
} |
1672 |
default: |
1673 |
OSL_ENSURE(0,"Not supported at the moment!"); |
1674 |
} |
1675 |
nRet = N3SQLParamData(m_aStatementHandle,&pColumnIndex); |
1676 |
} |
1677 |
while (nRet == SQL_NEED_DATA); |
1678 |
} |
1679 |
} |
1673 |
|
1680 |
|