Skip to content

Conversation

Indribell
Copy link

As people can have no background in Ruby or Crystal, the following example will be more familiar to them coming from languages like PHP/...

See also Issue #32

@RX14
Copy link
Member

RX14 commented Jan 16, 2019

I think it'd be better to replace the other example, it's not a very good first impression.

@Indribell
Copy link
Author

I think it'd be better to replace the other example, it's not a very good first impression.

In that case it will require replacing the examples on the Sqlite, PostgreSQL and Mysql pages because all 3 drivers use the almost exact same example.

db = DB.open "sqlite3://./data.db"
db.exec "CREATE TABLE IF NOT EXISTS contacts (name text, age integer)"
db.exec "INSERT INTO contacts VALUES (?, ?)", "John Doe", 30
contacts = db.query_all "SELECT name, age FROM contacts", as: {name: String, age: Int64}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we close the db connection sometime?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants