MySql连接字符串

MySql连接字符串,第1张

The port 3306 is the default MySql port.

The value is ignored if Unix socket is used.

Use this to connect to a server in a replicated server configuration without concern on which server to use.

Use SSL if the server supports it, but allow connection in all cases

This option is available from Connector/NET version 6.2.1

Always use SSL. Deny connection if server does not support SSL.

This option is available from Connector/NET version 6.2.1

This option is available from Connector/NET version 6.2.1

This option is available from Connector/NET version 6.2.1

This option is available from Connector/NET version 6.2.1

This option is available from Connector/NET version 5.2.2

Returns a MySqlDateTime object for invalid values and a System.DateTime object for valid values

Returns System.DateTime.MinValue valued System.DateTime object for invalid values and a System.DateTime object for valid values.

The use of auto enlist transactionscope (default behaviour) could cause trouble in medium trust environments.

Default behaviour is that parameters for stored routines (stored procedures) are checked against the server

Some permissions and value casting related errors reported fixed when using this connection option.

The default behaviour is to read tables mysql.proc/INFORMATION_SCHEMA.ROUTINES and try to map provided command parameter values to the called procedures parameters and type cast values accordingly.

This can be troublesome if permissions to the (aforementioned) sproc info tables are insufficient.

The driver will not automatically map the parameters so you must manually set parameter types and you must also make sure to add the parameters to the command object in the exact order as appeared in the procedure definition.

This option is available from Connector/NET version 5.0.4

Specifying DefaultTableCacheAge is optional, default value is 60 seconds.

This option is available from Connector/NET version 6.4

This option is available from Connector/NET version 5.2.6

From version 6.2 idle connections are removed from the pool, freeing resources on the client (sockets) and the server (sockets and threads). Do not manually keep (global) connections and open close. Keep connection object creation and disposal as tight as possible, this might be counterintuitive but pooling mechanisms will take care of caching well and your code will be cleaner.

This is the default behaviour.

Default values are 0 and 100.

Makes an additional round trip to the server when obtaining a connection from the pool and connection state will be reset.

This is useful in load balancing scenarios when available servers change you don't want 100 constant connections in the pool pointing to only one server.

Specified in seconds, the amount of time after connection object creation the connection will be destroyed. Destruction will only happen when connections are returned to pool.

A connection might be long lived in the pool, however the connections server settings are updated (SHOW VARIABLES command) each time returned to the pool. This makes the client use of the connection object up to date with the correct server settings. However this causes a round trip and to optimize pooling performance this behaviour can be turned off.

This option is available from Connector/NET version 6.3

This option is available from Connector/NET version 6.4.4

The Windows Native Authentication Plugin must be installed for this to work.

Number of seconds between each keep-alive package send.

This option is available from Connector/NET version 6.1.1

The default is 25, meaning that stored procedure meta data (such as input/output data types etc) for the latest 25 called procedures will be cached in client memory.

This option is available from Connector/NET version 5.0.2

This enables Visual Studio wizards that bracket symbols with [] to work with Connector/Net. This option incurs a performance hit, so should only be used if necessary.

This option is available from Connector/NET version 6.3.1

Use this one to specify a default command timeout for the connection. Please note that the property in the connection string does not supercede the individual command timeout property on an individual command object.

This option is available from Connector/NET version 5.1.4.

Use this one to specify the length in seconds to wait for a server connection before terminating the attempt and receive an error.

Use this one to instruct the provider to ignore any command prepare statements and prevent corruption issues with server side prepared statements.

The option was added in Connector/NET version 5.0.3 and Connector/NET version 1.0.9.

Use this one to specify which network protocol to use for the connection.

"socket" is the default value used if the key isn't specified. Value "tcp" is an equivalent for "socket".

Use "pipe" to use a named pipes connection, "unix" for a Unix socket connection and "memory" to use MySQL shared memory.

It's possible to explicit set the shared memory object name used for communication.

