36 #include <nsStringGlue.h>
45 static PRLogModuleInfo* gDatabaseResultLog = nsnull;
46 #define LOG(args) PR_LOG(gDatabaseResultLog, PR_LOG_DEBUG, args)
54 if(NS_UNLIKELY(aLock)) {
62 if(NS_UNLIKELY(aLock)) {
77 : m_RequiresLocking(aRequiresLocking)
81 if(!gDatabaseResultLog)
82 gDatabaseResultLog = PR_NewLogModule(
"sbDatabaseResult");
85 if(NS_UNLIKELY(m_RequiresLocking))
87 m_pLock = PR_NewLock();
88 NS_ASSERTION(m_pLock,
"CDatabaseResult.m_pColumnNamesLock failed");
101 NS_IMETHODIMP CDatabaseResult::GetColumnCount(PRUint32 *_retval)
103 NS_ENSURE_ARG_POINTER(_retval);
117 NS_IMETHODIMP CDatabaseResult::GetColumnName(PRUint32 dbColumn, nsAString &_retval)
135 NS_IMETHODIMP CDatabaseResult::GetColumnIndex(
const nsAString &aColumnName, PRUint32 *_retval)
137 NS_ENSURE_ARG_POINTER(_retval);
145 NS_IMETHODIMP CDatabaseResult::GetRowCount(PRUint32 *_retval)
147 NS_ENSURE_ARG_POINTER(_retval);
162 NS_IMETHODIMP CDatabaseResult::GetRowCell(PRUint32 dbRow, PRUint32 dbCell, nsAString &_retval)
180 NS_IMETHODIMP CDatabaseResult::GetRowCellByColumn(PRUint32 dbRow,
const nsAString &dbColumn, nsAString &_retval)
183 return GetRowCell(dbRow, dbCell, _retval);
188 NS_IMETHODIMP CDatabaseResult::GetColumnNamePtr(PRUint32 dbColumn, PRUnichar **_retval)
193 *_retval =
const_cast<PRUnichar *
>(
m_ColumnNames[dbColumn].BeginReading());
201 *_retval =
const_cast<PRUnichar *
>(
m_ColumnNames[dbColumn].BeginReading());
212 NS_IMETHODIMP CDatabaseResult::GetRowCellPtr(PRUint32 dbRow, PRUint32 dbCell, PRUnichar **_retval)
217 *_retval =
const_cast<PRUnichar *
>(
m_RowCells[dbRow][dbCell].BeginReading());
225 *_retval =
const_cast<PRUnichar *
>(
m_RowCells[dbRow][dbCell].BeginReading());
236 NS_IMETHODIMP CDatabaseResult::GetRowCellByColumnPtr(PRUint32 dbRow,
const nsAString &dbColumn, PRUnichar **_retval)
239 return GetRowCellPtr(dbRow, dbCell, _retval);
243 NS_IMETHODIMP CDatabaseResult::ClearResultSet()
284 dbrowcells_t::iterator itRows =
m_RowCells.begin();
293 dbrowcells_t::iterator itRows =
m_RowCells.begin();
367 PRUint32 retval = (PRUint32)-1;
372 dbcolumnresolvemap_t::const_iterator itColumnIndex =
376 retval = itColumnIndex->second;
381 dbcolumnresolvemap_t::const_iterator itColumnIndex =
385 retval = itColumnIndex->second;
402 for(PRUint32
i = 0;
i < nSize;
i++) {
414 for(PRUint32
i = 0;
i < nSize;
i++) {
dbcolumnresolvemap_t m_ColumnResolveMap
nsresult SetColumnName(PRUint32 dbColumn, const nsString &strColumnName)
nsresult SetColumnNames(const std::vector< nsString > &vColumnNames)
Songbird Database Object Definition.
virtual ~CDatabaseResult()
nsresult SetRowCell(PRUint32 dbRow, PRUint32 dbCell, const nsString &strCellValue)
void RebuildColumnResolveMap()
NS_IMPL_THREADSAFE_ISUPPORTS1(sbDeviceCapsCompatibility, sbIDeviceCapsCompatibility) sbDeviceCapsCompatibility
nsresult DeleteRow(PRUint32 dbRow)
nsresult SetRowCells(PRUint32 dbRow, const std::vector< nsString > &vCellValues)
NS_DECL_ISUPPORTS NS_DECL_SBIDATABASERESULT nsresult AddRow(const std::vector< nsString > &vCellValues)
An object containing the results of a database SELECT query.
PRPackedBool m_RequiresLocking
static void IfLock(PRLock *aLock)
static void IfUnlock(PRLock *aLock)
_getSelectedPageStyle s i
dbcolumnnames_t m_ColumnNames
PRUint32 GetColumnIndexFromName(const nsAString &strColumnName)