os/persistentdata/persistentstorage/sql/TEST/testexecute/SQLite/config/Configuration.ini
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
sl@0
     2
// //////////////////////////////////////////////////////////////////////// 
sl@0
     3
//
sl@0
     4
// Configuration tests - try changing the values of the default encoding
sl@0
     5
// and cache_size and page_size. From an integration test we can't really
sl@0
     6
// detect an effect of the _size settings, though we can read them back
sl@0
     7
// with the 'pragma' syntax.
sl@0
     8
//
sl@0
     9
// First check the defaults. If these change it will confuse the other tests
sl@0
    10
// so we might as well detect that change and generate a failure ASAP...
sl@0
    11
[CheckDefaults]
sl@0
    12
// First open a zero length database to check the defaults.
sl@0
    13
NoOperation0=
sl@0
    14
Open1=Z:\TEF_SQL\TestData\ReadOnly.db
sl@0
    15
Function2=ScalarFullSelect
sl@0
    16
Method2=SelectTextL
sl@0
    17
Result2=UTF-16le
sl@0
    18
Use_Set2=0
sl@0
    19
Statement2=PRAGMA encoding;
sl@0
    20
sl@0
    21
Function3=ScalarFullSelect
sl@0
    22
Method3=SelectIntL
sl@0
    23
Result3=1024
sl@0
    24
Use_Set3=1
sl@0
    25
Statement3=PRAGMA page_size;
sl@0
    26
sl@0
    27
Function4=ScalarFullSelect
sl@0
    28
Method4=SelectIntL
sl@0
    29
Result4=DEFAULT_SOFT_HEAP_LIMIT
sl@0
    30
Use_Set4=1
sl@0
    31
Statement4=PRAGMA cache_size;
sl@0
    32
Close5=
sl@0
    33
EndBlock6=
sl@0
    34
sl@0
    35
// Check that gibberish in the configuration string prevents Create from
sl@0
    36
// working.
sl@0
    37
[CheckOverride1]
sl@0
    38
DefineConfig0=this is a load of old rubbish which should have no effect on settings
sl@0
    39
Delete1=C:\ConfigTest1.db
sl@0
    40
ExpectedError1=KErrNotFound
sl@0
    41
Create2=C:\ConfigTest1.db
sl@0
    42
ExpectedError2=KErrArgument
sl@0
    43
// The next line will PANIC the client because the Create will have failed due
sl@0
    44
// to the bad configuration line. That's ok, we're expecting it.
sl@0
    45
Exec3=Select * from SomeTable;
sl@0
    46
EndBlock4=
sl@0
    47
sl@0
    48
// Check that properly formatted configuration options work, but that
sl@0
    49
// page_size can't be changed for a pre-existing db, and a bad encoding
sl@0
    50
// has no effect. The cache_size is also not affected.
sl@0
    51
[CheckOverride2]
sl@0
    52
DefineConfig0=page_size=2048;cache_size=64;encoding=hatstand
sl@0
    53
// On a pre-existing database we can't change the page size, plus the
sl@0
    54
// bad encoding will have been ignored.
sl@0
    55
Open1=Z:\TEF_SQL\TestData\ReadOnly.db
sl@0
    56
sl@0
    57
// encoding will not have been changed from its default of utf-16
sl@0
    58
Function2=ScalarFullSelect
sl@0
    59
Method2=SelectTextL
sl@0
    60
Result2=UTF-16le
sl@0
    61
Use_Set2=1
sl@0
    62
Statement2=PRAGMA encoding;
sl@0
    63
sl@0
    64
// page_size will not have been changed from its default of 1024..
sl@0
    65
Function3=ScalarFullSelect
sl@0
    66
Method3=SelectIntL
sl@0
    67
Result3=1024
sl@0
    68
Use_Set3=1
sl@0
    69
Statement3=PRAGMA page_size;
sl@0
    70
sl@0
    71
