Bug 552092 - Expose a length property on mozIStorageBindingParamsArray

Expose the length so that consumers don't have to track if they added anything
to the array themselves.
r=asuth
sr=rob_strong
This commit is contained in:
Shawn Wilsher 2010-03-15 10:23:39 -07:00
Родитель 24d00ec869
Коммит e905b76465
3 изменённых файлов: 17 добавлений и 3 удалений

Просмотреть файл

@ -41,14 +41,14 @@
interface mozIStorageBindingParams;
[scriptable, uuid(e676e1a3-1dc6-4802-ac03-291fa9de7f93)]
[scriptable, uuid(67eea5c3-4881-41ff-b0fe-09f2356aeadb)]
interface mozIStorageBindingParamsArray : nsISupports {
/**
* Creates a new mozIStorageBindingParams object that can be added to this
* array.
*
* @returns a mozIStorageBindingParams object that can be used to specify
* parameters that need to be bound.
* @return a mozIStorageBindingParams object that can be used to specify
* parameters that need to be bound.
*/
mozIStorageBindingParams newBindingParams();
@ -59,4 +59,9 @@ interface mozIStorageBindingParamsArray : nsISupports {
* The parameters to add to this array.
*/
void addParams(in mozIStorageBindingParams aParameters);
/**
* The number of mozIStorageBindingParams this object contains.
*/
readonly attribute unsigned long length;
};

Просмотреть файл

@ -109,5 +109,12 @@ BindingParamsArray::AddParams(mozIStorageBindingParams *aParameters)
return NS_OK;
}
NS_IMETHODIMP
BindingParamsArray::GetLength(PRUint32 *_length)
{
*_length = length();
return NS_OK;
}
} // namespace storage
} // namespace mozilla

Просмотреть файл

@ -520,6 +520,7 @@ function test_bind_multiple_rows_by_index()
bp.bindByIndex(3, null);
bp.bindBlobByIndex(4, BLOB, BLOB.length);
array.addParams(bp);
do_check_eq(array.length, i + 1);
}
stmt.bindParameters(array);
@ -589,6 +590,7 @@ function test_bind_multiple_rows_by_name()
bp.bindByName("null", null);
bp.bindBlobByName("blob", BLOB, BLOB.length);
array.addParams(bp);
do_check_eq(array.length, i + 1);
}
stmt.bindParameters(array);