<commit_before>/*
	This file is part of ADBCJ.

	ADBCJ is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	ADBCJ is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with ADBCJ.  If not, see <http://www.gnu.org/licenses/>.

	Copyright 2008  <NAME>
 */
package org.adbcj.mysql.codec;

import org.adbcj.PreparedStatement;
import org.adbcj.Value;
import org.adbcj.mysql.codec.packets.*;
import org.adbcj.support.DefaultValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.util.Set;

/**
 * Client stateful decoder.  Being stateful, each client connection must have its own decoder instance to function
 * properly.
 *
 * @author <NAME> <<EMAIL>>
 */
public class MySqlClientDecoder {
    private static final Logger logger = LoggerFactory.getLogger(MySqlClientDecoder.class);

    /**
     * The salt size in a server greeting
     */
    public static final int SALT_SIZE = 8;

    /**
     * The size of the second salt in a server greeting
     */
    public static final int SALT2_SIZE = 12;

    /**
     * Number of unused bytes in server greeting
     */
    public static final int GREETING_UNUSED_SIZE = 13;

    public static final int RESPONSE_OK = 0x00;
    public static final int RESPONSE_EOF = 0xfe;
    public static final int RESPONSE_ERROR = 0xff;

    /**
     * The state of the decoder.
     */
    enum State {
        /**
         * The client is connecting
         */
        CONNECTING,
        RESPONSE,
        FIELD,
        FIELD_EOF,
        ROW
    }

    private State state = State.CONNECTING;

    private String charset = "ISO8859_1";

    /**<commit_msg>code format<commit_after>/*
	This file is part of ADBCJ.

	ADBCJ is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	ADBCJ is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with ADBCJ.  If not, see <http://www.gnu.org/licenses/>.

	Copyright 2008  <NAME>
 */
package org.adbcj.mysql.codec;

import org.adbcj.PreparedStatement;
import org.adbcj.Value;
import org.adbcj.mysql.codec.packets.*;
import org.adbcj.support.DefaultValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.util.Set;

/**
 * Client stateful decoder.  Being stateful, each client connection must have its own decoder instance to function
 * properly.
 *
 * @author <NAME> <<EMAIL>>
 */
public class MySqlClientDecoder {
    private static final Logger logger = LoggerFactory.getLogger(MySqlClientDecoder.class);

    /**
     * The salt size in a server greeting
     */
    public static final int SALT_SIZE = 8;

    /**
     * The size of the second salt in a server greeting
     */
    public static final int SALT2_SIZE = 12;

    /**
     * Number of unused bytes in server greeting
     */
    public static final int GREETING_UNUSED_SIZE = 13;

    public static final int RESPONSE_OK = 0x00;
    public static final int RESPONSE_EOF = 0xfe;
    public static final int RESPONSE_ERROR = 0xff;

    /**
     * The state of the decoder.
     */
    enum State {
        CONNECTING,
        RESPONSE,
        FIELD,
        FIELD_EOF,
        ROW
    }

    private State state = State.CONNECTING;

    private String charset = "UTF-8";

    /**
{'fraction_non_alphanumeric': 0.0735080058224163, 'fraction_numerical': 0.010189228529839884, 'mean_word_length': 2.9416826003824093, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7251226', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1183, 'n_words': 475}