Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
Source Code for Connector/J 8.0.31 - Core Impl
Where to get the Java source code for Connector/J 8.0 Core Impl module?
✍: FYIcenter.com
Java source code files for Connector/J 8.0 Core Impl module are:
⏎ com/mysql/cj/result/StringValueFactory.java
/* * Copyright (c) 2015, 2021, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License, version 2.0, as published by the * Free Software Foundation. * * This program is also distributed with certain software (including but not * limited to OpenSSL) that is licensed under separate terms, as designated in a * particular file or component or in included license documentation. The * authors of MySQL hereby grant you an additional permission to link the * program and your derivative works with the separately licensed software that * they have included with MySQL. * * Without limiting anything contained in the foregoing, this file, which is * part of MySQL Connector/J, is also subject to the Universal FOSS Exception, * version 1.0, a copy of which can be found at * http://oss.oracle.com/licenses/universal-foss-exception. * * 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, version 2.0, * 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., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ package com.mysql.cj.result; import java.math.BigDecimal; import java.math.BigInteger; import com.mysql.cj.CharsetMapping; import com.mysql.cj.conf.PropertyKey; import com.mysql.cj.conf.PropertySet; import com.mysql.cj.protocol.InternalDate; import com.mysql.cj.protocol.InternalTime; import com.mysql.cj.protocol.InternalTimestamp; import com.mysql.cj.util.DataTypeUtil; import com.mysql.cj.util.StringUtils; /** * A {@link com.mysql.cj.result.ValueFactory} implementation to create strings. */ public class StringValueFactory implements ValueFactory<String> { protected PropertySet pset = null; public StringValueFactory(PropertySet pset) { this.pset = pset; } @Override public void setPropertySet(PropertySet pset) { this.pset = pset; } /** * Create a string from InternalDate. The fields are formatted in a YYYY-mm-dd format. * * @param idate * {@link InternalDate} * @return string */ public String createFromDate(InternalDate idate) { // essentially the same string we received from the server, no TZ interpretation return String.format("%04d-%02d-%02d", idate.getYear(), idate.getMonth(), idate.getDay()); } /** * Create a string from InternalTime. The fields are formatted in a HH:MM:SS[.nnnnnnnnn] format. * * @param it * {@link InternalTime} * @return string */ public String createFromTime(InternalTime it) { return it.toString(); } /** * Create a string from time fields. The fields are formatted by concatenating the result of {@link #createFromDate(InternalDate)} and {@link * #createFromTime(InternalTime)}. * * @param its * {@link InternalTimestamp} * @return string */ public String createFromTimestamp(InternalTimestamp its) { return String.format("%s %s", createFromDate(its), createFromTime(new InternalTime(its.getHours(), its.getMinutes(), its.getSeconds(), its.getNanos(), its.getScale()))); } /** * Create a string from time fields. The fields are formatted by concatenating the result of {@link #createFromDate(InternalDate)} and {@link * #createFromTime(InternalTime)}. * * @param its * {@link InternalTimestamp} * @return string */ public String createFromDatetime(InternalTimestamp its) { return String.format("%s %s", createFromDate(its), createFromTime(new InternalTime(its.getHours(), its.getMinutes(), its.getSeconds(), its.getNanos(), its.getScale()))); } public String createFromLong(long l) { return String.valueOf(l); } public String createFromBigInteger(BigInteger i) { return i.toString(); } public String createFromDouble(double d) { return String.valueOf(d); } public String createFromBigDecimal(BigDecimal d) { return d.toString(); } /** * Interpret the given byte array as a string. This value factory needs to know the encoding to interpret the string. The default (null) will interpret the * byte array using the platform encoding. * * @param bytes * byte array * @param offset * offset * @param length * data length in bytes * @param f * field * @return string */ public String createFromBytes(byte[] bytes, int offset, int length, Field f) { return StringUtils.toString(bytes, offset, length, f.getCollationIndex() == CharsetMapping.MYSQL_COLLATION_INDEX_binary ? this.pset.getStringProperty(PropertyKey.characterEncoding).getValue() : f.getEncoding()); } @Override public String createFromBit(byte[] bytes, int offset, int length) { return createFromLong(DataTypeUtil.bitToLong(bytes, offset, length)); } @Override public String createFromYear(long l) { if (this.pset.getBooleanProperty(PropertyKey.yearIsDateType).getValue()) { if (l < 100) { if (l <= 69) { l += 100; } l += 1900; } return createFromDate(new InternalDate((int) l, 1, 1)); } return createFromLong(l); } public String createFromNull() { return null; } public String getTargetTypeName() { return String.class.getName(); } }
⏎ com/mysql/cj/result/StringValueFactory.java
Or download all of them as a single archive file:
File name: mysql-connector-java-core-impl-8.0.31.zip File size: 201048 bytes Release date: 2022-09-03 Download
⇒ Source Code for Connector/J 8.0.31 - Protocol Impl
⇐ Source Code for Connector/J 8.0.31 - Core API
2023-05-31, 5046👍, 0💬
Popular Posts:
What Is activation.jar? I heard it's related to JAF (JavaBeans Activation Framework) 1.0.2? The if y...
JDK 11 java.sql.rowset.jmod is the JMOD file for JDK 11 SQL Rowset module. JDK 11 SQL Rowset module ...
commons-net-1.4.1.jar is the JAR file for Apache Commons Net 1.4.1, which implements the client side...
How to download and install Apache XMLBeans-2.6.0.zip? If you want to try the XMLBeans Java library,...
Swingx is the SwingLabs Swing Component Extensions. JAR File Size and Download Location: File name: ...