Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion inst/@octave_sqlite/commit.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

## -*- texinfo -*-
## @deftypefn {} {} commit (@var{db})
## Commit pending transactions of sqlite connection.
## Commit pending transactions of sqlite connection that has AutoCommit = off.
##
## @subsubheading Inputs
## @table @asis
Expand All @@ -29,6 +29,22 @@
## @subsubheading Outputs
## None
##
## @subsubheading Examples
## Create a database table turn off autocommit and insert a row and commit
## @example
## @code {
## # create sql connection
## db = sqlite("mytest.db");
## # create table
## execute(db, 'CREATE TABLE Test (Id INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT)');
## # turn off auto commit
## db.AutoCommit = "off";
## execute(db, 'INSERT INTO Test (Name) VALUES ("Line1")');
## # commit the insert
## commit(db);
## }
## @end example
##
## @seealso{sqlite, rollback}
## @end deftypefn

Expand Down
12 changes: 12 additions & 0 deletions inst/@octave_sqlite/execute.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@
## @subsubheading Inputs
## None
##
## @subsubheading Examples
## Create a database table and insert a row
## @example
## @code {
## # create sql connection
## db = sqlite("mytest.db");
## # create table and then insert a row
## execute(db, 'CREATE TABLE Test (Id INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT)');
## execute(db, 'INSERT INTO Test (Name) VALUES ("Line1")');
## }
## @end example
##
## @seealso{sqlite, fetch}
## @end deftypefn

Expand Down
19 changes: 19 additions & 0 deletions inst/@octave_sqlite/fetch.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,25 @@
## a table containing the query result.
## @end table
##
## @subsubheading Examples
## Select all rows of data from a database tables
## @example
## @code {
## # create sql connection
## db = sqlite("mytest.db");
## data = fetch(db, 'SELECT * FROM TestTable');
## }
## @end example
##
## Select 5 rows of data from a database tables
## @example
## @code {
## # create sql connection
## db = sqlite("mytest.db");
## data = fetch(db, 'SELECT * FROM TestTable', "MaxRows", 5);
## }
## @end example
##
## @seealso{sqlite, sqlread}
## @end deftypefn

Expand Down
16 changes: 16 additions & 0 deletions inst/@octave_sqlite/rollback.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@
## @subsubheading Outputs
## None
##
## @subsubheading Examples
## Create a database table and insert a row, then roll back the insert
## @example
## @code {
## # create sql connection
## db = sqlite("mytest.db");
## # create table
## execute(db, 'CREATE TABLE Test (Id INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT)');
## # turn off auto commit
## db.AutoCommit = "off";
## execute(db, 'INSERT INTO Test (Name) VALUES ("Line1")');
## # roll back the insert
## rollback(db);
## }
## @end example
##
## @seealso{sqlite, commit}
## @end deftypefn

Expand Down
19 changes: 19 additions & 0 deletions inst/@octave_sqlite/sqlread.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,25 @@
## a table containing the query result.
## @end table
##
## @subsubheading Examples
## Select all rows of data from a database table
## @example
## @code {
## # create sql connection
## db = sqlite("mytest.db");
## data = sqlread(db, 'TestTable');
## }
## @end example
##
## Select 5 rows of data from a database table
## @example
## @code {
## # create sql connection
## db = sqlite("mytest.db");
## data = sqlread(db, 'TestTable', "MaxRows", 5);
## }
## @end example
##
## @seealso{sqlite, fetch}
## @end deftypefn

Expand Down
13 changes: 13 additions & 0 deletions inst/@octave_sqlite/sqlwrite.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@
## @subsubheading Outputs
## None
##
## @subsubheading Examples
## Create a database table and insert a row
## @example
## @code {
## # create sql connection
## db = sqlite("mytest.db");
## # create table (if doesnt exist) and then insert 2 rows
## t = dbtable([1;2],['Name1';'Name2'], 'VariableNames', @{'Id','Name'@});
## # insert table data
## sqlwrite(db, "Test", t, 'ColumnType', @{'numeric', 'text'@});
## }
## @end example
##
## @seealso{sqlite, execute}
## @end deftypefn

Expand Down
27 changes: 27 additions & 0 deletions inst/dbtable.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,33 @@
## User data value
## @end table
## @end table
##
## @subsubheading Examples
## Directly create a 2 column table from input of each column
## @example
## @code {
## t = dbtable([0;1;3], [2;4;6]);
## }
## @end example
##
## Directly create a 2 column table from input of each column, and specify variable
## names
## @example
## @code {
## t = dbtable([0;1;3], [2;4;6], "VariableNames", @{'Variable1', 'Variable2'@});
## }
## @end example
##
## Create a 2 column table from 2 variables V1, V2
## @example
## @code {
## V1 = [0;1;3];
## V2 = [2;4;6];
## t = dbtable(V1, V2);
## }
## @end example
##
## @seealso{readdbtable, struct2dbtable}
## @end deftypefn

properties (Access = private)
Expand Down