// cache_size WILL NOT have changed.
sl@0
    72
Function4=ScalarFullSelect
sl@0
    73
Method4=SelectIntL
sl@0
    74
Result4=64
sl@0
    75
Use_Set4=1
sl@0
    76
Statement4=PRAGMA cache_size;
sl@0
    77
sl@0
    78
Close5=
sl@0
    79
EndBlock6=
sl@0
    80
sl@0
    81
// Try changing all three config items to legal values, and check them.
sl@0
    82
[CheckOverride3]
sl@0
    83
DefineConfig0=page_size=2048;cache_size=34;encoding=UTF-8
sl@0
    84
// On a new database we can change the page size and the encoding.
sl@0
    85
// Not the cache_size.
sl@0
    86
Delete1=C:\ConfigTest2.db
sl@0
    87
ExpectedError1=KErrNotFound
sl@0
    88
sl@0
    89
Create2=C:\ConfigTest2.db
sl@0
    90
sl@0
    91
// encoding will not have been changed from its default of utf-16
sl@0
    92
Function3=ScalarFullSelect
sl@0
    93
Method3=SelectTextL
sl@0
    94
Result3=UTF-8
sl@0
    95
Use_Set3=1
sl@0
    96
Statement3=PRAGMA encoding;
sl@0
    97
sl@0
    98
// page_size will have been changed from its default of 1024..
sl@0
    99
Function4=ScalarFullSelect
sl@0
   100
Method4=SelectIntL
sl@0
   101
Result4=2048
sl@0
   102
Use_Set4=1
sl@0
   103
Statement4=PRAGMA page_size;
sl@0
   104
sl@0
   105
// cache_size WILL have changed to 34..
sl@0
   106
Function5=ScalarFullSelect
sl@0
   107
Method5=SelectIntL
sl@0
   108
Result5=34
sl@0
   109
Use_Set5=1
sl@0
   110
Statement5=PRAGMA cache_size;
sl@0
   111
sl@0
   112
Close6=
sl@0
   113
Delete7=C:\ConfigTest2.db
sl@0
   114
EndBlock8=
sl@0
   115
sl@0
   116
// Try setting page_size to a non-power-of-two (no effect), stick in some
sl@0
   117
// properly formatted by useless extras (no effect) and attempt to set
sl@0
   118
// cache_size (works) and an unsupported encoding (doesn't work).
sl@0
   119
[CheckOverride4]
sl@0
   120
DefineConfig0=page_size=4095;x=y;i=j;cache_size=43;encoding=UTF-16be
sl@0
   121
// On a new database we can change the page size and the encoding.
sl@0
   122
// But page_size is supposed to be a power of 2.
sl@0
   123
Delete1=C:\ConfigTest3.db
sl@0
   124
ExpectedError1=KErrNotFound
sl@0
   125
sl@0
   126
Create2=C:\ConfigTest3.db
sl@0
   127
sl@0
   128
// encoding will not have been changed from its default of utf-16
sl@0
   129
Function3=ScalarFullSelect
sl@0
   130
Method3=SelectTextL
sl@0
   131
Result3=UTF-16le
sl@0
   132
Use_Set3=1
sl@0
   133
Statement3=PRAGMA encoding;
sl@0
   134
sl@0
   135
// page_size will not have been changed from its default of 1024..
sl@0
   136
Function4=ScalarFullSelect
sl@0
   137
Method4=SelectIntL
sl@0
   138
Result4=1024
sl@0
   139
Use_Set4=1
sl@0
   140
Statement4=PRAGMA page_size;
sl@0
   141
sl@0
   142
// cache_size WILL have changed.
sl@0
   143
Function5=ScalarFullSelect
sl@0
   144
Method5=SelectIntL
sl@0
   145
Result5=43
sl@0
   146
Use_Set5=1
sl@0
   147
Statement5=PRAGMA cache_size;
sl@0
   148
sl@0
   149
