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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? datetest.java

?? 開發(fā)MySql數(shù)據(jù)庫的最新JDBC驅(qū)動。
?? 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 testsuite.BaseTestCase;import java.sql.Connection;import java.sql.Date;import java.sql.PreparedStatement;import java.sql.SQLException;import java.sql.Statement;import java.sql.Time;import java.sql.Timestamp;import java.text.DateFormat;import java.text.SimpleDateFormat;import java.util.Calendar;import java.util.Locale;import java.util.Properties;import java.util.TimeZone;import com.mysql.jdbc.SQLError;/** *  * @author Mark Matthews * @version $Id: DateTest.java 5345 2006-06-01 20:18:04Z mmatthews $ */public class DateTest extends BaseTestCase {	// ~ Constructors	// -----------------------------------------------------------	/**	 * Creates a new DateTest object.	 * 	 * @param name	 *            DOCUMENT ME!	 */	public DateTest(String name) {		super(name);	}	// ~ Methods	// ----------------------------------------------------------------	/**	 * Runs all test cases in this test suite	 * 	 * @param args	 */	public static void main(String[] args) {		junit.textui.TestRunner.run(DateTest.class);	}	/**	 * DOCUMENT ME!	 * 	 * @throws Exception	 *             DOCUMENT ME!	 */	public void setUp() throws Exception {		super.setUp();		createTestTable();	}	/**	 * DOCUMENT ME!	 * 	 * @throws SQLException	 *             DOCUMENT ME!	 */	public void testTimestamp() throws SQLException {		this.pstmt = this.conn				.prepareStatement("INSERT INTO DATETEST(tstamp, dt, dtime, tm) VALUES (?, ?, ?, ?)");		// TimeZone.setDefault(TimeZone.getTimeZone("GMT"));		Calendar cal = Calendar.getInstance();		cal.set(Calendar.MONTH, 6);		cal.set(Calendar.DAY_OF_MONTH, 3);		cal.set(Calendar.YEAR, 2002);		cal.set(Calendar.HOUR, 7);		cal.set(Calendar.MINUTE, 0);		cal.set(Calendar.SECOND, 0);		cal.set(Calendar.MILLISECOND, 0);		cal.set(Calendar.AM_PM, Calendar.AM);		cal.getTime();		System.out.println(cal);		// DateFormat df = SimpleDateFormat.getInstance();		DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss z");		Calendar calGMT = Calendar.getInstance(TimeZone.getTimeZone("GMT"));		// df.setTimeZone(TimeZone.getTimeZone("GMT"));		Timestamp nowTstamp = new Timestamp(cal.getTime().getTime());		java.sql.Date nowDate = new java.sql.Date(cal.getTime().getTime());		Timestamp nowDatetime = new Timestamp(cal.getTime().getTime());		java.sql.Time nowTime = new java.sql.Time(cal.getTime().getTime());		System.out				.println("** Times with given calendar (before storing) **\n");		System.out.println("TIMESTAMP:\t" + nowTstamp.getTime() + " -> "				+ df.format(nowTstamp));		System.out.println("DATE:\t\t" + nowDate.getTime() + " -> "				+ df.format(nowDate));		System.out.println("DATETIME:\t" + nowDatetime.getTime() + " -> "				+ df.format(nowDatetime));		System.out.println("DATE:\t\t" + nowDate.getTime() + " -> "				+ df.format(nowDate));		System.out.println("TIME:\t\t" + nowTime.getTime() + " -> "				+ df.format(nowTime));		System.out.println("\n");		this.pstmt.setTimestamp(1, nowTstamp, calGMT);		// have to use the same TimeZone as used to create or there will be		// shift		this.pstmt.setDate(2, nowDate, cal);		this.pstmt.setTimestamp(3, nowDatetime, calGMT);		// have to use the same TimeZone as used to create or there will be		// shift		this.pstmt.setTime(4, nowTime, cal);		this.pstmt.execute();		this.pstmt.getUpdateCount();		this.pstmt.clearParameters();		this.rs = this.stmt.executeQuery("SELECT * from DATETEST");		java.sql.Date thenDate = null;		while (this.rs.next()) {			Timestamp thenTstamp = this.rs.getTimestamp(1, calGMT);			thenDate = this.rs.getDate(2, cal);			java.sql.Timestamp thenDatetime = this.rs.getTimestamp(3, calGMT);			java.sql.Time thenTime = this.rs.getTime(4, cal);			System.out					.println("** Times with given calendar (retrieved from database) **\n");			System.out.println("TIMESTAMP:\t" + thenTstamp.getTime() + " -> "					+ df.format(thenTstamp));			System.out.println("DATE:\t\t" + thenDate.getTime() + " -> "					+ df.format(thenDate));			System.out.println("DATETIME:\t" + thenDatetime.getTime() + " -> "					+ df.format(thenDatetime));			System.out.println("TIME:\t\t" + thenTime.getTime() + " -> "					+ df.format(thenTime));			System.out.println("\n");		}		this.rs.close();		this.rs = null;	}	public void testNanosParsing() throws SQLException {		try {			this.stmt.executeUpdate("DROP TABLE IF EXISTS testNanosParsing");			this.stmt					.executeUpdate("CREATE TABLE testNanosParsing (dateIndex int, field1 VARCHAR(32))");			this.stmt					.executeUpdate("INSERT INTO testNanosParsing VALUES (1, '1969-12-31 18:00:00.0'), "							+ "(2, '1969-12-31 18:00:00.90'), "							+ "(3, '1969-12-31 18:00:00.900'), "							+ "(4, '1969-12-31 18:00:00.9000'), "							+ "(5, '1969-12-31 18:00:00.90000'), "							+ "(6, '1969-12-31 18:00:00.900000'), "							+ "(7, '1969-12-31 18:00:00.')");			this.rs = this.stmt					.executeQuery("SELECT field1 FROM testNanosParsing ORDER BY dateIndex ASC");			assertTrue(this.rs.next());			assertTrue(this.rs.getTimestamp(1).getNanos() == 0);			assertTrue(this.rs.next());			assertTrue(this.rs.getTimestamp(1).getNanos() + " != 90", this.rs					.getTimestamp(1).getNanos() == 90);			assertTrue(this.rs.next());			assertTrue(this.rs.getTimestamp(1).getNanos() + " != 900", this.rs					.getTimestamp(1).getNanos() == 900);			assertTrue(this.rs.next());			assertTrue(this.rs.getTimestamp(1).getNanos() + " != 9000", this.rs					.getTimestamp(1).getNanos() == 9000);			assertTrue(this.rs.next());			assertTrue(this.rs.getTimestamp(1).getNanos() + " != 90000",					this.rs.getTimestamp(1).getNanos() == 90000);			assertTrue(this.rs.next());			assertTrue(this.rs.getTimestamp(1).getNanos() + " != 900000",					this.rs.getTimestamp(1).getNanos() == 900000);			assertTrue(this.rs.next());			try {				this.rs.getTimestamp(1);			} catch (SQLException sqlEx) {				assertTrue(SQLError.SQL_STATE_ILLEGAL_ARGUMENT.equals(sqlEx						.getSQLState()));			}		} finally {			this.stmt.executeUpdate("DROP TABLE IF EXISTS testNanosParsing");		}	}	private void createTestTable() throws SQLException {		//		// Catch the error, the table might exist		//		try {			this.stmt.executeUpdate("DROP TABLE DATETEST");		} catch (SQLException SQLE) {			;		}		this.stmt				.executeUpdate("CREATE TABLE DATETEST (tstamp TIMESTAMP, dt DATE, dtime DATETIME, tm TIME)");	}	/**	 * Tests the configurability of all-zero date/datetime/timestamp handling in	 * the driver.	 * 	 * @throws Exception	 *             if the test fails.	 */	public void testZeroDateBehavior() throws Exception {		try {			this.stmt					.executeUpdate("DROP TABLE IF EXISTS testZeroDateBehavior");			this.stmt					.executeUpdate("CREATE TABLE testZeroDateBehavior(fieldAsString VARCHAR(32), fieldAsDateTime DATETIME)");			this.stmt					.executeUpdate("INSERT INTO testZeroDateBehavior VALUES ('0000-00-00 00:00:00', '0000-00-00 00:00:00')");			Properties props = new Properties();			props.setProperty("zeroDateTimeBehavior", "round");			Connection roundConn = getConnectionWithProps(props);			Statement roundStmt = roundConn.createStatement();			this.rs = roundStmt					.executeQuery("SELECT fieldAsString, fieldAsDateTime FROM testZeroDateBehavior");			this.rs.next();			assertEquals("0001-01-01", this.rs.getDate(1).toString());			assertEquals("0001-01-01 00:00:00.0", 					new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.0", Locale.US).format(this.rs.getTimestamp(1)));			assertEquals("0001-01-01", this.rs.getDate(2).toString());			assertEquals("0001-01-01 00:00:00.0", 					new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.0", Locale.US).format(this.rs.getTimestamp(2)));			PreparedStatement roundPrepStmt = roundConn					.prepareStatement("SELECT fieldAsString, fieldAsDateTime FROM testZeroDateBehavior");			this.rs = roundPrepStmt.executeQuery();			this.rs.next();			assertEquals("0001-01-01", this.rs.getDate(1).toString());			assertEquals("0001-01-01 00:00:00.0", 					new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.0", Locale.US).format(this.rs.getTimestamp(1)));			assertEquals("0001-01-01", this.rs.getDate(2).toString());			assertEquals("0001-01-01 00:00:00.0", 					new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.0", Locale.US).format(this.rs.getTimestamp(2)));			props = new Properties();			props.setProperty("zeroDateTimeBehavior", "convertToNull");			Connection nullConn = getConnectionWithProps(props);			Statement nullStmt = nullConn.createStatement();			this.rs = nullStmt					.executeQuery("SELECT fieldAsString, fieldAsDateTime FROM testZeroDateBehavior");			this.rs.next();			assertTrue(null == this.rs.getDate(1));			assertTrue(null == this.rs.getTimestamp(1));			assertTrue(null == this.rs.getDate(2));			assertTrue(null == this.rs.getTimestamp(2));			PreparedStatement nullPrepStmt = nullConn					.prepareStatement("SELECT fieldAsString, fieldAsDateTime FROM testZeroDateBehavior");			this.rs = nullPrepStmt.executeQuery();			this.rs.next();			assertTrue(null == this.rs.getDate(1));			assertTrue(null == this.rs.getTimestamp(1));			assertTrue(null == this.rs.getDate(2));			assertTrue(null == this.rs.getTimestamp(2));			assertTrue(null == this.rs.getString(2));			props = new Properties();			props.setProperty("zeroDateTimeBehavior", "exception");			Connection exceptionConn = getConnectionWithProps(props);			Statement exceptionStmt = exceptionConn.createStatement();			this.rs = exceptionStmt					.executeQuery("SELECT fieldAsString, fieldAsDateTime FROM testZeroDateBehavior");			this.rs.next();			try {				this.rs.getDate(1);				fail("Exception should have been thrown when trying to retrieve invalid date");			} catch (SQLException sqlEx) {				assertTrue(SQLError.SQL_STATE_ILLEGAL_ARGUMENT.equals(sqlEx						.getSQLState()));			}			try {				this.rs.getTimestamp(1);				fail("Exception should have been thrown when trying to retrieve invalid date");			} catch (SQLException sqlEx) {				assertTrue(SQLError.SQL_STATE_ILLEGAL_ARGUMENT.equals(sqlEx						.getSQLState()));			}			try {				this.rs.getDate(2);				fail("Exception should have been thrown when trying to retrieve invalid date");			} catch (SQLException sqlEx) {				assertTrue(SQLError.SQL_STATE_ILLEGAL_ARGUMENT.equals(sqlEx						.getSQLState()));			}			try {				this.rs.getTimestamp(2);				fail("Exception should have been thrown when trying to retrieve invalid date");			} catch (SQLException sqlEx) {				assertTrue(SQLError.SQL_STATE_ILLEGAL_ARGUMENT.equals(sqlEx						.getSQLState()));			}			PreparedStatement exceptionPrepStmt = exceptionConn					.prepareStatement("SELECT fieldAsString, fieldAsDateTime FROM testZeroDateBehavior");			try {				this.rs = exceptionPrepStmt.executeQuery();				this.rs.next();				this.rs.getDate(2);				fail("Exception should have been thrown when trying to retrieve invalid date");			} catch (SQLException sqlEx) {				assertTrue(SQLError.SQL_STATE_ILLEGAL_ARGUMENT.equals(sqlEx						.getSQLState()));			}		} finally {			this.stmt					.executeUpdate("DROP TABLE IF EXISTS testZeroDateBehavior");		}	}	public void testReggieBug() throws Exception {		try {			this.stmt.executeUpdate("DROP TABLE IF EXISTS testReggieBug");			this.stmt.executeUpdate("CREATE TABLE testReggieBug (field1 DATE)");			PreparedStatement pStmt = this.conn					.prepareStatement("INSERT INTO testReggieBug VALUES (?)");			pStmt.setDate(1, new Date(2004 - 1900, 07, 28));			pStmt.executeUpdate();			this.rs = this.stmt.executeQuery("SELECT * FROM testReggieBug");			this.rs.next();			System.out.println(this.rs.getDate(1));			this.rs = this.conn.prepareStatement("SELECT * FROM testReggieBug")					.executeQuery();			this.rs.next();			System.out.println(this.rs.getDate(1));		} finally {			this.stmt.executeUpdate("DROP TABLE IF EXISTS testReggieBug");		}	}		public void testNativeConversions() throws Exception {		Timestamp ts = new Timestamp(System.currentTimeMillis());		Date dt = new Date(ts.getTime());		Time tm = new Time(ts.getTime());				createTable("testNativeConversions", "(time_field TIME, date_field DATE, datetime_field DATETIME, timestamp_field TIMESTAMP)");		this.pstmt = this.conn.prepareStatement("INSERT INTO testNativeConversions VALUES (?,?,?,?)");		this.pstmt.setTime(1, tm);		this.pstmt.setDate(2, dt);		this.pstmt.setTimestamp(3, ts);		this.pstmt.setTimestamp(4, ts);		this.pstmt.execute();		this.pstmt.close();				this.pstmt = this.conn.prepareStatement("SELECT time_field, date_field, datetime_field, timestamp_field FROM testNativeConversions");		this.rs = this.pstmt.executeQuery();		assertTrue(this.rs.next());		System.out.println(this.rs.getTime(1));		System.out.println(this.rs.getTime(2));		System.out.println(this.rs.getTime(3));		System.out.println(this.rs.getTime(4));		System.out.println();		System.out.println(this.rs.getDate(1));		System.out.println(this.rs.getDate(2));		System.out.println(this.rs.getDate(3));		System.out.println(this.rs.getDate(4));		System.out.println();		System.out.println(this.rs.getTimestamp(1));		System.out.println(this.rs.getTimestamp(2));		System.out.println(this.rs.getTimestamp(3));		System.out.println(this.rs.getTimestamp(4));	}		}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产99久久久久久免费看农村| 一本色道综合亚洲| 亚洲丝袜美腿综合| 日韩免费观看高清完整版 | 蜜桃久久久久久久| 亚洲精品乱码久久久久久久久| 精品国产乱码久久久久久久久| 欧美综合在线视频| 成人av网站大全| 韩国成人精品a∨在线观看| 亚洲国产精品久久不卡毛片| 日本一区二区三区四区| 欧美一级黄色录像| 色悠悠久久综合| 成人av在线一区二区三区| 久久99精品国产.久久久久久| 亚洲午夜成aⅴ人片| 国产精品―色哟哟| 久久先锋影音av| 日韩欧美一二区| 91精品国产色综合久久不卡蜜臀 | 欧美一区二区三区在线看| 91麻豆免费观看| 丁香桃色午夜亚洲一区二区三区| 美美哒免费高清在线观看视频一区二区 | 久久精品国产亚洲5555| 午夜精品久久久久影视| 亚洲影视在线播放| 亚洲一区在线电影| 亚洲精品一二三| 亚洲欧美另类图片小说| 国产精品丝袜一区| 中文字幕二三区不卡| 久久久久亚洲蜜桃| 久久综合九色综合久久久精品综合| 91精品国产品国语在线不卡| 欧美日韩国产成人在线91| 欧美天堂亚洲电影院在线播放| 91在线无精精品入口| 91网页版在线| 91伊人久久大香线蕉| 91玉足脚交白嫩脚丫在线播放| 91在线视频免费观看| 色婷婷激情综合| 欧美性生活大片视频| 欧美日韩免费观看一区三区| 欧美精品99久久久**| 91精品欧美综合在线观看最新 | 日韩一区二区在线观看视频| 欧美一区二区三区四区高清| 欧美大肚乱孕交hd孕妇| 精品国产一区二区三区av性色| 精品国产乱码久久久久久夜甘婷婷 | 久久久久久久久免费| 国产午夜三级一区二区三| 欧美国产精品一区| 亚洲天天做日日做天天谢日日欢| 亚洲综合一区二区三区| 日韩国产高清影视| 国产一区二区三区精品欧美日韩一区二区三区| 国产综合久久久久影院| 成人av高清在线| 在线观看视频91| 欧美xxxxx牲另类人与| 欧美韩日一区二区三区| 一区二区三区欧美激情| 日本vs亚洲vs韩国一区三区二区| 韩国精品一区二区| 91视频免费观看| 日韩一区二区电影| 欧美高清在线精品一区| 亚洲综合色成人| 久久99精品久久久| 99精品欧美一区二区三区小说| 欧美剧情电影在线观看完整版免费励志电影| 91精品国产91热久久久做人人| 欧美经典一区二区| 亚洲第四色夜色| 国产一区二区不卡| 欧美丝袜自拍制服另类| wwwwxxxxx欧美| 一区二区三区在线观看网站| 久久精品国产一区二区三| 99精品视频一区二区| 日韩亚洲欧美中文三级| 国产精品第四页| 精品一区二区在线播放| 日本精品一级二级| 久久噜噜亚洲综合| 五月激情综合婷婷| 99视频一区二区| 亚洲精品一区二区三区四区高清| 亚洲色大成网站www久久九九| 六月婷婷色综合| 欧洲中文字幕精品| 国产精品毛片a∨一区二区三区| 日韩—二三区免费观看av| 97久久精品人人澡人人爽| 精品国产乱码久久久久久夜甘婷婷| 一区二区不卡在线播放| 懂色av中文一区二区三区| 欧美一卡2卡3卡4卡| 亚洲欧美一区二区三区久本道91 | 黄色日韩网站视频| 欧美视频日韩视频在线观看| 国产欧美日韩三区| 久久99日本精品| 欧美日韩成人在线| 一区二区三区日本| 99国产麻豆精品| 国产亚洲一区二区三区在线观看| 日本亚洲电影天堂| 欧美图区在线视频| 亚洲精品乱码久久久久久| 成人av资源下载| 国产欧美综合色| 国产高清不卡一区| 久久久久久电影| 国产一区二区三区视频在线播放| 日韩美女主播在线视频一区二区三区| 亚洲国产综合人成综合网站| 色综合色狠狠天天综合色| 亚洲欧洲日韩一区二区三区| 国产a视频精品免费观看| 2021久久国产精品不只是精品| 奇米精品一区二区三区四区| 欧美三片在线视频观看| 亚洲在线免费播放| 欧美中文字幕一区二区三区| 亚洲精品视频在线| 色哟哟国产精品免费观看| 自拍偷拍亚洲激情| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 欧美天堂亚洲电影院在线播放| 亚洲一区在线视频观看| 色八戒一区二区三区| 亚洲乱码国产乱码精品精的特点| 91麻豆国产自产在线观看| 亚洲天堂av一区| 在线亚洲欧美专区二区| 亚洲专区一二三| 在线电影一区二区三区| 蜜桃av噜噜一区二区三区小说| wwwwxxxxx欧美| 国产成人精品免费在线| 国产精品第一页第二页第三页 | 精品电影一区二区| 国产在线一区二区综合免费视频| 精品国产髙清在线看国产毛片| 国产一区二区久久| 亚洲国产成人午夜在线一区| 国产成a人亚洲精品| 亚洲色图制服丝袜| 欧美午夜电影在线播放| 午夜精品成人在线视频| 日韩一区二区三区电影| 国内不卡的二区三区中文字幕| 亚洲国产激情av| 色94色欧美sute亚洲13| 午夜精品久久久久久久久久久| 日韩你懂的在线观看| 成人永久看片免费视频天堂| 亚洲免费观看高清在线观看| 欧美高清视频不卡网| 国产真实乱偷精品视频免| 综合久久一区二区三区| 欧美一区二视频| 高清不卡在线观看| 亚洲二区在线观看| 久久只精品国产| 色婷婷综合久色| 麻豆精品精品国产自在97香蕉| 久久精品视频免费| 欧美日韩亚洲综合在线| 国产一区二区在线观看视频| ...av二区三区久久精品| 制服丝袜亚洲精品中文字幕| 国产精品系列在线观看| 亚洲福利一二三区| 日本一区二区在线不卡| 欧美日韩一本到| av高清久久久| 另类中文字幕网| 亚洲一区中文日韩| 国产欧美日本一区视频| 在线综合亚洲欧美在线视频 | 911国产精品| a美女胸又www黄视频久久| 日韩电影在线看| 日韩一区日韩二区| 久久久久免费观看| 91精品国产色综合久久不卡电影| 99久久精品国产麻豆演员表| 奇米精品一区二区三区四区 | 国产99久久久国产精品潘金| 五月婷婷欧美视频| 中文字幕视频一区二区三区久| 日韩欧美国产系列| 欧美日产在线观看| 色哟哟一区二区三区|