CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
e_blobbytes.test80 linesDownload Raw Back to test
1# 2014 October 302#3# The author disclaims copyright to this source code.  In place of4# a legal notice, here is a blessing:5#6#    May you do good and not evil.7#    May you find forgiveness for yourself and forgive others.8#    May you share freely, never taking more than you give.9#10#***********************************************************************11#12 13set testdir [file dirname $argv0]14source $testdir/tester.tcl15set testprefix e_blobbytes16 17ifcapable !incrblob {18  finish_test19  return20}21 22do_execsql_test 1.0 {23  CREATE TABLE q1(r INTEGER PRIMARY KEY, s TEXT);24  WITH d(a, b) AS (25    SELECT 0, '' 26      UNION ALL27    SELECT a+1, b||'.' FROM d WHERE a<1000028  )29  INSERT INTO q1 SELECT * FROM d;30}31 32 33# EVIDENCE-OF: R-07796-55423 Returns the size in bytes of the BLOB34# accessible via the successfully opened BLOB handle in its only35# argument.36#37proc check_blob_size {tn rowid bytes} {38  uplevel [list do_test $tn [subst -nocommands {39    sqlite3_blob_open db main q1 s $rowid 0 B40    set res [sqlite3_blob_bytes [set B]]41    sqlite3_blob_close [set B]42    set res43  }] $bytes]44}45check_blob_size 1.1 43 4346check_blob_size 1.2 391 39147check_blob_size 1.3 6349 634948check_blob_size 1.4 2621 262149check_blob_size 1.5 7771 777150check_blob_size 1.6 7949 794951check_blob_size 1.7 4374 437452check_blob_size 1.8 2578 257853check_blob_size 1.9 7004 700454check_blob_size 1.10 2180 218055check_blob_size 1.11 3796 379656check_blob_size 1.12 7101 710157check_blob_size 1.13 7449 744958check_blob_size 1.14 7224 722459check_blob_size 1.15 3038 303860check_blob_size 1.16 1083 108361check_blob_size 1.17 5157 515762check_blob_size 1.18 6686 668663check_blob_size 1.19 6592 659264check_blob_size 1.20 0 065 66 67# EVIDENCE-OF: R-53088-19343 The incremental blob I/O routines can only68# read or overwriting existing blob content; they cannot change the size69# of a blob.70#71#   Also demonstrated in other e_blobXXX.test files.72#73do_test 2.1 {74  sqlite3_blob_open db main q1 s 86 1 B75  list [catch { sqlite3_blob_write $B 86 "1" 1 } msg] $msg76} {1 SQLITE_ERROR}77sqlite3_blob_close $B78 79finish_test80