
// Called by Panics.script.
// Tests that PANICs occur in the right situations.

// Attempt to use an RSqlStatement object without an RSqlDatabase.
[One-a]
Prepare0=one
[One-b]
AtRow0=True
[One-c]
ParameterIndex0=x
[One-d]
Next0=
[One-e]
Reset0=
[One-f]
// Doesn't actually call ParameterIndex, just gets it on the internal array,
// position 0..
ParameterIndex0=2,*explicit*
// Use position 0, which contains ParameterIndex 2 which is invalid.
StreamWriteBindBin1=0,Z:\TEF_SQL\TestData\reference1.bin
[One-g]
// Doesn't actually call ParameterIndex, just gets it on the internal array,
// position 0..
ParameterIndex0=2,*explicit*
// Use position 0, which contains ParameterIndex 2 which is invalid.
BindInt64_1=0,Z:\TEF_SQL\TestData\reference1.bin
[One-h]
// Doesn't actually call ColumnIndex, just gets it on the internal array,
// position 0..
ColumnIndex0=2,*explicit*
// Use position 0, which contains ColumnIndex 2 which is invalid.
ColumnSize1=0,43
[One-i]
// Doesn't actually call ColumnIndex, just gets it on the internal array,
// position 0..
ColumnIndex0=2,*explicit*
// Use position 0, which contains ColumnIndex 2 which is invalid.
ColumnInt1=0,43
[One-j]
// Doesn't actually call ColumnIndex, just gets it on the internal array,
// position 0..
ColumnIndex0=2,*explicit*
// Use position 0, which contains ColumnIndex 2 which is invalid.
ColumnTextL1=0,Banana

// ///////////////////////////////////////////////////////////////////////////

// Attempt to use an RSqlDatabase which isn't open. Not exhaustive..
[Two]
Open0=Z:\TEF_SQL\TestData\test1.db
Close1=
Exec2=Select * from MonkeyPuzzle;
[Two-b]
Open0=Z:\TEF_SQL\TestData\test1.db
Close1=
SetIsolationLevel2=EReadUncommitted
[Two-c]
Open0=Z:\TEF_SQL\TestData\test1.db
Close1=
Attach2=Z:\TEF_SQL\TestData\test1.db,fruitgum
[Two-d]
Open0=Z:\TEF_SQL\TestData\test1.db
Close1=
Detach2=fruitgum
[Two-e]
Open0=Z:\TEF_SQL\TestData\test1.db
Close1=
LastErrorMessage2=
[Two-f]
Open0=Z:\TEF_SQL\TestData\test1.db
Close1=
FreeReservedSpace2=
// Runs a create that should fail, then attempts to run an Exec..
[Two-g]
Create0=A:\wontwork.db
ExpectedError0=KErrNotReady
Exec1=delete * from hello;

// ///////////////////////////////////////////////////////////////////////////

