Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¶à·þÎñÆ÷¹²Ïísession(mysql)

<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */
//===========================================
// ³ÌÐò£º mysql-Based Session Class
// ¹¦ÄÜ£º »ùÓÚmysql´æ´¢µÄ Session ¹¦ÄÜÀà
// ×÷Õß: yejr
// ÍøÕ¾: http://imysql.cn
// ʱ¼ä: 2007-01-05
//===========================================

/**
* ˈ̞: MySQL Session Class
* ¹¦ÄÜ: ×ÔÖ÷ʵÏÖ»ùÓÚMySQL HEAP±í´æ´¢µÄ Session ¹¦ÄÜ
* ÃèÊö: Õâ¸öÀà¾ÍÊÇʵÏÖSessionµÄ¹¦ÄÜ£¬»ù±¾ÉÏÊÇͨ¹ýÉèÖÿͻ§¶ËµÄCookieÀ´±£´æSessionID£¬
* È»ºó°ÑÓû§µÄÊý¾Ý±£´æÔÚ·þÎñÆ÷¶Ë£¬×îºóͨ¹ýCookieÖеÄSession IdÀ´È·¶¨Ò»¸öÊý¾ÝÊÇ·ñÊÇÓû§µÄ£¬
* È»ºó½øÐÐÏàÓ¦µÄÊý¾Ý²Ù×÷
*
* ×¢Òâ: ±¾Ààµ÷ÓÃÁËPEAR::DBÀà,Èç¹ûÓÐ×Ô¼ºµÄDBÀà,Ôò¿ÉÒÔÉÔ΢ÐÞ¸ÄһϴúÂë
*
* ±¸×¢£ºÊý¾Ý±í³õʼ»¯SQLÓï¾ä:
* CREATE TABLE `sessions` (
* `sid` varchar(32) NOT NULL default '',
* `session` longtext,
* `flush_dt` int unsigned NOT NULL default '0',
* PRIMARY KEY (`sid`),
* KEY `last` (`flush_dt`)
* ) ENGINE=HEAP;
*/

//É趨 SESSION ÓÐЧʱ¼ä£¬µ¥Î»ÊÇ Ãë
define('SESS_LIFTTIME', 3600);
define('DB_DSN', 'mysql://root:@localhost/test');
define('DB_NAME','test');

require_once('DB.php');

$gDb = new DB;
$gDb = DB::connect(DB_DSN, TRUE);

if (PEAR::isError($gDb))
{
die($gDb->getMessage());
}

if (!defined('MySQLSession'))
{
define('MySQLSession', TRUE);

class Usess
{
static $mSessSavePath;
static $mSessName;
static $mSessMaxTime;
static $mTblSess = 'sessions';
static $mTblSessMap;
static $mDb;

// {{{ ³õʼ»¯¹¹Ô캯Êý
/**
* ¹¹Ô캯Êý
*
* @param string $login_user µÇ¼Óû§
* @param int $login_type Óû§ÀàÐÍ
* @param string $login_sess µÇ¼SessionÖµ
* @return Esession


Ïà¹ØÎĵµ£º

MySQLÓÅ»¯

µØÖ·£º http://imysql.cn/taxonomy/term/1?page=1
[InnoDBϵÁÐ] -- innodb±íÈçºÎ¸ü¿ìµÃµ½count(*)½á¹û£ºhttp://imysql.cn/2008_06_24_speedup_innodb_count
[InnoDBϵÁÐϵÁÐ] -- ´óÊý¾ÝÁ¿µÄµ¼³öµ¼Èë·½·¨±È½Ï£º
http://imysql.cn/2007_10_15_large_innodb_table_export_import
[MySQLÓÅ»¯°¸Àý]ϵÁÐ -- DISABLE/ENABLE K ......

mysql alter Óï¾äÓ÷¨,Ìí¼Ó¡¢Ð޸ġ¢É¾³ý×ֶεÈ


//Ö÷¼ü
alter table tabelname add new_field_id int(5) unsigned default 0 not null auto_increment ,add primary key (new_field_id);
//Ôö¼ÓÒ»¸öÐÂÁÐ
alter table t2 add d timestamp;
alter table infos add ex tinyint not null default '0';
//ɾ³ýÁÐ
alter table t2 drop column c;
//ÖØÃüÃûÁÐ
......

MySQLÓëÊÂÎñ


MySQL5.X¶¼ÒѾ­·¢²¼ºÃ¾ÃÁË£¬µ«ÊÇ»¹ÓкܶàÈËÈÏΪMySQLÊDz»Ö§³ÖÊÂÎñ´¦ÀíµÄ£¬Õâ²»µÃ²»¹ÖËûÃÇÊǹª¹ÑÎŵ쬯äʵ£¬Ö»ÒªÄãµÄMySQL°æ±¾
Ö§³ÖBDB»òInnoDB±íÀàÐÍ£¬ÄÇôÄãµÄMySQL¾Í¾ßÓÐÊÂÎñ´¦ÀíµÄÄÜÁ¦¡£ÕâÀïÃæ£¬ÓÖÒÔInnoDB±íÀàÐÍÓõÄ×î¶à£¬ËäÈ»ºóÀ´·¢ÉúÁËÖîÈçOracleÊÕ
¹ºInnoDBµÈÁîMySQL²»Ë¬µÄÊÂÇ飬µ«ÄÇЩÉÌÒµÉϵĶ·ÕùÓë¼¼ÊõÎÞ¹ ......

¾­µäµÄMYSQLÓï¾ä

·Ç³£³£Óõģº¾­µäµÄMYSQLÓï¾ä…… php¿ªÔ´
ÕâÕæÊÇÒ»¸öºÃ¶«Î÷£ºÑ§Ï°ºÃÁ˺ÜÊÜÓõÄŶ……
SQL·ÖÀࣺ
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(Create£¬Alter£¬Drop£¬DECLARE)
DML—Êý¾Ý²Ù×ÝÓïÑÔ(Select£¬Delete£¬Update£¬Insert)
DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)php¿ªÔ´
Ê×ÏÈ,¼òÒ ......

C#Á¬½ÓMySQL½øÐвÙ×÷µÄ·½·¨

ÓÉÓÚÐèҪʵÏÖÒÔϹ¦ÄÜ£º
Íø¹ØÍ¨¹ý´®¿Ú·¢ËÍÊý¾Ý¸øPC»ú£¬PC»úÊÕ¼¯Êý¾Ý²¢½âÎö±£´æµ½MySQLÖУ¬È»ºóJSPÒ³Ãæ¶ÁÈ¡MySQLÖеÄÊý¾Ý²¢ÏÔʾ¡£
ËùÒÔÀûÓÃC#Á¬½ÓMySQLÊý¾Ý³ÉΪÁ˱ØÐëÒª¾­¹ýµÄ¹ý³Ì£¬Ôڴ˸øÓèÏêϸµÄ˵Ã÷¡£
1¡¢ÏÂÔØÐèÒªµÄÎļþMySQLDriverCS£¬ÏÂÔØµØÖ·Îª£ºhttp://sourceforge.net/projects/mysqldrivercs
2¡¢°²×°Îļþ£ºMySQ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