Anomalous commit/rollback behavior

1 次查看(过去 30 天)
Please observe:
K>> get(conn, 'AutoCommit') % AutoCommit is Off
ans =
off
K>> curs = fetch(exec(conn, ['select * from RawValue r inner join CalculatedValue c '... 'on r.RawValueID=c.RawValueID where r.RealTimeFlagsID=-9998 and '... 'not r.SiteID like ''ADM%'''])) % Matlab just added the queried data to the database; note that (a lot of) data is being returned
curs =
Attributes: []
Data: {5271x58 cell}
DatabaseObject: [1x1 database]
RowLimit: 0
SQLQuery: [1x141 char]
Message: []
Type: 'Database Cursor Object'
ResultSet: [1x1 sun.jdbc.odbc.JdbcOdbcResultSet]
Cursor: [1x1 com.mathworks.toolbox.database.sqlExec]
Statement: [1x1 sun.jdbc.odbc.JdbcOdbcStatement]
Fetch: [1x1 com.mathworks.toolbox.database.fetchTheData]
K>> commit(conn) % Now I (ostensibly) commit it
K>> curs = fetch(exec(conn, ['select * from RawValue r inner join CalculatedValue c '... 'on r.RawValueID=c.RawValueID where r.RealTimeFlagsID=-9998 and '... 'not r.SiteID like ''ADM%'''])) % Yup, it's still there! :)
curs =
Attributes: []
Data: {5271x58 cell}
DatabaseObject: [1x1 database]
RowLimit: 0
SQLQuery: [1x141 char]
Message: []
Type: 'Database Cursor Object'
ResultSet: [1x1 sun.jdbc.odbc.JdbcOdbcResultSet]
Cursor: [1x1 com.mathworks.toolbox.database.sqlExec]
Statement: [1x1 sun.jdbc.odbc.JdbcOdbcStatement]
Fetch: [1x1 com.mathworks.toolbox.database.fetchTheData]
K>> rollback(conn) % My understanding is that this should now have no effect
K>> curs = fetch(exec(conn, ['select * from RawValue r inner join CalculatedValue c '... 'on r.RawValueID=c.RawValueID where r.RealTimeFlagsID=-9998 and '... 'not r.SiteID like ''ADM%'''])) *% But wait, there's less! :(*
curs =
Attributes: []
Data: {'No Data'}
DatabaseObject: [1x1 database]
RowLimit: 0
SQLQuery: [1x141 char]
Message: []
Type: 'Database Cursor Object'
ResultSet: [1x1 sun.jdbc.odbc.JdbcOdbcResultSet]
Cursor: [1x1 com.mathworks.toolbox.database.sqlExec]
Statement: [1x1 sun.jdbc.odbc.JdbcOdbcStatement]
Fetch: [1x1 com.mathworks.toolbox.database.fetchTheData]
Can someone please explain this result to me?
Thanks!
  1 个评论
Oleg Komarov
Oleg Komarov 2011-8-8
In the example you're using plain SELECT queries wich do not affect the content of a TABLE.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Database Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by