PHP Class SDb

Inheritance: extends Db
Afficher le fichier Open project: hetao29/slightphp Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( string $table_name = "", $config = [] ) : void 构造方法
__get ( $k )
__set ( $k, $v )
del ( $foreign_info = false ) 删除信息,可以连带外键一起删除
get ( $foreign_info = false ) 得到信息,返回数组,可以用对像获取本身
getAll ( ) 得到带外键的信息
getConfig ( string $zone = null, string $type = "main" ) : array
listAll ( $condition, $foreign_info = false ) * 按条件获取所有信息
reset ( ) 重设所有参数
set ( ) 保存信息,支持外键属性保存 当外键属性保存时,特别注意: 你必须初始化外键的值,否则可能无效,如: $test->user_profile = new stdclass; $test->user_profile->field_name = "field_value";
setConfig ( string $zone, string $type = "main" ) : array 设置数据库配置文件
setConfigFile ( string $file ) : void set global db config file
setForeignKey ( $keys = [] ) 设置外键关联
setTable ( $table_name )
useConfig ( $zone, $type = "main" )

Method Details

__construct() public méthode

构造方法
public __construct ( string $table_name = "", $config = [] ) : void
$table_name string
Résultat void

__get() public méthode

public __get ( $k )

__set() public méthode

public __set ( $k, $v )

del() public méthode

删除信息,可以连带外键一起删除
public del ( $foreign_info = false )

get() public méthode

得到信息,返回数组,可以用对像获取本身
public get ( $foreign_info = false )

getAll() public méthode

得到带外键的信息
public getAll ( )

getConfig() static public méthode

static public getConfig ( string $zone = null, string $type = "main" ) : array
$zone string
$type string main|query
Résultat array

listAll() public méthode

* 按条件获取所有信息
public listAll ( $condition, $foreign_info = false )
$condition 条件,参照Db::select()里的定义
$foreign_info 是否返回外键信息

reset() public méthode

重设所有参数
public reset ( )

set() public méthode

保存信息,支持外键属性保存 当外键属性保存时,特别注意: 你必须初始化外键的值,否则可能无效,如: $test->user_profile = new stdclass; $test->user_profile->field_name = "field_value";
public set ( )

setConfig() public méthode

设置数据库配置文件
public setConfig ( string $zone, string $type = "main" ) : array
$zone string
$type string main|query
Résultat array

setConfigFile() static public méthode

set global db config file
static public setConfigFile ( string $file ) : void
$file string
Résultat void

setForeignKey() public méthode

设置外键关联
public setForeignKey ( $keys = [] )

setTable() public méthode

public setTable ( $table_name )

useConfig() public méthode

Deprecation: use setConfig
public useConfig ( $zone, $type = "main" )