最奇怪的事情刚刚发生:
这是我用 PhpMyAdmin MySql 界面编写的 SP:
Begin
/* event id and number of event's albums*/
Declare eventId varchar(20);
/*Declare numberOfAlbums int default 0; */
/* get event id */
Set eventId = decodeEventCode(eventCode);
If (eventKey Is Not Null And eventKey <> '' And getEventKey(eventId,facebookId) = eventKey) Then
/* get number of albums */
/*Set numberOfAlbums = (Select Count(eventId) From Albums Where Event_Id = eventId);*/
/* return active album */
Select Users.Facebook_Id, Users.Facebook_Access_Token, Users.Facebook_Expires, getUserTime(facebookId) As User_Local_Time, Events.Name as Event_Name, Events.Place As Event_Place, Events.Start_Time, Events.End_Time, Albums.Album_Id, Albums.Number_Of_Pictures/*, numberOfAlbums As Album_Count*/
From Albums
Inner Join Events
On Events.Event_Id = Albums.Event_Id
Inner Join Users
On Users.Facebook_Id = Events.Facebook_Id
Where Albums.Event_Id = eventId
Order By Albums.Number_Of_Pictures
Limit 1;
/* if no rows was found return 0*/
If (Found_Rows() = 0) Then
select 0 as status;
End If;
Else
Select 0 as status;
End If;
End
这就是使用 PhpMyAdmin 中的“执行”按钮的结果的样子。注意接口生成的查询:
这是我复制/粘贴的确切查询,并在 PhpMyAdmin SQL 查询界面中使用以对其进行测试 - 它没有选择任何表示未找到表的内容:
这是我从我的 php 代码中调用的:
/**
* Get the current active event album with all his details
* @param $eventCode string the event code of the event
* @param $eventKey string the user's special event key
* @param $facebookId string user's facebook id
* @return array the details of the active album
*/
function getEventActiveAlbum($eventCode,$eventKey,$facebookId)
{
return $this->queryDb("Call getEventActiveAlbum('$eventCode','$eventKey','$facebookId')");
}
生成查询:
Call getEventActiveAlbum('10230910','42','613714903')
知道为什么会这样吗?从 PHP 代码运行脚本时,我什么也得不到……