Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 194680 Details for
Bug 344669
[DB] Crash detection fails when using Oracle JDBC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
applied the pattern described in the bug report
clipboard.txt (text/plain), 4.27 KB, created by
Erdal Karaca
on 2011-05-04 04:52:06 EDT
(
hide
)
Description:
applied the pattern described in the bug report
Filename:
MIME Type:
Creator:
Erdal Karaca
Created:
2011-05-04 04:52:06 EDT
Size:
4.27 KB
patch
obsolete
>Index: src/org/eclipse/emf/cdo/server/internal/db/MetaDataManager.java >=================================================================== >--- src/org/eclipse/emf/cdo/server/internal/db/MetaDataManager.java (revision 7643) >+++ src/org/eclipse/emf/cdo/server/internal/db/MetaDataManager.java (working copy) >@@ -352,8 +352,8 @@ > public boolean handle(int row, final Object... values) > { > InternalCDOPackageUnit packageUnit = createPackageUnit(); >- packageUnit.setOriginalType(CDOPackageUnit.Type.values()[(Integer)values[1]]); >- packageUnit.setTimeStamp((Long)values[2]); >+ packageUnit.setOriginalType(CDOPackageUnit.Type.values()[((Number)values[1]).intValue()]); >+ packageUnit.setTimeStamp(((Number)values[2]).longValue()); > packageUnits.put((String)values[0], packageUnit); > return true; > } >Index: src/org/eclipse/emf/cdo/server/internal/db/SQLQueryHandler.java >=================================================================== >--- src/org/eclipse/emf/cdo/server/internal/db/SQLQueryHandler.java (revision 7643) >+++ src/org/eclipse/emf/cdo/server/internal/db/SQLQueryHandler.java (working copy) >@@ -9,6 +9,7 @@ > * Kai Schlamp - initial API and implementation > * Eike Stepper - maintenance > * Kai Schlamp - Bug 284812: [DB] Query non CDO object fails >+ * Erdal Karaca - added cdoObjectResultAsMap parameter to return Map<String,Object> in result > */ > package org.eclipse.emf.cdo.server.internal.db; > >@@ -43,6 +44,8 @@ > > public static final String CDO_OBJECT_QUERY = "cdoObjectQuery"; > >+ public static final String CDO_OBJECT_RESULT_AS_MAP = "cdoObjectResultAsMap"; >+ > public static final String QUERY_STATEMENT = "queryStatement"; > > private DBStoreAccessor storeAccessor; >@@ -101,6 +104,7 @@ > int firstResult = -1; > boolean queryStatement = true; > boolean objectQuery = true; >+ boolean asMap = false; > > HashMap<String, List<Integer>> paramMap = new HashMap<String, List<Integer>>(); > query = parse(query, paramMap); >@@ -156,6 +160,22 @@ > } > } > } >+ else if (CDO_OBJECT_RESULT_AS_MAP.equalsIgnoreCase(key)) >+ { >+ final Object o = info.getParameters().get(key); >+ if (o != null) >+ { >+ try >+ { >+ asMap = (Boolean)o; >+ } >+ catch (ClassCastException ex) >+ { >+ throw new IllegalArgumentException("Parameter cdoObjectResultAsMap must be a boolean but it is a " + o >+ + " class " + o.getClass().getName(), ex); >+ } >+ } >+ } > else > { > if (!paramMap.containsKey(key) || paramMap.get(key) == null) >@@ -182,6 +202,14 @@ > > int maxResults = info.getMaxResults(); > int counter = 0; >+ >+ String[] columnNames = new String[resultSet.getMetaData().getColumnCount()]; >+ >+ for (int i = 1; i <= columnNames.length; i++) >+ { >+ columnNames[i - 1] = resultSet.getMetaData().getColumnName(i); >+ } >+ > while (resultSet.next()) > { > if (maxResults != CDOQueryInfo.UNLIMITED_RESULTS && counter++ >= maxResults) >@@ -197,10 +225,11 @@ > else > { > int columnCount = resultSet.getMetaData().getColumnCount(); >+ > if (columnCount == 1) > { > Object result = resultSet.getObject(1); >- context.addResult(result); >+ context.addResult(asMap ? toMap(columnNames, new Object[] { result }) : result); > } > else > { >@@ -210,7 +239,7 @@ > results[i] = resultSet.getObject(i + 1); > } > >- context.addResult(results); >+ context.addResult(asMap ? toMap(columnNames, results) : results); > } > } > } >@@ -232,6 +261,19 @@ > } > } > >+ private Map<String, Object> toMap(String[] columnNames, Object[] results) >+ { >+ Map<String, Object> ret = new HashMap<String, Object>(); >+ >+ for (int i = 0; i < columnNames.length; i++) >+ { >+ String columnName = columnNames[i]; >+ ret.put(columnName, results[i]); >+ } >+ >+ return ret; >+ } >+ > private String parse(String query, Map<String, List<Integer>> paramMap) > { > int length = query.length();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 344669
:
194680
|
194681
|
194829