rpms/dbxml/devel import.log, NONE, 1.1 patch.2.4.13.1, NONE, 1.1 patch.2.4.13.2, NONE, 1.1 .cvsignore, 1.2, 1.3 dbxml-standalone-build.patch, 1.3, 1.4 dbxml.spec, 1.4, 1.5 sources, 1.2, 1.3 dbxml-g++-4.3.patch, 1.2, NONE dbxml-index-utilisation.patch, 1.1, NONE dbxml-invalid-schema.patch, 1.1, NONE dbxml-os-clock.patch, 1.1, NONE dbxml-predicates.patch, 1.1, NONE dbxml-python-build.patch, 1.1, NONE dbxml-python25-types.patch, 1.1, NONE dbxml-query-performance.patch, 1.1, NONE dbxml-statistics.patch, 1.1, NONE dbxml-xmlindexlookup.patch, 1.1, NONE dbxml-xmlmodify.patch, 1.1, NONE

Milan Zazrivec mzazrive at fedoraproject.org
Sun Aug 31 10:04:27 UTC 2008


Author: mzazrive

Update of /cvs/pkgs/rpms/dbxml/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv23124/devel

Modified Files:
	.cvsignore dbxml-standalone-build.patch dbxml.spec sources 
Added Files:
	import.log patch.2.4.13.1 patch.2.4.13.2 
Removed Files:
	dbxml-g++-4.3.patch dbxml-index-utilisation.patch 
	dbxml-invalid-schema.patch dbxml-os-clock.patch 
	dbxml-predicates.patch dbxml-python-build.patch 
	dbxml-python25-types.patch dbxml-query-performance.patch 
	dbxml-statistics.patch dbxml-xmlindexlookup.patch 
	dbxml-xmlmodify.patch 
Log Message:
rebased to latest upstream (ver. 2.4.13)



--- NEW FILE import.log ---
dbxml-2_4_13-2_1_fc10:HEAD:dbxml-2.4.13-2.1.fc10.src.rpm:1220176927


--- NEW FILE patch.2.4.13.1 ---
diff -cr dbxml-2.4.13.orig/dbxml/src/dbxml/ConfigurationDatabase.cpp dbxml-2.4.13/dbxml/src/dbxml/ConfigurationDatabase.cpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/ConfigurationDatabase.cpp	Tue Jan 15 16:27:16 2008
--- dbxml-2.4.13/dbxml/src/dbxml/ConfigurationDatabase.cpp	Tue May 13 16:33:12 2008
***************
*** 3,9 ****
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: ConfigurationDatabase.cpp,v 1.43 2008/01/15 15:35:02 jpcs Exp $
  //
  
  #include "DbXmlInternal.hpp"
--- 3,9 ----
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: ConfigurationDatabase.cpp,v 1.43.2.1 2008/05/13 20:23:52 gmf Exp $
  //
  
  #include "DbXmlInternal.hpp"
***************
*** 91,107 ****
  		// which will fail for pre-2.2 containers
  		if (err == 0 && doVersionCheck)
  			err = checkVersion(txn, rdonly);
! 		if (err == 0)
  			err = seqDatabase_.open(txn, DB_BTREE, flags, mode);
! 
! 		if (err == 0)
! 			seq_ = initDbSequence(txn, seqDatabase_.getDb(),
! 					      seqIncr_, flags);
! 
! 		// Add the default index specification, if there
! 		// isn't one already
! 		if(err == 0 && !rdonly)
! 			err = checkIndexSpecification(txn);
  
  		// Add, or set the container type.  If this is
  		// a create, it won't be there. "type" is by ref
--- 91,106 ----
  		// which will fail for pre-2.2 containers
  		if (err == 0 && doVersionCheck)
  			err = checkVersion(txn, rdonly);
! 		if (err == 0 && !rdonly) {
  			err = seqDatabase_.open(txn, DB_BTREE, flags, mode);
! 			if (err == 0)
! 				seq_ = initDbSequence(txn, seqDatabase_.getDb(),
! 						      seqIncr_, flags);
! 			// Add the default index specification, if there
! 			// isn't one already and not read-only
! 			if(err == 0)
! 				err = checkIndexSpecification(txn);
! 		}
  
  		// Add, or set the container type.  If this is
  		// a create, it won't be there. "type" is by ref
***************
*** 154,159 ****
--- 153,159 ----
  	db_seq_t newValue = 0;
  	u_int32_t flags = 0;
  	DbTxn *dbtxn = 0;
