repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbClob.java | MariaDbClob.getSubString | public String getSubString(long pos, int length) throws SQLException {
if (pos < 1) {
throw ExceptionMapper.getSqlException("position must be >= 1");
}
if (length < 0) {
throw ExceptionMapper.getSqlException("length must be > 0");
}
try {
String val = toString();
return va... | java | public String getSubString(long pos, int length) throws SQLException {
if (pos < 1) {
throw ExceptionMapper.getSqlException("position must be >= 1");
}
if (length < 0) {
throw ExceptionMapper.getSqlException("length must be > 0");
}
try {
String val = toString();
return va... | [
"public",
"String",
"getSubString",
"(",
"long",
"pos",
",",
"int",
"length",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"pos",
"<",
"1",
")",
"{",
"throw",
"ExceptionMapper",
".",
"getSqlException",
"(",
"\"position must be >= 1\"",
")",
";",
"}",
"if",... | Get sub string.
@param pos position
@param length length of sub string
@return substring
@throws SQLException if pos is less than 1 or length is less than 0 | [
"Get",
"sub",
"string",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbClob.java#L118-L134 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbClob.java | MariaDbClob.getCharacterStream | public Reader getCharacterStream(long pos, long length) throws SQLException {
String val = toString();
if (val.length() < (int) pos - 1 + length) {
throw ExceptionMapper
.getSqlException("pos + length is greater than the number of characters in the Clob");
}
String sub = val.substring((i... | java | public Reader getCharacterStream(long pos, long length) throws SQLException {
String val = toString();
if (val.length() < (int) pos - 1 + length) {
throw ExceptionMapper
.getSqlException("pos + length is greater than the number of characters in the Clob");
}
String sub = val.substring((i... | [
"public",
"Reader",
"getCharacterStream",
"(",
"long",
"pos",
",",
"long",
"length",
")",
"throws",
"SQLException",
"{",
"String",
"val",
"=",
"toString",
"(",
")",
";",
"if",
"(",
"val",
".",
"length",
"(",
")",
"<",
"(",
"int",
")",
"pos",
"-",
"1"... | Returns a Reader object that contains a partial Clob value, starting with the character
specified by pos, which is length characters in length.
@param pos the offset to the first character of the partial value to be retrieved. The first
character in the Clob is at position 1.
@param length the length in characters ... | [
"Returns",
"a",
"Reader",
"object",
"that",
"contains",
"a",
"partial",
"Clob",
"value",
"starting",
"with",
"the",
"character",
"specified",
"by",
"pos",
"which",
"is",
"length",
"characters",
"in",
"length",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbClob.java#L152-L160 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbClob.java | MariaDbClob.setCharacterStream | public Writer setCharacterStream(long pos) throws SQLException {
int bytePosition = utf8Position((int) pos - 1);
OutputStream stream = setBinaryStream(bytePosition + 1);
return new OutputStreamWriter(stream, StandardCharsets.UTF_8);
} | java | public Writer setCharacterStream(long pos) throws SQLException {
int bytePosition = utf8Position((int) pos - 1);
OutputStream stream = setBinaryStream(bytePosition + 1);
return new OutputStreamWriter(stream, StandardCharsets.UTF_8);
} | [
"public",
"Writer",
"setCharacterStream",
"(",
"long",
"pos",
")",
"throws",
"SQLException",
"{",
"int",
"bytePosition",
"=",
"utf8Position",
"(",
"(",
"int",
")",
"pos",
"-",
"1",
")",
";",
"OutputStream",
"stream",
"=",
"setBinaryStream",
"(",
"bytePosition"... | Set character stream.
@param pos position
@return writer
@throws SQLException if position is invalid | [
"Set",
"character",
"stream",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbClob.java#L169-L173 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbClob.java | MariaDbClob.utf8Position | private int utf8Position(int charPosition) {
int pos = offset;
for (int i = 0; i < charPosition; i++) {
int byteValue = data[pos] & 0xff;
if (byteValue < 0x80) {
pos += 1;
} else if (byteValue < 0xC2) {
throw new UncheckedIOException("invalid UTF8", new CharacterCodingException... | java | private int utf8Position(int charPosition) {
int pos = offset;
for (int i = 0; i < charPosition; i++) {
int byteValue = data[pos] & 0xff;
if (byteValue < 0x80) {
pos += 1;
} else if (byteValue < 0xC2) {
throw new UncheckedIOException("invalid UTF8", new CharacterCodingException... | [
"private",
"int",
"utf8Position",
"(",
"int",
"charPosition",
")",
"{",
"int",
"pos",
"=",
"offset",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"charPosition",
";",
"i",
"++",
")",
"{",
"int",
"byteValue",
"=",
"data",
"[",
"pos",
"]",
... | Convert character position into byte position in UTF8 byte array.
@param charPosition charPosition
@return byte position | [
"Convert",
"character",
"position",
"into",
"byte",
"position",
"in",
"UTF8",
"byte",
"array",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbClob.java#L193-L212 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbClob.java | MariaDbClob.setString | public int setString(long pos, String str) throws SQLException {
int bytePosition = utf8Position((int) pos - 1);
super.setBytes(bytePosition + 1 - offset, str.getBytes(StandardCharsets.UTF_8));
return str.length();
} | java | public int setString(long pos, String str) throws SQLException {
int bytePosition = utf8Position((int) pos - 1);
super.setBytes(bytePosition + 1 - offset, str.getBytes(StandardCharsets.UTF_8));
return str.length();
} | [
"public",
"int",
"setString",
"(",
"long",
"pos",
",",
"String",
"str",
")",
"throws",
"SQLException",
"{",
"int",
"bytePosition",
"=",
"utf8Position",
"(",
"(",
"int",
")",
"pos",
"-",
"1",
")",
";",
"super",
".",
"setBytes",
"(",
"bytePosition",
"+",
... | Set String.
@param pos position
@param str string
@return string length
@throws SQLException if UTF-8 conversion failed | [
"Set",
"String",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbClob.java#L222-L226 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbClob.java | MariaDbClob.length | @Override
public long length() {
//The length of a character string is the number of UTF-16 units (not the number of characters)
long len = 0;
int pos = offset;
//set ASCII (<= 127 chars)
for (; len < length && data[pos] >= 0; ) {
len++;
pos++;
}
//multi-bytes UTF-8
while... | java | @Override
public long length() {
//The length of a character string is the number of UTF-16 units (not the number of characters)
long len = 0;
int pos = offset;
//set ASCII (<= 127 chars)
for (; len < length && data[pos] >= 0; ) {
len++;
pos++;
}
//multi-bytes UTF-8
while... | [
"@",
"Override",
"public",
"long",
"length",
"(",
")",
"{",
"//The length of a character string is the number of UTF-16 units (not the number of characters)",
"long",
"len",
"=",
"0",
";",
"int",
"pos",
"=",
"offset",
";",
"//set ASCII (<= 127 chars)",
"for",
"(",
";",
... | Return character length of the Clob. Assume UTF8 encoding. | [
"Return",
"character",
"length",
"of",
"the",
"Clob",
".",
"Assume",
"UTF8",
"encoding",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbClob.java#L239-L282 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/protocol/tls/MariaDbX509KeyManager.java | MariaDbX509KeyManager.searchAccurateAliases | private ArrayList<String> searchAccurateAliases(String[] keyTypes, Principal[] issuers) {
if (keyTypes == null || keyTypes.length == 0) {
return null;
}
ArrayList<String> accurateAliases = new ArrayList<>();
for (Map.Entry<String, KeyStore.PrivateKeyEntry> mapEntry : privateKeyHash.entrySet()) {
... | java | private ArrayList<String> searchAccurateAliases(String[] keyTypes, Principal[] issuers) {
if (keyTypes == null || keyTypes.length == 0) {
return null;
}
ArrayList<String> accurateAliases = new ArrayList<>();
for (Map.Entry<String, KeyStore.PrivateKeyEntry> mapEntry : privateKeyHash.entrySet()) {
... | [
"private",
"ArrayList",
"<",
"String",
">",
"searchAccurateAliases",
"(",
"String",
"[",
"]",
"keyTypes",
",",
"Principal",
"[",
"]",
"issuers",
")",
"{",
"if",
"(",
"keyTypes",
"==",
"null",
"||",
"keyTypes",
".",
"length",
"==",
"0",
")",
"{",
"return"... | Search aliases corresponding to algorithms and issuers.
@param keyTypes list of algorithms
@param issuers list of issuers;
@return list of corresponding aliases | [
"Search",
"aliases",
"corresponding",
"to",
"algorithms",
"and",
"issuers",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/tls/MariaDbX509KeyManager.java#L156-L189 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/socket/SocketUtility.java | SocketUtility.getSocketHandler | @SuppressWarnings("unchecked")
public static SocketHandlerFunction getSocketHandler() {
try {
//forcing use of JNA to ensure AOT compilation
Platform.getOSType();
return (urlParser, host) -> {
if (urlParser.getOptions().pipe != null) {
return new NamedPipeSocket(host, urlParse... | java | @SuppressWarnings("unchecked")
public static SocketHandlerFunction getSocketHandler() {
try {
//forcing use of JNA to ensure AOT compilation
Platform.getOSType();
return (urlParser, host) -> {
if (urlParser.getOptions().pipe != null) {
return new NamedPipeSocket(host, urlParse... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"SocketHandlerFunction",
"getSocketHandler",
"(",
")",
"{",
"try",
"{",
"//forcing use of JNA to ensure AOT compilation",
"Platform",
".",
"getOSType",
"(",
")",
";",
"return",
"(",
"urlParser",
"... | Create socket according to options. In case of compilation ahead of time, will throw an error
if dependencies found, then use default socket implementation.
@return Socket | [
"Create",
"socket",
"according",
"to",
"options",
".",
"In",
"case",
"of",
"compilation",
"ahead",
"of",
"time",
"will",
"throw",
"an",
"error",
"if",
"dependencies",
"found",
"then",
"use",
"default",
"socket",
"implementation",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/socket/SocketUtility.java#L15-L45 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/failover/thread/TerminableRunnable.java | TerminableRunnable.blockTillTerminated | public void blockTillTerminated() {
while (!runState.compareAndSet(State.IDLE, State.REMOVED)) {
// wait and retry
LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(10));
if (Thread.currentThread().isInterrupted()) {
runState.set(State.REMOVED);
return;
}
}
} | java | public void blockTillTerminated() {
while (!runState.compareAndSet(State.IDLE, State.REMOVED)) {
// wait and retry
LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(10));
if (Thread.currentThread().isInterrupted()) {
runState.set(State.REMOVED);
return;
}
}
} | [
"public",
"void",
"blockTillTerminated",
"(",
")",
"{",
"while",
"(",
"!",
"runState",
".",
"compareAndSet",
"(",
"State",
".",
"IDLE",
",",
"State",
".",
"REMOVED",
")",
")",
"{",
"// wait and retry",
"LockSupport",
".",
"parkNanos",
"(",
"TimeUnit",
".",
... | Unschedule next launched, and wait for the current task to complete before closing it. | [
"Unschedule",
"next",
"launched",
"and",
"wait",
"for",
"the",
"current",
"task",
"to",
"complete",
"before",
"closing",
"it",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/thread/TerminableRunnable.java#L94-L103 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/failover/thread/TerminableRunnable.java | TerminableRunnable.unscheduleTask | public void unscheduleTask() {
if (unschedule.compareAndSet(false, true)) {
scheduledFuture.cancel(false);
scheduledFuture = null;
}
} | java | public void unscheduleTask() {
if (unschedule.compareAndSet(false, true)) {
scheduledFuture.cancel(false);
scheduledFuture = null;
}
} | [
"public",
"void",
"unscheduleTask",
"(",
")",
"{",
"if",
"(",
"unschedule",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"scheduledFuture",
".",
"cancel",
"(",
"false",
")",
";",
"scheduledFuture",
"=",
"null",
";",
"}",
"}"
] | Unschedule task if active, and cancel thread to inform it must be interrupted in a proper way. | [
"Unschedule",
"task",
"if",
"active",
"and",
"cancel",
"thread",
"to",
"inform",
"it",
"must",
"be",
"interrupted",
"in",
"a",
"proper",
"way",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/thread/TerminableRunnable.java#L112-L118 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/dao/CmdInformationSingle.java | CmdInformationSingle.getGeneratedKeys | public ResultSet getGeneratedKeys(Protocol protocol) {
if (insertId == 0) {
return SelectResultSet.createEmptyResultSet();
}
if (updateCount > 1) {
long[] insertIds = new long[(int) updateCount];
for (int i = 0; i < updateCount; i++) {
insertIds[i] = insertId + i * autoIncrement;
... | java | public ResultSet getGeneratedKeys(Protocol protocol) {
if (insertId == 0) {
return SelectResultSet.createEmptyResultSet();
}
if (updateCount > 1) {
long[] insertIds = new long[(int) updateCount];
for (int i = 0; i < updateCount; i++) {
insertIds[i] = insertId + i * autoIncrement;
... | [
"public",
"ResultSet",
"getGeneratedKeys",
"(",
"Protocol",
"protocol",
")",
"{",
"if",
"(",
"insertId",
"==",
"0",
")",
"{",
"return",
"SelectResultSet",
".",
"createEmptyResultSet",
"(",
")",
";",
"}",
"if",
"(",
"updateCount",
">",
"1",
")",
"{",
"long"... | Get generated Keys.
@param protocol current protocol
@return a resultSet containing the single insert ids. | [
"Get",
"generated",
"Keys",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/dao/CmdInformationSingle.java#L126-L140 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java | BinaryRowProtocol.getInternalBigDecimal | public BigDecimal getInternalBigDecimal(ColumnInformation columnInfo) throws SQLException {
if (lastValueWasNull()) {
return null;
}
switch (columnInfo.getColumnType()) {
case BIT:
return BigDecimal.valueOf(parseBit());
case TINYINT:
return BigDecimal.valueOf((long) getInt... | java | public BigDecimal getInternalBigDecimal(ColumnInformation columnInfo) throws SQLException {
if (lastValueWasNull()) {
return null;
}
switch (columnInfo.getColumnType()) {
case BIT:
return BigDecimal.valueOf(parseBit());
case TINYINT:
return BigDecimal.valueOf((long) getInt... | [
"public",
"BigDecimal",
"getInternalBigDecimal",
"(",
"ColumnInformation",
"columnInfo",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"switch",
"(",
"columnInfo",
".",
"getColumnType",
"(",
")... | Get BigDecimal from raw binary format.
@param columnInfo column information
@return BigDecimal value
@throws SQLException if column is not numeric | [
"Get",
"BigDecimal",
"from",
"raw",
"binary",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java#L668-L717 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java | BinaryRowProtocol.getInternalDate | @SuppressWarnings("deprecation")
public Date getInternalDate(ColumnInformation columnInfo, Calendar cal, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
switch (columnInfo.getColumnType()) {
case TIMESTAMP:
case DATETIME:
Timestamp timestam... | java | @SuppressWarnings("deprecation")
public Date getInternalDate(ColumnInformation columnInfo, Calendar cal, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
switch (columnInfo.getColumnType()) {
case TIMESTAMP:
case DATETIME:
Timestamp timestam... | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"Date",
"getInternalDate",
"(",
"ColumnInformation",
"columnInfo",
",",
"Calendar",
"cal",
",",
"TimeZone",
"timeZone",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")"... | Get date from raw binary format.
@param columnInfo column information
@param cal calendar
@param timeZone time zone
@return date value
@throws SQLException if column is not compatible to Date | [
"Get",
"date",
"from",
"raw",
"binary",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java#L728-L790 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java | BinaryRowProtocol.getInternalTime | public Time getInternalTime(ColumnInformation columnInfo, Calendar cal, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
switch (columnInfo.getColumnType()) {
case TIMESTAMP:
case DATETIME:
Timestamp ts = getInternalTimestamp(columnInfo, cal, ... | java | public Time getInternalTime(ColumnInformation columnInfo, Calendar cal, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
switch (columnInfo.getColumnType()) {
case TIMESTAMP:
case DATETIME:
Timestamp ts = getInternalTimestamp(columnInfo, cal, ... | [
"public",
"Time",
"getInternalTime",
"(",
"ColumnInformation",
"columnInfo",
",",
"Calendar",
"cal",
",",
"TimeZone",
"timeZone",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"switch",
"(",
... | Get time from raw binary format.
@param columnInfo column information
@param cal calendar
@param timeZone time zone
@return Time value
@throws SQLException if column cannot be converted to Time | [
"Get",
"time",
"from",
"raw",
"binary",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java#L801-L851 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java | BinaryRowProtocol.getInternalObject | public Object getInternalObject(ColumnInformation columnInfo, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
switch (columnInfo.getColumnType()) {
case BIT:
if (columnInfo.getLength() == 1) {
return buf[pos] != 0;
}
byte... | java | public Object getInternalObject(ColumnInformation columnInfo, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
switch (columnInfo.getColumnType()) {
case BIT:
if (columnInfo.getLength() == 1) {
return buf[pos] != 0;
}
byte... | [
"public",
"Object",
"getInternalObject",
"(",
"ColumnInformation",
"columnInfo",
",",
"TimeZone",
"timeZone",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"switch",
"(",
"columnInfo",
".",
"... | Get Object from raw binary format.
@param columnInfo column information
@param timeZone time zone
@return Object value
@throws SQLException if column type is not compatible | [
"Get",
"Object",
"from",
"raw",
"binary",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java#L982-L1068 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java | BinaryRowProtocol.getInternalBoolean | public boolean getInternalBoolean(ColumnInformation columnInfo) throws SQLException {
if (lastValueWasNull()) {
return false;
}
switch (columnInfo.getColumnType()) {
case BIT:
return parseBit() != 0;
case TINYINT:
return getInternalTinyInt(columnInfo) != 0;
case SMALL... | java | public boolean getInternalBoolean(ColumnInformation columnInfo) throws SQLException {
if (lastValueWasNull()) {
return false;
}
switch (columnInfo.getColumnType()) {
case BIT:
return parseBit() != 0;
case TINYINT:
return getInternalTinyInt(columnInfo) != 0;
case SMALL... | [
"public",
"boolean",
"getInternalBoolean",
"(",
"ColumnInformation",
"columnInfo",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"switch",
"(",
"columnInfo",
".",
"getColumnType",
"(",
")",
... | Get boolean from raw binary format.
@param columnInfo column information
@return boolean value
@throws SQLException if column type doesn't permit conversion | [
"Get",
"boolean",
"from",
"raw",
"binary",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java#L1077-L1105 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java | BinaryRowProtocol.getInternalByte | public byte getInternalByte(ColumnInformation columnInfo) throws SQLException {
if (lastValueWasNull()) {
return 0;
}
long value;
switch (columnInfo.getColumnType()) {
case BIT:
value = parseBit();
break;
case TINYINT:
value = getInternalTinyInt(columnInfo);
... | java | public byte getInternalByte(ColumnInformation columnInfo) throws SQLException {
if (lastValueWasNull()) {
return 0;
}
long value;
switch (columnInfo.getColumnType()) {
case BIT:
value = parseBit();
break;
case TINYINT:
value = getInternalTinyInt(columnInfo);
... | [
"public",
"byte",
"getInternalByte",
"(",
"ColumnInformation",
"columnInfo",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"0",
";",
"}",
"long",
"value",
";",
"switch",
"(",
"columnInfo",
".",
"getColumnType"... | Get byte from raw binary format.
@param columnInfo column information
@return byte value
@throws SQLException if column type doesn't permit conversion | [
"Get",
"byte",
"from",
"raw",
"binary",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java#L1114-L1160 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java | BinaryRowProtocol.getInternalTimeString | public String getInternalTimeString(ColumnInformation columnInfo) {
if (lastValueWasNull()) {
return null;
}
if (length == 0) {
// binary send 00:00:00 as 0.
if (columnInfo.getDecimals() == 0) {
return "00:00:00";
} else {
StringBuilder value = new StringBuilder("00:0... | java | public String getInternalTimeString(ColumnInformation columnInfo) {
if (lastValueWasNull()) {
return null;
}
if (length == 0) {
// binary send 00:00:00 as 0.
if (columnInfo.getDecimals() == 0) {
return "00:00:00";
} else {
StringBuilder value = new StringBuilder("00:0... | [
"public",
"String",
"getInternalTimeString",
"(",
"ColumnInformation",
"columnInfo",
")",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"length",
"==",
"0",
")",
"{",
"// binary send 00:00:00 as 0.",
"if",
"(",
... | Get Time in string format from raw binary format.
@param columnInfo column information
@return time value | [
"Get",
"Time",
"in",
"string",
"format",
"from",
"raw",
"binary",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java#L1228-L1295 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java | BinaryRowProtocol.getInternalZonedDateTime | public ZonedDateTime getInternalZonedDateTime(ColumnInformation columnInfo, Class clazz,
TimeZone timeZone) throws SQLException {
if (lastValueWasNull()) {
return null;
}
if (length == 0) {
lastValueNull |= BIT_LAST_FIELD_NULL;
return null;
}
switch (columnInfo.getColumnType... | java | public ZonedDateTime getInternalZonedDateTime(ColumnInformation columnInfo, Class clazz,
TimeZone timeZone) throws SQLException {
if (lastValueWasNull()) {
return null;
}
if (length == 0) {
lastValueNull |= BIT_LAST_FIELD_NULL;
return null;
}
switch (columnInfo.getColumnType... | [
"public",
"ZonedDateTime",
"getInternalZonedDateTime",
"(",
"ColumnInformation",
"columnInfo",
",",
"Class",
"clazz",
",",
"TimeZone",
"timeZone",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
... | Get ZonedDateTime from raw binary format.
@param columnInfo column information
@param clazz asked class
@param timeZone time zone
@return ZonedDateTime value
@throws SQLException if column type doesn't permit conversion | [
"Get",
"ZonedDateTime",
"from",
"raw",
"binary",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java#L1367-L1427 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java | BinaryRowProtocol.getInternalLocalTime | public LocalTime getInternalLocalTime(ColumnInformation columnInfo, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
if (length == 0) {
lastValueNull |= BIT_LAST_FIELD_NULL;
return null;
}
switch (columnInfo.getColumnType().getSqlType()) {
... | java | public LocalTime getInternalLocalTime(ColumnInformation columnInfo, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
if (length == 0) {
lastValueNull |= BIT_LAST_FIELD_NULL;
return null;
}
switch (columnInfo.getColumnType().getSqlType()) {
... | [
"public",
"LocalTime",
"getInternalLocalTime",
"(",
"ColumnInformation",
"columnInfo",
",",
"TimeZone",
"timeZone",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"length",
"==",
"0... | Get LocalTime from raw binary format.
@param columnInfo column information
@param timeZone time zone
@return LocalTime value
@throws SQLException if column type doesn't permit conversion | [
"Get",
"LocalTime",
"from",
"raw",
"binary",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java#L1548-L1618 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/pool/Pools.java | Pools.retrievePool | public static Pool retrievePool(UrlParser urlParser) {
if (!poolMap.containsKey(urlParser)) {
synchronized (poolMap) {
if (!poolMap.containsKey(urlParser)) {
if (poolExecutor == null) {
poolExecutor = new ScheduledThreadPoolExecutor(1,
new MariaDbThreadFactory("Ma... | java | public static Pool retrievePool(UrlParser urlParser) {
if (!poolMap.containsKey(urlParser)) {
synchronized (poolMap) {
if (!poolMap.containsKey(urlParser)) {
if (poolExecutor == null) {
poolExecutor = new ScheduledThreadPoolExecutor(1,
new MariaDbThreadFactory("Ma... | [
"public",
"static",
"Pool",
"retrievePool",
"(",
"UrlParser",
"urlParser",
")",
"{",
"if",
"(",
"!",
"poolMap",
".",
"containsKey",
"(",
"urlParser",
")",
")",
"{",
"synchronized",
"(",
"poolMap",
")",
"{",
"if",
"(",
"!",
"poolMap",
".",
"containsKey",
... | Get existing pool for a configuration. Create it if doesn't exists.
@param urlParser configuration parser
@return pool | [
"Get",
"existing",
"pool",
"for",
"a",
"configuration",
".",
"Create",
"it",
"if",
"doesn",
"t",
"exists",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/pool/Pools.java#L45-L60 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/pool/Pools.java | Pools.remove | public static void remove(Pool pool) {
if (poolMap.containsKey(pool.getUrlParser())) {
synchronized (poolMap) {
if (poolMap.containsKey(pool.getUrlParser())) {
poolMap.remove(pool.getUrlParser());
shutdownExecutor();
}
}
}
} | java | public static void remove(Pool pool) {
if (poolMap.containsKey(pool.getUrlParser())) {
synchronized (poolMap) {
if (poolMap.containsKey(pool.getUrlParser())) {
poolMap.remove(pool.getUrlParser());
shutdownExecutor();
}
}
}
} | [
"public",
"static",
"void",
"remove",
"(",
"Pool",
"pool",
")",
"{",
"if",
"(",
"poolMap",
".",
"containsKey",
"(",
"pool",
".",
"getUrlParser",
"(",
")",
")",
")",
"{",
"synchronized",
"(",
"poolMap",
")",
"{",
"if",
"(",
"poolMap",
".",
"containsKey"... | Remove pool.
@param pool pool to remove | [
"Remove",
"pool",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/pool/Pools.java#L67-L76 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/pool/Pools.java | Pools.close | public static void close() {
synchronized (poolMap) {
for (Pool pool : poolMap.values()) {
try {
pool.close();
} catch (InterruptedException exception) {
//eat
}
}
shutdownExecutor();
poolMap.clear();
}
} | java | public static void close() {
synchronized (poolMap) {
for (Pool pool : poolMap.values()) {
try {
pool.close();
} catch (InterruptedException exception) {
//eat
}
}
shutdownExecutor();
poolMap.clear();
}
} | [
"public",
"static",
"void",
"close",
"(",
")",
"{",
"synchronized",
"(",
"poolMap",
")",
"{",
"for",
"(",
"Pool",
"pool",
":",
"poolMap",
".",
"values",
"(",
")",
")",
"{",
"try",
"{",
"pool",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Inte... | Close all pools. | [
"Close",
"all",
"pools",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/pool/Pools.java#L81-L93 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/pool/Pools.java | Pools.close | public static void close(String poolName) {
if (poolName == null) {
return;
}
synchronized (poolMap) {
for (Pool pool : poolMap.values()) {
if (poolName.equals(pool.getUrlParser().getOptions().poolName)) {
try {
pool.close();
} catch (InterruptedException ... | java | public static void close(String poolName) {
if (poolName == null) {
return;
}
synchronized (poolMap) {
for (Pool pool : poolMap.values()) {
if (poolName.equals(pool.getUrlParser().getOptions().poolName)) {
try {
pool.close();
} catch (InterruptedException ... | [
"public",
"static",
"void",
"close",
"(",
"String",
"poolName",
")",
"{",
"if",
"(",
"poolName",
"==",
"null",
")",
"{",
"return",
";",
"}",
"synchronized",
"(",
"poolMap",
")",
"{",
"for",
"(",
"Pool",
"pool",
":",
"poolMap",
".",
"values",
"(",
")"... | Closing a pool with name defined in url.
@param poolName the option "poolName" value | [
"Closing",
"a",
"pool",
"with",
"name",
"defined",
"in",
"url",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/pool/Pools.java#L100-L121 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/input/ReadAheadBufferedStream.java | ReadAheadBufferedStream.read | public synchronized int read(byte[] externalBuf, int off, int len) throws IOException {
if (len == 0) {
return 0;
}
int totalReads = 0;
while (true) {
//read
if (end - pos <= 0) {
if (len - totalReads >= buf.length) {
//buffer length is less than asked byte and buf... | java | public synchronized int read(byte[] externalBuf, int off, int len) throws IOException {
if (len == 0) {
return 0;
}
int totalReads = 0;
while (true) {
//read
if (end - pos <= 0) {
if (len - totalReads >= buf.length) {
//buffer length is less than asked byte and buf... | [
"public",
"synchronized",
"int",
"read",
"(",
"byte",
"[",
"]",
"externalBuf",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"len",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"int",
"totalReads",
"=",
"0",
"... | Returing byte array, from cache of reading socket if needed.
@param externalBuf buffer to fill
@param off offset
@param len length to read
@return number of added bytes
@throws IOException if exception during socket reading | [
"Returing",
"byte",
"array",
"from",
"cache",
"of",
"reading",
"socket",
"if",
"needed",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/input/ReadAheadBufferedStream.java#L80-L120 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/input/ReadAheadBufferedStream.java | ReadAheadBufferedStream.fillBuffer | private void fillBuffer(int minNeededBytes) throws IOException {
int lengthToReallyRead = Math.min(BUF_SIZE, Math.max(super.available(), minNeededBytes));
end = super.read(buf, 0, lengthToReallyRead);
pos = 0;
} | java | private void fillBuffer(int minNeededBytes) throws IOException {
int lengthToReallyRead = Math.min(BUF_SIZE, Math.max(super.available(), minNeededBytes));
end = super.read(buf, 0, lengthToReallyRead);
pos = 0;
} | [
"private",
"void",
"fillBuffer",
"(",
"int",
"minNeededBytes",
")",
"throws",
"IOException",
"{",
"int",
"lengthToReallyRead",
"=",
"Math",
".",
"min",
"(",
"BUF_SIZE",
",",
"Math",
".",
"max",
"(",
"super",
".",
"available",
"(",
")",
",",
"minNeededBytes",... | Fill buffer with required length, or available bytes.
@param minNeededBytes asked number of bytes
@throws IOException in case of failing reading stream. | [
"Fill",
"buffer",
"with",
"required",
"length",
"or",
"available",
"bytes",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/input/ReadAheadBufferedStream.java#L128-L132 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/protocol/tls/MariaDbX509TrustManager.java | MariaDbX509TrustManager.checkClientTrusted | @Override
public void checkClientTrusted(X509Certificate[] x509Certificates, String string)
throws CertificateException {
if (trustManager == null) {
return;
}
trustManager.checkClientTrusted(x509Certificates, string);
} | java | @Override
public void checkClientTrusted(X509Certificate[] x509Certificates, String string)
throws CertificateException {
if (trustManager == null) {
return;
}
trustManager.checkClientTrusted(x509Certificates, string);
} | [
"@",
"Override",
"public",
"void",
"checkClientTrusted",
"(",
"X509Certificate",
"[",
"]",
"x509Certificates",
",",
"String",
"string",
")",
"throws",
"CertificateException",
"{",
"if",
"(",
"trustManager",
"==",
"null",
")",
"{",
"return",
";",
"}",
"trustManag... | Check client trusted.
@param x509Certificates certificate
@param string string
@throws CertificateException exception | [
"Check",
"client",
"trusted",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/tls/MariaDbX509TrustManager.java#L203-L210 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/pool/Pool.java | Pool.addConnectionRequest | private void addConnectionRequest() {
if (totalConnection.get() < options.maxPoolSize && poolState.get() == POOL_STATE_OK) {
//ensure to have one worker if was timeout
connectionAppender.prestartCoreThread();
connectionAppenderQueue.offer(() -> {
if ((totalConnection.get() < options.minP... | java | private void addConnectionRequest() {
if (totalConnection.get() < options.maxPoolSize && poolState.get() == POOL_STATE_OK) {
//ensure to have one worker if was timeout
connectionAppender.prestartCoreThread();
connectionAppenderQueue.offer(() -> {
if ((totalConnection.get() < options.minP... | [
"private",
"void",
"addConnectionRequest",
"(",
")",
"{",
"if",
"(",
"totalConnection",
".",
"get",
"(",
")",
"<",
"options",
".",
"maxPoolSize",
"&&",
"poolState",
".",
"get",
"(",
")",
"==",
"POOL_STATE_OK",
")",
"{",
"//ensure to have one worker if was timeou... | Add new connection if needed. Only one thread create new connection, so new connection request
will wait to newly created connection or for a released connection. | [
"Add",
"new",
"connection",
"if",
"needed",
".",
"Only",
"one",
"thread",
"create",
"new",
"connection",
"so",
"new",
"connection",
"request",
"will",
"wait",
"to",
"newly",
"created",
"connection",
"or",
"for",
"a",
"released",
"connection",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/pool/Pool.java#L140-L157 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/pool/Pool.java | Pool.removeIdleTimeoutConnection | private void removeIdleTimeoutConnection() {
//descending iterator since first from queue are the first to be used
Iterator<MariaDbPooledConnection> iterator = idleConnections.descendingIterator();
MariaDbPooledConnection item;
while (iterator.hasNext()) {
item = iterator.next();
long id... | java | private void removeIdleTimeoutConnection() {
//descending iterator since first from queue are the first to be used
Iterator<MariaDbPooledConnection> iterator = idleConnections.descendingIterator();
MariaDbPooledConnection item;
while (iterator.hasNext()) {
item = iterator.next();
long id... | [
"private",
"void",
"removeIdleTimeoutConnection",
"(",
")",
"{",
"//descending iterator since first from queue are the first to be used",
"Iterator",
"<",
"MariaDbPooledConnection",
">",
"iterator",
"=",
"idleConnections",
".",
"descendingIterator",
"(",
")",
";",
"MariaDbPoole... | Removing idle connection.
Close them and recreate connection to reach minimal number of connection. | [
"Removing",
"idle",
"connection",
".",
"Close",
"them",
"and",
"recreate",
"connection",
"to",
"reach",
"minimal",
"number",
"of",
"connection",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/pool/Pool.java#L163-L208 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/pool/Pool.java | Pool.addConnection | private void addConnection() throws SQLException {
//create new connection
Protocol protocol = Utils.retrieveProxy(urlParser, globalInfo);
MariaDbConnection connection = new MariaDbConnection(protocol);
MariaDbPooledConnection pooledConnection = createPoolConnection(connection);
if (options.static... | java | private void addConnection() throws SQLException {
//create new connection
Protocol protocol = Utils.retrieveProxy(urlParser, globalInfo);
MariaDbConnection connection = new MariaDbConnection(protocol);
MariaDbPooledConnection pooledConnection = createPoolConnection(connection);
if (options.static... | [
"private",
"void",
"addConnection",
"(",
")",
"throws",
"SQLException",
"{",
"//create new connection",
"Protocol",
"protocol",
"=",
"Utils",
".",
"retrieveProxy",
"(",
"urlParser",
",",
"globalInfo",
")",
";",
"MariaDbConnection",
"connection",
"=",
"new",
"MariaDb... | Create new connection.
@throws SQLException if connection creation failed | [
"Create",
"new",
"connection",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/pool/Pool.java#L215-L246 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/pool/Pool.java | Pool.getIdleConnection | private MariaDbPooledConnection getIdleConnection(long timeout, TimeUnit timeUnit)
throws InterruptedException {
while (true) {
MariaDbPooledConnection item =
(timeout == 0) ? idleConnections.pollFirst() : idleConnections.pollFirst(timeout, timeUnit);
if (item != null) {
Ma... | java | private MariaDbPooledConnection getIdleConnection(long timeout, TimeUnit timeUnit)
throws InterruptedException {
while (true) {
MariaDbPooledConnection item =
(timeout == 0) ? idleConnections.pollFirst() : idleConnections.pollFirst(timeout, timeUnit);
if (item != null) {
Ma... | [
"private",
"MariaDbPooledConnection",
"getIdleConnection",
"(",
"long",
"timeout",
",",
"TimeUnit",
"timeUnit",
")",
"throws",
"InterruptedException",
"{",
"while",
"(",
"true",
")",
"{",
"MariaDbPooledConnection",
"item",
"=",
"(",
"timeout",
"==",
"0",
")",
"?",... | Get an existing idle connection in pool.
@return an IDLE connection. | [
"Get",
"an",
"existing",
"idle",
"connection",
"in",
"pool",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/pool/Pool.java#L257-L304 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/pool/Pool.java | Pool.getConnection | public MariaDbConnection getConnection(String username, String password) throws SQLException {
try {
if ((urlParser.getUsername() != null ? urlParser.getUsername().equals(username)
: username == null)
&& (urlParser.getPassword() != null ? urlParser.getPassword().equals(password)
... | java | public MariaDbConnection getConnection(String username, String password) throws SQLException {
try {
if ((urlParser.getUsername() != null ? urlParser.getUsername().equals(username)
: username == null)
&& (urlParser.getPassword() != null ? urlParser.getPassword().equals(password)
... | [
"public",
"MariaDbConnection",
"getConnection",
"(",
"String",
"username",
",",
"String",
"password",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"if",
"(",
"(",
"urlParser",
".",
"getUsername",
"(",
")",
"!=",
"null",
"?",
"urlParser",
".",
"getUsername",... | Get new connection from pool if user and password correspond to pool. If username and password
are different from pool, will return a dedicated connection.
@param username username
@param password password
@return connection
@throws SQLException if any error occur during connection | [
"Get",
"new",
"connection",
"from",
"pool",
"if",
"user",
"and",
"password",
"correspond",
"to",
"pool",
".",
"If",
"username",
"and",
"password",
"are",
"different",
"from",
"pool",
"will",
"return",
"a",
"dedicated",
"connection",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/pool/Pool.java#L425-L447 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/pool/Pool.java | Pool.close | public void close() throws InterruptedException {
synchronized (this) {
Pools.remove(this);
poolState.set(POOL_STATE_CLOSING);
pendingRequestNumber.set(0);
scheduledFuture.cancel(false);
connectionAppender.shutdown();
try {
connectionAppender.awaitTermination(10, TimeUn... | java | public void close() throws InterruptedException {
synchronized (this) {
Pools.remove(this);
poolState.set(POOL_STATE_CLOSING);
pendingRequestNumber.set(0);
scheduledFuture.cancel(false);
connectionAppender.shutdown();
try {
connectionAppender.awaitTermination(10, TimeUn... | [
"public",
"void",
"close",
"(",
")",
"throws",
"InterruptedException",
"{",
"synchronized",
"(",
"this",
")",
"{",
"Pools",
".",
"remove",
"(",
"this",
")",
";",
"poolState",
".",
"set",
"(",
"POOL_STATE_CLOSING",
")",
";",
"pendingRequestNumber",
".",
"set"... | Close pool and underlying connections.
@throws InterruptedException if interrupted | [
"Close",
"pool",
"and",
"underlying",
"connections",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/pool/Pool.java#L465-L513 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java | AbstractMastersListener.addToBlacklist | public void addToBlacklist(HostAddress hostAddress) {
if (hostAddress != null && !isExplicitClosed()) {
blacklist.putIfAbsent(hostAddress, System.nanoTime());
}
} | java | public void addToBlacklist(HostAddress hostAddress) {
if (hostAddress != null && !isExplicitClosed()) {
blacklist.putIfAbsent(hostAddress, System.nanoTime());
}
} | [
"public",
"void",
"addToBlacklist",
"(",
"HostAddress",
"hostAddress",
")",
"{",
"if",
"(",
"hostAddress",
"!=",
"null",
"&&",
"!",
"isExplicitClosed",
"(",
")",
")",
"{",
"blacklist",
".",
"putIfAbsent",
"(",
"hostAddress",
",",
"System",
".",
"nanoTime",
"... | After a failover, put the hostAddress in a static list so the other connection will not take
this host in account for a time.
@param hostAddress the HostAddress to add to blacklist | [
"After",
"a",
"failover",
"put",
"the",
"hostAddress",
"in",
"a",
"static",
"list",
"so",
"the",
"other",
"connection",
"will",
"not",
"take",
"this",
"host",
"in",
"account",
"for",
"a",
"time",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java#L212-L216 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java | AbstractMastersListener.resetOldsBlackListHosts | public void resetOldsBlackListHosts() {
long currentTimeNanos = System.nanoTime();
Set<Map.Entry<HostAddress, Long>> entries = blacklist.entrySet();
for (Map.Entry<HostAddress, Long> blEntry : entries) {
long entryNanos = blEntry.getValue();
long durationSeconds = TimeUnit.NANOSECONDS.toSeconds(... | java | public void resetOldsBlackListHosts() {
long currentTimeNanos = System.nanoTime();
Set<Map.Entry<HostAddress, Long>> entries = blacklist.entrySet();
for (Map.Entry<HostAddress, Long> blEntry : entries) {
long entryNanos = blEntry.getValue();
long durationSeconds = TimeUnit.NANOSECONDS.toSeconds(... | [
"public",
"void",
"resetOldsBlackListHosts",
"(",
")",
"{",
"long",
"currentTimeNanos",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"Set",
"<",
"Map",
".",
"Entry",
"<",
"HostAddress",
",",
"Long",
">",
">",
"entries",
"=",
"blacklist",
".",
"entrySet",... | Permit to remove Host to blacklist after loadBalanceBlacklistTimeout seconds. | [
"Permit",
"to",
"remove",
"Host",
"to",
"blacklist",
"after",
"loadBalanceBlacklistTimeout",
"seconds",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java#L232-L242 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java | AbstractMastersListener.setMasterHostFail | public boolean setMasterHostFail() {
if (masterHostFail.compareAndSet(false, true)) {
masterHostFailNanos = System.nanoTime();
currentConnectionAttempts.set(0);
return true;
}
return false;
} | java | public boolean setMasterHostFail() {
if (masterHostFail.compareAndSet(false, true)) {
masterHostFailNanos = System.nanoTime();
currentConnectionAttempts.set(0);
return true;
}
return false;
} | [
"public",
"boolean",
"setMasterHostFail",
"(",
")",
"{",
"if",
"(",
"masterHostFail",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"masterHostFailNanos",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"currentConnectionAttempts",
".",
"set",... | Set master fail variables.
@return true if was already failed | [
"Set",
"master",
"fail",
"variables",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java#L275-L282 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java | AbstractMastersListener.relaunchOperation | public HandleErrorResult relaunchOperation(Method method, Object[] args)
throws IllegalAccessException, InvocationTargetException {
HandleErrorResult handleErrorResult = new HandleErrorResult(true);
if (method != null) {
switch (method.getName()) {
case "executeQuery":
if (args[2]... | java | public HandleErrorResult relaunchOperation(Method method, Object[] args)
throws IllegalAccessException, InvocationTargetException {
HandleErrorResult handleErrorResult = new HandleErrorResult(true);
if (method != null) {
switch (method.getName()) {
case "executeQuery":
if (args[2]... | [
"public",
"HandleErrorResult",
"relaunchOperation",
"(",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"HandleErrorResult",
"handleErrorResult",
"=",
"new",
"HandleErrorResult",
"(",
... | After a failover that has bean done, relaunch the operation that was in progress. In case of
special operation that crash server, doesn't relaunched it;
@param method the methode accessed
@param args the parameters
@return An object that indicate the result or that the exception as to be thrown
@throws IllegalAccess... | [
"After",
"a",
"failover",
"that",
"has",
"bean",
"done",
"relaunch",
"the",
"operation",
"that",
"was",
"in",
"progress",
".",
"In",
"case",
"of",
"special",
"operation",
"that",
"crash",
"server",
"doesn",
"t",
"relaunched",
"it",
";"
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java#L306-L351 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java | AbstractMastersListener.isQueryRelaunchable | public boolean isQueryRelaunchable(Method method, Object[] args) {
if (method != null) {
switch (method.getName()) {
case "executeQuery":
if (!((Boolean) args[0])) {
return true; //launched on slave connection
}
if (args[2] instanceof String) {
ret... | java | public boolean isQueryRelaunchable(Method method, Object[] args) {
if (method != null) {
switch (method.getName()) {
case "executeQuery":
if (!((Boolean) args[0])) {
return true; //launched on slave connection
}
if (args[2] instanceof String) {
ret... | [
"public",
"boolean",
"isQueryRelaunchable",
"(",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"method",
"!=",
"null",
")",
"{",
"switch",
"(",
"method",
".",
"getName",
"(",
")",
")",
"{",
"case",
"\"executeQuery\"",
":",
"... | Check if query can be re-executed.
@param method invoke method
@param args invoke arguments
@return true if can be re-executed | [
"Check",
"if",
"query",
"can",
"be",
"re",
"-",
"executed",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java#L360-L391 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java | AbstractMastersListener.syncConnection | public void syncConnection(Protocol from, Protocol to) throws SQLException {
if (from != null) {
proxy.lock.lock();
try {
to.resetStateAfterFailover(from.getMaxRows(), from.getTransactionIsolationLevel(),
from.getDatabase(), from.getAutocommit());
} finally {
proxy.lo... | java | public void syncConnection(Protocol from, Protocol to) throws SQLException {
if (from != null) {
proxy.lock.lock();
try {
to.resetStateAfterFailover(from.getMaxRows(), from.getTransactionIsolationLevel(),
from.getDatabase(), from.getAutocommit());
} finally {
proxy.lo... | [
"public",
"void",
"syncConnection",
"(",
"Protocol",
"from",
",",
"Protocol",
"to",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"from",
"!=",
"null",
")",
"{",
"proxy",
".",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"to",
".",
"resetStateAfter... | When switching between 2 connections, report existing connection parameter to the new used
connection.
@param from used connection
@param to will-be-current connection
@throws SQLException if catalog cannot be set | [
"When",
"switching",
"between",
"2",
"connections",
"report",
"existing",
"connection",
"parameter",
"to",
"the",
"new",
"used",
"connection",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java#L409-L422 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java | AbstractMastersListener.throwFailoverMessage | @Override
public void throwFailoverMessage(HostAddress failHostAddress, boolean wasMaster,
SQLException queryException,
boolean reconnected) throws SQLException {
String firstPart = "Communications link failure with "
+ (wasMaster ? "primary" : "secondary")
+ ((failHostAddress != null)... | java | @Override
public void throwFailoverMessage(HostAddress failHostAddress, boolean wasMaster,
SQLException queryException,
boolean reconnected) throws SQLException {
String firstPart = "Communications link failure with "
+ (wasMaster ? "primary" : "secondary")
+ ((failHostAddress != null)... | [
"@",
"Override",
"public",
"void",
"throwFailoverMessage",
"(",
"HostAddress",
"failHostAddress",
",",
"boolean",
"wasMaster",
",",
"SQLException",
"queryException",
",",
"boolean",
"reconnected",
")",
"throws",
"SQLException",
"{",
"String",
"firstPart",
"=",
"\"Comm... | Throw a human readable message after a failoverException.
@param failHostAddress failedHostAddress
@param wasMaster was failed connection master
@param queryException internal error
@param reconnected connection status
@throws SQLException error with failover information | [
"Throw",
"a",
"human",
"readable",
"message",
"after",
"a",
"failoverException",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java#L496-L540 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java | TextRowProtocol.getInternalString | public String getInternalString(ColumnInformation columnInfo, Calendar cal, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
switch (columnInfo.getColumnType()) {
case BIT:
return String.valueOf(parseBit());
case DOUBLE:
case FLOAT:
... | java | public String getInternalString(ColumnInformation columnInfo, Calendar cal, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
switch (columnInfo.getColumnType()) {
case BIT:
return String.valueOf(parseBit());
case DOUBLE:
case FLOAT:
... | [
"public",
"String",
"getInternalString",
"(",
"ColumnInformation",
"columnInfo",
",",
"Calendar",
"cal",
",",
"TimeZone",
"timeZone",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"switch",
"... | Get String from raw text format.
@param columnInfo column information
@param cal calendar
@param timeZone time zone
@return String value
@throws SQLException if column type doesn't permit conversion | [
"Get",
"String",
"from",
"raw",
"text",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java#L186-L244 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java | TextRowProtocol.getInternalInt | public int getInternalInt(ColumnInformation columnInfo) throws SQLException {
if (lastValueWasNull()) {
return 0;
}
long value = getInternalLong(columnInfo);
rangeCheck(Integer.class, Integer.MIN_VALUE, Integer.MAX_VALUE, value, columnInfo);
return (int) value;
} | java | public int getInternalInt(ColumnInformation columnInfo) throws SQLException {
if (lastValueWasNull()) {
return 0;
}
long value = getInternalLong(columnInfo);
rangeCheck(Integer.class, Integer.MIN_VALUE, Integer.MAX_VALUE, value, columnInfo);
return (int) value;
} | [
"public",
"int",
"getInternalInt",
"(",
"ColumnInformation",
"columnInfo",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"0",
";",
"}",
"long",
"value",
"=",
"getInternalLong",
"(",
"columnInfo",
")",
";",
"... | Get int from raw text format.
@param columnInfo column information
@return int value
@throws SQLException if column type doesn't permit conversion or not in Integer range | [
"Get",
"int",
"from",
"raw",
"text",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java#L253-L260 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java | TextRowProtocol.getInternalFloat | public float getInternalFloat(ColumnInformation columnInfo) throws SQLException {
if (lastValueWasNull()) {
return 0;
}
switch (columnInfo.getColumnType()) {
case BIT:
return parseBit();
case TINYINT:
case SMALLINT:
case YEAR:
case INTEGER:
case MEDIUMINT:
... | java | public float getInternalFloat(ColumnInformation columnInfo) throws SQLException {
if (lastValueWasNull()) {
return 0;
}
switch (columnInfo.getColumnType()) {
case BIT:
return parseBit();
case TINYINT:
case SMALLINT:
case YEAR:
case INTEGER:
case MEDIUMINT:
... | [
"public",
"float",
"getInternalFloat",
"(",
"ColumnInformation",
"columnInfo",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"0",
";",
"}",
"switch",
"(",
"columnInfo",
".",
"getColumnType",
"(",
")",
")",
"... | Get float from raw text format.
@param columnInfo column information
@return float value
@throws SQLException if column type doesn't permit conversion or not in Float range | [
"Get",
"float",
"from",
"raw",
"text",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java#L350-L387 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java | TextRowProtocol.getInternalBigDecimal | public BigDecimal getInternalBigDecimal(ColumnInformation columnInfo) {
if (lastValueWasNull()) {
return null;
}
if (columnInfo.getColumnType() == ColumnType.BIT) {
return BigDecimal.valueOf(parseBit());
}
return new BigDecimal(new String(buf, pos, length, StandardCharsets.UTF_8));
} | java | public BigDecimal getInternalBigDecimal(ColumnInformation columnInfo) {
if (lastValueWasNull()) {
return null;
}
if (columnInfo.getColumnType() == ColumnType.BIT) {
return BigDecimal.valueOf(parseBit());
}
return new BigDecimal(new String(buf, pos, length, StandardCharsets.UTF_8));
} | [
"public",
"BigDecimal",
"getInternalBigDecimal",
"(",
"ColumnInformation",
"columnInfo",
")",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"columnInfo",
".",
"getColumnType",
"(",
")",
"==",
"ColumnType",
".",
... | Get BigDecimal from raw text format.
@param columnInfo column information
@return BigDecimal value | [
"Get",
"BigDecimal",
"from",
"raw",
"text",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java#L442-L451 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java | TextRowProtocol.getInternalDate | @SuppressWarnings("deprecation")
public Date getInternalDate(ColumnInformation columnInfo, Calendar cal, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
switch (columnInfo.getColumnType()) {
case DATE:
int[] datePart = new int[]{0,0,0};
... | java | @SuppressWarnings("deprecation")
public Date getInternalDate(ColumnInformation columnInfo, Calendar cal, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
switch (columnInfo.getColumnType()) {
case DATE:
int[] datePart = new int[]{0,0,0};
... | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"Date",
"getInternalDate",
"(",
"ColumnInformation",
"columnInfo",
",",
"Calendar",
"cal",
",",
"TimeZone",
"timeZone",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")"... | Get date from raw text format.
@param columnInfo column information
@param cal calendar
@param timeZone time zone
@return date value
@throws SQLException if column type doesn't permit conversion | [
"Get",
"date",
"from",
"raw",
"text",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java#L462-L534 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java | TextRowProtocol.getInternalTime | public Time getInternalTime(ColumnInformation columnInfo, Calendar cal, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
if (columnInfo.getColumnType() == ColumnType.TIMESTAMP
|| columnInfo.getColumnType() == ColumnType.DATETIME) {
Timestamp timest... | java | public Time getInternalTime(ColumnInformation columnInfo, Calendar cal, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
if (columnInfo.getColumnType() == ColumnType.TIMESTAMP
|| columnInfo.getColumnType() == ColumnType.DATETIME) {
Timestamp timest... | [
"public",
"Time",
"getInternalTime",
"(",
"ColumnInformation",
"columnInfo",
",",
"Calendar",
"cal",
",",
"TimeZone",
"timeZone",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"c... | Get time from raw text format.
@param columnInfo column information
@param cal calendar
@param timeZone time zone
@return time value
@throws SQLException if column type doesn't permit conversion | [
"Get",
"time",
"from",
"raw",
"text",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java#L545-L591 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java | TextRowProtocol.getInternalBoolean | public boolean getInternalBoolean(ColumnInformation columnInfo) {
if (lastValueWasNull()) {
return false;
}
if (columnInfo.getColumnType() == ColumnType.BIT) {
return parseBit() != 0;
}
final String rawVal = new String(buf, pos, length, StandardCharsets.UTF_8);
return !("false".equa... | java | public boolean getInternalBoolean(ColumnInformation columnInfo) {
if (lastValueWasNull()) {
return false;
}
if (columnInfo.getColumnType() == ColumnType.BIT) {
return parseBit() != 0;
}
final String rawVal = new String(buf, pos, length, StandardCharsets.UTF_8);
return !("false".equa... | [
"public",
"boolean",
"getInternalBoolean",
"(",
"ColumnInformation",
"columnInfo",
")",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"columnInfo",
".",
"getColumnType",
"(",
")",
"==",
"ColumnType",
".",
"BI... | Get boolean from raw text format.
@param columnInfo column information
@return boolean value | [
"Get",
"boolean",
"from",
"raw",
"text",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java#L797-L807 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java | TextRowProtocol.getInternalByte | public byte getInternalByte(ColumnInformation columnInfo) throws SQLException {
if (lastValueWasNull()) {
return 0;
}
long value = getInternalLong(columnInfo);
rangeCheck(Byte.class, Byte.MIN_VALUE, Byte.MAX_VALUE, value, columnInfo);
return (byte) value;
} | java | public byte getInternalByte(ColumnInformation columnInfo) throws SQLException {
if (lastValueWasNull()) {
return 0;
}
long value = getInternalLong(columnInfo);
rangeCheck(Byte.class, Byte.MIN_VALUE, Byte.MAX_VALUE, value, columnInfo);
return (byte) value;
} | [
"public",
"byte",
"getInternalByte",
"(",
"ColumnInformation",
"columnInfo",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"0",
";",
"}",
"long",
"value",
"=",
"getInternalLong",
"(",
"columnInfo",
")",
";",
... | Get byte from raw text format.
@param columnInfo column information
@return byte value
@throws SQLException if column type doesn't permit conversion | [
"Get",
"byte",
"from",
"raw",
"text",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java#L816-L823 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java | TextRowProtocol.getInternalShort | public short getInternalShort(ColumnInformation columnInfo) throws SQLException {
if (lastValueWasNull()) {
return 0;
}
long value = getInternalLong(columnInfo);
rangeCheck(Short.class, Short.MIN_VALUE, Short.MAX_VALUE, value, columnInfo);
return (short) value;
} | java | public short getInternalShort(ColumnInformation columnInfo) throws SQLException {
if (lastValueWasNull()) {
return 0;
}
long value = getInternalLong(columnInfo);
rangeCheck(Short.class, Short.MIN_VALUE, Short.MAX_VALUE, value, columnInfo);
return (short) value;
} | [
"public",
"short",
"getInternalShort",
"(",
"ColumnInformation",
"columnInfo",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"0",
";",
"}",
"long",
"value",
"=",
"getInternalLong",
"(",
"columnInfo",
")",
";",... | Get short from raw text format.
@param columnInfo column information
@return short value
@throws SQLException if column type doesn't permit conversion or value is not in Short range | [
"Get",
"short",
"from",
"raw",
"text",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java#L832-L839 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java | TextRowProtocol.getInternalTimeString | public String getInternalTimeString(ColumnInformation columnInfo) {
if (lastValueWasNull()) {
return null;
}
String rawValue = new String(buf, pos, length, StandardCharsets.UTF_8);
if ("0000-00-00".equals(rawValue)) {
return null;
}
if (options.maximizeMysqlCompatibility && options... | java | public String getInternalTimeString(ColumnInformation columnInfo) {
if (lastValueWasNull()) {
return null;
}
String rawValue = new String(buf, pos, length, StandardCharsets.UTF_8);
if ("0000-00-00".equals(rawValue)) {
return null;
}
if (options.maximizeMysqlCompatibility && options... | [
"public",
"String",
"getInternalTimeString",
"(",
"ColumnInformation",
"columnInfo",
")",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"String",
"rawValue",
"=",
"new",
"String",
"(",
"buf",
",",
"pos",
",",
"length",
... | Get Time in string format from raw text format.
@param columnInfo column information
@return String representation of time | [
"Get",
"Time",
"in",
"string",
"format",
"from",
"raw",
"text",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java#L847-L862 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java | TextRowProtocol.getInternalBigInteger | public BigInteger getInternalBigInteger(ColumnInformation columnInfo) {
if (lastValueWasNull()) {
return null;
}
return new BigInteger(new String(buf, pos, length, StandardCharsets.UTF_8));
} | java | public BigInteger getInternalBigInteger(ColumnInformation columnInfo) {
if (lastValueWasNull()) {
return null;
}
return new BigInteger(new String(buf, pos, length, StandardCharsets.UTF_8));
} | [
"public",
"BigInteger",
"getInternalBigInteger",
"(",
"ColumnInformation",
"columnInfo",
")",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"BigInteger",
"(",
"new",
"String",
"(",
"buf",
",",
"pos",
","... | Get BigInteger format from raw text format.
@param columnInfo column information
@return BigInteger value | [
"Get",
"BigInteger",
"format",
"from",
"raw",
"text",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java#L870-L875 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java | TextRowProtocol.getInternalZonedDateTime | public ZonedDateTime getInternalZonedDateTime(ColumnInformation columnInfo, Class clazz,
TimeZone timeZone) throws SQLException {
if (lastValueWasNull()) {
return null;
}
if (length == 0) {
lastValueNull |= BIT_LAST_FIELD_NULL;
return null;
}
String raw = new String(buf, pos... | java | public ZonedDateTime getInternalZonedDateTime(ColumnInformation columnInfo, Class clazz,
TimeZone timeZone) throws SQLException {
if (lastValueWasNull()) {
return null;
}
if (length == 0) {
lastValueNull |= BIT_LAST_FIELD_NULL;
return null;
}
String raw = new String(buf, pos... | [
"public",
"ZonedDateTime",
"getInternalZonedDateTime",
"(",
"ColumnInformation",
"columnInfo",
",",
"Class",
"clazz",
",",
"TimeZone",
"timeZone",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
... | Get ZonedDateTime format from raw text format.
@param columnInfo column information
@param clazz class for logging
@param timeZone time zone
@return ZonedDateTime value
@throws SQLException if column type doesn't permit conversion | [
"Get",
"ZonedDateTime",
"format",
"from",
"raw",
"text",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java#L886-L935 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java | TextRowProtocol.getInternalOffsetTime | public OffsetTime getInternalOffsetTime(ColumnInformation columnInfo, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
if (length == 0) {
lastValueNull |= BIT_LAST_FIELD_NULL;
return null;
}
ZoneId zoneId = timeZone.toZoneId().normalized();
... | java | public OffsetTime getInternalOffsetTime(ColumnInformation columnInfo, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
if (length == 0) {
lastValueNull |= BIT_LAST_FIELD_NULL;
return null;
}
ZoneId zoneId = timeZone.toZoneId().normalized();
... | [
"public",
"OffsetTime",
"getInternalOffsetTime",
"(",
"ColumnInformation",
"columnInfo",
",",
"TimeZone",
"timeZone",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"length",
"==",
... | Get OffsetTime format from raw text format.
@param columnInfo column information
@param timeZone time zone
@return OffsetTime value
@throws SQLException if column type doesn't permit conversion | [
"Get",
"OffsetTime",
"format",
"from",
"raw",
"text",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java#L945-L1013 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java | TextRowProtocol.getInternalLocalTime | public LocalTime getInternalLocalTime(ColumnInformation columnInfo, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
if (length == 0) {
lastValueNull |= BIT_LAST_FIELD_NULL;
return null;
}
String raw = new String(buf, pos, length, StandardCha... | java | public LocalTime getInternalLocalTime(ColumnInformation columnInfo, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
if (length == 0) {
lastValueNull |= BIT_LAST_FIELD_NULL;
return null;
}
String raw = new String(buf, pos, length, StandardCha... | [
"public",
"LocalTime",
"getInternalLocalTime",
"(",
"ColumnInformation",
"columnInfo",
",",
"TimeZone",
"timeZone",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"length",
"==",
"0... | Get LocalTime format from raw text format.
@param columnInfo column information
@param timeZone time zone
@return LocalTime value
@throws SQLException if column type doesn't permit conversion | [
"Get",
"LocalTime",
"format",
"from",
"raw",
"text",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java#L1023-L1061 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java | TextRowProtocol.getInternalLocalDate | public LocalDate getInternalLocalDate(ColumnInformation columnInfo, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
if (length == 0) {
lastValueNull |= BIT_LAST_FIELD_NULL;
return null;
}
String raw = new String(buf, pos, length, StandardCha... | java | public LocalDate getInternalLocalDate(ColumnInformation columnInfo, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
if (length == 0) {
lastValueNull |= BIT_LAST_FIELD_NULL;
return null;
}
String raw = new String(buf, pos, length, StandardCha... | [
"public",
"LocalDate",
"getInternalLocalDate",
"(",
"ColumnInformation",
"columnInfo",
",",
"TimeZone",
"timeZone",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"length",
"==",
"0... | Get LocalDate format from raw text format.
@param columnInfo column information
@param timeZone time zone
@return LocalDate value
@throws SQLException if column type doesn't permit conversion | [
"Get",
"LocalDate",
"format",
"from",
"raw",
"text",
"format",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java#L1071-L1112 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java | AbstractConnectProtocol.connect | public void connect() throws SQLException {
if (!isClosed()) {
close();
}
try {
connect((currentHost != null) ? currentHost.host : null,
(currentHost != null) ? currentHost.port : 3306);
} catch (IOException ioException) {
throw ExceptionMapper.connException(
"Coul... | java | public void connect() throws SQLException {
if (!isClosed()) {
close();
}
try {
connect((currentHost != null) ? currentHost.host : null,
(currentHost != null) ? currentHost.port : 3306);
} catch (IOException ioException) {
throw ExceptionMapper.connException(
"Coul... | [
"public",
"void",
"connect",
"(",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"!",
"isClosed",
"(",
")",
")",
"{",
"close",
"(",
")",
";",
"}",
"try",
"{",
"connect",
"(",
"(",
"currentHost",
"!=",
"null",
")",
"?",
"currentHost",
".",
"host",
"... | Connect to currentHost.
@throws SQLException exception | [
"Connect",
"to",
"currentHost",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java#L363-L376 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java | AbstractConnectProtocol.connect | private void connect(String host, int port) throws SQLException, IOException {
try {
socket = Utils.createSocket(urlParser, host);
if (options.socketTimeout != null) {
socket.setSoTimeout(options.socketTimeout);
}
initializeSocketOption();
// Bind the socket to a particular i... | java | private void connect(String host, int port) throws SQLException, IOException {
try {
socket = Utils.createSocket(urlParser, host);
if (options.socketTimeout != null) {
socket.setSoTimeout(options.socketTimeout);
}
initializeSocketOption();
// Bind the socket to a particular i... | [
"private",
"void",
"connect",
"(",
"String",
"host",
",",
"int",
"port",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"try",
"{",
"socket",
"=",
"Utils",
".",
"createSocket",
"(",
"urlParser",
",",
"host",
")",
";",
"if",
"(",
"options",
".",
... | Connect the client and perform handshake.
@param host host
@param port port
@throws SQLException handshake error, e.g wrong user or password
@throws IOException connection error (host/port not available) | [
"Connect",
"the",
"client",
"and",
"perform",
"handshake",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java#L386-L473 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java | AbstractConnectProtocol.sendPipelineCheckMaster | private void sendPipelineCheckMaster() throws IOException {
if (urlParser.getHaMode() == HaMode.AURORA) {
writer.startPacket(0);
writer.write(COM_QUERY);
writer.write(IS_MASTER_QUERY);
writer.flush();
}
} | java | private void sendPipelineCheckMaster() throws IOException {
if (urlParser.getHaMode() == HaMode.AURORA) {
writer.startPacket(0);
writer.write(COM_QUERY);
writer.write(IS_MASTER_QUERY);
writer.flush();
}
} | [
"private",
"void",
"sendPipelineCheckMaster",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"urlParser",
".",
"getHaMode",
"(",
")",
"==",
"HaMode",
".",
"AURORA",
")",
"{",
"writer",
".",
"startPacket",
"(",
"0",
")",
";",
"writer",
".",
"write",
"... | Send query to identify if server is master.
@throws IOException in case of socket error. | [
"Send",
"query",
"to",
"identify",
"if",
"server",
"is",
"master",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java#L1068-L1075 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java | AbstractConnectProtocol.enabledSslCipherSuites | private void enabledSslCipherSuites(SSLSocket sslSocket) throws SQLException {
if (options.enabledSslCipherSuites != null) {
List<String> possibleCiphers = Arrays.asList(sslSocket.getSupportedCipherSuites());
String[] ciphers = options.enabledSslCipherSuites.split("[,;\\s]+");
for (String cipher :... | java | private void enabledSslCipherSuites(SSLSocket sslSocket) throws SQLException {
if (options.enabledSslCipherSuites != null) {
List<String> possibleCiphers = Arrays.asList(sslSocket.getSupportedCipherSuites());
String[] ciphers = options.enabledSslCipherSuites.split("[,;\\s]+");
for (String cipher :... | [
"private",
"void",
"enabledSslCipherSuites",
"(",
"SSLSocket",
"sslSocket",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"options",
".",
"enabledSslCipherSuites",
"!=",
"null",
")",
"{",
"List",
"<",
"String",
">",
"possibleCiphers",
"=",
"Arrays",
".",
"asLis... | Set ssl socket cipher according to options.
@param sslSocket current ssl socket
@throws SQLException if a cipher isn't known | [
"Set",
"ssl",
"socket",
"cipher",
"according",
"to",
"options",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java#L1265-L1277 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java | AbstractConnectProtocol.versionGreaterOrEqual | public boolean versionGreaterOrEqual(int major, int minor, int patch) {
if (this.majorVersion > major) {
return true;
}
if (this.majorVersion < major) {
return false;
}
/*
* Major versions are equal, compare minor versions
*/
if (this.minorVersion > minor) {
return ... | java | public boolean versionGreaterOrEqual(int major, int minor, int patch) {
if (this.majorVersion > major) {
return true;
}
if (this.majorVersion < major) {
return false;
}
/*
* Major versions are equal, compare minor versions
*/
if (this.minorVersion > minor) {
return ... | [
"public",
"boolean",
"versionGreaterOrEqual",
"(",
"int",
"major",
",",
"int",
"minor",
",",
"int",
"patch",
")",
"{",
"if",
"(",
"this",
".",
"majorVersion",
">",
"major",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"this",
".",
"majorVersion",
"... | Utility method to check if database version is greater than parameters.
@param major major version
@param minor minor version
@param patch patch version
@return true if version is greater than parameters | [
"Utility",
"method",
"to",
"check",
"if",
"database",
"version",
"is",
"greater",
"than",
"parameters",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java#L1287-L1308 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/send/authentication/ClearPasswordPlugin.java | ClearPasswordPlugin.process | public Buffer process(PacketOutputStream out, PacketInputStream in, AtomicInteger sequence) throws IOException {
if (password == null || password.isEmpty()) {
out.writeEmptyPacket(sequence.incrementAndGet());
} else {
out.startPacket(sequence.incrementAndGet());
byte[] bytePwd;
if (passw... | java | public Buffer process(PacketOutputStream out, PacketInputStream in, AtomicInteger sequence) throws IOException {
if (password == null || password.isEmpty()) {
out.writeEmptyPacket(sequence.incrementAndGet());
} else {
out.startPacket(sequence.incrementAndGet());
byte[] bytePwd;
if (passw... | [
"public",
"Buffer",
"process",
"(",
"PacketOutputStream",
"out",
",",
"PacketInputStream",
"in",
",",
"AtomicInteger",
"sequence",
")",
"throws",
"IOException",
"{",
"if",
"(",
"password",
"==",
"null",
"||",
"password",
".",
"isEmpty",
"(",
")",
")",
"{",
"... | Send password in clear text to server.
@param out out stream
@param in in stream
@param sequence packet sequence
@return response packet
@throws IOException if socket error | [
"Send",
"password",
"in",
"clear",
"text",
"to",
"server",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/send/authentication/ClearPasswordPlugin.java#L87-L107 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/input/StandardPacketInputStream.java | StandardPacketInputStream.create | public static byte[] create(byte[][] rowDatas, ColumnType[] columnTypes) {
int totalLength = 0;
for (byte[] rowData : rowDatas) {
if (rowData == null) {
totalLength++;
} else {
int length = rowData.length;
if (length < 251) {
totalLength += length + 1;
} el... | java | public static byte[] create(byte[][] rowDatas, ColumnType[] columnTypes) {
int totalLength = 0;
for (byte[] rowData : rowDatas) {
if (rowData == null) {
totalLength++;
} else {
int length = rowData.length;
if (length < 251) {
totalLength += length + 1;
} el... | [
"public",
"static",
"byte",
"[",
"]",
"create",
"(",
"byte",
"[",
"]",
"[",
"]",
"rowDatas",
",",
"ColumnType",
"[",
"]",
"columnTypes",
")",
"{",
"int",
"totalLength",
"=",
"0",
";",
"for",
"(",
"byte",
"[",
"]",
"rowData",
":",
"rowDatas",
")",
"... | Create Buffer with Text protocol values.
@param rowDatas datas
@param columnTypes column types
@return Buffer | [
"Create",
"Buffer",
"with",
"Text",
"protocol",
"values",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/input/StandardPacketInputStream.java#L159-L211 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/UrlParser.java | UrlParser.parse | public static UrlParser parse(final String url, Properties prop) throws SQLException {
if (url != null
&& (url.startsWith("jdbc:mariadb:") || url.startsWith("jdbc:mysql:") && !url
.contains(DISABLE_MYSQL_URL))) {
UrlParser urlParser = new UrlParser();
parseInternal(urlParser, url, (prop ... | java | public static UrlParser parse(final String url, Properties prop) throws SQLException {
if (url != null
&& (url.startsWith("jdbc:mariadb:") || url.startsWith("jdbc:mysql:") && !url
.contains(DISABLE_MYSQL_URL))) {
UrlParser urlParser = new UrlParser();
parseInternal(urlParser, url, (prop ... | [
"public",
"static",
"UrlParser",
"parse",
"(",
"final",
"String",
"url",
",",
"Properties",
"prop",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"url",
"!=",
"null",
"&&",
"(",
"url",
".",
"startsWith",
"(",
"\"jdbc:mariadb:\"",
")",
"||",
"url",
".",
... | Parse url connection string with additional properties.
@param url connection string
@param prop properties
@return UrlParser instance
@throws SQLException if parsing exception occur | [
"Parse",
"url",
"connection",
"string",
"with",
"additional",
"properties",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/UrlParser.java#L155-L164 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/UrlParser.java | UrlParser.parseInternal | private static void parseInternal(UrlParser urlParser, String url, Properties properties)
throws SQLException {
try {
urlParser.initialUrl = url;
int separator = url.indexOf("//");
if (separator == -1) {
throw new IllegalArgumentException(
"url parsing error : '//' is not... | java | private static void parseInternal(UrlParser urlParser, String url, Properties properties)
throws SQLException {
try {
urlParser.initialUrl = url;
int separator = url.indexOf("//");
if (separator == -1) {
throw new IllegalArgumentException(
"url parsing error : '//' is not... | [
"private",
"static",
"void",
"parseInternal",
"(",
"UrlParser",
"urlParser",
",",
"String",
"url",
",",
"Properties",
"properties",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"urlParser",
".",
"initialUrl",
"=",
"url",
";",
"int",
"separator",
"=",
"url",... | Parses the connection URL in order to set the UrlParser instance with all the information
provided through the URL.
@param urlParser object instance in which all data from the connection url is stored
@param url connection URL
@param properties properties
@throws SQLException if format is incorrect | [
"Parses",
"the",
"connection",
"URL",
"in",
"order",
"to",
"set",
"the",
"UrlParser",
"instance",
"with",
"all",
"the",
"information",
"provided",
"through",
"the",
"URL",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/UrlParser.java#L175-L211 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/UrlParser.java | UrlParser.auroraPipelineQuirks | public UrlParser auroraPipelineQuirks() {
//Aurora has issue with pipelining, depending on network speed.
//Driver must rely on information provided by user : hostname if dns, and HA mode.</p>
boolean disablePipeline = isAurora();
if (options.useBatchMultiSend == null) {
options.useBatchMultiSen... | java | public UrlParser auroraPipelineQuirks() {
//Aurora has issue with pipelining, depending on network speed.
//Driver must rely on information provided by user : hostname if dns, and HA mode.</p>
boolean disablePipeline = isAurora();
if (options.useBatchMultiSend == null) {
options.useBatchMultiSen... | [
"public",
"UrlParser",
"auroraPipelineQuirks",
"(",
")",
"{",
"//Aurora has issue with pipelining, depending on network speed.",
"//Driver must rely on information provided by user : hostname if dns, and HA mode.</p>",
"boolean",
"disablePipeline",
"=",
"isAurora",
"(",
")",
";",
"if",... | Permit to set parameters not forced. if options useBatchMultiSend and usePipelineAuth are not
explicitly set in connection string, value will default to true or false according if aurora
detection.
@return UrlParser for easy testing | [
"Permit",
"to",
"set",
"parameters",
"not",
"forced",
".",
"if",
"options",
"useBatchMultiSend",
"and",
"usePipelineAuth",
"are",
"not",
"explicitly",
"set",
"in",
"connection",
"string",
"value",
"will",
"default",
"to",
"true",
"or",
"false",
"according",
"if"... | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/UrlParser.java#L343-L357 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/ServerPrepareStatementCache.java | ServerPrepareStatementCache.removeEldestEntry | @Override
public boolean removeEldestEntry(Map.Entry eldest) {
boolean mustBeRemoved = this.size() > maxSize;
if (mustBeRemoved) {
ServerPrepareResult serverPrepareResult = ((ServerPrepareResult) eldest.getValue());
serverPrepareResult.setRemoveFromCache();
if (serverPrepareResult.canBeDeal... | java | @Override
public boolean removeEldestEntry(Map.Entry eldest) {
boolean mustBeRemoved = this.size() > maxSize;
if (mustBeRemoved) {
ServerPrepareResult serverPrepareResult = ((ServerPrepareResult) eldest.getValue());
serverPrepareResult.setRemoveFromCache();
if (serverPrepareResult.canBeDeal... | [
"@",
"Override",
"public",
"boolean",
"removeEldestEntry",
"(",
"Map",
".",
"Entry",
"eldest",
")",
"{",
"boolean",
"mustBeRemoved",
"=",
"this",
".",
"size",
"(",
")",
">",
"maxSize",
";",
"if",
"(",
"mustBeRemoved",
")",
"{",
"ServerPrepareResult",
"server... | Remove eldestEntry.
@param eldest eldest entry
@return true if eldest entry must be removed | [
"Remove",
"eldestEntry",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/ServerPrepareStatementCache.java#L83-L99 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/ServerPrepareStatementCache.java | ServerPrepareStatementCache.put | public synchronized ServerPrepareResult put(String key, ServerPrepareResult result) {
ServerPrepareResult cachedServerPrepareResult = super.get(key);
//if there is already some cached data (and not been deallocate), return existing cached data
if (cachedServerPrepareResult != null && cachedServerPrepareResu... | java | public synchronized ServerPrepareResult put(String key, ServerPrepareResult result) {
ServerPrepareResult cachedServerPrepareResult = super.get(key);
//if there is already some cached data (and not been deallocate), return existing cached data
if (cachedServerPrepareResult != null && cachedServerPrepareResu... | [
"public",
"synchronized",
"ServerPrepareResult",
"put",
"(",
"String",
"key",
",",
"ServerPrepareResult",
"result",
")",
"{",
"ServerPrepareResult",
"cachedServerPrepareResult",
"=",
"super",
".",
"get",
"(",
"key",
")",
";",
"//if there is already some cached data (and n... | Associates the specified value with the specified key in this map. If the map previously
contained a mapping for the key, the existing cached prepared result shared counter will be
incremented.
@param key key
@param result new prepare result.
@return the previous value associated with key if not been deallocate, or... | [
"Associates",
"the",
"specified",
"value",
"with",
"the",
"specified",
"key",
"in",
"this",
"map",
".",
"If",
"the",
"map",
"previously",
"contained",
"a",
"mapping",
"for",
"the",
"key",
"the",
"existing",
"cached",
"prepared",
"result",
"shared",
"counter",
... | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/ServerPrepareStatementCache.java#L111-L121 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/send/authentication/gssapi/WindowsNativeSspiAuthentication.java | WindowsNativeSspiAuthentication.authenticate | public void authenticate(final PacketOutputStream out, final PacketInputStream in, final AtomicInteger sequence,
final String servicePrincipalName, final String mechanisms) throws IOException {
// initialize a security context on the client
IWindowsSecurityContext clientContext = Win... | java | public void authenticate(final PacketOutputStream out, final PacketInputStream in, final AtomicInteger sequence,
final String servicePrincipalName, final String mechanisms) throws IOException {
// initialize a security context on the client
IWindowsSecurityContext clientContext = Win... | [
"public",
"void",
"authenticate",
"(",
"final",
"PacketOutputStream",
"out",
",",
"final",
"PacketInputStream",
"in",
",",
"final",
"AtomicInteger",
"sequence",
",",
"final",
"String",
"servicePrincipalName",
",",
"final",
"String",
"mechanisms",
")",
"throws",
"IOE... | Process native windows GSS plugin authentication.
@param out out stream
@param in in stream
@param sequence packet sequence
@param servicePrincipalName principal name
@param mechanisms gssapi mechanism
@throws IOException if socket error | [
"Process",
"native",
"windows",
"GSS",
"plugin",
"authentication",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/send/authentication/gssapi/WindowsNativeSspiAuthentication.java#L78-L106 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/send/SendClosePacket.java | SendClosePacket.send | public static void send(final PacketOutputStream pos) {
try {
pos.startPacket(0);
pos.write(Packet.COM_QUIT);
pos.flush();
} catch (IOException ioe) {
//eat
}
} | java | public static void send(final PacketOutputStream pos) {
try {
pos.startPacket(0);
pos.write(Packet.COM_QUIT);
pos.flush();
} catch (IOException ioe) {
//eat
}
} | [
"public",
"static",
"void",
"send",
"(",
"final",
"PacketOutputStream",
"pos",
")",
"{",
"try",
"{",
"pos",
".",
"startPacket",
"(",
"0",
")",
";",
"pos",
".",
"write",
"(",
"Packet",
".",
"COM_QUIT",
")",
";",
"pos",
".",
"flush",
"(",
")",
";",
"... | Send close stream to server.
@param pos write outputStream | [
"Send",
"close",
"stream",
"to",
"server",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/send/SendClosePacket.java#L67-L75 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java | AbstractPacketOutputStream.flush | public void flush() throws IOException {
flushBuffer(true);
out.flush();
// if buffer is big, and last query doesn't use at least half of it, resize buffer to default value
if (buf.length > SMALL_BUFFER_SIZE && cmdLength * 2 < buf.length) {
buf = new byte[SMALL_BUFFER_SIZE];
}
if (cmdLen... | java | public void flush() throws IOException {
flushBuffer(true);
out.flush();
// if buffer is big, and last query doesn't use at least half of it, resize buffer to default value
if (buf.length > SMALL_BUFFER_SIZE && cmdLength * 2 < buf.length) {
buf = new byte[SMALL_BUFFER_SIZE];
}
if (cmdLen... | [
"public",
"void",
"flush",
"(",
")",
"throws",
"IOException",
"{",
"flushBuffer",
"(",
"true",
")",
";",
"out",
".",
"flush",
"(",
")",
";",
"// if buffer is big, and last query doesn't use at least half of it, resize buffer to default value",
"if",
"(",
"buf",
".",
"... | Send packet to socket.
@throws IOException if socket error occur. | [
"Send",
"packet",
"to",
"socket",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java#L184-L198 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java | AbstractPacketOutputStream.checkMaxAllowedLength | public void checkMaxAllowedLength(int length) throws MaxAllowedPacketException {
if (cmdLength + length >= maxAllowedPacket && cmdLength == 0) {
//launch exception only if no packet has been send.
throw new MaxAllowedPacketException("query size (" + (cmdLength + length)
+ ") is >= to max_allow... | java | public void checkMaxAllowedLength(int length) throws MaxAllowedPacketException {
if (cmdLength + length >= maxAllowedPacket && cmdLength == 0) {
//launch exception only if no packet has been send.
throw new MaxAllowedPacketException("query size (" + (cmdLength + length)
+ ") is >= to max_allow... | [
"public",
"void",
"checkMaxAllowedLength",
"(",
"int",
"length",
")",
"throws",
"MaxAllowedPacketException",
"{",
"if",
"(",
"cmdLength",
"+",
"length",
">=",
"maxAllowedPacket",
"&&",
"cmdLength",
"==",
"0",
")",
"{",
"//launch exception only if no packet has been send... | Count query size. If query size is greater than max_allowed_packet and nothing has been already
send, throw an exception to avoid having the connection closed.
@param length additional length to query size
@throws MaxAllowedPacketException if query has not to be send. | [
"Count",
"query",
"size",
".",
"If",
"query",
"size",
"is",
"greater",
"than",
"max_allowed_packet",
"and",
"nothing",
"has",
"been",
"already",
"send",
"throw",
"an",
"exception",
"to",
"avoid",
"having",
"the",
"connection",
"closed",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java#L211-L217 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java | AbstractPacketOutputStream.writeShort | public void writeShort(short value) throws IOException {
if (2 > buf.length - pos) {
//not enough space remaining
byte[] arr = new byte[2];
arr[0] = (byte) value;
arr[1] = (byte) (value >> 8);
write(arr, 0, 2);
return;
}
buf[pos] = (byte) value;
buf[pos + 1] = (byte)... | java | public void writeShort(short value) throws IOException {
if (2 > buf.length - pos) {
//not enough space remaining
byte[] arr = new byte[2];
arr[0] = (byte) value;
arr[1] = (byte) (value >> 8);
write(arr, 0, 2);
return;
}
buf[pos] = (byte) value;
buf[pos + 1] = (byte)... | [
"public",
"void",
"writeShort",
"(",
"short",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"2",
">",
"buf",
".",
"length",
"-",
"pos",
")",
"{",
"//not enough space remaining",
"byte",
"[",
"]",
"arr",
"=",
"new",
"byte",
"[",
"2",
"]",
";",
... | Write short value into buffer. flush buffer if too small.
@param value short value
@throws IOException if socket error occur | [
"Write",
"short",
"value",
"into",
"buffer",
".",
"flush",
"buffer",
"if",
"too",
"small",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java#L233-L246 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java | AbstractPacketOutputStream.writeInt | public void writeInt(int value) throws IOException {
if (4 > buf.length - pos) {
//not enough space remaining
byte[] arr = new byte[4];
arr[0] = (byte) value;
arr[1] = (byte) (value >> 8);
arr[2] = (byte) (value >> 16);
arr[3] = (byte) (value >> 24);
write(arr, 0, 4);
... | java | public void writeInt(int value) throws IOException {
if (4 > buf.length - pos) {
//not enough space remaining
byte[] arr = new byte[4];
arr[0] = (byte) value;
arr[1] = (byte) (value >> 8);
arr[2] = (byte) (value >> 16);
arr[3] = (byte) (value >> 24);
write(arr, 0, 4);
... | [
"public",
"void",
"writeInt",
"(",
"int",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"4",
">",
"buf",
".",
"length",
"-",
"pos",
")",
"{",
"//not enough space remaining",
"byte",
"[",
"]",
"arr",
"=",
"new",
"byte",
"[",
"4",
"]",
";",
"a... | Write int value into buffer. flush buffer if too small.
@param value int value
@throws IOException if socket error occur | [
"Write",
"int",
"value",
"into",
"buffer",
".",
"flush",
"buffer",
"if",
"too",
"small",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java#L254-L271 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java | AbstractPacketOutputStream.writeLong | public void writeLong(long value) throws IOException {
if (8 > buf.length - pos) {
//not enough space remaining
byte[] arr = new byte[8];
arr[0] = (byte) value;
arr[1] = (byte) (value >> 8);
arr[2] = (byte) (value >> 16);
arr[3] = (byte) (value >> 24);
arr[4] = (byte) (valu... | java | public void writeLong(long value) throws IOException {
if (8 > buf.length - pos) {
//not enough space remaining
byte[] arr = new byte[8];
arr[0] = (byte) value;
arr[1] = (byte) (value >> 8);
arr[2] = (byte) (value >> 16);
arr[3] = (byte) (value >> 24);
arr[4] = (byte) (valu... | [
"public",
"void",
"writeLong",
"(",
"long",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"8",
">",
"buf",
".",
"length",
"-",
"pos",
")",
"{",
"//not enough space remaining",
"byte",
"[",
"]",
"arr",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
... | Write long value into buffer. flush buffer if too small.
@param value long value
@throws IOException if socket error occur | [
"Write",
"long",
"value",
"into",
"buffer",
".",
"flush",
"buffer",
"if",
"too",
"small",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java#L279-L304 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java | AbstractPacketOutputStream.writeBytes | public void writeBytes(byte value, int len) throws IOException {
if (len > buf.length - pos) {
//not enough space remaining
byte[] arr = new byte[len];
Arrays.fill(arr, value);
write(arr, 0, len);
return;
}
for (int i = pos; i < pos + len; i++) {
buf[i] = value;
}
... | java | public void writeBytes(byte value, int len) throws IOException {
if (len > buf.length - pos) {
//not enough space remaining
byte[] arr = new byte[len];
Arrays.fill(arr, value);
write(arr, 0, len);
return;
}
for (int i = pos; i < pos + len; i++) {
buf[i] = value;
}
... | [
"public",
"void",
"writeBytes",
"(",
"byte",
"value",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"len",
">",
"buf",
".",
"length",
"-",
"pos",
")",
"{",
"//not enough space remaining",
"byte",
"[",
"]",
"arr",
"=",
"new",
"byte",
... | Write byte value, len times into buffer. flush buffer if too small.
@param value byte value
@param len number of time to write value.
@throws IOException if socket error occur. | [
"Write",
"byte",
"value",
"len",
"times",
"into",
"buffer",
".",
"flush",
"buffer",
"if",
"too",
"small",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java#L313-L326 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java | AbstractPacketOutputStream.write | public void write(int value) throws IOException {
if (pos >= buf.length) {
if (pos >= getMaxPacketLength() && !bufferContainDataAfterMark) {
//buffer is more than a Packet, must flushBuffer()
flushBuffer(false);
} else {
growBuffer(1);
}
}
buf[pos++] = (byte) value;... | java | public void write(int value) throws IOException {
if (pos >= buf.length) {
if (pos >= getMaxPacketLength() && !bufferContainDataAfterMark) {
//buffer is more than a Packet, must flushBuffer()
flushBuffer(false);
} else {
growBuffer(1);
}
}
buf[pos++] = (byte) value;... | [
"public",
"void",
"write",
"(",
"int",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"pos",
">=",
"buf",
".",
"length",
")",
"{",
"if",
"(",
"pos",
">=",
"getMaxPacketLength",
"(",
")",
"&&",
"!",
"bufferContainDataAfterMark",
")",
"{",
"//buffe... | Write byte into buffer, flush buffer to socket if needed.
@param value byte to send
@throws IOException if socket error occur. | [
"Write",
"byte",
"into",
"buffer",
"flush",
"buffer",
"to",
"socket",
"if",
"needed",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java#L413-L423 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java | AbstractPacketOutputStream.write | public void write(byte[] arr, int off, int len) throws IOException {
if (len > buf.length - pos) {
if (buf.length != getMaxPacketLength()) {
growBuffer(len);
}
//max buffer size
if (len > buf.length - pos) {
if (mark != -1) {
growBuffer(len);
if (mark !=... | java | public void write(byte[] arr, int off, int len) throws IOException {
if (len > buf.length - pos) {
if (buf.length != getMaxPacketLength()) {
growBuffer(len);
}
//max buffer size
if (len > buf.length - pos) {
if (mark != -1) {
growBuffer(len);
if (mark !=... | [
"public",
"void",
"write",
"(",
"byte",
"[",
"]",
"arr",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"len",
">",
"buf",
".",
"length",
"-",
"pos",
")",
"{",
"if",
"(",
"buf",
".",
"length",
"!=",
"getMaxPac... | Write byte array to buffer. If buffer is full, flush socket.
@param arr byte array
@param off offset
@param len byte length to write
@throws IOException if socket error occur | [
"Write",
"byte",
"array",
"to",
"buffer",
".",
"If",
"buffer",
"is",
"full",
"flush",
"socket",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java#L437-L475 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java | AbstractPacketOutputStream.write | public void write(Reader reader, boolean escape, boolean noBackslashEscapes) throws IOException {
char[] buffer = new char[4096];
int len;
while ((len = reader.read(buffer)) >= 0) {
byte[] data = new String(buffer, 0, len).getBytes("UTF-8");
if (escape) {
writeBytesEscaped(data, data.len... | java | public void write(Reader reader, boolean escape, boolean noBackslashEscapes) throws IOException {
char[] buffer = new char[4096];
int len;
while ((len = reader.read(buffer)) >= 0) {
byte[] data = new String(buffer, 0, len).getBytes("UTF-8");
if (escape) {
writeBytesEscaped(data, data.len... | [
"public",
"void",
"write",
"(",
"Reader",
"reader",
",",
"boolean",
"escape",
",",
"boolean",
"noBackslashEscapes",
")",
"throws",
"IOException",
"{",
"char",
"[",
"]",
"buffer",
"=",
"new",
"char",
"[",
"4096",
"]",
";",
"int",
"len",
";",
"while",
"(",... | Write reader into socket.
@param reader reader
@param escape must be escape
@param noBackslashEscapes escape method
@throws IOException if socket error occur | [
"Write",
"reader",
"into",
"socket",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java#L652-L664 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java | AbstractPacketOutputStream.writeBytesEscaped | public void writeBytesEscaped(byte[] bytes, int len, boolean noBackslashEscapes)
throws IOException {
if (len * 2 > buf.length - pos) {
//makes buffer bigger (up to 16M)
if (buf.length != getMaxPacketLength()) {
growBuffer(len * 2);
}
//data may be bigger than buffer.
/... | java | public void writeBytesEscaped(byte[] bytes, int len, boolean noBackslashEscapes)
throws IOException {
if (len * 2 > buf.length - pos) {
//makes buffer bigger (up to 16M)
if (buf.length != getMaxPacketLength()) {
growBuffer(len * 2);
}
//data may be bigger than buffer.
/... | [
"public",
"void",
"writeBytesEscaped",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"len",
",",
"boolean",
"noBackslashEscapes",
")",
"throws",
"IOException",
"{",
"if",
"(",
"len",
"*",
"2",
">",
"buf",
".",
"length",
"-",
"pos",
")",
"{",
"//makes buffe... | Write escape bytes to socket.
@param bytes bytes
@param len len to write
@param noBackslashEscapes escape method
@throws IOException if socket error occur | [
"Write",
"escape",
"bytes",
"to",
"socket",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java#L698-L776 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java | AbstractPacketOutputStream.flushBufferStopAtMark | @Override
public void flushBufferStopAtMark() throws IOException {
final int end = pos;
pos = mark;
flushBuffer(true);
out.flush();
startPacket(0);
System.arraycopy(buf, mark, buf, pos, end - mark);
pos += end - mark;
mark = -1;
bufferContainDataAfterMark = true;
} | java | @Override
public void flushBufferStopAtMark() throws IOException {
final int end = pos;
pos = mark;
flushBuffer(true);
out.flush();
startPacket(0);
System.arraycopy(buf, mark, buf, pos, end - mark);
pos += end - mark;
mark = -1;
bufferContainDataAfterMark = true;
} | [
"@",
"Override",
"public",
"void",
"flushBufferStopAtMark",
"(",
")",
"throws",
"IOException",
"{",
"final",
"int",
"end",
"=",
"pos",
";",
"pos",
"=",
"mark",
";",
"flushBuffer",
"(",
"true",
")",
";",
"out",
".",
"flush",
"(",
")",
";",
"startPacket",
... | Flush to last mark.
@throws IOException if flush fail. | [
"Flush",
"to",
"last",
"mark",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java#L818-L830 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java | AbstractPacketOutputStream.resetMark | public byte[] resetMark() {
mark = -1;
if (bufferContainDataAfterMark) {
byte[] data = Arrays.copyOfRange(buf, initialPacketPos(), pos);
startPacket(0);
bufferContainDataAfterMark = false;
return data;
}
return null;
} | java | public byte[] resetMark() {
mark = -1;
if (bufferContainDataAfterMark) {
byte[] data = Arrays.copyOfRange(buf, initialPacketPos(), pos);
startPacket(0);
bufferContainDataAfterMark = false;
return data;
}
return null;
} | [
"public",
"byte",
"[",
"]",
"resetMark",
"(",
")",
"{",
"mark",
"=",
"-",
"1",
";",
"if",
"(",
"bufferContainDataAfterMark",
")",
"{",
"byte",
"[",
"]",
"data",
"=",
"Arrays",
".",
"copyOfRange",
"(",
"buf",
",",
"initialPacketPos",
"(",
")",
",",
"p... | Reset mark flag and send bytes after mark flag.
@return bytes after mark flag | [
"Reset",
"mark",
"flag",
"and",
"send",
"bytes",
"after",
"mark",
"flag",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java#L841-L851 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/scheduler/SchedulerServiceProviderHolder.java | SchedulerServiceProviderHolder.getScheduler | public static DynamicSizedSchedulerInterface getScheduler(int initialThreadCount, String poolName,
int maximumPoolSize) {
return getSchedulerProvider().getScheduler(initialThreadCount, poolName, maximumPoolSize);
} | java | public static DynamicSizedSchedulerInterface getScheduler(int initialThreadCount, String poolName,
int maximumPoolSize) {
return getSchedulerProvider().getScheduler(initialThreadCount, poolName, maximumPoolSize);
} | [
"public",
"static",
"DynamicSizedSchedulerInterface",
"getScheduler",
"(",
"int",
"initialThreadCount",
",",
"String",
"poolName",
",",
"int",
"maximumPoolSize",
")",
"{",
"return",
"getSchedulerProvider",
"(",
")",
".",
"getScheduler",
"(",
"initialThreadCount",
",",
... | Get a Dynamic sized scheduler directly with the current set provider.
@param initialThreadCount Number of threads scheduler is allowed to grow to
@param poolName name of pool to identify threads
@param maximumPoolSize maximum pool size
@return Scheduler capable of providing the needed thread count | [
"Get",
"a",
"Dynamic",
"sized",
"scheduler",
"directly",
"with",
"the",
"current",
"set",
"provider",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/scheduler/SchedulerServiceProviderHolder.java#L135-L138 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/socket/NamedPipeSocket.java | NamedPipeSocket.connect | public void connect(SocketAddress endpoint, int timeout) throws IOException {
String filename;
if (host == null || host.equals("localhost")) {
filename = "\\\\.\\pipe\\" + name;
} else {
filename = "\\\\" + host + "\\pipe\\" + name;
}
//use a default timeout of 100ms if no timeout set.
... | java | public void connect(SocketAddress endpoint, int timeout) throws IOException {
String filename;
if (host == null || host.equals("localhost")) {
filename = "\\\\.\\pipe\\" + name;
} else {
filename = "\\\\" + host + "\\pipe\\" + name;
}
//use a default timeout of 100ms if no timeout set.
... | [
"public",
"void",
"connect",
"(",
"SocketAddress",
"endpoint",
",",
"int",
"timeout",
")",
"throws",
"IOException",
"{",
"String",
"filename",
";",
"if",
"(",
"host",
"==",
"null",
"||",
"host",
".",
"equals",
"(",
"\"localhost\"",
")",
")",
"{",
"filename... | Name pipe connection.
@param endpoint endPoint
@param timeout timeout in milliseconds
@throws IOException exception | [
"Name",
"pipe",
"connection",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/socket/NamedPipeSocket.java#L100-L176 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/send/parameters/SerializableParameter.java | SerializableParameter.writeTo | public void writeTo(final PacketOutputStream pos) throws IOException {
if (loadedStream == null) {
writeObjectToBytes();
}
pos.write(BINARY_INTRODUCER);
pos.writeBytesEscaped(loadedStream, loadedStream.length, noBackSlashEscapes);
pos.write(QUOTE);
} | java | public void writeTo(final PacketOutputStream pos) throws IOException {
if (loadedStream == null) {
writeObjectToBytes();
}
pos.write(BINARY_INTRODUCER);
pos.writeBytesEscaped(loadedStream, loadedStream.length, noBackSlashEscapes);
pos.write(QUOTE);
} | [
"public",
"void",
"writeTo",
"(",
"final",
"PacketOutputStream",
"pos",
")",
"throws",
"IOException",
"{",
"if",
"(",
"loadedStream",
"==",
"null",
")",
"{",
"writeObjectToBytes",
"(",
")",
";",
"}",
"pos",
".",
"write",
"(",
"BINARY_INTRODUCER",
")",
";",
... | Write object to buffer for text protocol.
@param pos the stream to write to
@throws IOException if error reading stream | [
"Write",
"object",
"to",
"buffer",
"for",
"text",
"protocol",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/send/parameters/SerializableParameter.java#L78-L86 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/dao/ServerPrepareResult.java | ServerPrepareResult.failover | public void failover(int statementId, Protocol unProxiedProtocol) {
this.statementId = statementId;
this.unProxiedProtocol = unProxiedProtocol;
this.parameterTypeHeader = new ColumnType[parameters.length];
this.shareCounter = 1;
this.isBeingDeallocate = false;
} | java | public void failover(int statementId, Protocol unProxiedProtocol) {
this.statementId = statementId;
this.unProxiedProtocol = unProxiedProtocol;
this.parameterTypeHeader = new ColumnType[parameters.length];
this.shareCounter = 1;
this.isBeingDeallocate = false;
} | [
"public",
"void",
"failover",
"(",
"int",
"statementId",
",",
"Protocol",
"unProxiedProtocol",
")",
"{",
"this",
".",
"statementId",
"=",
"statementId",
";",
"this",
".",
"unProxiedProtocol",
"=",
"unProxiedProtocol",
";",
"this",
".",
"parameterTypeHeader",
"=",
... | Update information after a failover.
@param statementId new statement Id
@param unProxiedProtocol the protocol on which the prepare has been done | [
"Update",
"information",
"after",
"a",
"failover",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/dao/ServerPrepareResult.java#L103-L110 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbResultSetMetaData.java | MariaDbResultSetMetaData.isNullable | public int isNullable(final int column) throws SQLException {
if ((getColumnInformation(column).getFlags() & ColumnFlags.NOT_NULL) == 0) {
return ResultSetMetaData.columnNullable;
} else {
return ResultSetMetaData.columnNoNulls;
}
} | java | public int isNullable(final int column) throws SQLException {
if ((getColumnInformation(column).getFlags() & ColumnFlags.NOT_NULL) == 0) {
return ResultSetMetaData.columnNullable;
} else {
return ResultSetMetaData.columnNoNulls;
}
} | [
"public",
"int",
"isNullable",
"(",
"final",
"int",
"column",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"(",
"getColumnInformation",
"(",
"column",
")",
".",
"getFlags",
"(",
")",
"&",
"ColumnFlags",
".",
"NOT_NULL",
")",
"==",
"0",
")",
"{",
"retur... | Indicates the nullability of values in the designated column.
@param column the first column is 1, the second is 2, ...
@return the nullability status of the given column; one of <code>columnNoNulls</code>,
<code>columnNullable</code> or <code>columnNullableUnknown</code>
@throws SQLException if a database access erro... | [
"Indicates",
"the",
"nullability",
"of",
"values",
"in",
"the",
"designated",
"column",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbResultSetMetaData.java#L144-L150 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbResultSetMetaData.java | MariaDbResultSetMetaData.getTableName | public String getTableName(final int column) throws SQLException {
if (returnTableAlias) {
return getColumnInformation(column).getTable();
} else {
return getColumnInformation(column).getOriginalTable();
}
} | java | public String getTableName(final int column) throws SQLException {
if (returnTableAlias) {
return getColumnInformation(column).getTable();
} else {
return getColumnInformation(column).getOriginalTable();
}
} | [
"public",
"String",
"getTableName",
"(",
"final",
"int",
"column",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"returnTableAlias",
")",
"{",
"return",
"getColumnInformation",
"(",
"column",
")",
".",
"getTable",
"(",
")",
";",
"}",
"else",
"{",
"return",
... | Gets the designated column's table name.
@param column the first column is 1, the second is 2, ...
@return table name or "" if not applicable
@throws SQLException if a database access error occurs | [
"Gets",
"the",
"designated",
"column",
"s",
"table",
"name",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbResultSetMetaData.java#L255-L261 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbResultSetMetaData.java | MariaDbResultSetMetaData.getColumnType | public int getColumnType(final int column) throws SQLException {
ColumnInformation ci = getColumnInformation(column);
switch (ci.getColumnType()) {
case BIT:
if (ci.getLength() == 1) {
return Types.BIT;
}
return Types.VARBINARY;
case TINYINT:
if (ci.getLengt... | java | public int getColumnType(final int column) throws SQLException {
ColumnInformation ci = getColumnInformation(column);
switch (ci.getColumnType()) {
case BIT:
if (ci.getLength() == 1) {
return Types.BIT;
}
return Types.VARBINARY;
case TINYINT:
if (ci.getLengt... | [
"public",
"int",
"getColumnType",
"(",
"final",
"int",
"column",
")",
"throws",
"SQLException",
"{",
"ColumnInformation",
"ci",
"=",
"getColumnInformation",
"(",
"column",
")",
";",
"switch",
"(",
"ci",
".",
"getColumnType",
"(",
")",
")",
"{",
"case",
"BIT"... | Retrieves the designated column's SQL type.
@param column the first column is 1, the second is 2, ...
@return SQL type from java.sql.Types
@throws SQLException if a database access error occurs
@see Types | [
"Retrieves",
"the",
"designated",
"column",
"s",
"SQL",
"type",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbResultSetMetaData.java#L276-L317 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java | MariaDbDatabaseMetaData.skipWhite | private static int skipWhite(char[] part, int startPos) {
for (int i = startPos; i < part.length; i++) {
if (!Character.isWhitespace(part[i])) {
return i;
}
}
return part.length;
} | java | private static int skipWhite(char[] part, int startPos) {
for (int i = startPos; i < part.length; i++) {
if (!Character.isWhitespace(part[i])) {
return i;
}
}
return part.length;
} | [
"private",
"static",
"int",
"skipWhite",
"(",
"char",
"[",
"]",
"part",
",",
"int",
"startPos",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"startPos",
";",
"i",
"<",
"part",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"Character",
".",
... | Return new position, or -1 on error | [
"Return",
"new",
"position",
"or",
"-",
"1",
"on",
"error"
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java#L116-L123 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java | MariaDbDatabaseMetaData.catalogCond | private String catalogCond(String columnName, String catalog) {
if (catalog == null) {
/* Treat null catalog as current */
if (connection.nullCatalogMeansCurrent) {
return "(ISNULL(database()) OR (" + columnName + " = database()))";
}
return "(1 = 1)";
}
if (catalog.isEmpty()... | java | private String catalogCond(String columnName, String catalog) {
if (catalog == null) {
/* Treat null catalog as current */
if (connection.nullCatalogMeansCurrent) {
return "(ISNULL(database()) OR (" + columnName + " = database()))";
}
return "(1 = 1)";
}
if (catalog.isEmpty()... | [
"private",
"String",
"catalogCond",
"(",
"String",
"columnName",
",",
"String",
"catalog",
")",
"{",
"if",
"(",
"catalog",
"==",
"null",
")",
"{",
"/* Treat null catalog as current */",
"if",
"(",
"connection",
".",
"nullCatalogMeansCurrent",
")",
"{",
"return",
... | Generate part of the information schema query that restricts catalog names In the driver,
catalogs is the equivalent to MariaDB schemas.
@param columnName - column name in the information schema table
@param catalog - catalog name. This driver does not (always) follow JDBC standard for
following special values, due... | [
"Generate",
"part",
"of",
"the",
"information",
"schema",
"query",
"that",
"restricts",
"catalog",
"names",
"In",
"the",
"driver",
"catalogs",
"is",
"the",
"equivalent",
"to",
"MariaDB",
"schemas",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java#L502-L515 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java | MariaDbDatabaseMetaData.getPseudoColumns | public ResultSet getPseudoColumns(String catalog, String schemaPattern, String tableNamePattern,
String columnNamePattern) throws SQLException {
return connection.createStatement().executeQuery(
"SELECT ' ' TABLE_CAT, ' ' TABLE_SCHEM,"
+ "' ' TABLE_NAME, ' ' COLUMN_NAME, 0 DATA_TYPE, 0 COL... | java | public ResultSet getPseudoColumns(String catalog, String schemaPattern, String tableNamePattern,
String columnNamePattern) throws SQLException {
return connection.createStatement().executeQuery(
"SELECT ' ' TABLE_CAT, ' ' TABLE_SCHEM,"
+ "' ' TABLE_NAME, ' ' COLUMN_NAME, 0 DATA_TYPE, 0 COL... | [
"public",
"ResultSet",
"getPseudoColumns",
"(",
"String",
"catalog",
",",
"String",
"schemaPattern",
",",
"String",
"tableNamePattern",
",",
"String",
"columnNamePattern",
")",
"throws",
"SQLException",
"{",
"return",
"connection",
".",
"createStatement",
"(",
")",
... | Retrieves a description of the pseudo or hidden columns available in a given table within the
specified catalog and schema. Pseudo or hidden columns may not always be stored within a table
and are not visible in a ResultSet unless they are specified in the query's outermost SELECT
list. Pseudo or hidden columns may not... | [
"Retrieves",
"a",
"description",
"of",
"the",
"pseudo",
"or",
"hidden",
"columns",
"available",
"in",
"a",
"given",
"table",
"within",
"the",
"specified",
"catalog",
"and",
"schema",
".",
"Pseudo",
"or",
"hidden",
"columns",
"may",
"not",
"always",
"be",
"st... | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java#L1085-L1092 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java | MariaDbDatabaseMetaData.getDatabaseProductName | public String getDatabaseProductName() throws SQLException {
if (urlParser.getOptions().useMysqlMetadata) {
return "MySQL";
}
if (connection.getProtocol().isServerMariaDb()
&& connection.getProtocol().getServerVersion().toLowerCase(Locale.ROOT).contains("mariadb")) {
return "MariaDB"... | java | public String getDatabaseProductName() throws SQLException {
if (urlParser.getOptions().useMysqlMetadata) {
return "MySQL";
}
if (connection.getProtocol().isServerMariaDb()
&& connection.getProtocol().getServerVersion().toLowerCase(Locale.ROOT).contains("mariadb")) {
return "MariaDB"... | [
"public",
"String",
"getDatabaseProductName",
"(",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"urlParser",
".",
"getOptions",
"(",
")",
".",
"useMysqlMetadata",
")",
"{",
"return",
"\"MySQL\"",
";",
"}",
"if",
"(",
"connection",
".",
"getProtocol",
"(",
... | Return Server type.
MySQL or MariaDB. MySQL can be forced for compatibility with option "useMysqlMetadata"
@return server type
@throws SQLException in case of socket error. | [
"Return",
"Server",
"type",
".",
"MySQL",
"or",
"MariaDB",
".",
"MySQL",
"can",
"be",
"forced",
"for",
"compatibility",
"with",
"option",
"useMysqlMetadata"
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java#L1138-L1147 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java | MariaDbDatabaseMetaData.getVersionColumns | public ResultSet getVersionColumns(String catalog, String schema, String table)
throws SQLException {
String sql =
"SELECT 0 SCOPE, ' ' COLUMN_NAME, 0 DATA_TYPE,"
+ " ' ' TYPE_NAME, 0 COLUMN_SIZE, 0 BUFFER_LENGTH,"
+ " 0 DECIMAL_DIGITS, 0 PSEUDO_COLUMN "
+ " FROM DU... | java | public ResultSet getVersionColumns(String catalog, String schema, String table)
throws SQLException {
String sql =
"SELECT 0 SCOPE, ' ' COLUMN_NAME, 0 DATA_TYPE,"
+ " ' ' TYPE_NAME, 0 COLUMN_SIZE, 0 BUFFER_LENGTH,"
+ " 0 DECIMAL_DIGITS, 0 PSEUDO_COLUMN "
+ " FROM DU... | [
"public",
"ResultSet",
"getVersionColumns",
"(",
"String",
"catalog",
",",
"String",
"schema",
",",
"String",
"table",
")",
"throws",
"SQLException",
"{",
"String",
"sql",
"=",
"\"SELECT 0 SCOPE, ' ' COLUMN_NAME, 0 DATA_TYPE,\"",
"+",
"\" ' ' TYPE_NAME, 0 COLUMN_SIZE, 0 BUF... | Retrieves a description of a table's columns that are automatically updated when any value in a
row is updated. They are unordered.
<P>Each column description has the following columns:</p>
<OL> <LI><B>SCOPE</B> short {@code =>}
is not used <LI><B>COLUMN_NAME</B> String {@code =>} column name <LI><B>DATA_TYPE</B> in... | [
"Retrieves",
"a",
"description",
"of",
"a",
"table",
"s",
"columns",
"that",
"are",
"automatically",
"updated",
"when",
"any",
"value",
"in",
"a",
"row",
"is",
"updated",
".",
"They",
"are",
"unordered",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java#L2183-L2191 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/protocol/tls/SslFactory.java | SslFactory.getSslSocketFactory | public static SSLSocketFactory getSslSocketFactory(Options options) throws SQLException {
TrustManager[] trustManager = null;
KeyManager[] keyManager = null;
if (options.trustServerCertificate || options.serverSslCert != null
|| options.trustStore != null) {
trustManager = new X509TrustManag... | java | public static SSLSocketFactory getSslSocketFactory(Options options) throws SQLException {
TrustManager[] trustManager = null;
KeyManager[] keyManager = null;
if (options.trustServerCertificate || options.serverSslCert != null
|| options.trustStore != null) {
trustManager = new X509TrustManag... | [
"public",
"static",
"SSLSocketFactory",
"getSslSocketFactory",
"(",
"Options",
"options",
")",
"throws",
"SQLException",
"{",
"TrustManager",
"[",
"]",
"trustManager",
"=",
"null",
";",
"KeyManager",
"[",
"]",
"keyManager",
"=",
"null",
";",
"if",
"(",
"options"... | Create an SSL factory according to connection string options.
@param options connection options
@return SSL socket factory
@throws SQLException in case of error initializing context. | [
"Create",
"an",
"SSL",
"factory",
"according",
"to",
"connection",
"string",
"options",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/tls/SslFactory.java#L34-L71 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/ClientSidePreparedStatement.java | ClientSidePreparedStatement.clearBatch | @Override
public void clearBatch() {
parameterList.clear();
hasLongData = false;
this.parameters = new ParameterHolder[prepareResult.getParamCount()];
} | java | @Override
public void clearBatch() {
parameterList.clear();
hasLongData = false;
this.parameters = new ParameterHolder[prepareResult.getParamCount()];
} | [
"@",
"Override",
"public",
"void",
"clearBatch",
"(",
")",
"{",
"parameterList",
".",
"clear",
"(",
")",
";",
"hasLongData",
"=",
"false",
";",
"this",
".",
"parameters",
"=",
"new",
"ParameterHolder",
"[",
"prepareResult",
".",
"getParamCount",
"(",
")",
... | Clear batch. | [
"Clear",
"batch",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/ClientSidePreparedStatement.java#L277-L282 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/ClientSidePreparedStatement.java | ClientSidePreparedStatement.executeInternalBatch | private void executeInternalBatch(int size) throws SQLException {
executeQueryPrologue(true);
results = new Results(this, 0, true, size, false, resultSetScrollType,
resultSetConcurrency, autoGeneratedKeys, protocol.getAutoIncrementIncrement());
if (protocol
.executeBatchClient(protocol.i... | java | private void executeInternalBatch(int size) throws SQLException {
executeQueryPrologue(true);
results = new Results(this, 0, true, size, false, resultSetScrollType,
resultSetConcurrency, autoGeneratedKeys, protocol.getAutoIncrementIncrement());
if (protocol
.executeBatchClient(protocol.i... | [
"private",
"void",
"executeInternalBatch",
"(",
"int",
"size",
")",
"throws",
"SQLException",
"{",
"executeQueryPrologue",
"(",
"true",
")",
";",
"results",
"=",
"new",
"Results",
"(",
"this",
",",
"0",
",",
"true",
",",
"size",
",",
"false",
",",
"resultS... | Choose better way to execute queries according to query and options.
@param size parameters number
@throws SQLException if any error occur | [
"Choose",
"better",
"way",
"to",
"execute",
"queries",
"according",
"to",
"query",
"and",
"options",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/ClientSidePreparedStatement.java#L355-L401 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/ClientSidePreparedStatement.java | ClientSidePreparedStatement.setParameter | public void setParameter(final int parameterIndex, final ParameterHolder holder)
throws SQLException {
if (parameterIndex >= 1 && parameterIndex < prepareResult.getParamCount() + 1) {
parameters[parameterIndex - 1] = holder;
} else {
String error = "Could not set parameter at position " + para... | java | public void setParameter(final int parameterIndex, final ParameterHolder holder)
throws SQLException {
if (parameterIndex >= 1 && parameterIndex < prepareResult.getParamCount() + 1) {
parameters[parameterIndex - 1] = holder;
} else {
String error = "Could not set parameter at position " + para... | [
"public",
"void",
"setParameter",
"(",
"final",
"int",
"parameterIndex",
",",
"final",
"ParameterHolder",
"holder",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"parameterIndex",
">=",
"1",
"&&",
"parameterIndex",
"<",
"prepareResult",
".",
"getParamCount",
"(",... | Set parameter.
@param parameterIndex index
@param holder parameter holder
@throws SQLException if index position doesn't correspond to query parameters | [
"Set",
"parameter",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/ClientSidePreparedStatement.java#L442-L467 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/ClientSidePreparedStatement.java | ClientSidePreparedStatement.close | @Override
public void close() throws SQLException {
super.close();
if (connection == null || connection.pooledConnection == null
|| connection.pooledConnection.noStmtEventListeners()) {
return;
}
connection.pooledConnection.fireStatementClosed(this);
connection = null;
} | java | @Override
public void close() throws SQLException {
super.close();
if (connection == null || connection.pooledConnection == null
|| connection.pooledConnection.noStmtEventListeners()) {
return;
}
connection.pooledConnection.fireStatementClosed(this);
connection = null;
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"SQLException",
"{",
"super",
".",
"close",
"(",
")",
";",
"if",
"(",
"connection",
"==",
"null",
"||",
"connection",
".",
"pooledConnection",
"==",
"null",
"||",
"connection",
".",
"pooledCon... | Close prepared statement, maybe fire closed-statement events | [
"Close",
"prepared",
"statement",
"maybe",
"fire",
"closed",
"-",
"statement",
"events"
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/ClientSidePreparedStatement.java#L520-L529 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/output/CompressPacketOutputStream.java | CompressPacketOutputStream.writeEmptyPacket | public void writeEmptyPacket() throws IOException {
buf[0] = (byte) 4;
buf[1] = (byte) 0x00;
buf[2] = (byte) 0x00;
buf[3] = (byte) this.compressSeqNo++;
buf[4] = (byte) 0x00;
buf[5] = (byte) 0x00;
buf[6] = (byte) 0x00;
buf[7] = (byte) 0x00;
buf[8] = (byte) 0x00;
buf[9] = (byte) 0... | java | public void writeEmptyPacket() throws IOException {
buf[0] = (byte) 4;
buf[1] = (byte) 0x00;
buf[2] = (byte) 0x00;
buf[3] = (byte) this.compressSeqNo++;
buf[4] = (byte) 0x00;
buf[5] = (byte) 0x00;
buf[6] = (byte) 0x00;
buf[7] = (byte) 0x00;
buf[8] = (byte) 0x00;
buf[9] = (byte) 0... | [
"public",
"void",
"writeEmptyPacket",
"(",
")",
"throws",
"IOException",
"{",
"buf",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"4",
";",
"buf",
"[",
"1",
"]",
"=",
"(",
"byte",
")",
"0x00",
";",
"buf",
"[",
"2",
"]",
"=",
"(",
"byte",
")",
"0x00",
... | Write an empty packet.
@throws IOException if socket error occur. | [
"Write",
"an",
"empty",
"packet",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/output/CompressPacketOutputStream.java#L394-L418 | train |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/protocol/authentication/DefaultAuthenticationProvider.java | DefaultAuthenticationProvider.processAuthPlugin | public static AuthenticationPlugin processAuthPlugin(String plugin,
String password,
byte[] authData,
Options options)
throws SQLException {
swit... | java | public static AuthenticationPlugin processAuthPlugin(String plugin,
String password,
byte[] authData,
Options options)
throws SQLException {
swit... | [
"public",
"static",
"AuthenticationPlugin",
"processAuthPlugin",
"(",
"String",
"plugin",
",",
"String",
"password",
",",
"byte",
"[",
"]",
"authData",
",",
"Options",
"options",
")",
"throws",
"SQLException",
"{",
"switch",
"(",
"plugin",
")",
"{",
"case",
"M... | Process AuthenticationSwitch.
@param plugin plugin name
@param password password
@param authData auth data
@param options connection string options
@return authentication response according to parameters
@throws SQLException if error occur. | [
"Process",
"AuthenticationSwitch",
"."
] | d148c7cd347c4680617be65d9e511b289d38a30b | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/authentication/DefaultAuthenticationProvider.java#L86-L110 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.