1.
CREATE DEFINER=`root`@`localhost` PROCEDURE `P_HoverTreePages`(
IN `TableName` VARCHAR(200),
IN `FieldList` VARCHAR(2000)
,
IN `PrimaryKey` VARCHAR(100),
IN `Where` VARCHAR(2000),
IN `Order` VARCHAR(1000),
IN `SortType` INT,
IN `RecorderCount` INT,
IN `PageSize` INT,
IN `PageIndex` INT,
OUT `TotalCount` INT,
OUT `TotalPageCount` INT )
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT 'fenye'
BEGIN set @sqlStr = CONCAT('select * from ',TableName,' order by ',PrimaryKey,' desc limit ?,?');
prepare sqlStr from @sqlStr ; set @hstart=PageSize*(PageIndex-1);
set @hsize=PageSize;
execute sqlStr using @hstart,@hsize; END
调用:
CALL `P_HoverTreePages`('t_hovertreenote', 'h', 'hid', 'h', 'h', '', '', '', '', @hh, @yy)