os/persistentdata/persistentstorage/sql/TEST/testexecute/SQLite/config/APIBasic2-8S.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.
     1 
     2 // Called by BasicSQL2-8S.script.
     3 // Duplicates BasicSQL2.script/APIBasic2.ini but uses 8-bit methods (Prepare
     4 // and Exec) and asynchronous methods rather than the usual synchronous
     5 // UTF-16 methods.
     6 //
     7 // Tests that a transaction  which is not completed is visible  to a EReadUncommitted
     8 // session and simultaneously (so a bit of concurrency), not visible
     9 // to a EReadSerializable session.
    10 
    11 // Set up a new database.
    12 [Thread1]
    13 WaitB0=2
    14 EightBit1=True
    15 Async2=True
    16 Delete3=C:\Transaction0.db
    17 ExpectedError3=KErrNotFound
    18 Create4=C:\Transaction0.db
    19 Exec5=Create Table Curtab(f1 int primary key, f2 real, f3 text);
    20 Prepare6=Insert into Curtab(f1, f2, f3) values(:mary, :mungo, :midge);
    21 ParameterIndex7=:mary
    22 ParameterIndex8=:mungo
    23 ParameterIndex9=:midge
    24 BindInt10=0,-4853
    25 BindReal11=1,6.0827626
    26 BindText12=2,Here's some text
    27 St_Exec13=
    28 Reset14=
    29 St_Close15=
    30 // At this point one record outside of a transaction is present.
    31 
    32 Exec16=Begin Transaction;
    33 Prepare17=Insert into Curtab(f1, f2, f3) values(:mary, :mungo, :midge);
    34 ParameterIndex18=:mary
    35 ParameterIndex19=:mungo
    36 ParameterIndex20=:midge
    37 BindInt21=0,9876
    38 BindReal22=1,7.0710678
    39 BindText23=2,Here's yet more text
    40 St_Exec24=
    41 Reset25=
    42 BindInt26=0,1011010
    43 BindReal27=1,182282.397
    44 BindText28=2,I want chocolate. Now.
    45 St_Exec29=
    46 Reset30=
    47 BindInt31=0,7070707
    48 BindReal32=1,-1.60217733e-19
    49 BindText33=2,Now I want ice-cream.
    50 St_Exec34=
    51 Reset35=
    52 St_Close36=
    53 // At this point we've added one row outside of the transaction and 3 more
    54 // within it. Send a signal to the slave threads which will check for the
    55 // above content (one is ESerializable, one is EReadUncommitted, so they'll
    56 // see different content).
    57 // Wake up 2 threads..
    58 SignalA37=2
    59 // Wait for two signals to show they've finished..
    60 WaitB38=2
    61 Exec39=Rollback;
    62 Close40=
    63 EndBlock41=
    64 
    65 // ESerializable thread.
    66 [Thread2]
    67 SignalB0=1
    68 EightBit1=True
    69 Async2=True
    70 // Wait until the db has been setup.
    71 WaitA3=1
    72 Open4=C:\Transaction0.db
    73 SetIsolationLevel5=ESerializable
    74 Prepare6=Select * from Curtab;
    75 ColumnIndex7=f1
    76 ColumnIndex8=f2
    77 ColumnIndex9=f3
    78 Next10=
    79 ExpectedError10=KSqlErrLocked
    80 St_Close11=
    81 Close12=
    82 SignalB13=1
    83 EndBlock14=
    84 
    85 [Thread3]
    86 SignalB0=1
    87 EightBit1=True
    88 Async2=True
    89 // Wait until the db has been setup.
    90 WaitA3=1
    91 Open4=C:\Transaction0.db
    92 SetIsolationLevel5=EReadUncommitted
    93 Prepare6=Select * from Curtab;
    94 ColumnIndex7=f1
    95 ColumnIndex8=f2
    96 ColumnIndex9=f3
    97 Next10=KSqlAtRow
    98 ColumnInt11=0,-4853
    99 ColumnReal12=1,6.0827626
   100 ColumnTextL13=2,Here's some text
   101 Next14=KSqlAtRow
   102 ColumnInt15=0,9876
   103 ColumnReal16=1,7.0710678
   104 ColumnTextL17=2,Here's yet more text
   105 Next18=KSqlAtRow
   106 ColumnInt19=0,1011010
   107 ColumnReal20=1,182282.397
   108 ColumnTextL21=2,I want chocolate. Now.
   109 Next22=KSqlAtRow
   110 ColumnInt23=0,7070707
   111 ColumnReal24=1,-1.60217733e-19
   112 ColumnTextL25=2,Now I want ice-cream.
   113 Next26=KSqlAtEnd
   114 St_Close27=
   115 Close28=
   116 SignalB29=1
   117 EndBlock30=
   118 
   119 [CheckFollowingRollback]
   120 EightBit0=True
   121 Async1=True
   122 Open2=C:\Transaction0.db
   123 Prepare3=Select * from Curtab;
   124 ColumnIndex4=f1
   125 ColumnIndex5=f2
   126 ColumnIndex6=f3
   127 Next7=KSqlAtRow
   128 ColumnInt8=0,-4853
   129 ColumnReal9=1,6.0827626
   130 ColumnTextL10=2,Here's some text
   131 Next11=KSqlAtEnd
   132 St_Close12=
   133 Close13=
   134 Delete14=C:\Transaction0.db
   135 EndBlock15=
   136 
   137 
   138 // Create some cells with text in. Copy these with streams - passing
   139 // an RSqlColumnReadStream to an RSqlParamWriteStream.
   140 [CopyCellsWithStreams]
   141 EightBit0=True
   142 Async1=True
   143 Delete2=C:\CopyCells.db
   144 ExpectedError2=KErrNotFound
   145 Create3=C:\CopyCells.db
   146 Exec4=Create table Table1(field1 text(50));
   147 Exec5=Create table Table2(field1 text(50));
   148 
   149 Exec6=Insert Into Table1(field1) values("We're going to copy this string");
   150 Exec7=Insert Into Table1(field1) values("And this one");
   151 Exec8=Insert Into Table1(field1) values("In fact, all of them. There's a loop");
   152 
   153 // This is used to select the field we want to copy.
   154 Prepare9=select field1 from Table1;
   155 
   156 // This will copy the first cell into a new one (using a separate
   157 // RSqlStatement object). The two lines below define values for the separate
   158 // RSqlStatement to use.
   159 Function10=CopyCellsUsingStreams
   160 PrepareStatement=Insert into Table2(field1) values(:mob);
   161 ParamName=:mob
   162 
   163 // Close PrepareX and read back the content of Table2 to see if the cell
   164 // copied correctly.
   165 St_Close11=
   166 Prepare12=select field1 from Table2;
   167 Next13=KSqlAtRow
   168 ColumnIndex14=field1
   169 ColumnTextL15=0,We're going to copy this string
   170 Next16=KSqlAtRow
   171 ColumnTextL17=0,And this one
   172 Next18=KSqlAtRow
   173 ColumnTextL19=0,In fact, all of them. There's a loop
   174 Next20=KSqlAtEnd
   175 
   176 // Shut down our RSqlStatement and RSqlDatabase resources.
   177 St_Close21=
   178 Close22=
   179 Delete23=C:\CopyCells.db
   180 EndBlock24=
   181 
   182 // A separate test, here we bind the content of one file (to an integer
   183 // field actually, but SQLite doesn't care about that), then we bind the
   184 // content of another before performing the exec/reset. So which data
   185 // ends up in the cell? The data from the second bind.
   186 [DoubleBind]
   187 EightBit0=True
   188 Async1=True
   189 Delete2=C:\GenerateErrors2.db
   190 ExpectedError2=KErrNotFound
   191 Create3=C:\GenerateErrors2.db
   192 Exec4=Create Table Table1(Field1 int);
   193 Prepare5=Insert into Table1(Field1) Values (:Mickey);
   194 ParameterIndex6=:Mickey
   195 StreamWriteBindText7=0,Z:\TEF_SQL\TestData\reference1.bin
   196 StreamWriteBindText8=0,Z:\TEF_SQL\TestData\reference1.txt
   197 St_Exec9=
   198 Reset10=
   199 St_Close11=
   200 Prepare12=select * from Table1;
   201 ColumnIndex13=Field1
   202 Next14=KSqlAtRow
   203 ColumnTextL15=0,Z:\TEF_SQL\TestData\reference1.txt
   204 St_Close16=
   205 Close17=
   206 Delete18=C:\GenerateErrors2.db
   207 EndBlock19=
   208 
   209 
   210 // Test the 'leaving' version of Create, Prepare and Open, also see what
   211 // happens if you try creating a database on ROM..
   212 [LeaveMethods]
   213 EightBit0=True
   214 Async1=True
   215 Delete2=C:\Leave1.db
   216 ExpectedError2=KErrNotFound
   217 OpenL3=C:\Leave1.db
   218 ExpectedError3=KErrNotFound
   219 CreateL4=C:\Leave1.db
   220 Exec5=Create table Leavetable(f1 text(50), f2 int, f3 real);
   221 PrepareL6=Insert into Leavetable values(:wonka, :charlie, :joe);
   222 ParameterIndex7=:wonka
   223 ParameterIndex8=:charlie
   224 ParameterIndex9=:joe
   225 BindText10=0,Great Glass Elevator
   226 BindInt11=1,5
   227 BindReal12=2,1.23456
   228 St_Exec13=
   229 Reset14=
   230 BindText15=0,Chocolate Factory
   231 BindInt16=1,54
   232 BindReal17=2,9.87654
   233 St_Exec18=
   234 Reset19=
   235 St_Close20=
   236 PrepareL21=select * from Leavetable;
   237 Next22=KSqlAtRow
   238 ColumnIndex23=f1
   239 ColumnIndex24=f2
   240 ColumnIndex25=f3
   241 ColumnTextL26=0,Great Glass Elevator
   242 ColumnInt27=1,5
   243 ColumnReal28=2,1.23456
   244 Next29=KSqlAtRow
   245 ColumnTextL30=0,Chocolate Factory
   246 ColumnInt31=1,54
   247 ColumnReal32=2,9.87654
   248 Next33=KSqlAtEnd
   249 St_Close34=
   250 
   251 Close35=
   252 CreateL36=C:\Leave1.db
   253 ExpectedError36=KErrAlreadyExists
   254 Delete37=C:\Leave1.db
   255 CreateL38=Z:\TEF_SQL\TestData\ReadOnly.db
   256 ExpectedError38=KErrAlreadyExists
   257 CreateL39=Z:\TEF_SQL\TestData\DoesntExist.db
   258 ExpectedError39=KErrAccessDenied
   259 EndBlock40=
   260 
   261 // Create (and implicitly open) a database, then another, then another, etc.
   262 // This actually isn't supposed to generate errors.
   263 // This leaks memory, normally the programmer would be expected to close
   264 // each of the databases before opening another, but we're explicitly
   265 // checking that successive Opens/Creates give no error.
   266 [MultipleCreateOpen]
   267 EightBit0=True
   268 Async1=True
   269 Delete2=C:\MCO1.db
   270 ExpectedError2=KErrNotFound
   271 Delete3=C:\MCO2.db
   272 ExpectedError3=KErrNotFound
   273 Delete4=C:\MCO3.db
   274 ExpectedError4=KErrNotFound
   275 Delete5=C:\MCO4.db
   276 ExpectedError5=KErrNotFound
   277 Delete6=C:\MCO5.db
   278 ExpectedError6=KErrNotFound
   279 
   280 CreateL7=C:\MCO1.db
   281 Create8=C:\MCO2.db
   282 OpenL9=Z:\TEF_SQL\TestData\test1.db
   283 CreateL10=C:\MCO3.db
   284 Create11=C:\MCO4.db
   285 CreateL12=C:\MCO5.db
   286 
   287 Delete13=C:\MCO1.db
   288 ExpectedError13=KErrInUse
   289 Delete14=C:\MCO2.db
   290 ExpectedError14=KErrInUse
   291 Delete15=C:\MCO3.db
   292 ExpectedError15=KErrInUse
   293 Delete16=C:\MCO4.db
   294 ExpectedError16=KErrInUse
   295 Delete17=C:\MCO5.db
   296 ExpectedError17=KErrInUse
   297 Close18=
   298 Delete19=C:\MCO5.db
   299 
   300 Open20=Z:\TEF_SQL\TestData\ReadOnly.db
   301 OpenL21=Z:\TEF_SQL\TestData\test1.db
   302 Open22=Z:\TEF_SQL\TestData\ReadOnly.db
   303 
   304 EndBlock23=
   305 
   306 [ExtraBindTest]
   307 EightBit0=True
   308 Async1=True
   309 // First set up a table.
   310 Delete2=C:\ExtraBindTest.db
   311 ExpectedError2=KErrNotFound
   312 Create3=C:\ExtraBindTest.db
   313 Exec4=Create table Sometable(Someint int, Somereal real, Sometext text);
   314 Prepare5=Insert into Sometable(Someint, Somereal, Sometext) values (:FInt, :FReal, :FText);
   315 Function6=WriteBigTable
   316 LowCount=105
   317 HighCount=119
   318 CountStep=3
   319 Multiplier=0.0
   320 Text=Here's some rather pointless text
   321 EventuallyExpectedError=KErrNone
   322 St_Close7=
   323 // Now try a non-trivial select. Ok then, fairly trivial, ;-)
   324 Prepare8=Select * from Sometable where Someint > :Brian;
   325 ParameterIndex9=:Brian
   326 BindInt10=0,112
   327 Next11=KSqlAtRow
   328 ColumnIndex12=Someint
   329 ColumnIndex13=Somereal
   330 ColumnIndex14=Sometext
   331 ColumnInt15=0,114
   332 ColumnReal16=1,0.0
   333 ColumnTextL17=2,Here's some rather pointless text
   334 Next18=KSqlAtRow
   335 ColumnInt19=0,117
   336 ColumnReal20=1,0.0
   337 ColumnTextL21=2,Here's some rather pointless text
   338 Next22=KSqlAtEnd
   339 St_Close23=
   340 Close24=
   341 Delete25=C:\ExtraBindTest.db
   342 EndBlock26=
   343 
   344 [ExtraBindTest2]
   345 EightBit0=True
   346 Async1=True
   347 Delete2=C:\ExtraBindTest2.db
   348 ExpectedError2=KErrNotFound
   349 Create3=C:\ExtraBindTest2.db
   350 Exec4=Create table Sometable(Someint int, Somereal real, Sometext text);
   351 Prepare5=Insert into Sometable(Sometext) values (:FText);
   352 ParameterIndex6=:FText
   353 NewBlock7=WriteInts20
   354 St_Exec8=
   355 Reset9=
   356 NewBlock10=WriteInts21
   357 St_Exec11=
   358 Reset12=
   359 NewBlock13=WriteInts22
   360 St_Exec14=
   361 Reset15=
   362 NewBlock16=WriteInts400
   363 St_Exec17=
   364 Reset18=
   365 St_Close19=
   366 Prepare20=Select * from Sometable;
   367 ColumnIndex21=Sometext
   368 Next22=KSqlAtRow
   369 ColumnSize23=0,80
   370 Next24=KSqlAtRow
   371 ColumnSize25=0,84
   372 Next26=KSqlAtRow
   373 ColumnSize27=0,88
   374 Next28=KSqlAtRow
   375 ColumnSize29=0,1600
   376 Next30=KSqlAtEnd
   377 // MUST close the Statement or confusion ensues!!
   378 St_Close31==
   379 Prepare32=Select Sometext from Sometable where Sometext=:Block
   380 ParameterIndex33=:Block
   381 // We're trying to recover one of the blocks. This function does a bind..
   382 NewBlock34=WriteInts21
   383 Next35=KSqlAtRow
   384 ColumnIndex36=Sometext
   385 ColumnSize37=0,84
   386 Next38=KSqlAtEnd
   387 St_Close39=
   388 Close40=
   389 Delete41=C:\ExtraBindTest2.db
   390 EndBlock42=
   391 
   392 [WriteInts20]
   393 Function0=WriteIntsToStream
   394 Count=20
   395 EndBlock1=
   396 [WriteInts21]
   397 Function0=WriteIntsToStream
   398 Count=21
   399 EndBlock1=
   400 [WriteInts22]
   401 Function0=WriteIntsToStream
   402 Count=22
   403 EndBlock1=
   404 [WriteInts400]
   405 Function0=WriteIntsToStream
   406 Count=400
   407 EndBlock1=
   408