cursor

Union of Tables with Cursor in Android

淺唱寂寞╮ 提交于 2019-12-11 03:38:54
问题 I am trying to UNION two tables with the same fields to create a single cursor (through a content provider) that I am using to create my ListView. @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); String groupBy = null; switch (sUriMatcher.match(uri)) { case LIST: StringBuilder sb = new StringBuilder(); for (String s : projection) sb.append(s).append(","); String

How to add decoration to OS specific cursor in SWT

六月ゝ 毕业季﹏ 提交于 2019-12-11 03:29:51
问题 I'd like to change the cursor on an SWT Composite to add a small image to the standard OS arrow cursor, in the bottom right corner for instance. I imagine it will mean somehow getting hold of the Image and X,Y hotspot of the cursor but I can't figure how do do that. Any thoughts? EDIT: Following the comment this has spawned this question. 来源: https://stackoverflow.com/questions/31143499/how-to-add-decoration-to-os-specific-cursor-in-swt

close() the cursor and DB when use the sqlite database

江枫思渺然 提交于 2019-12-11 03:21:49
问题 In my application I use the sqlite Database ,When I run the application Logcat display me close() was never explicitly called on database '/data/data/com.MAT.CanadaImmigrationApp/databases/CanadaianImmigrationApp' E/Database(13822): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here I search on google and I found db.close(); // to close your Database, cur.close(); //to close your cursor But I don't get the

Android Cursor RecyclerView does a flick on swipe

こ雲淡風輕ζ 提交于 2019-12-11 03:17:57
问题 I want to implement swipeable items in my recycler view. I'm using a custom recycler adapter populated with a Loader (Github link here) and a custom listener for swipe (Github link here). Data is stored locally with a SQLite and retrieved with a call to a filtered Cursor. I think I'm doing something wrong with the implementations, because what happens when I try to swipe is that my recycler item get like "flashed" for a very short time and then disappear. Everything works fine except for this

Move cursor to first row after while loop ResultSet

荒凉一梦 提交于 2019-12-11 03:13:45
问题 If I have to loop two times after each other using while(rs.next()) for different reasons through the same ResultSet , what can I do so that the ResultSet doesn't close automatically and to prevent the 'ResultSet is closed Exception'? I tried using resultset.first() to move the cursor back to the first row after the first loop but this error fired even on this statement! 回答1: This depends on your driver used. Some driver are not able to reset a ResultSet . In this case you will get an

Android CursorWrapperInner: Cursor finalized without prior close()

点点圈 提交于 2019-12-11 03:06:37
问题 in my application i keep getting this warning in my log: 12-17 20:17:20.979: W/CursorWrapperInner(3715): Cursor finalized without prior close(). when using: StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() .detectAll() .penaltyLog() .penaltyDeath() .build()); i get: 12-17 20:19:55.049: E/StrictMode(3919): A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. 12-17 20:19:55.049: E/StrictMode(3919): java

“Cursor is closed” error - when trying to execute an Oracle SP using JDBC

一笑奈何 提交于 2019-12-11 03:04:49
问题 The Oracle version of our database is 10g. The stored procedure selects all the elements in a table and returns a REF CURSOR type as follows: create or replace PROCEDURE S_S_TEST( test_OUT OUT OAS_TYPES.REFCURSOR ) AS BEGIN OPEN test_OUT FOR SELECT * FROM table_p; CLOSE test_OUT; END S_S_TEST; When this stored procedure is executed in JAVA the following exception is obtained- java.sql.SQLException: Cursor is closed. at oracle.jdbc.driver.T4CResultSetAccessor.getCursor(T4CResultSetAccessor

PostgreSQL CURSOR with “order by” clause

女生的网名这么多〃 提交于 2019-12-11 02:47:28
问题 Let's suppose there is a Query called A and it takes 2sec. SELECT ... FROM ... ORDER BY "users_device"."id" # Query A # It contains join clause. # It takes 2sec However, When I run A with declaring CURSOR , it takes 8sec. DECLARE "cursor" NO SCROLL CURSOR WITH HOLD FOR SELECT ... FROM ... ORDER BY "users_device"."id" # It takes 8sec I have tried to compare Query Plan between them and then I found A with CURSOR seems to try to avoid sorting operation. The below is actual query plan. # A

ORA-29481: Implicit results cannot be returned to client when calling Oracle 12c procedure from JDBC

自作多情 提交于 2019-12-11 02:30:41
问题 I wrote a PL/SQL procedure like this: CREATE OR REPLACE PROCEDURE p_5666 ( id1 NUMBER := NULL, id2 NUMBER := NULL, id3 NUMBER := NULL ) IS c1 SYS_REFCURSOR; c2 SYS_REFCURSOR; c3 SYS_REFCURSOR; BEGIN IF id1 IS NOT NULL THEN OPEN c1 FOR SELECT first_name, last_name FROM t_author WHERE id = id1; dbms_sql.return_result (c1); END IF; IF id2 IS NOT NULL THEN OPEN c2 FOR SELECT title FROM t_book WHERE id = id2; dbms_sql.return_result (c2); END IF; IF id3 IS NOT NULL THEN OPEN c3 FOR SELECT id3 AS id

cursor loop in PostgreSQL

柔情痞子 提交于 2019-12-11 02:24:07
问题 This below code is a cursor in PostgreSQL 9.0. I want to fetch my records by joining more than one table and i am getting JSON data from that join. So I want to loop those records and parse that json using query something like SELECT "Dump"->'activities-steps'->0->'value' as "steps" FROM "ActivitySessionDump" where "Id"=42594321345021288 then i have to get data from this query and insert to some other table like insert to table name (key,value); So i prepared one readonly cursor to achieve