Close6=
sl@0
   150
Delete7=C:\ConfigTest3.db
sl@0
   151
EndBlock8=
sl@0
   152
sl@0
   153
sl@0
   154
// Try setting a legal page_size (works), a cache_size (doesn't work) and
sl@0
   155
// a legal character encoding (works).
sl@0
   156
[CheckOverride5]
sl@0
   157
DefineConfig0=page_size=512;cache_size=432;encoding=UTF-8
sl@0
   158
// On a new database we can change the page size, cache size and the
sl@0
   159
// encoding.
sl@0
   160
Delete1=C:\ConfigTest4.db
sl@0
   161
ExpectedError1=KErrNotFound
sl@0
   162
sl@0
   163
Create2=C:\ConfigTest4.db
sl@0
   164
sl@0
   165
// encoding will not have been changed from its default of utf-16
sl@0
   166
Function3=ScalarFullSelect
sl@0
   167
Method3=SelectTextL
sl@0
   168
Result3=UTF-8
sl@0
   169
Use_Set3=1
sl@0
   170
Statement3=PRAGMA encoding;
sl@0
   171
sl@0
   172
// page_size will not have been changed from its default of 1024..
sl@0
   173
Function4=ScalarFullSelect
sl@0
   174
Method4=SelectIntL
sl@0
   175
Result4=512
sl@0
   176
Use_Set4=1
sl@0
   177
Statement4=PRAGMA page_size;
sl@0
   178
sl@0
   179
// cache_size WILL have changed.
sl@0
   180
Function5=ScalarFullSelect
sl@0
   181
Method5=SelectIntL
sl@0
   182
Result5=432
sl@0
   183
Use_Set5=1
sl@0
   184
Statement5=PRAGMA cache_size;
sl@0
   185
sl@0
   186
Close6=
sl@0
   187
Delete7=C:\ConfigTest4.db
sl@0
   188
EndBlock8=
sl@0
   189
sl@0
   190
// /////////////////////////////////////////////////////////////////////////
sl@0
   191
sl@0
   192
// The following tests create two functionally identical databases but one
sl@0
   193
// block uses UTF-8. Then check that the file sizes differ.
sl@0
   194
sl@0
   195
// Create a database with a single table containing a single cell containing
sl@0
   196
// the text content of the reference1.txt text file. Set UTF-16.
sl@0
   197
[WriteTextDB-16bit]
sl@0
   198
Delete0=C:\ConfigTest5.db
sl@0
   199
ExpectedError0=KErrNotFound
sl@0
   200
Create1=C:\ConfigTest5.db
sl@0
   201
sl@0
   202
// First check for our expected defaults.
sl@0
   203
Function2=ScalarFullSelect
sl@0
   204
Method2=SelectTextL
sl@0
   205
Result2=UTF-16le
sl@0
   206
Use_Set2=1
sl@0
   207
Statement2=PRAGMA encoding;
sl@0
   208
sl@0
   209
Function3=ScalarFullSelect
sl@0
   210
Method3=SelectIntL
sl@0
   211
Result3=1024
sl@0
   212
Use_Set3=1
sl@0
   213
Statement3=PRAGMA page_size;
sl@0
   214
sl@0
   215
Function4=ScalarFullSelect
sl@0
   216
Method4=SelectIntL
sl@0
   217
Result4=DEFAULT_SOFT_HEAP_LIMIT
sl@0
   218
Use_Set4=1
sl@0
   219
Statement4=PRAGMA cache_size;
sl@0
   220
sl@0
   221
Exec5=Create Table Sometable(f1 text);
sl@0
   222
Prepare6=Insert into Sometable values(:val);
sl@0
   223
ParameterIndex7=:val
sl@0
   224
StreamWriteBindText8=0,Z:\TEF_SQL\TestData\reference1.txt
sl@0
   225
St_Exec9=
sl@0
   226
Reset10=
sl@0
   227
