1
0
mirror of https://e.coding.net/circlecloud/McAccount.git synced 2025-09-05 07:27:21 +00:00

fix MySQL error and fix message.php...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092
2015-10-14 21:07:36 +08:00
parent af6a38d957
commit ec7a26a582
3 changed files with 36 additions and 37 deletions

View File

@ -24,10 +24,10 @@ class Amysql {
}
static public function filter(&$array, $function) {
if (! is_array ( $array ))
Return $array = $function ( $array );
return $array = $function ( $array );
foreach ( $array as $key => $value )
(is_array ( $value ) && $array [$key] = Amysql::filter ( $value, $function )) || $array [$key] = $function ( $value );
Return $array;
return $array;
}
}
@ -165,7 +165,7 @@ class AmysqlController {
if (! isset ( $this->AmysqlClass [$ClassName] )) // 不存在类对象
$this->AmysqlClass [$ClassName] = new $ClassName ();
Return $this->AmysqlClass [$ClassName];
return $this->AmysqlClass [$ClassName];
}
Amysql::AmysqlNotice ( $file . ' 类文件不存在' );
@ -195,7 +195,7 @@ class AmysqlController {
$this->DB->DBConnect ( $this->DBConfig ); // 没连接就进行数据库连接
$this->AmysqlModel [$ModelTag]->MysqlConnect = $this->DB->DBS [$ModelTag]; // 模型使用的数据库连接
}
Return $this->AmysqlModel [$ModelTag];
return $this->AmysqlModel [$ModelTag];
}
Amysql::AmysqlNotice ( $file . ' 模型文件不存在' );
@ -211,7 +211,7 @@ class AmysqlController {
$file = str_replace ( _PathTag, DIRECTORY_SEPARATOR, $file );
$file = _View . $file . '.php';
if (is_file ( $file ))
Return file_get_contents ( $file );
return file_get_contents ( $file );
Amysql::AmysqlNotice ( $file . ' 数据文件不存在' );
}
@ -272,7 +272,7 @@ class AmysqlTemplates {
$file = str_replace ( _PathTag, DIRECTORY_SEPARATOR, $file );
$file = _View . $file . '.php';
if (is_file ( $file ))
Return include ($file);
return include ($file);
Amysql::AmysqlNotice ( $file . ' 模板文件不存在' );
}
@ -306,17 +306,17 @@ class AmysqlModel {
public function _query($sql) {
global $Config;
if (! $this->MysqlConnect)
Return false;
return false;
$this->QueryStatus = '(0)';
$this->Affected = 0;
if ($Config ['DebugSql'])
$this->SqlBug .= "\n" . '<!--DebugSql: ' . $sql . '-->' . "\n";
$result = mysql_query ( $sql, $this->MysqlConnect );
if (! $result)
Return false;
return false;
$this->Affected = mysql_affected_rows ();
$this->QueryStatus = '(ok)';
Return $result;
return $result;
}
/**
@ -329,7 +329,7 @@ class AmysqlModel {
public function _insert($table, $data) {
$this->InsertId = 0;
if (! is_array ( $data ) || count ( $data ) == 0)
Return 0;
return 0;
$field_arr = array ();
foreach ( $data as $key => $val )
@ -338,7 +338,7 @@ class AmysqlModel {
$sql = "INSERT INTO `$table` SET " . implode ( ',', $field_arr );
$this->_query ( $sql );
$this->InsertId = mysql_insert_id ();
Return $this->InsertId;
return $this->InsertId;
}
/**
@ -353,7 +353,7 @@ class AmysqlModel {
public function _update($table, $data, $where = '') {
$this->Affected = 0;
if (! is_array ( $data ) || count ( $data ) == 0)
Return 0;
return 0;
$field_arr = array ();
foreach ( $data as $key => $val )
@ -361,7 +361,7 @@ class AmysqlModel {
$sql = "UPDATE `$table` SET " . implode ( ',', $field_arr ) . $where;
$this->_query ( $sql );
Return $this->Affected;
return $this->Affected;
}
/**
@ -374,11 +374,11 @@ class AmysqlModel {
public function _row($sql, $result_type = MYSQL_ASSOC) {
$result = $this->_query ( $sql );
if (! $result)
Return false;
return false;
$row = mysql_fetch_array ( $result, $result_type );
$this->ResultSum = 1;
$this->_free ( $result );
Return $row;
return $row;
}
/**
@ -391,7 +391,7 @@ class AmysqlModel {
public function _all($sql, $result_type = MYSQL_ASSOC) {
$result = $this->_query ( $sql );
if (! $result)
Return false;
return false;
$data = array ();
$this->ResultSum = 0;
while ( $row = mysql_fetch_array ( $result, $result_type ) ) {
@ -399,7 +399,7 @@ class AmysqlModel {
++ $this->ResultSum;
}
$this->_free ( $result );
Return $data;
return $data;
}
/**
@ -411,8 +411,8 @@ class AmysqlModel {
public function _sum($sql) {
$result = $this->_query ( $sql );
if (! $result)
Return false;
Return mysql_num_rows ( $result );
return false;
return mysql_num_rows ( $result );
}
/**
@ -421,7 +421,7 @@ class AmysqlModel {
* @param Object $rs
*/
public function _free($rs) {
Return mysql_free_result ( $rs );
return mysql_free_result ( $rs );
}
}