function sqlite_exceptions
clear all
close all
clc
dummy = mksqlite('version mex');
fprintf( '\n\n' );
commands = { ...
'mksqlite(''open'',''filenotfound.db'', ''ro'');', ...
'mksqlite(''open'','''');', ...
'mksqlite(''select column_doesnt_exist'');', ...
'mksqlite(''syntax error'');', ...
'mksqlite( -10, ''open'', '''' );', ...
'mksqlite( ''open'', '''' );', ...
};
for i = 1:numel( commands )
if i == numel( commands )
fprintf( '\nNext error will not be catched and thus terminates this script:' );
end
fprintf( '\nCalling %s\n', commands{i} );
try
eval( commands{i} );
fprintf( 'succeeded\n' );
catch ex
switch ex.identifier
case 'MKSQLITE:ANY'
fprintf( 'mksqlite omitted an error: "%s"\n', ex.message );
case 'SQLITE:ERROR'
fprintf( 'SQLite syntax error: "%s"\n', ex.message );
otherwise
C = regexp( ex.identifier, ':', 'split' );
if numel(C) == 2 && strcmpi( C{1}, 'SQLITE' )
switch( C{2} )
case {'AUTH', 'CANTOPEN' }
fprintf( 'SQLite error while open database: "%s"\n', ex.message );
otherwise
fprintf( 'Any other SQLite error: "%s"\n', ex.message );
end
else
rethrow(ex);
end
end
end
end
mksqlite Version 2.5 build: 133, ein MATLAB Interface zu SQLite
(c) 2008-2017 by Martin Kortmann <mail@kortmann.de>
Andreas Martin <andimartin@users.sourceforge.net>
basierend auf SQLite Version 3.16.2 - http://www.sqlite.org
mksqlite verwendet:
- DEELX perl kompatible regex engine Version 1.3 (Sswater@gmail.com)
- BLOSC/LZ4 1.3.0-rc3.dev zur Datenkompression (Francesc Alted / Yann Collett)
- MD5 Message-Digest Algorithm (RFC 1321) Implementierung von Alexander Peslyak
Platform: PCWIN64, little endian
Calling mksqlite('open','filenotfound.db', 'ro');
SQLite error while open database: "unable to open database file"
Calling mksqlite('open','');
succeeded
Calling mksqlite('select column_doesnt_exist');
SQLite syntax error: "no such column: column_doesnt_exist"
Calling mksqlite('syntax error');
SQLite syntax error: "near "syntax": syntax error"
Calling mksqlite( -10, 'open', '' );
mksqlite omitted an error: "ungueltiger Datenbankhandle"
Next error will not be catched and thus terminates this script:
Calling mksqlite( 'open', '' );
succeeded