C# mysql¶ÁÈ¡Àà
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MySql.Data.Types;
using MySql.Data.MySqlClient;
/// <summary>
/// C#²Ù×÷mysql»ùÀà
/// </summary>
public class MySqlobj
{
private MySqlConnection conn;
private MySqlCommand com;
private bool _alreadyDispose = false;
#region ¹¹ÔìÓëèØ¹¹
public MySqlobj()
{
try
{
conn = new MySqlConnection(ConfigurationManager.AppSettings["mysqlconn"]);
conn.Open();
com = new MySqlCommand();
com.Connection = conn;
}
catch (Exception ee)
{
throw new Exception("Á¬½ÓÊý¾Ý¿â³ö´í");
}
}
~MySqlobj()
{
Dispose();
}
protected virtual void Dispose(bool isDisposing)
{
if (_alreadyDispose) return;
if (isDisposing)
{
// TODO: ´Ë´¦ÊÍ·ÅÊÜ¿Ø×ÊÔ´
if (com != null)
{
com.Dispose();
}
if (conn != null)
{
try
{
conn.Close();
conn.Dispose();
}
catch (Exception ee)
{
}
finally
{
conn = null;
}
}
}
// TODO: ´Ë´¦ÊÍ·Å·ÇÊÜ¿Ø×ÊÔ´¡£ÉèÖñ»´¦Àí¹ý±ê¼Ç
_alreadyDispose = true;
}
#endregion
#region IDisposable ³ÉÔ±
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
#endregion
#region »ñÈ¡DataSet
public DataSet GetDataSet(string sqlString)
{
DataSet ds = new DataSet();
try
Ïà¹ØÎĵµ£º
ʱ¼ä£º2009-03-12 12:38:24 À´Ô´£ºLinuxÁªÃË
×÷Õߣº
À´Ô´£ºit168.com
×÷ÕߣºÌïÒÝ(sery@163.com)
Ë×»°Ëµ£º¹¤ÓûÉÆÆäÊ£¬±ØÏÈÀûÆäÆ÷.Òª×öºÃϵͳ¹ÜÀí,ʹ×Ô¼ºµÄ¹¤×÷¸üÇáËɸüÓÐЧµÄ»°£¬Ò»¸öºÃµÄ¼à¿Ø¹¤¾ßÊDZز»¿ÉÉÙµÄÁË¡£ÔÚÕâÀïÎÒÏò ......
ÓÐÁ½ÖÖ·½·¨¡£
·½·¨Ò»£ºÔÚmysql>Ìáʾ·ûÖÐʹÓÃtee
mysql> tee output.txt
Logging to file 'output.txt'
mysql> notee
Outfile disabled.
»òÕß
mysql> \T output.txt
Logging to file 'output.txt'
mysql> \t
Outfile disabled.
Õâ¸öÀàËÆÓÚsqlplusµÄspool¹¦ÄÜ£¬¿ÉÒÔ½«ÃüÁîÐÐÖеĽá¹û±£´æµ½Í ......
Ò»´ÎNginx+PHP+MysqlµÄ²¢·¢²âÊÔ¾Àú
Ò»¡¢Ó²¼þ»·¾³
CPU:4ºËIntel(R) Xeon(R) CPU E5504 @ 2.00GHz
6GÄڴ棬120GÓ²ÅÌ
¶þ¡¢Èí¼þ»·¾³
L ......
Ê×ÏÈ·ÖÎöÂÒÂëµÄÇé¿ö
1.дÈëÊý¾Ý¿âʱ×÷ΪÂÒÂëдÈë
2.²éѯ½á¹ûÒÔÂÒÂë·µ»Ø
¾¿¾¹ÔÚ·¢ÉúÂÒÂëʱÊÇÄÄÒ»ÖÖÇé¿öÄØ£¿
ÎÒÃÇÏÈÔÚmysql ÃüÁîÐÐÏÂÊäÈë
show variables like '%char%';
²é¿´mysql ×Ö·û¼¯ÉèÖÃÇé¿ö:
mysql> show variables like '%char%';
+--------------------------+---------------------------------------- ......