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

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

?? datetest.java

?? 用于JAVA數(shù)據(jù)庫連接.解壓就可用,方便得很
?? 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一区二区三区免费野_久草精品视频
欧美日韩国产综合一区二区三区 | 亚洲国产综合人成综合网站| 国产69精品一区二区亚洲孕妇| 久久精品这里都是精品| 久久精品国产澳门| 久久精品欧美一区二区三区不卡| 国产精品综合在线视频| 中文字幕亚洲精品在线观看 | 日本韩国一区二区三区视频| 亚洲宅男天堂在线观看无病毒| 欧美日韩一区不卡| 激情都市一区二区| 中文字幕一区二区三区在线观看| 在线观看中文字幕不卡| 久久国产精品72免费观看| 国产丝袜美腿一区二区三区| 91久久精品一区二区三| 日本欧美肥老太交大片| 国产日本一区二区| 欧美午夜寂寞影院| 国产精品中文欧美| 一区二区三区免费| 精品日本一线二线三线不卡| av在线不卡网| 日日摸夜夜添夜夜添亚洲女人| 国产午夜精品久久久久久久| 色噜噜狠狠色综合中国| 久久不见久久见中文字幕免费| 国产精品卡一卡二卡三| 欧美日韩一区在线观看| 国产福利一区二区三区视频在线 | 亚洲一区二区在线观看视频| 欧美videos中文字幕| 色综合天天性综合| 国产一区二区三区久久久| 一区二区三区精品视频| 久久综合99re88久久爱| 欧美三级视频在线| 成人黄色网址在线观看| 麻豆专区一区二区三区四区五区| 中文字幕一区二区三| 精品国产免费一区二区三区香蕉| 色天使色偷偷av一区二区| 国产专区综合网| 午夜精品在线看| 亚洲码国产岛国毛片在线| 337p日本欧洲亚洲大胆精品| 日本韩国精品在线| 国产成人精品免费一区二区| 欧美96一区二区免费视频| 依依成人综合视频| 亚洲国产高清在线| 欧美精品一区视频| 欧美日韩精品欧美日韩精品一综合| 国产mv日韩mv欧美| 日韩专区欧美专区| 亚洲伊人伊色伊影伊综合网| 亚洲同性同志一二三专区| 久久女同性恋中文字幕| 欧美一区二区三区在线观看| 欧美日韩综合在线免费观看| 色欧美片视频在线观看在线视频| 成人免费视频视频| 国产乱码精品一区二区三区忘忧草| 日韩精品午夜视频| 五月综合激情婷婷六月色窝| 一区二区成人在线视频| 一区二区三区四区乱视频| 国产亚洲精品久| www国产成人免费观看视频 深夜成人网| 欧美一区二区视频在线观看2022| 欧美日韩大陆一区二区| 欧美日韩一区久久| 欧美日韩免费电影| 欧美男女性生活在线直播观看| 91久久人澡人人添人人爽欧美| 91丨九色丨尤物| 91年精品国产| 欧美伊人精品成人久久综合97| 色香色香欲天天天影视综合网| 91老师国产黑色丝袜在线| 色综合色狠狠综合色| 欧美在线免费视屏| 欧美亚洲国产一区二区三区va| 欧美性感一区二区三区| 欧美欧美欧美欧美| 欧美一级免费观看| 久久综合精品国产一区二区三区| 久久免费精品国产久精品久久久久| 精品少妇一区二区三区在线视频| 精品欧美久久久| 国产农村妇女毛片精品久久麻豆 | 久久久久久亚洲综合| 久久女同性恋中文字幕| 国产性色一区二区| 国产精品短视频| 亚洲国产综合人成综合网站| 蜜桃视频在线观看一区| 国产麻豆9l精品三级站| 成人免费视频播放| 欧美影院一区二区| 日韩视频一区二区| 中文字幕不卡三区| 亚洲综合免费观看高清完整版在线 | 国产sm精品调教视频网站| 99久久er热在这里只有精品66| 91福利区一区二区三区| 337p亚洲精品色噜噜| 国产亚洲婷婷免费| 亚洲一区二区三区四区在线免费观看| 香蕉成人啪国产精品视频综合网| 激情久久五月天| 在线观看欧美日本| 精品国精品自拍自在线| 亚洲私人影院在线观看| 午夜精品久久久久久久久久久| 国产乱码精品一区二区三区av| 在线看国产一区| 久久综合久久鬼色| 亚洲一级二级在线| 国产乱人伦精品一区二区在线观看| 91影视在线播放| 久久久精品免费免费| 午夜天堂影视香蕉久久| 国产成人精品三级麻豆| 日韩一区二区三区观看| 亚洲欧美激情一区二区| 国产在线精品一区在线观看麻豆| 91官网在线免费观看| 久久影院午夜论| 日韩专区欧美专区| 一本一本大道香蕉久在线精品| 精品久久人人做人人爰| 亚洲综合色噜噜狠狠| bt欧美亚洲午夜电影天堂| 欧美tk—视频vk| 天天色图综合网| 色婷婷国产精品| 国产精品久久久久影院亚瑟| 老司机免费视频一区二区| 欧美三级电影精品| 亚洲精品久久久蜜桃| 成人妖精视频yjsp地址| 精品久久久久久久人人人人传媒 | 91精品国产一区二区人妖| 亚洲人被黑人高潮完整版| 国产精品69久久久久水密桃| 欧美一区二区三区免费视频| 一区二区三区欧美在线观看| 91污片在线观看| 国产精品国模大尺度视频| 国产成人av电影在线观看| 久久伊人蜜桃av一区二区| 日韩电影一二三区| 欧美精品在线观看播放| 亚洲超丰满肉感bbw| 在线一区二区视频| 樱花草国产18久久久久| 色婷婷国产精品久久包臀| 亚洲天堂福利av| 99久久er热在这里只有精品15| 国产精品网友自拍| 白白色 亚洲乱淫| 国产精品激情偷乱一区二区∴| 国产不卡高清在线观看视频| 久久久精品日韩欧美| 国产高清精品在线| 国产精品女同互慰在线看 | 日本韩国欧美一区二区三区| 亚洲人妖av一区二区| 91在线视频观看| 亚洲精品自拍动漫在线| 在线视频国内一区二区| 亚洲一区二区欧美| 7777精品伊人久久久大香线蕉经典版下载 | 国产精品一二三| 欧美激情一区三区| www.成人网.com| 一区二区三区在线视频免费观看| 欧美又粗又大又爽| 亚洲成人黄色影院| 日韩免费福利电影在线观看| 韩日精品视频一区| 亚洲国产精品传媒在线观看| 成人动漫在线一区| 一区二区三区在线观看动漫| 欧美精品久久99| 国产一区二区三区在线观看免费| 国产欧美一区二区精品忘忧草| 99在线热播精品免费| 亚洲国产精品综合小说图片区| 欧美一级精品大片| 粉嫩久久99精品久久久久久夜| 亚洲人123区| 日韩午夜在线播放| 成人av片在线观看| 无吗不卡中文字幕| 国产午夜精品福利| 在线观看av一区二区| 久久成人免费电影|