<?php
/*
SQLyog
Copyright 2003-2011, Webyog
http://www.webyog.com
HTTP Tunneling Page
This page exposes the MySQL API as a set of web-services which is consumed by SQLyog - the most popular GUI to MySQL.
This page allows SQLyog to manage MySQL even if the MySQL port is blocked or remote access to MySQL is not allowed.
*/
/*Wrapper Functions for PHP-MYSQL and PHP-MYSQLI*/
function yog_mysql_connect ($host, $port, $username, $password, $db_name="")
{
$username = utf8_decode($username);
$ret=0;
switch (DB_EXTENSION)
{
case "mysql":
if($port != 0){
//TCP-IP
$ret = mysql_connect ($host.':'.$port, $username, $password);
}
else{
//UDS. Here 'host' is the socket path
$ret = mysql_connect ($host, $username, $password);
}
if (strlen ($db_name)!=0){
mysql_select_db("$db_name");
}
break;
case "mysqli":
$port=(int)$port;
if($port != 0){
//TCP-IP
$GLOBALS["___mysqli_ston"] = mysqli_connect($host, $username, $password,$db_name, $port);
}
else{
//UDS. Here 'host' is the socket path
$GLOBALS["___mysqli_ston"] = mysqli_connect(null, $username, $password,$db_name, 0, $host);
}
$ret=$GLOBALS["___mysqli_ston"];
break;
}
return $ret;
}
function yog_mysql_field_type ( $result, $offset )
{
//Get the type of the specified field in a result
$ret=0;
switch (DB_EXTENSION)
{
case "mysql":
$ret = mysql_field_type ( $result, $offset );
break;
case "mysqli":
$tmp=mysqli_fetch_field_direct ( $result, $offset);
$ret = GetCorrectDataTypeMySQLI($tmp->type);
break;
}
return $ret;
}
function yog_mysql_field_len ( $result, $offset )
{
//Returns the length of the specified field
$ret=0;
switch (DB_EXTENSION)
{
case "mysql":
$ret = mysql_field_len ($result,$offset );
break;
case "mysqli":
$tmp=mysqli_fetch_field_direct ( $result, $offset);
$ret = $tmp->length;
break;
}
return $ret;
}
function yog_mysql_field_flags ($result, $offset)
{
//Get the flags associated with the specified field in a result
$ret=0;
switch (DB_EXTENSION)
{
case "mysql":
$ret = mysql_field_flags ($result,$offset);
break;
case "mysqli":
$___mysqli_obj = (mysqli_fetch_field_direct($result, $offset));
$___mysqli_tmp = $___mysqli_obj->flags;
$ret=($___mysqli_tmp? (string)(substr((($___mysqli_tmp & MYSQLI_NOT_NULL_FLAG) ? "not_null " : "") . (($___mysqli_tmp & MYSQLI_PRI_KEY_FLAG) ? "primary_key " : "") . (($___mysqli_tmp & MYSQLI_UNIQUE_KEY_FLAG) ? "unique_key " : "") . (($___mysqli_tmp & MYSQLI_MULTIPLE_KEY_FLAG) ? "unique_key " : "") . (($___mysqli_tmp & MYSQLI_BLOB_FLAG) ? "blob " : "") . (($___mysqli_tmp & MYSQLI_UNSIGNED_FLAG) ? "unsigned " : "") . (($___mysqli_tmp & MYSQLI_ZEROFILL_FLAG) ? "zerofill " : "") . (($___mysqli_tmp & 128) ? "binary " : "") . (($___mysqli_tmp & 256) ? "enum " : "") . (($___mysqli_tmp & MYSQLI_AUTO_INCREMENT_FLAG) ? "auto_increment " : "") . (($___mysqli_tmp & MYSQLI_TIMESTAMP_FLAG) ? "timestamp " : "") . (($___mysqli_tmp & MYSQLI_SET_FLAG) ? "set " : ""), 0, -1)) : false);
break;
}
return $ret;
}
function yog_mysql_get_server_info ($db_link)
{
//Get MySQL server info
$ret=0;
switch (DB_EXTENSION)
{
case "mysql":
$ret = mysql_get_server_info ($db_link);
break;
case "mysqli":
$ret = mysqli_get_server_info ($db_link);
break;
}
return $ret;
}
function yog_mysql_affected_rows ( $db_link )
{
//Get number of affected rows in previous MySQL operation
$ret=0;
switch (DB_EXTENSION)
{
case "mysql":
$ret = mysql_affected_rows($db_link);
break;
case "mysqli":
$ret = mysqli_affected_rows($db_link);
break;
}
return $ret;
}
function yog_mysql_insert_id ( $db_link )
{
//Get the ID generated from the previous INSERT operation
$ret=0;
switch (DB_EXTENSION)
{
case "mysql":
$ret = mysql_insert_id($db_link);
break;
case "mysqli":
$ret = mysqli_insert_id($db_link);
break;
}
return $ret;
}
function yog_mysql_query ( $query, $db_link )
{
//Send a MySQL query
$ret=array();
switch (DB_EXTENSION)
{
case "mysql":
$result = mysql_query ($query, $db_link);
/**********************/
if (yog_mysql_errno($db_link)!=0) {
$temp_ar= array("result"=>-1, "ar"=>mysql_affected_rows($db_link));
array_push($ret, $temp_ar);
}
elseif ($result===FALSE) {
$temp_ar= array("result"=>1, "ar"=>mysql_affected_rows($db_link));
array_push($ret, $temp_ar);
}
else {
$temp_ar= array("result"=>$result, "ar"=>mysql_affected_rows($db_link));
array_push($ret, $temp_ar);
}
/**********************/
break;
case "mysqli":
$ret = get_array_from_query($query, $db_link);
break;
}
return $ret;
}
function get_array_from_query($query, $db_link)
{
$ret=array();
$bool = mysqli_real_query ( $db_link, $query )or yog_mysql_error($db_link);
if (yog_mysql_errno($db_link)!=0) {
$temp_ar= array("result"=>-1, "ar"=>0);
array_push($ret, $temp_ar);
}
elseif ($bool) {
do {
/* store first result set */
$result = mysqli_store_result($db_link);
$num_ar= mysqli_affected_rows($db_link);
if ($result===FALSE && yog_mysql_errno($db_link)!=0) {
$temp_ar= array("result"=>-1, "ar"=>$num_ar);
array_push($ret, $temp_ar);
break;
}
elseif ($result===FALSE) {
$temp_ar= array("result"=>1, "ar"=>$num_ar);
array_push($ret, $temp_ar);
}
else {
$temp_ar= array("result"=>$result, "ar"=>$num_ar);
array_push($ret, $temp_ar);
}
} while (mysqli_next_result($db_link));
if (yog_mysql_errno($db_link)!=0) {
$temp_ar= array("result"=>-1, "ar"=>$num_ar);
array_push($ret, $temp_ar);
}
}
return $ret;
}
function yog_mysql_errno($db_link)
{
//Returns the numerical value of the error message from previous MySQL operation
$ret=0;
switch (DB_EXTENSION)
{
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
MySQL tools - 副本.zip (43个子文件)
MySQL tools - 副本
htmlayout.dll 897KB
SJA.exe 2.63MB
L10n.db 816KB
SQLyog.exe 8.6MB
SQLyog.dll 3.2MB
uninst.exe 80KB
SQLyogTunnel.php 45KB
plink.exe 487KB
SciLexer.dll 757KB
SQLYog
htmlayout.dll 897KB
SJA.exe 2.63MB
L10n.db 816KB
SQLyog.exe 8.6MB
SQLyog.dll 3.2MB
uninst.exe 80KB
SQLyogTunnel.php 45KB
plink.exe 487KB
SciLexer.dll 757KB
SQLyog.lnk 1KB
SQLyog.chm 11.55MB
SJASchemas
odbcimport-dsnless.xml 600B
exportjobs-alldbs.xml 1KB
odbcimport-general.xml 6KB
notification.xml 886B
exportjob-alltables.xml 1KB
datasync-alltables.xml 635B
odbcimport-withwhere.xml 6KB
odbcimport-withtrigger.xml 6KB
datasync-seltables.xml 1KB
exportjob-seltables.xml 1KB
Keywords.db 114KB
SQLyog.chm 11.55MB
SJASchemas
odbcimport-dsnless.xml 600B
exportjobs-alldbs.xml 1KB
odbcimport-general.xml 6KB
notification.xml 886B
exportjob-alltables.xml 1KB
datasync-alltables.xml 635B
odbcimport-withwhere.xml 6KB
odbcimport-withtrigger.xml 6KB
datasync-seltables.xml 1KB
exportjob-seltables.xml 1KB
Keywords.db 114KB
共 43 条
- 1
资源评论
等等兔儿爷
- 粉丝: 2
- 资源: 13
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功