зеркало из https://github.com/mozilla/pjs.git
switch to new mdb interface naming conventions
This commit is contained in:
Родитель
8f129330d2
Коммит
5d61d42934
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -142,8 +142,8 @@ protected:
|
|||
// the db folder info will have to know what db and row it belongs to, since it is really
|
||||
// just a wrapper around the singleton folder info row in the mdb.
|
||||
nsMsgDatabase *m_mdb;
|
||||
mdbTable *m_mdbTable; // singleton table in db
|
||||
mdbRow *m_mdbRow; // singleton row in table;
|
||||
nsIMdbTable *m_mdbTable; // singleton table in db
|
||||
nsIMdbRow *m_mdbRow; // singleton row in table;
|
||||
|
||||
PRBool m_mdbTokensInitialized;
|
||||
|
||||
|
|
|
@ -196,16 +196,16 @@ public:
|
|||
// but also useful to tell the summary to mark itself invalid
|
||||
virtual nsresult SetSummaryValid(PRBool valid = TRUE);
|
||||
|
||||
static mdbFactory *GetMDBFactory();
|
||||
static nsIMdbFactory *GetMDBFactory();
|
||||
nsDBFolderInfo *GetDBFolderInfo() {return m_dbFolderInfo;}
|
||||
mdbEnv *GetEnv() {return m_mdbEnv;}
|
||||
mdbStore *GetStore() {return m_mdbStore;}
|
||||
nsIMdbEnv *GetEnv() {return m_mdbEnv;}
|
||||
nsIMdbStore *GetStore() {return m_mdbStore;}
|
||||
|
||||
static nsMsgDatabase* FindInCache(nsFilePath &dbName);
|
||||
|
||||
//helper function to fill in nsStrings from hdr row cell contents.
|
||||
nsresult RowCellColumnTonsString(mdbRow *row, mdb_token columnToken, nsString &resultStr);
|
||||
nsresult RowCellColumnToUInt32(mdbRow *row, mdb_token columnToken, PRUint32 *uint32Result);
|
||||
nsresult RowCellColumnTonsString(nsIMdbRow *row, mdb_token columnToken, nsString &resultStr);
|
||||
nsresult RowCellColumnToUInt32(nsIMdbRow *row, mdb_token columnToken, PRUint32 *uint32Result);
|
||||
|
||||
// helper functions to copy an nsString to a yarn, int32 to yarn, and vice versa.
|
||||
static struct mdbYarn *nsStringToYarn(struct mdbYarn *yarn, nsString *str);
|
||||
|
@ -220,9 +220,9 @@ public:
|
|||
#endif
|
||||
protected:
|
||||
nsDBFolderInfo *m_dbFolderInfo;
|
||||
mdbEnv *m_mdbEnv; // to be used in all the db calls.
|
||||
mdbStore *m_mdbStore;
|
||||
mdbTable *m_mdbAllMsgHeadersTable;
|
||||
nsIMdbEnv *m_mdbEnv; // to be used in all the db calls.
|
||||
nsIMdbStore *m_mdbStore;
|
||||
nsIMdbTable *m_mdbAllMsgHeadersTable;
|
||||
nsFilePath m_dbName;
|
||||
|
||||
nsNewsSet *m_newSet; // new messages since last open.
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsMsgHdr methods:
|
||||
nsMsgHdr(nsMsgDatabase *db, mdbRow *dbRow);
|
||||
nsMsgHdr(nsMsgDatabase *db, nsIMdbRow *dbRow);
|
||||
void Init();
|
||||
|
||||
virtual ~nsMsgHdr();
|
||||
|
@ -84,7 +84,7 @@ public:
|
|||
|
||||
void SetCSID(PRUint16 csid) {m_csID = csid;}
|
||||
PRInt16 GetCSID();
|
||||
mdbRow *GetMDBRow() {return m_mdbRow;}
|
||||
nsIMdbRow *GetMDBRow() {return m_mdbRow;}
|
||||
protected:
|
||||
nsresult SetStringColumn(const char *str, mdb_token token);
|
||||
nsresult SetUInt32Column(PRUint32 value, mdb_token token);
|
||||
|
@ -104,7 +104,7 @@ protected:
|
|||
// just a wrapper around the msg row in the mdb. This could cause problems,
|
||||
// though I hope not.
|
||||
nsMsgDatabase *m_mdb;
|
||||
mdbRow *m_mdbRow;
|
||||
nsIMdbRow *m_mdbRow;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,71 +1,77 @@
|
|||
#include "mdb.h"
|
||||
#include "stdio.h"
|
||||
|
||||
nsIMdbFactory *NS_NewIMdbFactory()
|
||||
{
|
||||
return new nsIMdbFactory;
|
||||
}
|
||||
|
||||
mdb_err
|
||||
mdbFactory::ThumbToOpenStore( // redeem completed thumb from OpenFileStore()
|
||||
mdbEnv* ev, // context
|
||||
mdbThumb* ioThumb, // thumb from OpenFileStore() with done status
|
||||
mdbStore** acqStore) // acquire new db store object
|
||||
nsIMdbFactory::ThumbToOpenStore( // redeem completed thumb from OpenFileStore()
|
||||
nsIMdbEnv* ev, // context
|
||||
nsIMdbThumb* ioThumb, // thumb from OpenFileStore() with done status
|
||||
nsIMdbStore** acqStore) // acquire new db store object
|
||||
{
|
||||
*acqStore = new mdbStore;
|
||||
*acqStore = new nsIMdbStore;
|
||||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbFactory::CreateNewFileStore( // create a new db with minimal content
|
||||
mdbEnv* ev, // context
|
||||
mdb_err nsIMdbFactory::CreateNewFileStore( // create a new db with minimal content
|
||||
nsIMdbEnv* ev, // context
|
||||
nsIMdbHeap* ioHeap, // can be nil to cause ev's heap attribute to be used
|
||||
const char* inFilePath, // name of file which should not yet exist
|
||||
const mdbOpenPolicy* inOpenPolicy, // runtime policies for using db
|
||||
mdbStore** acqStore)
|
||||
nsIMdbStore** acqStore)
|
||||
{
|
||||
printf("new file store for %s\n", inFilePath);
|
||||
*acqStore = new mdbStore;
|
||||
*acqStore = new nsIMdbStore;
|
||||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbStore::SmallCommit( // save minor changes if convenient and uncostly
|
||||
mdbEnv* ev)
|
||||
mdb_err nsIMdbStore::SmallCommit( // save minor changes if convenient and uncostly
|
||||
nsIMdbEnv* ev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
mdb_err mdbStore::LargeCommit( // save important changes if at all possible
|
||||
mdbEnv* ev, // context
|
||||
mdbThumb** acqThumb)
|
||||
mdb_err nsIMdbStore::LargeCommit( // save important changes if at all possible
|
||||
nsIMdbEnv* ev, // context
|
||||
nsIMdbThumb** acqThumb)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbStore::SessionCommit( // save all changes if large commits delayed
|
||||
mdbEnv* ev, // context
|
||||
mdbThumb** acqThumb)
|
||||
mdb_err nsIMdbStore::SessionCommit( // save all changes if large commits delayed
|
||||
nsIMdbEnv* ev, // context
|
||||
nsIMdbThumb** acqThumb)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
mdb_err
|
||||
mdbStore::CompressCommit( // commit and make db physically smaller if possible
|
||||
mdbEnv* ev, // context
|
||||
mdbThumb** acqThumb)
|
||||
nsIMdbStore::CompressCommit( // commit and make db physically smaller if possible
|
||||
nsIMdbEnv* ev, // context
|
||||
nsIMdbThumb** acqThumb)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbStore::NewTable( // make one new table of specific type
|
||||
mdbEnv* ev, // context
|
||||
mdb_err nsIMdbStore::NewTable( // make one new table of specific type
|
||||
nsIMdbEnv* ev, // context
|
||||
mdb_scope inRowScope, // row scope for row ids
|
||||
mdb_kind inTableKind, // the type of table to access
|
||||
mdb_bool inMustBeUnique, // whether store can hold only one of these
|
||||
mdbTable** acqTable) ; // acquire scoped collection of rows
|
||||
nsIMdbTable** acqTable) ; // acquire scoped collection of rows
|
||||
|
||||
mdb_err mdbPort::GetTable( // access one table with specific oid
|
||||
mdbEnv* ev, // context
|
||||
mdb_err nsIMdbPort::GetTable( // access one table with specific oid
|
||||
nsIMdbEnv* ev, // context
|
||||
const mdbOid* inOid, // hypothetical table oid
|
||||
mdbTable** acqTable)
|
||||
nsIMdbTable** acqTable)
|
||||
{
|
||||
*acqTable = new mdbTable;
|
||||
*acqTable = new nsIMdbTable;
|
||||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbPort::StringToToken ( mdbEnv* ev, // context
|
||||
mdb_err nsIMdbPort::StringToToken ( nsIMdbEnv* ev, // context
|
||||
const char* inTokenName, // Latin1 string to tokenize if possible
|
||||
mdb_token* outToken)
|
||||
{
|
||||
|
@ -73,21 +79,21 @@ mdb_err mdbPort::StringToToken ( mdbEnv* ev, // context
|
|||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbPort::GetTableKind (
|
||||
mdbEnv* ev, // context
|
||||
mdb_err nsIMdbPort::GetTableKind (
|
||||
nsIMdbEnv* ev, // context
|
||||
mdb_scope inRowScope, // row scope for row ids
|
||||
mdb_kind inTableKind, // the type of table to access
|
||||
mdb_count* outTableCount, // current number of such tables
|
||||
mdb_bool* outMustBeUnique, // whether port can hold only one of these
|
||||
mdbTable** acqTable)
|
||||
nsIMdbTable** acqTable)
|
||||
{
|
||||
*acqTable = new mdbTable;
|
||||
*acqTable = new nsIMdbTable;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
mdb_err mdbTable::HasOid( // test for the table position of a row member
|
||||
mdbEnv* ev, // context
|
||||
mdb_err nsIMdbTable::HasOid( // test for the table position of a row member
|
||||
nsIMdbEnv* ev, // context
|
||||
const mdbOid* inOid, // row to find in table
|
||||
mdb_pos* outPos)
|
||||
{
|
||||
|
@ -96,7 +102,7 @@ mdb_err mdbTable::HasOid( // test for the table position of a row member
|
|||
|
||||
for (iteratePos = 0; iteratePos < m_rows.Count(); iteratePos++)
|
||||
{
|
||||
mdbRow *row = (mdbRow *) m_rows.ElementAt(iteratePos);
|
||||
nsIMdbRow *row = (nsIMdbRow *) m_rows.ElementAt(iteratePos);
|
||||
if (row && row->m_oid.mOid_Id == inOid->mOid_Id)
|
||||
{
|
||||
*outPos = iteratePos;
|
||||
|
@ -106,57 +112,57 @@ mdb_err mdbTable::HasOid( // test for the table position of a row member
|
|||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbTable::GetTableRowCursor( // make a cursor, starting iteration at inRowPos
|
||||
mdbEnv* ev, // context
|
||||
mdb_err nsIMdbTable::GetTableRowCursor( // make a cursor, starting iteration at inRowPos
|
||||
nsIMdbEnv* ev, // context
|
||||
mdb_pos inRowPos, // zero-based ordinal position of row in table
|
||||
mdbTableRowCursor** acqCursor)
|
||||
nsIMdbTableRowCursor** acqCursor)
|
||||
{
|
||||
*acqCursor = new mdbTableRowCursor;
|
||||
*acqCursor = new nsIMdbTableRowCursor;
|
||||
(*acqCursor)->SetTable(ev, this);
|
||||
(*acqCursor)->m_pos = inRowPos;
|
||||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbTableRowCursor::SetTable(mdbEnv* ev, mdbTable* ioTable)
|
||||
mdb_err nsIMdbTableRowCursor::SetTable(nsIMdbEnv* ev, nsIMdbTable* ioTable)
|
||||
{
|
||||
m_table = ioTable;
|
||||
m_pos = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbTableRowCursor::NextRow( // get row cells from table for cells already in row
|
||||
mdbEnv* ev, // context
|
||||
mdbRow** acqRow, // acquire next row in table
|
||||
mdb_err nsIMdbTableRowCursor::NextRow( // get row cells from table for cells already in row
|
||||
nsIMdbEnv* ev, // context
|
||||
nsIMdbRow** acqRow, // acquire next row in table
|
||||
mdb_pos* outRowPos)
|
||||
{
|
||||
if (m_pos < 0)
|
||||
m_pos = 0;
|
||||
|
||||
*outRowPos = m_pos;
|
||||
*acqRow = (mdbRow *) m_table->m_rows.ElementAt(m_pos++);
|
||||
*acqRow = (nsIMdbRow *) m_table->m_rows.ElementAt(m_pos++);
|
||||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbTable::CutRow ( // make sure the row with inOid is not a member
|
||||
mdbEnv* ev, // context
|
||||
mdbRow* ioRow)
|
||||
mdb_err nsIMdbTable::CutRow ( // make sure the row with inOid is not a member
|
||||
nsIMdbEnv* ev, // context
|
||||
nsIMdbRow* ioRow)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbStore::NewRowWithOid (mdbEnv* ev, // new row w/ caller assigned oid
|
||||
mdb_err nsIMdbStore::NewRowWithOid (nsIMdbEnv* ev, // new row w/ caller assigned oid
|
||||
mdb_scope inRowScope, // row scope for row ids
|
||||
const mdbOid* inOid, // caller assigned oid
|
||||
mdbRow** acqRow)
|
||||
nsIMdbRow** acqRow)
|
||||
{
|
||||
*acqRow = new mdbRow;
|
||||
*acqRow = new nsIMdbRow;
|
||||
(*acqRow)->m_oid = *inOid;
|
||||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbTable::AddRow ( // make sure the row with inOid is a table member
|
||||
mdbEnv* ev, // context
|
||||
mdbRow* ioRow)
|
||||
mdb_err nsIMdbTable::AddRow ( // make sure the row with inOid is a table member
|
||||
nsIMdbEnv* ev, // context
|
||||
nsIMdbRow* ioRow)
|
||||
{
|
||||
m_rows.AppendElement(ioRow);
|
||||
return 0;
|
||||
|
@ -164,15 +170,15 @@ mdb_err mdbTable::AddRow ( // make sure the row with inOid is a table member
|
|||
|
||||
|
||||
|
||||
mdb_err mdbRow::AddColumn( // make sure a particular column is inside row
|
||||
mdbEnv* ev, // context
|
||||
mdb_err nsIMdbRow::AddColumn( // make sure a particular column is inside row
|
||||
nsIMdbEnv* ev, // context
|
||||
mdb_column inColumn, // column to add
|
||||
const mdbYarn* inYarn)
|
||||
{
|
||||
// evilly, I happen to know the column token is a char * const str pointer.
|
||||
printf("adding column %s : %s\n", inColumn, inYarn->mYarn_Buf);
|
||||
mdbCellImpl newCell;
|
||||
mdbCell *existingCell = NULL;
|
||||
nsIMdbCell *existingCell = NULL;
|
||||
|
||||
newCell.m_column = inColumn;
|
||||
GetCell(ev, inColumn, &existingCell);
|
||||
|
@ -193,10 +199,10 @@ mdb_err mdbRow::AddColumn( // make sure a particular column is inside row
|
|||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbRow::GetCell( // find a cell in this row
|
||||
mdbEnv* ev, // context
|
||||
mdb_err nsIMdbRow::GetCell( // find a cell in this row
|
||||
nsIMdbEnv* ev, // context
|
||||
mdb_column inColumn, // column to find
|
||||
mdbCell** acqCell)
|
||||
nsIMdbCell** acqCell)
|
||||
{
|
||||
mdbCellImpl newCell;
|
||||
|
||||
|
@ -209,23 +215,23 @@ mdb_err mdbRow::GetCell( // find a cell in this row
|
|||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbCollection::GetOid (mdbEnv* ev,
|
||||
mdb_err nsIMdbCollection::GetOid (nsIMdbEnv* ev,
|
||||
const mdbOid* outOid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbTableRowCursor::NextRowOid ( // get row id of next row in the table
|
||||
mdbEnv* ev, // context
|
||||
mdb_err nsIMdbTableRowCursor::NextRowOid ( // get row id of next row in the table
|
||||
nsIMdbEnv* ev, // context
|
||||
mdbOid* outOid, // out row oid
|
||||
mdb_pos* outRowPos)
|
||||
{
|
||||
mdbRow *curRow;
|
||||
nsIMdbRow *curRow;
|
||||
if (m_pos < 0)
|
||||
m_pos = 0;
|
||||
|
||||
*outRowPos = m_pos;
|
||||
curRow = (mdbRow *) m_table->m_rows.ElementAt(m_pos++);
|
||||
curRow = (nsIMdbRow *) m_table->m_rows.ElementAt(m_pos++);
|
||||
if (curRow)
|
||||
*outOid = curRow->m_oid;
|
||||
else
|
||||
|
@ -233,23 +239,23 @@ mdb_err mdbTableRowCursor::NextRowOid ( // get row id of next row in the table
|
|||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbBlob::AliasYarn(mdbEnv* ev,
|
||||
mdb_err nsIMdbBlob::AliasYarn(nsIMdbEnv* ev,
|
||||
mdbYarn* outYarn)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbObject::CutStrongRef(mdbEnv* ev)
|
||||
mdb_err nsIMdbObject::CutStrongRef(nsIMdbEnv* ev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbFactory::MakeEnv(mdbEnv** acqEnv)
|
||||
mdb_err nsIMdbFactory::MakeEnv(nsIMdbHeap* ioHeap, nsIMdbEnv** acqEnv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbThumb::DoMore(mdbEnv* ev,
|
||||
mdb_err nsIMdbThumb::DoMore(nsIMdbEnv* ev,
|
||||
mdb_count* outTotal, // total somethings to do in operation
|
||||
mdb_count* outCurrent, // subportion of total completed so far
|
||||
mdb_bool* outDone, // is operation finished?
|
||||
|
@ -260,16 +266,16 @@ mdb_err mdbThumb::DoMore(mdbEnv* ev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbFactory::OpenFileStore(class mdbEnv *,char const *fileName,struct mdbOpenPolicy const *,class mdbThumb **retThumb)
|
||||
mdb_err nsIMdbFactory::OpenFileStore(class nsIMdbEnv *, nsIMdbHeap* , char const *fileName,struct mdbOpenPolicy const *,class nsIMdbThumb **retThumb)
|
||||
{
|
||||
|
||||
*retThumb = new mdbThumb;
|
||||
*retThumb = new nsIMdbThumb;
|
||||
return 0;
|
||||
}
|
||||
|
||||
mdb_err mdbStore::NewTable(class mdbEnv *,unsigned long,unsigned long,unsigned char,class mdbTable **retTable)
|
||||
mdb_err nsIMdbStore::NewTable(class nsIMdbEnv *,unsigned long,unsigned long,unsigned char,class nsIMdbTable **retTable)
|
||||
{
|
||||
*retTable = new mdbTable;
|
||||
*retTable = new nsIMdbTable;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -296,7 +302,7 @@ PRBool mdbCellImpl::Equals(const mdbCellImpl& other)
|
|||
}
|
||||
|
||||
|
||||
mdb_err mdbCellImpl::AliasYarn(mdbEnv* ev,
|
||||
mdb_err mdbCellImpl::AliasYarn(nsIMdbEnv* ev,
|
||||
mdbYarn* outYarn)
|
||||
{
|
||||
outYarn->mYarn_Buf = m_cellValue;
|
||||
|
|
|
@ -116,7 +116,7 @@ nsresult nsDBFolderInfo::AddToNewMDB()
|
|||
nsresult ret = NS_OK;
|
||||
if (m_mdb && m_mdb->GetStore())
|
||||
{
|
||||
mdbStore *store = m_mdb->GetStore();
|
||||
nsIMdbStore *store = m_mdb->GetStore();
|
||||
// create the unique table for the dbFolderInfo.
|
||||
mdb_err err = store->NewTable(m_mdb->GetEnv(), m_rowScopeToken,
|
||||
m_tableKindToken, PR_TRUE, &m_mdbTable);
|
||||
|
@ -141,7 +141,7 @@ nsresult nsDBFolderInfo::InitFromExistingDB()
|
|||
nsresult ret = NS_OK;
|
||||
if (m_mdb && m_mdb->GetStore())
|
||||
{
|
||||
mdbStore *store = m_mdb->GetStore();
|
||||
nsIMdbStore *store = m_mdb->GetStore();
|
||||
if (store)
|
||||
{
|
||||
mdb_count outTableCount; // current number of such tables
|
||||
|
@ -159,8 +159,8 @@ nsresult nsDBFolderInfo::InitMDBInfo()
|
|||
nsresult ret = NS_OK;
|
||||
if (!m_mdbTokensInitialized && m_mdb && m_mdb->GetStore())
|
||||
{
|
||||
mdbStore *store = m_mdb->GetStore();
|
||||
mdbEnv *env = m_mdb->GetEnv();
|
||||
nsIMdbStore *store = m_mdb->GetStore();
|
||||
nsIMdbEnv *env = m_mdb->GetEnv();
|
||||
|
||||
store->StringToToken(env, kNumVisibleMessagesColumnName, &m_numVisibleMessagesColumnToken);
|
||||
store->StringToToken(env, kNumMessagesColumnName, &m_numMessagesColumnToken);
|
||||
|
|
|
@ -231,13 +231,15 @@ nsrefcnt nsMsgDatabase::Release(void)
|
|||
return mRefCnt;
|
||||
}
|
||||
|
||||
/* static */ mdbFactory *nsMsgDatabase::GetMDBFactory()
|
||||
extern nsIMdbFactory *NS_NewIMdbFactory();
|
||||
|
||||
/* static */ nsIMdbFactory *nsMsgDatabase::GetMDBFactory()
|
||||
{
|
||||
static mdbFactory *gMDBFactory = NULL;
|
||||
static nsIMdbFactory *gMDBFactory = NULL;
|
||||
if (!gMDBFactory)
|
||||
{
|
||||
// ### hook up class factory code when it's working
|
||||
gMDBFactory = new mdbFactory;
|
||||
gMDBFactory = NS_NewIMdbFactory(); //new nsIMdbFactory;
|
||||
}
|
||||
return gMDBFactory;
|
||||
}
|
||||
|
@ -248,20 +250,20 @@ nsrefcnt nsMsgDatabase::Release(void)
|
|||
nsresult nsMsgDatabase::OpenMDB(const char *dbName, PRBool create)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
mdbFactory *myMDBFactory = GetMDBFactory();
|
||||
nsIMdbFactory *myMDBFactory = GetMDBFactory();
|
||||
if (myMDBFactory)
|
||||
{
|
||||
ret = myMDBFactory->MakeEnv(&m_mdbEnv);
|
||||
ret = myMDBFactory->MakeEnv(NULL, &m_mdbEnv);
|
||||
if (NS_SUCCEEDED(ret))
|
||||
{
|
||||
mdbThumb *thumb;
|
||||
nsIMdbThumb *thumb;
|
||||
struct stat st;
|
||||
|
||||
m_dbName = dbName;
|
||||
if (stat(dbName, &st))
|
||||
ret = NS_MSG_ERROR_FOLDER_SUMMARY_MISSING;
|
||||
else
|
||||
ret = myMDBFactory->OpenFileStore(m_mdbEnv, dbName, NULL, /* const mdbOpenPolicy* inOpenPolicy */
|
||||
ret = myMDBFactory->OpenFileStore(m_mdbEnv, NULL, dbName, NULL, /* const mdbOpenPolicy* inOpenPolicy */
|
||||
&thumb);
|
||||
if (NS_SUCCEEDED(ret))
|
||||
{
|
||||
|
@ -283,7 +285,7 @@ nsresult nsMsgDatabase::OpenMDB(const char *dbName, PRBool create)
|
|||
}
|
||||
else if (create) // ### need error code saying why open file store failed
|
||||
{
|
||||
ret = myMDBFactory->CreateNewFileStore(m_mdbEnv, dbName, NULL, &m_mdbStore);
|
||||
ret = myMDBFactory->CreateNewFileStore(m_mdbEnv, NULL, dbName, NULL, &m_mdbStore);
|
||||
if (ret == NS_OK)
|
||||
ret = InitNewDB();
|
||||
}
|
||||
|
@ -338,7 +340,7 @@ nsresult nsMsgDatabase::ForceClosed()
|
|||
nsresult nsMsgDatabase::Commit(msgDBCommitType commitType)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
mdbThumb *commitThumb = NULL;
|
||||
nsIMdbThumb *commitThumb = NULL;
|
||||
|
||||
if (m_mdbStore)
|
||||
{
|
||||
|
@ -407,7 +409,7 @@ nsresult nsMsgDatabase::InitNewDB()
|
|||
if (dbFolderInfo)
|
||||
{
|
||||
err = dbFolderInfo->AddToNewMDB();
|
||||
mdbStore *store = GetStore();
|
||||
nsIMdbStore *store = GetStore();
|
||||
// create the unique table for the dbFolderInfo.
|
||||
mdb_err err = store->NewTable(GetEnv(), m_hdrRowScopeToken,
|
||||
m_hdrTableKindToken, PR_FALSE, &m_mdbAllMsgHeadersTable);
|
||||
|
@ -492,11 +494,11 @@ nsresult nsMsgDatabase::GetMsgHdrForKey(nsMsgKey key, nsMsgHdr **pmsgHdr)
|
|||
err = m_mdbAllMsgHeadersTable->HasOid(GetEnv(), &rowObjectId, &rowPos);
|
||||
if (err == NS_OK)
|
||||
{
|
||||
mdbTableRowCursor *rowCursor;
|
||||
nsIMdbTableRowCursor *rowCursor;
|
||||
err = m_mdbAllMsgHeadersTable->GetTableRowCursor(GetEnv(), rowPos, &rowCursor);
|
||||
if (err == NS_OK && rowPos >= 0) // ### is rowPos > 0 the right thing to check?
|
||||
{
|
||||
mdbRow *hdrRow;
|
||||
nsIMdbRow *hdrRow;
|
||||
err = rowCursor->NextRow(GetEnv(), &hdrRow, &rowPos);
|
||||
if (err == NS_OK)
|
||||
{
|
||||
|
@ -1038,7 +1040,7 @@ class ListContext
|
|||
public:
|
||||
ListContext();
|
||||
virtual ~ListContext();
|
||||
mdbTableRowCursor *m_rowCursor;
|
||||
nsIMdbTableRowCursor *m_rowCursor;
|
||||
};
|
||||
|
||||
ListContext::ListContext()
|
||||
|
@ -1081,7 +1083,7 @@ nsresult nsMsgDatabase::ListFirst(ListContext **ppContext, nsMsgHdr **pResultHdr
|
|||
nsresult nsMsgDatabase::ListNext(ListContext *pContext, nsMsgHdr **pResultHdr)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
mdbRow *hdrRow;
|
||||
nsIMdbRow *hdrRow;
|
||||
mdb_pos rowPos;
|
||||
|
||||
if (!pResultHdr || !pContext)
|
||||
|
@ -1105,7 +1107,7 @@ nsresult nsMsgDatabase::ListDone(ListContext *pContext)
|
|||
nsresult nsMsgDatabase::ListAllKeys(nsMsgKeyArray &outputKeys)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
mdbTableRowCursor *rowCursor;
|
||||
nsIMdbTableRowCursor *rowCursor;
|
||||
err = m_mdbAllMsgHeadersTable->GetTableRowCursor(GetEnv(), -1, &rowCursor);
|
||||
while (err == NS_OK)
|
||||
{
|
||||
|
@ -1160,7 +1162,7 @@ nsresult nsMsgDatabase::ListNextUnread(ListContext **pContext, nsMsgHdr **pResul
|
|||
nsresult nsMsgDatabase::CreateNewHdr(nsMsgKey key, nsMsgHdr **pnewHdr)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
mdbRow *hdrRow;
|
||||
nsIMdbRow *hdrRow;
|
||||
struct mdbOid allMsgHdrsTableOID;
|
||||
|
||||
if (!pnewHdr || !m_mdbAllMsgHeadersTable)
|
||||
|
@ -1183,7 +1185,7 @@ nsresult nsMsgDatabase::CreateNewHdr(nsMsgKey key, nsMsgHdr **pnewHdr)
|
|||
nsresult nsMsgDatabase::CreateNewHdr(PRBool *newThread, MessageHdrStruct *hdrStruct, nsMsgHdr **pnewHdr, PRBool notify /* = FALSE */)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
mdbRow *hdrRow;
|
||||
nsIMdbRow *hdrRow;
|
||||
struct mdbOid allMsgHdrsTableOID;
|
||||
|
||||
if (!pnewHdr || !m_mdbAllMsgHeadersTable)
|
||||
|
@ -1261,10 +1263,10 @@ nsresult nsMsgDatabase::GetMsgHdrStructFromnsMsgHdr(nsMsgHdr *msgHdr, MessageHdr
|
|||
return err;
|
||||
}
|
||||
|
||||
nsresult nsMsgDatabase::RowCellColumnTonsString(mdbRow *hdrRow, mdb_token columnToken, nsString &resultStr)
|
||||
nsresult nsMsgDatabase::RowCellColumnTonsString(nsIMdbRow *hdrRow, mdb_token columnToken, nsString &resultStr)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
mdbCell *hdrCell;
|
||||
nsIMdbCell *hdrCell;
|
||||
|
||||
err = hdrRow->GetCell(GetEnv(), columnToken, &hdrCell);
|
||||
if (err == NS_OK)
|
||||
|
@ -1276,10 +1278,10 @@ nsresult nsMsgDatabase::RowCellColumnTonsString(mdbRow *hdrRow, mdb_token column
|
|||
return err;
|
||||
}
|
||||
|
||||
nsresult nsMsgDatabase::RowCellColumnToUInt32(mdbRow *hdrRow, mdb_token columnToken, PRUint32 *uint32Result)
|
||||
nsresult nsMsgDatabase::RowCellColumnToUInt32(nsIMdbRow *hdrRow, mdb_token columnToken, PRUint32 *uint32Result)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
mdbCell *hdrCell;
|
||||
nsIMdbCell *hdrCell;
|
||||
|
||||
err = hdrRow->GetCell(GetEnv(), columnToken, &hdrCell);
|
||||
if (err == NS_OK)
|
||||
|
|
|
@ -44,7 +44,7 @@ nsMsgHdr::QueryInterface(REFNSIID iid, void** result)
|
|||
return nsRDFResource::QueryInterface(iid, result);
|
||||
}
|
||||
|
||||
nsMsgHdr::nsMsgHdr(nsMsgDatabase *db, mdbRow *dbRow)
|
||||
nsMsgHdr::nsMsgHdr(nsMsgDatabase *db, nsIMdbRow *dbRow)
|
||||
: nsRDFResource(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
|
Загрузка…
Ссылка в новой задаче