Jump to content

MySQL 1312 (Stored Procedure problem)


Jusonex

Recommended Posts

Posted

hey guys,

I've got a problem with MySQL Stored procedures.

First of all: my procedure:

CREATE PROCEDURE kickTenant(IN `houseID` smallint,IN `userID` bigint,IN `ownerID` bigint)BEGIN    SET @cc = 0;    SELECT count(*) INTO @cc FROM `house` WHERE `id` = houseID AND `owner` = ownerID;    IF @cc = 1 THEN        DELETE FROM `house_tenants` WHERE `ID` = houseID AND `tenant` = userID;        SELECT 1;    ELSE        SELECT 2;    END IF;END;

and the lua part:

  
local query = "CALL kickTenant("..houseID..", "..userID..", "..getPlayerUserID(client)..")" 
outputChatBox(tostring(query)) --outputs "CALL kickTenant(1, 1, 1)" (right) 
local result = mysql_query(handler, query) 

If I try this, 'result' will return nil and mysql_error()/mysql_errno() outputs

MySQL: 1312

MySQL: PROCEDURE mta-rp.buyHouse can't return a result set in the given context

But the strange thing is, that it work's perfect on my local (windows) computer, but not on the rootserver (Linux Debian x86) and if I try to execute this procedure via MySQL console (Navicat) on the rootserver, it works perfect, too.

Posted

a guy from IRC told me i should use the built-in MySQL functions.

strangly, the row wasn't deleted, but I got 1 ("SELECT 1") as a result.

It seems, that the "DELETE" query has been ignored. But why?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...