Am Dienstag, den 16.02.2010, 11:52 +0100 schrieb Fernand Vanrie:
> So far i found a lot of things not working with Stored Procedures, but 
> finaly :-) i got a sort of workaround for a Stored Procedure on MySql 
> with parameters.
> 
> SUB TESTstoredprocedurecall
> oBaseContext = CreateUnoService("com.sun.star.sdb.DatabaseContext")
> oDB = oBaseContext.getByName("mysql_native")
> oCon = oDB.getConnection("user", "Password")
> oStatement = oCon.createStatement()
> sSQL1 = "call teststoredprocedure('Parm1', '¨Parm2')" ' must been pased 
> in right order
> ostatement.execute(sSQL1)' gives True
> oResultset1 = ostatement.getresultset
> oResultSet1.next
> print oResultset1.getstring(1)' confirmes the selection based on parameters
> ostatement.close ' must been done otherwise we ran in a 
> Exception:'sdbc.SQLExepetion "Commands out of sync, you can not run this 
> command now"
> 'after this exception you need to restart OO or dispose oDB
> ocon.close ' just to be sure everyting isclosed
> end sub
> 
>  this  Exception "Commands out of sync, you can not run this command 
> now" make the use of "PreparedStatements"  useless I will file a Issue 
> if this is realy a bug.

Very well done, Fernand!

> Hope this  is usefull information for who trye to use stored procedures

As soon as I need it I will do some tests.

Marc



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to