dlang-community / d2sqlite3

A small wrapper around SQLite for the D programming language
Boost Software License 1.0
75 stars 26 forks source link

Prepare many statements from a single string. #59

Open cyisfor opened 4 years ago

cyisfor commented 4 years ago

sqlite3_prepare_v2 provides a tail parameter, and I figured out the trick with it a while ago. It sets tail to the point that it stops being able to parse, which is helpful for showing where your error is in your SQL statement, but it's also helpful for parsing multiple SQL statements. sqlite3_prepare only prepares the first, then "fails" at the beginning of the second statement right after the semicolon, which lets one prepare many statements from a single string. So that's what I did. Hope you like it!

Geod24 commented 4 years ago

It looks like a lot could be simplified and built purely on top of the existing Statement primitive. Also you should squash the commits.