I'm trying to use the adodbapi module, but run into the following
problem:

After initalization (connection, cursor) I have the following call to
a stored procedure (SQL Server, using SQLOLEDB.1 provider).

m = u'BrReg'
rs = u''
msg = u''
x = self.cur.callproc('__DocFetchBaseCategories', (0, 0, m, rs, msg))
print x
>>> [0, 0, u'BrReg', u'', u'']
print self.cur.returnValue
>>> None
print self.cur.rowcount
>>> -1

The procedure is enclosed below.  Strange thing is that if the
variable 'm' is set to an empty string, everything works ok, the
resultstate value (x[3]) becomes '_OK'.  However having the variable
'm' set to 'BrReg' as indicated, seems to result in the returned set
(x) not being updated.  When executing the Stored Procedure in Query
Analyzer, everything seems to be ok (BrReg is a valid value and
results in both '_OK' resultstate and a set of values (record set)).

When using the value m='', the returnValue when printed is 0.

---------------------------- FRAGMENT OF SQL CODE --------------------
create proc __DocFetchBaseCategories (
        @TraceLevel int, 
        @UserId int,
        @Module varchar(32),
        @Resultstate varchar(121) output,
        @Message varchar(255) output
) as
begin
        if @Module <> ''
        begin
                select 10000,
                        C.Category,
                        C.BaseCategory,
                        C.CategoryDescription
                from _DerivedCategories D, _Categories C
                where D.Category like (@Module + '[_]%')
                        and not D.BaseCategory like (@Module + '[_]%')
                        and D.DerivedLevel = 1
                        and D.Category = C.Category
        end
        else
        begin
                select 10000,
                        Category,
                        BaseCategory,
                        CategoryDescription
                from _Categories
                where BaseCategory = ''
        end

        select @ResultState = '_OK',
                @Message = ''

NormalExit:

end

--------------------------------------------------------------------------------------------
The connection object reports 0 ADOerrors when I use the method
printADOerrors on the connection object.

Any help is appreciated.


Nikolai Kirsebom


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to