DatabaseQuery.cpp
Go to the documentation of this file.
1 /*
2 //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2008 POTI, Inc.
8 // http://songbirdnest.com
9 //
10 // This file may be licensed under the terms of of the
11 // GNU General Public License Version 2 (the "GPL").
12 //
13 // Software distributed under the License is distributed
14 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
15 // express or implied. See the GPL for the specific language
16 // governing rights and limitations.
17 //
18 // You should have received a copy of the GPL along with this
19 // program. If not, go to http://www.gnu.org/licenses/gpl.html
20 // or write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 // END SONGBIRD GPL
24 //
25 */
26 
32 // INCLUDES ===================================================================
33 #include "DatabaseQuery.h"
34 #include "DatabaseEngine.h"
36 
37 #include <prlog.h>
38 #include <prmem.h>
39 #include <nsMemory.h>
40 #include <nsXPCOM.h>
41 #include <nsServiceManagerUtils.h>
42 #include <nsStringGlue.h>
43 
44 #include <nsAutoLock.h>
45 #include <nsNetUtil.h>
46 
47 #include <nsIServiceManager.h>
48 #include <nsThreadUtils.h>
49 #include <nsSupportsArray.h>
50 #include <nsIClassInfoImpl.h>
51 #include <nsIProgrammingLanguage.h>
52 #include <nsIProxyObjectManager.h>
53 
55 #include <sbLockUtils.h>
56 
57 #ifdef DEBUG_locks
58 #include <nsPrintfCString.h>
59 #endif
60 
61 #define DATABASEQUERY_DEFAULT_CALLBACK_SLOTS (2)
62 
63 #ifdef PR_LOGGING
64 static PRLogModuleInfo* sDatabaseQueryLog = nsnull;
65 #define LOG(args) PR_LOG(sDatabaseQueryLog, PR_LOG_ALWAYS, args)
66 #else
67 #define LOG(args) /* nothing */
68 #endif
69 
70 
71 // CLASSES ====================================================================
72 //=============================================================================
73 // CDatabaseQuery Class
74 //=============================================================================
75 //-----------------------------------------------------------------------------
78 
79 NS_INTERFACE_MAP_BEGIN(CDatabaseQuery)
80  NS_IMPL_QUERY_CLASSINFO(CDatabaseQuery)
81  NS_INTERFACE_MAP_ENTRY(sbIDatabaseQuery)
82  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, sbIDatabaseQuery)
83 NS_INTERFACE_MAP_END
84 
87 
88 NS_DECL_CLASSINFO(CDatabaseQuery)
89 NS_IMPL_THREADSAFE_CI(CDatabaseQuery)
90 
91 //-----------------------------------------------------------------------------
92 CDatabaseQuery::CDatabaseQuery()
93 : m_pLock(PR_NewLock())
94 , m_IsAborting(PR_FALSE)
95 , m_IsExecuting(PR_FALSE)
96 , m_AsyncQuery(PR_FALSE)
97 , m_CurrentQuery((PRUint32)-1)
98 , m_LastError(0)
99 , m_pQueryRunningMonitor(nsAutoMonitor::NewMonitor("CDatabaseQuery.m_pdbQueryRunningMonitor"))
100 , m_QueryHasCompleted(PR_FALSE)
101 , m_RollingLimit(0)
102 , m_RollingLimitColumnIndex(0)
103 , m_RollingLimitResult(0)
104 {
105 #ifdef PR_LOGGING
106  if (!sDatabaseQueryLog)
107  sDatabaseQueryLog = PR_NewLogModule("sbDatabaseQuery");
108 #endif
109 
110  m_CallbackList.Init(DATABASEQUERY_DEFAULT_CALLBACK_SLOTS);
111 } //ctor
112 
113 //-----------------------------------------------------------------------------
115 {
116  if (m_pLock)
117  PR_DestroyLock(m_pLock);
119  nsAutoMonitor::DestroyMonitor(m_pQueryRunningMonitor);
120 
121  m_CallbackList.Clear();
122 } //dtor
123 
125 {
126  nsresult rv;
128  NS_ENSURE_SUCCESS(rv, rv);
129 
130  return NS_OK;
131 }
132 
133 //-----------------------------------------------------------------------------
134 /* attribute nsIURI databaseLocation; */
135 NS_IMETHODIMP CDatabaseQuery::GetDatabaseLocation(nsIURI * *aDatabaseLocation)
136 {
137  NS_ENSURE_ARG_POINTER(aDatabaseLocation);
138  if (!NS_IsMainThread()) {
139  NS_WARNING("CDatabaseQuery::GetDatabaseLocation is main thread only, "
140  "since it constructs an nsStandardURL object");
141  return NS_ERROR_FAILURE;
142  }
143 
144  nsresult rv = NS_OK;
145  *aDatabaseLocation = nsnull;
146 
148  if(!m_LocationURIString.IsEmpty())
149  {
150  rv = NS_NewURI(aDatabaseLocation, m_LocationURIString);
151  NS_ENSURE_SUCCESS(rv, rv);
152  }
153 
154  return NS_OK;
155 } //GetDatabaseLocation
156 
157 //-----------------------------------------------------------------------------
158 NS_IMETHODIMP CDatabaseQuery::SetDatabaseLocation(nsIURI * aDatabaseLocation)
159 {
160  NS_ENSURE_ARG_POINTER(aDatabaseLocation);
161  nsresult rv = NS_ERROR_UNEXPECTED;
162 
163  PRBool isFile = PR_FALSE;
164  if(NS_SUCCEEDED(aDatabaseLocation->SchemeIs("file", &isFile)) &&
165  isFile)
166  {
167  nsCString spec;
168  rv = aDatabaseLocation->GetSpec(spec);
169  NS_ENSURE_SUCCESS(rv, rv);
170 
172  m_LocationURIString = spec;
173  }
174  else
175  {
176  //We only support database files stored locally, for now.
177  rv = NS_ERROR_NOT_IMPLEMENTED;
178  }
179 
180  return rv;
181 } //SetDatabaseLocation
182 
183 //-----------------------------------------------------------------------------
184 nsresult CDatabaseQuery::GetDatabaseLocation(nsACString& aURISpec)
185 {
187  aURISpec.Assign(m_LocationURIString);
188  return NS_OK;
189 } //GetDatabaseLocation
190 
191 //-----------------------------------------------------------------------------
192 /* void SetAsyncQuery (in PRBool bAsyncQuery); */
193 NS_IMETHODIMP CDatabaseQuery::SetAsyncQuery(PRBool bAsyncQuery)
194 {
195  m_AsyncQuery = bAsyncQuery;
196  return NS_OK;
197 } //SetAsyncQuery
198 
199 //-----------------------------------------------------------------------------
200 /* PRBool IsAyncQuery (); */
201 NS_IMETHODIMP CDatabaseQuery::IsAyncQuery(PRBool *_retval)
202 {
203  NS_ENSURE_ARG_POINTER(_retval);
204  *_retval = m_AsyncQuery;
205  return NS_OK;
206 } //IsAyncQuery
207 
208 //-----------------------------------------------------------------------------
209 /* void AddSimpleQueryCallback (in sbIDatabaseSimpleQueryCallback dbPersistCB); */
210 NS_IMETHODIMP CDatabaseQuery::AddSimpleQueryCallback(sbIDatabaseSimpleQueryCallback *dbPersistCB)
211 {
212  NS_ENSURE_ARG_POINTER(dbPersistCB);
213  nsCOMPtr<sbIDatabaseSimpleQueryCallback> proxiedCallback;
214 
215  nsresult rv = do_GetProxyForObject(NS_PROXY_TO_CURRENT_THREAD,
216  NS_GET_IID(sbIDatabaseSimpleQueryCallback),
217  dbPersistCB,
218  NS_PROXY_ASYNC | NS_PROXY_ALWAYS,
219  getter_AddRefs(proxiedCallback));
220  NS_ENSURE_SUCCESS(rv, rv);
221 
222  m_CallbackList.Put(dbPersistCB, proxiedCallback);
223 
224  return NS_OK;
225 } //AddPersistentQueryCallback
226 
227 //-----------------------------------------------------------------------------
228 /* void RemoveSimpleQueryCallback (in sbIDatabasePersistentQueryCallback dbPersistCB); */
229 NS_IMETHODIMP CDatabaseQuery::RemoveSimpleQueryCallback(sbIDatabaseSimpleQueryCallback *dbPersistCB)
230 {
231  NS_ENSURE_ARG_POINTER(dbPersistCB);
232 
233  m_CallbackList.Remove(dbPersistCB);
234 
235  return NS_OK;
236 } //RemoveSimpleQueryCallback
237 
238 //-----------------------------------------------------------------------------
239 /* void SetDatabaseGUID (in wstring dbGUID); */
240 NS_IMETHODIMP CDatabaseQuery::SetDatabaseGUID(const nsAString &dbGUID)
241 {
243  m_DatabaseGUID = dbGUID;
244  return NS_OK;
245 } //SetDatabaseGUID
246 
247 //-----------------------------------------------------------------------------
248 /* wstring GetDatabaseGUID (); */
249 NS_IMETHODIMP CDatabaseQuery::GetDatabaseGUID(nsAString &_retval)
250 {
252  _retval = m_DatabaseGUID;
253  return NS_OK;
254 } //GetDatabaseGUID
255 
256 //-----------------------------------------------------------------------------
257 /* void AddQuery (in wstring strQuery); */
258 NS_IMETHODIMP CDatabaseQuery::AddQuery(const nsAString &strQuery)
259 {
260  // First, we need to create a prepared statement.
261  nsCOMPtr<sbIDatabasePreparedStatement> preparedStatement;
262  nsresult rv = PrepareQuery(strQuery, getter_AddRefs(preparedStatement));
263  NS_ENSURE_SUCCESS(rv, rv);
264 
265  rv = AddPreparedStatement(preparedStatement);
266  NS_ENSURE_SUCCESS(rv, rv);
267 
268  return NS_OK;
269 } //AddQuery
270 
271 //-----------------------------------------------------------------------------
272 /* sbIPreparedStatement PrepareQuery (in wstring strQuery); */
273 NS_IMETHODIMP CDatabaseQuery::PrepareQuery(const nsAString &strQuery, sbIDatabasePreparedStatement **_retval)
274 {
275  nsCOMPtr<sbIDatabasePreparedStatement> preparedStatement = new CDatabasePreparedStatement(strQuery);
276  NS_ENSURE_TRUE(preparedStatement, NS_ERROR_OUT_OF_MEMORY);
277  preparedStatement.forget(_retval);
278 
279  return NS_OK;
280 } //AddQuery
281 
282 NS_IMETHODIMP CDatabaseQuery::AddPreparedStatement(sbIDatabasePreparedStatement *preparedStatement)
283 {
284  NS_ENSURE_ARG_POINTER(preparedStatement);
285 
287  m_DatabaseQueryList.push_back(preparedStatement);
288 
289  // Also add an element to the bind parameters array
290  m_BindParameters.resize(m_BindParameters.size()+1);
291 
292  return NS_OK;
293 }
294 
295 //-----------------------------------------------------------------------------
296 /* PRInt32 GetQueryCount (); */
297 NS_IMETHODIMP CDatabaseQuery::GetQueryCount(PRUint32 *_retval)
298 {
299  NS_ENSURE_ARG_POINTER(_retval);
301  *_retval = (PRInt32)m_DatabaseQueryList.size();
302  return NS_OK;
303 } //GetQueryCount
304 
305 //-----------------------------------------------------------------------------
306 /* sbIDatabasePreparedStatement GetQuery (in PRInt32 nIndex); */
307 NS_IMETHODIMP CDatabaseQuery::GetQuery(PRUint32 nIndex, sbIDatabasePreparedStatement **_retval)
308 {
309  nsresult rv = NS_OK;
310  NS_ENSURE_ARG_POINTER(_retval);
311 
313 
314  if((PRUint32)nIndex < m_DatabaseQueryList.size()) {
315  NS_ADDREF(*_retval = m_DatabaseQueryList[nIndex]);
316  }
317  else {
318  rv = NS_ERROR_ILLEGAL_VALUE;
319  }
320 
321  return rv;
322 } //GetQuery
323 
324 //-----------------------------------------------------------------------------
325 /* sbIDatabasePreparedStatement PopQuery(); */
327 {
328  nsresult rv = NS_OK;
329 
330  NS_ENSURE_ARG_POINTER(_retval);
331 
333 
334  if(m_DatabaseQueryList.size() > 0) {
335  NS_ADDREF(*_retval = m_DatabaseQueryList[0]);
336  m_DatabaseQueryList.pop_front();
337  }
338  else {
339  rv = NS_ERROR_ILLEGAL_VALUE;
340  }
341 
342  return rv;
343 } //PopQuery
344 
345 //-----------------------------------------------------------------------------
346 /* void ResetQuery (); */
347 NS_IMETHODIMP CDatabaseQuery::ResetQuery()
348 {
349  // Make sure we're not running
350  nsAutoMonitor monQueryRunning(m_pQueryRunningMonitor);
351 
352  // These should be in sync, but just in case
353  NS_ASSERTION( !m_IsExecuting, "Resetting a query that is executing!!!!!");
354  NS_ASSERTION( m_QueryHasCompleted || m_CurrentQuery == PR_UINT32_MAX,
355  "Resetting a query that is not complete!!!!!");
356 
357  // Make sure no-one is touching m_IsExecuting
359 
360  m_DatabaseQueryList.clear();
361 
362  // Also clear parameters array
363  m_BindParameters.clear();
364 
365  // Done with result set
366  m_QueryResult = nsnull;
367 
368  m_RollingLimit = 0;
371 
372  return NS_OK;
373 }
374 
375 //-----------------------------------------------------------------------------
376 /* sbIDatabaseResult GetResultObject (); */
378 {
379  NS_ENSURE_ARG_POINTER(_retval);
380 
382  NS_IF_ADDREF(*_retval = m_QueryResult);
383 
384  return NS_OK;
385 } //GetResultObject
386 
387 //-----------------------------------------------------------------------------
388 /* PRInt32 GetLastError (); */
389 NS_IMETHODIMP CDatabaseQuery::GetLastError(PRInt32 *_retval)
390 {
391  NS_ENSURE_ARG_POINTER(_retval);
392  *_retval = m_LastError;
393  return NS_OK;
394 } //GetLastError
395 
396 //-----------------------------------------------------------------------------
397 /* void SetLastError (in PRInt32 dbError); */
398 NS_IMETHODIMP CDatabaseQuery::SetLastError(PRInt32 dbError)
399 {
400  m_LastError = dbError;
401  return NS_OK;
402 }
403 
404 //-----------------------------------------------------------------------------
405 NS_IMETHODIMP CDatabaseQuery::Execute(PRInt32 *_retval)
406 {
407  LOG(("DBQ:[0x%x] Execute - ENTRY POINT", this));
408  NS_ENSURE_ARG_POINTER(_retval);
409  *_retval = 1;
410 
411  {
412  nsAutoMonitor mon(m_pQueryRunningMonitor);
413  m_QueryHasCompleted = PR_FALSE;
414  }
415 
416  // Will re-enter back to WaitForCompletion and wait if Sync Query
417  // returns failure only if shutting down
418  // retval is 1 if an error
419  // 0 if successful OR already running
420  nsresult rv = mDatabaseEngine->SubmitQuery(this, _retval);
421  NS_ENSURE_SUCCESS(rv, rv);
422 
423  if(*_retval != SQLITE_OK)
424  {
425  nsAutoMonitor mon(m_pQueryRunningMonitor);
426  m_QueryHasCompleted = PR_TRUE;
427  mon.NotifyAll();
428  return NS_ERROR_FAILURE;
429  }
430 
431  LOG(("DBQ:[0x%x] Execute - EXIT POINT\n\n", this));
432 
433  return NS_OK;
434 } //Execute
435 
436 //-----------------------------------------------------------------------------
437 NS_IMETHODIMP CDatabaseQuery::WaitForCompletion(PRInt32 *_retval)
438 {
439  NS_ENSURE_ARG_POINTER(_retval);
440  {
441  nsAutoMonitor mon(m_pQueryRunningMonitor);
442  while (!m_QueryHasCompleted) {
443  mon.Wait();
444  }
445 
446  NS_ASSERTION( !m_IsExecuting, "Query marked completed but still executing.");
447  }
448  *_retval = NS_OK;
449  return NS_OK;
450 } //WaitForCompletion
451 
452 //-----------------------------------------------------------------------------
453 /* PRBool IsExecuting (); */
454 NS_IMETHODIMP CDatabaseQuery::IsExecuting(PRBool *_retval)
455 {
456  NS_ENSURE_ARG_POINTER(_retval);
457 
459  *_retval = m_IsExecuting;
460 
461  return NS_OK;
462 } //IsExecuting
463 
464 //-----------------------------------------------------------------------------
465 /* PRInt32 CurrentQuery (); */
466 NS_IMETHODIMP CDatabaseQuery::CurrentQuery(PRUint32 *_retval)
467 {
468  NS_ENSURE_ARG_POINTER(_retval);
469 
471  *_retval = m_CurrentQuery;
472 
473  return NS_OK;
474 } //CurrentQuery
475 
476 //-----------------------------------------------------------------------------
477 /* void Abort (); */
478 NS_IMETHODIMP CDatabaseQuery::Abort(PRBool *_retval)
479 {
480  NS_ENSURE_ARG_POINTER(_retval);
481  *_retval = PR_FALSE;
482 
483  if(m_IsExecuting)
484  {
485  PRInt32 nWaitResult = 0;
486 
487  {
489  m_IsAborting = PR_TRUE;
490  }
491 
492  WaitForCompletion(&nWaitResult);
493 
494  *_retval = PR_TRUE;
495  }
496 
497  return NS_OK;
498 }
499 
500 NS_IMETHODIMP CDatabaseQuery::GetRollingLimit(PRUint64 *aRollingLimit)
501 {
502  NS_ENSURE_ARG_POINTER(aRollingLimit);
503 
505  *aRollingLimit = m_RollingLimit;
506 
507  return NS_OK;
508 }
509 
510 NS_IMETHODIMP CDatabaseQuery::SetRollingLimit(PRUint64 aRollingLimit)
511 {
513  m_RollingLimit = aRollingLimit;
514 
515  return NS_OK;
516 }
517 
518 NS_IMETHODIMP CDatabaseQuery::GetRollingLimitColumnIndex(PRUint32 *aRollingLimitColumnIndex)
519 {
520  NS_ENSURE_ARG_POINTER(aRollingLimitColumnIndex);
521 
523  *aRollingLimitColumnIndex = m_RollingLimitColumnIndex;
524 
525  return NS_OK;
526 }
527 
528 NS_IMETHODIMP CDatabaseQuery::SetRollingLimitColumnIndex(PRUint32 aRollingLimitColumnIndex)
529 {
531  m_RollingLimitColumnIndex = aRollingLimitColumnIndex;
532 
533  return NS_OK;
534 }
535 
536 NS_IMETHODIMP CDatabaseQuery::GetRollingLimitResult(PRUint32 *aRollingLimitResult)
537 {
538  NS_ENSURE_ARG_POINTER(aRollingLimitResult);
539 
541  *aRollingLimitResult = m_RollingLimitResult;
542 
543  return NS_OK;
544 }
545 
546 NS_IMETHODIMP CDatabaseQuery::SetRollingLimitResult(PRUint32 aRollingLimitResult)
547 {
549  m_RollingLimitResult = aRollingLimitResult;
550 
551  return NS_OK;
552 }
553 
554 NS_IMETHODIMP CDatabaseQuery::BindUTF8StringParameter(PRUint32 aParamIndex,
555  const nsACString &aValue)
556 {
557  NS_ENSURE_TRUE(m_BindParameters.size() > 0, NS_ERROR_FAILURE);
559 
560  nsresult rv = EnsureLastQueryParameter(aParamIndex);
561  NS_ENSURE_SUCCESS(rv, rv);
562  CQueryParameter& qp = m_BindParameters[m_BindParameters.size()-1][aParamIndex];
563  qp.type = UTF8STRING;
564  qp.utf8StringValue = aValue;
565 
566  return NS_OK;
567 }
568 
569 NS_IMETHODIMP CDatabaseQuery::BindStringParameter(PRUint32 aParamIndex,
570  const nsAString &aValue)
571 {
572  NS_ENSURE_TRUE(m_BindParameters.size() > 0, NS_ERROR_FAILURE);
574  nsresult rv = EnsureLastQueryParameter(aParamIndex);
575  NS_ENSURE_SUCCESS(rv, rv);
576 
577  CQueryParameter& qp = m_BindParameters[m_BindParameters.size()-1][aParamIndex];
578  qp.type = STRING;
579  qp.stringValue = aValue;
580 
581  return NS_OK;
582 }
583 
584 NS_IMETHODIMP CDatabaseQuery::BindDoubleParameter(PRUint32 aParamIndex,
585  double aValue)
586 {
587  NS_ENSURE_TRUE(m_BindParameters.size() > 0, NS_ERROR_FAILURE);
589  nsresult rv = EnsureLastQueryParameter(aParamIndex);
590  NS_ENSURE_SUCCESS(rv, rv);
591  CQueryParameter& qp = m_BindParameters[m_BindParameters.size()-1][aParamIndex];
592  qp.type = DOUBLE;
593  qp.doubleValue = aValue;
594 
595  return NS_OK;
596 }
597 
598 NS_IMETHODIMP CDatabaseQuery::BindInt32Parameter(PRUint32 aParamIndex,
599  PRInt32 aValue)
600 {
601  NS_ENSURE_TRUE(m_BindParameters.size() > 0, NS_ERROR_FAILURE);
603  nsresult rv = EnsureLastQueryParameter(aParamIndex);
604  NS_ENSURE_SUCCESS(rv, rv);
605  CQueryParameter& qp = m_BindParameters[m_BindParameters.size()-1][aParamIndex];
606  qp.type = INTEGER32;
607  qp.int32Value = aValue;
608 
609  return NS_OK;
610 }
611 
612 NS_IMETHODIMP CDatabaseQuery::BindInt64Parameter(PRUint32 aParamIndex,
613  PRInt64 aValue)
614 {
615  NS_ENSURE_TRUE(m_BindParameters.size() > 0, NS_ERROR_FAILURE);
617  nsresult rv = EnsureLastQueryParameter(aParamIndex);
618  NS_ENSURE_SUCCESS(rv, rv);
619  CQueryParameter& qp = m_BindParameters[m_BindParameters.size()-1][aParamIndex];
620  qp.type = INTEGER64;
621  qp.int64Value = aValue;
622 
623  return NS_OK;
624 }
625 
626 NS_IMETHODIMP CDatabaseQuery::BindNullParameter(PRUint32 aParamIndex)
627 {
628  NS_ENSURE_TRUE(m_BindParameters.size() > 0, NS_ERROR_FAILURE);
630  nsresult rv = EnsureLastQueryParameter(aParamIndex);
631  NS_ENSURE_SUCCESS(rv, rv);
632  CQueryParameter& qp = m_BindParameters[m_BindParameters.size()-1][aParamIndex];
633  qp.type = ISNULL;
634 
635  return NS_OK;
636 }
637 
638 nsresult CDatabaseQuery::EnsureLastQueryParameter(PRUint32 aParamIndex)
639 {
640  NS_ENSURE_TRUE(m_BindParameters.size() > 0, NS_ERROR_FAILURE);
641  if (aParamIndex >= m_BindParameters[m_BindParameters.size()-1].size()) {
642  m_BindParameters[m_BindParameters.size()-1].resize(aParamIndex+1);
643  }
644 
645  return NS_OK;
646 }
647 
648 //-----------------------------------------------------------------------------
650 {
652  return m_QueryResult;
653 } //GetResultObject
654 
655 void
657 {
659  m_QueryResult = aResultObject;
660 }
661 
663 {
664  bindParameterArray_t* retval = nsnull;
666 
667  if(aQueryIndex < m_BindParameters.size()) {
668  retval = new bindParameterArray_t(m_BindParameters[aQueryIndex]);
669  } else {
670  retval = new bindParameterArray_t;
671  }
672 
673  return retval;
674 }
675 
677 {
678  bindParameterArray_t* retval = nsnull;
680 
681  if(m_BindParameters.size()) {
682  retval = new bindParameterArray_t(m_BindParameters[0]);
683  m_BindParameters.pop_front();
684  } else {
685  retval = new bindParameterArray_t;
686  }
687 
688  return retval;
689 }
PRUint64 m_RollingLimit
return NS_OK
ParameterType type
onPageChanged aValue
Definition: FeedWriter.js:1395
std::vector< CQueryParameter > bindParameterArray_t
#define DATABASEQUERY_DEFAULT_CALLBACK_SLOTS
std::deque< bindParameterArray_t > m_BindParameters
NS_IMPL_THREADSAFE_CI(sbMediaListEnumeratorWrapper)
nsresult do_GetProxyForObject(nsIEventTarget *aTarget, REFNSIID aIID, nsISupports *aObj, PRInt32 aProxyType, void **aProxyObject)
#define SONGBIRD_DATABASEENGINE_CONTRACTID
PRBool m_QueryHasCompleted
NS_IMPL_THREADSAFE_RELEASE(sbRequestItem)
NS_IMPL_THREADSAFE_ADDREF(sbRequestItem)
nsCString m_LocationURIString
PRUint32 m_CurrentQuery
NS_DECL_ISUPPORTS NS_DECL_SBIDATABASEQUERY NS_DECL_NSICLASSINFO nsresult Init()
nsresult GetDatabaseLocation(nsACString &aURISpec)
virtual ~CDatabaseQuery()
bindParameterArray_t * GetQueryParameters(PRUint32 aQueryIndex)
PRMonitor * m_pQueryRunningMonitor
void SetResultObject(CDatabaseResult *aResultObject)
nsRefPtr< CDatabaseResult > m_QueryResult
nsCString utf8StringValue
nsresult PopQuery(sbIDatabasePreparedStatement **_retval)
nsString m_DatabaseGUID
nsInterfaceHashtableMT< nsISupportsHashKey, sbIDatabaseSimpleQueryCallback > m_CallbackList
PRBool m_IsExecuting
A callback object used to inform client code that a query has completed.
PRLock * m_pLock
nsString stringValue
An object containing the results of a database SELECT query.
#define LOG(args)
const PR_UINT32_MAX
Definition: httpd.js:55
nsCOMPtr< sbIDatabaseEngine > mDatabaseEngine
sbIJobCancelable NS_DECL_CLASSINFO(sbGstreamerMediaInspector)
PRUint32 m_RollingLimitColumnIndex
An object responsible for executing SQL queries on the database.
Songbird Database Prepared Query.
PRUint32 m_RollingLimitResult
std::deque< nsCOMPtr< sbIDatabasePreparedStatement > > m_DatabaseQueryList
PRInt32 m_LastError
NS_INTERFACE_MAP_END NS_IMPL_CI_INTERFACE_GETTER1(CDatabaseQuery, sbIDatabaseQuery) CDatabaseQuery
CDatabaseResult * GetResultObject()
A prepared database statement.
Songbird Database Object Definition.
bindParameterArray_t * PopQueryParameters()