亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? updatabilitytest.java

?? 用于JAVA數據庫連接.解壓就可用,方便得很
?? JAVA
字號:
/* Copyright (C) 2002-2004 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as  published by the Free Software Foundation. There are special exceptions to the terms and conditions of the GPL  as it is applied to this software. View the full text of the  exception in file EXCEPTIONS-CONNECTOR-J in the directory of this  software distribution. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */package testsuite.simple;import com.mysql.jdbc.NotUpdatable;import testsuite.BaseTestCase;import java.sql.DatabaseMetaData;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;/** * Tests for updatable result sets *  * @author Mark Matthews * @version $Id: UpdatabilityTest.java,v 1.1.2.1 2005/05/13 18:58:37 mmatthews *          Exp $ */public class UpdatabilityTest extends BaseTestCase {	/**	 * Creates a new UpdatabilityTest object.	 * 	 * @param name	 *            DOCUMENT ME!	 */	public UpdatabilityTest(String name) {		super(name);	}	/**	 * Runs all test cases in this test suite	 * 	 * @param args	 */	public static void main(String[] args) {		junit.textui.TestRunner.run(UpdatabilityTest.class);	}	/**	 * DOCUMENT ME!	 * 	 * @throws Exception	 *             DOCUMENT ME!	 */	public void setUp() throws Exception {		super.setUp();		createTestTable();	}	/**	 * If using MySQL-4.1, tests if aliased tables work as updatable result	 * sets.	 * 	 * @throws Exception	 *             if an error occurs	 */	public void testAliasedTables() throws Exception {		DatabaseMetaData dbmd = this.conn.getMetaData();		if (versionMeetsMinimum(4, 1)) {			Statement scrollableStmt = null;			try {				scrollableStmt = this.conn.createStatement(						ResultSet.TYPE_SCROLL_INSENSITIVE,						ResultSet.CONCUR_UPDATABLE);				this.rs = scrollableStmt						.executeQuery("SELECT pos1 AS p1, pos2 AS P2, char_field AS cf FROM UPDATABLE AS UPD LIMIT 1");				this.rs.next();				this.rs.close();				this.rs = null;				scrollableStmt.close();				scrollableStmt = null;			} finally {				if (this.rs != null) {					try {						this.rs.close();					} catch (SQLException sqlEx) {						; // ignore					}					this.rs = null;				}				if (scrollableStmt != null) {					try {						scrollableStmt.close();					} catch (SQLException sqlEx) {						; // ignore					}					scrollableStmt = null;				}			}		}	}	/**	 * Tests that the driver does not let you update result sets that come from	 * tables that don't have primary keys	 * 	 * @throws SQLException	 *             if an error occurs	 */	public void testBogusTable() throws SQLException {		this.stmt.executeUpdate("DROP TABLE IF EXISTS BOGUS_UPDATABLE");		this.stmt.executeUpdate("CREATE TABLE BOGUS_UPDATABLE (field1 int)");		Statement scrollableStmt = null;		try {			scrollableStmt = this.conn.createStatement(					ResultSet.TYPE_SCROLL_INSENSITIVE,					ResultSet.CONCUR_UPDATABLE);			this.rs = scrollableStmt					.executeQuery("SELECT * FROM BOGUS_UPDATABLE");			try {				this.rs.moveToInsertRow();				fail("ResultSet.moveToInsertRow() should not succeed on non-updatable table");			} catch (NotUpdatable noUpdate) {				// ignore			}		} finally {			if (scrollableStmt != null) {				try {					scrollableStmt.close();				} catch (SQLException sqlEx) {					;				}			}			this.stmt.executeUpdate("DROP TABLE IF EXISTS BOGUS_UPDATABLE");		}	}	/**	 * Tests that the driver does not let you update result sets that come from	 * queries that haven't selected all primary keys	 * 	 * @throws SQLException	 *             if an error occurs	 */	public void testMultiKeyTable() throws SQLException {		this.stmt.executeUpdate("DROP TABLE IF EXISTS MULTI_UPDATABLE");		this.stmt				.executeUpdate("CREATE TABLE MULTI_UPDATABLE (field1 int NOT NULL, field2 int NOT NULL, PRIMARY KEY (field1, field2))");		Statement scrollableStmt = null;		try {			scrollableStmt = this.conn.createStatement(					ResultSet.TYPE_SCROLL_INSENSITIVE,					ResultSet.CONCUR_UPDATABLE);			this.rs = scrollableStmt					.executeQuery("SELECT field1 FROM MULTI_UPDATABLE");			try {				this.rs.moveToInsertRow();				fail("ResultSet.moveToInsertRow() should not succeed on query that does not select all primary keys");			} catch (NotUpdatable noUpdate) {				// ignore			}		} finally {			if (scrollableStmt != null) {				try {					scrollableStmt.close();				} catch (SQLException sqlEx) {					// ignore				}			}			this.stmt.executeUpdate("DROP TABLE IF EXISTS MULTI_UPDATABLE");		}	}	/**	 * DOCUMENT ME!	 * 	 * @throws SQLException	 *             DOCUMENT ME!	 */	public void testUpdatability() throws SQLException {		Statement scrollableStmt = null;		try {			scrollableStmt = this.conn.createStatement(					ResultSet.TYPE_SCROLL_INSENSITIVE,					ResultSet.CONCUR_UPDATABLE);			this.rs = scrollableStmt					.executeQuery("SELECT * FROM UPDATABLE ORDER BY pos1");			this.rs.getMetaData().getColumnCount();			while (this.rs.next()) {				int rowPos = this.rs.getInt(1);				this.rs.updateString(3, "New Data" + (100 - rowPos));				this.rs.updateRow();			}			//			// Insert a new row			//			this.rs.moveToInsertRow();			this.rs.updateInt(1, 400);			this.rs.updateInt(2, 400);			this.rs.updateString(3, "New Data" + (100 - 400));			this.rs.insertRow();			// Test moveToCurrentRow			int rememberedPosition = this.rs.getRow();			this.rs.moveToInsertRow();			this.rs.moveToCurrentRow();			assertTrue("ResultSet.moveToCurrentRow() failed",					this.rs.getRow() == rememberedPosition);			this.rs.close();			this.rs = scrollableStmt					.executeQuery("SELECT * FROM UPDATABLE ORDER BY pos1");			boolean dataGood = true;			while (this.rs.next()) {				int rowPos = this.rs.getInt(1);				if (!this.rs.getString(3).equals("New Data" + (100 - rowPos))) {					dataGood = false;				}			}			assertTrue("Updates failed", dataGood);			// move back, and change the primary key			// This should work			int newPrimaryKeyId = 99999;			this.rs.absolute(1);			this.rs.updateInt(1, newPrimaryKeyId);			this.rs.updateRow();			int savedPrimaryKeyId = this.rs.getInt(1);			assertTrue("Updated primary key does not match",					(newPrimaryKeyId == savedPrimaryKeyId));			// Check cancelRowUpdates()			this.rs.absolute(1);			int primaryKey = this.rs.getInt(1);			int originalValue = this.rs.getInt(2);			this.rs.updateInt(2, -3);			this.rs.cancelRowUpdates();			int newValue = this.rs.getInt(2);			assertTrue("ResultSet.cancelRowUpdates() failed",					newValue == originalValue);			// Now check refreshRow()			// Check cancelRowUpdates()			this.rs.absolute(1);			primaryKey = this.rs.getInt(1);			this.stmt					.executeUpdate("UPDATE UPDATABLE SET char_field='foo' WHERE pos1="							+ primaryKey);			this.rs.refreshRow();			assertTrue("ResultSet.refreshRow failed", this.rs.getString(					"char_field").equals("foo"));			// Now check deleteRow()			this.rs.last();			int oldLastRow = this.rs.getRow();			this.rs.deleteRow();			this.rs.last();			assertTrue("ResultSet.deleteRow() failed",					this.rs.getRow() == (oldLastRow - 1));			this.rs.close();			/*			 * FIXME: Move to regression			 * 			 * scrollableStmt.executeUpdate("DROP TABLE IF EXISTS test");			 * scrollableStmt.executeUpdate("CREATE TABLE test (ident INTEGER			 * PRIMARY KEY, name TINYTEXT, expiry DATETIME default null)");			 * scrollableStmt.executeUpdate("INSERT INTO test SET ident=1,			 * name='original'");			 * 			 * //Select to get a resultset to work on ResultSet this.rs =			 * this.stmt.executeQuery("SELECT ident, name, expiry FROM test");			 * 			 * //Check that the expiry field was null before we did our update			 * this.rs.first();			 * 			 * java.sql.Date before = this.rs.getDate("expiry");			 * 			 * if (this.rs.wasNull()) { System.out.println("Expiry was correctly			 * SQL null before update"); }			 * 			 * //Update a different field this.rs.updateString("name",			 * "Updated"); this.rs.updateRow();			 * 			 * //Test to see if field has been altered java.sql.Date after =			 * this.rs.getDate(3);			 * 			 * if (this.rs.wasNull()) System.out.println("Bug disproved - expiry			 * SQL null after update"); else System.out.println("Bug proved -			 * expiry corrupted to '" + after + "'");			 */		} finally {			if (scrollableStmt != null) {				try {					scrollableStmt.close();				} catch (SQLException sqlEx) {					;				}			}		}	}	private void createTestTable() throws SQLException {		//		// Catch the error, the table might exist		//		try {			this.stmt.executeUpdate("DROP TABLE UPDATABLE");		} catch (SQLException SQLE) {			;		}		this.stmt				.executeUpdate("CREATE TABLE UPDATABLE (pos1 int not null, pos2 int not null, char_field VARCHAR(32), PRIMARY KEY (pos1, pos2))");		for (int i = 0; i < 100; i++) {			this.stmt.executeUpdate("INSERT INTO UPDATABLE VALUES (" + i + ", "					+ i + ",'StringData" + i + "')");		}	}}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品不卡在线| 男女性色大片免费观看一区二区 | 欧美一级高清片| 日本高清无吗v一区| 国产精品18久久久久久久久| 日韩高清不卡一区二区三区| 亚洲一区二区三区四区在线观看 | 亚洲视频在线一区二区| 久久青草欧美一区二区三区| 日韩欧美一区电影| 91麻豆精品国产自产在线| 欧美性猛片aaaaaaa做受| 色一区在线观看| 91在线小视频| 色综合咪咪久久| 色一情一乱一乱一91av| 99久久夜色精品国产网站| 91免费国产在线观看| 91免费视频网| 91在线小视频| 99re热这里只有精品视频| av综合在线播放| 91麻豆.com| 欧美中文字幕一区| 欧美日本不卡视频| 欧美色图激情小说| 欧美日韩中文精品| 日韩三级电影网址| 国产三级精品在线| 亚洲女与黑人做爰| 亚洲国产成人av网| 美女视频黄免费的久久 | 亚洲v中文字幕| 日本欧美韩国一区三区| 久久99热国产| 国产69精品久久久久毛片| 国产91精品一区二区麻豆亚洲| 国产成人午夜精品5599| 久久国产日韩欧美精品| 成人av免费在线| 欧美日韩中文精品| 久久天堂av综合合色蜜桃网 | 蜜臀久久久久久久| 国产一区二区三区久久久| 国产成人在线免费| 91精品福利视频| 日韩欧美成人激情| 亚洲欧洲av一区二区三区久久| 亚洲1区2区3区4区| 精品一区二区精品| 欧洲另类一二三四区| 精品国产一区二区三区不卡| 精品国产区一区| 亚洲欧美日韩系列| 国产真实精品久久二三区| 99久久精品国产精品久久| 欧美乱妇23p| 国产精品美女久久久久久2018 | 蜜桃av一区二区三区| 成人性生交大片免费看视频在线| 色欧美日韩亚洲| 精品福利av导航| 亚洲国产视频在线| av激情成人网| 久久久精品黄色| 蜜桃久久精品一区二区| 91免费国产视频网站| 久久夜色精品国产噜噜av| 丝袜美腿亚洲一区二区图片| 国产成人综合在线播放| 欧美一区二区三区视频免费 | 在线不卡一区二区| 亚洲日本乱码在线观看| 韩国av一区二区三区| 欧美丝袜自拍制服另类| 中文字幕在线观看不卡视频| 狠狠狠色丁香婷婷综合激情 | 欧美性受xxxx| 国产精品久久久久久亚洲毛片 | 麻豆精品视频在线观看视频| 欧美中文字幕一二三区视频| 亚洲三级电影全部在线观看高清| 久久成人免费网| 日韩视频在线你懂得| 亚欧色一区w666天堂| 欧美偷拍一区二区| 亚洲黄网站在线观看| 91视频免费看| 亚洲综合在线五月| 91国内精品野花午夜精品 | 国产在线一区观看| 欧美精品一区二区精品网| 视频一区二区三区入口| 99久久精品免费看| 亚洲欧美日韩在线不卡| 在线免费观看一区| 亚洲成av人影院| 91精品国产综合久久久久久 | 欧美三级乱人伦电影| 一区二区三区国产| 日韩片之四级片| 成人国产亚洲欧美成人综合网| 一区二区三区日韩| 精品国产一区二区三区四区四| 91在线视频18| 男人操女人的视频在线观看欧美| 国产日韩视频一区二区三区| 日本韩国欧美一区二区三区| 免费成人在线网站| 亚洲情趣在线观看| 精品国产一区二区精华| 在线观看网站黄不卡| 国产精品一区二区在线播放| 樱桃国产成人精品视频| 精品国产91亚洲一区二区三区婷婷| 懂色av一区二区三区免费看| 日韩和欧美一区二区| 国产精品美女一区二区| 欧美成人综合网站| 色综合天天综合狠狠| 国模冰冰炮一区二区| 亚洲第一福利视频在线| 中文字幕免费不卡| 欧美大片在线观看| 欧美另类久久久品| 色哟哟精品一区| 成人动漫一区二区三区| 韩国精品免费视频| 日韩av高清在线观看| 亚洲人一二三区| 欧美激情在线免费观看| 欧美成va人片在线观看| 欧美日韩精品一区二区三区| www.亚洲激情.com| 国产激情视频一区二区在线观看 | 香蕉成人伊视频在线观看| 亚洲国产精品高清| 久久日一线二线三线suv| 欧美一区二区视频在线观看| 91浏览器在线视频| 97久久久精品综合88久久| 丁香一区二区三区| 国产成人在线看| 国产电影精品久久禁18| 激情都市一区二区| 国产一二精品视频| 国内精品不卡在线| 国模一区二区三区白浆| 蜜桃视频在线观看一区| 麻豆免费看一区二区三区| 奇米综合一区二区三区精品视频| 视频一区中文字幕| 蜜臀av亚洲一区中文字幕| 视频一区免费在线观看| 日韩不卡免费视频| 免费欧美高清视频| 久久爱另类一区二区小说| 激情图片小说一区| 国产不卡视频一区| 不卡视频一二三四| 色婷婷激情综合| 在线观看日韩一区| 欧美精品一级二级| 日韩精品一区二区三区视频| 久久欧美一区二区| 中文字幕一区二区三区四区 | 午夜久久久久久电影| 丝袜脚交一区二区| 激情国产一区二区| 成人午夜又粗又硬又大| 91丨九色丨黑人外教| 欧美在线免费观看视频| 欧美一区二区三区免费视频| 欧美tickling挠脚心丨vk| 久久久不卡网国产精品二区| 国产精品久久久久一区二区三区共| 亚洲欧美日韩国产成人精品影院| 亚洲与欧洲av电影| 极品尤物av久久免费看| 白白色亚洲国产精品| 69堂精品视频| 久久精品在线观看| 亚洲综合一二三区| 韩国成人福利片在线播放| 一本大道久久精品懂色aⅴ| 777亚洲妇女| 欧美国产1区2区| 日韩精品亚洲专区| 国产不卡高清在线观看视频| 欧美日韩一区成人| 欧美国产成人在线| 人禽交欧美网站| 日本韩国精品在线| 国产丝袜在线精品| 香蕉成人啪国产精品视频综合网| 懂色av一区二区夜夜嗨| 日韩写真欧美这视频| 亚洲乱码中文字幕| 国产成人超碰人人澡人人澡| 欧美日产在线观看|