TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Implementing SQL PREPARE for sqlite

1 pointsby mingodadover 9 years ago
Hello !<p>I was thinking for a long time that sqlite3 and fossil are nice projects but lacking a central repository that anyone can clone and try to extend&#x2F;hack then and share with others like github makes cooperation harder than it need be. I saw several times people mention on mailing lists that they have some extensions&#x2F;modifications to sqlite and offering it to ones that ask for.<p>Then I found this https:&#x2F;&#x2F;github.com&#x2F;mackyle&#x2F;sqlite that follow https:&#x2F;&#x2F;www.sqlite.org with less than a day lag, would be nice if the sqlite author create and maintained a mirror on github to centralize third part works&#x2F;contributions, there was a section on sqlite&#x2F;wiki for contributors but it was closed long ago.<p>So here is my fork on github with the intention to implement &quot;SQL PREPARE&quot; following the postgresql implementation http:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;9.5&#x2F;static&#x2F;sql-prepare.html it has a simple public user facing interface &quot;PREPARE&#x2F;EXECUTE&#x2F;DEALLOCATE&quot;, I followed the actual implementations of virtual tables and triggers to get the parser and dummy functions to be called by the parser, so far it seems to accept and parse something like this:<p>PREPARE astmt(id integer, name text) AS select 1 as id, &#x27;dad&#x27; as name;<p>EXECUTE astmt(1, &#x27;blue&#x27;);<p>DEALLOCATE astmt;<p>Now I need to implement the empty functions to actually make it do the real work.<p>I&#x27;m asking and inviting anyone interested to help implement this with the same license as sqlite.<p>Here is the links to my fork, go there fork it and let&#x27;s share the implementation of it.<p>https:&#x2F;&#x2F;github.com&#x2F;mingodad&#x2F;sqlite&#x2F;tree&#x2F;sql-prepared<p>https:&#x2F;&#x2F;github.com&#x2F;mingodad&#x2F;sqlite&#x2F;commit&#x2F;3b53199a9d853f98946ffa6ea665fc7357fc4be7<p>I chose this as the first attempt because it has interesting characteristics it will open the road for a kind of stored procedure because we can pass arbitrary parameters to then and also they should return zero or more rows with varying columns.<p>Cheers !

no comments

no comments