标签: cursor

使用FAST_FORWARD定义游标有什么好处?

使用FAST_FORWARD定义游标有什么好处?性能更好吗?为什么?

sql sql-server cursor

20
推荐指数
2
解决办法
3万
查看次数

在Java中移动光标

我想创建一个应用程序,测量光标距组件中心的距离,然后将光标移回中心(就像大多数PC视频游戏一样).有没有人有什么建议?

java cursor

20
推荐指数
2
解决办法
4万
查看次数

WPF中的默认光标?

我正在更改控件的光标WPF.

btn.Cursor = Cursors.Wait;
Run Code Online (Sandbox Code Playgroud)

执行一个操作后,我想恢复到默认光标,我没有找到任何Cursors.Default,如何获取默认光标?

.net wpf cursor

20
推荐指数
2
解决办法
1万
查看次数

Recyclerview + Content provider + CursorLoader

我在SQLite数据库中有一些数据.我有一个内容提供程序,它将从数据库中获取数据.现在的问题是如何实现cursorLoader与recyclerview一起工作?

此外,任何人都可以解释为什么我们需要将数据从游标传输到对象以显示在listview/recyclerview中而不是直接从游标中显示?

例如,在自定义cursorAdapter类中,

Person person = new Person(cursor.getString(cursor.getColumnIndexOrThrow(PERSON_NAME)));
textview.setText = person.getName();
Run Code Online (Sandbox Code Playgroud)

要么

textview.setText = cursor.getString(cursor.getColumnIndexOrThrow(PERSON_NAME));
Run Code Online (Sandbox Code Playgroud)

以上哪种方法比较好?

在过去,我们曾经有listview和gridview,现在看来它们被合并成为recyclerview.那么,我如何实现基于网格的Recyclerview?

sqlite android cursor android-contentprovider android-recyclerview

20
推荐指数
1
解决办法
8943
查看次数

MongoDB - 错误:getMore命令失败:找不到光标

我需要sid在大约500K文档的集合中为每个文档创建一个新字段.每个sid都是独一无二的,并基于该记录的现有roundedDatestream字段.

我正在使用以下代码:

var cursor = db.getCollection('snapshots').find();
var iterated = 0;
var updated = 0;

while (cursor.hasNext()) {
    var doc = cursor.next();

    if (doc.stream && doc.roundedDate && !doc.sid) {
        db.getCollection('snapshots').update({ "_id": doc['_id'] }, {
            $set: {
                sid: doc.stream.valueOf() + '-' + doc.roundedDate,
            }
        });

        updated++;
    }

    iterated++;
}; 

print('total ' + cursor.count() + ' iterated through ' + iterated + ' updated ' + updated);
Run Code Online (Sandbox Code Playgroud)

它起初效果很好,但几个小时后大约有100K记录,它出错了:

