⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updatetest.java

📁 Java写的TDS协议(JDBC/ODBC)实现
💻 JAVA
字号:
package net.sourceforge.jtds.test;

import java.sql.*;
import junit.framework.TestCase;

/**
 * @created    March 17, 2001
 * @version    1.0
 */

public class UpdateTest
         extends TestBase {

    public UpdateTest(String name)
    {
        super(name);
    }

    public void testTemp()
    throws Exception
    {
        Statement stmt = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY );

        stmt.execute( "CREATE TABLE #temp ( pk INT PRIMARY KEY, f_string VARCHAR(30), f_float FLOAT )" );

        //populate in the traditional way
        for ( int i=0; i<100; i++ ) {
            stmt.execute(
                "INSERT INTO #temp "
                + "VALUES( " + i
                + "," +  "'The String " + i + "'"
                + ", " + i + ")"
            );
        }

        dump( stmt.executeQuery( "SELECT Count(*) FROM #temp" ) );

        //Navigate around
        ResultSet rs = stmt.executeQuery( "SELECT * FROM #temp" );

        rs.first();
        dumpRow( rs );

        rs.last();
        dumpRow( rs );

        rs.first();
        dumpRow( rs );

        // SAfe Can no longer do this. It's going to be executed on a different Tds, which is wrong. :o(
//        stmt.execute( "DROP TABLE #temp" );

        stmt.close();
    }

    public static void main(String[] args)
    {
        junit.textui.TestRunner.run(UpdateTest.class);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -