Anomalous commit/rollback behavior

1 visualización (últimos 30 días)
David Goldsmith
David Goldsmith el 8 de Ag. de 2011
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 comentario
Oleg Komarov
Oleg Komarov el 8 de Ag. de 2011
In the example you're using plain SELECT queries wich do not affect the content of a TABLE.

Iniciar sesión para comentar.

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by