Tag: cws_src680_dba201
User: oj      
Date: 05/04/29 01:19:05

Modified:
 /dba/dbaccess/source/ui/misc/
  UITools.cxx

Log:
 #i43667# use a rowsetvalue to extract the data out of the metadata, oracle 
seems to not support the standard

File Changes:

Directory: /dba/dbaccess/source/ui/misc/
========================================

File [changed]: UITools.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/UITools.cxx?r1=1.56&r2=1.56.28.1
Delta lines:  +62 -19
---------------------
--- UITools.cxx 10 Mar 2005 16:52:07 -0000      1.56
+++ UITools.cxx 29 Apr 2005 08:19:02 -0000      1.56.28.1
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: UITools.cxx,v $
  *
- *  $Revision: 1.56 $
+ *  $Revision: 1.56.28.1 $
  *
- *  last change: $Author: vg $ $Date: 2005/03/10 16:52:07 $
+ *  last change: $Author: oj $ $Date: 2005/04/29 08:19:02 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -113,6 +113,12 @@
 #ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
 #include <com/sun/star/sdbc/XRow.hpp>
 #endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_
+#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_
+#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
+#endif
 #ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_
 #include <com/sun/star/task/XInteractionHandler.hpp>
 #endif
@@ -312,6 +318,10 @@
 #ifndef _SVT_FILEVIEW_HXX
 #include <svtools/fileview.hxx>
 #endif
+#ifndef _CONNECTIVITY_FILE_VALUE_HXX_
+#include <connectivity/FValue.hxx>
+#endif
+
 // .........................................................................
 namespace dbaui
 {
@@ -709,26 +719,59 @@
        {
                static const ::rtl::OUString aB1 = 
::rtl::OUString::createFromAscii(" [ ");
                static const ::rtl::OUString aB2 = 
::rtl::OUString::createFromAscii(" ]");
+        Reference<XResultSetMetaData> xResultSetMetaData = 
Reference<XResultSetMetaDataSupplier>(xRs,UNO_QUERY)->getMetaData();
+        ::connectivity::ORowSetValue aValue;
+        ::std::vector<sal_Int32> aTypes;
                // Loop on the result set until we reach end of file
                while (xRs->next())
                {
                        TOTypeInfoSP pInfo(new OTypeInfo());
-                       pInfo->aTypeName                = xRow->getString (1);
-                       pInfo->nType                    = xRow->getShort (2);
-                       pInfo->nPrecision               = xRow->getInt (3);
-                       pInfo->aLiteralPrefix   = xRow->getString (4);
-                       pInfo->aLiteralSuffix   = xRow->getString (5);
-                       pInfo->aCreateParams    = xRow->getString (6);
-                       pInfo->bNullable                = xRow->getInt (7) == 
ColumnValue::NULLABLE;
-                       pInfo->bCaseSensitive   = xRow->getBoolean (8);
-                       pInfo->nSearchType              = xRow->getShort (9);
-                       pInfo->bUnsigned                = xRow->getBoolean (10);
-                       pInfo->bCurrency                = xRow->getBoolean (11);
-                       pInfo->bAutoIncrement   = xRow->getBoolean (12);
-                       pInfo->aLocalTypeName   = xRow->getString (13);
-                       pInfo->nMinimumScale    = xRow->getShort (14);
-                       pInfo->nMaximumScale    = xRow->getShort (15);
-                       pInfo->nNumPrecRadix    = xRow->getInt (18);
+            sal_Int32 nPos = 1;
+            if ( aTypes.empty() )
+            {
+                sal_Int32 nCount = xResultSetMetaData->getColumnCount();
+                if ( nCount < 1 )
+                    nCount = 18;
+                aTypes.reserve(nCount+1);
+                aTypes.push_back(-1);
+                for (sal_Int32 j = 1; j <= nCount ; ++j)
+                    aTypes.push_back(xResultSetMetaData->getColumnType(j));
+            }
+
+            aValue.fill(nPos,aTypes[nPos++],xRow);
+                       pInfo->aTypeName                = aValue;
+            aValue.fill(nPos,aTypes[nPos++],xRow);
+                       pInfo->nType                    = aValue;
+            aValue.fill(nPos,aTypes[nPos++],xRow);
+                       pInfo->nPrecision               = aValue;
+            aValue.fill(nPos,aTypes[nPos++],xRow);
+                       pInfo->aLiteralPrefix   = aValue;
+            aValue.fill(nPos,aTypes[nPos++],xRow);
+                       pInfo->aLiteralSuffix   = aValue;
+            aValue.fill(nPos,aTypes[nPos++],xRow);
+                       pInfo->aCreateParams    = aValue;
+            aValue.fill(nPos,aTypes[nPos++],xRow);
+                       pInfo->bNullable                = (sal_Int32)aValue == 
ColumnValue::NULLABLE;
+            aValue.fill(nPos,aTypes[nPos++],xRow);
+                       pInfo->bCaseSensitive   = aValue;
+            aValue.fill(nPos,aTypes[nPos++],xRow);
+                       pInfo->nSearchType              = aValue;
+            aValue.fill(nPos,aTypes[nPos++],xRow);
+                       pInfo->bUnsigned                = aValue;
+            aValue.fill(nPos,aTypes[nPos++],xRow);
+                       pInfo->bCurrency                = aValue;
+            aValue.fill(nPos,aTypes[nPos++],xRow);
+                       pInfo->bAutoIncrement   = aValue;
+            aValue.fill(nPos,aTypes[nPos++],xRow);
+                       pInfo->aLocalTypeName   = aValue;
+            aValue.fill(nPos,aTypes[nPos++],xRow);
+                       pInfo->nMinimumScale    = aValue;
+            aValue.fill(nPos,aTypes[nPos++],xRow);
+                       pInfo->nMaximumScale    = aValue;
+            nPos = 18;
+            aValue.fill(nPos,aTypes[nPos++],xRow);
+                       pInfo->nNumPrecRadix    = aValue;
+
                        // check if values are less than zero like it happens 
in a oracle jdbc driver
                        if( pInfo->nPrecision < 0)
                                pInfo->nPrecision = 0;




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to