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
2011년 8월 8일
In the example you're using plain SELECT queries wich do not affect the content of a TABLE.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Database Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!