MBS SQL plugin test

Hi all,

I test the MBS SQL plugin but this code returns a recordset NIL:

dim cle As String="test"

dim demande as String="SELECT name FROM test WHERE user= :log AND trash=0"

dim v as Variant = p_session.db.Prepare(demande)
dim prepSql as SQLPreparedStatementMBS = v

prepSql.BindType("log", SQLPreparedStatementMBS.kTypeString)
prepSql.Bind("log", cle)

dim rs As RecordSet=prepSql.SQLSelect

You know where is the error?

Thank you

Olivier

ErrorMessage not set?

You do use SQLDatabaseMBS class somewhere in that project?

Sorry, I had made an error in the path of the database. It’s works.

I made many tests to compare with the SQLITE engine included in Xojo, especially compared to the problems outlined here:

https://forum.xojo.com/29395-sqlite-with-wal-multiuser-mode-behavior-that-disappoints-me/p1#p241292

Unfortunately, the web app also freezes the same way (during the timeout of the second writing try). Even using Xojo threads.

Unless I use the SQLexecuteMT methods of the MBS plugin. Then the application is not frozen for the duration of the timeout. Congratulations Christian! This are preemptive threads?

For the DIFERRED TRANSACTION problem (no timeout), is ok with MBS plugin!

Ok, I’ve read a few articles on your blog, it actually seems preemptive threads. Impressive !

https://www.mbsplugins.de/archive/2009-12-27/Multithreading

Thanks.

In a Xojo thread, if I run for example:

  • SQLexecuteMT (“BEGIN IMMEDIATE TRANSACTION”)
  • SQLselectMT(“SELECT…”)
  • SQLexecuteMT(“UPDATE…”)
  • SQLselectMT(“SELECT…”)
  • SQLexecuteMT(“DELETE…”)
  • SQLexecuteMT(“SELECT…”)
  • SQLexecuteMT(“END TRANSACTION”)

All these operations will be launched in a single preemptive thread, or each operation will be launched in a different thread? In the latter case, SQLITE can not guarantee the atomicity of the transaction is not it?

the MT function returns when the thread is done and the query is also done.
Each MT call creates a thread.

And for the BEGIN/END calls you don’T need MT.

Please make sure you don’t run two commands the same time on two threads.

two commands on same database connection of course.
With two connections you can do two transactions independent.