A class that processes the abnormal database, follow the error code pop-up prompt information

xiaoxiao2021-03-19  193

Public Class MyErrorContext

{

Public Static Class MyError

{

Int errno;

String szerrordesc;

Public myerror (int errno, string errotesc)

{

THIS.ERRNO = Errno;

THIS.SERRORDESC = ErrorDesc;

}

Public int getErrorNo ()

{

Return errno;

}

Public string geterrordesc ()

{

Return szerrordesc;

}

}

Public Static Final INT DB_ER_CANT_CREATE_TABLE = 1005; // Creating a table failed

Public Static Final INT DB_ER_CANT_CREATE_DB = 1006; // Creating Database Fails

Public Static Final INT DB_ER_DB_CREATE_EXISTS = 1007; / / The database already exists, create a database failed

Public Static Final INT DB_ER_DB_DROP_EXISTS = 1008; // Database does not exist, delete database failed

Public Static Final INT DB_ER_DB_DROP_DELETE = 1009; / / Cannot delete database files caused to delete database failed

Public Static Final INT DB_ER_DB_DROP_RMDIR = 1010; // Cannot delete data directory results in deletion of database failed

Public Static Final INT DB_ER_CANT_DELETE_FILE = 1011; // Delete Database File Failed

Public Static Final INT DB_ER_CANT_FIND_SYSTEM_REC = 1012; // Do not read records in system tables

Public Static Final INT DB_ER_CHECKREAD = 1020; // Record has been modified by other users

Public Static Final Int db_er_disk_full = 1021; // Hard disk remaining space, please increase the user's free space

Public Static Final INT DB_ER_DUP_KEY = 1022; // Keyword Repeat, change record failed

PUBLIC Static Final INT DB_ER_ERROR_ON_CLOSE = 1023; // An error occurred while turning off

Public Static Final INT DB_ER_ERROR_ON_READ = 1024; // Read file error

Public Static Final INT DB_ER_ERROR_ON_RENAME = 1025; // When changing the name, an error occurs.

Public Static Final INT DB_ER_ERROR_ON_WRITE = 1026; // Write file error

Public Static Final INT DB_ER_KEY_NOT_FOUND = 1032; // Record does not exist

Public Static Final Int db_er_open_as_readonly = 1036; // The data table is read-only, and it cannot be modified to it.

Public Static Final Int DB_ER_OUTOFMEMORY = 1037; // System memory is insufficient, please restart the database or restart the server

Public Static Final INT DB_ER_OUT_OF_SORTMEMORY = 1038; // Unsolicted memory, please increase the sorting buffer

Public Static Final INT DB_ER_CON_COUNT_ERROR = 1040; // The maximum number of connections to the database is reached, please increase the database available connections PUBLIC FINAL INT DB_ER_OUT_OF_RESOURCES = 1041; // System memory is insufficient

Public Static Final INT DB_ER_BAD_HOST_ERROR = 1042; // Invalid host name

Public Static Final INT DB_ER_HANDSHAKE_ERROR = 1043; // Invalid connection

Public Static Final INT DB_ER_DBACCESS_DENIED_ERROR = 1044; // The current user does not access the database

Public Static Final INT DB_ER_ACCESS_DENIED_ERROR = 1045; // Cannot connect to the database, username or password error

Public Static Final INT DB_ER_BAD_NULL_ERROR = 1048; // Field can't be empty

Public Static Final INT DB_ER_BAD_DB_ERROR = 1049; // Database does not exist

Public Static Final INT DB_ER_TABLE_EXISTS_ERROR = 1050; // Data table already exists

Public Static Final INT DB_ER_BAD_TABLE_ERROR = 1051; // Data table does not exist

Public Static Final INT DB_ER_BAD_FIELD_ERROR = 1054; // field does not exist

Public Static Final INT DB_ER_EMPTY_QUERY = 1065; // Invalid SQL statement, SQL statement is empty

Public Static Final INT DB_ER_IPSOCK_ERROR = 1081; // Can't establish a socket connection

Public Static Final INT DB_ER_RECORD_FILE_FULL = 1114; // Data table is full, can not accommodate any record

Public Static Final INT DB_ER_TOO_MANY_TABLES = 1116; // Opened Data Table too much

Public Static Final INT DB_ER_HOST_IS_BLOCKED = 1129; / / The database appears anomaly, please restart the database

Public Static Final INT DB_ER_HOST_NOT_PRIVILED = 1130; // Connect the database failed, no access to the database

Public Static Final INT DB_ER_PASSWORD_NO_MATCH = 1133; // Database User does not exist

Public Static Final INT DB_ER_NONEXISTING_GRANT = 1141; // Current User No access to Database

Public Static Final INT DB_ER_TABLEACCESS_DENIED_ERROR = 1142; // Current User No access to Data Sheet

Public Static Final INT DB_ER_COLUMNACCESS_DENIED_ERROR = 1143; // Current user does not have access to fields in the data table

Public Static Final INT DB_ER_NO_SUCH_TABLE = 1146; // Data table does not exist

Public Static Final INT DB_ER_NONEXISTING_TABLE_GRANT = 1147; // Unsave User's Access to Data Sheet

Public Static Final Int db_er_syntax_error = 1149; // SQL Statement Syntax Error PUBLIC Static Final Int DB_ER_NET_READ_ERROR = 1158; // Network error, read error, please check network connection status

Public Static Final Int db_er_net_read_interrupted = 1159; // Network error, read timeout, please check the network connection status

Public Static Final Int DB_ER_NET_ERROR_ON_WRITE = 1160; // Network error, write error, please check the network connection status

Public Static Final INT DB_ER_NET_WRITE_INTERRUPTED = 1161; // Network error, write timeout, please check the network connection status

Public Static Final INT DB_ER_DUP_ENTRY = 1062; // Field value repetition, invasive storage failed

Public Static Final INT DB_ER_DUP_UNIQUE = 1169; // field value repeat, update record failed

Public Static Final INT DB_ER_CHECK_NO_SUCH_TABLE = 1177; // Open data table failed

Public Static Final INT DB_ER_ERROR_DURING_COMMIT = 1180; // Submit a failure

Public Static Final INT DB_ER_ERROR_DURING_ROLLBACK = 1181; // Rollback transaction failed

Public Static Final INT DB_ER_TOO_MANY_USER_CONNATIONS = 1203; // The current user and database established connection The maximum number of connections that has arrived in the database, increase the number of database connections or restart the database

Public Static Final INT DB_ER_LOCK_WAIT_TIMEOUT = 1205; / / Parked timeout

Public Static Final INT DB_ER_NO_PERMISSION_TO_CREATE_USER = 1211; // The current user does not create permissions for users

Public Static Final Int DB_ER_NO_REFERENCED_ROW = 1216; // Foreign key constraint check failed, updated subtable record failed

Public Static Final INT DB_ER_ROW_IS_REFERENCED = 1217; // Foreign key constraint check failed, deleted or modified the main table record failed

Public Static Final INT DB_ER_USER_LIMIT_REACHED = 1226; // The current user uses resources that exceed the allowed resources, please restart the database or restart the server.

Public Static Final INT DB_ER_SPECIFIC_ACCESS_DENIED_ERROR = 1227; // If you have no right to do this

Public Static Final INT DB_ER_NOT_SUPPORTED_YET = 1235; // mysql version is too low, does not have this function

Private static final myrror [] errorMap =

{

NEW MYERROR (DB_ER_CANT_CREATE_TABLE, "Create Table Failed"),

New myerror (db_er_cant_create_db, "created database failed"),

NEW MYERROR (DB_ER_DB_CREATE_EXISTS, "Database Existent, Create Database Failed"), New MyError (DB_ER_DB_DROP_EXISTS, "Database does not exist, delete database failed",

New myerror (DB_ER_DB_DROP_DELETE, "You cannot delete database files to delete database failed"),

New myerror (DB_ER_DB_DROP_RMDIR, "You cannot delete the data directory caused deletion database failed"),

New myerror (DB_ER_CANT_DELETE_FILE, "Delete Database File Failure"),

NEW MYERROR (DB_ER_CANT_FIND_SYSTEM_REC, "You cannot read the record in the system table"),

New myerror (DB_ER_CHECKREAD, "Record has been modified by other users"),

New myerror (db_er_disk_full, "The remaining space remaining in the hard disk, please increase the spaceless space of the hard disk"),

New myerror (db_er_dup_key, "keyword repeat, change record failed",

New myerror (DB_ER_ERROR_ON_CLOSE, "errors when closed"),

NEW MYERROR (DB_ER_ERROR_ON_READ, "Read File Error"),

New myerror (DB_ER_ERROR_ON_RENAME, "changing the name when changing the name),

NEW MYERROR (DB_ER_ERROR_ON_WRITE, "Write File Error"),

New myerror (DB_ER_KEY_NOT_FOUND, "Record does not exist"),

New myerror (db_er_open_as_readonly, "data sheet is read-only, can't modify it"),

New myerror (DB_ER_OUTOFMEMORY, "System memory, please restart the database or restart server"),

NEW MYERROR (DB_ER_OUT_OF_SORTMEMORY, "Unsolicing memory, increase sort buffer"),

New myerror (DB_ER_CON_COUNT_ERROR, "" The maximum number of connections to the database is reached, please increase the number of connections available in the database "),

NEW MYERROR (DB_ER_OUT_OF_RESOURCES, "System Insufficient"),

NEW MYERROR (DB_ER_BAD_HOST_ERROR, "invalid host name",

NEW MYERROR (DB_ER_HANDSHAKE_ERROR, "Invalid Connection"),

NEW MYERROR (DB_ER_DBACCESS_DENIED_ERROR, "The current user does not have access to the database"),

NEW MYERROR (DB_ER_ACCESS_DENIED_ERROR, "Cannot connect to the database, username or password error"),

New myerror (db_er_bad_null_error, "Field can't be empty"),

New myerror (DB_ER_BAD_DB_ERROR, "Database does not exist"),

New myerror (DB_ER_TABLE_EXISTS_ERROR, "Data Table Exes"),

New myerror (DB_ER_BAD_TABLE_ERROR, "Data Table does not exist"),

NEW MYERROR (DB_ER_BAD_FIELD_ERROR, "Field does not exist"),

NEW MYERROR (DB_ER_EMPTY_QUERY, "Invalid SQL statement, SQL statement is empty"), new myerror (db_er_ipsock_error, "cannot establish a socket connection",

New myerror (db_er_record_file_full, "data sheet is full, no record"),

NEW MYERROR (DB_ER_TOO_MANY_TABLES, "Too many data sheets"),

NEW MYERROR (DB_ER_HOST_IS_BLOCKED, "Database Appear, Restart Database"),

NEW MYERROR (DB_ER_HOST_NOT_PRIVILEGED, "Connection Database Failed, No Permissions for Database"),

New myerror (db_er_password_no_match, "database user does not exist"),

NEW MYERROR (DB_ER_NONEXISTING_GRANT, "Current User No access to Database"),

NEW MYERROR (DB_ER_TABLEACCESS_DENIED_ERROR, "Current User No Access Data Sheet"),

NEW MYERROR (DB_ER_COLUMNACCESS_DENIED_ERROR, "" The current user does not have the right to access fields in the data table "),

New myerror (db_er_no_such_table, "data sheet does not exist"),

NEW MYERROR (DB_ER_NONEXISTING_TABLE_GRANT, "Access to Data Table", "

NEW MYERROR (DB_ER_SYNTAX_ERROR, "SQL Statement Syntax Error"),

NEW MYERROR (DB_ER_NET_READ_ERROR, "network error, read error, please check the network connection status"),

New myerror (db_er_net_read_interrupted, "network error, reading timeout, please check the network connection status),

NEW MYERROR (DB_ER_NET_ERROR_ON_WRITE, "network error, writing error, please check the network connection status"),

New myerror (db_er_net_write_interrupted, "network error, writing timeout, please check the network connection status),

NEW MYERROR (DB_ER_DUP_ENTRY, "Field Value Repeat, Fault Failed"),

NEW MYERROR (DB_ER_DUP_UNIQUE, "Field Value Repeat, Update Record Fails",

NEW MYERROR (DB_ER_CHECK_NO_SUCH_TABLE, "Open Data Failed"),

NEW MYERROR (DB_ER_ERROR_DURING_COMMIT, "Submit Failed"),

New myerror (db_er_error_during_rollback, "Rollback Transaction Failed"),

NEW MYERROR (DB_ER_TOO_MANY_USER_CONNECTIONS, "The current user and database established connection has arrived in the maximum number of connections to the database, please increase the number of database connections available or restart database"),

NEW MYERROR (DB_ER_LOCK_WAIT_TIMEOUT, "Plocking Timeout"),

New myerror (db_er_no_permission_to_create_user, "The current user does not create permissions"),

NEW MYERROR (DB_ER_NO_REFERENCED_ROW, "Foreign Key Constraint Failed, Update Table Record Failed"), New MyError (DB_ER_ROW_IS_REFERENCED, "Foreign key constraint check failed, deleted or modified the main table record failed"),

New myerror (db_er_user_limit_reat_reached, "The current user used by users has exceeded the allowed resources, please restart the database or restart the server"),

New myerror (db_er_specific_access_denied_error, "insufficient permissions, you have no right to do this"),

New myerror (db_er_not_supported_yet, "mysql version is too low, does not have this function"),

}

Public static string geterrorinfo (int errno)

{

For (int i = 0; i

{

IF (errno == errormap [i] .GeterrorNo ())

{

Return ErrorMap [I] .GeterrorDesc ();

}

}

""; "

}

Public String getErrorMessage (int ErrorCode)

{

String error = NULL;

For (int i = 0; i

{

IF (ErrorMap [i] .GeterrorNo () == ErrorCode)

{

Error = ErrorMap [i] .GeterrorNo () ":" ErrorMap [i] .GeterrorDesc ();

Break;

}

}

Return Error;

}

}

转载请注明原文地址:https://www.9cbs.com/read-130061.html

New Post(0)