// Try using a Column* call when we've gone off the end of the table, i.e
// Next gave a KSqlAtEnd.
[Three]
Delete0=C:\Panics0.db
ExpectedError0=KErrNotFound
Create1=C:\Panics0.db
Exec2=Create Table Con( Someint int primary key, Somereal real, Sometext text);
Exec3=Insert into Con values(1, 2.0, "Three");
Exec4=Insert into Con values(2, 3.0, "Four");
Exec5=Insert into Con values(3, 4.0, "Five");
Prepare6=select * from Con;
ColumnIndex7=Someint
Next7=KSqlAtRow
Next8=KSqlAtRow
Next9=KSqlAtRow
Next10=KSqlAtEnd
IsNull11=0,false
// Try using a Column* call when we've gone off the end of the table.
[Three-b]
Open0=C:\Panics0.db
Prepare1=select * from Con;
ColumnIndex2=Someint
Next3=KSqlAtRow
Next4=KSqlAtRow
Next5=KSqlAtRow
Next6=KSqlAtEnd
// Try using a Column* call when we've gone off the end of the table.
ColumnSize7=0,123
[Three-c]
Open0=C:\Panics0.db
Prepare1=select * from Con;
ColumnIndex2=Someint
Next3=KSqlAtRow
Next4=KSqlAtRow
Next5=KSqlAtRow
Next6=KSqlAtEnd
// Try using a Column* call when we've gone off the end of the table.
ColumnInt7=0,123
[Three-d]
Open0=C:\Panics0.db
Prepare1=select * from Con;
ColumnIndex2=Someint
Next3=KSqlAtRow
Next4=KSqlAtRow
Next5=KSqlAtRow
Next6=KSqlAtEnd
// Try using a Column* call when we've gone off the end of the table.
ColumnInt64_7=0,123
[Three-e]
Open0=C:\Panics0.db
Prepare1=select * from Con;
ColumnIndex2=Someint
Next3=KSqlAtRow
Next4=KSqlAtRow
Next5=KSqlAtRow
Next6=KSqlAtEnd
// Try using a Column* call when we've gone off the end of the table.
ColumnReal7=0,123
[Three-f]
Open0=C:\Panics0.db
Prepare1=select * from Con;
ColumnIndex2=Someint
Next3=KSqlAtRow
Next4=KSqlAtRow
Next5=KSqlAtRow
Next6=KSqlAtEnd
// Try using a Column* call when we've gone off the end of the table.
// Don't bother with all 3 different columntext methods.
ColumnTextP7=0,123
[Three-g]
Open0=C:\Panics0.db
Prepare1=select * from Con;
ColumnIndex2=Someint
Next3=KSqlAtRow
Next4=KSqlAtRow
Next5=KSqlAtRow
Next6=KSqlAtEnd
// Try using a Column* call when we've gone off the end of the table.
ColumnBinaryD7=0,123
[Three-h]
Open0=C:\Panics0.db
Prepare1=select * from Con;
ColumnIndex2=Someint
Next3=KSqlAtRow
Next4=KSqlAtRow
Next5=KSqlAtRow
Next6=KSqlAtEnd
// Try using a Column* call when we've gone off the end of the table.
StreamReadColText7=0,Z:\TEF_SQL\TestData\reference1.txt
// Use a bad parameter index.
[Three-i]
Open0=C:\Panics0.db
Prepare1=insert into Con(Someint, Somereal) values(:a, :b);
ParameterIndex2=:a
ParameterIndex3=:b
// Parameter index 2 is bad.
ParameterIndex4=2,*explicit*
BindInt5=0,23
BindReal6=1,2.3
// Bang!
BindText7=2,Ivor

// ///////////////////////////////////////////////////////////////////////////

// Use a parameter index which is out of bounds.
[Four]
Open0=C:\Panics0.db
Prepare1=insert into con(Sometext) values (:fred);
ParameterIndex2=:fred
ParameterIndex3=3,*explicit*
BindText4=0,My hovercraft
BindText5=1,is full of eels

// Attempt to find the columntype for a bad columnindex.
[Four-b]
Open0=C:\Panics0.db
Prepare1=select * from Con;
// Slot 0 ok..
ColumnIndex2=Someint
// Setup a bad column index in slot 1..
ColumnIndex3=3,*explicit*
Next4=KSqlAtRow
// Have to be at a row for ColumnType to work. This is because SQLite isn't
// strongly typed.
ColumnType5=0,ESqlInt
ColumnType6=1,kaboom!

// Try doing a Next on an unprepared RSqlStatement.
[Four-c]
Open0=C:\Panics0.db
Next1=Kaboom!

// ///////////////////////////////////////////////////////////////////////////

// Attempt to read a column entry without selecting it.
[Five]
Open0=C:\Panics0.db
Prepare1=select Sometext, Somereal from Con;
ColumnIndex2=Someint
ExpectedError2=KErrNotFound
Next3=KSqlAtRow
// Blows up here.
ColumnInt4=0,1
Next5=KSqlAtRow
ColumnInt6=0,2
Next7=KSqlAtRow
ColumnInt8=0,3
Next9=KSqlAtEnd
EndBlock10=

// ///////////////////////////////////////////////////////////////////////////

// Runs ParameterIndex on a non-existent table.
[Six]
Open0=C:\Panics0.db
Prepare1=Insert into carpet(john, paul, george, ringo) values(:a, :b, :c, :d);
ExpectedError1=KSqlErrGeneral
LastErrorMessage2=
ParameterIndex3=:a

// ///////////////////////////////////////////////////////////////////////////
