http://www.yces.chc.edu.tw/LifeType/post/1/118
如果有興趣要修改最新的 phpMyAdmin 能支援 Big5,可以參考以下的資料。
許多網頁介紹
使用 ContvertZ 轉換 chinese_traditional-utf-8.inc.php 成 chinese_traditional-big5.inc.php ,第一行改 $charset = 'big5';
vi libraries\select_lang.lib.php
$GLOBALS['mysql_charset_map'] = array(
'big5' => 'big5', //改為 latin1
'utf-8' => 'utf-8', //改為 latin1
但是程式裡面都沒有使用到 $GLOBALS['mysql_charset_map']
而且,SET CHARACTER SET 'utf8'; 已經固定寫死,參考以下程式碼
libraries\database_interface.lib.php
#852
if (! empty($GLOBALS['collation_connection'])) {
PMA_DBI_query("SET CHARACTER SET 'utf8';", $link, PMA_DBI_QUERY_STORE);
$mysql_charset = explode('_', $GLOBALS['collation_connection']);
PMA_DBI_query("SET collation_connection = '" . PMA_sqlAddslashes($GLOBALS['collation_connection']) . "';", $link, PMA_DBI_QUERY_STORE);
} else {
PMA_DBI_query("SET NAMES 'utf8' COLLATE 'utf8_general_ci';", $link, PMA_DBI_QUERY_STORE);
}
參考 2.x 版更改以上程式碼
$mysql_charset = $GLOBALS['mysql_charset_map'][$GLOBALS['charset']];
if (! empty($GLOBALS['collation_connection'])) {
PMA_DBI_query('SET CHARACTER SET ' . $mysql_charset . ';', $link, PMA_DBI_QUERY_STORE);
PMA_DBI_query("SET collation_connection = '" . PMA_sqlAddslashes($GLOBALS['collation_connection']) . "';", $link, PMA_DBI_QUERY_STORE);
} else {
PMA_DBI_query("SET NAMES '" . $mysql_charset . "' COLLATE 'utf8_general_ci';", $link, PMA_DBI_QUERY_STORE);
}
大功告成
以下是檢視 2 種版本 MySQL 連線差異
// VER 2.X
090506 9:16:01 1 Connect root@localhost on
1 Query SELECT VERSION()
1 Query SET NAMES latin1
1 Query SET collation_connection = 'utf8_unicode_ci'
1 Query SET CHARACTER SET latin1
1 Query SET collation_connection = 'utf8_unicode_ci'
1 Query SHOW SESSION VARIABLES LIKE 'collation_connection'
1 Query SHOW SESSION VARIABLES LIKE 'character_set_connection'
1 Query SHOW CHARACTER SET
1 Query SHOW COLLATION
1 Quit
2 Connect root@localhost on
2 Query SELECT VERSION()
2 Query SET NAMES latin1
2 Query SET collation_connection = 'utf8_unicode_ci'
2 Query SET CHARACTER SET latin1
2 Query SET collation_connection = 'utf8_unicode_ci'
2 Query SHOW SESSION VARIABLES LIKE 'collation_connection'
2 Query SHOW SESSION VARIABLES LIKE 'character_set_connection'
2 Query SHOW CHARACTER SET
2 Query SHOW COLLATION
2 Query SHOW DATABASES
2 Query SHOW TABLES FROM `information_schema`
2 Query SHOW TABLES FROM `mysql`
2 Query SHOW TABLES FROM `test`
2 Quit
090506 9:16:02 3 Connect root@localhost on
3 Query SELECT VERSION()
3 Query SET NAMES latin1
3 Query SET collation_connection = 'utf8_unicode_ci'
3 Query SET CHARACTER SET latin1
3 Query SET collation_connection = 'utf8_unicode_ci'
3 Query SHOW SESSION VARIABLES LIKE 'collation_connection'
3 Query SHOW SESSION VARIABLES LIKE 'character_set_connection'
3 Query SHOW CHARACTER SET
3 Query SHOW COLLATION
3 Query SELECT COUNT(*) FROM mysql.user
3 Query SELECT COUNT(*) FROM mysql.user
3 Query SHOW GRANTS
3 Query SELECT COUNT(*) FROM mysql.user
3 Query SELECT USER()
3 Query SHOW MASTER LOGS
3 Quit
//ver 3.x
090506 9:16:50 4 Connect root@localhost on
4 Query SET CHARACTER SET 'utf8'
4 Query SET collation_connection = 'utf8_unicode_ci'
4 Quit
5 Connect root@localhost on
5 Query SET CHARACTER SET 'utf8'
5 Query SET collation_connection = 'utf8_unicode_ci'
5 Query SHOW DATABASES
5 Query SHOW TABLES FROM `information_schema`
5 Query SHOW TABLES FROM `mysql`
5 Query SHOW TABLES FROM `test`
5 Quit
090506 9:16:51 6 Connect root@localhost on
6 Query SET CHARACTER SET 'utf8'
6 Query SET collation_connection = 'utf8_unicode_ci'
6 Init DB mysql
6 Query SHOW MASTER LOGS
6 Query SELECT USER()
6 Quit
[ 發表回應 ] ( 10預覽 ) | 常註連結 | ( 2.9 / 1777 )
香港高級政府人員減薪的決定,完全沒有考慮各方面負面的連鎖反應。
表面上,香港高級政府人員願意減薪,看起來很偉大。
但他們每月都是那些花不完工資系列的打工皇帝,減一點薪對他們來說算什麼。
而且,每月才省50多萬元。可是他們換來的是聲譽。全都是為了自己,不理會其它人的感受。
政府高管帶頭減薪,反而對很差的經濟帶來負面影響。
但其它人怎樣算?
全香港這幾年,沒什麼人有加薪。不減薪已經很好了。高管帶頭,老板又可以找借口減薪了。
公司有困難,員工幫忙一下,問題不大。但就我的公司老板而言,在過去十年裡,金融風暴、沙士期間,業職不斷增長,老板不但不加薪,總是利用經濟環境不好來凍薪,到經濟好的時候就說今年沒錢賺。
其實,我要說的就是,全世界都知道現在的環境不好,沒什麼好消息。政府不但沒有提高香港的繁榮和勁爭力作出供獻,反而雪上加霜,制造更多的負面消息。
總是滿足那些未考慮大環境的不滿素求,而去做一些笨事情。
只覺得現在全都是一些低能政府及低能議員。
未來,香港感到沒有希望了。沒有勁爭力。香港完全失去了正確方向。
議員只懂說什麼普選,懂什麼是經濟再說。
成功普選但沒有飯開,普來有什麼用。
[ 發表回應 ] ( 12預覽 ) | 常註連結 | ( 3 / 1537 )
Create this procedure in the required database and here is how you run it:
--To search all columns of all tables in Pubs database for the keyword "Computer"
EXEC SearchAllTables 'Computer'
GO
Here is the complete stored procedure code:
CREATE PROC SearchAllTables
(
@SearchStr nvarchar(100)
)
AS
BEGIN
-- Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved.
-- Purpose: To search all columns of all tables for a given search string
-- Written by: Narayana Vyas Kondreddi
-- Site: http://vyaskn.tripod.com
-- Tested on: SQL Server 7.0 and SQL Server 2000
-- Date modified: 28th July 2002 22:50 GMT
CREATE TABLE #Results (ColumnName nvarchar(370), ColumnValue nvarchar(3630))
SET NOCOUNT ON
DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)
SET @TableName = ''
SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')
WHILE @TableName IS NOT NULL
BEGIN
SET @ColumnName = ''
SET @TableName =
(
SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME))
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
AND QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) > @TableName
AND OBJECTPROPERTY(
OBJECT_ID(
QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)
), 'IsMSShipped'
) = 0
)
WHILE (@TableName IS NOT NULL) AND (@ColumnName IS NOT NULL)
BEGIN
SET @ColumnName =
(
SELECT MIN(QUOTENAME(COLUMN_NAME))
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = PARSENAME(@TableName, 2)
AND TABLE_NAME = PARSENAME(@TableName, 1)
AND DATA_TYPE IN ('char', 'varchar', 'nchar', 'nvarchar')
AND QUOTENAME(COLUMN_NAME) > @ColumnName
)
IF @ColumnName IS NOT NULL
BEGIN
INSERT INTO #Results
EXEC
(
'SELECT ''' + @TableName + '.' + @ColumnName + ''', LEFT(' + @ColumnName + ', 3630)
FROM ' + @TableName + ' (NOLOCK) ' +
' WHERE ' + @ColumnName + ' LIKE ' + @SearchStr2
)
END
END
END
SELECT ColumnName, ColumnValue FROM #Results
END
[ 發表回應 ] ( 13預覽 ) | 常註連結 | ( 3 / 1546 )
Create this procedure in the required database and here is how call it:
--To replace all occurences of 'America' with 'USA':
EXEC SearchAndReplace 'America', 'USA'
GO
Here is the complete stored procedure code:
(Note: If you only want to search, but not replace, try this procedure instead: How to search all columns of all tables in a database for a keyword?)
CREATE PROC SearchAndReplace
(
@SearchStr nvarchar(100),
@ReplaceStr nvarchar(100)
)
AS
BEGIN
-- Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved.
-- Purpose: To search all columns of all tables for a given search string and replace it with another string
-- Written by: Narayana Vyas Kondreddi
-- Site: http://vyaskn.tripod.com
-- Tested on: SQL Server 7.0 and SQL Server 2000
-- Date modified: 2nd November 2002 13:50 GMT
SET NOCOUNT ON
DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110), @SQL nvarchar(4000), @RCTR int
SET @TableName = ''
SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')
SET @RCTR = 0
WHILE @TableName IS NOT NULL
BEGIN
SET @ColumnName = ''
SET @TableName =
(
SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME))
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
AND QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) > @TableName
AND OBJECTPROPERTY(
OBJECT_ID(
QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)
), 'IsMSShipped'
) = 0
)
WHILE (@TableName IS NOT NULL) AND (@ColumnName IS NOT NULL)
BEGIN
SET @ColumnName =
(
SELECT MIN(QUOTENAME(COLUMN_NAME))
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = PARSENAME(@TableName, 2)
AND TABLE_NAME = PARSENAME(@TableName, 1)
AND DATA_TYPE IN ('char', 'varchar', 'nchar', 'nvarchar')
AND QUOTENAME(COLUMN_NAME) > @ColumnName
)
IF @ColumnName IS NOT NULL
BEGIN
SET @SQL= 'UPDATE ' + @TableName +
' SET ' + @ColumnName
+ ' = REPLACE(' + @ColumnName + ', '
+ QUOTENAME(@SearchStr, '''') + ', ' + QUOTENAME(@ReplaceStr, '''') +
') WHERE ' + @ColumnName + ' LIKE ' + @SearchStr2
EXEC (@SQL)
SET @RCTR = @RCTR + @@ROWCOUNT
END
END
END
SELECT 'Replaced ' + CAST(@RCTR AS varchar) + ' occurence(s)' AS 'Outcome'
END
[ 發表回應 ] ( 13預覽 ) | 常註連結 | ( 3 / 1549 )
To reset the netsupport Video driver
"c:\program files\NetSupport Manager\WINSTALL.EXE" /R"c:\program files\NetSupport Manager" /Q
[ 發表回應 ] ( 14預覽 ) | 常註連結 | ( 3 / 1480 )