St_Close11=
sl@0
   228
sl@0
   229
Prepare12=select f1 from Sometable;
sl@0
   230
ColumnIndex13=f1
sl@0
   231
Next14=KSqlAtRow
sl@0
   232
ColumnSize15=0,3626
sl@0
   233
St_Close16=
sl@0
   234
Close17=
sl@0
   235
EndBlock18=
sl@0
   236
sl@0
   237
// Create a database with a single table containing a single cell containing
sl@0
   238
// the text content of the reference1.txt text file. Set UTF-8.
sl@0
   239
[WriteTextDB-8bit]
sl@0
   240
Delete0=C:\ConfigTest6.db
sl@0
   241
ExpectedError0=KErrNotFound
sl@0
   242
DefineConfig1=encoding=UTF-8
sl@0
   243
Create2=C:\ConfigTest6.db
sl@0
   244
sl@0
   245
// Check the defaults (plus our changed character encoding)
sl@0
   246
Function3=ScalarFullSelect
sl@0
   247
Method3=SelectTextL
sl@0
   248
Result3=UTF-8
sl@0
   249
Use_Set3=1
sl@0
   250
Statement3=PRAGMA encoding;
sl@0
   251
sl@0
   252
Function4=ScalarFullSelect
sl@0
   253
Method4=SelectIntL
sl@0
   254
Result4=1024
sl@0
   255
Use_Set4=1
sl@0
   256
Statement4=PRAGMA page_size;
sl@0
   257
sl@0
   258
Function5=ScalarFullSelect
sl@0
   259
Method5=SelectIntL
sl@0
   260
Result5=DEFAULT_SOFT_HEAP_LIMIT
sl@0
   261
Use_Set5=1
sl@0
   262
Statement5=PRAGMA cache_size;
sl@0
   263
sl@0
   264
Exec6=Create Table Sometable(f1 text);
sl@0
   265
Prepare7=Insert into Sometable values(:val);
sl@0
   266
ParameterIndex8=:val
sl@0
   267
StreamWriteBindText9=0,Z:\TEF_SQL\TestData\reference1.txt
sl@0
   268
St_Exec10=
sl@0
   269
Reset11=
sl@0
   270
St_Close12=
sl@0
   271
sl@0
   272
Prepare13=select f1 from Sometable;
sl@0
   273
ColumnIndex14=f1
sl@0
   274
Next15=KSqlAtRow
sl@0
   275
ColumnSize16=0,3626
sl@0
   276
St_Close17=
sl@0
   277
Close18=
sl@0
   278
EndBlock19=
sl@0
   279
sl@0
   280
// Check that the two databases created above (which are exactly equivalent)
sl@0
   281
// differ in size. That will suggest that the UTF-8/UTF-16
sl@0
   282
// encoding options have done their work. Through the SQLite APIs they generate
sl@0
   283
// identical output. It seems kind of overkill to have a whole code-driven
sl@0
   284
// test function to do this but I see no other way..
sl@0
   285
// Attempt an attach of UTF-16 to UTF-8 database - it will fail, that's an
sl@0
   286
// illegal operation.
sl@0
   287
[FilesDiffer]
sl@0
   288
Function0=FilesDifferBySize
sl@0
   289
FileA0=C:\ConfigTest5.db
sl@0
   290
FileB0=C:\ConfigTest6.db
sl@0
   291
Open1=C:\ConfigTest5.db
sl@0
   292
Exec2=Attach "C:\ConfigTest6.db" as ThatOne;
sl@0
   293
ExpectedError2=KSqlErrGeneral
sl@0
   294
LastErrorMessage3=attached databases must use the same text encoding as main database
sl@0
   295
// Delete will succeed because the attach didn't.
sl@0
   296
Delete4=C:\ConfigTest6.db
sl@0
   297
Close5=
sl@0
   298
Delete6=C:\ConfigTest5.db
sl@0
   299
EndBlock7=