/** * This static method simplifies the creation of an SQL Document and allows * us to embedd the complexity of creating / handling the dtmIdent inside * the document. This type of method may better placed inside the DTMDocument * code */ public static SQLDocument getNewDocument(ExpressionContext exprContext) { DTMManager mgr = ((XPathContext.XPathExpressionContext)exprContext).getDTMManager(); DTMManagerDefault mgrDefault = (DTMManagerDefault) mgr; int dtmIdent = mgrDefault.getFirstFreeDTMID(); SQLDocument doc = new SQLDocument(mgr, dtmIdent << DTMManager.IDENT_DTM_NODE_BITS); // Register the document mgrDefault.addDTM(doc, dtmIdent); doc.setExpressionContext(exprContext); return doc; }
addElement(1, m_RowSet_TypeID, m_SQLIdx, m_MultipleResults ? m_RowSetIdx : m_MetaDataIdx); if ( m_MultipleResults ) extractSQLMetaData(m_ResultSet.getMetaData()); addRowToDTMFromResultSet(); int outParamIdx = addElement(1, m_OutParameter_TypeID, m_SQLIdx, m_RowSetIdx); int lastColID = DTM.NULL; for ( int indx = 0 ; indx < parameters.size() ; indx++ ) lastColID = addElementWithData(rawobj, 2, m_Col_TypeID, outParamIdx, lastColID); addAttributeToNode(parm.getName(), m_ColAttrib_COLUMN_NAME_TypeID, lastColID); addAttributeToNode(parm.getName(), m_ColAttrib_COLUMN_LABEL_TypeID, lastColID); addAttributeToNode(new Integer(parm.getType()), m_ColAttrib_COLUMN_TYPE_TypeID, lastColID); addAttributeToNode(parm.getTypeName(), m_ColAttrib_COLUMN_TYPENAME_TypeID, lastColID); SQLWarning warn = checkWarnings(); if ( warn != null ) m_XConnection.setError(null, null, warn); addElement(2, m_Row_TypeID, m_RowSetIdx, m_MultipleResults ? m_MetaDataIdx : DTM.NULL); m_LastRowIdx = addElement(2, m_Row_TypeID, m_RowSetIdx, m_LastRowIdx); int colID = _firstch(m_LastRowIdx); pcolID = addElementWithData(o,3,m_Col_TypeID, m_LastRowIdx, pcolID); cloneAttributeFromNode(pcolID, m_ColHeadersIdx[i-1]); int dataIdent = _firstch(colID); if (dataIdent == DTM.NULL)
(this, queryString, SQLQueryParser.NO_INLINE_PARSER); doc = SQLDocument.getNewDocument(exprContext); doc.execute(this, query); if (doc.hasErrors()) setError(e, doc, doc.checkWarnings()); doc.close(m_IsDefaultPool); doc = null;
int id = _exptype(identity); addRowToDTMFromResultSet(); addRowToDTMFromResultSet(); int startIdx = m_RowSetIdx; while ( startIdx == m_RowSetIdx && m_ResultSet != null ) addRowToDTMFromResultSet();
m_QueryParser = query; executeSQLStatement(); createExpandedNameTable(); m_DocumentIdx = addElement(0, m_Document_TypeID, DTM.NULL, DTM.NULL); m_SQLIdx = addElement(1, m_SQL_TypeID, m_DocumentIdx, DTM.NULL); extractSQLMetaData(m_ResultSet.getMetaData());
if ( m_MultipleResults ) extractSQLMetaData(m_ResultSet.getMetaData()); addRowToDTMFromResultSet(); SQLWarning warn = checkWarnings(); if ( warn != null ) m_XConnection.setError(null, null, warn); colID = _nextsib(colID); m_XConnection.setError(e, this, checkWarnings()); m_HasErrors = true;
m_QueryParser = query; executeSQLStatement(); createExpandedNameTable(); extractSQLMetaData(m_ResultSet.getMetaData());
ExpressionContext ctx = m_LastSQLDocumentWithError.getExpressionContext(); SQLWarning warn = m_LastSQLDocumentWithError.checkWarnings();
/** * Provide access to the last error that occued. This error * may be over written when the next operation occurs. * */ public DTM getError( ) { if ( m_FullErrors ) { for ( int idx = 0 ; idx < m_OpenSQLDocuments.size() ; idx++ ) { SQLDocument doc = (SQLDocument)m_OpenSQLDocuments.elementAt(idx); SQLWarning warn = doc.checkWarnings(); if ( warn != null ) setError(null, doc, warn); } } return(buildErrorDocument()); }
/** * Close the connection to the data source. Only close the connections * for a single document. * * @throws SQLException */ public void close(ExpressionContext exprContext, Object doc) throws SQLException { if (DEBUG) System.out.println("Entering XConnection.close(" + doc + ")"); SQLDocument sqlDoc = locateSQLDocument(exprContext, doc); if (sqlDoc != null) { // If we are using the Default Connection Pool, then // force the connection pool to flush unused connections. sqlDoc.close(m_IsDefaultPool); m_OpenSQLDocuments.remove(sqlDoc); } }
m_MetaDataIdx = addElement(1, m_MetaData_TypeID, m_MultipleResults ? m_RowSetIdx : m_SQLIdx, DTM.NULL); m_XConnection.setError(e, this, checkWarnings()); addElement(2,m_ColumnHeader_TypeID, m_MetaDataIdx, lastColHeaderIdx); addAttributeToNode( meta.getColumnName(i), m_ColAttrib_COLUMN_NAME_TypeID, lastColHeaderIdx); addAttributeToNode( S_ATTRIB_NOT_SUPPORTED, m_ColAttrib_COLUMN_NAME_TypeID, lastColHeaderIdx); addAttributeToNode( meta.getColumnLabel(i), m_ColAttrib_COLUMN_LABEL_TypeID, lastColHeaderIdx); addAttributeToNode( S_ATTRIB_NOT_SUPPORTED, m_ColAttrib_COLUMN_LABEL_TypeID, lastColHeaderIdx); addAttributeToNode( meta.getCatalogName(i), m_ColAttrib_CATALOGUE_NAME_TypeID, lastColHeaderIdx); addAttributeToNode( S_ATTRIB_NOT_SUPPORTED, m_ColAttrib_CATALOGUE_NAME_TypeID, lastColHeaderIdx);
SQLWarning warn = checkWarnings(); if ( warn != null ) m_XConnection.setError(null, null, warn); getManager().release(this, true);
ExpressionContext cont = doc.getExpressionContext(); m_LastSQLDocumentWithError = doc;
addRowToDTMFromResultSet(); addRowToDTMFromResultSet(); int startIdx = m_RowSetIdx; while ( startIdx == m_RowSetIdx && m_ResultSet != null ) addRowToDTMFromResultSet();
if ( m_MultipleResults ) extractSQLMetaData(m_ResultSet.getMetaData()); addRowToDTMFromResultSet(); SQLWarning warn = checkWarnings(); if ( warn != null ) m_XConnection.setError(null, null, warn); colID = _nextsib(colID); m_XConnection.setError(e, this, checkWarnings()); m_HasErrors = true;
m_QueryParser = query; executeSQLStatement(); createExpandedNameTable(); m_DocumentIdx = addElement(0, m_Document_TypeID, DTM.NULL, DTM.NULL); m_SQLIdx = addElement(1, m_SQL_TypeID, m_DocumentIdx, DTM.NULL); extractSQLMetaData(m_ResultSet.getMetaData());
m_QueryParser = query; executeSQLStatement(); createExpandedNameTable(); extractSQLMetaData(m_ResultSet.getMetaData());
ExpressionContext ctx = m_LastSQLDocumentWithError.getExpressionContext(); SQLWarning warn = m_LastSQLDocumentWithError.checkWarnings();
m_XConnection.setError(origEx, this, checkWarnings()); m_XConnection.setError(e, this, checkWarnings());
d.close(m_IsDefaultPool);