+ 	DBXML_ASSERT(seq_);
  	if (txn) flags |= DB_AUTO_COMMIT|DB_TXN_NOSYNC;
  	try {
  		err = seq_->get(dbtxn, 1, &newValue, flags);
***************
*** 166,171 ****
--- 166,172 ----
  
  void ConfigurationDatabase::resetSequenceCache()
  {
+ 	DBXML_ASSERT(seq_);
  	try {
  		seq_->set_cachesize(seqIncr_);
  	} catch (DbException &e) {
diff -cr dbxml-2.4.13.orig/dbxml/src/dbxml/Container.cpp dbxml-2.4.13/dbxml/src/dbxml/Container.cpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/Container.cpp	Tue Apr 15 13:26:17 2008
--- dbxml-2.4.13/dbxml/src/dbxml/Container.cpp	Tue May 13 16:33:12 2008
***************
*** 3,9 ****
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: Container.cpp,v 1.326 2008/04/15 15:14:00 gmf Exp $
  //
  
  #include "DbXmlInternal.hpp"
--- 3,9 ----
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: Container.cpp,v 1.326.2.1 2008/05/13 20:23:52 gmf Exp $
  //
  
  #include "DbXmlInternal.hpp"
***************
*** 138,143 ****
--- 138,144 ----
  	  id_(-1),
  	  usingTxns_((txn != 0) || (flags & DBXML_TRANSACTIONAL)),
  	  usingCDB_(false),
+ 	  readOnly_(false),
  	  indexDbNotify_(0)
  {
  	if (pagesize != 0 && (pagesize < 512 || pagesize > 65536)) {
***************
*** 157,163 ****
  
  	try {
  		TransactionGuard txnGuard;
! 		txn = autoTransact(txn, txnGuard);
  
  		err = openInternal(txn, flags, mode, doVersionCheck);
  		if(err == 0) txnGuard.commit();
--- 158,165 ----
  
  	try {
  		TransactionGuard txnGuard;
! 		// do not check read-only status in this call
! 		txn = autoTransact(txn, txnGuard, false);
  
  		err = openInternal(txn, flags, mode, doVersionCheck);
  		if(err == 0) txnGuard.commit();
***************
*** 243,249 ****
  
  	// Remove flags that aren't passed to DB
  	flags &= ~(DBXML_INDEX_NODES|DBXML_NO_INDEX_NODES|
! 		DBXML_STATISTICS|DBXML_NO_STATISTICS|DBXML_ALLOW_VALIDATION);
  	
  	// set default page sizes if creating, and not already set
  	//
--- 245,254 ----
  
  	// Remove flags that aren't passed to DB
  	flags &= ~(DBXML_INDEX_NODES|DBXML_NO_INDEX_NODES|
! 		   DBXML_STATISTICS|DBXML_NO_STATISTICS|DBXML_ALLOW_VALIDATION);
! 
! 	if (flags & DB_RDONLY)
! 		readOnly_ = true;
  	
  	// set default page sizes if creating, and not already set
  	//
***************
*** 1916,1929 ****
  	delete toDel;
  }
  
! Transaction *Container::autoTransact(Transaction *txn, TransactionGuard &txnGuard) const
  {
  	return Transaction::autoTransact(txn, mgr_, txnGuard, usingTxns_, usingCDB_);
  }
  
  /////////////////////////////////
  // Implemention of ContainerBase methods
  
  void Container::getIndexSpecification(Transaction *txn,
  				      IndexSpecification &is)
  {
--- 1921,1948 ----
  	delete toDel;
  }
  
! Transaction *Container::autoTransact(Transaction *txn,
! 				     TransactionGuard &txnGuard,
! 				     bool ckReadOnly) const
  {
+ 	if (ckReadOnly)
+ 		checkReadOnly(); // may throw
  	return Transaction::autoTransact(txn, mgr_, txnGuard, usingTxns_, usingCDB_);
  }
  
  /////////////////////////////////
  // Implemention of ContainerBase methods
  
+ void Container::checkReadOnly() const
+ {
+ 	if (readOnly_) {
+ 		string msg = "Cannot perform updating operation on read-only container: ";
+ 		msg += getName();
+ 		throw XmlException(XmlException::INVALID_VALUE,
+ 				   msg);
+ 	}
+ }
+ 
  void Container::getIndexSpecification(Transaction *txn,
  				      IndexSpecification &is)
  {
diff -cr dbxml-2.4.13.orig/dbxml/src/dbxml/Container.hpp dbxml-2.4.13/dbxml/src/dbxml/Container.hpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/Container.hpp	Wed Jan 23 13:57:37 2008
--- dbxml-2.4.13/dbxml/src/dbxml/Container.hpp	Tue May 13 16:33:12 2008
***************
*** 3,9 ****
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: Container.hpp,v 1.172 2008/01/23 18:57:37 gmf Exp $
  //
  
  #ifndef __CONTAINER_HPP
--- 3,9 ----
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: Container.hpp,v 1.172.2.1 2008/05/13 20:23:52 gmf Exp $
  //
  
  #ifndef __CONTAINER_HPP
***************
*** 134,139 ****
--- 134,141 ----
  	void getIndexSpecification(Transaction *txn,
  				   IndexSpecification &index);
  
+ 	virtual void checkReadOnly() const; // throws if read-only
+ 
  	virtual Cost getDocumentSSCost(OperationContext &oc, StructuralStatsCache &cache);
  	virtual Cost getIndexCost(OperationContext &oc,
  		DbWrapper::Operation op1, const Key &key1,
***************
*** 351,357 ****
  	void openIndexDbs(Transaction *txn, u_int32_t flags, int mode);
  	void logDocumentOperation(const Document &doc, const char *msg);
  
! 	Transaction *autoTransact(Transaction *txn, TransactionGuard &txnGuard) const;
  private:
  	XmlManager xmlMgr_;
  	u_int32_t flags_;
--- 353,361 ----
  	void openIndexDbs(Transaction *txn, u_int32_t flags, int mode);
  	void logDocumentOperation(const Document &doc, const char *msg);
  
! 	Transaction *autoTransact(Transaction *txn,
! 				  TransactionGuard &txnGuard,
! 				  bool checkReadonly = true) const;
  private:
  	XmlManager xmlMgr_;
  	u_int32_t flags_;
***************
*** 365,370 ****
--- 369,375 ----
  	int id_;
  	bool usingTxns_;
  	bool usingCDB_; // ignored if not using DB 4.5 or greater
+ 	bool readOnly_;
  
  	IndexDbNotify *indexDbNotify_;
  
diff -cr dbxml-2.4.13.orig/dbxml/src/dbxml/ContainerBase.hpp dbxml-2.4.13/dbxml/src/dbxml/ContainerBase.hpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/ContainerBase.hpp	Wed Jan 16 13:23:24 2008
--- dbxml-2.4.13/dbxml/src/dbxml/ContainerBase.hpp	Tue May 13 16:33:12 2008
***************
*** 3,9 ****
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: ContainerBase.hpp,v 1.17 2008/01/16 18:23:24 gmf Exp $
  //
  
  #ifndef __CONTAINERBASE_HPP
--- 3,9 ----
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: ContainerBase.hpp,v 1.17.2.1 2008/05/13 20:23:52 gmf Exp $
  //
  
  #ifndef __CONTAINERBASE_HPP
***************
*** 64,69 ****
--- 64,70 ----
  	virtual int getContainerID() const { return 0; }
  	virtual void getIndexSpecification(Transaction *txn,
  					   IndexSpecification &index);
+ 	virtual void checkReadOnly() const { return; }
  
  	// get the estimated cost of an operation
  	virtual Cost getDocumentSSCost(OperationContext &oc, StructuralStatsCache &cache);
diff -cr dbxml-2.4.13.orig/dbxml/src/dbxml/RawNodeValue.cpp dbxml-2.4.13/dbxml/src/dbxml/RawNodeValue.cpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/RawNodeValue.cpp	Tue Apr 15 13:26:17 2008
--- dbxml-2.4.13/dbxml/src/dbxml/RawNodeValue.cpp	Tue May 13 16:33:12 2008
***************
*** 3,9 ****
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: RawNodeValue.cpp,v 1.19 2008/04/11 14:07:35 lauren Exp $
  //
  
  #include "DbXmlInternal.hpp"
--- 3,9 ----
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: RawNodeValue.cpp,v 1.19.2.1 2008/05/09 19:44:18 gmf Exp $
  //
  
  #include "DbXmlInternal.hpp"
***************
*** 98,104 ****
  	ContainerBase *cont = ((Manager&)mgr).getContainerFromID(cid_, false);
  	if(!cont)
  		throw XmlException(XmlException::CONTAINER_CLOSED, "Cannot complete operation because container is closed.");
! 	return cont->getDbWrapper();
  }
  
  DictionaryDatabase *RawNodeValue::getDictDB() const
--- 98,111 ----
  	ContainerBase *cont = ((Manager&)mgr).getContainerFromID(cid_, false);
  	if(!cont)
  		throw XmlException(XmlException::CONTAINER_CLOSED, "Cannot complete operation because container is closed.");
! 	 DbWrapper *docDb = cont->getDbWrapper();
! 	 //Materialize whole documents that have not already been parsed into the temporary nodestorage db
! 	 if(!docDb){
! 		XmlDocument doc = asDocument();
! 		(*doc).getElement(*NsNid::getRootNid(),0);
! 		docDb = (*doc).getDocDb();
! 	 }
! 	 return docDb;
  }
  
  DictionaryDatabase *RawNodeValue::getDictDB() const
***************
*** 112,118 ****
  }
  
  void RawNodeValue::getNsDomNode() const
! {
  	if (!node_) {
  		doc_.init(GET_RESULTS().getOperationContext().txn(),
  			  getDocDB(), getDictDB(),
--- 119,125 ----
  }
  
  void RawNodeValue::getNsDomNode() const
! { 
  	if (!node_) {
  		doc_.init(GET_RESULTS().getOperationContext().txn(),
  			  getDocDB(), getDictDB(),
diff -cr dbxml-2.4.13.orig/dbxml/src/dbxml/Value.cpp dbxml-2.4.13/dbxml/src/dbxml/Value.cpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/Value.cpp	Mon Mar  3 13:33:19 2008
--- dbxml-2.4.13/dbxml/src/dbxml/Value.cpp	Tue May 13 16:33:12 2008
***************
*** 3,9 ****
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: Value.cpp,v 1.140 2008/03/03 17:53:18 gmf Exp $
  //
  
  #include "DbXmlInternal.hpp"
--- 3,9 ----
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: Value.cpp,v 1.140.2.1 2008/05/09 16:21:06 gmf Exp $
  //
  
  #include "DbXmlInternal.hpp"
***************
*** 526,532 ****
  {
  	if (((Document&)d_).getContainerID() == 0) {
  		throw XmlException(XmlException::INVALID_VALUE,
! 				   "getNodeHandle() requires a live node");
  	}
  
  	IndexEntry ie;
--- 526,532 ----
  {
  	if (((Document&)d_).getContainerID() == 0) {
  		throw XmlException(XmlException::INVALID_VALUE,
! 				   "Node handles are only available for nodes from a container");
  	}
  
  	IndexEntry ie;
diff -cr dbxml-2.4.13.orig/dbxml/src/dbxml/dataItem/DbXmlNodeImpl.cpp dbxml-2.4.13/dbxml/src/dbxml/dataItem/DbXmlNodeImpl.cpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/dataItem/DbXmlNodeImpl.cpp	Wed Mar 26 15:35:19 2008
--- dbxml-2.4.13/dbxml/src/dbxml/dataItem/DbXmlNodeImpl.cpp	Tue May 13 16:33:12 2008
***************
*** 3,9 ****
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: DbXmlNodeImpl.cpp,v 1.103 2008/03/26 19:35:19 gmf Exp $
  //
  
  #include "../DbXmlInternal.hpp"
--- 3,9 ----
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: DbXmlNodeImpl.cpp,v 1.103.2.2 2008/05/13 20:23:52 gmf Exp $
  //
  
  #include "../DbXmlInternal.hpp"
***************
*** 313,318 ****
--- 313,365 ----
  	return XMLString::replicate((XMLCh*)target.getRawBuffer(), mm);
  }
  
+ string DbXmlNodeImpl::getNodeHandle() const
+ {
+ 	// this method will only work on nodes from a real container
+ 	if (getContainerID() == 0) {
+ 		throw XmlException(XmlException::INVALID_VALUE,
+ 				   "Node handles are only available for nodes from a container");
+ 	}
+ 	IndexEntry ie;
+ 	ie.setDocID(getDocID());
+ 
+ 	short type = getNodeType();
+ 	if(type != nsNodeDocument) {
+ 		ie.setNodeID(getNodeID());
+ 
+ 		if(type == nsNodeElement) {
+ 			ie.setFormat(IndexEntry::NH_ELEMENT_FORMAT);
+ 		} else if(type == nsNodeAttr) {
+ 			ie.setFormat(IndexEntry::NH_ATTRIBUTE_FORMAT);
+ 			ie.setIndex(getIndex());
+ 		} else if(type == nsNodeText ||
+ 			type == nsNodeCDATA) {
+ 			ie.setFormat(IndexEntry::NH_TEXT_FORMAT);
+ 			ie.setIndex(getIndex());
+ 		} else if(type == nsNodeComment) {
+ 			ie.setFormat(IndexEntry::NH_COMMENT_FORMAT);
+ 			ie.setIndex(getIndex());
+ 		} else if(type == nsNodePinst) {
+ 			ie.setFormat(IndexEntry::NH_PI_FORMAT);
+ 			ie.setIndex(getIndex());
+ 		} else {
+ 			throw XmlException(XmlException::INVALID_VALUE,
+ 				"Node handle unavailable for node type");
+ 		}
+ 	} else {
+ 		ie.setFormat(IndexEntry::NH_DOCUMENT_FORMAT);
+ 	}
+ 
+ 	return ie.getNodeHandle();
+ }
+ 
+ void DbXmlNodeImpl::checkReadOnly() const
+ {
+ 	ContainerBase *base = getContainer();
+ 	if (base)
+ 		base->checkReadOnly();
+ }
+ 	
  //
  // DbxmlNsDomNode Implementation
  //
***************
*** 434,439 ****
--- 481,487 ----
  bool DbXmlNsDomNode::isUpdateAble() const
  {
  	MATERIALISE_NODE;
+ 	checkReadOnly();
  	if ((Document*)document_ &&
  	    ((Document*)document_)->getDocDb())
  		return true;
***************
*** 575,615 ****
  	return node_->getLastDescendantNid();
  }
  
- string DbXmlNsDomNode::getNodeHandle() const
- {
- 	IndexEntry ie;
- 	ie.setDocID(getDocID());
- 
- 	short type = getNodeType();
- 	if(type != nsNodeDocument) {
- 		ie.setNodeID(getNodeID());
- 
- 		if(type == nsNodeElement) {
- 			ie.setFormat(IndexEntry::NH_ELEMENT_FORMAT);
- 		} else if(type == nsNodeAttr) {
- 			ie.setFormat(IndexEntry::NH_ATTRIBUTE_FORMAT);
- 			ie.setIndex(getIndex());
- 		} else if(type == nsNodeText ||
- 			type == nsNodeCDATA) {
- 			ie.setFormat(IndexEntry::NH_TEXT_FORMAT);
- 			ie.setIndex(getIndex());
- 		} else if(type == nsNodeComment) {
- 			ie.setFormat(IndexEntry::NH_COMMENT_FORMAT);
- 			ie.setIndex(getIndex());
- 		} else if(type == nsNodePinst) {
- 			ie.setFormat(IndexEntry::NH_PI_FORMAT);
- 			ie.setIndex(getIndex());
- 		} else {
- 			throw XmlException(XmlException::INVALID_VALUE,
- 				"Node handle unavailable for node type");
- 		}
- 	} else {
- 		ie.setFormat(IndexEntry::NH_DOCUMENT_FORMAT);
- 	}
- 
- 	return ie.getNodeHandle();
- }
- 
  const XMLCh* DbXmlNsDomNode::getLocalName() const
  {
  	switch(getNodeType())
--- 623,628 ----
***************
*** 1306,1311 ****
--- 1319,1325 ----
  
  bool DbXmlAttributeNode::isUpdateAble() const
  {
+ 	checkReadOnly();
  	// attributes are only updateable if they
  	// exist in a real container (vs constructed)
  	// TBD -- maybe think about updating standalone
diff -cr dbxml-2.4.13.orig/dbxml/src/dbxml/dataItem/DbXmlNodeImpl.hpp dbxml-2.4.13/dbxml/src/dbxml/dataItem/DbXmlNodeImpl.hpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/dataItem/DbXmlNodeImpl.hpp	Wed Mar 26 15:35:19 2008
--- dbxml-2.4.13/dbxml/src/dbxml/dataItem/DbXmlNodeImpl.hpp	Tue May 13 16:33:12 2008
***************
*** 3,9 ****
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: DbXmlNodeImpl.hpp,v 1.61 2008/03/26 19:35:19 gmf Exp $
  //
  
  #ifndef __DBXMLNODEIMPL_HPP
--- 3,9 ----
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: DbXmlNodeImpl.hpp,v 1.61.2.2 2008/05/13 20:23:52 gmf Exp $
  //
  
  #ifndef __DBXMLNODEIMPL_HPP
***************
*** 152,158 ****
  				      DynamicContext *context) const {
  		return 0;
  	}
! 	virtual std::string getNodeHandle() const { return 0; }
  	virtual DbXmlResult getAxisDbXmlResult(XQStep::Axis axis,
  					       const NodeTest *nodeTest,
  					       const DynamicContext *context,
--- 152,158 ----
  				      DynamicContext *context) const {
  		return 0;
  	}
! 	virtual std::string getNodeHandle() const;
  	virtual DbXmlResult getAxisDbXmlResult(XQStep::Axis axis,
  					       const NodeTest *nodeTest,
  					       const DynamicContext *context,
***************
*** 166,171 ****
--- 166,173 ----
  	virtual const XMLCh *getPrefix() const { return 0; }
  	virtual const XMLCh *getValue() const { return 0; }
  	virtual const XMLCh *getPITarget() const { return 0; }
+ protected:
+ 	void checkReadOnly() const;
  };
  	
  class DbXmlNsDomNode: public DbXmlNodeImpl
***************
*** 232,238 ****
  	virtual Item::Ptr getMetaData(const XMLCh *uri,
  				      const XMLCh *name,
  				      DynamicContext *context) const;
- 	virtual std::string getNodeHandle() const;
  	virtual const XMLCh *getLocalName() const;
  	virtual const XMLCh *getUri() const;
  	virtual const XMLCh *getPrefix() const;
--- 234,239 ----
diff -cr dbxml-2.4.13.orig/dbxml/src/dbxml/query/BufferQP.cpp dbxml-2.4.13/dbxml/src/dbxml/query/BufferQP.cpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/query/BufferQP.cpp	Wed Jan  9 09:49:45 2008
--- dbxml-2.4.13/dbxml/src/dbxml/query/BufferQP.cpp	Tue May 13 16:33:13 2008
***************
*** 3,9 ****
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: BufferQP.cpp,v 1.22 2008/01/08 21:54:25 bostic Exp $
  //
  
  #include "../DbXmlInternal.hpp"
--- 3,9 ----
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: BufferQP.cpp,v 1.22.2.1 2008/05/09 16:04:41 gmf Exp $
  //
  
  #include "../DbXmlInternal.hpp"
***************
*** 33,39 ****
  	: QueryPlan(BUFFER, flags, mm),
  	  parent_(parent),
  	  arg_(arg),
! 	  bufferId_(bufferId)
  {
  }
  
--- 33,41 ----
  	: QueryPlan(BUFFER, flags, mm),
  	  parent_(parent),
  	  arg_(arg),
! 	  bufferId_(bufferId),
! 	  parentCost_(),
! 	  parentCostSet_(false)
  {
  }
  
***************
*** 66,71 ****
--- 68,74 ----
  	_src.clear();
  
  	parent_ = parent_->staticTyping(context);
+ 	parentCostSet_ = false;
  	// Do not add the StaticAnalysis, as
  	// that is handled by the BufferEndQP objects
  
***************
*** 82,87 ****
--- 85,91 ----
  	_src.clear();
  
  	parent_->staticTypingLite(context);
+ 	parentCostSet_ = false;
  	// Do not add the StaticAnalysis, as
  	// that is handled by the BufferEndQP objects
  
***************
*** 95,100 ****
--- 99,105 ----
  {
  	// Optimise the parent QueryPlan
  	parent_ = parent_->optimize(opt);
+ 	parentCostSet_ = false;
  
  	BufferReferenceSetter().run(this);
  
***************
*** 253,258 ****
--- 258,264 ----
  		mm = memMgr_;
  	}
  
+ 	// We deliberately don't copy the parentCost_ - it's only a cache
  	BufferQP *result = new (mm) BufferQP(parent_->copy(mm), arg_->copy(mm), bufferId_, flags_, mm);
  	result->setLocationInfo(this);
  	BufferReferenceSetter().run(result);
***************
*** 273,287 ****
  	arg_->findQueryPlanRoots(qprset);
  }
  
  Cost BufferQP::cost(OperationContext &context, QueryExecutionContext &qec) const
  {
! 	Cost parentCost = parent_->cost(context, qec);
  
  	Cost cost = arg_->cost(context, qec);
! 	cost.pagesOverhead += parentCost.totalPages();
  
  	// Add the cost of storing the buffered data
! 	cost.pagesOverhead += parentCost.keys * INLINE_BYTES_PER_KEY_THRESHOLD;
  
  	return cost;
  }
--- 279,302 ----
  	arg_->findQueryPlanRoots(qprset);
  }
  
+ Cost BufferQP::getParentCost(OperationContext &context, QueryExecutionContext &qec) const
+ {
+ 	if(!parentCostSet_) {
+ 		parentCost_ = parent_->cost(context, qec);
+ 		parentCostSet_ = true;
+ 	}
+ 	return parentCost_;
+ }
+ 
  Cost BufferQP::cost(OperationContext &context, QueryExecutionContext &qec) const
  {
! 	getParentCost(context, qec);
  
  	Cost cost = arg_->cost(context, qec);
! 	cost.pagesOverhead += parentCost_.totalPages();
  
  	// Add the cost of storing the buffered data
! 	cost.pagesOverhead += parentCost_.keys * INLINE_BYTES_PER_KEY_THRESHOLD;
  
  	return cost;
  }
***************
*** 370,376 ****
  Cost BufferReferenceQP::cost(OperationContext &context, QueryExecutionContext &qec) const
  {
  	Cost cost;
! 	cost.keys = bqp_->getParent()->cost(context, qec).keys;
  
  	// Add the cost of retriving the buffered data
  	cost.pagesForKeys = cost.keys * INLINE_BYTES_PER_KEY_THRESHOLD;
--- 385,391 ----
  Cost BufferReferenceQP::cost(OperationContext &context, QueryExecutionContext &qec) const
  {
  	Cost cost;
! 	cost.keys = bqp_->getParentCost(context, qec).keys;
  
  	// Add the cost of retriving the buffered data
  	cost.pagesForKeys = cost.keys * INLINE_BYTES_PER_KEY_THRESHOLD;
diff -cr dbxml-2.4.13.orig/dbxml/src/dbxml/query/BufferQP.hpp dbxml-2.4.13/dbxml/src/dbxml/query/BufferQP.hpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/query/BufferQP.hpp	Wed Jan  9 09:49:45 2008
--- dbxml-2.4.13/dbxml/src/dbxml/query/BufferQP.hpp	Tue May 13 16:33:13 2008
***************
*** 3,9 ****
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: BufferQP.hpp,v 1.10 2008/01/08 21:54:25 bostic Exp $
  //
  
  #ifndef __BUFFERQP_HPP
--- 3,9 ----
  //
  // Copyright (c) 2002,2008 Oracle.  All rights reserved.
  //
! // $Id: BufferQP.hpp,v 1.10.2.1 2008/05/09 16:04:41 gmf Exp $
  //
  
  #ifndef __BUFFERQP_HPP
***************
*** 45,50 ****
--- 45,51 ----
  
  	virtual NodeIterator *createNodeIterator(DynamicContext *context) const;
  	virtual Cost cost(OperationContext &context, QueryExecutionContext &qec) const;
+ 	Cost getParentCost(OperationContext &context, QueryExecutionContext &qec) const;
  
  	virtual void findQueryPlanRoots(QPRSet &qprset) const;
  	virtual bool isSubsetOf(const QueryPlan *o) const;
***************
*** 57,62 ****
--- 58,66 ----
  	QueryPlan *parent_;
  	QueryPlan *arg_;
  	unsigned int bufferId_;
+ 
+ 	mutable Cost parentCost_;
+ 	mutable bool parentCostSet_;
  };
  
  class BufferReferenceQP : public QueryPlan
diff -cr dbxml-2.4.13.orig/dbxml/src/java/com/sleepycat/dbxml/XmlQueryContext.java dbxml-2.4.13/dbxml/src/java/com/sleepycat/dbxml/XmlQueryContext.java
*** dbxml-2.4.13.orig/dbxml/src/java/com/sleepycat/dbxml/XmlQueryContext.java	Fri Mar 21 13:29:32 2008
--- dbxml-2.4.13/dbxml/src/java/com/sleepycat/dbxml/XmlQueryContext.java	Tue May 13 16:33:13 2008
***************
*** 39,44 ****
--- 39,45 ----
  	if(o.namespaces != null) namespaces = new HashMap(o.namespaces);
  	if(o.variables != null)variables = new HashMap(o.variables);
  	interrupt = new Interrupter();
+ 	mgr = o.mgr;
      }
  
      public void delete(){}
diff -cr dbxml-2.4.13.orig/dbxml/src/java/com/sleepycat/dbxml/XmlValue.java dbxml-2.4.13/dbxml/src/java/com/sleepycat/dbxml/XmlValue.java
*** dbxml-2.4.13.orig/dbxml/src/java/com/sleepycat/dbxml/XmlValue.java	Wed Apr  2 12:34:40 2008
--- dbxml-2.4.13/dbxml/src/java/com/sleepycat/dbxml/XmlValue.java	Tue May 13 16:33:13 2008
***************
*** 3,9 ****
  
  //Copyright (c) 2002,2008 Oracle.  All rights reserved.
  
! //$Id: XmlValue.java,v 1.75 2008/03/21 17:23:54 lauren Exp $
  
  
  package com.sleepycat.dbxml;
--- 3,9 ----
  
  //Copyright (c) 2002,2008 Oracle.  All rights reserved.
  
! //$Id: XmlValue.java,v 1.75.2.1 2008/05/09 19:44:18 gmf Exp $
  
  
  package com.sleepycat.dbxml;
***************
*** 1000,1008 ****
  	    checkConstructedDocument();
  	    XmlResults xmlresults = HelperFunctions.getAttributes(ID, getResult());
  	    if(tempResults != null)
! 		tempResults.delete();
! 	    XmlResults origResults = getResult();
! 	    xmlresults.resultsMapPut(new Long(XmlResults.getCPtr(origResults)), origResults);
  	    return xmlresults;
  	}
  		
--- 1000,1011 ----
  	    checkConstructedDocument();
  	    XmlResults xmlresults = HelperFunctions.getAttributes(ID, getResult());
  	    if(tempResults != null)
! 		xmlresults.resultsMapPut(new Long(XmlResults.getCPtr(tempResults)), tempResults);
! 	    else{
! 		XmlResults origResults = getResult();
! 		xmlresults.resultsMapPut(new Long(XmlResults.getCPtr(origResults)), origResults);
! 	    }
! 	    
  	    return xmlresults;
  	}
  		
diff -cr dbxml-2.4.13.orig/dbxml/test/java/XmlQueryContext/QueryContextTest.java dbxml-2.4.13/dbxml/test/java/XmlQueryContext/QueryContextTest.java
*** dbxml-2.4.13.orig/dbxml/test/java/XmlQueryContext/QueryContextTest.java	Wed Apr 30 10:59:54 2008
--- dbxml-2.4.13/dbxml/test/java/XmlQueryContext/QueryContextTest.java	Tue May 13 16:33:14 2008
***************
*** 75,80 ****
--- 75,105 ----
  	XmlValue origValue = original.getVariableValue("name");
  	XmlValue copiedValue = copied.getVariableValue("name");
  	assertTrue(origValue.equals(copiedValue));
+ 	
+ 	String docString = "<?xml version=\"1.0\" "
+ 	    + "encoding=\"UTF-8\"?><a_node atr1=\"test\" atr2=\"test2\""
+ 	    + "><b_node/><c_node>Other text</c_node><d_node/>"
+ 	    + "</a_node>";
+ 	String query = "collection('" + CON_NAME + "')/old:a_node/c_node";
+ 	XmlTransaction txn = null;
+ 	XmlResults res = null;
+ 	try{
+ 	    if(hp.isTransactional()){
+ 		txn = mgr.createTransaction();
+ 		cont.putDocument(txn, docName, docString);
+ 		res = mgr.query(txn, query, copied);
+ 	    }else{
+ 		cont.putDocument(docName, docString);
+ 		res = mgr.query(query, copied);
+ 	    }    
+ 	    assert(res.size() > 0);
+ 	}catch(XmlException e){
+ 	    throw e;
+ 	}finally{
+ 	    if(txn != null) txn.commit();
+ 	    if(res != null) res.delete();
+ 	    res = null;
+ 	}
  
  	try{
  	    copied = new XmlQueryContext(null);
diff -cr dbxml-2.4.13.orig/dbxml/test/java/XmlValue/ValueTest.java dbxml-2.4.13/dbxml/test/java/XmlValue/ValueTest.java
*** dbxml-2.4.13.orig/dbxml/test/java/XmlValue/ValueTest.java	Wed Apr 30 10:59:54 2008
--- dbxml-2.4.13/dbxml/test/java/XmlValue/ValueTest.java	Tue May 13 16:33:14 2008
***************
*** 3,9 ****
   *
   * Copyright (c) 2007,2008 Oracle.  All rights reserved.
   *
!  * $Id: ValueTest.java,v 1.18 2008/04/30 13:02:58 lauren Exp $
   */
  
  package dbxmltest;
--- 3,9 ----
   *
   * Copyright (c) 2007,2008 Oracle.  All rights reserved.
   *
!  * $Id: ValueTest.java,v 1.17.2.2 2008/05/09 19:47:35 gmf Exp $
   */
  
  package dbxmltest;
***************
*** 2721,2726 ****
--- 2721,2755 ----
  	    if(results != null)results.delete();
  	    results = null;
  	}
+ 	
+ 	try{
+ 	    if(hp.isTransactional())
+ 		results = mgr.query(txn, "collection('"+ CON_NAME+"')/old:a_node", context);
+ 	    else
+ 		results = mgr.query("collection('"+ CON_NAME+"')/old:a_node", context);
+ 
+ 	    value = results.next();
+ 	    tempResults = value.getAttributes();
+ 	    tempValue = tempResults.next(); 
+ 	    assertTrue(tempValue.getNodeName().matches("atr1") || tempValue.getNodeName().matches("atr2") || tempValue.getNodeName().matches("xmlns:old"));
+ 	    assertTrue(tempValue.getNodeValue().matches("test") || tempValue.getNodeValue().matches("test2") || tempValue.getNodeValue().matches("http://dbxmltest.test/test"));
+ 	    results.delete();
+ 	    results = null;
+ 	    try{
+ 		tempValue = tempResults.next();
+ 		tempValue.getNodeName();
+ 		fail("Failure in ValueTest.testGetAttributes()");
+ 	    }catch(XmlException e){
+ 		assertEquals(e.getErrorCode(), XmlException.INVALID_VALUE);
+ 	    }
+ 	}catch(XmlException e){
+ 	    throw e;
+ 	}finally{
+ 	    if(tempResults != null) tempResults.delete();
+ 	    tempResults = null;
+ 	    if(results != null)results.delete();
+ 	    results = null;
+ 	}
  
  	XmlDocument contextDoc = mgr.createDocument();
  	contextDoc.setContent(docString);
***************
*** 2753,2758 ****
--- 2782,2808 ----
  	    results = null;
  	}
  
+ 	XmlResults atts = null;
+ 	try{
+ 	    if(hp.isTransactional())
+ 		contextDoc = cont.getDocument(txn, docName);
+ 	    else
+ 		contextDoc = cont.getDocument(docName);
+ 	    docValue = new XmlValue(contextDoc);
+ 	    XmlValue xmlValue = docValue.getFirstChild();
+ 	    atts = xmlValue.getAttributes();
+ 	    while (atts.hasNext()) {
+ 		tempValue = atts.next();
+ 		assertTrue(tempValue.getNodeName().matches("atr1") || tempValue.getNodeName().matches("atr2") || tempValue.getNodeName().matches("xmlns:old"));
+ 		assertTrue(tempValue.getNodeValue().matches("test") || tempValue.getNodeValue().matches("test2") || tempValue.getNodeValue().matches("http://dbxmltest.test/test"));
+ 	    }
+ 	}catch(XmlException e){
+ 	    throw e;
+ 	}finally{
+ 	    if(atts != null)atts.delete();
+ 	    atts = null;
+ 	}
+ 
  	// test null XmlValue
  	try {
  	    vl_NONE.getAttributes();
diff -cr dbxml-2.4.13.orig/dbxml/test/queries/queries.xml dbxml-2.4.13/dbxml/test/queries/queries.xml
*** dbxml-2.4.13.orig/dbxml/test/queries/queries.xml	Fri Apr 25 11:00:36 2008
--- dbxml-2.4.13/dbxml/test/queries/queries.xml	Tue May 13 16:33:14 2008
***************
*** 1,4 ****
! <test-suite version="$Id: queries.xml,v 1.7 2008/04/25 14:52:33 jpcs Exp $"
              ResultOffsetPath="ExpectedTestResults/"
              XQueryQueryOffsetPath="Queries/"
              XQueryFileExtension=".xq">
--- 1,4 ----
! <test-suite version="$Id: queries.xml,v 1.7.2.1 2008/05/09 16:04:42 gmf Exp $"
              ResultOffsetPath="ExpectedTestResults/"
              XQueryQueryOffsetPath="Queries/"
              XQueryFileExtension=".xq">
***************
*** 124,129 ****
--- 124,135 ----
        <defaultCollection>aCollection</defaultCollection>
        <output-file compare="Fragment">ancestor-Q8.out</output-file>
      </test-case>
+     <test-case name="ancestor-Q9" FilePath="AncestorTests/">
+       <!-- Test for the exponential negative predicate bug -->
+       <query name="ancestor-Q9"/>
+       <defaultCollection>aCollection</defaultCollection>
+       <expected-error>FORG0001</expected-error>
+     </test-case>
    </test-group>
  
    <test-group name="PredicateTests">
diff -cr dbxml-2.4.13.orig/dbxml/test/tcl/xml008.tcl dbxml-2.4.13/dbxml/test/tcl/xml008.tcl
*** dbxml-2.4.13.orig/dbxml/test/tcl/xml008.tcl	Tue Apr 15 15:33:55 2008
--- dbxml-2.4.13/dbxml/test/tcl/xml008.tcl	Tue May 13 16:33:14 2008
***************
*** 2,8 ****
  #
  # Copyright (c) 2000,2008 Oracle.  All rights reserved.
  #
! # $Id: xml008.tcl,v 1.6 2008/04/15 19:33:45 gmf Exp $
  #
  # TEST	xml008
  # TEST	Container Management
--- 2,8 ----
  #
  # Copyright (c) 2000,2008 Oracle.  All rights reserved.
  #
! # $Id: xml008.tcl,v 1.6.2.1 2008/05/13 20:23:53 gmf Exp $
  #
  # TEST	xml008
  # TEST	Container Management
***************
*** 47,53 ****
      }
  
      set basename $tnum
!     
      # multiple containers
      xml008_1 $env $txnenv $basename.1 $oargs
      
--- 47,53 ----
      }
  
      set basename $tnum
! 
      # multiple containers
      xml008_1 $env $txnenv $basename.1 $oargs
      
***************
*** 71,76 ****
--- 71,79 ----
  
      # container not found
      xml008_9 $env $txnenv $basename.9 $oargs
+ 
+     # container read only
+     xml008_10 $env $txnenv $basename.10 $oargs
      
      return
  }
***************
*** 829,831 ****
--- 832,942 ----
      delete mgr
  }
  
+ # Container read only
+ proc xml008_10 { {env "NULL"} {txnenv 0} {basename $tnum} oargs } {
+     puts "\t8.10: Container read only"
+     source ./include.tcl
+     set txn "0"
+ 
+     xml_cleanup $testdir $env
+     xml_database mgr $testdir $env
+     wrap XmlUpdateContext uc [$mgr createUpdateContext]
+ 
+     set container_name "readonly.dbxml"
+     set doc_name "doc"
+     set doc_name1 "doc1"
+     set doc_content "<root><a att='1'/></root>"
+ 
+     # create a container and insert a document
+     if { $txnenv == 1 } {
+ 	wrap XmlTransaction txn [$mgr createTransaction]
+ 	wrap XmlContainer container [$mgr createContainer $txn $container_name $oargs $global_container_type]
+ 	$container putDocument $txn $doc_name $doc_content $uc
+ 	$txn commit
+ 	delete txn
+     } else {
+ 	wrap XmlContainer container [$mgr createContainer $container_name $oargs $global_container_type]
+ 	$container putDocument $doc_name $doc_content $uc
+     }
+     # close the container
+     delete container
+ 
+     # open it read-only
+     set ronly_args [expr $oargs + $DB_RDONLY]
+     if { $txnenv == 1 } {
+ 	wrap XmlTransaction txn [$mgr createTransaction]
+ 	wrap XmlContainer container [$mgr openContainer $txn $container_name $ronly_args]
+ 	$txn commit
+ 	delete txn
+     } else {
+ 	wrap XmlContainer container [$mgr openContainer $container_name $ronly_args]
+     }
+     $container addAlias "alias"
+ 
+     wrap XmlQueryContext qc [$mgr createQueryContext]
+ 
+     # try to putdocument
+     if { $txnenv == 1 } {
+ 	wrap XmlTransaction txn [$mgr createTransaction]
+ 	catch { $container putDocument $txn $doc_name1 $doc_content $uc } ret
+ 	$txn commit
+ 	delete txn
+     } else {
+ 	wrap XmlContainer container [$mgr openContainer $container_name $ronly_args]
+ 	catch { $container putDocument $doc_name1 $doc_content $uc } ret
+     }
+     dbxml_error_check_good $basename [string match "*read-only*" $ret] 1
+ 
+     # try to add an index
+     if { $txnenv == 1 } {
+ 	wrap XmlTransaction txn [$mgr createTransaction]
+ 	wrap XmlIndexSpecification is [$container getIndexSpecification]
+ 	catch { $container setIndexSpecification $txn $is $uc } ret
+ 	$txn commit
+ 	delete txn
+     } else {
+ 	wrap XmlIndexSpecification is [$container getIndexSpecification]
+ 	catch { $container setIndexSpecification $is $uc } ret
+     }
+     delete is;
+     dbxml_error_check_good $basename [string match "*read-only*" $ret] 1
+     
+ 
+     # basic query  (will work)
+     set query "collection('alias')/root/a"
+     if { $txnenv == 1 } {
+ 	wrap XmlTransaction txn [$mgr createTransaction]
+ 	wrap XmlResults res [$mgr query $txn $query $qc]
+     } else {
+ 	wrap XmlResults res [$mgr query $query $qc]
+     }
+     
+     new XmlValue value
+     while { [$res next $value] } {
+ 	set v [$value asString]
+     }
+     if { $txnenv == 1 } {
+ 	$txn commit
+ 	delete txn
+     }
+     delete res
+     delete value
+ 
+     # update query (will fail)
+     set query "for \$i in collection('alias')/root/a return rename node \$i as 'b'"
+     if { $txnenv == 1 } {
+ 	wrap XmlTransaction txn [$mgr createTransaction]
+ 	catch {wrap XmlResults res [$mgr query $txn $query $qc]} ret
+ 	$txn commit
+ 	delete txn
+     } else {
+ 	catch {wrap XmlResults res [$mgr query $query $qc]} ret
+     }
+     dbxml_error_check_good $basename [string match "*read-only*" $ret] 1
+     
+     delete qc
+     delete container
+     delete uc
+     delete mgr
+ }
+ 


--- NEW FILE patch.2.4.13.2 ---
diff -c dbxml-2.4.13.orig/dbxml/src/dbxml/dataItem/DbXmlSequenceBuilder.cpp dbxml-2.4.13/dbxml/src/dbxml/dataItem/DbXmlSequenceBuilder.cpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/dataItem/DbXmlSequenceBuilder.cpp
--- dbxml-2.4.13/dbxml/src/dbxml/dataItem/DbXmlSequenceBuilder.cpp
***************
*** 35,41 ****
  	  xmlDoc_(0),
  	  doingSequence_(0),
  	  writer_(0),
! 	  seq_(context->getMemoryManager())
  {
  	rootNid_.setLen(0, false);
  }
--- 35,42 ----
  	  xmlDoc_(0),
  	  doingSequence_(0),
  	  writer_(0),
! 	  seq_(context->getMemoryManager()),
! 	  nextIsRoot_(false)
  {
  	rootNid_.setLen(0, false);
  }
***************
*** 80,88 ****
  	// get the "root" of the sequence and create a node
  	NsDomElement *root = ((Document&)xmlDoc_).getElement(NsNid(&rootNid_), 0);
  	DBXML_ASSERT(root);
- 	// Tell NsDom that this is the "root" of the tree, whether it's
- 	// a Document node or not
- 	root->setIsRoot();
  	
  	seq_.addItem(((DbXmlFactoryImpl*)context_->getItemFactory())->
  		     createNode(root, xmlDoc_, context_));
--- 81,86 ----
***************
*** 98,104 ****
--- 96,104 ----
  {
  	DBXML_ASSERT(!writer_);
  	DBXML_ASSERT(!doingSequence_);
+ 	DBXML_ASSERT(!nextIsRoot_);
  	writer_ = createWriter(xmlDoc_, context_, &rootNid_);
+ 	nextIsRoot_ = true;
  	doingSequence_++;
  	((Document*)xmlDoc_)->setDocumentURI(documentURI);
  	((Document*)xmlDoc_)->getNsDocument()->
***************
*** 121,131 ****
  					     const XMLCh *uri,
  					     const XMLCh *localname)
  {
! 	bool isRoot = false;
  	if (writer_ == 0) {
  		DBXML_ASSERT(!doingSequence_);
  		writer_ = createWriter(xmlDoc_, context_, 0);
! 		isRoot = true;
  	}
  	doingSequence_++;
  	XMLChToUTF8Null pfx(prefix);
--- 121,132 ----
  					     const XMLCh *uri,
  					     const XMLCh *localname)
  {
! 	bool initRootNid = false;
  	if (writer_ == 0) {
  		DBXML_ASSERT(!doingSequence_);
  		writer_ = createWriter(xmlDoc_, context_, 0);
! 		initRootNid = true;
! 		nextIsRoot_ = true;
  	}
  	doingSequence_++;
  	XMLChToUTF8Null pfx(prefix);
***************
*** 133,139 ****
  	XMLChToUTF8Null lname(localname);
  	writer_->writeStartElementInternal(lname.ucstr(), pfx.ucstr(),
  					   turi.ucstr(),
! 					   (isRoot ? &rootNid_ : 0));
  }
  
  void DbXmlSequenceBuilder::endElementEvent(const XMLCh *prefix,
--- 134,142 ----
  	XMLChToUTF8Null lname(localname);
  	writer_->writeStartElementInternal(lname.ucstr(), pfx.ucstr(),
  					   turi.ucstr(),
! 					   (initRootNid ? &rootNid_ : 0),
! 					   nextIsRoot_);
! 	nextIsRoot_ = false; // unconditionally clear
  }
  
  void DbXmlSequenceBuilder::endElementEvent(const XMLCh *prefix,
diff dbxml-2.4.13.orig/dbxml/src/dbxml/dataItem/DbXmlSequenceBuilder.hpp dbxml-2.4.13/dbxml/src/dbxml/dataItem/DbXmlSequenceBuilder.hpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/dataItem/DbXmlSequenceBuilder.hpp
--- dbxml-2.4.13/dbxml/src/dbxml/dataItem/DbXmlSequenceBuilder.hpp
53a54
>        bool nextIsRoot_;
diff -c dbxml-2.4.13.orig/dbxml/src/dbxml/nodeStore/NsDom.cpp dbxml-2.4.13/dbxml/src/dbxml/nodeStore/NsDom.cpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/nodeStore/NsDom.cpp
--- dbxml-2.4.13/dbxml/src/dbxml/nodeStore/NsDom.cpp
***************
*** 102,108 ****
  			   NsDoc *document) :
  
  	NsDomNode(document), node_(node),
! 	lname_(0), isRoot_(false)
  {
  	if (isDocumentNode()) {
  		qname_.set(_nsDomDocName, false);
--- 102,108 ----
  			   NsDoc *document) :
  
  	NsDomNode(document), node_(node),
! 	lname_(0)
  {
  	if (isDocumentNode()) {
  		qname_.set(_nsDomDocName, false);
***************
*** 120,125 ****
--- 120,137 ----
  	return new NsDomElement(*node_, doc_);
  }
  
+ void NsDomElement::setIsRoot()
+ {
+ 	DBXML_ASSERT(node_);
+ 	node_->setIsRoot();
+ }
+ 
+ bool NsDomElement::isRoot() const
+ {
+ 	DBXML_ASSERT(node_);
+ 	return node_->isRoot();
+ }
+ 
  void NsDomElement::refreshNode(OperationContext &oc,
  			       bool forWrite)
  {
***************
*** 275,281 ****
  NsDomElement *
  NsDomElement::getElemParent()
  {
! 	if (isRoot_ || isDocumentNode())
  		return 0;
  	NsDomElement *ret = new NsDomElement(getParentNode(), doc_);
  	if (!ret)
--- 287,293 ----
  NsDomElement *
  NsDomElement::getElemParent()
  {
! 	if (isRoot() || isDocumentNode())
  		return 0;
  	NsDomElement *ret = new NsDomElement(getParentNode(), doc_);
  	if (!ret)
diff -c dbxml-2.4.13.orig/dbxml/src/dbxml/nodeStore/NsDom.hpp dbxml-2.4.13/dbxml/src/dbxml/nodeStore/NsDom.hpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/nodeStore/NsDom.hpp
--- dbxml-2.4.13/dbxml/src/dbxml/nodeStore/NsDom.hpp
***************
*** 155,167 ****
  		return node_->numAttrs();
  	}
  		
- 	
  	// TBD GMF Hack to indicate that a constructed element
  	// is the "root" of its tree -- i.e. don't navigate to
  	// the parent (document) node.  A better solution is to
  	// allow trees without a document node in node storage
! 	void setIsRoot() { isRoot_ = true; }
! 	bool isRoot() const { return isRoot_; }
  
  	//
  	// Navigational methods that operate on element nodes
--- 155,166 ----
  		return node_->numAttrs();
  	}
  		
  	// TBD GMF Hack to indicate that a constructed element
  	// is the "root" of its tree -- i.e. don't navigate to
  	// the parent (document) node.  A better solution is to
  	// allow trees without a document node in node storage
! 	void setIsRoot();
! 	bool isRoot() const;
  
  	//
  	// Navigational methods that operate on element nodes
***************
*** 190,196 ****
  	mutable NsString baseUri_;
  	mutable NsString uri_;
  	mutable NsString prefix_;
- 	bool isRoot_;
  };
  
  //
--- 189,194 ----
diff -c dbxml-2.4.13.orig/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp dbxml-2.4.13/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp
--- dbxml-2.4.13/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp
***************
*** 576,582 ****
  void NsEventWriter::writeStartElementInternal(const unsigned char *localName,
  					      const unsigned char *prefix,
  					      const unsigned char *uri,
! 					      NsFullNid *nid)
  {
  	DBXML_ASSERT(!writer_);
  	DBXML_ASSERT(!_ewriter);
--- 576,582 ----
  void NsEventWriter::writeStartElementInternal(const unsigned char *localName,
  					      const unsigned char *prefix,
  					      const unsigned char *uri,
! 					      NsFullNid *nid, bool setIsRoot)
  {
  	DBXML_ASSERT(!writer_);
  	DBXML_ASSERT(!_ewriter);
***************
*** 589,594 ****
--- 589,596 ----
  		node->acquire();
  		if (nid)
  			nid->copyNid(node->getFullNid());
+ 		if (setIsRoot)
+ 			node->setIsRoot();
  		startElem(node, localName, (const char *)uri,
  			  (const char *)prefix, false);
  		isEmpty_ = false; // don't know if empty or not
diff -c dbxml-2.4.13.orig/dbxml/src/dbxml/nodeStore/NsEventWriter.hpp dbxml-2.4.13/dbxml/src/dbxml/nodeStore/NsEventWriter.hpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/nodeStore/NsEventWriter.hpp
--- dbxml-2.4.13/dbxml/src/dbxml/nodeStore/NsEventWriter.hpp
***************
*** 130,136 ****
  	void writeStartElementInternal(const unsigned char *localName,
  				       const unsigned char *prefix,
  				       const unsigned char *uri,
! 				       NsFullNid *nid);
  	void writeEndElementInternal();
  	void writeAttributeInternal(const unsigned char *localName,
  				    const unsigned char *prefix,
--- 130,136 ----
  	void writeStartElementInternal(const unsigned char *localName,
  				       const unsigned char *prefix,
  				       const unsigned char *uri,
! 				       NsFullNid *nid, bool setIsRoot);
  	void writeEndElementInternal();
  	void writeAttributeInternal(const unsigned char *localName,
  				    const unsigned char *prefix,
diff -c dbxml-2.4.13.orig/dbxml/src/dbxml/nodeStore/NsNode.hpp dbxml-2.4.13/dbxml/src/dbxml/nodeStore/NsNode.hpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/nodeStore/NsNode.hpp
--- dbxml-2.4.13/dbxml/src/dbxml/nodeStore/NsNode.hpp
***************
*** 279,285 ****
  	NS_HASTEXTCHILD =  0x00000008, /**< has a text child attached */
  	NS_HASNEXT =       0x00000010, /**< has next sibling */
  	NS_HASPREV =       0x00000020, /**< has prev sibling */
! 	NS_NOT_USED_1 =    0x00000040, /**< NOT USED */
  	NS_LAST_IS_LAST_DESC = 0x00000080, /**< last child is a leaf */
  	NS_NAMEPREFIX =    0x00000100, /**< name has a prefix */
  	NS_HASURI =        0x00000200, /**< has a namespace URI */
--- 279,286 ----
  	NS_HASTEXTCHILD =  0x00000008, /**< has a text child attached */
  	NS_HASNEXT =       0x00000010, /**< has next sibling */
  	NS_HASPREV =       0x00000020, /**< has prev sibling */
! 	NS_ISROOT =        0x00000040, /**< only set for constructed XML where node is the
! 					  root element */
  	NS_LAST_IS_LAST_DESC = 0x00000080, /**< last child is a leaf */
  	NS_NAMEPREFIX =    0x00000100, /**< name has a prefix */
  	NS_HASURI =        0x00000200, /**< has a namespace URI */
***************
*** 373,378 ****
--- 374,382 ----
  	bool isDoc() const {
  		return ((nd_header.nh_flags & NS_ISDOCUMENT) != 0);
  	}
+ 	bool isRoot() const {
+ 		return ((nd_header.nh_flags & NS_ISROOT) != 0);
+ 	}
  	bool hasChildElem() const {
  		return ((nd_header.nh_flags & NS_HASCHILD) != 0);
  	}
***************
*** 653,658 ****
--- 657,666 ----
  	void setIsDocument() {
  		setFlag(NS_ISDOCUMENT);
  	}
+ 
+ 	void setIsRoot() {
+ 		setFlag(NS_ISROOT);
+ 	}
  	
  	void setHasChildElem() {
  		setFlag(NS_HASCHILD);
diff -c dbxml-2.4.13.orig/dbxml/src/dbxml/Modify.hpp dbxml-2.4.13/dbxml/src/dbxml/Modify.hpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/Modify.hpp
--- dbxml-2.4.13/dbxml/src/dbxml/Modify.hpp
***************
*** 19,24 ****
--- 19,25 ----
  #include "ReferenceCounted.hpp"
  #include "nodeStore/NsDom.hpp"
  #include "UTF8.hpp"
+ #include "QueryExpression.hpp"
  
  #include <xercesc/parsers/XercesDOMParser.hpp>
  
diff -c dbxml-2.4.13.orig/dbxml/src/dbxml/RawNodeValue.cpp dbxml-2.4.13/dbxml/src/dbxml/RawNodeValue.cpp
*** dbxml-2.4.13.orig/dbxml/src/dbxml/RawNodeValue.cpp
--- dbxml-2.4.13/dbxml/src/dbxml/RawNodeValue.cpp
***************
*** 520,528 ****
  		doc->setID(did_);
  		doc->setContainerID(cid_);
  		doc->setTransaction(GET_RESULTS().getOperationContext().txn());
! 		if(cid_ == 0)
  			doc->setDbMinder(GET_RESULTS().getDbMinder());
! 		else
  			doc->setAsNotMaterialized();
  	}
  	return xdoc_;
--- 520,533 ----
  		doc->setID(did_);
  		doc->setContainerID(cid_);
  		doc->setTransaction(GET_RESULTS().getOperationContext().txn());
! 		if (cid_ == 0) {
  			doc->setDbMinder(GET_RESULTS().getDbMinder());
! 			//Set query constructed documents as DOM
! 			if(!doc->getDbMinder().isNull()) { 
! 				doc->getDocDb();
! 				doc->setContentAsNsDom(did_, doc->getCacheDatabase());
! 			}
! 		} else
  			doc->setAsNotMaterialized();
  	}
  	return xdoc_;
diff -c dbxml-2.4.13.orig/dbxml/src/java/dbxml_java_wrap.cpp dbxml-2.4.13/dbxml/src/java/dbxml_java_wrap.cpp
*** dbxml-2.4.13.orig/dbxml/src/java/dbxml_java_wrap.cpp
--- dbxml-2.4.13/dbxml/src/java/dbxml_java_wrap.cpp
***************
*** 464,470 ****
  	#include "../dbxml/RawNodeValue.hpp"
  	#include "../dbxml/Results.hpp"
  	#include "../dbxml/Document.hpp"
! 	#include "../dbxml/ScopedDbt.hpp"
  
  	using namespace DbXml;
      typedef struct
--- 464,471 ----
  	#include "../dbxml/RawNodeValue.hpp"
  	#include "../dbxml/Results.hpp"
  	#include "../dbxml/Document.hpp"
!         #include "../dbxml/ScopedDbt.hpp"
! 	#include "../dbxml/Modify.hpp"
  
  	using namespace DbXml;
      typedef struct
***************
*** 1309,1316 ****
  			    break;
  		    }
  		    default:
! 			    if(docid != 0)
! 				    (*cdoc).setAsNotMaterialized();
  		    }
  		    
  		    createCPPMetaData(jenv, jdoc, cdoc);
--- 1310,1324 ----
  			    break;
  		    }
  		    default:
! 			    if (docid != 0 && cid != 0)
!                                     (*cdoc).setAsNotMaterialized();
! 			    else if (!(*cdoc).getDbMinder().isNull() &&
! 				     cid == 0) {
! 				    //set query constructed documents as DOM
! 				    (*cdoc).getDocDb();
! 				    (*cdoc).setContentAsNsDom(
! 					    docid, (*cdoc).getCacheDatabase());
! 			    }
  		    }
  		    
  		    createCPPMetaData(jenv, jdoc, cdoc);
diff -ru dbxml-2.4.13-orig/dbxml/src/dbxml/optimizer/QueryPlanGenerator.cpp dbxml-2.4.13/dbxml/src/dbxml/optimizer/QueryPlanGenerator.cpp
--- dbxml-2.4.13-orig/dbxml/src/dbxml/optimizer/QueryPlanGenerator.cpp	2008-04-25 15:46:28.000000000 +0100
+++ dbxml-2.4.13/dbxml/src/dbxml/optimizer/QueryPlanGenerator.cpp	2008-05-16 17:10:50.000000000 +0100
@@ -1321,7 +1321,7 @@
 		}
 	}

-	return ast;
+	return optimize(ast);
 }

 QueryPlanGenerator::ReverseResult QueryPlanGenerator::reverseNav(XQNav::Steps::iterator i, XQNav::Steps::iterator end, const ReverseResult &context, const QName &contextName)
@@ -1450,7 +1450,7 @@

 QueryPlanGenerator::ReverseResult QueryPlanGenerator::reverseVariable(XQVariable *item, const ReverseResult &context, const QName &contextName)
 {
-	if(!XPath2Utils::equals(item->getName(), contextName.name) ||
+	if(context.ast != 0 || !XPath2Utils::equals(item->getName(), contextName.name) ||
 		!XPath2Utils::equals(item->getURI(), contextName.uri))
 		return ReverseResult(reverseJoin(context, item, item), contextName);

diff -ru dbxml-2.4.13-orig/dbxml/src/dbxml/query/DecisionPointQP.cpp dbxml-2.4.13/dbxml/src/dbxml/query/DecisionPointQP.cpp
--- dbxml-2.4.13-orig/dbxml/src/dbxml/query/DecisionPointQP.cpp	2008-01-09 14:49:45.000000000 +0000
+++ dbxml-2.4.13/dbxml/src/dbxml/query/DecisionPointQP.cpp	2008-05-16 17:10:50.000000000 +0100
@@ -19,6 +19,7 @@
 #include "../optimizer/QueryPlanOptimizer.hpp"

 #include <xqilla/context/DynamicContext.hpp>
+#include <xqilla/framework/XPath2MemoryManagerImpl.hpp>

 #include <sstream>

@@ -151,8 +152,10 @@

 	// Save the compile time mutex, in case we need to just-in-time
 	// optimise at runtime
-	compileTimeMinder_ = GET_CONFIGURATION(opt.getContext())->getMinder();
-	compileTimeContext_ = opt.getContext();
+	if(compileTimeMinder_ == 0) {
+		compileTimeMinder_ = GET_CONFIGURATION(opt.getContext())->getMinder();
+		compileTimeContext_ = opt.getContext();
+	}

 	bool unknownContainers = true;
 	if(!qpListDone_ && opt.getPhase() == OptimizationContext::RESOLVE_INDEXES) {
@@ -246,21 +249,43 @@
 	combinations.push_back(result);
 }

+class AutoMemoryManagerReset
+{
+public:
+  AutoMemoryManagerReset(StaticContext* context, XPath2MemoryManager *mm)
+  {
+    context_ = context;
+    mm_ = context->getMemoryManager();
+    context->setMemoryManager(mm);
+  }
+
+  ~AutoMemoryManagerReset()
+  {
+    context_->setMemoryManager(mm_);
+  }
+
+protected:
+  StaticContext* context_;
+  XPath2MemoryManager *mm_;
+};
+
 DecisionPointQP::ListItem *DecisionPointQP::justInTimeOptimize(int contID, DynamicContext *context)
 {
 	// **** IMPORTANT - This algorithm is very carefully arranged to avoid
 	// **** deadlocks and race-conditions. Don't rearrange things unless you
 	// **** know what you are doing!

-	// Get the runtime memory manager and configuration
-	XPath2MemoryManager *mm = context->getMemoryManager();
+	// Get the runtime configuration
 	DbXmlConfiguration *conf = GET_CONFIGURATION(context);

 	// Lookup the container
 	ScopedContainer scont((Manager&)conf->getManager(), contID, /*mustExist*/true);

-	// Just-in-time optimise the QueryPlan, using the runtime memory manager for thread safety
-	QueryPlan *qp = arg_->copy(mm);
+	// Just-in-time optimise the QueryPlan, using a temporary memory manager for thread safety
+	XPath2MemoryManagerImpl tmpMM;
+	AutoMemoryManagerReset resetMM(context, &tmpMM);
+
+	QueryPlan *qp = arg_->copy(&tmpMM);
 	try {
 		AutoDecisionPointReset reset(conf, this);
 		justInTimeOptimize(qp, scont.get(), context);


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/dbxml/devel/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- .cvsignore	6 Jan 2008 18:04:56 -0000	1.2
+++ .cvsignore	31 Aug 2008 10:03:56 -0000	1.3
@@ -1 +1 @@
-dbxml-2.3.10-fedora.tar.gz
+dbxml-2.4.13-fedora.tar.gz

dbxml-standalone-build.patch:

Index: dbxml-standalone-build.patch
===================================================================
RCS file: /cvs/pkgs/rpms/dbxml/devel/dbxml-standalone-build.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- dbxml-standalone-build.patch	20 Feb 2008 22:18:16 -0000	1.3
+++ dbxml-standalone-build.patch	31 Aug 2008 10:03:57 -0000	1.4
@@ -1,6 +1,6 @@
---- dist/aclocal/options.ac	2006-06-13 21:32:29.000000000 +0200
-+++ dist/aclocal/options.ac	2007-11-12 20:55:02.000000000 +0100
-@@ -55,23 +55,24 @@
+--- ./dist/aclocal/options.ac	2008-08-31 09:36:47.000000000 +0200
++++ ./dist/aclocal/options.ac	2008-08-31 09:37:54.000000000 +0200
+@@ -55,23 +55,24 @@ AC_MSG_RESULT($db_cv_test)
  AC_MSG_CHECKING([if --with-berkeleydb=DIR option specified])
  AC_ARG_WITH(berkeleydb,
  	[AC_HELP_STRING([--with-berkeleydb=DIR],
@@ -21,8 +21,7 @@
 +	AC_MSG_CHECKING([for Berkeley DB version from installed library])
 +	db_version=`ls "$libdir"/libdb_cxx-?.?.so | sed 's/.*db_cxx-\(.*\).so/\1/'`
  	AC_MSG_RESULT([$db_version])
--	if test "$db_version" != "4.3" && test "$db_version" != "4.4" && test "$db_version" != "4.5"; then
-+	if test "$db_version" != "4.3" && test "$db_version" != "4.4" && test "$db_version" != "4.5" && test "$db_version" != "4.6"; then
+ 	if test "$db_version" != "4.3" && test "$db_version" != "4.4" && test "$db_version" != "4.5" && test "$db_version" != "4.6" && test "$db_version" != "4.7"; then
  		AC_MSG_ERROR([$with_berkeleydb is version $db_version, which is not a supported version of Berkeley DB. The version must be at least 4.3])
  	fi
  	echo "$CPPFLAGS" | grep "$with_berkeleydb/include" >/dev/null 2>&1 || CPPFLAGS="$CPPFLAGS -I$with_berkeleydb/include"
@@ -32,36 +31,33 @@
  
  	# find test lib locations, if specified, and possible
  	# it could be safer to require that --with-berkeleydb point to a build
-@@ -100,7 +100,7 @@
+@@ -100,7 +101,7 @@ if test `ls "$with_berkeleydb"/lib/libdb
  	    fi
  	fi
  
 -	ADDITIONAL_CLASSPATH="$ADDITIONAL_CLASSPATH:$with_berkeleydb/lib/db.jar"
 +	ADDITIONAL_CLASSPATH="$ADDITIONAL_CLASSPATH:/usr/share/java/db.jar"
+ 
+ 
  elif test `ls "$with_berkeleydb"/build_unix/libdb_cxx-*.la 2>/dev/null | wc -l` -gt 0 ; then
- 	AC_MSG_CHECKING([for Berkeley DB version from build tree])
- 	db_version=`ls "$with_berkeleydb"/build_unix/libdb_cxx-*.la | sed 's/.*db_cxx-\(.*\).la/\1/'`
-@@ -146,10 +146,11 @@
- 	with_xqilla="@XQILLA_HOME@"
+@@ -179,9 +180,10 @@ if test "$with_xqilla" = "no"; then
  fi
  with_xqilla=`cd $with_xqilla && pwd`
--# Try as an install directory
+ # Try as an install directory
 -if test `ls "$with_xqilla"/lib/libxqilla*.la 2>/dev/null | wc -l` -gt 0 ; then
--	echo "$CPPFLAGS" | grep "$with_xqilla/include" >/dev/null 2>&1 || CPPFLAGS="$CPPFLAGS -I$with_xqilla/include"
++if test `ls "$libdir"/libxqilla.so 2>/dev/null | wc -l` -gt 0 ; then
+ 	echo "$CPPFLAGS" | grep "$with_xqilla/include" >/dev/null 2>&1 || CPPFLAGS="$CPPFLAGS -I$with_xqilla/include"
 -	LIBS="$LIBS -L$with_xqilla/lib -lxqilla"
-+# Try from installed library
-+if test `ls "$libdir"/libxqilla10.so.1.0.? 2>/dev/null | wc -l` -gt 0 ; then
-+	echo "$CPPFLAGS" | grep "$with_xqilla/include" >/dev/null 2>&1 || CPPFLAGS="$CPPFLAGS -I$with_xqilla/include/xqilla10"
-+	LIBS="$LIBS -L$libdir -lxqilla10"
-+	LIBXSO_LIBS="$LIBXSO_LIBS -L$libdir -lxqilla10"
++	LIBS="$LIBS -L$libdir -lxqilla"
++	LIBXSO_LIBS="$LIBXSO_LIBS -L$libdir -lxqilla"
  # Try as a source directory, built in the top level directory
  elif test `ls "$with_xqilla"/libxqilla*.la 2>/dev/null | wc -l` -gt 0 ; then
    # If we have been given a build directory inside the XQilla top
-@@ -177,12 +177,13 @@
+@@ -209,12 +211,13 @@ if test "$with_xerces" = "no"; then
  fi
  
- # specifically test for 2.6 or 2.7.  This needs to change as releases change
--if test `ls $with_xerces/lib/libxerces-c.*2[[6-7]].* 2>/dev/null | wc -l` -gt 0 ; then
+ # specifically test for 2.6 - 2.8.  This needs to change as releases change
+-if test `ls $with_xerces/lib/libxerces-c.*2[[6-8]].* 2>/dev/null | wc -l` -gt 0 ; then
 -	AC_MSG_CHECKING([for Xerces C++ version from install tree])
 -	xerces_version=`ls "$with_xerces"/lib/libxerces-c.*[[0-9]][[0-9]].* | tail -1 | sed 's/.*xerces-c.*\([[0-9]]\)\([[0-9]]\).*/\1.\2/'`
 +if test `ls $libdir/libxerces-c.*2[[6-8]].* 2>/dev/null | wc -l` -gt 0 ; then
@@ -73,11 +69,20 @@
 +	LIBS="$LIBS -L$libdir -lxerces-c"
 +	LIBXSO_LIBS="$LIBXSO_LIBS -L$libdir -lxerces-c"
  	AC_MSG_RESULT([$xerces_version])
- elif test `ls $with_xerces/lib/libxerces-c*2[[6-7]].* 2>/dev/null | wc -l` -gt 0 ; then
+ elif test `ls $with_xerces/lib/libxerces-c*2[[6-8]].* 2>/dev/null | wc -l` -gt 0 ; then
  	AC_MSG_CHECKING([for Xerces C++ version from install tree])
---- dist/Makefile.in	2007-01-19 16:52:44.000000000 +0100
-+++ dist/Makefile.in	2007-11-12 20:54:36.000000000 +0100
-@@ -327,8 +327,8 @@
+--- ./dist/configure.ac	2008-08-31 09:37:03.000000000 +0200
++++ ./dist/configure.ac	2008-08-31 09:37:54.000000000 +0200
+@@ -397,5 +397,5 @@ LTLIBOBJS=`echo "$LIB@&t at OBJS" |
+ AC_SUBST(LTLIBOBJS)
+ 
+ # Initial output file list.
+-AC_CONFIG_FILES(Makefile.defs:Makefile.defs.in Makefile:Makefile.in Makefile.rules:Makefile.rules.in include.tcl:$srcdir/../test/tcl/include.tcl $srcdir/../src/python/setup.py:$srcdir/../src/python/setup.py.in $srcdir/../src/perl/config:$srcdir/../src/perl/config.in)
++AC_CONFIG_FILES(Makefile.defs:Makefile.defs.in Makefile:Makefile.in Makefile.rules:Makefile.rules.in include.tcl:$srcdir/../test/tcl/include.tcl $srcdir/../src/python/setup.py:$srcdir/../src/python/setup.py.in)
+ AC_OUTPUT
+--- ./dist/Makefile.in	2008-08-31 09:37:22.000000000 +0200
++++ ./dist/Makefile.in	2008-08-31 09:37:54.000000000 +0200
+@@ -373,8 +373,8 @@ library_install: install_include install
  uninstall: uninstall_include uninstall_lib uninstall_utilities uninstall_docs
  
  install_setup:
@@ -88,7 +93,7 @@
  
  INCLUDE_NAMES= DbXml.hpp DbXmlFwd.hpp XmlQueryExpression.hpp XmlContainer.hpp \
  	XmlDocument.hpp XmlException.hpp XmlIndexSpecification.hpp \
-@@ -342,22 +342,22 @@
+@@ -388,21 +388,21 @@ INCLUDE_NAMES= DbXml.hpp DbXmlFwd.hpp Xm
  INCLUDE_FILES= $(patsubst %,$(srcdir)/include/dbxml/,$(INCLUDE_NAMES))
  
  install_include:
@@ -113,17 +118,15 @@
 -	    ($(mkdir) -p $(libdir) && $(chmod) $(dmode) $(libdir))
 -	@cd $(libdir) && $(rm) -f $(LIB_INSTALL_FILE_LIST)
 -	@$(INSTALLER) $(libxso_target) $(install_tcl) $(install_java) $(libdir)
--	@(cd $(libdir) && \
 +	@echo "Installing DB XML library: $(DESTDIR)$(libdir) ..."
 +	@test -d $(DESTDIR)$(libdir) || \
 +	    ($(mkdir) -p $(DESTDIR)$(libdir) && $(chmod) $(dmode) $(DESTDIR)$(libdir))
 +	@cd $(DESTDIR)$(libdir) && $(rm) -f $(LIB_INSTALL_FILE_LIST)
 +	@$(INSTALLER) $(libxso_target) $(install_tcl) $(install_java) $(DESTDIR)$(libdir)
-+	@(cd $(DESTDIR)$(libdir) && \
+ 	@(cd $(libdir) && \
  	    test -f $(libxso) && $(ln) -s $(libxso) $(libxso_default); \
  	    test -f $(libxso) && $(ln) -s $(libxso) $(libxso_major); \
- 	    test -f $(libxso_static) && $(ln) -s $(libxso_static) $(libcxx); \
-@@ -368,26 +368,26 @@
+@@ -414,26 +414,26 @@ install_lib:
  	    test -f $(libjso) && $(ln) -s $(libjso) $(libjso_g); \
  	    $(LIBJSO_LN_INSTALL)) || true
  	@(test -f $(libj_jarfile) && \
@@ -161,7 +164,7 @@
  		$(rm) -f $$i $$i.exe; \
  	done)
  
-@@ -395,14 +395,14 @@
+@@ -441,11 +441,11 @@ DOCLIST=\
  	api_c api_cxx api_tcl collections gsg gsg_db_rep gsg_txn gsg_xml_txn \
  	gsg_xml images index.html license java ref ref_xml intro_xml utility
  install_docs:
@@ -177,16 +180,72 @@
 +	@cd $(srcdir)/docs && $(cp) -pr $(DOCLIST) $(DESTDIR)$(docdir)/
  
  uninstall_docs:
--	@cd $(docdir) && $(rm) -rf $(DOCLIST)
-+	@cd $(DESTDIR)$(docdir) && $(rm) -rf $(DOCLIST)
- 
- ##################################################
- # Remaining standard Makefile targets.
---- dist/RELEASE	2007-01-30 16:34:38.000000000 +0100
-+++ dist/RELEASE	2008-02-20 23:13:50.000000000 +0100
-@@ -13,4 +13,4 @@ DBXML_VERSION_STRING="Oracle: Berkeley D
- #  DbXmlFwd.hpp, XmlValue.hpp, XmlDocument.hpp, src/dbxml/nodeStore/NsTypes.hpp
- # the last three must be modified by hand.
- XERCES_VERSION_MAJOR=2
--XERCES_VERSION_MINOR=7
-+XERCES_VERSION_MINOR=8
+ 	@cd $(docdir) && $(rm) -rf $(DOCLIST)
+--- ./src/python/setup.py.template	2008-03-21 22:56:01.000000000 +0100
++++ ./src/python/setup.py.template	2008-08-31 09:49:25.000000000 +0200
+@@ -16,24 +16,22 @@ from distutils.core import setup, Extens
+ # Windows: may require further editing to reflect site specifics.
+ #
+ if os.name == "posix":
+-  db_home = "@DB_DIR@"
+-  xerces_home = "@XERCES_DIR@"
+   xqilla_home = "@XQILLA_DIR@"
+   LFLAGS = os.environ.get('LFLAGS', [])
+ else:
+-  xerces_home = "../@XERCES_WINHOME@"
+   xqilla_home = "../@XQILLA_HOME@"
+-  db_home = "../@DB_HOME@"
+ 
+ bsddb_home = ""
++libdir = ""
++includedir = ""
+ 
+ for arg in sys.argv:
+-  if arg.startswith('--with-berkeleydb='):
+-    db_home = arg.split('=')[1]
+-  elif arg.startswith('--with-xerces='):
+-    xerces_home = arg.split('=')[1]
+-  elif arg.startswith('--with-xqilla='):
++  if arg.startswith('--with-xqilla='):
+     xqillahome = arg.split('=')[1]
++  elif arg.startswith('--with-libdir='):
++    libdir = arg.split('=')[1]
++  elif arg.startswith('--with-includedir='):
++    includedir = arg.split('=')[1]
+   elif arg.startswith('--lflags='):
+     LFLAGS = arg.split('=')[1].split()
+     sys.argv.remove(arg)
+@@ -60,17 +58,17 @@ else:
+   DEFINES = []
+ 
+ if os.name == "posix":
++  if includedir:
++    INCLUDES.append(includedir)
+   INCLUDES.append("../../include")
+-  INCLUDES.append(os.path.join(db_home, "include"))
++  INCLUDES.append(os.path.join(xqilla_home, "include"))
+ 
+-  LIBDIRS =     ["../../build_unix/.libs",
+-                 os.path.join(db_home, "lib"),
+-                 os.path.join(xqilla_home, "lib"),
+-                 os.path.join(xerces_home, "lib")]
++  LIBDIRS =     ["../../build_unix/.libs"]
++  if libdir:
++    LIBDIRS.append(libdir)
+ 
+-  LIBS =        ["dbxml- at DBXML_VERSION_MAJOR@",
+-                 "db_cxx- at DB_VERSION_MAJOR@",
+-                 "xqilla", "xerces-c"]
++  LIBS =        ["dbxml- at DBXML_VERSION_MAJOR@. at DBXML_VERSION_MINOR@",
++		  "db_cxx", "xqilla", "xerces-c"]
+ 
+   DATAFILES =   []
+ 
+@@ -93,7 +91,6 @@ if os.name == "posix":
+               ext_modules = [Extension("_dbxml", ["dbxml_python_wrap.cpp"],
+                                        include_dirs = INCLUDES,
+                                        library_dirs = LIBDIRS,
+-                                       runtime_library_dirs = LIBDIRS,
+                                        define_macros = DEFINES,
+                                        libraries = LIBS,
+                                        extra_link_args = lflags_arg


Index: dbxml.spec
===================================================================
RCS file: /cvs/pkgs/rpms/dbxml/devel/dbxml.spec,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- dbxml.spec	20 Feb 2008 21:07:42 -0000	1.4
+++ dbxml.spec	31 Aug 2008 10:03:57 -0000	1.5
@@ -1,41 +1,33 @@
 %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
-%{!?python_version: %define python_version %(%{__python} -c "from distutils.sysconfig import get_python_version; print get_python_version()")}
 
 Name: dbxml
 Summary: An embeddable XML database with XQuery-based access to documents
 Group: System Environment/Libraries
-Version: 2.3.10
-Release: 12%{?dist}
+Version: 2.4.13
+Release: 2.1%{?dist}
 License: BSD
 URL: http://www.oracle.com/technology/software/products/berkeley-db/xml/index.html
 # Source tarball from Oracle containing sources of db4, xercesc, xqilla
 # and dbxml library itself
-# Source0: http://download.oracle.com/berkeley-db/dbxml-2.3.10.tar.gz
+# Source0: http://download.oracle.com/berkeley-db/dbxml-2.4.13.tar.gz
 #
-# New tarball with db4, xercesc, xqilla and perl sources removed
-Source0: dbxml-2.3.10-fedora.tar.gz
-Patch0: dbxml-standalone-build.patch
-Patch1: dbxml-python-build.patch
-Patch2: dbxml-python25-types.patch
-Patch3: dbxml-os-clock.patch
-Patch4: dbxml-xmlindexlookup.patch
-Patch5: dbxml-query-performance.patch
-Patch6: dbxml-index-utilisation.patch
-Patch7: dbxml-predicates.patch
-Patch8: dbxml-xmlmodify.patch
-Patch9: dbxml-statistics.patch
-Patch10: dbxml-invalid-schema.patch
-Patch11: dbxml-g++-4.3.patch
+# New tarball with db4, xercesc, xqilla and dbxml-perl sources removed
+Source0: dbxml-2.4.13-fedora.tar.gz
+# Fedora specific patches
+Patch1: dbxml-standalone-build.patch
+# Patches provided by Oracle
+Patch100: patch.2.4.13.1
+Patch101: patch.2.4.13.2
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-build
 
 BuildRequires: automake autoconf libtool
 BuildRequires: python-devel
 BuildRequires: db4-devel >= 4.3.28
-BuildRequires: xerces-c-devel >= 2.7.0
-BuildRequires: xqilla10-devel >= 1.0.2
+BuildRequires: xerces-c-devel >= 2.8.0
+BuildRequires: xqilla-devel >= 2.1.3
 
-Requires: db4 >= 4.3.28 xerces-c >= 2.7.0 xqilla10 >= 1.0.2
+Requires: db4 >= 4.3.28 xerces-c >= 2.8.0 xqilla >= 2.1.3
 
 %define install_prefix %{buildroot}%{_usr}
 %define install_libdir %{buildroot}%{_libdir}
@@ -127,42 +119,22 @@
 retrieval of data.
 
 %prep
-libdb4_version() {
-`ls "%{_libdir}"/libdb_cxx-?.?.so | sed 's/.*db_cxx-\(.*\).so/\1/'`
-}
-%setup -q -n dbxml-2.3.10
-%patch0
+%setup -q -n dbxml-%{version}
 %patch1
-%if "%{python_version}" > "2.4"
-%patch2
-%endif 
-%if "libdb4_version" > "4.5"
-%patch3
-%endif
-%patch4
-%patch5
-%patch6
-%patch7
-%patch8
-%patch9
-%patch10
-%patch11
+%patch100 -p2
+%patch101 -p2
 
 %build
-export CPPFLAGS="-I%{_includedir}/xqilla10"
+export CPPFLAGS="-I%{_includedir}/xqilla"
 export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
 export CXXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
 
-pushd src/python
-sed -i "s!\"../../build_unix/.libs\"!\"../../build_unix/.libs\",\"%{_libdir}\"!" setup.py.template
-sed -i "s!\"../../include\"!\"../../include\",\"%{_includedir}\"!" setup.py.template
-popd
 pushd dist
 chmod a+x s_paths
 sh s_readme
 sh s_config
 sh s_include
-sh s_perm
+#sh s_perm
 sh s_python
 popd
 pushd build_unix
@@ -196,7 +168,7 @@
 
 # dbxml-python
 pushd src/python
-%{__python} setup.py build
+%{__python} setup.py --with-libdir=%{_libdir} --with-includedir=%{_includedir} build
 popd
 
 %install
@@ -207,7 +179,7 @@
 fix_encoding() {
 for file in "$@"; do
 	if grep -q 'encoding="' $file; then
-		enc=$(grep 'encoding="' $file | sed 's/.\+encoding="\(.\+\)"\ .\+/\1/')
+		enc=$(grep -m 1 'encoding="' $file | sed 's/.\+encoding="\(.\+\)"\ .\+/\1/')
 		if  [ "$enc" != "UTF-8" ]; then
 			iconv -f $enc -t "UTF-8" $file > tmp
 			sed -i s/"$enc"/"UTF-8"/ tmp
@@ -230,7 +202,7 @@
 	%{install_docdir}/dbxml-devel-%{version}/examples
 find %{install_docdir}/dbxml-devel-%{version} -name "*.cmd" -exec chmod 0644 {} ';'
 find %{install_docdir}/dbxml-devel-%{version} -name "*.sh" -exec chmod 0644 {} ';'
-fix_encoding `find %{install_docdir}/dbxml-doc-%{version} -name "*.html"`
+fix_encoding $(find %{install_docdir}/dbxml-doc-%{version} -name "*.html")
 
 # dbxml-python
 pushd src/python
@@ -263,8 +235,6 @@
 
 %files devel
 %defattr(-,root,root,-)
-%attr(0755,root,root) %{_libdir}/libdbxml-?.so
-%attr(0755,root,root) %{_libdir}/libdbxml.so
 %{_includedir}/dbxml/
 %{_defaultdocdir}/dbxml-devel-%{version}
 
@@ -279,6 +249,9 @@
 %{_defaultdocdir}/dbxml-python-%{version}
 
 %changelog
+* Sun Aug 31 2008 Milan Zazrivec <mzazrivec at redhat.com> - 2.4.13-2.1
+- Rebased to latest upstream version 2.4.13
+
 * Wed Feb 20 2008 Milan Zazrivec <mzazrivec at redhat.com> - 2.3.10-12
 - Fixed malformed g++ 4.3 build patch
 


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/dbxml/devel/sources,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sources	6 Jan 2008 18:04:56 -0000	1.2
+++ sources	31 Aug 2008 10:03:57 -0000	1.3
@@ -1 +1 @@
-e88a39cc543d291b54b31cefa74b3967  dbxml-2.3.10-fedora.tar.gz
+124bace7891311ffd15e83b4db849179  dbxml-2.4.13-fedora.tar.gz


--- dbxml-g++-4.3.patch DELETED ---


--- dbxml-index-utilisation.patch DELETED ---


--- dbxml-invalid-schema.patch DELETED ---


--- dbxml-os-clock.patch DELETED ---


--- dbxml-predicates.patch DELETED ---


--- dbxml-python-build.patch DELETED ---


--- dbxml-python25-types.patch DELETED ---


--- dbxml-query-performance.patch DELETED ---


--- dbxml-statistics.patch DELETED ---


--- dbxml-xmlindexlookup.patch DELETED ---


--- dbxml-xmlmodify.patch DELETED ---




More information about the fedora-extras-commits mailing list