using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Post
{
    public class ConstValuesTracing
    {
        // tracing struct length
        public int CONST_STRUCT_VAR_LEN_PATHSIZE = 256;
        public int CONST_STRUCT_VAR_LEN_ALIAS = 32;
        public int CONST_STRUCT_VAR_LEN_VERSION = 16;
        public int CONST_STRUCT_VAR_LEN_TIMESTAMP = 24;
        public int CONST_STRUCT_VAR_LEN_OSNAME = 16;
        public int CONST_STRUCT_VAR_LEN_HOSTNAME = 16;
        public int CONST_STRUCT_VAR_LEN_KERNEL_RELEASE = 32;
        public int CONST_STRUCT_VAR_LEN_KERNEL_VERSION = 40;
        public int CONST_STRUCT_VAR_LEN_ARCHITECTURE = 32;
        public int CONST_STRUCT_VAR_LEN_DBNAME = 16;
        public int CONST_STRUCT_VAR_LEN_INSTANCE_NAME = 16;
        public int CONST_STRUCT_VAR_LEN_DBBANNER = 384;
        public int CONST_STRUCT_VAR_LEN_DBVERSION = 64;
        public int CONST_STRUCT_VAR_LEN_TRANSACTION_ID = 20;

        public int CONST_STRUCT_SIZE_FILEHEADER = 2048;
        //public int CONST_STRUCT_SIZE_BRACKET = 10;
        public int CONST_STRUCT_SIZE_BRACKET = 12;

        public Int16 CONST_TRACING_COMMAND_DML = 0x01;     // 0x01
        public Int16 CONST_TRACING_COMMAND_DDL = 0x02;     // 0x02
        public Int16 CONST_TRACING_COMMAND_LOB = 0x03;     // 0x03
        public Int16 CONST_TRACING_COMMAND_DEFINITION = 0x10;     // 0x10        

        public Int16 CONST_RECORD_TYPE_DML_UNKNOWN = 0x00;    // 0
        public Int16 CONST_RECORD_TYPE_DML_DELETE = 0x01;    // 1
        public Int16 CONST_RECORD_TYPE_DML_INSERT = 0x02;    // 2
        public Int16 CONST_RECORD_TYPE_DML_UPDATE = 0x03;    // 3
        public Int16 CONST_RECORD_TYPE_DML_UPDATE_PK = 0x07;    // 7        
        public Int16 CONST_RECORD_TYPE_LOB = 0x10;    // 16
        public Int16 CONST_RECORD_TYPE_SEQUENCE_OPER = 0x20;    // 32
        public Int16 CONST_RECORD_TYPE_DDL = 0x40;    // 64
        public Int16 CONST_RECORD_TYPE_DEFINITION = 0x80;    // 128
        public Int16 CONST_RECORD_TYPE_FRAGMENT = 0xF0;    // 240

        public Int16 CONST_PARTITION_NONE = 0x00;
        public Int16 CONST_PARTITION_BULK = 0x01;

        public Int16 CONST_DDL_TYPE_CREATE = 0x01;
        public Int16 CONST_DDL_TYPE_ALTER = 0x02;
        public Int16 CONST_DDL_TYPE_DROP = 0x03;
        public Int16 CONST_DDL_TYPE_RENAME = 0x04;
        public Int16 CONST_DDL_TYPE_TRUNCATE = 0x05;
        public Int16 CONST_DDL_TYPE_GRANT = 0x06;
        public Int16 CONST_DDL_TYPE_REVOKE = 0x07;

        public Int16 CONST_OBJECT_TYPE_TABLE = 0x01;
        public Int16 CONST_OBJECT_TYPE_CLUSTER = 0x02;
        public Int16 CONST_OBJECT_TYPE_SEQUENCE = 0x03;
        public Int16 CONST_OBJECT_TYPE_MATERIAL_VIEW = 0x04;
        public Int16 CONST_OBJECT_TYPE_INDEX = 0x05;
        public Int16 CONST_OBJECT_TYPE_VIEW = 0x06;

        public int CONST_TRACING_DML_TRACING_BEFORE = 1;
        public int CONST_TRACING_DML_TRACING_AFTER = 2;

        public byte CONST_TRACING_FLAG_BEFORE = 0x01;
        public byte CONST_TRACING_FLAG_AFTER = 0x02;
        public string CONST_TRACING_OPERATION_INSERT = "2";
        public string CONST_TRACING_OPERATION_DELETE = "1";
        public string CONST_TRACING_OPERATION_UPDATE = "4";
        public string CONST_TRACING_OPERATION_UPDATE_BEFORE = "3";

        /*
        public int CONST_TRACING_TYPE_INT32VAL_UNKNOWN = 0;
        public int CONST_TRACING_TYPE_INT32VAL_NUMERIC = 1;        
        public int CONST_TRACING_TYPE_INT32VAL_STRING = 17;
        public int CONST_TRACING_TYPE_INT32VAL_U_STRING = 18;
        public int CONST_TRACING_TYPE_INT32VAL_DATE = 33;
        public int CONST_TRACING_TYPE_INT32VAL_TIMESTAMP = 34;
        public int CONST_TRACING_TYPE_INT32VAL_TIMESTAMP_TZ = 35;
        public int CONST_TRACING_TYPE_INT32VAL_TIMESTAMP_TZR = 36;
        public int CONST_TRACING_TYPE_INT32VAL_TIMESTAMP_LTZ = 37;
        public int CONST_TRACING_TYPE_INT32VAL_INTERVAL_YM = 48;
        public int CONST_TRACING_TYPE_INT32VAL_INTERVAL_DS = 49;
        public int CONST_TRACING_TYPE_INT32VAL_ROWID = 96;
        public int CONST_TRACING_TYPE_INT32VAL_BLOB = 128;
        public int CONST_TRACING_TYPE_INT32VAL_CLOB = 129;
        public int CONST_TRACING_TYPE_INT32VAL_NCLOB = 130;
        public int CONST_TRACING_TYPE_INT32VAL_BFILE = 131;
        public int CONST_TRACING_TYPE_INT32VAL_BLOB_FETCH = 132;
        public int CONST_TRACING_TYPE_INT32VAL_CLOB_FETCH = 133;
        public int CONST_TRACING_TYPE_INT32VAL_NCLOB_FETCH = 134;
        public int CONST_TRACING_TYPE_INT32VAL_RAW = 144;
        public int CONST_TRACING_TYPE_INT32VAL_LONGRAW_FETCH = 145;
        public int CONST_TRACING_TYPE_INT32VAL_LONG_FETCH = 146;
        public int CONST_TRACING_TYPE_INT32VAL_LONGRAW = 147;
        public int CONST_TRACING_TYPE_INT32VAL_LONG = 148;        
        public int CONST_TRACING_TYPE_INT32VAL_DATETIMEOFFSET = 39;     // sqlserver
        */

        public Int16 CONST_COL_FLAG_LOB = 0x08;
        public Int16 CONST_COL_FLAG_FETCH = 0x80;

        // main type          
        public Int16 CONST_COL_TYPE_UNKNOWN = 0x00;
        public Int16 CONST_COL_TYPE_NUMERIC = 0x10;
        public Int16 CONST_COL_TYPE_STRING = 0x20;
        public Int16 CONST_COL_TYPE_U_STRING = 0x21;     // COL_TYPE_STRING + COL_SUBTYPE_NCHAR
        public Int16 CONST_COL_TYPE_ROWID = 0x22;   // COL_TYPE_STRING + COL_SUBTYPE_ROWID
        public Int16 CONST_COL_TYPE_DATE = 0x30;
        public Int16 CONST_COL_TYPE_TIMESTAMP = 0x50;
        public Int16 CONST_COL_TYPE_TIMESTAMP_TZ = 0x52;     // COL_TYPE_TIMESTAMP + COL_SUBTYPE_TIMESTAMP_TZ
        public Int16 CONST_COL_TYPE_TIMESTAMP_TZR = 0x53;    // COL_TYPE_TIMESTAMP + COL_SUBTYPE_TIMESTAMP_TZR
        public Int16 CONST_COL_TYPE_TIMESTAMP_LTZ = 0x54;    // COL_TYPE_TIMESTAMP + COL_SUBTYPE_TIMESTAMP_LTZ
        public Int16 CONST_COL_TYPE_INTERVAL_YM = 0x55;    // COL_TYPE_DATE +  COL_SUBTYPE_INTERVAL_YM
        public Int16 CONST_COL_TYPE_INTERVAL_DS = 0x5D;    // COL_TYPE_DATE +  COL_SUBTYPE_INTERVAL_DS
        public Int16 CONST_COL_TYPE_RAW = 0x40;
        public Int16 CONST_COL_TYPE_CLOB = 0x28;    // COL_TYPE_STRING + COL_FLAG_LOB
        public Int16 CONST_COL_TYPE_NCLOB = 0x29;    // COL_TYPE_STRING + COL_FLAG_LOB + COL_SUBTYPE_NCHAR
        public Int16 CONST_COL_TYPE_BLOB = 0x48;        // COL_TYPE_RAW + COL_FLAG_LOB
        public Int16 CONST_COL_TYPE_BFILE = 0x2C;     // COL_TYPE_STRING + COL_FLAG_LOB + COL_SUBTYPE_BFILE
        public Int16 CONST_COL_TYPE_CLOB_FETCH = 0xA8;    // COL_TYPE_STRING + COL_FLAG_LOB + COL_FLAG_FETCH
        public Int16 CONST_COL_TYPE_NCLOB_FETCH = 0xA9;    // COL_TYPE_STRING + COL_FLAG_LOB + COL_SUBTYPE_NCHAR + COL_FLAG_FETCH
        public Int16 CONST_COL_TYPE_BLOB_FETCH = 0xC8;     // COL_TYPE_RAW + COL_FLAG_LOB + COL_FLAG_FETCH
        public Int16 CONST_COL_TYPE_LONG = 0x23;      // COL_TYPE_STRING + COL_SUBTYPE_LONG
        public Int16 CONST_COL_TYPE_LONGRAW = 0x43;    // COL_TYPE_RAW + COL_SUBTYPE_LONG
        public Int16 CONST_COL_TYPE_LONG_FETCH = 0xA3;     // COL_TYPE_STRING + COL_SUBTYPE_LONG + COL_FLAG_FETCH
        public Int16 CONST_COL_TYPE_LONGRAW_FETCH = 0xC3;         // COL_TYPE_RAW + COL_SUBTYPE_LONG + COL_FLAG_FETCH
        public Int16 CONST_COL_TYPE_DATETIMEOFFSET = 0x59;     // sqlserver 존재하는 col type

        // subtype
        public Int16 CONST_COL_SUBTYPE_NONE = 0x00;
        public Int16 CONST_COL_SUBTYPE_NCHAR = 0x01;
        public Int16 CONST_COL_SUBTYPE_ROWID = 0x02;
        public Int16 CONST_COL_SUBTYPE_XML = 0x04;
        public Int16 CONST_COL_SUBTYPE_TIMESTAMP_TZ = 0x02;
        public Int16 CONST_COL_SUBTYPE_TIMESTAMP_TZR = 0x03;
        public Int16 CONST_COL_SUBTYPE_TIMESTAMP_LTZ = 0x04;
        public Int16 CONST_COL_SUBTYPE_INTERVAL_YM = 0x05;
        public Int16 CONST_COL_SUBTYPE_INTERVAL_FALG_DS = 0x08;
        public Int16 CONST_COL_SUBTYPE_INTERVAL_DS = 0x0D;
        public Int16 CONST_COL_SUBTYPE_LONG = 0x03;
        public Int16 CONST_COL_SUBTYPE_BFILE = 0x04;

        public string CONST_TRACING_TABLEMETA_DATATYPE_INT = "int";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_SMALLINT = "smallint";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_TINYINT = "tinyint";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_BIGINT = "bigint";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_DECIMAL = "decimal";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_NUMERIC = "numeric";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_BIT = "bit";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_MONEY = "money";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_SMALLMONEY = "smallmoney";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_FLOAT = "FLOAT";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_BINARY_FLOAT = "BINARY_FLOAT";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_BINARY_DOUBLE = "BINARY_DOUBLE";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_NUMBER = "NUMBER";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_LONG = "LONG";     // LONG
        public string CONST_TRACING_TABLEMETA_DATATYPE_REAL = "real";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_DATE = "DATE";       // DATE
        public string CONST_TRACING_TABLEMETA_DATATYPE_TIMESTAMP = "TIMESTAMP";       // DATE
        public string CONST_TRACING_TABLEMETA_DATATYPE_INTERVAL_YEAR_TO_MONTH = "INTERVAL YEAR";       // INTERVAL YEAR TO MONTH
        public string CONST_TRACING_TABLEMETA_DATATYPE_INTERVAL_DAY_TO_SECOND = "INTERVAL DAY";       // INTERVAL DAY TO SECOND
        public string CONST_TRACING_TABLEMETA_DATATYPE_TIME = "time";       // TIMESTAMP
        public string CONST_TRACING_TABLEMETA_DATATYPE_DATETIME = "datetime";       // TIMESTAMP
        public string CONST_TRACING_TABLEMETA_DATATYPE_DATETIME2 = "datetime2";       // TIMESTAMP
        public string CONST_TRACING_TABLEMETA_DATATYPE_SMALLDATETIME = "smalldatetime";         // DATE
        public string CONST_TRACING_TABLEMETA_DATATYPE_DATETIMEOFFSET = "datetimeoffset";       // TIMESTAMP
        public string CONST_TRACING_TABLEMETA_DATATYPE_CHAR = "char";       // STRING
        public string CONST_TRACING_TABLEMETA_DATATYPE_VARCHAR = "varchar";       // STRING
        public string CONST_TRACING_TABLEMETA_DATATYPE_VARCHAR2 = "varchar2";       // STRING
        public string CONST_TRACING_TABLEMETA_DATATYPE_NCHAR = "nchar";     // U_STRING
        public string CONST_TRACING_TABLEMETA_DATATYPE_NVARCHAR = "nvarchar";     // U_STRING
        public string CONST_TRACING_TABLEMETA_DATATYPE_NVARCHAR2 = "nvarchar2";     // U_STRING        
        public string CONST_TRACING_TABLEMETA_DATATYPE_BINARY = "binary";       // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_VARBINARY = "varbinary";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_RAW = "RAW";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_LONG_RAW = "LONG RAW";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_BLOB = "BLOB";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_CLOB = "CLOB";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_NCLOB = "NCLOB";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_BFILE = "BFILE";     // NUMERIC
        public string CONST_TRACING_TABLEMETA_DATATYPE_TEXT = "text";     // U_STRING
        public string CONST_TRACING_TABLEMETA_DATATYPE_NTEXT = "ntext";     // U_STRING
        public string CONST_TRACING_TABLEMETA_DATATYPE_IMAGE = "image";     // U_STRING        

        public Int16 CONST_TRACING_TX_INDICATOR_CONTINUE = 0x00;    // transaction 의 시작과 끝이 아닌 중간 레코드
        public Int16 CONST_TRACING_TX_INDICATOR_START = 0x01;    // transaction 의 시작 레코드
        public Int16 CONST_TRACING_TX_INDICATOR_END = 0x02;      // transaction 의 끝 레코드
        public Int16 CONST_TRACING_TX_INDICATOR_START_END = 0x03;     // transaction 의 시작과 끝인 레코드 , transaction 에 레코드가 하나일 경우

        public Int16 CONST_TRACING_CAPTURE_TYPE_FETCH = 0x10;    // fetch
        public Int16 CONST_TRACING_CAPTURE_TYPE_REDO = 0x01;    // default
        public Int16 CONST_TRACING_CAPTURE_TYPE_MIX = 0x11;    // 1.4 에서 사용하지 않음

        public string CONST_TRACING_VERSION_SIGNATURE = "0x71BB";
        public string CONST_TRACING_VERSION_2 = "20";    // 2.0
    }

}
