数据库查询j2me包括条件 [英] Database query j2me including criterias

查看:117
本文介绍了数据库查询j2me包括条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用J2ME创建应用程序。用于连接数据库我使用 RecordStore

I am creating an application with J2ME. for connecting with database i am using RecordStore.

所以要获得一个记录,我需要写如下:

so to get a record i need to write as follow:

public boolean SearchRecord(String Rec, int pos )
    {
        String [] data = getRecordData();

        Rec = Rec.substring(0,pos);
        for ( int i = 0 ; i < data.length ; i++ )
        {
            data[i] = data[i].substring(0, pos );
            if ( Rec.toString().trim().equals(data[i].toString().trim()) )
            {
                data = null; // System.gc();
                return true;
            }
        }

        data = null; // System.gc();
        return false;
    }

这是首先获取所有记录并遍历它来搜索记录。但我有成千上万的记录,我只是需要一些基于标准有没有办法解决这个问题?我不想遍历成千上万的记录,以获得十条记录。

This is first get all records and traverse through it to search a record. But i have thousands of records and i just need some based on criteria is there any way to resolve this problem ? I do not want to traverse through thousands of records to get ten records.

另一件事我困惑的UI部分,LWUIT更好或JSR更好的实现?

One more thing i am confused about UI part that LWUIT is better or JSR is better to implement ?

推荐答案

您在问题中的代码是来自我的 answer 。我已经开发这个代码大约一年前用于搜索目的。 RMS的基本是平面文件的结构化版本。您无法触发RMS上的查询。没有内置的方法从RMS搜索记录。这就是为什么经过许多研究, d我开发了上面的代码。

The code you are talking in the question is method from my answer. I have developed this code about a year ago for searching purpose only. The basic of RMS is a structured version of flat file. You can not fire a query on RMS. There is no in-built method for searching records from RMS. This is the reason that after many r & d i developed the above code.

这篇关于数据库查询j2me包括条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