MYSQL connection string parameter parsing (explanation)

Forced to go to the MySQL database, I found that when reading the database, the values ​​of the tinyint type were converted to boolean, so the values ​​greater than 1 were lost and became true. There is no Boolean type in MySQL, which is stored as tinyint, which is fine, but it should not become boolean when reading back. There is no solution to the network search, and I am going to report a bug to the official. I think that the official should not have such a low-level error. First download the Connector/NET source code and study it. It is found that there is an attribute of TreatTinyAsBoolean. There are no results in Baidu search, and Google has a few English ones. It seems that no one has noticed this, or that .Net is rarely used to play MySQL.

So change the database connection string to this form and everything should work:
Database= dbname ;Data Source= 192.168.1.1 ;Port= 3306 ;User Id= root ;Password= **** ;Charset= utf8 ;TreatTinyAsBoolean= false ;

By the way, all the properties involved in the source code are listed:
Server, host, data source, datasource, address, addr, network address: database location (any of the above keywords can be)
Database, initial catalog: database name
Port: socket port, Default 3306
ConnectionProtocol, protocol: connection protocol, default Sockets
PipeName, pipe: connection pipeline, default MYSQL
UseCompression, compress: whether to compress the connection, default false
AllowBatch: whether to allow multiple SQL statements to be executed at one time, default true
Logging: whether to enable logging, default false
SharedMemoryName : The name of the memory share, default MYSQL
UseOldSyntax, old syntax, oldsyntax: Whether it is compatible with the old syntax, default false
ConnectionTimeout, connection timeout: connection timeout waiting time, default 15s
DefaultCommandTimeout, command timeout: MySqlCommand timeout, default 30s
UserID, uid, username, user name, user: database login account
Password, pwd: login password
PersistSecurityInfo: whether to keep sensitive information, default false
Encrypt: has been replaced with SSL, default false
CertificateFile: certificate file (.pfx) format
CertificatePassword: certificate password
CertificateStoreLocation : Where the certificate is stored
CertificateThumbprint : The certificate thumbprint
AllowZeroDateTime: Whether the date and time can be zero, the default is false
ConvertZeroDateTime: Whether the zero date and time are converted into DateTime.MinValue, the default is false
UseUsageAdvisor, usage advisor: Whether to enable the assistant will affect the database performance, the default is false
ProcedureCacheSize, procedure cache, procedurecache: Several stored procedures can be cached at the same time, 0 is forbidden, the default is 25
UsePerformanceMonitor, userperfmon, perfmon: whether to enable performance monitoring, the default is false
IgnorePrepare: whether to ignore the Prepare() call, the default is true
UseProcedureBodies, procedure bodies: whether to check the stored procedure body, Validity of parameters, default true
AutoEnlist: Whether to automatically use active connections, default true
RespectBinaryFlags: Whether to respond to binary flags of metadata on columns, default true
TreatTinyAsBoolean: Whether to treat TINYINT(1) columns as boolean, default true
AllowUserVariables: Whether to allow user variables in SQL, the default is false
InteractiveSession, interactive: whether the session allows interaction, the default is false
FunctionsReturnString: whether all server functions are processed according to the return string, the default is false
UseAffectedRows: Whether to use the number of affected rows to replace the number of rows found to return data, default false
OldGuids: Whether to use binary(16) column as Guids, default false
Keepalive: Number of seconds to keep the TCP connection, default 0, not keep.
ConnectionLifeTime: The minimum time (in seconds) that the connection will remain in the connection pool before it is destroyed. Default 0
Pooling: Whether to use the thread pool, default true
MinimumPoolSize, min pool size: The minimum number of threads allowed in the thread pool, the default 0
MaximumPoolSize, max pool size: The maximum number of threads allowed in the thread pool, the default 100
ConnectionReset: After the connection expires Whether to reset automatically, the default is false
CharacterSet, charset: The character set used to request the connection to the server, the default: no
TreatBlobsAsUTF8: Whether binary blobs are treated as utf8, the default is false
BlobAsUTF8IncludePattern: The matching pattern of the column, once matched, it will be processed as utf8, default: No
SslMode: Whether to enable SSL connection mode, default: MySqlSslMode.None

Article source: http://home.3233567.cn/space.php?uid=182&do=blog&id=159

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324836985&siteId=291194637