os/persistentdata/persistentstorage/sql/TEST/testexecute/SQLite/config/Configuration.ini
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sql/TEST/testexecute/SQLite/config/Configuration.ini	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,299 @@
     1.4 +
     1.5 +// //////////////////////////////////////////////////////////////////////// 
     1.6 +//
     1.7 +// Configuration tests - try changing the values of the default encoding
     1.8 +// and cache_size and page_size. From an integration test we can't really
     1.9 +// detect an effect of the _size settings, though we can read them back
    1.10 +// with the 'pragma' syntax.
    1.11 +//
    1.12 +// First check the defaults. If these change it will confuse the other tests
    1.13 +// so we might as well detect that change and generate a failure ASAP...
    1.14 +[CheckDefaults]
    1.15 +// First open a zero length database to check the defaults.
    1.16 +NoOperation0=
    1.17 +Open1=Z:\TEF_SQL\TestData\ReadOnly.db
    1.18 +Function2=ScalarFullSelect
    1.19 +Method2=SelectTextL
    1.20 +Result2=UTF-16le
    1.21 +Use_Set2=0
    1.22 +Statement2=PRAGMA encoding;
    1.23 +
    1.24 +Function3=ScalarFullSelect
    1.25 +Method3=SelectIntL
    1.26 +Result3=1024
    1.27 +Use_Set3=1
    1.28 +Statement3=PRAGMA page_size;
    1.29 +
    1.30 +Function4=ScalarFullSelect
    1.31 +Method4=SelectIntL
    1.32 +Result4=DEFAULT_SOFT_HEAP_LIMIT
    1.33 +Use_Set4=1
    1.34 +Statement4=PRAGMA cache_size;
    1.35 +Close5=
    1.36 +EndBlock6=
    1.37 +
    1.38 +// Check that gibberish in the configuration string prevents Create from
    1.39 +// working.
    1.40 +[CheckOverride1]
    1.41 +DefineConfig0=this is a load of old rubbish which should have no effect on settings
    1.42 +Delete1=C:\ConfigTest1.db
    1.43 +ExpectedError1=KErrNotFound
    1.44 +Create2=C:\ConfigTest1.db
    1.45 +ExpectedError2=KErrArgument
    1.46 +// The next line will PANIC the client because the Create will have failed due
    1.47 +// to the bad configuration line. That's ok, we're expecting it.
    1.48 +Exec3=Select * from SomeTable;
    1.49 +EndBlock4=
    1.50 +
    1.51 +// Check that properly formatted configuration options work, but that
    1.52 +// page_size can't be changed for a pre-existing db, and a bad encoding
    1.53 +// has no effect. The cache_size is also not affected.
    1.54 +[CheckOverride2]
    1.55 +DefineConfig0=page_size=2048;cache_size=64;encoding=hatstand
    1.56 +// On a pre-existing database we can't change the page size, plus the
    1.57 +// bad encoding will have been ignored.
    1.58 +Open1=Z:\TEF_SQL\TestData\ReadOnly.db
    1.59 +
    1.60 +// encoding will not have been changed from its default of utf-16
    1.61 +Function2=ScalarFullSelect
    1.62 +Method2=SelectTextL
    1.63 +Result2=UTF-16le
    1.64 +Use_Set2=1
    1.65 +Statement2=PRAGMA encoding;
    1.66 +
    1.67 +// page_size will not have been changed from its default of 1024..
    1.68 +Function3=ScalarFullSelect
    1.69 +Method3=SelectIntL
    1.70 +Result3=1024
    1.71 +Use_Set3=1
    1.72 +Statement3=PRAGMA page_size;
    1.73 +
    1.74 +// cache_size WILL NOT have changed.
    1.75 +Function4=ScalarFullSelect
    1.76 +Method4=SelectIntL
    1.77 +Result4=64
    1.78 +Use_Set4=1
    1.79 +Statement4=PRAGMA cache_size;
    1.80 +
    1.81 +Close5=
    1.82 +EndBlock6=
    1.83 +
    1.84 +// Try changing all three config items to legal values, and check them.
    1.85 +[CheckOverride3]
    1.86 +DefineConfig0=page_size=2048;cache_size=34;encoding=UTF-8
    1.87 +// On a new database we can change the page size and the encoding.
    1.88 +// Not the cache_size.
    1.89 +Delete1=C:\ConfigTest2.db
    1.90 +ExpectedError1=KErrNotFound
    1.91 +
    1.92 +Create2=C:\ConfigTest2.db
    1.93 +
    1.94 +// encoding will not have been changed from its default of utf-16
    1.95 +Function3=ScalarFullSelect
    1.96 +Method3=SelectTextL
    1.97 +Result3=UTF-8
    1.98 +Use_Set3=1
    1.99 +Statement3=PRAGMA encoding;
   1.100 +
   1.101 +// page_size will have been changed from its default of 1024..
   1.102 +Function4=ScalarFullSelect
   1.103 +Method4=SelectIntL
   1.104 +Result4=2048
   1.105 +Use_Set4=1
   1.106 +Statement4=PRAGMA page_size;
   1.107 +
   1.108 +// cache_size WILL have changed to 34..
   1.109 +Function5=ScalarFullSelect
   1.110 +Method5=SelectIntL
   1.111 +Result5=34
   1.112 +Use_Set5=1
   1.113 +Statement5=PRAGMA cache_size;
   1.114 +
   1.115 +Close6=
   1.116 +Delete7=C:\ConfigTest2.db
   1.117 +EndBlock8=
   1.118 +
   1.119 +// Try setting page_size to a non-power-of-two (no effect), stick in some
   1.120 +// properly formatted by useless extras (no effect) and attempt to set
   1.121 +// cache_size (works) and an unsupported encoding (doesn't work).
   1.122 +[CheckOverride4]
   1.123 +DefineConfig0=page_size=4095;x=y;i=j;cache_size=43;encoding=UTF-16be
   1.124 +// On a new database we can change the page size and the encoding.
   1.125 +// But page_size is supposed to be a power of 2.
   1.126 +Delete1=C:\ConfigTest3.db
   1.127 +ExpectedError1=KErrNotFound
   1.128 +
   1.129 +Create2=C:\ConfigTest3.db
   1.130 +
   1.131 +// encoding will not have been changed from its default of utf-16
   1.132 +Function3=ScalarFullSelect
   1.133 +Method3=SelectTextL
   1.134 +Result3=UTF-16le
   1.135 +Use_Set3=1
   1.136 +Statement3=PRAGMA encoding;
   1.137 +
   1.138 +// page_size will not have been changed from its default of 1024..
   1.139 +Function4=ScalarFullSelect
   1.140 +Method4=SelectIntL
   1.141 +Result4=1024
   1.142 +Use_Set4=1
   1.143 +Statement4=PRAGMA page_size;
   1.144 +
   1.145 +// cache_size WILL have changed.
   1.146 +Function5=ScalarFullSelect
   1.147 +Method5=SelectIntL
   1.148 +Result5=43
   1.149 +Use_Set5=1
   1.150 +Statement5=PRAGMA cache_size;
   1.151 +
   1.152 +Close6=
   1.153 +Delete7=C:\ConfigTest3.db
   1.154 +EndBlock8=
   1.155 +
   1.156 +
   1.157 +// Try setting a legal page_size (works), a cache_size (doesn't work) and
   1.158 +// a legal character encoding (works).
   1.159 +[CheckOverride5]
   1.160 +DefineConfig0=page_size=512;cache_size=432;encoding=UTF-8
   1.161 +// On a new database we can change the page size, cache size and the
   1.162 +// encoding.
   1.163 +Delete1=C:\ConfigTest4.db
   1.164 +ExpectedError1=KErrNotFound
   1.165 +
   1.166 +Create2=C:\ConfigTest4.db
   1.167 +
   1.168 +// encoding will not have been changed from its default of utf-16
   1.169 +Function3=ScalarFullSelect
   1.170 +Method3=SelectTextL
   1.171 +Result3=UTF-8
   1.172 +Use_Set3=1
   1.173 +Statement3=PRAGMA encoding;
   1.174 +
   1.175 +// page_size will not have been changed from its default of 1024..
   1.176 +Function4=ScalarFullSelect
   1.177 +Method4=SelectIntL
   1.178 +Result4=512
   1.179 +Use_Set4=1
   1.180 +Statement4=PRAGMA page_size;
   1.181 +
   1.182 +// cache_size WILL have changed.
   1.183 +Function5=ScalarFullSelect
   1.184 +Method5=SelectIntL
   1.185 +Result5=432
   1.186 +Use_Set5=1
   1.187 +Statement5=PRAGMA cache_size;
   1.188 +
   1.189 +Close6=
   1.190 +Delete7=C:\ConfigTest4.db
   1.191 +EndBlock8=
   1.192 +
   1.193 +// /////////////////////////////////////////////////////////////////////////
   1.194 +
   1.195 +// The following tests create two functionally identical databases but one
   1.196 +// block uses UTF-8. Then check that the file sizes differ.
   1.197 +
   1.198 +// Create a database with a single table containing a single cell containing
   1.199 +// the text content of the reference1.txt text file. Set UTF-16.
   1.200 +[WriteTextDB-16bit]
   1.201 +Delete0=C:\ConfigTest5.db
   1.202 +ExpectedError0=KErrNotFound
   1.203 +Create1=C:\ConfigTest5.db
   1.204 +
   1.205 +// First check for our expected defaults.
   1.206 +Function2=ScalarFullSelect
   1.207 +Method2=SelectTextL
   1.208 +Result2=UTF-16le
   1.209 +Use_Set2=1
   1.210 +Statement2=PRAGMA encoding;
   1.211 +
   1.212 +Function3=ScalarFullSelect
   1.213 +Method3=SelectIntL
   1.214 +Result3=1024
   1.215 +Use_Set3=1
   1.216 +Statement3=PRAGMA page_size;
   1.217 +
   1.218 +Function4=ScalarFullSelect
   1.219 +Method4=SelectIntL
   1.220 +Result4=DEFAULT_SOFT_HEAP_LIMIT
   1.221 +Use_Set4=1
   1.222 +Statement4=PRAGMA cache_size;
   1.223 +
   1.224 +Exec5=Create Table Sometable(f1 text);
   1.225 +Prepare6=Insert into Sometable values(:val);
   1.226 +ParameterIndex7=:val
   1.227 +StreamWriteBindText8=0,Z:\TEF_SQL\TestData\reference1.txt
   1.228 +St_Exec9=
   1.229 +Reset10=
   1.230 +St_Close11=
   1.231 +
   1.232 +Prepare12=select f1 from Sometable;
   1.233 +ColumnIndex13=f1
   1.234 +Next14=KSqlAtRow
   1.235 +ColumnSize15=0,3626
   1.236 +St_Close16=
   1.237 +Close17=
   1.238 +EndBlock18=
   1.239 +
   1.240 +// Create a database with a single table containing a single cell containing
   1.241 +// the text content of the reference1.txt text file. Set UTF-8.
   1.242 +[WriteTextDB-8bit]
   1.243 +Delete0=C:\ConfigTest6.db
   1.244 +ExpectedError0=KErrNotFound
   1.245 +DefineConfig1=encoding=UTF-8
   1.246 +Create2=C:\ConfigTest6.db
   1.247 +
   1.248 +// Check the defaults (plus our changed character encoding)
   1.249 +Function3=ScalarFullSelect
   1.250 +Method3=SelectTextL
   1.251 +Result3=UTF-8
   1.252 +Use_Set3=1
   1.253 +Statement3=PRAGMA encoding;
   1.254 +
   1.255 +Function4=ScalarFullSelect
   1.256 +Method4=SelectIntL
   1.257 +Result4=1024
   1.258 +Use_Set4=1
   1.259 +Statement4=PRAGMA page_size;
   1.260 +
   1.261 +Function5=ScalarFullSelect
   1.262 +Method5=SelectIntL
   1.263 +Result5=DEFAULT_SOFT_HEAP_LIMIT
   1.264 +Use_Set5=1
   1.265 +Statement5=PRAGMA cache_size;
   1.266 +
   1.267 +Exec6=Create Table Sometable(f1 text);
   1.268 +Prepare7=Insert into Sometable values(:val);
   1.269 +ParameterIndex8=:val
   1.270 +StreamWriteBindText9=0,Z:\TEF_SQL\TestData\reference1.txt
   1.271 +St_Exec10=
   1.272 +Reset11=
   1.273 +St_Close12=
   1.274 +
   1.275 +Prepare13=select f1 from Sometable;
   1.276 +ColumnIndex14=f1
   1.277 +Next15=KSqlAtRow
   1.278 +ColumnSize16=0,3626
   1.279 +St_Close17=
   1.280 +Close18=
   1.281 +EndBlock19=
   1.282 +
   1.283 +// Check that the two databases created above (which are exactly equivalent)
   1.284 +// differ in size. That will suggest that the UTF-8/UTF-16
   1.285 +// encoding options have done their work. Through the SQLite APIs they generate
   1.286 +// identical output. It seems kind of overkill to have a whole code-driven
   1.287 +// test function to do this but I see no other way..
   1.288 +// Attempt an attach of UTF-16 to UTF-8 database - it will fail, that's an
   1.289 +// illegal operation.
   1.290 +[FilesDiffer]
   1.291 +Function0=FilesDifferBySize
   1.292 +FileA0=C:\ConfigTest5.db
   1.293 +FileB0=C:\ConfigTest6.db
   1.294 +Open1=C:\ConfigTest5.db
   1.295 +Exec2=Attach "C:\ConfigTest6.db" as ThatOne;
   1.296 +ExpectedError2=KSqlErrGeneral
   1.297 +LastErrorMessage3=attached databases must use the same text encoding as main database
   1.298 +// Delete will succeed because the attach didn't.
   1.299 +Delete4=C:\ConfigTest6.db
   1.300 +Close5=
   1.301 +Delete6=C:\ConfigTest5.db
   1.302 +EndBlock7=