function sqlite_test_big_int ()
clear all
close all
clc
dummy = mksqlite('version mex');
fprintf( '\n\n' );
format long
mksqlite( 'open', '' );
mksqlite( 'CREATE TABLE bigint (x INT)' );
for i = 1:2
if i == 1
fprintf( 'Small value as bigint\n' );
value_orig = uint8( hex2dec( ['CC'; 'CC'; 'CC'; 'CC'; '00'; '00'; '00'; '00'] ) );
value_orig = typecast( value_orig', 'int64' );
else
fprintf( 'Huge value as bigint\n' );
value_orig = uint8( hex2dec( ['CC'; 'CC'; 'CC'; 'CC'; 'CC'; 'CC'; 'CC'; '7C'] ) );
value_orig = typecast( value_orig', 'int64' );
end
fprintf( 'MATLAB original:\n\tdata type: %s, and value: %ld\n', ...
class( value_orig ), value_orig );
mksqlite( 'INSERT INTO bigint VALUES (?)', value_orig );
value_fetched = mksqlite( 'SELECT x, PRINTF("%d",x) AS x_dec FROM bigint' );
fprintf( 'After fetching from database:\n\tdata type: %s, and value: %s', ...
class( value_fetched.x ), value_fetched.x_dec );
fprintf( '\n\n' );
mksqlite( 'DELETE FROM bigint' );
end
mksqlite( 'close' );
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
Small value as bigint
MATLAB original:
data type: int64, and value: 3435973836
After fetching from database:
data type: double, and value: 3435973836
Huge value as bigint
MATLAB original:
data type: int64, and value: 8992787735933406412
After fetching from database:
data type: int64, and value: 8992787735933406412