Bug 333848 - add full-featured user-defined functions and progress handlers to storage. Patch by Lev Serebryakov <blacklion@gmail.com>. r=cbiesinger, sr=cbiesinger

This commit is contained in:
sdwilsh@shawnwilsher.com 2007-07-07 14:14:56 -07:00
Родитель ae472131bb
Коммит c94d0a239c
1 изменённых файлов: 5 добавлений и 2 удалений

7
netwerk/cache/src/nsDiskCacheDeviceSQL.cpp поставляемый
Просмотреть файл

@ -46,6 +46,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsPrintfCString.h" #include "nsPrintfCString.h"
#include "nsCRT.h" #include "nsCRT.h"
#include "nsIVariant.h"
#include "mozIStorageService.h" #include "mozIStorageService.h"
#include "mozIStorageStatement.h" #include "mozIStorageStatement.h"
@ -202,9 +203,11 @@ GetCacheDataFile(nsIFile *cacheDir, const char *cid, const char *key,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsOfflineCacheEvictionFunction::OnFunctionCall(mozIStorageValueArray *values) nsOfflineCacheEvictionFunction::OnFunctionCall(mozIStorageValueArray *values, nsIVariant **_retval)
{ {
LOG(("nsOfflineCacheDevice::EvictionObserver\n")); LOG(("nsOfflineCacheDevice::EvictionObserver\n"));
*_retval = nsnull;
PRUint32 numEntries; PRUint32 numEntries;
nsresult rv = values->GetNumEntries(&numEntries); nsresult rv = values->GetNumEntries(&numEntries);
@ -762,7 +765,7 @@ nsOfflineCacheDevice::Init()
new nsOfflineCacheEvictionFunction(this); new nsOfflineCacheEvictionFunction(this);
if (!evictionFunction) return NS_ERROR_OUT_OF_MEMORY; if (!evictionFunction) return NS_ERROR_OUT_OF_MEMORY;
rv = mDB->CreateFunction("cache_eviction_observer", 3, evictionFunction); rv = mDB->CreateFunction(NS_LITERAL_CSTRING("cache_eviction_observer"), 3, evictionFunction);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
// create all (most) of our statements up front // create all (most) of our statements up front