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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/api/OAuthClient.java | OAuthClient.acquireAccessToken | protected void acquireAccessToken(final OAuthCallback cb) {
if (isAccessTokenCached()) {
// Execute the callback immediately with cached OAuth credentials
if (VERBOSE) Log.d(TAG, "Access token cached");
if (cb != null) {
// Ensure networking occurs off the mai... | java | protected void acquireAccessToken(final OAuthCallback cb) {
if (isAccessTokenCached()) {
// Execute the callback immediately with cached OAuth credentials
if (VERBOSE) Log.d(TAG, "Access token cached");
if (cb != null) {
// Ensure networking occurs off the mai... | [
"protected",
"void",
"acquireAccessToken",
"(",
"final",
"OAuthCallback",
"cb",
")",
"{",
"if",
"(",
"isAccessTokenCached",
"(",
")",
")",
"{",
"// Execute the callback immediately with cached OAuth credentials",
"if",
"(",
"VERBOSE",
")",
"Log",
".",
"d",
"(",
"TAG... | Asynchronously attempt to acquire an OAuth Access Token
@param cb called when AccessToken is acquired. Always called
on a background thread suitable for networking. | [
"Asynchronously",
"attempt",
"to",
"acquire",
"an",
"OAuth",
"Access",
"Token"
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/api/OAuthClient.java#L96-L154 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/api/OAuthClient.java | OAuthClient.executeQueuedCallbacks | protected void executeQueuedCallbacks() {
if (VERBOSE)
Log.i(TAG, String.format("Executing %d queued callbacks", mCallbackQueue.size()));
for (OAuthCallback cb : mCallbackQueue) {
cb.onSuccess(getRequestFactoryFromCachedCredentials());
}
} | java | protected void executeQueuedCallbacks() {
if (VERBOSE)
Log.i(TAG, String.format("Executing %d queued callbacks", mCallbackQueue.size()));
for (OAuthCallback cb : mCallbackQueue) {
cb.onSuccess(getRequestFactoryFromCachedCredentials());
}
} | [
"protected",
"void",
"executeQueuedCallbacks",
"(",
")",
"{",
"if",
"(",
"VERBOSE",
")",
"Log",
".",
"i",
"(",
"TAG",
",",
"String",
".",
"format",
"(",
"\"Executing %d queued callbacks\"",
",",
"mCallbackQueue",
".",
"size",
"(",
")",
")",
")",
";",
"for"... | Execute queued callbacks once valid OAuth
credentials are acquired. | [
"Execute",
"queued",
"callbacks",
"once",
"valid",
"OAuth",
"credentials",
"are",
"acquired",
"."
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/api/OAuthClient.java#L214-L220 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/av/FFmpegMuxer.java | FFmpegMuxer.captureH264MetaData | private void captureH264MetaData(ByteBuffer encodedData, MediaCodec.BufferInfo bufferInfo) {
mH264MetaSize = bufferInfo.size;
mH264Keyframe = ByteBuffer.allocateDirect(encodedData.capacity());
byte[] videoConfig = new byte[bufferInfo.size];
encodedData.get(videoConfig, bufferInfo.offset,... | java | private void captureH264MetaData(ByteBuffer encodedData, MediaCodec.BufferInfo bufferInfo) {
mH264MetaSize = bufferInfo.size;
mH264Keyframe = ByteBuffer.allocateDirect(encodedData.capacity());
byte[] videoConfig = new byte[bufferInfo.size];
encodedData.get(videoConfig, bufferInfo.offset,... | [
"private",
"void",
"captureH264MetaData",
"(",
"ByteBuffer",
"encodedData",
",",
"MediaCodec",
".",
"BufferInfo",
"bufferInfo",
")",
"{",
"mH264MetaSize",
"=",
"bufferInfo",
".",
"size",
";",
"mH264Keyframe",
"=",
"ByteBuffer",
".",
"allocateDirect",
"(",
"encodedDa... | Should only be called once, when the encoder produces
an output buffer with the BUFFER_FLAG_CODEC_CONFIG flag.
For H264 output, this indicates the Sequence Parameter Set
and Picture Parameter Set are contained in the buffer.
These NAL units are required before every keyframe to ensure
playback is possible in a segmente... | [
"Should",
"only",
"be",
"called",
"once",
"when",
"the",
"encoder",
"produces",
"an",
"output",
"buffer",
"with",
"the",
"BUFFER_FLAG_CODEC_CONFIG",
"flag",
".",
"For",
"H264",
"output",
"this",
"indicates",
"the",
"Sequence",
"Parameter",
"Set",
"and",
"Picture... | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/FFmpegMuxer.java#L296-L305 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/av/FFmpegMuxer.java | FFmpegMuxer.packageH264Keyframe | private void packageH264Keyframe(ByteBuffer encodedData, MediaCodec.BufferInfo bufferInfo) {
mH264Keyframe.position(mH264MetaSize);
mH264Keyframe.put(encodedData); // BufferOverflow
} | java | private void packageH264Keyframe(ByteBuffer encodedData, MediaCodec.BufferInfo bufferInfo) {
mH264Keyframe.position(mH264MetaSize);
mH264Keyframe.put(encodedData); // BufferOverflow
} | [
"private",
"void",
"packageH264Keyframe",
"(",
"ByteBuffer",
"encodedData",
",",
"MediaCodec",
".",
"BufferInfo",
"bufferInfo",
")",
"{",
"mH264Keyframe",
".",
"position",
"(",
"mH264MetaSize",
")",
";",
"mH264Keyframe",
".",
"put",
"(",
"encodedData",
")",
";",
... | Adds the SPS + PPS data to the ByteBuffer containing a h264 keyframe
@param encodedData
@param bufferInfo | [
"Adds",
"the",
"SPS",
"+",
"PPS",
"data",
"to",
"the",
"ByteBuffer",
"containing",
"a",
"h264",
"keyframe"
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/FFmpegMuxer.java#L313-L316 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/av/Texture2dProgram.java | Texture2dProgram.handleTouchEvent | public void handleTouchEvent(MotionEvent ev){
if(ev.getAction() == MotionEvent.ACTION_MOVE){
// A finger is dragging about
if(mTexHeight != 0 && mTexWidth != 0){
mSummedTouchPosition[0] += (2 * (ev.getX() - mLastTouchPosition[0])) / mTexWidth;
mSummedTouch... | java | public void handleTouchEvent(MotionEvent ev){
if(ev.getAction() == MotionEvent.ACTION_MOVE){
// A finger is dragging about
if(mTexHeight != 0 && mTexWidth != 0){
mSummedTouchPosition[0] += (2 * (ev.getX() - mLastTouchPosition[0])) / mTexWidth;
mSummedTouch... | [
"public",
"void",
"handleTouchEvent",
"(",
"MotionEvent",
"ev",
")",
"{",
"if",
"(",
"ev",
".",
"getAction",
"(",
")",
"==",
"MotionEvent",
".",
"ACTION_MOVE",
")",
"{",
"// A finger is dragging about",
"if",
"(",
"mTexHeight",
"!=",
"0",
"&&",
"mTexWidth",
... | Configures the effect offset
This only has an effect for programs that
use positional effects like SQUEEZE and MIRROR | [
"Configures",
"the",
"effect",
"offset"
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/Texture2dProgram.java#L468-L482 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/av/Texture2dProgram.java | Texture2dProgram.setKernel | public void setKernel(float[] values, float colorAdj) {
if (values.length != KERNEL_SIZE) {
throw new IllegalArgumentException("Kernel size is " + values.length +
" vs. " + KERNEL_SIZE);
}
System.arraycopy(values, 0, mKernel, 0, KERNEL_SIZE);
mColorAdjust ... | java | public void setKernel(float[] values, float colorAdj) {
if (values.length != KERNEL_SIZE) {
throw new IllegalArgumentException("Kernel size is " + values.length +
" vs. " + KERNEL_SIZE);
}
System.arraycopy(values, 0, mKernel, 0, KERNEL_SIZE);
mColorAdjust ... | [
"public",
"void",
"setKernel",
"(",
"float",
"[",
"]",
"values",
",",
"float",
"colorAdj",
")",
"{",
"if",
"(",
"values",
".",
"length",
"!=",
"KERNEL_SIZE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Kernel size is \"",
"+",
"values",
"."... | Configures the convolution filter values.
This only has an effect for programs that use the
FRAGMENT_SHADER_EXT_FILT Fragment shader.
@param values Normalized filter values; must be KERNEL_SIZE elements. | [
"Configures",
"the",
"convolution",
"filter",
"values",
".",
"This",
"only",
"has",
"an",
"effect",
"for",
"programs",
"that",
"use",
"the",
"FRAGMENT_SHADER_EXT_FILT",
"Fragment",
"shader",
"."
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/Texture2dProgram.java#L491-L499 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/av/Texture2dProgram.java | Texture2dProgram.setTexSize | public void setTexSize(int width, int height) {
mTexHeight = height;
mTexWidth = width;
float rw = 1.0f / width;
float rh = 1.0f / height;
// Don't need to create a new array here, but it's syntactically convenient.
mTexOffset = new float[] {
-rw, -rh, ... | java | public void setTexSize(int width, int height) {
mTexHeight = height;
mTexWidth = width;
float rw = 1.0f / width;
float rh = 1.0f / height;
// Don't need to create a new array here, but it's syntactically convenient.
mTexOffset = new float[] {
-rw, -rh, ... | [
"public",
"void",
"setTexSize",
"(",
"int",
"width",
",",
"int",
"height",
")",
"{",
"mTexHeight",
"=",
"height",
";",
"mTexWidth",
"=",
"width",
";",
"float",
"rw",
"=",
"1.0f",
"/",
"width",
";",
"float",
"rh",
"=",
"1.0f",
"/",
"height",
";",
"// ... | Sets the size of the texture. This is used to find adjacent texels when filtering. | [
"Sets",
"the",
"size",
"of",
"the",
"texture",
".",
"This",
"is",
"used",
"to",
"find",
"adjacent",
"texels",
"when",
"filtering",
"."
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/Texture2dProgram.java#L504-L517 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/av/Texture2dProgram.java | Texture2dProgram.draw | public void draw(float[] mvpMatrix, FloatBuffer vertexBuffer, int firstVertex,
int vertexCount, int coordsPerVertex, int vertexStride,
float[] texMatrix, FloatBuffer texBuffer, int textureId, int texStride) {
GlUtil.checkGlError("draw start");
// Select the pro... | java | public void draw(float[] mvpMatrix, FloatBuffer vertexBuffer, int firstVertex,
int vertexCount, int coordsPerVertex, int vertexStride,
float[] texMatrix, FloatBuffer texBuffer, int textureId, int texStride) {
GlUtil.checkGlError("draw start");
// Select the pro... | [
"public",
"void",
"draw",
"(",
"float",
"[",
"]",
"mvpMatrix",
",",
"FloatBuffer",
"vertexBuffer",
",",
"int",
"firstVertex",
",",
"int",
"vertexCount",
",",
"int",
"coordsPerVertex",
",",
"int",
"vertexStride",
",",
"float",
"[",
"]",
"texMatrix",
",",
"Flo... | Issues the draw call. Does the full setup on every call.
@param mvpMatrix The 4x4 projection matrix.
@param vertexBuffer Buffer with vertex position data.
@param firstVertex Index of first vertex to use in vertexBuffer.
@param vertexCount Number of vertices in vertexBuffer.
@param coordsPerVertex The number of coordi... | [
"Issues",
"the",
"draw",
"call",
".",
"Does",
"the",
"full",
"setup",
"on",
"every",
"call",
"."
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/Texture2dProgram.java#L533-L593 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/location/DeviceLocation.java | DeviceLocation.getLastKnownLocation | public static void getLastKnownLocation(Context context, boolean waitForGpsFix, final LocationResult cb) {
DeviceLocation deviceLocation = new DeviceLocation();
LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
Location last_loc;
last_loc = lm.ge... | java | public static void getLastKnownLocation(Context context, boolean waitForGpsFix, final LocationResult cb) {
DeviceLocation deviceLocation = new DeviceLocation();
LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
Location last_loc;
last_loc = lm.ge... | [
"public",
"static",
"void",
"getLastKnownLocation",
"(",
"Context",
"context",
",",
"boolean",
"waitForGpsFix",
",",
"final",
"LocationResult",
"cb",
")",
"{",
"DeviceLocation",
"deviceLocation",
"=",
"new",
"DeviceLocation",
"(",
")",
";",
"LocationManager",
"lm",
... | Get the last known location.
If one is not available, fetch
a fresh location
@param context
@param waitForGpsFix
@param cb | [
"Get",
"the",
"last",
"known",
"location",
".",
"If",
"one",
"is",
"not",
"available",
"fetch",
"a",
"fresh",
"location"
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/location/DeviceLocation.java#L41-L55 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/Kickflip.java | Kickflip.getApiClient | public static KickflipApiClient getApiClient(Context context, KickflipCallback callback) {
checkNotNull(sClientKey);
checkNotNull(sClientSecret);
if (sKickflip == null || !sKickflip.getConfig().getClientId().equals(sClientKey)) {
sKickflip = new KickflipApiClient(context, sClientKey,... | java | public static KickflipApiClient getApiClient(Context context, KickflipCallback callback) {
checkNotNull(sClientKey);
checkNotNull(sClientSecret);
if (sKickflip == null || !sKickflip.getConfig().getClientId().equals(sClientKey)) {
sKickflip = new KickflipApiClient(context, sClientKey,... | [
"public",
"static",
"KickflipApiClient",
"getApiClient",
"(",
"Context",
"context",
",",
"KickflipCallback",
"callback",
")",
"{",
"checkNotNull",
"(",
"sClientKey",
")",
";",
"checkNotNull",
"(",
"sClientSecret",
")",
";",
"if",
"(",
"sKickflip",
"==",
"null",
... | Create a new instance of the KickflipApiClient if one hasn't
yet been created, or the provided API keys don't match
the existing client.
@param context the context of the host application
@param callback an optional callback to be notified with the Kickflip user
corresponding to the provided API keys.
@return | [
"Create",
"a",
"new",
"instance",
"of",
"the",
"KickflipApiClient",
"if",
"one",
"hasn",
"t",
"yet",
"been",
"created",
"or",
"the",
"provided",
"API",
"keys",
"don",
"t",
"match",
"the",
"existing",
"client",
"."
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/Kickflip.java#L336-L345 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java | KickflipApiClient.loginUser | public void loginUser(String username, final String password, final KickflipCallback cb) {
GenericData data = new GenericData();
data.put("username", username);
data.put("password", password);
post(GET_USER_PRIVATE, new UrlEncodedContent(data), User.class, new KickflipCallback() {
... | java | public void loginUser(String username, final String password, final KickflipCallback cb) {
GenericData data = new GenericData();
data.put("username", username);
data.put("password", password);
post(GET_USER_PRIVATE, new UrlEncodedContent(data), User.class, new KickflipCallback() {
... | [
"public",
"void",
"loginUser",
"(",
"String",
"username",
",",
"final",
"String",
"password",
",",
"final",
"KickflipCallback",
"cb",
")",
"{",
"GenericData",
"data",
"=",
"new",
"GenericData",
"(",
")",
";",
"data",
".",
"put",
"(",
"\"username\"",
",",
"... | Login an exiting Kickflip User and make it active.
@param username The Kickflip user's username
@param password The Kickflip user's password
@param cb This callback will receive a User in {@link io.kickflip.sdk.api.KickflipCallback#onSuccess(io.kickflip.sdk.api.json.Response)}
or an Exception {@link io.kickflip.... | [
"Login",
"an",
"exiting",
"Kickflip",
"User",
"and",
"make",
"it",
"active",
"."
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java#L214-L234 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java | KickflipApiClient.setUserInfo | public void setUserInfo(final String newPassword, String email, String displayName, Map extraInfo, final KickflipCallback cb) {
if (!assertActiveUserAvailable(cb)) return;
GenericData data = new GenericData();
final String finalPassword;
if (newPassword != null){
data.put("ne... | java | public void setUserInfo(final String newPassword, String email, String displayName, Map extraInfo, final KickflipCallback cb) {
if (!assertActiveUserAvailable(cb)) return;
GenericData data = new GenericData();
final String finalPassword;
if (newPassword != null){
data.put("ne... | [
"public",
"void",
"setUserInfo",
"(",
"final",
"String",
"newPassword",
",",
"String",
"email",
",",
"String",
"displayName",
",",
"Map",
"extraInfo",
",",
"final",
"KickflipCallback",
"cb",
")",
"{",
"if",
"(",
"!",
"assertActiveUserAvailable",
"(",
"cb",
")"... | Set the current active user's meta info. Pass a null argument to leave it as-is.
@param newPassword the user's new password
@param email the user's new email address
@param displayName The desired display name
@param extraInfo Arbitrary String data to associate with this user.
@param cb This callback ... | [
"Set",
"the",
"current",
"active",
"user",
"s",
"meta",
"info",
".",
"Pass",
"a",
"null",
"argument",
"to",
"leave",
"it",
"as",
"-",
"is",
"."
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java#L246-L275 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java | KickflipApiClient.getUserInfo | public void getUserInfo(String username, final KickflipCallback cb) {
if (!assertActiveUserAvailable(cb)) return;
GenericData data = new GenericData();
data.put("username", username);
post(GET_USER_PUBLIC, new UrlEncodedContent(data), User.class, new KickflipCallback() {
@Ov... | java | public void getUserInfo(String username, final KickflipCallback cb) {
if (!assertActiveUserAvailable(cb)) return;
GenericData data = new GenericData();
data.put("username", username);
post(GET_USER_PUBLIC, new UrlEncodedContent(data), User.class, new KickflipCallback() {
@Ov... | [
"public",
"void",
"getUserInfo",
"(",
"String",
"username",
",",
"final",
"KickflipCallback",
"cb",
")",
"{",
"if",
"(",
"!",
"assertActiveUserAvailable",
"(",
"cb",
")",
")",
"return",
";",
"GenericData",
"data",
"=",
"new",
"GenericData",
"(",
")",
";",
... | Get public user info
@param username The Kickflip user's username
@param cb This callback will receive a User in {@link io.kickflip.sdk.api.KickflipCallback#onSuccess(io.kickflip.sdk.api.json.Response)}
or an Exception {@link io.kickflip.sdk.api.KickflipCallback#onError(io.kickflip.sdk.exception.KickflipExceptio... | [
"Get",
"public",
"user",
"info"
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java#L284-L303 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java | KickflipApiClient.stopStream | private void stopStream(User user, Stream stream, final KickflipCallback cb) {
checkNotNull(stream);
// TODO: Add start / stop lat lon to Stream?
GenericData data = new GenericData();
data.put("stream_id", stream.getStreamId());
data.put("uuid", user.getUUID());
if (strea... | java | private void stopStream(User user, Stream stream, final KickflipCallback cb) {
checkNotNull(stream);
// TODO: Add start / stop lat lon to Stream?
GenericData data = new GenericData();
data.put("stream_id", stream.getStreamId());
data.put("uuid", user.getUUID());
if (strea... | [
"private",
"void",
"stopStream",
"(",
"User",
"user",
",",
"Stream",
"stream",
",",
"final",
"KickflipCallback",
"cb",
")",
"{",
"checkNotNull",
"(",
"stream",
")",
";",
"// TODO: Add start / stop lat lon to Stream?",
"GenericData",
"data",
"=",
"new",
"GenericData"... | Stop a Stream owned by the given Kickflip User.
@param cb This callback will receive a Stream subclass in #onSuccess(response)
depending on the Kickflip account type. Implementors should
check if the response is instanceof HlsStream, etc. | [
"Stop",
"a",
"Stream",
"owned",
"by",
"the",
"given",
"Kickflip",
"User",
"."
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java#L370-L383 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java | KickflipApiClient.handleKickflipResponse | private void handleKickflipResponse(HttpResponse response, Class<? extends Response> responseClass, KickflipCallback cb) throws IOException {
if (cb == null) return;
HashMap responseMap = null;
Response kickFlipResponse = response.parseAs(responseClass);
if (VERBOSE)
Log.i(TA... | java | private void handleKickflipResponse(HttpResponse response, Class<? extends Response> responseClass, KickflipCallback cb) throws IOException {
if (cb == null) return;
HashMap responseMap = null;
Response kickFlipResponse = response.parseAs(responseClass);
if (VERBOSE)
Log.i(TA... | [
"private",
"void",
"handleKickflipResponse",
"(",
"HttpResponse",
"response",
",",
"Class",
"<",
"?",
"extends",
"Response",
">",
"responseClass",
",",
"KickflipCallback",
"cb",
")",
"throws",
"IOException",
"{",
"if",
"(",
"cb",
"==",
"null",
")",
"return",
"... | Parse the HttpResponse as the appropriate Response subclass
@param response
@param responseClass
@param cb
@throws IOException | [
"Parse",
"the",
"HttpResponse",
"as",
"the",
"appropriate",
"Response",
"subclass"
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java#L699-L721 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/FileUtils.java | FileUtils.getRootStorageDirectory | public static File getRootStorageDirectory(Context c, String directory_name){
File result;
// First, try getting access to the sdcard partition
if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
Log.d(TAG,"Using sdcard");
result = new File(Enviro... | java | public static File getRootStorageDirectory(Context c, String directory_name){
File result;
// First, try getting access to the sdcard partition
if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
Log.d(TAG,"Using sdcard");
result = new File(Enviro... | [
"public",
"static",
"File",
"getRootStorageDirectory",
"(",
"Context",
"c",
",",
"String",
"directory_name",
")",
"{",
"File",
"result",
";",
"// First, try getting access to the sdcard partition",
"if",
"(",
"Environment",
".",
"getExternalStorageState",
"(",
")",
".",... | Returns a Java File initialized to a directory of given name
at the root storage location, with preference to external storage.
If the directory did not exist, it will be created at the conclusion of this call.
If a file with conflicting name exists, this method returns null;
@param c the context to determine the inte... | [
"Returns",
"a",
"Java",
"File",
"initialized",
"to",
"a",
"directory",
"of",
"given",
"name",
"at",
"the",
"root",
"storage",
"location",
"with",
"preference",
"to",
"external",
"storage",
".",
"If",
"the",
"directory",
"did",
"not",
"exist",
"it",
"will",
... | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/FileUtils.java#L54-L73 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/FileUtils.java | FileUtils.getStorageDirectory | public static File getStorageDirectory(File parent_directory, String new_child_directory_name){
File result = new File(parent_directory, new_child_directory_name);
if(!result.exists())
if(result.mkdir())
return result;
else{
Log.e("getStorageDirec... | java | public static File getStorageDirectory(File parent_directory, String new_child_directory_name){
File result = new File(parent_directory, new_child_directory_name);
if(!result.exists())
if(result.mkdir())
return result;
else{
Log.e("getStorageDirec... | [
"public",
"static",
"File",
"getStorageDirectory",
"(",
"File",
"parent_directory",
",",
"String",
"new_child_directory_name",
")",
"{",
"File",
"result",
"=",
"new",
"File",
"(",
"parent_directory",
",",
"new_child_directory_name",
")",
";",
"if",
"(",
"!",
"resu... | Returns a Java File initialized to a directory of given name
within the given location.
@param parent_directory a File representing the directory in which the new child will reside
@return a File pointing to the desired directory, or null if a file with conflicting name
exists or if getRootStorageDirectory was not cal... | [
"Returns",
"a",
"Java",
"File",
"initialized",
"to",
"a",
"directory",
"of",
"given",
"name",
"within",
"the",
"given",
"location",
"."
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/FileUtils.java#L83-L99 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/FileUtils.java | FileUtils.createTempFile | public static File createTempFile(Context c, File root, String filename, String extension){
File output = null;
try {
if(filename != null){
if(!extension.contains("."))
extension = "." + extension;
output = new File(root, filename + extensi... | java | public static File createTempFile(Context c, File root, String filename, String extension){
File output = null;
try {
if(filename != null){
if(!extension.contains("."))
extension = "." + extension;
output = new File(root, filename + extensi... | [
"public",
"static",
"File",
"createTempFile",
"(",
"Context",
"c",
",",
"File",
"root",
",",
"String",
"filename",
",",
"String",
"extension",
")",
"{",
"File",
"output",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"filename",
"!=",
"null",
")",
"{",
"if"... | Returns a TempFile with given root, filename, and extension.
The resulting TempFile is safe for use with Android's MediaRecorder
@param c
@param root
@param filename
@param extension
@return | [
"Returns",
"a",
"TempFile",
"with",
"given",
"root",
"filename",
"and",
"extension",
".",
"The",
"resulting",
"TempFile",
"is",
"safe",
"for",
"use",
"with",
"Android",
"s",
"MediaRecorder"
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/FileUtils.java#L110-L126 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/FileUtils.java | FileUtils.tail2 | public static String tail2( File file, int lines) {
lines++; // Read # lines inclusive
java.io.RandomAccessFile fileHandler = null;
try {
fileHandler =
new java.io.RandomAccessFile( file, "r" );
long fileLength = fileHandler.length() - 1;
... | java | public static String tail2( File file, int lines) {
lines++; // Read # lines inclusive
java.io.RandomAccessFile fileHandler = null;
try {
fileHandler =
new java.io.RandomAccessFile( file, "r" );
long fileLength = fileHandler.length() - 1;
... | [
"public",
"static",
"String",
"tail2",
"(",
"File",
"file",
",",
"int",
"lines",
")",
"{",
"lines",
"++",
";",
"// Read # lines inclusive",
"java",
".",
"io",
".",
"RandomAccessFile",
"fileHandler",
"=",
"null",
";",
"try",
"{",
"fileHandler",
"=",
"new",
... | Read the last few lines of a file
@param file the source file
@param lines the number of lines to read
@return the String result | [
"Read",
"the",
"last",
"few",
"lines",
"of",
"a",
"file"
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/FileUtils.java#L182-L226 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/FileUtils.java | FileUtils.deleteDirectory | public static void deleteDirectory(File fileOrDirectory) {
if (fileOrDirectory.isDirectory())
for (File child : fileOrDirectory.listFiles())
deleteDirectory(child);
fileOrDirectory.delete();
} | java | public static void deleteDirectory(File fileOrDirectory) {
if (fileOrDirectory.isDirectory())
for (File child : fileOrDirectory.listFiles())
deleteDirectory(child);
fileOrDirectory.delete();
} | [
"public",
"static",
"void",
"deleteDirectory",
"(",
"File",
"fileOrDirectory",
")",
"{",
"if",
"(",
"fileOrDirectory",
".",
"isDirectory",
"(",
")",
")",
"for",
"(",
"File",
"child",
":",
"fileOrDirectory",
".",
"listFiles",
"(",
")",
")",
"deleteDirectory",
... | Delete a directory and all its contents | [
"Delete",
"a",
"directory",
"and",
"all",
"its",
"contents"
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/FileUtils.java#L231-L237 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/av/Muxer.java | Muxer.getNextRelativePts | protected long getNextRelativePts(long absPts, int trackIndex) {
if (mFirstPts == 0) {
mFirstPts = absPts;
return 0;
}
return getSafePts(absPts - mFirstPts, trackIndex);
} | java | protected long getNextRelativePts(long absPts, int trackIndex) {
if (mFirstPts == 0) {
mFirstPts = absPts;
return 0;
}
return getSafePts(absPts - mFirstPts, trackIndex);
} | [
"protected",
"long",
"getNextRelativePts",
"(",
"long",
"absPts",
",",
"int",
"trackIndex",
")",
"{",
"if",
"(",
"mFirstPts",
"==",
"0",
")",
"{",
"mFirstPts",
"=",
"absPts",
";",
"return",
"0",
";",
"}",
"return",
"getSafePts",
"(",
"absPts",
"-",
"mFir... | Return a relative pts given an absolute pts and trackIndex.
This method advances the state of the Muxer, and must only
be called once per call to {@link #writeSampleData(android.media.MediaCodec, int, int, java.nio.ByteBuffer, android.media.MediaCodec.BufferInfo)}. | [
"Return",
"a",
"relative",
"pts",
"given",
"an",
"absolute",
"pts",
"and",
"trackIndex",
"."
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/Muxer.java#L164-L170 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/av/Muxer.java | Muxer.getSafePts | private long getSafePts(long pts, int trackIndex) {
if (mLastPts[trackIndex] >= pts) {
// Enforce a non-zero minimum spacing
// between pts
mLastPts[trackIndex] += 9643;
return mLastPts[trackIndex];
}
mLastPts[trackIndex] = pts;
return pts;... | java | private long getSafePts(long pts, int trackIndex) {
if (mLastPts[trackIndex] >= pts) {
// Enforce a non-zero minimum spacing
// between pts
mLastPts[trackIndex] += 9643;
return mLastPts[trackIndex];
}
mLastPts[trackIndex] = pts;
return pts;... | [
"private",
"long",
"getSafePts",
"(",
"long",
"pts",
",",
"int",
"trackIndex",
")",
"{",
"if",
"(",
"mLastPts",
"[",
"trackIndex",
"]",
">=",
"pts",
")",
"{",
"// Enforce a non-zero minimum spacing",
"// between pts",
"mLastPts",
"[",
"trackIndex",
"]",
"+=",
... | Sometimes packets with non-increasing pts are dequeued from the MediaCodec output buffer.
This method ensures that a crash won't occur due to non monotonically increasing packet timestamp. | [
"Sometimes",
"packets",
"with",
"non",
"-",
"increasing",
"pts",
"are",
"dequeued",
"from",
"the",
"MediaCodec",
"output",
"buffer",
".",
"This",
"method",
"ensures",
"that",
"a",
"crash",
"won",
"t",
"occur",
"due",
"to",
"non",
"monotonically",
"increasing",... | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/Muxer.java#L176-L185 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/av/Filters.java | Filters.updateFilter | public static void updateFilter(FullFrameRect rect, int newFilter) {
Texture2dProgram.ProgramType programType;
float[] kernel = null;
float colorAdj = 0.0f;
if (VERBOSE) Log.d(TAG, "Updating filter to " + newFilter);
switch (newFilter) {
case FILTER_NONE:
... | java | public static void updateFilter(FullFrameRect rect, int newFilter) {
Texture2dProgram.ProgramType programType;
float[] kernel = null;
float colorAdj = 0.0f;
if (VERBOSE) Log.d(TAG, "Updating filter to " + newFilter);
switch (newFilter) {
case FILTER_NONE:
... | [
"public",
"static",
"void",
"updateFilter",
"(",
"FullFrameRect",
"rect",
",",
"int",
"newFilter",
")",
"{",
"Texture2dProgram",
".",
"ProgramType",
"programType",
";",
"float",
"[",
"]",
"kernel",
"=",
"null",
";",
"float",
"colorAdj",
"=",
"0.0f",
";",
"if... | Updates the filter on the provided FullFrameRect
@return the int code of the new filter | [
"Updates",
"the",
"filter",
"on",
"the",
"provided",
"FullFrameRect"
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/Filters.java#L47-L136 | train |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/av/SizeableFrameRect.java | SizeableFrameRect.drawFrame | public void drawFrame(int textureId, float[] texMatrix) {
// Use the identity matrix for MVP so our 2x2 FULL_RECTANGLE covers the viewport.
mProgram.draw(IDENTITY_MATRIX, mRectDrawable.getVertexArray(), 0,
mRectDrawable.getVertexCount(), mRectDrawable.getCoordsPerVertex(),
... | java | public void drawFrame(int textureId, float[] texMatrix) {
// Use the identity matrix for MVP so our 2x2 FULL_RECTANGLE covers the viewport.
mProgram.draw(IDENTITY_MATRIX, mRectDrawable.getVertexArray(), 0,
mRectDrawable.getVertexCount(), mRectDrawable.getCoordsPerVertex(),
... | [
"public",
"void",
"drawFrame",
"(",
"int",
"textureId",
",",
"float",
"[",
"]",
"texMatrix",
")",
"{",
"// Use the identity matrix for MVP so our 2x2 FULL_RECTANGLE covers the viewport.",
"mProgram",
".",
"draw",
"(",
"IDENTITY_MATRIX",
",",
"mRectDrawable",
".",
"getVert... | Draws a rectangle in an area defined by TEX_COORDS | [
"Draws",
"a",
"rectangle",
"in",
"an",
"area",
"defined",
"by",
"TEX_COORDS"
] | af3aae5f1128d7376e67aefe11a3a1a3844be734 | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/SizeableFrameRect.java#L97-L103 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgStatement.java | PgStatement.isOneShotQuery | protected boolean isOneShotQuery(CachedQuery cachedQuery) {
if (cachedQuery == null) {
return true;
}
cachedQuery.increaseExecuteCount();
if ((mPrepareThreshold == 0 || cachedQuery.getExecuteCount() < mPrepareThreshold)
&& !getForceBinaryTransfer()) {
return true;
}
return fa... | java | protected boolean isOneShotQuery(CachedQuery cachedQuery) {
if (cachedQuery == null) {
return true;
}
cachedQuery.increaseExecuteCount();
if ((mPrepareThreshold == 0 || cachedQuery.getExecuteCount() < mPrepareThreshold)
&& !getForceBinaryTransfer()) {
return true;
}
return fa... | [
"protected",
"boolean",
"isOneShotQuery",
"(",
"CachedQuery",
"cachedQuery",
")",
"{",
"if",
"(",
"cachedQuery",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"cachedQuery",
".",
"increaseExecuteCount",
"(",
")",
";",
"if",
"(",
"(",
"mPrepareThreshold",... | Returns true if query is unlikely to be reused.
@param cachedQuery to check (null if current query)
@return true if query is unlikely to be reused | [
"Returns",
"true",
"if",
"query",
"is",
"unlikely",
"to",
"be",
"reused",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgStatement.java#L355-L365 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgStatement.java | PgStatement.setQueryTimeoutMs | public void setQueryTimeoutMs(long millis) throws SQLException {
checkClosed();
if (millis < 0) {
throw new PSQLException(GT.tr("Query timeout must be a value greater than or equals to 0."),
PSQLState.INVALID_PARAMETER_VALUE);
}
timeout = millis;
} | java | public void setQueryTimeoutMs(long millis) throws SQLException {
checkClosed();
if (millis < 0) {
throw new PSQLException(GT.tr("Query timeout must be a value greater than or equals to 0."),
PSQLState.INVALID_PARAMETER_VALUE);
}
timeout = millis;
} | [
"public",
"void",
"setQueryTimeoutMs",
"(",
"long",
"millis",
")",
"throws",
"SQLException",
"{",
"checkClosed",
"(",
")",
";",
"if",
"(",
"millis",
"<",
"0",
")",
"{",
"throw",
"new",
"PSQLException",
"(",
"GT",
".",
"tr",
"(",
"\"Query timeout must be a va... | Sets the queryTimeout limit.
@param millis - the new query timeout limit in milliseconds
@throws SQLException if a database access error occurs | [
"Sets",
"the",
"queryTimeout",
"limit",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgStatement.java#L556-L564 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/ds/PGPooledConnection.java | PGPooledConnection.close | @Override
public void close() throws SQLException {
if (last != null) {
last.close();
if (!con.isClosed()) {
if (!con.getAutoCommit()) {
try {
con.rollback();
} catch (SQLException ignored) {
}
}
}
}
try {
con.close();
}... | java | @Override
public void close() throws SQLException {
if (last != null) {
last.close();
if (!con.isClosed()) {
if (!con.getAutoCommit()) {
try {
con.rollback();
} catch (SQLException ignored) {
}
}
}
}
try {
con.close();
}... | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"last",
"!=",
"null",
")",
"{",
"last",
".",
"close",
"(",
")",
";",
"if",
"(",
"!",
"con",
".",
"isClosed",
"(",
")",
")",
"{",
"if",
"(",
"!",
"co... | Closes the physical database connection represented by this PooledConnection. If any client has
a connection based on this PooledConnection, it is forcibly closed as well. | [
"Closes",
"the",
"physical",
"database",
"connection",
"represented",
"by",
"this",
"PooledConnection",
".",
"If",
"any",
"client",
"has",
"a",
"connection",
"based",
"on",
"this",
"PooledConnection",
"it",
"is",
"forcibly",
"closed",
"as",
"well",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/ds/PGPooledConnection.java#L82-L100 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/ds/PGPooledConnection.java | PGPooledConnection.getConnection | @Override
public Connection getConnection() throws SQLException {
if (con == null) {
// Before throwing the exception, let's notify the registered listeners about the error
PSQLException sqlException =
new PSQLException(GT.tr("This PooledConnection has already been closed."),
P... | java | @Override
public Connection getConnection() throws SQLException {
if (con == null) {
// Before throwing the exception, let's notify the registered listeners about the error
PSQLException sqlException =
new PSQLException(GT.tr("This PooledConnection has already been closed."),
P... | [
"@",
"Override",
"public",
"Connection",
"getConnection",
"(",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"con",
"==",
"null",
")",
"{",
"// Before throwing the exception, let's notify the registered listeners about the error",
"PSQLException",
"sqlException",
"=",
"new... | Gets a handle for a client to use. This is a wrapper around the physical connection, so the
client can call close and it will just return the connection to the pool without really closing
the pgysical connection.
<p>
According to the JDBC 2.0 Optional Package spec (6.2.3), only one client may have an active
handle to ... | [
"Gets",
"a",
"handle",
"for",
"a",
"client",
"to",
"use",
".",
"This",
"is",
"a",
"wrapper",
"around",
"the",
"physical",
"connection",
"so",
"the",
"client",
"can",
"call",
"close",
"and",
"it",
"will",
"just",
"return",
"the",
"connection",
"to",
"the"... | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/ds/PGPooledConnection.java#L113-L157 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/ds/PGPooledConnection.java | PGPooledConnection.fireConnectionClosed | void fireConnectionClosed() {
ConnectionEvent evt = null;
// Copy the listener list so the listener can remove itself during this method call
ConnectionEventListener[] local =
listeners.toArray(new ConnectionEventListener[0]);
for (ConnectionEventListener listener : local) {
if (evt == nul... | java | void fireConnectionClosed() {
ConnectionEvent evt = null;
// Copy the listener list so the listener can remove itself during this method call
ConnectionEventListener[] local =
listeners.toArray(new ConnectionEventListener[0]);
for (ConnectionEventListener listener : local) {
if (evt == nul... | [
"void",
"fireConnectionClosed",
"(",
")",
"{",
"ConnectionEvent",
"evt",
"=",
"null",
";",
"// Copy the listener list so the listener can remove itself during this method call",
"ConnectionEventListener",
"[",
"]",
"local",
"=",
"listeners",
".",
"toArray",
"(",
"new",
"Con... | Used to fire a connection closed event to all listeners. | [
"Used",
"to",
"fire",
"a",
"connection",
"closed",
"event",
"to",
"all",
"listeners",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/ds/PGPooledConnection.java#L162-L173 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/largeobject/BlobInputStream.java | BlobInputStream.read | public int read() throws java.io.IOException {
checkClosed();
try {
if (limit > 0 && apos >= limit) {
return -1;
}
if (buffer == null || bpos >= buffer.length) {
buffer = lo.read(bsize);
bpos = 0;
}
// Handle EOF
if (bpos >= buffer.length) {
r... | java | public int read() throws java.io.IOException {
checkClosed();
try {
if (limit > 0 && apos >= limit) {
return -1;
}
if (buffer == null || bpos >= buffer.length) {
buffer = lo.read(bsize);
bpos = 0;
}
// Handle EOF
if (bpos >= buffer.length) {
r... | [
"public",
"int",
"read",
"(",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
"{",
"checkClosed",
"(",
")",
";",
"try",
"{",
"if",
"(",
"limit",
">",
"0",
"&&",
"apos",
">=",
"limit",
")",
"{",
"return",
"-",
"1",
";",
"}",
"if",
"(",
"bu... | The minimum required to implement input stream. | [
"The",
"minimum",
"required",
"to",
"implement",
"input",
"stream",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/largeobject/BlobInputStream.java#L84-L112 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/util/LruCache.java | LruCache.borrow | public synchronized Value borrow(Key key) throws SQLException {
Value value = cache.remove(key);
if (value == null) {
return createAction.create(key);
}
currentSize -= value.getSize();
return value;
} | java | public synchronized Value borrow(Key key) throws SQLException {
Value value = cache.remove(key);
if (value == null) {
return createAction.create(key);
}
currentSize -= value.getSize();
return value;
} | [
"public",
"synchronized",
"Value",
"borrow",
"(",
"Key",
"key",
")",
"throws",
"SQLException",
"{",
"Value",
"value",
"=",
"cache",
".",
"remove",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"createAction",
".",
"create",
... | Borrows an entry from the cache.
@param key cache key
@return entry from cache or newly created entry if cache does not contain given key.
@throws SQLException if entry creation fails | [
"Borrows",
"an",
"entry",
"from",
"the",
"cache",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/util/LruCache.java#L112-L119 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/util/LruCache.java | LruCache.put | public synchronized void put(Key key, Value value) {
long valueSize = value.getSize();
if (maxSizeBytes == 0 || maxSizeEntries == 0 || valueSize * 2 > maxSizeBytes) {
// Just destroy the value if cache is disabled or if entry would consume more than a half of
// the cache
evictValue(value);
... | java | public synchronized void put(Key key, Value value) {
long valueSize = value.getSize();
if (maxSizeBytes == 0 || maxSizeEntries == 0 || valueSize * 2 > maxSizeBytes) {
// Just destroy the value if cache is disabled or if entry would consume more than a half of
// the cache
evictValue(value);
... | [
"public",
"synchronized",
"void",
"put",
"(",
"Key",
"key",
",",
"Value",
"value",
")",
"{",
"long",
"valueSize",
"=",
"value",
".",
"getSize",
"(",
")",
";",
"if",
"(",
"maxSizeBytes",
"==",
"0",
"||",
"maxSizeEntries",
"==",
"0",
"||",
"valueSize",
"... | Returns given value to the cache.
@param key key
@param value value | [
"Returns",
"given",
"value",
"to",
"the",
"cache",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/util/LruCache.java#L127-L145 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/util/LruCache.java | LruCache.putAll | public synchronized void putAll(Map<Key, Value> m) {
for (Map.Entry<Key, Value> entry : m.entrySet()) {
this.put(entry.getKey(), entry.getValue());
}
} | java | public synchronized void putAll(Map<Key, Value> m) {
for (Map.Entry<Key, Value> entry : m.entrySet()) {
this.put(entry.getKey(), entry.getValue());
}
} | [
"public",
"synchronized",
"void",
"putAll",
"(",
"Map",
"<",
"Key",
",",
"Value",
">",
"m",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Key",
",",
"Value",
">",
"entry",
":",
"m",
".",
"entrySet",
"(",
")",
")",
"{",
"this",
".",
"put",
"(... | Puts all the values from the given map into the cache.
@param m The map containing entries to put into the cache | [
"Puts",
"all",
"the",
"values",
"from",
"the",
"given",
"map",
"into",
"the",
"cache",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/util/LruCache.java#L152-L156 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java | QueryExecutorImpl.lock | private void lock(Object obtainer) throws PSQLException {
if (lockedFor == obtainer) {
throw new PSQLException(GT.tr("Tried to obtain lock while already holding it"),
PSQLState.OBJECT_NOT_IN_STATE);
}
waitOnLock();
lockedFor = obtainer;
} | java | private void lock(Object obtainer) throws PSQLException {
if (lockedFor == obtainer) {
throw new PSQLException(GT.tr("Tried to obtain lock while already holding it"),
PSQLState.OBJECT_NOT_IN_STATE);
}
waitOnLock();
lockedFor = obtainer;
} | [
"private",
"void",
"lock",
"(",
"Object",
"obtainer",
")",
"throws",
"PSQLException",
"{",
"if",
"(",
"lockedFor",
"==",
"obtainer",
")",
"{",
"throw",
"new",
"PSQLException",
"(",
"GT",
".",
"tr",
"(",
"\"Tried to obtain lock while already holding it\"",
")",
"... | Obtain lock over this connection for given object, blocking to wait if necessary.
@param obtainer object that gets the lock. Normally current thread.
@throws PSQLException when already holding the lock or getting interrupted. | [
"Obtain",
"lock",
"over",
"this",
"connection",
"for",
"given",
"object",
"blocking",
"to",
"wait",
"if",
"necessary",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java#L162-L170 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java | QueryExecutorImpl.unlock | private void unlock(Object holder) throws PSQLException {
if (lockedFor != holder) {
throw new PSQLException(GT.tr("Tried to break lock on database connection"),
PSQLState.OBJECT_NOT_IN_STATE);
}
lockedFor = null;
this.notify();
} | java | private void unlock(Object holder) throws PSQLException {
if (lockedFor != holder) {
throw new PSQLException(GT.tr("Tried to break lock on database connection"),
PSQLState.OBJECT_NOT_IN_STATE);
}
lockedFor = null;
this.notify();
} | [
"private",
"void",
"unlock",
"(",
"Object",
"holder",
")",
"throws",
"PSQLException",
"{",
"if",
"(",
"lockedFor",
"!=",
"holder",
")",
"{",
"throw",
"new",
"PSQLException",
"(",
"GT",
".",
"tr",
"(",
"\"Tried to break lock on database connection\"",
")",
",",
... | Release lock on this connection presumably held by given object.
@param holder object that holds the lock. Normally current thread.
@throws PSQLException when this thread does not hold the lock | [
"Release",
"lock",
"on",
"this",
"connection",
"presumably",
"held",
"by",
"given",
"object",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java#L178-L185 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java | QueryExecutorImpl.waitOnLock | private void waitOnLock() throws PSQLException {
while (lockedFor != null) {
try {
this.wait();
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
throw new PSQLException(
GT.tr("Interrupted while waiting to obtain lock on database connection"),
... | java | private void waitOnLock() throws PSQLException {
while (lockedFor != null) {
try {
this.wait();
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
throw new PSQLException(
GT.tr("Interrupted while waiting to obtain lock on database connection"),
... | [
"private",
"void",
"waitOnLock",
"(",
")",
"throws",
"PSQLException",
"{",
"while",
"(",
"lockedFor",
"!=",
"null",
")",
"{",
"try",
"{",
"this",
".",
"wait",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ie",
")",
"{",
"Thread",
".",
"cur... | Wait until our lock is released. Execution of a single synchronized method can then continue
without further ado. Must be called at beginning of each synchronized public method. | [
"Wait",
"until",
"our",
"lock",
"is",
"released",
".",
"Execution",
"of",
"a",
"single",
"synchronized",
"method",
"can",
"then",
"continue",
"without",
"further",
"ado",
".",
"Must",
"be",
"called",
"at",
"beginning",
"of",
"each",
"synchronized",
"public",
... | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java#L191-L202 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java | QueryExecutorImpl.startCopy | public synchronized CopyOperation startCopy(String sql, boolean suppressBegin)
throws SQLException {
waitOnLock();
if (!suppressBegin) {
doSubprotocolBegin();
}
byte[] buf = Utils.encodeUTF8(sql);
try {
LOGGER.log(Level.FINEST, " FE=> Query(CopyStart)");
pgStream.sendChar('... | java | public synchronized CopyOperation startCopy(String sql, boolean suppressBegin)
throws SQLException {
waitOnLock();
if (!suppressBegin) {
doSubprotocolBegin();
}
byte[] buf = Utils.encodeUTF8(sql);
try {
LOGGER.log(Level.FINEST, " FE=> Query(CopyStart)");
pgStream.sendChar('... | [
"public",
"synchronized",
"CopyOperation",
"startCopy",
"(",
"String",
"sql",
",",
"boolean",
"suppressBegin",
")",
"throws",
"SQLException",
"{",
"waitOnLock",
"(",
")",
";",
"if",
"(",
"!",
"suppressBegin",
")",
"{",
"doSubprotocolBegin",
"(",
")",
";",
"}",... | Sends given query to BE to start, initialize and lock connection for a CopyOperation.
@param sql COPY FROM STDIN / COPY TO STDOUT statement
@return CopyIn or CopyOut operation object
@throws SQLException on failure | [
"Sends",
"given",
"query",
"to",
"BE",
"to",
"start",
"initialize",
"and",
"lock",
"connection",
"for",
"a",
"CopyOperation",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java#L853-L876 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java | QueryExecutorImpl.initCopy | private synchronized void initCopy(CopyOperationImpl op) throws SQLException, IOException {
pgStream.receiveInteger4(); // length not used
int rowFormat = pgStream.receiveChar();
int numFields = pgStream.receiveInteger2();
int[] fieldFormats = new int[numFields];
for (int i = 0; i < numFields; i++)... | java | private synchronized void initCopy(CopyOperationImpl op) throws SQLException, IOException {
pgStream.receiveInteger4(); // length not used
int rowFormat = pgStream.receiveChar();
int numFields = pgStream.receiveInteger2();
int[] fieldFormats = new int[numFields];
for (int i = 0; i < numFields; i++)... | [
"private",
"synchronized",
"void",
"initCopy",
"(",
"CopyOperationImpl",
"op",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"pgStream",
".",
"receiveInteger4",
"(",
")",
";",
"// length not used",
"int",
"rowFormat",
"=",
"pgStream",
".",
"receiveChar",
... | Locks connection and calls initializer for a new CopyOperation Called via startCopy ->
processCopyResults.
@param op an uninitialized CopyOperation
@throws SQLException on locking failure
@throws IOException on database connection failure | [
"Locks",
"connection",
"and",
"calls",
"initializer",
"for",
"a",
"new",
"CopyOperation",
"Called",
"via",
"startCopy",
"-",
">",
"processCopyResults",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java#L886-L898 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java | QueryExecutorImpl.cancelCopy | public void cancelCopy(CopyOperationImpl op) throws SQLException {
if (!hasLock(op)) {
throw new PSQLException(GT.tr("Tried to cancel an inactive copy operation"),
PSQLState.OBJECT_NOT_IN_STATE);
}
SQLException error = null;
int errors = 0;
try {
if (op instanceof CopyIn) {
... | java | public void cancelCopy(CopyOperationImpl op) throws SQLException {
if (!hasLock(op)) {
throw new PSQLException(GT.tr("Tried to cancel an inactive copy operation"),
PSQLState.OBJECT_NOT_IN_STATE);
}
SQLException error = null;
int errors = 0;
try {
if (op instanceof CopyIn) {
... | [
"public",
"void",
"cancelCopy",
"(",
"CopyOperationImpl",
"op",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"!",
"hasLock",
"(",
"op",
")",
")",
"{",
"throw",
"new",
"PSQLException",
"(",
"GT",
".",
"tr",
"(",
"\"Tried to cancel an inactive copy operation\"",... | Finishes a copy operation and unlocks connection discarding any exchanged data.
@param op the copy operation presumably currently holding lock on this connection
@throws SQLException on any additional failure | [
"Finishes",
"a",
"copy",
"operation",
"and",
"unlocks",
"connection",
"discarding",
"any",
"exchanged",
"data",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java#L906-L971 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java | QueryExecutorImpl.endCopy | public synchronized long endCopy(CopyOperationImpl op) throws SQLException {
if (!hasLock(op)) {
throw new PSQLException(GT.tr("Tried to end inactive copy"), PSQLState.OBJECT_NOT_IN_STATE);
}
try {
LOGGER.log(Level.FINEST, " FE=> CopyDone");
pgStream.sendChar('c'); // CopyDone
pgSt... | java | public synchronized long endCopy(CopyOperationImpl op) throws SQLException {
if (!hasLock(op)) {
throw new PSQLException(GT.tr("Tried to end inactive copy"), PSQLState.OBJECT_NOT_IN_STATE);
}
try {
LOGGER.log(Level.FINEST, " FE=> CopyDone");
pgStream.sendChar('c'); // CopyDone
pgSt... | [
"public",
"synchronized",
"long",
"endCopy",
"(",
"CopyOperationImpl",
"op",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"!",
"hasLock",
"(",
"op",
")",
")",
"{",
"throw",
"new",
"PSQLException",
"(",
"GT",
".",
"tr",
"(",
"\"Tried to end inactive copy\"",
... | Finishes writing to copy and unlocks connection.
@param op the copy operation presumably currently holding lock on this connection
@return number of rows updated for server versions 8.2 or newer
@throws SQLException on failure | [
"Finishes",
"writing",
"to",
"copy",
"and",
"unlocks",
"connection",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java#L980-L1000 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java | QueryExecutorImpl.writeToCopy | public synchronized void writeToCopy(CopyOperationImpl op, byte[] data, int off, int siz)
throws SQLException {
if (!hasLock(op)) {
throw new PSQLException(GT.tr("Tried to write to an inactive copy operation"),
PSQLState.OBJECT_NOT_IN_STATE);
}
LOGGER.log(Level.FINEST, " FE=> CopyData... | java | public synchronized void writeToCopy(CopyOperationImpl op, byte[] data, int off, int siz)
throws SQLException {
if (!hasLock(op)) {
throw new PSQLException(GT.tr("Tried to write to an inactive copy operation"),
PSQLState.OBJECT_NOT_IN_STATE);
}
LOGGER.log(Level.FINEST, " FE=> CopyData... | [
"public",
"synchronized",
"void",
"writeToCopy",
"(",
"CopyOperationImpl",
"op",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"off",
",",
"int",
"siz",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"!",
"hasLock",
"(",
"op",
")",
")",
"{",
"throw",
"new... | Sends data during a live COPY IN operation. Only unlocks the connection if server suddenly
returns CommandComplete, which should not happen
@param op the CopyIn operation presumably currently holding lock on this connection
@param data bytes to send
@param off index of first byte to send (usually 0)
@param siz number ... | [
"Sends",
"data",
"during",
"a",
"live",
"COPY",
"IN",
"operation",
".",
"Only",
"unlocks",
"the",
"connection",
"if",
"server",
"suddenly",
"returns",
"CommandComplete",
"which",
"should",
"not",
"happen"
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java#L1012-L1031 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/Utils.java | Utils.toHexString | public static String toHexString(byte[] data) {
StringBuilder sb = new StringBuilder(data.length * 2);
for (byte element : data) {
sb.append(Integer.toHexString((element >> 4) & 15));
sb.append(Integer.toHexString(element & 15));
}
return sb.toString();
} | java | public static String toHexString(byte[] data) {
StringBuilder sb = new StringBuilder(data.length * 2);
for (byte element : data) {
sb.append(Integer.toHexString((element >> 4) & 15));
sb.append(Integer.toHexString(element & 15));
}
return sb.toString();
} | [
"public",
"static",
"String",
"toHexString",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"data",
".",
"length",
"*",
"2",
")",
";",
"for",
"(",
"byte",
"element",
":",
"data",
")",
"{",
"sb",
".",... | Turn a bytearray into a printable form, representing each byte in hex.
@param data the bytearray to stringize
@return a hex-encoded printable representation of {@code data} | [
"Turn",
"a",
"bytearray",
"into",
"a",
"printable",
"form",
"representing",
"each",
"byte",
"in",
"hex",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/Utils.java#L27-L34 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/Utils.java | Utils.doAppendEscapedIdentifier | private static void doAppendEscapedIdentifier(Appendable sbuf, String value) throws SQLException {
try {
sbuf.append('"');
for (int i = 0; i < value.length(); ++i) {
char ch = value.charAt(i);
if (ch == '\0') {
throw new PSQLException(GT.tr("Zero bytes may not occur in identif... | java | private static void doAppendEscapedIdentifier(Appendable sbuf, String value) throws SQLException {
try {
sbuf.append('"');
for (int i = 0; i < value.length(); ++i) {
char ch = value.charAt(i);
if (ch == '\0') {
throw new PSQLException(GT.tr("Zero bytes may not occur in identif... | [
"private",
"static",
"void",
"doAppendEscapedIdentifier",
"(",
"Appendable",
"sbuf",
",",
"String",
"value",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"sbuf",
".",
"append",
"(",
"'",
"'",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<"... | Common part for appendEscapedIdentifier.
@param sbuf Either StringBuffer or StringBuilder as we do not expect any IOException to be
thrown.
@param value value to append | [
"Common",
"part",
"for",
"appendEscapedIdentifier",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/Utils.java#L152-L173 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/fastpath/Fastpath.java | Fastpath.getInteger | public int getInteger(String name, FastpathArg[] args) throws SQLException {
byte[] returnValue = fastpath(name, args);
if (returnValue == null) {
throw new PSQLException(
GT.tr("Fastpath call {0} - No result was returned and we expected an integer.", name),
PSQLState.NO_DATA);
}
... | java | public int getInteger(String name, FastpathArg[] args) throws SQLException {
byte[] returnValue = fastpath(name, args);
if (returnValue == null) {
throw new PSQLException(
GT.tr("Fastpath call {0} - No result was returned and we expected an integer.", name),
PSQLState.NO_DATA);
}
... | [
"public",
"int",
"getInteger",
"(",
"String",
"name",
",",
"FastpathArg",
"[",
"]",
"args",
")",
"throws",
"SQLException",
"{",
"byte",
"[",
"]",
"returnValue",
"=",
"fastpath",
"(",
"name",
",",
"args",
")",
";",
"if",
"(",
"returnValue",
"==",
"null",
... | This convenience method assumes that the return value is an integer.
@param name Function name
@param args Function arguments
@return integer result
@throws SQLException if a database-access error occurs or no result | [
"This",
"convenience",
"method",
"assumes",
"that",
"the",
"return",
"value",
"is",
"an",
"integer",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/fastpath/Fastpath.java#L157-L172 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/fastpath/Fastpath.java | Fastpath.getOID | public long getOID(String name, FastpathArg[] args) throws SQLException {
long oid = getInteger(name, args);
if (oid < 0) {
oid += NUM_OIDS;
}
return oid;
} | java | public long getOID(String name, FastpathArg[] args) throws SQLException {
long oid = getInteger(name, args);
if (oid < 0) {
oid += NUM_OIDS;
}
return oid;
} | [
"public",
"long",
"getOID",
"(",
"String",
"name",
",",
"FastpathArg",
"[",
"]",
"args",
")",
"throws",
"SQLException",
"{",
"long",
"oid",
"=",
"getInteger",
"(",
"name",
",",
"args",
")",
";",
"if",
"(",
"oid",
"<",
"0",
")",
"{",
"oid",
"+=",
"N... | This convenience method assumes that the return value is an oid.
@param name Function name
@param args Function arguments
@return oid of the given call
@throws SQLException if a database-access error occurs or no result | [
"This",
"convenience",
"method",
"assumes",
"that",
"the",
"return",
"value",
"is",
"an",
"oid",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/fastpath/Fastpath.java#L208-L214 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/fastpath/Fastpath.java | Fastpath.createOIDArg | public static FastpathArg createOIDArg(long oid) {
if (oid > Integer.MAX_VALUE) {
oid -= NUM_OIDS;
}
return new FastpathArg((int) oid);
} | java | public static FastpathArg createOIDArg(long oid) {
if (oid > Integer.MAX_VALUE) {
oid -= NUM_OIDS;
}
return new FastpathArg((int) oid);
} | [
"public",
"static",
"FastpathArg",
"createOIDArg",
"(",
"long",
"oid",
")",
"{",
"if",
"(",
"oid",
">",
"Integer",
".",
"MAX_VALUE",
")",
"{",
"oid",
"-=",
"NUM_OIDS",
";",
"}",
"return",
"new",
"FastpathArg",
"(",
"(",
"int",
")",
"oid",
")",
";",
"... | Creates a FastpathArg with an oid parameter. This is here instead of a constructor of
FastpathArg because the constructor can't tell the difference between an long that's really
int8 and a long thats an oid.
@param oid input oid
@return FastpathArg with an oid parameter | [
"Creates",
"a",
"FastpathArg",
"with",
"an",
"oid",
"parameter",
".",
"This",
"is",
"here",
"instead",
"of",
"a",
"constructor",
"of",
"FastpathArg",
"because",
"the",
"constructor",
"can",
"t",
"tell",
"the",
"difference",
"between",
"an",
"long",
"that",
"... | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/fastpath/Fastpath.java#L312-L317 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/ds/common/PGObjectFactory.java | PGObjectFactory.getObjectInstance | public Object getObjectInstance(Object obj, Name name, Context nameCtx,
Hashtable<?, ?> environment) throws Exception {
Reference ref = (Reference) obj;
String className = ref.getClassName();
// Old names are here for those who still use them
if (className.equals("org.postgresql.ds.PGSimpleDataSou... | java | public Object getObjectInstance(Object obj, Name name, Context nameCtx,
Hashtable<?, ?> environment) throws Exception {
Reference ref = (Reference) obj;
String className = ref.getClassName();
// Old names are here for those who still use them
if (className.equals("org.postgresql.ds.PGSimpleDataSou... | [
"public",
"Object",
"getObjectInstance",
"(",
"Object",
"obj",
",",
"Name",
"name",
",",
"Context",
"nameCtx",
",",
"Hashtable",
"<",
"?",
",",
"?",
">",
"environment",
")",
"throws",
"Exception",
"{",
"Reference",
"ref",
"=",
"(",
"Reference",
")",
"obj",... | Dereferences a PostgreSQL DataSource. Other types of references are ignored. | [
"Dereferences",
"a",
"PostgreSQL",
"DataSource",
".",
"Other",
"types",
"of",
"references",
"are",
"ignored",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/ds/common/PGObjectFactory.java#L33-L53 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/ds/PGPoolingDataSource.java | PGPoolingDataSource.setDataSourceName | public void setDataSourceName(String dataSourceName) {
if (initialized) {
throw new IllegalStateException(
"Cannot set Data Source properties after DataSource has been used");
}
if (this.dataSourceName != null && dataSourceName != null
&& dataSourceName.equals(this.dataSourceName)) {... | java | public void setDataSourceName(String dataSourceName) {
if (initialized) {
throw new IllegalStateException(
"Cannot set Data Source properties after DataSource has been used");
}
if (this.dataSourceName != null && dataSourceName != null
&& dataSourceName.equals(this.dataSourceName)) {... | [
"public",
"void",
"setDataSourceName",
"(",
"String",
"dataSourceName",
")",
"{",
"if",
"(",
"initialized",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot set Data Source properties after DataSource has been used\"",
")",
";",
"}",
"if",
"(",
"this",
... | Sets the name of this DataSource. This is required, and uniquely identifies the DataSource. You
cannot create or use more than one DataSource in the same VM with the same name.
@param dataSourceName datasource name
@throws IllegalStateException The Data Source Name cannot be changed after the DataSource has
been used.... | [
"Sets",
"the",
"name",
"of",
"this",
"DataSource",
".",
"This",
"is",
"required",
"and",
"uniquely",
"identifies",
"the",
"DataSource",
".",
"You",
"cannot",
"create",
"or",
"use",
"more",
"than",
"one",
"DataSource",
"in",
"the",
"same",
"VM",
"with",
"th... | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/ds/PGPoolingDataSource.java#L234-L252 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/ds/PGPoolingDataSource.java | PGPoolingDataSource.initialize | public void initialize() throws SQLException {
synchronized (lock) {
source = createConnectionPool();
try {
source.initializeFrom(this);
} catch (Exception e) {
throw new PSQLException(GT.tr("Failed to setup DataSource."), PSQLState.UNEXPECTED_ERROR,
e);
}
... | java | public void initialize() throws SQLException {
synchronized (lock) {
source = createConnectionPool();
try {
source.initializeFrom(this);
} catch (Exception e) {
throw new PSQLException(GT.tr("Failed to setup DataSource."), PSQLState.UNEXPECTED_ERROR,
e);
}
... | [
"public",
"void",
"initialize",
"(",
")",
"throws",
"SQLException",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"source",
"=",
"createConnectionPool",
"(",
")",
";",
"try",
"{",
"source",
".",
"initializeFrom",
"(",
"this",
")",
";",
"}",
"catch",
"(",
"... | Initializes this DataSource. If the initialConnections is greater than zero, that number of
connections will be created. After this method is called, the DataSource properties cannot be
changed. If you do not call this explicitly, it will be called the first time you get a
connection from the DataSource.
@throws SQLEx... | [
"Initializes",
"this",
"DataSource",
".",
"If",
"the",
"initialConnections",
"is",
"greater",
"than",
"zero",
"that",
"number",
"of",
"connections",
"will",
"be",
"created",
".",
"After",
"this",
"method",
"is",
"called",
"the",
"DataSource",
"properties",
"cann... | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/ds/PGPoolingDataSource.java#L263-L279 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/ds/PGPoolingDataSource.java | PGPoolingDataSource.close | public void close() {
synchronized (lock) {
while (!available.isEmpty()) {
PooledConnection pci = available.pop();
try {
pci.close();
} catch (SQLException e) {
}
}
available = null;
while (!used.isEmpty()) {
PooledConnection pci = used.pop()... | java | public void close() {
synchronized (lock) {
while (!available.isEmpty()) {
PooledConnection pci = available.pop();
try {
pci.close();
} catch (SQLException e) {
}
}
available = null;
while (!used.isEmpty()) {
PooledConnection pci = used.pop()... | [
"public",
"void",
"close",
"(",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"while",
"(",
"!",
"available",
".",
"isEmpty",
"(",
")",
")",
"{",
"PooledConnection",
"pci",
"=",
"available",
".",
"pop",
"(",
")",
";",
"try",
"{",
"pci",
".",
"cl... | Closes this DataSource, and all the pooled connections, whether in use or not. | [
"Closes",
"this",
"DataSource",
"and",
"all",
"the",
"pooled",
"connections",
"whether",
"in",
"use",
"or",
"not",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/ds/PGPoolingDataSource.java#L332-L353 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/ds/PGPoolingDataSource.java | PGPoolingDataSource.getPooledConnection | private Connection getPooledConnection() throws SQLException {
PooledConnection pc = null;
synchronized (lock) {
if (available == null) {
throw new PSQLException(GT.tr("DataSource has been closed."),
PSQLState.CONNECTION_DOES_NOT_EXIST);
}
while (true) {
if (!availa... | java | private Connection getPooledConnection() throws SQLException {
PooledConnection pc = null;
synchronized (lock) {
if (available == null) {
throw new PSQLException(GT.tr("DataSource has been closed."),
PSQLState.CONNECTION_DOES_NOT_EXIST);
}
while (true) {
if (!availa... | [
"private",
"Connection",
"getPooledConnection",
"(",
")",
"throws",
"SQLException",
"{",
"PooledConnection",
"pc",
"=",
"null",
";",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"available",
"==",
"null",
")",
"{",
"throw",
"new",
"PSQLException",
"(",
... | Gets a connection from the pool. Will get an available one if present, or create a new one if
under the max limit. Will block if all used and a new one would exceed the max. | [
"Gets",
"a",
"connection",
"from",
"the",
"pool",
".",
"Will",
"get",
"an",
"available",
"one",
"if",
"present",
"or",
"create",
"a",
"new",
"one",
"if",
"under",
"the",
"max",
"limit",
".",
"Will",
"block",
"if",
"all",
"used",
"and",
"a",
"new",
"o... | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/ds/PGPoolingDataSource.java#L367-L395 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/ds/PGPoolingDataSource.java | PGPoolingDataSource.getReference | public Reference getReference() throws NamingException {
Reference ref = super.getReference();
ref.add(new StringRefAddr("dataSourceName", dataSourceName));
if (initialConnections > 0) {
ref.add(new StringRefAddr("initialConnections", Integer.toString(initialConnections)));
}
if (maxConnection... | java | public Reference getReference() throws NamingException {
Reference ref = super.getReference();
ref.add(new StringRefAddr("dataSourceName", dataSourceName));
if (initialConnections > 0) {
ref.add(new StringRefAddr("initialConnections", Integer.toString(initialConnections)));
}
if (maxConnection... | [
"public",
"Reference",
"getReference",
"(",
")",
"throws",
"NamingException",
"{",
"Reference",
"ref",
"=",
"super",
".",
"getReference",
"(",
")",
";",
"ref",
".",
"add",
"(",
"new",
"StringRefAddr",
"(",
"\"dataSourceName\"",
",",
"dataSourceName",
")",
")",... | Adds custom properties for this DataSource to the properties defined in the superclass. | [
"Adds",
"custom",
"properties",
"for",
"this",
"DataSource",
"to",
"the",
"properties",
"defined",
"in",
"the",
"superclass",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/ds/PGPoolingDataSource.java#L439-L449 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/v3/SimpleQuery.java | SimpleQuery.setFields | void setFields(Field[] fields) {
this.fields = fields;
this.resultSetColumnNameIndexMap = null;
this.cachedMaxResultRowSize = null;
this.needUpdateFieldFormats = fields != null;
this.hasBinaryFields = false; // just in case
} | java | void setFields(Field[] fields) {
this.fields = fields;
this.resultSetColumnNameIndexMap = null;
this.cachedMaxResultRowSize = null;
this.needUpdateFieldFormats = fields != null;
this.hasBinaryFields = false; // just in case
} | [
"void",
"setFields",
"(",
"Field",
"[",
"]",
"fields",
")",
"{",
"this",
".",
"fields",
"=",
"fields",
";",
"this",
".",
"resultSetColumnNameIndexMap",
"=",
"null",
";",
"this",
".",
"cachedMaxResultRowSize",
"=",
"null",
";",
"this",
".",
"needUpdateFieldFo... | Sets the fields that this query will return.
@param fields The fields that this query will return. | [
"Sets",
"the",
"fields",
"that",
"this",
"query",
"will",
"return",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/v3/SimpleQuery.java#L216-L222 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java | TimestampUtils.toTimestamp | public synchronized Timestamp toTimestamp(Calendar cal, String s) throws SQLException {
if (s == null) {
return null;
}
int slen = s.length();
// convert postgres's infinity values to internal infinity magic value
if (slen == 8 && s.equals("infinity")) {
return new Timestamp(PGStatemen... | java | public synchronized Timestamp toTimestamp(Calendar cal, String s) throws SQLException {
if (s == null) {
return null;
}
int slen = s.length();
// convert postgres's infinity values to internal infinity magic value
if (slen == 8 && s.equals("infinity")) {
return new Timestamp(PGStatemen... | [
"public",
"synchronized",
"Timestamp",
"toTimestamp",
"(",
"Calendar",
"cal",
",",
"String",
"s",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"slen",
"=",
"s",
".",
"length",
"(",
")",
... | Parse a string and return a timestamp representing its value.
@param cal calendar to be used to parse the input string
@param s The ISO formated date string to parse.
@return null if s is null or a timestamp of the parsed string s.
@throws SQLException if there is a problem parsing s. | [
"Parse",
"a",
"string",
"and",
"return",
"a",
"timestamp",
"representing",
"its",
"value",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java#L379-L409 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java | TimestampUtils.toLocalTime | public LocalTime toLocalTime(String s) throws SQLException {
if (s == null) {
return null;
}
if (s.equals("24:00:00")) {
return LocalTime.MAX;
}
try {
return LocalTime.parse(s);
} catch (DateTimeParseException nfe) {
throw new PSQLException(
GT.tr("Bad value f... | java | public LocalTime toLocalTime(String s) throws SQLException {
if (s == null) {
return null;
}
if (s.equals("24:00:00")) {
return LocalTime.MAX;
}
try {
return LocalTime.parse(s);
} catch (DateTimeParseException nfe) {
throw new PSQLException(
GT.tr("Bad value f... | [
"public",
"LocalTime",
"toLocalTime",
"(",
"String",
"s",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"s",
".",
"equals",
"(",
"\"24:00:00\"",
")",
")",
"{",
"return",
"LocalTime",
... | Parse a string and return a LocalTime representing its value.
@param s The ISO formated time string to parse.
@return null if s is null or a LocalTime of the parsed string s.
@throws SQLException if there is a problem parsing s. | [
"Parse",
"a",
"string",
"and",
"return",
"a",
"LocalTime",
"representing",
"its",
"value",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java#L419-L436 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java | TimestampUtils.toLocalDateTime | public LocalDateTime toLocalDateTime(String s) throws SQLException {
if (s == null) {
return null;
}
int slen = s.length();
// convert postgres's infinity values to internal infinity magic value
if (slen == 8 && s.equals("infinity")) {
return LocalDateTime.MAX;
}
if (slen == 9... | java | public LocalDateTime toLocalDateTime(String s) throws SQLException {
if (s == null) {
return null;
}
int slen = s.length();
// convert postgres's infinity values to internal infinity magic value
if (slen == 8 && s.equals("infinity")) {
return LocalDateTime.MAX;
}
if (slen == 9... | [
"public",
"LocalDateTime",
"toLocalDateTime",
"(",
"String",
"s",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"slen",
"=",
"s",
".",
"length",
"(",
")",
";",
"// convert postgres's infinity... | Parse a string and return a LocalDateTime representing its value.
@param s The ISO formated date string to parse.
@return null if s is null or a LocalDateTime of the parsed string s.
@throws SQLException if there is a problem parsing s. | [
"Parse",
"a",
"string",
"and",
"return",
"a",
"LocalDateTime",
"representing",
"its",
"value",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java#L445-L471 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java | TimestampUtils.getSharedCalendar | public Calendar getSharedCalendar(TimeZone timeZone) {
if (timeZone == null) {
timeZone = getDefaultTz();
}
Calendar tmp = calendarWithUserTz;
tmp.setTimeZone(timeZone);
return tmp;
} | java | public Calendar getSharedCalendar(TimeZone timeZone) {
if (timeZone == null) {
timeZone = getDefaultTz();
}
Calendar tmp = calendarWithUserTz;
tmp.setTimeZone(timeZone);
return tmp;
} | [
"public",
"Calendar",
"getSharedCalendar",
"(",
"TimeZone",
"timeZone",
")",
"{",
"if",
"(",
"timeZone",
"==",
"null",
")",
"{",
"timeZone",
"=",
"getDefaultTz",
"(",
")",
";",
"}",
"Calendar",
"tmp",
"=",
"calendarWithUserTz",
";",
"tmp",
".",
"setTimeZone"... | Get a shared calendar, applying the supplied time zone or the default time zone if null.
@param timeZone time zone to be set for the calendar
@return The shared calendar. | [
"Get",
"a",
"shared",
"calendar",
"applying",
"the",
"supplied",
"time",
"zone",
"or",
"the",
"default",
"time",
"zone",
"if",
"null",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java#L541-L548 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java | TimestampUtils.convertToDate | public Date convertToDate(long millis, TimeZone tz) {
// no adjustments for the inifity hack values
if (millis <= PGStatement.DATE_NEGATIVE_INFINITY
|| millis >= PGStatement.DATE_POSITIVE_INFINITY) {
return new Date(millis);
}
if (tz == null) {
tz = getDefaultTz();
}
if (isS... | java | public Date convertToDate(long millis, TimeZone tz) {
// no adjustments for the inifity hack values
if (millis <= PGStatement.DATE_NEGATIVE_INFINITY
|| millis >= PGStatement.DATE_POSITIVE_INFINITY) {
return new Date(millis);
}
if (tz == null) {
tz = getDefaultTz();
}
if (isS... | [
"public",
"Date",
"convertToDate",
"(",
"long",
"millis",
",",
"TimeZone",
"tz",
")",
"{",
"// no adjustments for the inifity hack values",
"if",
"(",
"millis",
"<=",
"PGStatement",
".",
"DATE_NEGATIVE_INFINITY",
"||",
"millis",
">=",
"PGStatement",
".",
"DATE_POSITIV... | Extracts the date part from a timestamp.
@param millis The timestamp from which to extract the date.
@param tz The time zone of the date.
@return The extracted date. | [
"Extracts",
"the",
"date",
"part",
"from",
"a",
"timestamp",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java#L1225-L1259 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java | TimestampUtils.convertToTime | public Time convertToTime(long millis, TimeZone tz) {
if (tz == null) {
tz = getDefaultTz();
}
if (isSimpleTimeZone(tz.getID())) {
// Leave just time part of the day.
// Suppose the input date is 2015 7 Jan 15:40 GMT+02:00 (that is 13:40 UTC)
// We want it to become 1970 1 Jan 15:40 ... | java | public Time convertToTime(long millis, TimeZone tz) {
if (tz == null) {
tz = getDefaultTz();
}
if (isSimpleTimeZone(tz.getID())) {
// Leave just time part of the day.
// Suppose the input date is 2015 7 Jan 15:40 GMT+02:00 (that is 13:40 UTC)
// We want it to become 1970 1 Jan 15:40 ... | [
"public",
"Time",
"convertToTime",
"(",
"long",
"millis",
",",
"TimeZone",
"tz",
")",
"{",
"if",
"(",
"tz",
"==",
"null",
")",
"{",
"tz",
"=",
"getDefaultTz",
"(",
")",
";",
"}",
"if",
"(",
"isSimpleTimeZone",
"(",
"tz",
".",
"getID",
"(",
")",
")"... | Extracts the time part from a timestamp. This method ensures the date part of output timestamp
looks like 1970-01-01 in given timezone.
@param millis The timestamp from which to extract the time.
@param tz timezone to use.
@return The extracted time. | [
"Extracts",
"the",
"time",
"part",
"from",
"a",
"timestamp",
".",
"This",
"method",
"ensures",
"the",
"date",
"part",
"of",
"output",
"timestamp",
"looks",
"like",
"1970",
"-",
"01",
"-",
"01",
"in",
"given",
"timezone",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java#L1269-L1297 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java | TimestampUtils.timeToString | public String timeToString(java.util.Date time, boolean withTimeZone) {
Calendar cal = null;
if (withTimeZone) {
cal = calendarWithUserTz;
cal.setTimeZone(timeZoneProvider.get());
}
if (time instanceof Timestamp) {
return toString(cal, (Timestamp) time, withTimeZone);
}
if (tim... | java | public String timeToString(java.util.Date time, boolean withTimeZone) {
Calendar cal = null;
if (withTimeZone) {
cal = calendarWithUserTz;
cal.setTimeZone(timeZoneProvider.get());
}
if (time instanceof Timestamp) {
return toString(cal, (Timestamp) time, withTimeZone);
}
if (tim... | [
"public",
"String",
"timeToString",
"(",
"java",
".",
"util",
".",
"Date",
"time",
",",
"boolean",
"withTimeZone",
")",
"{",
"Calendar",
"cal",
"=",
"null",
";",
"if",
"(",
"withTimeZone",
")",
"{",
"cal",
"=",
"calendarWithUserTz",
";",
"cal",
".",
"set... | Returns the given time value as String matching what the current postgresql server would send
in text mode.
@param time time value
@param withTimeZone whether timezone should be added
@return given time value as String | [
"Returns",
"the",
"given",
"time",
"value",
"as",
"String",
"matching",
"what",
"the",
"current",
"postgresql",
"server",
"would",
"send",
"in",
"text",
"mode",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java#L1307-L1320 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/xa/PGXADataSource.java | PGXADataSource.getXAConnection | public XAConnection getXAConnection(String user, String password) throws SQLException {
Connection con = super.getConnection(user, password);
return new PGXAConnection((BaseConnection) con);
} | java | public XAConnection getXAConnection(String user, String password) throws SQLException {
Connection con = super.getConnection(user, password);
return new PGXAConnection((BaseConnection) con);
} | [
"public",
"XAConnection",
"getXAConnection",
"(",
"String",
"user",
",",
"String",
"password",
")",
"throws",
"SQLException",
"{",
"Connection",
"con",
"=",
"super",
".",
"getConnection",
"(",
"user",
",",
"password",
")",
";",
"return",
"new",
"PGXAConnection",... | Gets a XA-enabled connection to the PostgreSQL database. The database is identified by the
DataSource properties serverName, databaseName, and portNumber. The user to connect as is
identified by the arguments user and password, which override the DataSource properties by the
same name.
@return A valid database connect... | [
"Gets",
"a",
"XA",
"-",
"enabled",
"connection",
"to",
"the",
"PostgreSQL",
"database",
".",
"The",
"database",
"is",
"identified",
"by",
"the",
"DataSource",
"properties",
"serverName",
"databaseName",
"and",
"portNumber",
".",
"The",
"user",
"to",
"connect",
... | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/xa/PGXADataSource.java#L45-L48 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/copy/CopyManager.java | CopyManager.copyOut | public long copyOut(final String sql, Writer to) throws SQLException, IOException {
byte[] buf;
CopyOut cp = copyOut(sql);
try {
while ((buf = cp.readFromCopy()) != null) {
to.write(encoding.decode(buf));
}
return cp.getHandledRowCount();
} catch (IOException ioEX) {
// i... | java | public long copyOut(final String sql, Writer to) throws SQLException, IOException {
byte[] buf;
CopyOut cp = copyOut(sql);
try {
while ((buf = cp.readFromCopy()) != null) {
to.write(encoding.decode(buf));
}
return cp.getHandledRowCount();
} catch (IOException ioEX) {
// i... | [
"public",
"long",
"copyOut",
"(",
"final",
"String",
"sql",
",",
"Writer",
"to",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"byte",
"[",
"]",
"buf",
";",
"CopyOut",
"cp",
"=",
"copyOut",
"(",
"sql",
")",
";",
"try",
"{",
"while",
"(",
"(... | Pass results of a COPY TO STDOUT query from database into a Writer.
@param sql COPY TO STDOUT statement
@param to the stream to write the results to (row by row)
@return number of rows updated for server 8.2 or newer; -1 for older
@throws SQLException on database usage errors
@throws IOException upon writer or databas... | [
"Pass",
"results",
"of",
"a",
"COPY",
"TO",
"STDOUT",
"query",
"from",
"database",
"into",
"a",
"Writer",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/copy/CopyManager.java#L85-L109 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSetMetaData.java | PgResultSetMetaData.getColumnClassName | public String getColumnClassName(int column) throws SQLException {
Field field = getField(column);
String result = connection.getTypeInfo().getJavaClass(field.getOID());
if (result != null) {
return result;
}
int sqlType = getSQLType(column);
switch (sqlType) {
case Types.ARRAY:
... | java | public String getColumnClassName(int column) throws SQLException {
Field field = getField(column);
String result = connection.getTypeInfo().getJavaClass(field.getOID());
if (result != null) {
return result;
}
int sqlType = getSQLType(column);
switch (sqlType) {
case Types.ARRAY:
... | [
"public",
"String",
"getColumnClassName",
"(",
"int",
"column",
")",
"throws",
"SQLException",
"{",
"Field",
"field",
"=",
"getField",
"(",
"column",
")",
";",
"String",
"result",
"=",
"connection",
".",
"getTypeInfo",
"(",
")",
".",
"getJavaClass",
"(",
"fi... | This can hook into our PG_Object mechanism | [
"This",
"can",
"hook",
"into",
"our",
"PG_Object",
"mechanism"
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSetMetaData.java#L408-L427 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/Driver.java | Driver.makeConnection | private static Connection makeConnection(String url, Properties props) throws SQLException {
return new PgConnection(hostSpecs(props), user(props), database(props), props, url);
} | java | private static Connection makeConnection(String url, Properties props) throws SQLException {
return new PgConnection(hostSpecs(props), user(props), database(props), props, url);
} | [
"private",
"static",
"Connection",
"makeConnection",
"(",
"String",
"url",
",",
"Properties",
"props",
")",
"throws",
"SQLException",
"{",
"return",
"new",
"PgConnection",
"(",
"hostSpecs",
"(",
"props",
")",
",",
"user",
"(",
"props",
")",
",",
"database",
... | Create a connection from URL and properties. Always does the connection work in the current
thread without enforcing a timeout, regardless of any timeout specified in the properties.
@param url the original URL
@param props the parsed/defaulted connection properties
@return a new connection
@throws SQLException if the... | [
"Create",
"a",
"connection",
"from",
"URL",
"and",
"properties",
".",
"Always",
"does",
"the",
"connection",
"work",
"in",
"the",
"current",
"thread",
"without",
"enforcing",
"a",
"timeout",
"regardless",
"of",
"any",
"timeout",
"specified",
"in",
"the",
"prop... | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/Driver.java#L457-L459 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/Driver.java | Driver.notImplemented | public static SQLFeatureNotSupportedException notImplemented(Class<?> callClass,
String functionName) {
return new SQLFeatureNotSupportedException(
GT.tr("Method {0} is not yet implemented.", callClass.getName() + "." + functionName),
PSQLState.NOT_IMPLEMENTED.getState());
} | java | public static SQLFeatureNotSupportedException notImplemented(Class<?> callClass,
String functionName) {
return new SQLFeatureNotSupportedException(
GT.tr("Method {0} is not yet implemented.", callClass.getName() + "." + functionName),
PSQLState.NOT_IMPLEMENTED.getState());
} | [
"public",
"static",
"SQLFeatureNotSupportedException",
"notImplemented",
"(",
"Class",
"<",
"?",
">",
"callClass",
",",
"String",
"functionName",
")",
"{",
"return",
"new",
"SQLFeatureNotSupportedException",
"(",
"GT",
".",
"tr",
"(",
"\"Method {0} is not yet implemente... | This method was added in v6.5, and simply throws an SQLException for an unimplemented method. I
decided to do it this way while implementing the JDBC2 extensions to JDBC, as it should help
keep the overall driver size down. It now requires the call Class and the function name to help
when the driver is used with closed... | [
"This",
"method",
"was",
"added",
"in",
"v6",
".",
"5",
"and",
"simply",
"throws",
"an",
"SQLException",
"for",
"an",
"unimplemented",
"method",
".",
"I",
"decided",
"to",
"do",
"it",
"this",
"way",
"while",
"implementing",
"the",
"JDBC2",
"extensions",
"t... | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/Driver.java#L688-L693 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/util/PGInterval.java | PGInterval.setValue | public void setValue(int years, int months, int days, int hours, int minutes, double seconds) {
setYears(years);
setMonths(months);
setDays(days);
setHours(hours);
setMinutes(minutes);
setSeconds(seconds);
} | java | public void setValue(int years, int months, int days, int hours, int minutes, double seconds) {
setYears(years);
setMonths(months);
setDays(days);
setHours(hours);
setMinutes(minutes);
setSeconds(seconds);
} | [
"public",
"void",
"setValue",
"(",
"int",
"years",
",",
"int",
"months",
",",
"int",
"days",
",",
"int",
"hours",
",",
"int",
"minutes",
",",
"double",
"seconds",
")",
"{",
"setYears",
"(",
"years",
")",
";",
"setMonths",
"(",
"months",
")",
";",
"se... | Set all values of this interval to the specified values.
@param years years
@param months months
@param days days
@param hours hours
@param minutes minutes
@param seconds seconds | [
"Set",
"all",
"values",
"of",
"this",
"interval",
"to",
"the",
"specified",
"values",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/util/PGInterval.java#L174-L181 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/util/PGInterval.java | PGInterval.getValue | public String getValue() {
return years + " years "
+ months + " mons "
+ days + " days "
+ hours + " hours "
+ minutes + " mins "
+ secondsFormat.format(seconds) + " secs";
} | java | public String getValue() {
return years + " years "
+ months + " mons "
+ days + " days "
+ hours + " hours "
+ minutes + " mins "
+ secondsFormat.format(seconds) + " secs";
} | [
"public",
"String",
"getValue",
"(",
")",
"{",
"return",
"years",
"+",
"\" years \"",
"+",
"months",
"+",
"\" mons \"",
"+",
"days",
"+",
"\" days \"",
"+",
"hours",
"+",
"\" hours \"",
"+",
"minutes",
"+",
"\" mins \"",
"+",
"secondsFormat",
".",
"format",
... | Returns the stored interval information as a string.
@return String represented interval | [
"Returns",
"the",
"stored",
"interval",
"information",
"as",
"a",
"string",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/util/PGInterval.java#L188-L195 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/util/PGInterval.java | PGInterval.add | public void add(Calendar cal) {
// Avoid precision loss
// Be aware postgres doesn't return more than 60 seconds - no overflow can happen
final int microseconds = (int) (getSeconds() * 1000000.0);
final int milliseconds = (microseconds + ((microseconds < 0) ? -500 : 500)) / 1000;
cal.add(Calendar.M... | java | public void add(Calendar cal) {
// Avoid precision loss
// Be aware postgres doesn't return more than 60 seconds - no overflow can happen
final int microseconds = (int) (getSeconds() * 1000000.0);
final int milliseconds = (microseconds + ((microseconds < 0) ? -500 : 500)) / 1000;
cal.add(Calendar.M... | [
"public",
"void",
"add",
"(",
"Calendar",
"cal",
")",
"{",
"// Avoid precision loss",
"// Be aware postgres doesn't return more than 60 seconds - no overflow can happen",
"final",
"int",
"microseconds",
"=",
"(",
"int",
")",
"(",
"getSeconds",
"(",
")",
"*",
"1000000.0",
... | Rolls this interval on a given calendar.
@param cal Calendar instance to add to | [
"Rolls",
"this",
"interval",
"on",
"a",
"given",
"calendar",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/util/PGInterval.java#L310-L322 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/util/PGInterval.java | PGInterval.add | public void add(Date date) {
final Calendar cal = Calendar.getInstance();
cal.setTime(date);
add(cal);
date.setTime(cal.getTime().getTime());
} | java | public void add(Date date) {
final Calendar cal = Calendar.getInstance();
cal.setTime(date);
add(cal);
date.setTime(cal.getTime().getTime());
} | [
"public",
"void",
"add",
"(",
"Date",
"date",
")",
"{",
"final",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"date",
")",
";",
"add",
"(",
"cal",
")",
";",
"date",
".",
"setTime",
"(",
"cal",
... | Rolls this interval on a given date.
@param date Date instance to add to | [
"Rolls",
"this",
"interval",
"on",
"a",
"given",
"date",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/util/PGInterval.java#L329-L334 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/util/PGInterval.java | PGInterval.add | public void add(PGInterval interval) {
interval.setYears(interval.getYears() + getYears());
interval.setMonths(interval.getMonths() + getMonths());
interval.setDays(interval.getDays() + getDays());
interval.setHours(interval.getHours() + getHours());
interval.setMinutes(interval.getMinutes() + getMi... | java | public void add(PGInterval interval) {
interval.setYears(interval.getYears() + getYears());
interval.setMonths(interval.getMonths() + getMonths());
interval.setDays(interval.getDays() + getDays());
interval.setHours(interval.getHours() + getHours());
interval.setMinutes(interval.getMinutes() + getMi... | [
"public",
"void",
"add",
"(",
"PGInterval",
"interval",
")",
"{",
"interval",
".",
"setYears",
"(",
"interval",
".",
"getYears",
"(",
")",
"+",
"getYears",
"(",
")",
")",
";",
"interval",
".",
"setMonths",
"(",
"interval",
".",
"getMonths",
"(",
")",
"... | Add this interval's value to the passed interval. This is backwards to what I would expect, but
this makes it match the other existing add methods.
@param interval intval to add | [
"Add",
"this",
"interval",
"s",
"value",
"to",
"the",
"passed",
"interval",
".",
"This",
"is",
"backwards",
"to",
"what",
"I",
"would",
"expect",
"but",
"this",
"makes",
"it",
"match",
"the",
"other",
"existing",
"add",
"methods",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/util/PGInterval.java#L342-L349 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java | PgConnection.addWarning | public void addWarning(SQLWarning warn) {
// Add the warning to the chain
if (firstWarning != null) {
firstWarning.setNextWarning(warn);
} else {
firstWarning = warn;
}
} | java | public void addWarning(SQLWarning warn) {
// Add the warning to the chain
if (firstWarning != null) {
firstWarning.setNextWarning(warn);
} else {
firstWarning = warn;
}
} | [
"public",
"void",
"addWarning",
"(",
"SQLWarning",
"warn",
")",
"{",
"// Add the warning to the chain",
"if",
"(",
"firstWarning",
"!=",
"null",
")",
"{",
"firstWarning",
".",
"setNextWarning",
"(",
"warn",
")",
";",
"}",
"else",
"{",
"firstWarning",
"=",
"war... | This adds a warning to the warning chain.
@param warn warning to add | [
"This",
"adds",
"a",
"warning",
"to",
"the",
"warning",
"chain",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java#L398-L406 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java | PgConnection.initObjectTypes | private void initObjectTypes(Properties info) throws SQLException {
// Add in the types that come packaged with the driver.
// These can be overridden later if desired.
addDataType("box", org.postgresql.geometric.PGbox.class);
addDataType("circle", org.postgresql.geometric.PGcircle.class);
addDataTy... | java | private void initObjectTypes(Properties info) throws SQLException {
// Add in the types that come packaged with the driver.
// These can be overridden later if desired.
addDataType("box", org.postgresql.geometric.PGbox.class);
addDataType("circle", org.postgresql.geometric.PGcircle.class);
addDataTy... | [
"private",
"void",
"initObjectTypes",
"(",
"Properties",
"info",
")",
"throws",
"SQLException",
"{",
"// Add in the types that come packaged with the driver.",
"// These can be overridden later if desired.",
"addDataType",
"(",
"\"box\"",
",",
"org",
".",
"postgresql",
".",
"... | This initialises the objectTypes hash map | [
"This",
"initialises",
"the",
"objectTypes",
"hash",
"map"
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java#L618-L651 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java | PgConnection.getServerMajorVersion | public int getServerMajorVersion() {
try {
StringTokenizer versionTokens = new StringTokenizer(queryExecutor.getServerVersion(), "."); // aaXbb.ccYdd
return integerPart(versionTokens.nextToken()); // return X
} catch (NoSuchElementException e) {
return 0;
}
} | java | public int getServerMajorVersion() {
try {
StringTokenizer versionTokens = new StringTokenizer(queryExecutor.getServerVersion(), "."); // aaXbb.ccYdd
return integerPart(versionTokens.nextToken()); // return X
} catch (NoSuchElementException e) {
return 0;
}
} | [
"public",
"int",
"getServerMajorVersion",
"(",
")",
"{",
"try",
"{",
"StringTokenizer",
"versionTokens",
"=",
"new",
"StringTokenizer",
"(",
"queryExecutor",
".",
"getServerVersion",
"(",
")",
",",
"\".\"",
")",
";",
"// aaXbb.ccYdd",
"return",
"integerPart",
"(",... | Get server major version.
@return server major version | [
"Get",
"server",
"major",
"version",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java#L916-L923 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java | PgConnection.integerPart | private static int integerPart(String dirtyString) {
int start = 0;
while (start < dirtyString.length() && !Character.isDigit(dirtyString.charAt(start))) {
++start;
}
int end = start;
while (end < dirtyString.length() && Character.isDigit(dirtyString.charAt(end))) {
++end;
}
i... | java | private static int integerPart(String dirtyString) {
int start = 0;
while (start < dirtyString.length() && !Character.isDigit(dirtyString.charAt(start))) {
++start;
}
int end = start;
while (end < dirtyString.length() && Character.isDigit(dirtyString.charAt(end))) {
++end;
}
i... | [
"private",
"static",
"int",
"integerPart",
"(",
"String",
"dirtyString",
")",
"{",
"int",
"start",
"=",
"0",
";",
"while",
"(",
"start",
"<",
"dirtyString",
".",
"length",
"(",
")",
"&&",
"!",
"Character",
".",
"isDigit",
"(",
"dirtyString",
".",
"charAt... | Parse a "dirty" integer surrounded by non-numeric characters | [
"Parse",
"a",
"dirty",
"integer",
"surrounded",
"by",
"non",
"-",
"numeric",
"characters"
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java#L1189-L1206 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/replication/LogSequenceNumber.java | LogSequenceNumber.valueOf | public static LogSequenceNumber valueOf(String strValue) {
int slashIndex = strValue.lastIndexOf('/');
if (slashIndex <= 0) {
return INVALID_LSN;
}
String logicalXLogStr = strValue.substring(0, slashIndex);
int logicalXlog = (int) Long.parseLong(logicalXLogStr, 16);
String segmentStr = s... | java | public static LogSequenceNumber valueOf(String strValue) {
int slashIndex = strValue.lastIndexOf('/');
if (slashIndex <= 0) {
return INVALID_LSN;
}
String logicalXLogStr = strValue.substring(0, slashIndex);
int logicalXlog = (int) Long.parseLong(logicalXLogStr, 16);
String segmentStr = s... | [
"public",
"static",
"LogSequenceNumber",
"valueOf",
"(",
"String",
"strValue",
")",
"{",
"int",
"slashIndex",
"=",
"strValue",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"slashIndex",
"<=",
"0",
")",
"{",
"return",
"INVALID_LSN",
";",
"}",
"... | Create LSN instance by string represent LSN.
@param strValue not null string as two hexadecimal numbers of up to 8 digits each, separated by
a slash. For example {@code 16/3002D50}, {@code 0/15D68C50}
@return not null LSN instance where if specified string represent have not valid form {@link
LogSequenceNumber#INVALID... | [
"Create",
"LSN",
"instance",
"by",
"string",
"represent",
"LSN",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/replication/LogSequenceNumber.java#L42-L61 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgClob.java | PgClob.position | public synchronized long position(String pattern, long start) throws SQLException {
checkFreed();
throw org.postgresql.Driver.notImplemented(this.getClass(), "position(String,long)");
} | java | public synchronized long position(String pattern, long start) throws SQLException {
checkFreed();
throw org.postgresql.Driver.notImplemented(this.getClass(), "position(String,long)");
} | [
"public",
"synchronized",
"long",
"position",
"(",
"String",
"pattern",
",",
"long",
"start",
")",
"throws",
"SQLException",
"{",
"checkFreed",
"(",
")",
";",
"throw",
"org",
".",
"postgresql",
".",
"Driver",
".",
"notImplemented",
"(",
"this",
".",
"getClas... | For now, this is not implemented. | [
"For",
"now",
"this",
"is",
"not",
"implemented",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgClob.java#L64-L67 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/BooleanTypeUtil.java | BooleanTypeUtil.castToBoolean | static boolean castToBoolean(final Object in) throws PSQLException {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Cast to boolean: \"{0}\"", String.valueOf(in));
}
if (in instanceof Boolean) {
return (Boolean) in;
}
if (in instanceof String) {
return fromString((Str... | java | static boolean castToBoolean(final Object in) throws PSQLException {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Cast to boolean: \"{0}\"", String.valueOf(in));
}
if (in instanceof Boolean) {
return (Boolean) in;
}
if (in instanceof String) {
return fromString((Str... | [
"static",
"boolean",
"castToBoolean",
"(",
"final",
"Object",
"in",
")",
"throws",
"PSQLException",
"{",
"if",
"(",
"LOGGER",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"Cast to bo... | Cast an Object value to the corresponding boolean value.
@param in Object to cast into boolean
@return boolean value corresponding to the cast of the object
@throws PSQLException PSQLState.CANNOT_COERCE | [
"Cast",
"an",
"Object",
"value",
"to",
"the",
"corresponding",
"boolean",
"value",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/BooleanTypeUtil.java#L35-L52 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/UTF8Encoding.java | UTF8Encoding.checkByte | private static void checkByte(int ch, int pos, int len) throws IOException {
if ((ch & 0xc0) != 0x80) {
throw new IOException(
GT.tr("Illegal UTF-8 sequence: byte {0} of {1} byte sequence is not 10xxxxxx: {2}",
pos, len, ch));
}
} | java | private static void checkByte(int ch, int pos, int len) throws IOException {
if ((ch & 0xc0) != 0x80) {
throw new IOException(
GT.tr("Illegal UTF-8 sequence: byte {0} of {1} byte sequence is not 10xxxxxx: {2}",
pos, len, ch));
}
} | [
"private",
"static",
"void",
"checkByte",
"(",
"int",
"ch",
",",
"int",
"pos",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"(",
"ch",
"&",
"0xc0",
")",
"!=",
"0x80",
")",
"{",
"throw",
"new",
"IOException",
"(",
"GT",
".",
"tr"... | helper for decode | [
"helper",
"for",
"decode"
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/UTF8Encoding.java#L25-L31 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java | PgDatabaseMetaData.getMaxIndexKeys | protected int getMaxIndexKeys() throws SQLException {
if (indexMaxKeys == 0) {
String sql;
sql = "SELECT setting FROM pg_catalog.pg_settings WHERE name='max_index_keys'";
Statement stmt = connection.createStatement();
ResultSet rs = null;
try {
rs = stmt.executeQuery(sql);
... | java | protected int getMaxIndexKeys() throws SQLException {
if (indexMaxKeys == 0) {
String sql;
sql = "SELECT setting FROM pg_catalog.pg_settings WHERE name='max_index_keys'";
Statement stmt = connection.createStatement();
ResultSet rs = null;
try {
rs = stmt.executeQuery(sql);
... | [
"protected",
"int",
"getMaxIndexKeys",
"(",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"indexMaxKeys",
"==",
"0",
")",
"{",
"String",
"sql",
";",
"sql",
"=",
"\"SELECT setting FROM pg_catalog.pg_settings WHERE name='max_index_keys'\"",
";",
"Statement",
"stmt",
"=... | maximum number of keys in an index. | [
"maximum",
"number",
"of",
"keys",
"in",
"an",
"index",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java#L46-L69 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java | PgDatabaseMetaData.escapeQuotes | protected String escapeQuotes(String s) throws SQLException {
StringBuilder sb = new StringBuilder();
if (!connection.getStandardConformingStrings()) {
sb.append("E");
}
sb.append("'");
sb.append(connection.escapeString(s));
sb.append("'");
return sb.toString();
} | java | protected String escapeQuotes(String s) throws SQLException {
StringBuilder sb = new StringBuilder();
if (!connection.getStandardConformingStrings()) {
sb.append("E");
}
sb.append("'");
sb.append(connection.escapeString(s));
sb.append("'");
return sb.toString();
} | [
"protected",
"String",
"escapeQuotes",
"(",
"String",
"s",
")",
"throws",
"SQLException",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"!",
"connection",
".",
"getStandardConformingStrings",
"(",
")",
")",
"{",
"sb",
"."... | Turn the provided value into a valid string literal for direct inclusion into a query. This
includes the single quotes needed around it.
@param s input value
@return string literal for direct inclusion into a query
@throws SQLException if something wrong happens | [
"Turn",
"the",
"provided",
"value",
"into",
"a",
"valid",
"string",
"literal",
"for",
"direct",
"inclusion",
"into",
"a",
"query",
".",
"This",
"includes",
"the",
"single",
"quotes",
"needed",
"around",
"it",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java#L1011-L1020 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java | PgDatabaseMetaData.parseACLArray | private static List<String> parseACLArray(String aclString) {
List<String> acls = new ArrayList<String>();
if (aclString == null || aclString.isEmpty()) {
return acls;
}
boolean inQuotes = false;
// start at 1 because of leading "{"
int beginIndex = 1;
char prevChar = ' ';
for (int... | java | private static List<String> parseACLArray(String aclString) {
List<String> acls = new ArrayList<String>();
if (aclString == null || aclString.isEmpty()) {
return acls;
}
boolean inQuotes = false;
// start at 1 because of leading "{"
int beginIndex = 1;
char prevChar = ' ';
for (int... | [
"private",
"static",
"List",
"<",
"String",
">",
"parseACLArray",
"(",
"String",
"aclString",
")",
"{",
"List",
"<",
"String",
">",
"acls",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"if",
"(",
"aclString",
"==",
"null",
"||",
"aclStri... | Parse an String of ACLs into a List of ACLs. | [
"Parse",
"an",
"String",
"of",
"ACLs",
"into",
"a",
"List",
"of",
"ACLs",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java#L1793-L1825 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/util/ObjectFactory.java | ObjectFactory.instantiate | public static Object instantiate(String classname, Properties info, boolean tryString,
String stringarg) throws ClassNotFoundException, SecurityException, NoSuchMethodException,
IllegalArgumentException, InstantiationException, IllegalAccessException,
InvocationTargetException {
Object[] a... | java | public static Object instantiate(String classname, Properties info, boolean tryString,
String stringarg) throws ClassNotFoundException, SecurityException, NoSuchMethodException,
IllegalArgumentException, InstantiationException, IllegalAccessException,
InvocationTargetException {
Object[] a... | [
"public",
"static",
"Object",
"instantiate",
"(",
"String",
"classname",
",",
"Properties",
"info",
",",
"boolean",
"tryString",
",",
"String",
"stringarg",
")",
"throws",
"ClassNotFoundException",
",",
"SecurityException",
",",
"NoSuchMethodException",
",",
"IllegalA... | Instantiates a class using the appropriate constructor. If a constructor with a single
Propertiesparameter exists, it is used. Otherwise, if tryString is true a constructor with a
single String argument is searched if it fails, or tryString is true a no argument constructor
is tried.
@param classname name of the class... | [
"Instantiates",
"a",
"class",
"using",
"the",
"appropriate",
"constructor",
".",
"If",
"a",
"constructor",
"with",
"a",
"single",
"Propertiesparameter",
"exists",
"it",
"is",
"used",
".",
"Otherwise",
"if",
"tryString",
"is",
"true",
"a",
"constructor",
"with",
... | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/util/ObjectFactory.java#L37-L61 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java | PgResultSet.isUpdateable | boolean isUpdateable() throws SQLException {
checkClosed();
if (resultsetconcurrency == ResultSet.CONCUR_READ_ONLY) {
throw new PSQLException(
GT.tr("ResultSets with concurrency CONCUR_READ_ONLY cannot be updated."),
PSQLState.INVALID_CURSOR_STATE);
}
if (updateable) {
... | java | boolean isUpdateable() throws SQLException {
checkClosed();
if (resultsetconcurrency == ResultSet.CONCUR_READ_ONLY) {
throw new PSQLException(
GT.tr("ResultSets with concurrency CONCUR_READ_ONLY cannot be updated."),
PSQLState.INVALID_CURSOR_STATE);
}
if (updateable) {
... | [
"boolean",
"isUpdateable",
"(",
")",
"throws",
"SQLException",
"{",
"checkClosed",
"(",
")",
";",
"if",
"(",
"resultsetconcurrency",
"==",
"ResultSet",
".",
"CONCUR_READ_ONLY",
")",
"{",
"throw",
"new",
"PSQLException",
"(",
"GT",
".",
"tr",
"(",
"\"ResultSets... | Is this ResultSet updateable? | [
"Is",
"this",
"ResultSet",
"updateable?"
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java#L1471-L1553 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java | PgResultSet.readDoubleValue | private double readDoubleValue(byte[] bytes, int oid, String targetType) throws PSQLException {
// currently implemented binary encoded fields
switch (oid) {
case Oid.INT2:
return ByteConverter.int2(bytes, 0);
case Oid.INT4:
return ByteConverter.int4(bytes, 0);
case Oid.INT8:
... | java | private double readDoubleValue(byte[] bytes, int oid, String targetType) throws PSQLException {
// currently implemented binary encoded fields
switch (oid) {
case Oid.INT2:
return ByteConverter.int2(bytes, 0);
case Oid.INT4:
return ByteConverter.int4(bytes, 0);
case Oid.INT8:
... | [
"private",
"double",
"readDoubleValue",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"oid",
",",
"String",
"targetType",
")",
"throws",
"PSQLException",
"{",
"// currently implemented binary encoded fields",
"switch",
"(",
"oid",
")",
"{",
"case",
"Oid",
".",
"IN... | Converts any numeric binary field to double value. This method does no overflow checking.
@param bytes The bytes of the numeric field.
@param oid The oid of the field.
@param targetType The target type. Used for error reporting.
@return The value as double.
@throws PSQLException If the field type is not supported nume... | [
"Converts",
"any",
"numeric",
"binary",
"field",
"to",
"double",
"value",
".",
"This",
"method",
"does",
"no",
"overflow",
"checking",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java#L2952-L2969 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/v3/ConnectionFactoryImpl.java | ConnectionFactoryImpl.createPostgresTimeZone | private static String createPostgresTimeZone() {
String tz = TimeZone.getDefault().getID();
if (tz.length() <= 3 || !tz.startsWith("GMT")) {
return tz;
}
char sign = tz.charAt(3);
String start;
switch (sign) {
case '+':
start = "GMT-";
break;
case '-':
s... | java | private static String createPostgresTimeZone() {
String tz = TimeZone.getDefault().getID();
if (tz.length() <= 3 || !tz.startsWith("GMT")) {
return tz;
}
char sign = tz.charAt(3);
String start;
switch (sign) {
case '+':
start = "GMT-";
break;
case '-':
s... | [
"private",
"static",
"String",
"createPostgresTimeZone",
"(",
")",
"{",
"String",
"tz",
"=",
"TimeZone",
".",
"getDefault",
"(",
")",
".",
"getID",
"(",
")",
";",
"if",
"(",
"tz",
".",
"length",
"(",
")",
"<=",
"3",
"||",
"!",
"tz",
".",
"startsWith"... | Convert Java time zone to postgres time zone. All others stay the same except that GMT+nn
changes to GMT-nn and vise versa.
@return The current JVM time zone in postgresql format. | [
"Convert",
"Java",
"time",
"zone",
"to",
"postgres",
"time",
"zone",
".",
"All",
"others",
"stay",
"the",
"same",
"except",
"that",
"GMT",
"+",
"nn",
"changes",
"to",
"GMT",
"-",
"nn",
"and",
"vise",
"versa",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/v3/ConnectionFactoryImpl.java#L369-L389 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/largeobject/LargeObject.java | LargeObject.close | public void close() throws SQLException {
if (!closed) {
// flush any open output streams
if (os != null) {
try {
// we can't call os.close() otherwise we go into an infinite loop!
os.flush();
} catch (IOException ioe) {
throw new PSQLException("Exception fl... | java | public void close() throws SQLException {
if (!closed) {
// flush any open output streams
if (os != null) {
try {
// we can't call os.close() otherwise we go into an infinite loop!
os.flush();
} catch (IOException ioe) {
throw new PSQLException("Exception fl... | [
"public",
"void",
"close",
"(",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"!",
"closed",
")",
"{",
"// flush any open output streams",
"if",
"(",
"os",
"!=",
"null",
")",
"{",
"try",
"{",
"// we can't call os.close() otherwise we go into an infinite loop!",
"os... | This method closes the object. You must not call methods in this object after this is called.
@throws SQLException if a database-access error occurs. | [
"This",
"method",
"closes",
"the",
"object",
".",
"You",
"must",
"not",
"call",
"methods",
"in",
"this",
"object",
"after",
"this",
"is",
"called",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/largeobject/LargeObject.java#L156-L179 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/largeobject/LargeObject.java | LargeObject.read | public int read(byte[] buf, int off, int len) throws SQLException {
byte[] b = read(len);
if (b.length < len) {
len = b.length;
}
System.arraycopy(b, 0, buf, off, len);
return len;
} | java | public int read(byte[] buf, int off, int len) throws SQLException {
byte[] b = read(len);
if (b.length < len) {
len = b.length;
}
System.arraycopy(b, 0, buf, off, len);
return len;
} | [
"public",
"int",
"read",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"SQLException",
"{",
"byte",
"[",
"]",
"b",
"=",
"read",
"(",
"len",
")",
";",
"if",
"(",
"b",
".",
"length",
"<",
"len",
")",
"{",
"l... | Reads some data from the object into an existing array.
@param buf destination array
@param off offset within array
@param len number of bytes to read
@return the number of bytes actually read
@throws SQLException if a database-access error occurs. | [
"Reads",
"some",
"data",
"from",
"the",
"object",
"into",
"an",
"existing",
"array",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/largeobject/LargeObject.java#L206-L213 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/largeobject/LargeObject.java | LargeObject.write | public void write(byte[] buf, int off, int len) throws SQLException {
FastpathArg[] args = new FastpathArg[2];
args[0] = new FastpathArg(fd);
args[1] = new FastpathArg(buf, off, len);
fp.fastpath("lowrite", args);
} | java | public void write(byte[] buf, int off, int len) throws SQLException {
FastpathArg[] args = new FastpathArg[2];
args[0] = new FastpathArg(fd);
args[1] = new FastpathArg(buf, off, len);
fp.fastpath("lowrite", args);
} | [
"public",
"void",
"write",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"SQLException",
"{",
"FastpathArg",
"[",
"]",
"args",
"=",
"new",
"FastpathArg",
"[",
"2",
"]",
";",
"args",
"[",
"0",
"]",
"=",
"new",
... | Writes some data from an array to the object.
@param buf destination array
@param off offset within array
@param len number of bytes to write
@throws SQLException if a database-access error occurs. | [
"Writes",
"some",
"data",
"from",
"an",
"array",
"to",
"the",
"object",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/largeobject/LargeObject.java#L236-L241 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/v3/BatchedQuery.java | BatchedQuery.getNativeSql | @Override
public String getNativeSql() {
if (sql != null) {
return sql;
}
sql = buildNativeSql(null);
return sql;
} | java | @Override
public String getNativeSql() {
if (sql != null) {
return sql;
}
sql = buildNativeSql(null);
return sql;
} | [
"@",
"Override",
"public",
"String",
"getNativeSql",
"(",
")",
"{",
"if",
"(",
"sql",
"!=",
"null",
")",
"{",
"return",
"sql",
";",
"}",
"sql",
"=",
"buildNativeSql",
"(",
"null",
")",
";",
"return",
"sql",
";",
"}"
] | Method to return the sql based on number of batches. Skipping the initial
batch. | [
"Method",
"to",
"return",
"the",
"sql",
"based",
"on",
"number",
"of",
"batches",
".",
"Skipping",
"the",
"initial",
"batch",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/v3/BatchedQuery.java#L78-L85 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgCallableStatement.java | PgCallableStatement.checkIndex | protected void checkIndex(int parameterIndex, int type1, int type2, String getName)
throws SQLException {
checkIndex(parameterIndex);
if (type1 != this.testReturn[parameterIndex - 1]
&& type2 != this.testReturn[parameterIndex - 1]) {
throw new PSQLException(
GT.tr("Parameter of typ... | java | protected void checkIndex(int parameterIndex, int type1, int type2, String getName)
throws SQLException {
checkIndex(parameterIndex);
if (type1 != this.testReturn[parameterIndex - 1]
&& type2 != this.testReturn[parameterIndex - 1]) {
throw new PSQLException(
GT.tr("Parameter of typ... | [
"protected",
"void",
"checkIndex",
"(",
"int",
"parameterIndex",
",",
"int",
"type1",
",",
"int",
"type2",
",",
"String",
"getName",
")",
"throws",
"SQLException",
"{",
"checkIndex",
"(",
"parameterIndex",
")",
";",
"if",
"(",
"type1",
"!=",
"this",
".",
"... | helperfunction for the getXXX calls to check isFunction and index == 1 Compare BOTH type fields
against the return type.
@param parameterIndex parameter index (1-based)
@param type1 type 1
@param type2 type 2
@param getName getter name
@throws SQLException if something goes wrong | [
"helperfunction",
"for",
"the",
"getXXX",
"calls",
"to",
"check",
"isFunction",
"and",
"index",
"==",
"1",
"Compare",
"BOTH",
"type",
"fields",
"against",
"the",
"return",
"type",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgCallableStatement.java#L361-L372 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/largeobject/LargeObjectManager.java | LargeObjectManager.open | public LargeObject open(int oid, int mode, boolean commitOnClose) throws SQLException {
return open((long) oid, mode, commitOnClose);
} | java | public LargeObject open(int oid, int mode, boolean commitOnClose) throws SQLException {
return open((long) oid, mode, commitOnClose);
} | [
"public",
"LargeObject",
"open",
"(",
"int",
"oid",
",",
"int",
"mode",
",",
"boolean",
"commitOnClose",
")",
"throws",
"SQLException",
"{",
"return",
"open",
"(",
"(",
"long",
")",
"oid",
",",
"mode",
",",
"commitOnClose",
")",
";",
"}"
] | This opens an existing large object, same as previous method, but commits the transaction on
close if asked.
@param oid of large object
@param mode mode of open
@param commitOnClose commit the transaction when this LOB will be closed
@return LargeObject instance providing access to the object
@throws SQLException on e... | [
"This",
"opens",
"an",
"existing",
"large",
"object",
"same",
"as",
"previous",
"method",
"but",
"commits",
"the",
"transaction",
"on",
"close",
"if",
"asked",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/largeobject/LargeObjectManager.java#L227-L229 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/largeobject/LargeObjectManager.java | LargeObjectManager.createLO | public long createLO(int mode) throws SQLException {
if (conn.getAutoCommit()) {
throw new PSQLException(GT.tr("Large Objects may not be used in auto-commit mode."),
PSQLState.NO_ACTIVE_SQL_TRANSACTION);
}
FastpathArg[] args = new FastpathArg[1];
args[0] = new FastpathArg(mode);
retu... | java | public long createLO(int mode) throws SQLException {
if (conn.getAutoCommit()) {
throw new PSQLException(GT.tr("Large Objects may not be used in auto-commit mode."),
PSQLState.NO_ACTIVE_SQL_TRANSACTION);
}
FastpathArg[] args = new FastpathArg[1];
args[0] = new FastpathArg(mode);
retu... | [
"public",
"long",
"createLO",
"(",
"int",
"mode",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"conn",
".",
"getAutoCommit",
"(",
")",
")",
"{",
"throw",
"new",
"PSQLException",
"(",
"GT",
".",
"tr",
"(",
"\"Large Objects may not be used in auto-commit mode.\"... | This creates a large object, returning its OID.
@param mode a bitmask describing different attributes of the new object
@return oid of new object
@throws SQLException on error | [
"This",
"creates",
"a",
"large",
"object",
"returning",
"its",
"OID",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/largeobject/LargeObjectManager.java#L293-L301 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/largeobject/LargeObjectManager.java | LargeObjectManager.delete | public void delete(long oid) throws SQLException {
FastpathArg[] args = new FastpathArg[1];
args[0] = Fastpath.createOIDArg(oid);
fp.fastpath("lo_unlink", args);
} | java | public void delete(long oid) throws SQLException {
FastpathArg[] args = new FastpathArg[1];
args[0] = Fastpath.createOIDArg(oid);
fp.fastpath("lo_unlink", args);
} | [
"public",
"void",
"delete",
"(",
"long",
"oid",
")",
"throws",
"SQLException",
"{",
"FastpathArg",
"[",
"]",
"args",
"=",
"new",
"FastpathArg",
"[",
"1",
"]",
";",
"args",
"[",
"0",
"]",
"=",
"Fastpath",
".",
"createOIDArg",
"(",
"oid",
")",
";",
"fp... | This deletes a large object.
@param oid describing object to delete
@throws SQLException on error | [
"This",
"deletes",
"a",
"large",
"object",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/largeobject/LargeObjectManager.java#L323-L327 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/VisibleBufferedInputStream.java | VisibleBufferedInputStream.ensureBytes | public boolean ensureBytes(int n) throws IOException {
int required = n - endIndex + index;
while (required > 0) {
if (!readMore(required)) {
return false;
}
required = n - endIndex + index;
}
return true;
} | java | public boolean ensureBytes(int n) throws IOException {
int required = n - endIndex + index;
while (required > 0) {
if (!readMore(required)) {
return false;
}
required = n - endIndex + index;
}
return true;
} | [
"public",
"boolean",
"ensureBytes",
"(",
"int",
"n",
")",
"throws",
"IOException",
"{",
"int",
"required",
"=",
"n",
"-",
"endIndex",
"+",
"index",
";",
"while",
"(",
"required",
">",
"0",
")",
"{",
"if",
"(",
"!",
"readMore",
"(",
"required",
")",
"... | Ensures that the buffer contains at least n bytes. This method invalidates the buffer and index
fields.
@param n The amount of bytes to ensure exists in buffer
@return true if required bytes are available and false if EOF
@throws IOException If reading of the wrapped stream failed. | [
"Ensures",
"that",
"the",
"buffer",
"contains",
"at",
"least",
"n",
"bytes",
".",
"This",
"method",
"invalidates",
"the",
"buffer",
"and",
"index",
"fields",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/VisibleBufferedInputStream.java#L106-L115 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/VisibleBufferedInputStream.java | VisibleBufferedInputStream.readMore | private boolean readMore(int wanted) throws IOException {
if (endIndex == index) {
index = 0;
endIndex = 0;
}
int canFit = buffer.length - endIndex;
if (canFit < wanted) {
// would the wanted bytes fit if we compacted the buffer
// and still leave some slack
if (index + can... | java | private boolean readMore(int wanted) throws IOException {
if (endIndex == index) {
index = 0;
endIndex = 0;
}
int canFit = buffer.length - endIndex;
if (canFit < wanted) {
// would the wanted bytes fit if we compacted the buffer
// and still leave some slack
if (index + can... | [
"private",
"boolean",
"readMore",
"(",
"int",
"wanted",
")",
"throws",
"IOException",
"{",
"if",
"(",
"endIndex",
"==",
"index",
")",
"{",
"index",
"=",
"0",
";",
"endIndex",
"=",
"0",
";",
"}",
"int",
"canFit",
"=",
"buffer",
".",
"length",
"-",
"en... | Reads more bytes into the buffer.
@param wanted How much should be at least read.
@return True if at least some bytes were read.
@throws IOException If reading of the wrapped stream failed. | [
"Reads",
"more",
"bytes",
"into",
"the",
"buffer",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/VisibleBufferedInputStream.java#L124-L146 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/VisibleBufferedInputStream.java | VisibleBufferedInputStream.moveBufferTo | private void moveBufferTo(byte[] dest) {
int size = endIndex - index;
System.arraycopy(buffer, index, dest, 0, size);
index = 0;
endIndex = size;
} | java | private void moveBufferTo(byte[] dest) {
int size = endIndex - index;
System.arraycopy(buffer, index, dest, 0, size);
index = 0;
endIndex = size;
} | [
"private",
"void",
"moveBufferTo",
"(",
"byte",
"[",
"]",
"dest",
")",
"{",
"int",
"size",
"=",
"endIndex",
"-",
"index",
";",
"System",
".",
"arraycopy",
"(",
"buffer",
",",
"index",
",",
"dest",
",",
"0",
",",
"size",
")",
";",
"index",
"=",
"0",... | Moves bytes from the buffer to the beginning of the destination buffer. Also sets the index and
endIndex variables.
@param dest The destination buffer. | [
"Moves",
"bytes",
"from",
"the",
"buffer",
"to",
"the",
"beginning",
"of",
"the",
"destination",
"buffer",
".",
"Also",
"sets",
"the",
"index",
"and",
"endIndex",
"variables",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/VisibleBufferedInputStream.java#L170-L175 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/util/ExpressionProperties.java | ExpressionProperties.getRawPropertyValue | public String getRawPropertyValue(String key) {
String value = super.getProperty(key);
if (value != null) {
return value;
}
for (Properties properties : defaults) {
value = properties.getProperty(key);
if (value != null) {
return value;
}
}
return null;
} | java | public String getRawPropertyValue(String key) {
String value = super.getProperty(key);
if (value != null) {
return value;
}
for (Properties properties : defaults) {
value = properties.getProperty(key);
if (value != null) {
return value;
}
}
return null;
} | [
"public",
"String",
"getRawPropertyValue",
"(",
"String",
"key",
")",
"{",
"String",
"value",
"=",
"super",
".",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"value",
";",
"}",
"for",
"(",
"Properties",
"pr... | Returns raw value of a property without any replacements.
@param key property name
@return raw property value | [
"Returns",
"raw",
"value",
"of",
"a",
"property",
"without",
"any",
"replacements",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/util/ExpressionProperties.java#L58-L70 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java | AbstractBlobClob.truncate | public synchronized void truncate(long len) throws SQLException {
checkFreed();
if (!conn.haveMinimumServerVersion(ServerVersion.v8_3)) {
throw new PSQLException(
GT.tr("Truncation of large objects is only implemented in 8.3 and later servers."),
PSQLState.NOT_IMPLEMENTED);
}
... | java | public synchronized void truncate(long len) throws SQLException {
checkFreed();
if (!conn.haveMinimumServerVersion(ServerVersion.v8_3)) {
throw new PSQLException(
GT.tr("Truncation of large objects is only implemented in 8.3 and later servers."),
PSQLState.NOT_IMPLEMENTED);
}
... | [
"public",
"synchronized",
"void",
"truncate",
"(",
"long",
"len",
")",
"throws",
"SQLException",
"{",
"checkFreed",
"(",
")",
";",
"if",
"(",
"!",
"conn",
".",
"haveMinimumServerVersion",
"(",
"ServerVersion",
".",
"v8_3",
")",
")",
"{",
"throw",
"new",
"P... | For Blobs this should be in bytes while for Clobs it should be in characters. Since we really
haven't figured out how to handle character sets for Clobs the current implementation uses
bytes for both Blobs and Clobs.
@param len maximum length
@throws SQLException if operation fails | [
"For",
"Blobs",
"this",
"should",
"be",
"in",
"bytes",
"while",
"for",
"Clobs",
"it",
"should",
"be",
"in",
"characters",
".",
"Since",
"we",
"really",
"haven",
"t",
"figured",
"out",
"how",
"to",
"handle",
"character",
"sets",
"for",
"Clobs",
"the",
"cu... | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java#L73-L95 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java | AbstractBlobClob.position | public synchronized long position(byte[] pattern, long start) throws SQLException {
assertPosition(start, pattern.length);
int position = 1;
int patternIdx = 0;
long result = -1;
int tmpPosition = 1;
for (LOIterator i = new LOIterator(start - 1); i.hasNext(); position++) {
byte b = i.nex... | java | public synchronized long position(byte[] pattern, long start) throws SQLException {
assertPosition(start, pattern.length);
int position = 1;
int patternIdx = 0;
long result = -1;
int tmpPosition = 1;
for (LOIterator i = new LOIterator(start - 1); i.hasNext(); position++) {
byte b = i.nex... | [
"public",
"synchronized",
"long",
"position",
"(",
"byte",
"[",
"]",
"pattern",
",",
"long",
"start",
")",
"throws",
"SQLException",
"{",
"assertPosition",
"(",
"start",
",",
"pattern",
".",
"length",
")",
";",
"int",
"position",
"=",
"1",
";",
"int",
"p... | Iterate over the buffer looking for the specified pattern.
@param pattern A pattern of bytes to search the blob for
@param start The position to start reading from
@return position of the specified pattern
@throws SQLException if something wrong happens | [
"Iterate",
"over",
"the",
"buffer",
"looking",
"for",
"the",
"specified",
"pattern",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java#L136-L161 | train |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java | AbstractBlobClob.assertPosition | protected void assertPosition(long pos, long len) throws SQLException {
checkFreed();
if (pos < 1) {
throw new PSQLException(GT.tr("LOB positioning offsets start at 1."),
PSQLState.INVALID_PARAMETER_VALUE);
}
if (pos + len - 1 > Integer.MAX_VALUE) {
throw new PSQLException(GT.tr("P... | java | protected void assertPosition(long pos, long len) throws SQLException {
checkFreed();
if (pos < 1) {
throw new PSQLException(GT.tr("LOB positioning offsets start at 1."),
PSQLState.INVALID_PARAMETER_VALUE);
}
if (pos + len - 1 > Integer.MAX_VALUE) {
throw new PSQLException(GT.tr("P... | [
"protected",
"void",
"assertPosition",
"(",
"long",
"pos",
",",
"long",
"len",
")",
"throws",
"SQLException",
"{",
"checkFreed",
"(",
")",
";",
"if",
"(",
"pos",
"<",
"1",
")",
"{",
"throw",
"new",
"PSQLException",
"(",
"GT",
".",
"tr",
"(",
"\"LOB pos... | Throws an exception if the pos value exceeds the max value by which the large object API can
index.
@param pos Position to write at.
@param len number of bytes to write.
@throws SQLException if something goes wrong | [
"Throws",
"an",
"exception",
"if",
"the",
"pos",
"value",
"exceeds",
"the",
"max",
"value",
"by",
"which",
"the",
"large",
"object",
"API",
"can",
"index",
"."
] | 95ba7b261e39754674c5817695ae5ebf9a341fae | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java#L224-L234 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.