Error: getMore command failed: {
    "ok" : …
Run Code Online (Sandbox Code Playgroud)

cursor mongodb node.js mongodb-query

20
推荐指数
1
解决办法
2万
查看次数

如何(正确)从startManagingCursor转换到CursorLoader?

我将我的android更新SDK到最新版本,现在它说startManagingCursor()deprecated.我需要帮助来更新我的代码以使用新代码 CursorLoader.

private void fillData() {
    Cursor notesCursor = mDbHelper.fetchAllNotes();
    startManagingCursor(notesCursor);
    NoteAdapter notes = new NoteAdapter(this,  R.layout.notes_row, notesCursor);
    setListAdapter(notes);
}
Run Code Online (Sandbox Code Playgroud)

那么,startManagingCursor()旧的,如果它被翻译,新代码会是什么样子?

android cursor android-cursorloader

19
推荐指数
1
解决办法
1万
查看次数

关闭结果集后,Oracle不会删除游标

注意:我们重用单一连接.

************************************************
public Connection connection() {        
    try {
        if ((connection == null) || (connection.isClosed()))
        {
            if (connection!=null)
                log.severe("Connection was closed !");
            connection = DriverManager.getConnection(jdbcURL, username, password);
        }
    } catch (SQLException e) {
        log.severe("can't connect: " + e.getMessage());
    }
    return connection;        
}
**************************************************

public IngisObject[] select(String query, String idColumnName, String[] columns) {
    Connection con = connection();

    Vector<IngisObject> objects = new Vector<IngisObject>();
    try {
        Statement stmt = con.createStatement();

        String sql = query;
        ResultSet rs =stmt.executeQuery(sql);//oracle increases cursors count here
        while(rs.next()) {
            IngisObject …
Run Code Online (Sandbox Code Playgroud)

java oracle jdbc resultset cursor

18
推荐指数
4
解决办法
6万
查看次数

android.database.CursorIndexOutOfBoundsException:请求索引-1,大小为2

下面是我的代码,我得到了android.database.CursorIndexOutOfBoundsException:索引-1请求,大小为2错误.谁能告诉我如何解决它?

ContentResolver cr = getContentResolver();
  Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI,
    null, null, null, null);
  if (Integer.parseInt(cur.getString(
    cur.getColumnIndex(People.PRIMARY_PHONE_ID))) > 0) {

   Cursor pCur = cr.query(
     Contacts.Phones.CONTENT_URI, 
     null, 
     Contacts.Phones.PERSON_ID +" = ?", 
     new String[]{id}, null);
   int i=0;
   int pCount = pCur.getCount();
   String[] phoneNum = new String[pCount];
   String[] phoneType = new String[pCount];
   while (pCur.moveToNext()) {
    phoneNum[i] = pCur.getString(
      pCur.getColumnIndex(Contacts.Phones.NUMBER));
    phoneType[i] = pCur.getString(
      pCur.getColumnIndex(Contacts.Phones.TYPE));
    i++;
   } 
  }
 }
}
Run Code Online (Sandbox Code Playgroud)

android cursor contacts

18
推荐指数
1
解决办法
2万
查看次数

如何在WPF应用程序启动期间显示等待光标?

以下是我希望在WPF应用程序启动时发生的基本事件.这与Word在我的机器上启动的方式非常相似.

  1. 显示忙碌光标.
  2. 执行基本初始化.这需要几秒钟,需要在显示启动画面之前完成.
  3. 显示启动画面.此启动画面显示更深入的初始化进度,可能需要一段时间(从数据库缓存信息).
  4. 显示默认光标.由于启动画面现在正在显示进度,因此无需显示忙碌光标.
  5. 启动屏幕进度完成后,显示主窗口.
  6. 关闭启动画面.

一切正常,除了在显示启动画面之前显示忙碌光标.当我通过快捷方式执行应用程序时,等待光标闪烁,但很快又回到默认状态.我已经尝试了不同的方法设置Cursor但没有工作,但我认为问题是我不在控件/窗口中 - 我是从App.xaml.cs中做到的.而且,我设置的属性似乎是Windows窗体属性.以下是我在App.xaml.cs中的代码的摘录.

protected override void OnStartup(StartupEventArgs e)
{
  base.OnStartup(e);

  System.Windows.Forms.Application.UseWaitCursor = true;
  //System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
  //System.Windows.Forms.Application.DoEvents();

  Initialize();

  SplashWindow splash = new SplashWindow();
  splash.Show();

  System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;

  // Right now I'm showing main window right after splash screen but I will eventually wait until splash screen closes.
  MainWindow main = new MainWindow();
  main.Show();
}
Run Code Online (Sandbox Code Playgroud)

c# wpf cursor

18
推荐指数
3
解决办法
5万
查看次数

在没有Cursor的单个SQL表中合并数据

我有一个带有ID列的表和另一个带有数字的列.一个ID可以有多个数字.例如

ID | Number
 1 |  25
 1 |  26
 1 |  30
 1 |  24
 2 |  4
 2 |  8
 2 |  5
Run Code Online (Sandbox Code Playgroud)

现在基于这些数据,在一个新表中,我希望有这个

ID | Low | High 
1  |  24 |  26
1  |  30 |  30
2  |  4  |  5
2  |  8  |  8
Run Code Online (Sandbox Code Playgroud)

如你所见,我想合并任何数字连续的数据,如24,25,26.所以现在低点是24,高点是26,然后30仍然是一个单独的范围.我正在处理大量的数据,所以我宁愿不使用游标来提高性能(这是我以前做过的事情,而且减慢了很多事情)......实现这个目标的最佳方法是什么? ?我不是SQL专家,所以我不确定是否有可用的功能可以使这更容易,或者最快的方法是什么.

谢谢您的帮助.

sql t-sql aggregate cursor sql-server-2008

18
推荐指数
1
解决办法
1649
查看次数