Make DatabaseCursorTest#testManyRowsLong use a single transaction.

Bug 3188416

Change-Id: Ib1f1bd549b2c2342a304b39c1ec75f4d16316d24
diff --git a/tests/tests/database/src/android/database/cts/DatabaseCursorTest.java b/tests/tests/database/src/android/database/cts/DatabaseCursorTest.java
index f60638a..1ed33c5 100644
--- a/tests/tests/database/src/android/database/cts/DatabaseCursorTest.java
+++ b/tests/tests/database/src/android/database/cts/DatabaseCursorTest.java
@@ -472,11 +472,17 @@
 
     @LargeTest
     public void testManyRowsLong() throws Exception {
-        mDatabase.execSQL("CREATE TABLE test (_id INTEGER PRIMARY KEY, data INT);");
-
+        mDatabase.beginTransaction();
         final int count = 9000;
-        for (int i = 0; i < count; i++) {
-            mDatabase.execSQL("INSERT INTO test (data) VALUES (" + i + ");");
+        try {
+            mDatabase.execSQL("CREATE TABLE test (_id INTEGER PRIMARY KEY, data INT);");
+
+            for (int i = 0; i < count; i++) {
+                mDatabase.execSQL("INSERT INTO test (data) VALUES (" + i + ");");
+            }
+            mDatabase.setTransactionSuccessful();
+        } finally {
+            mDatabase.endTransaction();
         }
 
         Cursor testCursor = getTestCursor(mDatabase.query("test", new String[] { "data" },