本文整理汇总了Java中org.hsqldb.types.TimestampData类的典型用法代码示例。如果您正苦于以下问题:Java TimestampData类的具体用法?Java TimestampData怎么用?Java TimestampData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TimestampData类属于org.hsqldb.types包,在下文中一共展示了TimestampData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: readDate
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
protected TimestampData readDate(Type type) throws IOException {
readField();
if (value == null) {
return null;
}
if (version18) {
java.sql.Date dateTime = java.sql.Date.valueOf((String) value);
long millis =
HsqlDateTime.convertMillisFromCalendar(tempCalDefault,
dateTime.getTime());
millis = HsqlDateTime.getNormalisedDate(millis);
return new TimestampData(millis / 1000);
}
return scanner.newDate((String) value);
}
开发者ID:Julien35,项目名称:dev-courses,代码行数:22,代码来源:RowInputTextLog.java
示例2: newDate
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
public TimestampData newDate(String s) {
intervalPosition = 0;
fractionPrecision = 0;
dateTimeType = null;
intervalString = s;
scanDateParts(2);
if (intervalPosition != s.length()) {
throw Error.error(ErrorCode.X_22007);
}
long seconds = HsqlDateTime.getDateSeconds(s);
return new TimestampData(seconds);
}
开发者ID:Julien35,项目名称:dev-courses,代码行数:18,代码来源:Scanner.java
示例3: readTimestamp
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
protected TimestampData readTimestamp(Type type) throws IOException {
readField();
if (value == null) {
return null;
}
if (version18) {
java.sql.Timestamp dateTime =
java.sql.Timestamp.valueOf((String) value);
long millis =
HsqlDateTime.convertMillisFromCalendar(tempCalDefault,
dateTime.getTime());
int nanos = dateTime.getNanos();
nanos = ((DateTimeType) type).normaliseFraction(nanos, type.scale);
return new TimestampData(millis / 1000, nanos, 0);
}
return scanner.newTimestamp((String) value);
}
开发者ID:Julien35,项目名称:dev-courses,代码行数:24,代码来源:RowInputTextLog.java
示例4: readTimestamp
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
protected TimestampData readTimestamp(Type type) {
readField();
if (value == null) {
return null;
}
if (version18) {
java.sql.Timestamp dateTime =
java.sql.Timestamp.valueOf((String) value);
long millis =
HsqlDateTime.convertMillisFromCalendar(tempCalDefault,
dateTime.getTime());
int nanos = dateTime.getNanos();
nanos = DateTimeType.normaliseFraction(nanos, type.scale);
return new TimestampData(millis / 1000, nanos, 0);
}
return scanner.newTimestamp((String) value);
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:24,代码来源:RowInputTextLog.java
示例5: writeTimestamp
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
protected void writeTimestamp(TimestampData o, Type type) {
if (type.typeCode == Types.SQL_TIMESTAMP) {
long millis = o.getSeconds() * 1000L;
millis = HsqlDateTime.convertMillisToCalendar(tempCalDefault,
millis);
writeLong(millis);
writeInt(o.getNanos());
} else {
writeLong(o.getSeconds());
writeInt(o.getNanos());
writeInt(o.getZone());
}
}
开发者ID:Julien35,项目名称:dev-courses,代码行数:17,代码来源:RowOutputBinary180.java
示例6: writeTimestamp
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
protected void writeTimestamp(TimestampData o, Type type) {
writeLong(o.getSeconds());
writeInt(o.getNanos());
if (type.typeCode == Types.SQL_TIMESTAMP_WITH_TIME_ZONE) {
writeInt(o.getZone());
}
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:10,代码来源:RowOutputBinary.java
示例7: readTimestamp
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
protected TimestampData readTimestamp(Type type) {
if (type.typeCode == Types.SQL_TIMESTAMP) {
long millis = readLong();
int nanos = readInt();
millis = HsqlDateTime.convertMillisFromCalendar(tempCalDefault,
millis);
return new TimestampData(millis / 1000, nanos);
} else {
return new TimestampData(readLong(), readInt(), readInt());
}
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:15,代码来源:RowInputBinary180.java
示例8: getSystemTimestamp
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
synchronized TimestampData getSystemTimestamp(boolean withZone) {
long millis = System.currentTimeMillis();
long seconds = millis / 1000;
int nanos = (int) (millis % 1000) * 1000000;
TimeZone zone = TimeZone.getDefault();
int offset = zone.getOffset(millis) / 1000;
if (!withZone) {
seconds += offset;
offset = 0;
}
return new TimestampData(seconds, nanos, offset);
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:16,代码来源:Session.java
示例9: readTimestamp
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
protected TimestampData readTimestamp(Type type) throws IOException {
if (type.typeCode == Types.SQL_TIMESTAMP) {
long millis = readLong();
int nanos = readInt();
millis = HsqlDateTime.convertMillisFromCalendar(tempCalDefault,
millis);
return new TimestampData(millis / 1000, nanos);
} else {
return new TimestampData(readLong(), readInt(), readInt());
}
}
开发者ID:Julien35,项目名称:dev-courses,代码行数:15,代码来源:RowInputBinary180.java
示例10: readTimestamp
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
protected TimestampData readTimestamp(Type type) throws IOException {
if (type.typeCode == Types.SQL_TIMESTAMP) {
return new TimestampData(readLong(), readInt());
} else {
return new TimestampData(readLong(), readInt(), readInt());
}
}
开发者ID:s-store,项目名称:sstore-soft,代码行数:9,代码来源:RowInputBinary.java
示例11: setDate
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
/**
* <!-- start generic documentation -->
* Sets the designated parameter to the given <code>java.sql.Date</code> value,
* using the given <code>Calendar</code> object. The driver uses
* the <code>Calendar</code> object to construct an SQL <code>DATE</code> value,
* which the driver then sends to the database. With
* a <code>Calendar</code> object, the driver can calculate the date
* taking into account a custom timezone. If no
* <code>Calendar</code> object is specified, the driver uses the default
* timezone, which is that of the virtual machine running the application.
* <!-- end generic documentation -->
*
* @param parameterIndex the first parameter is 1, the second is 2, ...
* @param x the parameter value
* @param cal the <code>Calendar</code> object the driver will use
* to construct the date
* @exception SQLException if a database access error occurs or
* this method is called on a closed <code>PreparedStatement</code>
* @since JDK 1.2 (JDK 1.1.x developers: read the overview for
* JDBCParameterMetaData)
*/
public synchronized void setDate(int parameterIndex, Date x,
Calendar cal) throws SQLException {
checkSetParameterIndex(parameterIndex, false);
int i = parameterIndex - 1;
if (x == null) {
parameterValues[i] = null;
return;
}
Type outType = parameterTypes[i];
long millis = HsqlDateTime.convertToNormalisedDate(x.getTime(), cal);
int zoneOffset = HsqlDateTime.getZoneMillis(cal, millis);
switch (outType.typeCode) {
case Types.SQL_DATE :
case Types.SQL_TIMESTAMP :
case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
break;
default :
throw Util.sqlException(ErrorCode.X_42561);
}
parameterValues[i] = new TimestampData((millis + zoneOffset) / 1000);
}
开发者ID:s-store,项目名称:sstore-soft,代码行数:50,代码来源:JDBCPreparedStatement.java
示例12: toDate
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
public static TimestampData toDate(String string, String pattern,
SimpleDateFormat format) {
Date date;
String javaPattern = HsqlDateTime.toJavaDatePattern(pattern);
int matchIndex = javaPattern.indexOf("*IY");
if (matchIndex >= 0) {
throw Error.error(ErrorCode.X_22511);
}
matchIndex = javaPattern.indexOf("*WW");
if (matchIndex >= 0) {
throw Error.error(ErrorCode.X_22511);
}
matchIndex = javaPattern.indexOf("*W");
if (matchIndex >= 0) {
throw Error.error(ErrorCode.X_22511);
}
try {
format.applyPattern(javaPattern);
date = format.parse(string);
} catch (Exception e) {
throw Error.error(ErrorCode.X_22007, e.toString());
}
int nanos = ((int) (date.getTime() % 1000)) * 1000000;
return new TimestampData(date.getTime() / 1000, nanos, 0);
}
开发者ID:Julien35,项目名称:dev-courses,代码行数:36,代码来源:HsqlDateTime.java
示例13: readDate
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
protected TimestampData readDate(Type type) {
String s = readString();
if (s == null) {
return null;
}
s = s.trim();
if (s.length() == 0) {
return null;
}
return scanner.newDate(s);
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:17,代码来源:RowInputText.java
示例14: writeDate
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
protected void writeDate(TimestampData o, Type type) {
writeLong(o.getSeconds());
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:4,代码来源:RowOutputBinary.java
示例15: writeDate
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
protected void writeDate(TimestampData o, Type type) {
writeString(type.convertToString(o));
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:4,代码来源:RowOutputText.java
示例16: writeDate
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
protected void writeDate(TimestampData o, Type type) {
write('\'');
writeBytes(type.convertToString(o));
write('\'');
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:7,代码来源:RowOutputTextLog.java
示例17: writeTimestamp
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
protected void writeTimestamp(TimestampData o, Type type) {
write('\'');
writeBytes(type.convertToString(o));
write('\'');
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:7,代码来源:RowOutputTextLog.java
示例18: getDate
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
/**
* <!-- start generic documentation -->
*
* Retrieves the value of the designated JDBC <code>DATE</code> parameter as a
* <code>java.sql.Date</code> object, using
* the given <code>Calendar</code> object
* to construct the date.
* With a <code>Calendar</code> object, the driver
* can calculate the date taking into account a custom timezone and locale.
* If no <code>Calendar</code> object is specified, the driver uses the
* default timezone and locale.
*
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* HSQLDB supports this feature. <p>
*
* </div>
* <!-- end release-specific documentation -->
*
* @param parameterIndex the first parameter is 1, the second is 2,
* and so on
* @param cal the <code>Calendar</code> object the driver will use
* to construct the date
* @return the parameter value. If the value is SQL <code>NULL</code>, the result
* is <code>null</code>.
* @exception SQLException JDBC 4.1[if the parameterIndex is not valid;]
* if a database access error occurs or
* this method is called on a closed <code>CallableStatement</code>
* @see #setDate
* @since JDK 1.2 (JDK 1.1.x developers: read the overview for
* JDBCParameterMetaData)
*/
public synchronized Date getDate(int parameterIndex,
Calendar cal) throws SQLException {
TimestampData t = (TimestampData) getColumnInType(parameterIndex,
Type.SQL_DATE);
if (t == null) {
return null;
}
long millis = t.getSeconds() * 1000;
if (cal != null) {
millis = HsqlDateTime.convertMillisToCalendar(cal, millis);
}
return new Date(millis);
}
开发者ID:Julien35,项目名称:dev-courses,代码行数:55,代码来源:JDBCCallableStatement.java
示例19: setDate
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
/**
* <!-- start generic documentation -->
* Sets the designated parameter to the given <code>java.sql.Date</code> value,
* using the given <code>Calendar</code> object. The driver uses
* the <code>Calendar</code> object to construct an SQL <code>DATE</code> value,
* which the driver then sends to the database. With
* a <code>Calendar</code> object, the driver can calculate the date
* taking into account a custom timezone. If no
* <code>Calendar</code> object is specified, the driver uses the default
* timezone, which is that of the virtual machine running the application.
* <!-- end generic documentation -->
*
* @param parameterIndex the first parameter is 1, the second is 2, ...
* @param x the parameter value
* @param cal the <code>Calendar</code> object the driver will use
* to construct the date
* @exception SQLException if a database access error occurs or
* this method is called on a closed <code>PreparedStatement</code>
* @since JDK 1.2 (JDK 1.1.x developers: read the overview for
* JDBCParameterMetaData)
*/
public synchronized void setDate(int parameterIndex, Date x,
Calendar cal) throws SQLException {
checkSetParameterIndex(parameterIndex);
int i = parameterIndex - 1;
if (x == null) {
parameterValues[i] = null;
parameterSet[i] = Boolean.TRUE;
return;
}
Type outType = parameterTypes[i];
Calendar calendar = cal == null ? session.getCalendar()
: cal;
long millis = HsqlDateTime.convertMillisFromCalendar(calendar,
x.getTime());
millis = HsqlDateTime.getNormalisedDate(millis);
switch (outType.typeCode) {
case Types.SQL_DATE :
case Types.SQL_TIMESTAMP :
parameterValues[i] = new TimestampData(millis / 1000);
break;
case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
int zoneOffset = HsqlDateTime.getZoneMillis(calendar, millis);
parameterValues[i] = new TimestampData(millis / 1000, 0,
zoneOffset / 1000);
break;
default :
throw JDBCUtil.sqlException(ErrorCode.X_42561);
}
parameterSet[i] = Boolean.TRUE;
}
开发者ID:Julien35,项目名称:dev-courses,代码行数:64,代码来源:JDBCPreparedStatement.java
示例20: setDate
import org.hsqldb.types.TimestampData; //导入依赖的package包/类
/**
* <!-- start generic documentation -->
* Sets the designated parameter to the given <code>java.sql.Date</code> value,
* using the given <code>Calendar</code> object. The driver uses
* the <code>Calendar</code> object to construct an SQL <code>DATE</code> value,
* which the driver then sends to the database. With
* a <code>Calendar</code> object, the driver can calculate the date
* taking into account a custom timezone. If no
* <code>Calendar</code> object is specified, the driver uses the default
* timezone, which is that of the virtual machine running the application.
* <!-- end generic documentation -->
*
* @param parameterIndex the first parameter is 1, the second is 2, ...
* @param x the parameter value
* @param cal the <code>Calendar</code> object the driver will use
* to construct the date
* @exception SQLException if a database access error occurs or
* this method is called on a closed <code>PreparedStatement</code>
* @since JDK 1.2 (JDK 1.1.x developers: read the overview for
* JDBCParameterMetaData)
*/
public synchronized void setDate(int parameterIndex, Date x,
Calendar cal) throws SQLException {
checkSetParameterIndex(parameterIndex);
int i = parameterIndex - 1;
if (x == null) {
parameterValues[i] = null;
parameterSet[i] = Boolean.TRUE;
return;
}
Type outType = parameterTypes[i];
Calendar calendar = cal == null ? session.getCalendar()
: cal;
long millis = HsqlDateTime.convertMillisFromCalendar(
session.getCalendarGMT(), calendar, x.getTime());
millis = HsqlDateTime.getNormalisedDate(session.getCalendarGMT(),
millis);
switch (outType.typeCode) {
case Types.SQL_DATE :
case Types.SQL_TIMESTAMP :
parameterValues[i] = new TimestampData(millis / 1000);
break;
case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
int zoneOffset = HsqlDateTime.getZoneMillis(calendar, millis);
parameterValues[i] = new TimestampData(millis / 1000, 0,
zoneOffset / 1000);
break;
default :
throw JDBCUtil.sqlException(ErrorCode.X_42561);
}
parameterSet[i] = Boolean.TRUE;
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:65,代码来源:JDBCPreparedStatement.java
注:本文中的org.hsqldb.types.TimestampData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论