打印本文 打印本文 关闭窗口 关闭窗口
在java中实现sql的select函数功能
作者:武汉SEO闵涛  文章来源:敏韬网  点击数7732  更新时间:2007/11/14 12:57:01  文章录入:mintao  责任编辑:mintao
然后把这些OrderInstruction对象加入OrderInstruciton[]:

OrderInstruction [] orderInstructions = new OrderInstruction [2];

orderInstructions[0] = colorOrderInstruction;

orderInstructions [1] = speedOrderInstruction;

5.加入选择指令,数据,条件和排序指令到SelectStatement中:

SelectStatement selectStatement  = new SelectStatement(selectInstructions, data,

            conditions, orderInstructions);

6.执行这个Statemment并得到返回结果:

ResultTable resultTable  = new Executor().execute(selectStatement );

7.操作得到的结果级。比如:

System.out.print("Columns:");

        for(int i = 0; i < resultTable.getColumnNames().length; i ++){

            System.out.print("\t");

            System.out.print(resultTable.getColumnNames()[i]);

        }

       

        Object[][] resultData = resultTable.getResultData();

        for(int i = 0; i < resultData.length; i ++){

            System.out.println();

            System.out.print("Row " + i + "  :");

            for(int e = 0; e < resultData[i].length; e ++){

                System.out.print("\t");

                System.out.print(resultData[i][e]);

            }

           

        }

这太复杂了,帮帮我吧!

如果你只想显示所有public getter()提供的属性该怎么做?如下代码就好了:

SelectInstruction[] selectInstructions = new SelectInstruction[]{new SelectInstruction("*", null)};

ResultTable resultTable = new Executor().ex

上一页  [1] [2] [3] [4] [5] [6] [7] [8]  下一页

打印本文 打印本文 关闭窗口 关闭窗口