日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql strtolower_GitHub - redfoxli/mysqlstr: a php extension provide string processing of mysql

發布時間:2024/9/19 数据库 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql strtolower_GitHub - redfoxli/mysqlstr: a php extension provide string processing of mysql 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

mysqlstr

Introduction

a php extension provide string processing of mysql

(strtolower && strtoupper base utf8)

把mysql里的字符串處理函數封裝成php擴展,供php使用

目前只提供了utf8下的大寫轉小寫以及小寫轉大寫這兩個功能

Why need this php ext

the result of strtolower(strtoupper) is different between php and mysql

efficiency

寫這個擴展的目的有兩個,一個是php的大小寫轉換函數和mysql的有一些區別,另外一個是性能問題

##Installation

$ /path/to/phpize

$ ./configure --with-php-config=/path/to/php-config

$ make

$ make install

add extension=mysqlstr.so in php.ini

Interface

strtoupper_utf8_ext

strtoupper_utf8_ext - make a utf8 string uppercase

Description

string strtoupper_utf8_ext(string str)

strtolower_utf8_ext

strtolower_utf8_ext - make a utf8 string lowercase

Description

string strtolower_utf8_ext(string str)

Example

case

$str = "High School D×DⅡ ";

$timeMB = microtime(true);

$resMb = mb_strtolower( $str, "UTF-8");

$timeMB = microtime(true) - $timeMB;

$timeSQL = microtime(true);

$resSQL = strtolower_utf8_ext($str);

$timeSQL = microtime(true) - $timeSQL;

echo "mbTime:" . sprintf("%.5f",$timeMB)." \n";

echo "sqlTime:" . sprintf("%.5f",$timeSQL)."\n";

echo "mbRes:" . $resMb . "\n";

echo "sqlRes:" . $resSQL . "\n";

result

mbTime:0.00004

sqlTime:0.00001

mbRes:high school d×dⅡ

sqlRes:high school d×dⅱ

efficiency case

$str = "High School D×DⅡ ";

$timeMB = microtime(true);

for($i=0;$i<30000;$i++)

$resMb = mb_strtolower( $str, "UTF-8");

$timeMB = microtime(true) - $timeMB;

$timeSQL = microtime(true);

for($i=0;$i<30000;$i++)

$resSQL = strtolower_utf8_ext($str);

$timeSQL = microtime(true) - $timeSQL;

echo "mbTime: " . sprintf("%.5f",$timeMB)." \n";

echo "sqlTime: " . sprintf("%.5f",$timeSQL)."\n";

result:

mbTime: 0.18481

sqlTime: 0.01055

More

String processing of mysql base mysql-5.1.74

More related analysis base Chinese is here

總結

以上是生活随笔為你收集整理的mysql strtolower_GitHub - redfoxli/mysqlstr: a php extension provide string processing of mysql的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。