diff --git a/mozilla/db/mdb/public/mdb.h b/mozilla/db/mdb/public/mdb.h index 8c7321a4380..8e01d44df26 100644 --- a/mozilla/db/mdb/public/mdb.h +++ b/mozilla/db/mdb/public/mdb.h @@ -2194,9 +2194,9 @@ public: // { ===== begin nsIMdbRow methods ===== // { ----- begin cursor methods ----- - NS_IMETHOD GetRowCellCursor( // make a cursor starting iteration at inRowPos + NS_IMETHOD GetRowCellCursor( // make a cursor starting iteration at inCellPos nsIMdbEnv* ev, // context - mdb_pos inRowPos, // zero-based ordinal position of row in table + mdb_pos inCellPos, // zero-based ordinal position of cell in row nsIMdbRowCellCursor** acqCursor) = 0; // acquire new cursor instance // } ----- end cursor methods ----- @@ -2337,7 +2337,7 @@ public: // { ----- begin cell iteration methods ----- NS_IMETHOD NextCell( // get next cell in the row nsIMdbEnv* ev, // context - nsIMdbCell* ioCell, // changes to the next cell in the iteration + nsIMdbCell** acqCell, // changes to the next cell in the iteration mdb_column* outColumn, // column for this particular cell mdb_pos* outPos) = 0; // position of cell in row sequence diff --git a/mozilla/db/mork/build/nsMorkFactory.cpp b/mozilla/db/mork/build/nsMorkFactory.cpp index 6a3cccfb090..404bd2c4d6f 100644 --- a/mozilla/db/mork/build/nsMorkFactory.cpp +++ b/mozilla/db/mork/build/nsMorkFactory.cpp @@ -48,11 +48,11 @@ class nsMorkFactoryFactory : public nsIMdbFactoryFactory { public: - nsMorkFactoryFactory(); - // nsISupports methods - NS_DECL_ISUPPORTS + nsMorkFactoryFactory(); + // nsISupports methods + NS_DECL_ISUPPORTS - NS_IMETHOD GetMdbFactory(nsIMdbFactory **aFactory); + NS_IMETHOD GetMdbFactory(nsIMdbFactory **aFactory); }; @@ -80,32 +80,32 @@ NS_IMPL_RELEASE(nsMorkFactoryFactory) NS_IMETHODIMP nsMorkFactoryFactory::QueryInterface(REFNSIID iid, void** result) { - if (! result) - return NS_ERROR_NULL_POINTER; - - *result = nsnull; - if(iid.Equals(NS_GET_IID(nsIMdbFactoryFactory)) || - iid.Equals(NS_GET_IID(nsISupports))) { - *result = NS_STATIC_CAST(nsIMdbFactoryFactory*, this); - AddRef(); - return NS_OK; - } - return NS_NOINTERFACE; + if (! result) + return NS_ERROR_NULL_POINTER; + + *result = nsnull; + if(iid.Equals(NS_GET_IID(nsIMdbFactoryFactory)) || + iid.Equals(NS_GET_IID(nsISupports))) { + *result = NS_STATIC_CAST(nsIMdbFactoryFactory*, this); + AddRef(); + return NS_OK; + } + return NS_NOINTERFACE; } nsMorkFactoryFactory::nsMorkFactoryFactory() { - NS_INIT_REFCNT(); + NS_INIT_REFCNT(); } NS_IMETHODIMP nsMorkFactoryFactory::GetMdbFactory(nsIMdbFactory **aFactory) { - if (!gMDBFactory) - gMDBFactory = MakeMdbFactory(); - *aFactory = gMDBFactory; - NS_IF_ADDREF(gMDBFactory); - return (gMDBFactory) ? NS_OK : NS_ERROR_OUT_OF_MEMORY; + if (!gMDBFactory) + gMDBFactory = MakeMdbFactory(); + *aFactory = gMDBFactory; + NS_IF_ADDREF(gMDBFactory); + return (gMDBFactory) ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } diff --git a/mozilla/db/mork/src/morkRowCellCursor.cpp b/mozilla/db/mork/src/morkRowCellCursor.cpp index 1ccf7294fdf..12b26df835d 100644 --- a/mozilla/db/mork/src/morkRowCellCursor.cpp +++ b/mozilla/db/mork/src/morkRowCellCursor.cpp @@ -95,6 +95,7 @@ morkRowCellCursor::CloseMorkNode(morkEnv* ev) // CloseRowCellCursor() only if op /*public virtual*/ morkRowCellCursor::~morkRowCellCursor() // CloseRowCellCursor() executed earlier { + CloseMorkNode(mMorkEnv); MORK_ASSERT(this->IsShutNode()); } @@ -278,12 +279,37 @@ morkRowCellCursor::SeekCell( // same as SetRow() followed by MakeCell() NS_IMETHODIMP morkRowCellCursor::NextCell( // get next cell in the row nsIMdbEnv* mev, // context - nsIMdbCell* ioCell, // changes to the next cell in the iteration + nsIMdbCell** acqCell, // changes to the next cell in the iteration mdb_column* outColumn, // column for this particular cell mdb_pos* outPos) { - NS_ASSERTION(PR_FALSE, "not implemented"); - return NS_ERROR_NOT_IMPLEMENTED; + morkEnv* ev = morkEnv::FromMdbEnv(mev); + mdb_column col = 0; + mdb_pos pos = mRowCellCursor_Col; + if ( pos < 0 ) + pos = 0; + else + ++pos; + + morkCell* cell = mRowCellCursor_RowObject->mRowObject_Row->CellAt(ev, pos); + if ( cell ) + { + col = cell->GetColumn(); + *acqCell = mRowCellCursor_RowObject->mRowObject_Row->AcquireCellHandle(ev, cell, col, pos); + } + else + { + *acqCell = nsnull; + pos = -1; + } + if ( outPos ) + *outPos = pos; + if ( outColumn ) + *outColumn = col; + + mRowCellCursor_Col = pos; + *outPos = pos; + return NS_OK; } NS_IMETHODIMP diff --git a/mozilla/db/mork/src/morkRowCellCursor.h b/mozilla/db/mork/src/morkRowCellCursor.h index fe93001c860..d5e3caf3c14 100644 --- a/mozilla/db/mork/src/morkRowCellCursor.h +++ b/mozilla/db/mork/src/morkRowCellCursor.h @@ -112,7 +112,7 @@ public: // morkRowCellCursor construction & destruction // { ----- begin cell iteration methods ----- NS_IMETHOD NextCell( // get next cell in the row nsIMdbEnv* ev, // context - nsIMdbCell* ioCell, // changes to the next cell in the iteration + nsIMdbCell** acqCell, // changes to the next cell in the iteration mdb_column* outColumn, // column for this particular cell mdb_pos* outPos); // position of cell in row sequence diff --git a/mozilla/db/mork/src/morkRowObject.cpp b/mozilla/db/mork/src/morkRowObject.cpp index aa543b8fa94..f081b782f6a 100644 --- a/mozilla/db/mork/src/morkRowObject.cpp +++ b/mozilla/db/mork/src/morkRowObject.cpp @@ -229,9 +229,9 @@ morkRowObject::DropActivity( // tell collection usage no longer expected // { ----- begin cursor methods ----- NS_IMETHODIMP -morkRowObject::GetRowCellCursor( // make a cursor starting iteration at inRowPos +morkRowObject::GetRowCellCursor( // make a cursor starting iteration at inCellPos nsIMdbEnv* mev, // context - mdb_pos inPos, // zero-based ordinal position of row in table + mdb_pos inPos, // zero-based ordinal position of cell in row nsIMdbRowCellCursor** acqCursor) { mdb_err outErr = 0;