Run an execution block (SQL Server) on Doctrine + ZF2

Asked

Viewed 155 times

1

I need to run an SQL (SQL SERVER) execution block on a Repository in Doctrine. My environment is with ZF2 + Doctrine 2. I’ve read some things about ResultSetMappingin Doctrine, but I couldn’t.

Code:

public function teste() {
        $connection = $this->_em->getConnection();
        $sql = "DECLARE @Test AS dbo.DataTempTransactions;
                INSERT INTO @Test VALUES ('015.004.000',100,'015A')
                DECLARE @DATE datetime
                SET @DATE = GETDATE()
                EXEC ONCode.dbo.TmSp_Exit @Test, @mnfdate = @DATE
                SELECT * FROM ONTest.dbo.OBTN";
        $stmt = $connection->prepare($sql);

        return $stmt->execute();
}

I am using in the block of an execution a Type defined by the user - dbo.DataTempTransactions - (Use Table-Valued Parameters (Database Engine)), I don’t know if it influences anything.

Thanks in advance.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.