Bug 487230 - Remove dead code in mozStorageValueArray.*
authorShawn Wilsher <sdwilsh@shawnwilsher.com>
Wed, 08 Apr 2009 12:24:22 -0400
changeset 27084 5c54a147468feb0dfc1b7f99441a12a3344f197a
parent 27083 bbb30d93a82fa6d5a4988f539b84ba20de4c9b65
child 27085 a41ec1a6b8fcf08db5ce425827c872899f429776
push idunknown
push userunknown
push dateunknown
bugs487230
milestone1.9.2a1pre
Bug 487230 - Remove dead code in mozStorageValueArray.* Removes code that appears to have never been used... r=asuth
storage/src/mozStorageValueArray.cpp
storage/src/mozStorageValueArray.h
--- a/storage/src/mozStorageValueArray.cpp
+++ b/storage/src/mozStorageValueArray.cpp
@@ -38,214 +38,16 @@
 
 #include "nsError.h"
 #include "nsMemory.h"
 #include "nsString.h"
 
 #include "mozStorageValueArray.h"
 
 /***
- *** mozStorageStatementRowValueArray
- ***/
-
-/* Implementation file */
-NS_IMPL_ISUPPORTS1(mozStorageStatementRowValueArray, mozIStorageValueArray)
-
-mozStorageStatementRowValueArray::mozStorageStatementRowValueArray(sqlite3_stmt *aSqliteStmt)
-{
-    mSqliteStatement = aSqliteStmt;
-    mNumEntries = sqlite3_data_count (aSqliteStmt);
-}
-
-mozStorageStatementRowValueArray::~mozStorageStatementRowValueArray()
-{
-    /* do nothing, we don't own the stmt */
-}
-
-/* readonly attribute unsigned long numEntries; */
-NS_IMETHODIMP
-mozStorageStatementRowValueArray::GetNumEntries(PRUint32 *aLength)
-{
-    *aLength = mNumEntries;
-    return NS_OK;
-}
-
-/* long getTypeOfIndex (in unsigned long aIndex); */
-NS_IMETHODIMP
-mozStorageStatementRowValueArray::GetTypeOfIndex(PRUint32 aIndex, PRInt32 *_retval)
-{
-    if (aIndex < 0 || aIndex >= mNumEntries)
-        return NS_ERROR_ILLEGAL_VALUE;
-
-    int t = sqlite3_column_type (mSqliteStatement, aIndex);
-    switch (t) {
-        case SQLITE_INTEGER:
-            *_retval = VALUE_TYPE_INTEGER;
-            break;
-        case SQLITE_FLOAT:
-            *_retval = VALUE_TYPE_FLOAT;
-            break;
-        case SQLITE_TEXT:
-            *_retval = VALUE_TYPE_TEXT;
-            break;
-        case SQLITE_BLOB:
-            *_retval = VALUE_TYPE_BLOB;
-            break;
-        case SQLITE_NULL:
-            *_retval = VALUE_TYPE_NULL;
-            break;
-        default:
-            // ???
-            return NS_ERROR_FAILURE;
-    }
-
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-mozStorageStatementRowValueArray::GetInt32(PRUint32 aIndex, PRInt32 *_retval)
-{
-    if (aIndex < 0 || aIndex >= mNumEntries)
-        return NS_ERROR_ILLEGAL_VALUE;
-
-    *_retval = sqlite3_column_int (mSqliteStatement, aIndex);
-
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-mozStorageStatementRowValueArray::GetInt64(PRUint32 aIndex, PRInt64 *_retval)
-{
-    if (aIndex < 0 || aIndex >= mNumEntries)
-        return NS_ERROR_ILLEGAL_VALUE;
-
-    *_retval = sqlite3_column_int64 (mSqliteStatement, aIndex);
-
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-mozStorageStatementRowValueArray::GetDouble(PRUint32 aIndex, double *_retval)
-{
-    if (aIndex < 0 || aIndex >= mNumEntries)
-        return NS_ERROR_ILLEGAL_VALUE;
-
-    *_retval = sqlite3_column_double (mSqliteStatement, aIndex);
-
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-mozStorageStatementRowValueArray::GetUTF8String(PRUint32 aIndex, nsACString &_retval)
-{
-    // GetTypeOfIndex will check aIndex for us, so we don't have to.
-    PRInt32 type;
-    nsresult rv = GetTypeOfIndex (aIndex, &type);
-    NS_ENSURE_SUCCESS(rv, rv);
-    if (type == SQLITE_NULL) {
-        // null columns get IsVoid set to distinguish them from empty strings
-        _retval.Truncate(0);
-        _retval.SetIsVoid(PR_TRUE);
-    } else {
-        PRUint32 slen = (PRUint32) sqlite3_column_bytes (mSqliteStatement, aIndex);
-        const char *cstr = (const char *) sqlite3_column_text (mSqliteStatement, aIndex);
-        _retval.Assign(cstr, slen);
-    }
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-mozStorageStatementRowValueArray::GetString(PRUint32 aIndex, nsAString & _retval)
-{
-    // GetTypeOfIndex will check aIndex for us, so we don't have to.
-    PRInt32 type;
-    nsresult rv = GetTypeOfIndex (aIndex, &type);
-    NS_ENSURE_SUCCESS(rv, rv);
-    if (type == SQLITE_NULL) {
-        // null columns get IsVoid set to distinguish them from empty strings
-        _retval.Truncate(0);
-        _retval.SetIsVoid(PR_TRUE);
-    } else {
-        int slen = sqlite3_column_bytes16 (mSqliteStatement, aIndex);
-        const PRUnichar *wstr = (const PRUnichar *) sqlite3_column_text16 (mSqliteStatement, aIndex);
-        _retval.Assign (wstr, slen/2);
-    }
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-mozStorageStatementRowValueArray::GetBlob(PRUint32 aIndex, PRUint32 *aDataSize, PRUint8 **aData)
-{
-    if (aIndex < 0 || aIndex >= mNumEntries)
-        return NS_ERROR_ILLEGAL_VALUE;
-
-    int blobsize = sqlite3_column_bytes (mSqliteStatement, aIndex);
-    const void *blob = sqlite3_column_blob (mSqliteStatement, aIndex);
-
-    void *blobcopy = nsMemory::Clone(blob, blobsize);
-    if (blobcopy == NULL)
-        return NS_ERROR_OUT_OF_MEMORY;
-
-    *aData = (PRUint8*) blobcopy;
-    *aDataSize = blobsize;
-
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-mozStorageStatementRowValueArray::GetIsNull(PRUint32 aIndex, PRBool *_retval)
-{
-    // GetTypeOfIndex will check aIndex for us, so we don't have to.
-    PRInt32 t;
-    nsresult rv = GetTypeOfIndex (aIndex, &t);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    if (t == VALUE_TYPE_NULL)
-        *_retval = PR_TRUE;
-    else
-        *_retval = PR_FALSE;
-
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-mozStorageStatementRowValueArray::GetSharedUTF8String(PRUint32 aIndex, PRUint32 *aLength, const char **_retval)
-{
-    if (aLength) {
-        int slen = sqlite3_column_bytes (mSqliteStatement, aIndex);
-        *aLength = slen;
-    }
-
-    *_retval = (const char*) sqlite3_column_text (mSqliteStatement, aIndex);
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-mozStorageStatementRowValueArray::GetSharedString(PRUint32 aIndex, PRUint32 *aLength, const PRUnichar **_retval)
-{
-    if (aLength) {
-        int slen = sqlite3_column_bytes16 (mSqliteStatement, aIndex);
-        *aLength = slen;
-    }
-
-    *_retval = (const PRUnichar *) sqlite3_column_text16 (mSqliteStatement, aIndex);
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-mozStorageStatementRowValueArray::GetSharedBlob(PRUint32 aIndex, PRUint32 *aDataSize, const PRUint8 **aData)
-{
-    *aDataSize = sqlite3_column_bytes (mSqliteStatement, aIndex);
-    *aData = (const PRUint8*) sqlite3_column_blob (mSqliteStatement, aIndex);
-
-    return NS_OK;
-}
-
-
-/***
  *** mozStorageArgvValueArray
  ***/
 
 /* Implementation file */
 NS_IMPL_ISUPPORTS1(mozStorageArgvValueArray, mozIStorageValueArray)
 
 mozStorageArgvValueArray::mozStorageArgvValueArray(PRInt32 aArgc, sqlite3_value **aArgv)
     : mArgc(aArgc), mArgv(aArgv)
--- a/storage/src/mozStorageValueArray.h
+++ b/storage/src/mozStorageValueArray.h
@@ -34,41 +34,20 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef _MOZSTORAGEVALUEARRAY_H_
 #define _MOZSTORAGEVALUEARRAY_H_
 
-#include "nsCOMPtr.h"
-
 #include "mozIStorageValueArray.h"
 
-#include "nsIArray.h"
-
 #include <sqlite3.h>
 
-class nsIArray;
-
-class mozStorageStatementRowValueArray : public mozIStorageValueArray
-{
-public:
-    mozStorageStatementRowValueArray (sqlite3_stmt *aSqliteStmt);
-    ~mozStorageStatementRowValueArray();
-
-    // interfaces
-    NS_DECL_ISUPPORTS
-    NS_DECL_MOZISTORAGEVALUEARRAY
-
-private:
-    sqlite3_stmt *mSqliteStatement;
-    PRUint32 mNumEntries;
-};
-
 class mozStorageArgvValueArray : public mozIStorageValueArray
 {
 public:
     mozStorageArgvValueArray (PRInt32 aArgc, sqlite3_value **aArgv);
     ~mozStorageArgvValueArray();
 
     // interfaces
     NS_DECL_ISUPPORTS