Anomalous commit/rollback behavior
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Oleg Komarov
am 8 Aug. 2011
In the example you're using plain SELECT queries wich do not affect the content of a TABLE.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Database Toolbox finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!