It's possible to explicit set the pipe name used for communication, if not set, 'mysql' is the default value.

It is the port value of -1 that tells the driver to use named pipes network protocol. This is available on Windows only. The value is ignored if Unix socket is used.

It's possible to explicit set the shared memory object name used for communication.

Use this one to specify which character set to use to encode queries sent to the server.

Note! Use lower case value utf8 and not upper case UTF8 as this will fail.

Note that resultsets still are returned in the character set of the data returned.

mysql如何实现多行查询结果合并成一行,mysql如何实现多行查询结果合并成一行网站简介信息

利用函数:group_concat(),实现一个ID对应多个名称时,原本为多行数据,把名称合并成一行。

其完整语法:

GROUP_CONCAT(expr)

该函数返回带有来自一个组的连接的非NULL值的字符串结果。其完整的语法如下所示:

GROUP_CONCAT([DISTINCT] expr [,expr ...]

[ORDER BY {unsigned_integer | col_name | expr}

[ASC | DESC] [,col_name ...]]

[SEPARATOR str_val])

mysql>SELECT student_name,

->GROUP_CONCAT(test_score)

->FROM student

->GROUP BY student_name

Or:

mysql>SELECT student_name,

->GROUP_CONCAT(DISTINCT test_score

->ORDER BY test_score DESC SEPARATOR ' ')

->FROM student

->GROUP BY student_name

在MySQL中,你可以获取表达式组合的连接值。你可以使用DISTINCT删去重复值。假若你希望多结果值进行排序,则应该使用 ORDER BY子句。若要按相反顺序排列,将 DESC (递减) 关键词添加到你要用ORDER BY 子句进行排序的列名称中。默认顺序为升序;可使用ASC将其明确指定。 SEPARATOR 后面跟随应该被插入结果的值中间的字符串值。默认为逗号 (‘,')。通过指定SEPARATOR '' ,你可以删除所有分隔符。

使用group_concat_max_len系统变量,你可以设置允许的最大长度。 程序中进行这项 *** 作的语法如下,其中 val 是一个无符号整数:

SET [SESSION | GLOBAL] group_concat_max_len = val

GROUP_CONCAT(expr)完整句法如下: GROUP_CONCAT([DISTINCT] expr [,expr ...][ORDER BY {unsigned_integer | col_name | formula} [ASC | DESC] [,col ...]][SEPARATOR str_val])这个函数在 MySQL 4.1 中被加入。函数返回一个字符串结果,该结果由分组中的值连接组合而成: mysql>SELECT student_name,->GROUP_CONCAT(test_score)->FROM student->GROUP BY student_nameormysql>SELECT student_name,->GROUP_CONCAT(DISTINCT test_score->ORDER BY test_score DESC SEPARATOR " ")->FROM student->GROUP BY student_name在MySQL 中,你可以得到表达式结合体的连结值。通过使用 DISTINCT 可以排除重复值。如果希望对结果中的值进行排序,可以使用 ORDER BY 子句。为了以倒序排序,可以在 ORDER BY 子句中用于排序的列名后添加一个 DESC (递减 descending) 关键词。缺省为升序;这也可以通过使用 ASC 关键词明确指定。SEPARATOR 是一个字符串值,它被用于插入到结果值中。缺省为一个逗号 (",")。你可以通过指定 SEPARATOR "" 完全地移除这个分隔符。在你的配置中,通过变量 group_concat_max_len 要以设置一个最大的长度。在运行时执行的句法如下: SET [SESSION | GLOBAL] group_concat_max_len = unsigned_integer如果最大长度被设置,结果值被剪切到这个最大长度。GROUP_CONCAT() 函数是一个增强的 Sybase SQL Anywhere 支持的基本 LIST() 函数。如果只有一个列,并且没有其它选项被指定,GROUP_CONCAT() 是向后兼容有极大限制的 LIST() 函数。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/6096383.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-14
下一篇 2023-03-14

发表评论

登录后才能评论

评论列表(0条)

保存