Closed alaviss closed 4 years ago
Huh? That optimization is important. I thought about populating a proc prepareStatement(ctx)
and to expose the state rather than relying on globals. This way threading would be simpler.
As a stop-gap measure, I'm switching to using a global + once
to keep the optimization, while making sure that the statements won't be prepared before a db connection is established.
I thought about populating a proc
prepareStatement(ctx)
and to expose the state rather than relying on globals. This way threading would be simpler.
Quoting discussion on IRC:
16:49:08 \<leorize> Araq: so what should I do about Araq/ormin#40? 16:50:41 \<leorize> having a ctx sounds fine to me, but how would it match with the current semantics? 16:51:07 \<Araq> not sure but the state must be exposed somehow 16:51:25 \<Araq> this design problem keeps Ormin from reaching v1 IMO 16:52:08 \<Araq> maybe the only good solution is setContext() 16:55:12 \<leorize> how would that work? 16:55:58 \<leorize> or are you planning to make queries an imported module instead of being included? 16:57:18 \<leorize> if it's included then we can just have a ctx global and a init() proc that should run before any queries are made
This prevents ormin from running
prepareStmt
before the db is opened.Fixes #21