手册 >> API参考 >> spLinker

spLinker

数据表的表间关联实现

数据表间关联是数据库操作常见的一种应用。sp框架提供了多种表间关联的功能支持,令开发者可以轻松应对各种数据表关联情况:一对一的关联一对多的关联多对多的关联

成员变量

public

private

成员函数

public

private

教程

数据表三种关联在SpeedPHP框架中的实现

数据表关联操作教程一,一对一关联

数据表关联操作教程二,一对多关联

数据表关联操作教程三,多对多关联

位置

spLinker类位于 SP_PATH/Core/spModel.php

详细

__input

函数式使用模型辅助类的输入函数。

object __input(args args)

__input() 是spController的模型辅助类在使用函数式方法时的标准输入接口。

__call

魔术函数,支持多重函数式使用类的方法

spLinker类中,__call执行了spModel继承类的相关操作,以及按关联的描述进行了对关联数据模型类的操作。

spLinker的使用均是通过spModel()->spLinker()->findAll()形式执行,所以开发者无需直接使用spLinker类中的成员函数。

prepare_result

准备执行结果

object prepare_result(records run_resultl)

参数:

prepare_delete

私有函数,辅助删除数据操作

records prepare_delete(string func_name, array func_args)

参数:

do_delete

私有函数,进行关联删除数据操作

bool do_delete( array thelinker, records maprecords )

参数:

do_update

私有函数,进行关联更新数据操作

bool do_update( array thelinker, array func_args )

参数:

do_create

私有函数,进行关联新增数据操作

bool do_create( array thelinker, int newid, array func_args )

参数:

do_select

私有函数,进行关联查找数据操作

records do_select( array thelinker, records run_result )

参数: