On Wednesday, 19 October 2016 at 16:01:37 UTC, Alfred Newman wrote:
Hello,

I am trying to handle a SQLite3 table with D. During my researchs, I discovered the lib https://dlang.org/phobos/etc_c_sqlite3.html.

However, for any reason, there is no code snippets or sample codes available there. So, I am stucked.

etc.c.sqlite3 is just a C wrapper, take a look at C examples for sqlite3. The D docs don't usually include documentation for simple C wrappers.


If you want a proper D library for sqlite3, try d2sqlite3 from dub. IMO it's really easy to use and works really well.

Your example using d2sqlite3:

auto stmt = db.prepare("INSERT INTO COMPANY (ID, NAME, AGE, ADDRESS, SALARY) VALUES (:id, :name, :age, :address, :salary)");
stmt.inject(1, "Paul", 32, "California", 20000);
stmt.inject(2, "Allen", 25, "Texas", 15000);
stmt.inject(3, "Teddy", 23, "Norway", 20000);
stmt.inject(4, "Mark", 25, "Rich-Mond", 65000);
  • SQLite Alfred Newman via Digitalmars-d-learn
    • Re: SQLite bachmeier via Digitalmars-d-learn
    • Re: SQLite WebFreak001 via Digitalmars-d-learn
    • Re: SQLite Vadim Lopatin via Digitalmars-d-learn
      • Re: SQLite Alfred Newman via Digitalmars-d-learn

Reply via email to