org.eclipse.persistence.internal.helper.Helper.printTimestampWithoutNanos()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(12.3k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中org.eclipse.persistence.internal.helper.Helper.printTimestampWithoutNanos()方法的一些代码示例,展示了Helper.printTimestampWithoutNanos()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Helper.printTimestampWithoutNanos()方法的具体详情如下:
包路径:org.eclipse.persistence.internal.helper.Helper
类名称:Helper
方法名:printTimestampWithoutNanos

Helper.printTimestampWithoutNanos介绍

[英]Print the sql.Timestamp without the nanos portion.
[中]打印sql。不带纳米部分的时间戳。

代码示例

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Appends a TimeStamp in Symfoware specific format.<br>
 * Note that Symfoware does not support the milli- and nanoseconds.<br>
 * Symfoware: TIMESTAMP'YYYY-MM-DD hh:mm:ss'
 */
@Override
protected void appendTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  writer.write("TIMESTAMP'" + Helper.printTimestampWithoutNanos(timestamp) + "'" );
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * Appends a TimeStamp in Symfoware specific format.<br>
 * Note that Symfoware does not support the milli- and nanoseconds.<br>
 * Symfoware: TIMESTAMP'YYYY-MM-DD hh:mm:ss'
 */
@Override
protected void appendTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  writer.write("TIMESTAMP'" + Helper.printTimestampWithoutNanos(timestamp) + "'" );
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Write a timestamp in Sybase specific format (yyyy-mm-dd-hh.mm.ss.fff).
 */
protected void appendSybaseTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  writer.write("'");
  writer.write(Helper.printTimestampWithoutNanos(timestamp));
  writer.write(':');
  // Must truncate the nanos to three decimal places,
  // it is actually a complex algorithm...
  String nanoString = Integer.toString(timestamp.getNanos());
  int numberOfZeros = 0;
  for (int num = Math.min(9 - nanoString.length(), 3); num > 0; num--) {
    writer.write('0');
    numberOfZeros++;
  }
  if ((nanoString.length() + numberOfZeros) > 3) {
    nanoString = nanoString.substring(0, (3 - numberOfZeros));
  }
  writer.write(nanoString);
  writer.write("'");
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * Write a timestamp in Sybase specific format ( yyyy-mm-dd-hh.mm.ss.fff)
 */
protected void appendSybaseTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  writer.write("'");
  writer.write(Helper.printTimestampWithoutNanos(timestamp));
  writer.write(':');
  // Must truncate the nanos to three decimal places,
  // it is actually a complex algorithm...
  String nanoString = Integer.toString(timestamp.getNanos());
  int numberOfZeros = 0;
  for (int num = Math.min(9 - nanoString.length(), 3); num > 0; num--) {
    writer.write('0');
    numberOfZeros++;
  }
  if ((nanoString.length() + numberOfZeros) > 3) {
    nanoString = nanoString.substring(0, (3 - numberOfZeros));
  }
  writer.write(nanoString);
  writer.write("'");
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Write a timestamp in Sybase specific format ( yyyy-mm-dd-hh.mm.ss.fff)
 */
protected void appendSybaseTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  writer.write("'");
  writer.write(Helper.printTimestampWithoutNanos(timestamp));
  writer.write(':');
  // Must truncate the nanos to three decimal places,
  // it is actually a complex algorithm...
  String nanoString = Integer.toString(timestamp.getNanos());
  int numberOfZeros = 0;
  for (int num = Math.min(9 - nanoString.length(), 3); num > 0; num--) {
    writer.write('0');
    numberOfZeros++;
  }
  if ((nanoString.length() + numberOfZeros) > 3) {
    nanoString = nanoString.substring(0, (3 - numberOfZeros));
  }
  writer.write(nanoString);
  writer.write("'");
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Write a timestamp in Sybase specific format (yyyy-mm-dd-hh.mm.ss.fff).
 */
protected void appendSybaseTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  writer.write("'");
  writer.write(Helper.printTimestampWithoutNanos(timestamp));
  writer.write(':');
  // Must truncate the nanos to three decimal places,
  // it is actually a complex algorithm...
  String nanoString = Integer.toString(timestamp.getNanos());
  int numberOfZeros = 0;
  for (int num = Math.min(9 - nanoString.length(), 3); num > 0; num--) {
    writer.write('0');
    numberOfZeros++;
  }
  if ((nanoString.length() + numberOfZeros) > 3) {
    nanoString = nanoString.substring(0, (3 - numberOfZeros));
  }
  writer.write(nanoString);
  writer.write("'");
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Write a timestamp in Sybase specific format ( yyyy-mm-dd-hh.mm.ss.fff)
 */
protected void appendSybaseTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  writer.write("'");
  writer.write(Helper.printTimestampWithoutNanos(timestamp));
  writer.write(':');
  // Must truncate the nanos to three decimal places,
  // it is actually a complex algorithm...
  String nanoString = Integer.toString(timestamp.getNanos());
  int numberOfZeros = 0;
  for (int num = Math.min(9 - nanoString.length(), 3); num > 0; num--) {
    writer.write('0');
    numberOfZeros++;
  }
  if ((nanoString.length() + numberOfZeros) > 3) {
    nanoString = nanoString.substring(0, (3 - numberOfZeros));
  }
  writer.write(nanoString);
  writer.write("'");
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Write a timestamp in Informix specific format (yyyy-mm-dd hh:mm:ss.fff).
 */
protected void appendInformixTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  writer.write("'");
  writer.write(Helper.printTimestampWithoutNanos(timestamp));
  writer.write('.');
  // Must truncate the nanos to three decimal places,
  // it is actually a complex algorithm...
  String nanoString = Integer.toString(timestamp.getNanos());
  int numberOfZeros = 0;
  for (int num = Math.min(9 - nanoString.length(), 3); num > 0; num--) {
    writer.write('0');
    numberOfZeros++;
  }
  if ((nanoString.length() + numberOfZeros) > 3) {
    nanoString = nanoString.substring(0, (3 - numberOfZeros));
  }
  writer.write(nanoString);
  writer.write("'");
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * Write a timestamp in Informix specific format (yyyy-mm-dd hh:mm:ss.fff).
 */
protected void appendInformixTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  writer.write("'");
  writer.write(Helper.printTimestampWithoutNanos(timestamp));
  writer.write('.');
  // Must truncate the nanos to three decimal places,
  // it is actually a complex algorithm...
  String nanoString = Integer.toString(timestamp.getNanos());
  int numberOfZeros = 0;
  for (int num = Math.min(9 - nanoString.length(), 3); num > 0; num--) {
    writer.write('0');
    numberOfZeros++;
  }
  if ((nanoString.length() + numberOfZeros) > 3) {
    nanoString = nanoString.substring(0, (3 - numberOfZeros));
  }
  writer.write(nanoString);
  writer.write("'");
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Appends an MySQL specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format.
 * Native Format: 'YYYY-MM-DD HH:MM:SS'
 */
@Override
protected void appendTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  if (usesNativeSQL()) {
    writer.write("'");
    writer.write(Helper.printTimestampWithoutNanos(timestamp));
    writer.write("'");
  } else {
    super.appendTimestamp(timestamp, writer);
  }
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * Write a timestamp in Sybase specific format (yyyy-mm-dd-hh.mm.ss.fff).
 */
protected void appendSybaseTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  writer.write("'");
  writer.write(Helper.printTimestampWithoutNanos(timestamp));
  writer.write(':');
  // Must truncate the nanos to three decimal places,
  // it is actually a complex algorithm...
  String nanoString = Integer.toString(timestamp.getNanos());
  int numberOfZeros = 0;
  for (int num = Math.min(9 - nanoString.length(), 3); num > 0; num--) {
    writer.write('0');
    numberOfZeros++;
  }
  if ((nanoString.length() + numberOfZeros) > 3) {
    nanoString = nanoString.substring(0, (3 - numberOfZeros));
  }
  writer.write(nanoString);
  writer.write("'");
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Write a timestamp in Informix specific format (yyyy-mm-dd hh:mm:ss.fff).
 */
protected void appendInformixTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  writer.write("'");
  writer.write(Helper.printTimestampWithoutNanos(timestamp));
  writer.write('.');
  // Must truncate the nanos to three decimal places,
  // it is actually a complex algorithm...
  String nanoString = Integer.toString(timestamp.getNanos());
  int numberOfZeros = 0;
  for (int num = Math.min(9 - nanoString.length(), 3); num > 0; num--) {
    writer.write('0');
    numberOfZeros++;
  }
  if ((nanoString.length() + numberOfZeros) > 3) {
    nanoString = nanoString.substring(0, (3 - numberOfZeros));
  }
  writer.write(nanoString);
  writer.write("'");
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Appends an TimesTen specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format.
 * Native Format: 'YYYY-MM-DD HH:MM:SS' 
 */
@Override
protected void appendTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  if (usesNativeSQL()) {
    writer.write("TIMESTAMP '");
    writer.write(Helper.printTimestampWithoutNanos(timestamp));
    writer.write("'");
  } else {
    super.appendTimestamp(timestamp, writer);
  }
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Appends an MySQL specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format.
 * Native Format: 'YYYY-MM-DD HH:MM:SS' 
 */
protected void appendTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  if (usesNativeSQL()) {
    writer.write("'");
    writer.write(Helper.printTimestampWithoutNanos(timestamp));
    writer.write("'");
  } else {
    super.appendTimestamp(timestamp, writer);
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Appends an Oracle specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format.
 * Native Format: to_date ('1997-11-06 10:35:45.0' , 'yyyy-mm-dd hh:mm:ss.n')
 */
@Override
protected void appendTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  if (usesNativeSQL()) {
    writer.write("to_date('");
    writer.write(Helper.printTimestampWithoutNanos(timestamp));
    writer.write("','yyyy-mm-dd hh24:mi:ss')");
  } else {
    super.appendTimestamp(timestamp, writer);
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Appends an TimesTen specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format.
 * Native Format: 'YYYY-MM-DD HH:MM:SS'
 */
@Override
protected void appendTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  if (usesNativeSQL()) {
    writer.write("TIMESTAMP '");
    writer.write(Helper.printTimestampWithoutNanos(timestamp));
    writer.write("'");
  } else {
    super.appendTimestamp(timestamp, writer);
  }
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * Appends an TimesTen specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format.
 * Native Format: 'YYYY-MM-DD HH:MM:SS' 
 */
@Override
protected void appendTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  if (usesNativeSQL()) {
    writer.write("TIMESTAMP '");
    writer.write(Helper.printTimestampWithoutNanos(timestamp));
    writer.write("'");
  } else {
    super.appendTimestamp(timestamp, writer);
  }
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * Appends an MySQL specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format.
 * Native Format: 'YYYY-MM-DD HH:MM:SS' 
 */
@Override
protected void appendTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  if (usesNativeSQL()) {
    writer.write("'");
    writer.write(Helper.printTimestampWithoutNanos(timestamp));
    writer.write("'");
  } else {
    super.appendTimestamp(timestamp, writer);
  }
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Appends an Oracle specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format.
 * Native Format: to_date ('1997-11-06 10:35:45.0' , 'yyyy-mm-dd hh:mm:ss.n')
 */
protected void appendTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  if (usesNativeSQL()) {
    writer.write("to_date('");
    writer.write(Helper.printTimestampWithoutNanos(timestamp));
    writer.write("','yyyy-mm-dd hh24:mi:ss')");
  } else {
    super.appendTimestamp(timestamp, writer);
  }
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * Appends an Oracle specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format.
 * Native Format: to_date ('1997-11-06 10:35:45.0' , 'yyyy-mm-dd hh:mm:ss.n')
 */
@Override
protected void appendTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
  if (usesNativeSQL()) {
    writer.write("to_date('");
    writer.write(Helper.printTimestampWithoutNanos(timestamp));
    writer.write("','yyyy-mm-dd hh24:mi:ss')");
  } else {
    super.appendTimestamp(timestamp, writer);
  }
}

相关文章

Helper类方法