Skip to content

Commit f6fd519

Browse files
committed
Updated example.
1 parent 306a48d commit f6fd519

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ The following SQL schema will be created by the example:
4949
```sql
5050
CREATE TABLE example_table (
5151
id INTEGER PRIMARY KEY,
52-
string VARCHAR(32),
52+
string TEXT,
5353
value INTEGER
5454
);
5555
```
5656

57-
The program opens a database `example.db`, creates the table `example_table`,
57+
The program opens a database `example.sqlite`, creates the table `example_table`,
5858
inserts some values, then reads them back in, and prints them to console.
5959

6060
The module `sqlite_util` contains C interoperability functions/interfaces to
@@ -73,17 +73,17 @@ program example
7373
type(c_ptr) :: stmt
7474
7575
! Open SQLite database.
76-
rc = sqlite3_open('example.db', db)
76+
rc = sqlite3_open('example.sqlite', db)
7777
7878
! Create table.
7979
rc = sqlite3_exec(db, "CREATE TABLE example_table (" // &
8080
"id INTEGER PRIMARY KEY," // &
81-
"string VARCHAR(32)," // &
81+
"string TEXT," // &
8282
"value INTEGER)", c_null_ptr, c_null_ptr, errmsg)
8383
if (rc /= SQLITE_OK) print '("sqlite3_exec(): ", a)', errmsg
8484
8585
! Create a prepared statement.
86-
rc = sqlite3_prepare(db, "INSERT INTO example_table(string, value) VALUES(?, ?)", stmt)
86+
rc = sqlite3_prepare_v2(db, "INSERT INTO example_table(string, value) VALUES(?, ?)", stmt)
8787
8888
! Bind the values to the statement.
8989
rc = sqlite3_bind_text(stmt, 1, 'one')
@@ -130,7 +130,7 @@ contains
130130
write (*, '(a12)', advance='no') sqlite3_column_text(stmt, i)
131131
132132
case default
133-
write (*, '(" unsupported")', advance='no')
133+
write (*, '(" not implemented")', advance='no')
134134
end select
135135
end do
136136
@@ -149,7 +149,7 @@ $ ./example
149149

150150
## fpm
151151
You can add *fortran-sqlite3* as an [fpm](https://github.com/fortran-lang/fpm)
152-
dependency:
152+
dependency to your `fpm.toml`:
153153

154154
```toml
155155
[dependencies]

0 commit comments

Comments
 (0)