// Create tests

[create1]
SPCreateL0=
SetDBPolicy1=ESchemaPolicy,ECapabilityAllFiles
SetDBPolicy2=EReadPolicy,ECapabilityAllFiles
CreateSP3=[102827c7]sec.db
SPClose4=
Exec5=create table names(pkey int primary key, fname text, lname text, ref int);
Exec6=insert into names(pkey, fname, lname, ref) values(1, "tom", "jones", 2);
Exec7=insert into names(pkey, fname, lname, ref) values(2, "jim", "davies", 1);
Exec8=insert into names(pkey, fname, lname, ref) values(3, "bob", "smith", 1);
Exec9=insert into names(pkey, fname, lname, ref) values(4, "dave", "house", 3);
Exec10=insert into names(pkey, fname, lname, ref) values(5, "jane", "hobbs", 4);
Close11=
EndBlock12=

[create1a]
SPCreateL0=
SetDBPolicy1=ESchemaPolicy,ECapabilityWriteUserData
SetDBPolicy2=EReadPolicy,ECapabilityWriteUserData
CreateSP3=[102827c7]sec1.db
SPClose4=
Exec5=create table names(pkey int primary key, fname text, lname text, ref int);
Exec6=insert into names(pkey, fname, lname, ref) values(1, "tom", "jones", 2);
Exec7=insert into names(pkey, fname, lname, ref) values(2, "jim", "davies", 1);
Exec8=insert into names(pkey, fname, lname, ref) values(3, "bob", "smith", 1);
Exec9=insert into names(pkey, fname, lname, ref) values(4, "dave", "house", 3);
Exec10=insert into names(pkey, fname, lname, ref) values(5, "jane", "hobbs", 4);
Close11=
EndBlock12=

[create1b]
SPCreate0=
SetDBPolicy1=ESchemaPolicy,ECapabilityAllFiles
SetDBPolicy2=EWritePolicy,ECapabilityAllFiles
SetDBPolicy3=EReadPolicy,ECapabilityWriteUserData
CreateSP4=[102827c7]sec4.db
SPClose5=
Exec6=create table names(pkey int primary key, fname text, lname text, ref int);
Exec7=insert into names(pkey, fname, lname, ref) values(1, "tom", "jones", 2);
Exec8=insert into names(pkey, fname, lname, ref) values(2, "jim", "davies", 1);
Exec9=insert into names(pkey, fname, lname, ref) values(3, "bob", "smith", 1);
Exec10=insert into names(pkey, fname, lname, ref) values(4, "dave", "house", 3);
Exec11=insert into names(pkey, fname, lname, ref) values(5, "jane", "hobbs", 4);
Close12=
EndBlock13=

[create2]
SPCreate0=
SetDBPolicy1=ESchemaPolicy,ECapabilityWriteUserData
CreateSP2=[102827c7]sec2.db
SPClose3=
Exec4=create table names(pkey int primary key, fname text, lname text, ref int);
Exec5=insert into names(pkey, fname, lname, ref) values(1, "tom", "jones", 2);
Exec6=insert into names(pkey, fname, lname, ref) values(2, "jim", "davies", 1);
Exec7=insert into names(pkey, fname, lname, ref) values(3, "bob", "smith", 1);
Exec8=insert into names(pkey, fname, lname, ref) values(4, "dave", "house", 3);
Exec9=insert into names(pkey, fname, lname, ref) values(5, "jane", "hobbs", 4);
Close10=
EndBlock11=

[create3]
SPCreate0=
SetDBPolicy1=ESchemaPolicy,ECapabilityAllFiles
CreateSP2=[102827c7]sec.db
ExpectedError2=KErrPermissionDenied
SPClose3=
EndBlock4=

[create4]
SPCreate0=
SetDBPolicy1=ESchemaPolicy,ECapabilityAllFiles
CreateSP2=[102827c8]sec.db
ExpectedError2=KErrPermissionDenied
SPClose3=
EndBlock4=

[create5]
SPCreate0=
CreateSP1=[102827c7]sec.db
ExpectedError1=KErrPermissionDenied
SPClose2=
EndBlock3=

[create6]
CreateSP0=[102827c7]sec.db
EndBlock1=

[create7]
SPCreate0=
SetDBPolicy1=EReadPolicy,ECapabilityAllFiles
CreateSP2=[102827c7]sec.db
ExpectedError2=KErrPermissionDenied
SPClose3=
EndBlock4=

[create8]
SPCreate0=
SetDBPolicy1=EWritePolicy,ECapabilityAllFiles
CreateSP2=[102827c7]sec.db
ExpectedError2=KErrPermissionDenied
SPClose3=
EndBlock4=

[create9]
SPCreate0=
SetDBPolicy1=EWritePolicy,ECapabilityAllFiles
SetDBPolicy2=EReadPolicy,ECapabilityAllFiles
CreateSP3=[102827c7]sec.db
ExpectedError3=KErrPermissionDenied
SPClose4=
EndBlock5=

[create10]
SPCreate0=
SetDBPolicy1=EWritePolicy,ECapabilityAllFiles
SetDBPolicy2=EReadPolicy,ECapabilityAllFiles
SetDBPolicy2=ESchemaPolicy,ECapabilityAllFiles
CreateSP3=[102827c7]sec3.db
ExpectedError3=KErrPermissionDenied
SPClose4=
EndBlock5=

[create11]
SPCreate0=
SetDBPolicy1=ESchemaPolicy,ECapabilityWriteUserData
CreateSP2=[102827c8]sec.db
SPClose3=
Exec4=create table names(pkey int primary key, fname text, lname text, ref int);
Exec5=insert into names(pkey, fname, lname, ref) values(1, "tom", "jones", 2);
Exec6=insert into names(pkey, fname, lname, ref) values(2, "jim", "davies", 1);
Exec7=insert into names(pkey, fname, lname, ref) values(3, "bob", "smith", 1);
Exec8=insert into names(pkey, fname, lname, ref) values(4, "dave", "house", 3);
Exec9=insert into names(pkey, fname, lname, ref) values(5, "jane", "hobbs", 4);
Close10=
EndBlock11=

[create12]
Create0=c:\private\102827c7\sec.db
Exec1=create table names(pkey int primary key, fname text, lname text, ref int);
Exec2=insert into names(pkey, fname, lname, ref) values(1, "tom", "jones", 2);
Exec3=insert into names(pkey, fname, lname, ref) values(2, "jim", "davies", 1);
Exec4=insert into names(pkey, fname, lname, ref) values(3, "bob", "smith", 1);
Exec5=insert into names(pkey, fname, lname, ref) values(4, "dave", "house", 3);
Exec6=insert into names(pkey, fname, lname, ref) values(5, "jane", "hobbs", 4);
Close7=
EndBlock8=

[create12a]
Create0=c:\private\102827c8\sec.db
ExpectedError0=KErrPermissionDenied
EndBlock1=

[create12b]
Create0=c:\private\102827c8\sec3.db
Exec1=create table names(pkey int primary key, fname text, lname text, ref int);
Exec2=insert into names(pkey, fname, lname, ref) values(1, "tom", "jones", 2);
Exec3=insert into names(pkey, fname, lname, ref) values(2, "jim", "davies", 1);
Exec4=insert into names(pkey, fname, lname, ref) values(3, "bob", "smith", 1);
Exec5=insert into names(pkey, fname, lname, ref) values(4, "dave", "house", 3);
Exec6=insert into names(pkey, fname, lname, ref) values(5, "jane", "hobbs", 4);
Close7=
EndBlock8=

// Read tests

[read1]
Open0=[102827c7]sec.db
Prepare1=select count(*) from names;
ColumnIndex2=
Next3=
ColumnInt4=0,5
St_Close5=
Close6=[102827c7]sec.db
EndBlock7=

[read2]
Open0=[102827c8]sec.db
Prepare1=select count(*) from names;
ColumnIndex2=
Next3=
ColumnInt4=0,5
St_Close5=
Close6=[102827c8]sec.db
EndBlock7=

[read3]
Open0=[102827c7]sec.db
ExpectedError0=KErrPermissionDenied
Close1=[102827c7]sec.db
EndBlock2=

[read4]
Open0=[102827c7]sec1.db
Prepare1=select count(*) from names;
ColumnIndex2=
Next3=
ColumnInt4=0,5
St_Close5=
Close6=[102827c7]sec1.db
EndBlock7=

// Write tests

[write1]
Open0=[102827c7]sec4.db
Prepare1=select count(*) from names;
ColumnIndex2=
Next3=
ColumnInt4=0,5
St_Close5=
Exec6=insert into names(pkey, fname, lname, ref) values(6, "new", "starter", 1);
ExpectedError6=KErrPermissionDenied
Prepare7=select count(*) from names;
ColumnIndex8=
Next9=
ColumnInt10=0,5
St_Close11=
Close12=[102827c7]sec4.db
EndBlock13=

[write2]
Open0=[102827c7]sec4.db
Prepare1=select count(*) from names;
ColumnIndex2=
Next3=
ColumnInt4=0,5
St_Close5=
Exec6=insert into names(pkey, fname, lname, ref) values(6, "new", "starter", 1);
Prepare7=select count(*) from names;
ColumnIndex8=
Next9=
ColumnInt10=0,6
St_Close11=
Close12=[102827c7]sec4.db
EndBlock13=

// Schema tests

[schema1]
Open0=[102827c7]sec4.db
Exec1=create table newtab(pkey int primary key, fname text, lname text, ref int);
ExpectedError1=KErrPermissionDenied
Close2=
EndBlock3=

[schema2]
Open0=[102827c7]sec4.db
Exec1=create table newtab(pkey int primary key, fname text, lname text, ref int);
Close2=
EndBlock3=

// Attach tests

[attach1]
Open0=[102827c7]sec1.db
Prepare1=select count(*) from names;
ColumnIndex2=
Next3=
ColumnInt4=0,5
St_Close5=
Exec6=attach "C:\private\10281e17\[102827c7]sec1.db" as [102827c7]sec1
ExpectedError6=KErrPermissionDenied
Close7=
EndBlock8=

[attach2]
Open0=[102827c7]sec.db
Prepare1=select count(*) from names;
ColumnIndex2=
Next3=
ColumnInt4=0,5
St_Close5=
Attach6=C:[102827c7]sec1.db,fred
Prepare7=select count(*) from fred.names;
ColumnIndex8=
Next9=
ColumnInt10=0,5
St_Close11=
Detach12=fred
Prepare13=select count(*) from fred.names;
ExpectedError13=KSqlErrGeneral
Close14=
EndBlock15=

[attach3]
Open0=[102827c7]sec1.db
Prepare1=select count(*) from names;
ColumnIndex2=
Next3=
ColumnInt4=0,5
St_Close5=
Attach6=C:[102827c7]sec.db,tom
ExpectedError6=KErrPermissionDenied
Close7=
EndBlock8=

[attach4]
Open0=[102827c7]sec.db
Prepare1=select count(*) from names;
ColumnIndex2=
Next3=
ColumnInt4=0,5
St_Close5=
Attach6=c:\private\102827c7\sec.db,bob
Prepare7=select count(*) from bob.names;
ColumnIndex8=
Next9=
ColumnInt10=0,5
St_Close11=
Detach12=bob
Prepare13=select count(*) from bob.names;
ExpectedError13=KSqlErrGeneral
Close14=
EndBlock15=

[attach5]
Open0=c:\private\102827c7\sec.db
Prepare1=select count(*) from names;
ColumnIndex2=
Next3=
ColumnInt4=0,5
St_Close5=
Attach6=[102827c7]sec.db,bob
Prepare7=select count(*) from bob.names;
ColumnIndex8=
Next9=
ColumnInt10=0,5
St_Close11=
Detach12=bob
Prepare13=select count(*) from bob.names;
ExpectedError13=KSqlErrGeneral
Close14=
EndBlock15=

[attach6]
// this is the test case where we try to cheat ATTACH by passing in arguments that will execute SQL while the authorizer is disabled.
Open0=[102827c7]sec.db
Prepare1=select count(*) from names;
ColumnIndex2=
Next3=
ColumnInt4=0,5
St_Close5=
Attach6=[102827c7]sec1.db' AS fred; delete from names;,fred2
ExpectedError6=KSqlErrGeneral
Prepare7=select count(*) from names;
ColumnIndex8=
Next9=
ColumnInt10=0,5
St_Close11=
Prepare12=select count(*) from fred.names;
ColumnIndex13=
Next14=
ColumnInt15=0,5
St_Close16=
Detach17=fred
Prepare18=select count(*) from fred.names;
ExpectedError18=KSqlErrGeneral
Close19=
EndBlock20=

// Copy tests

[copy1]
Copy0=[102827c7]sec.db,C:\sec_dest.db
ExpectedError0=KErrPermissionDenied
EndBlock1=

[copy2]
Create0=C:\[102827c7]sec_source.db
Copy1=C:\[102827c7]sec.db,[102827c7]sec_dest.db
ExpectedError1=KErrPermissionDenied
Close2=
Delete3=C:\[102827c7]sec_source.db
EndBlock4=

[copy3]
Copy0=C:\private\102827c7\sec.db,[102827c7]sec_dest.db
ExpectedError0=KErrPermissionDenied
EndBlock1=

[copy4]
Copy0=[102827c7]sec.db,C:\private\102827c7\sec_dest.db
ExpectedError0=KErrPermissionDenied
EndBlock1=

[copy5]
Copy0=[102827c7]sec.db,[102827c7]sec_copy.db
EndBlock1=

[copy6]
Copy0=C:\private\102827c7\sec.db, C:\private\102827c7\sec_copy.db
ExpectedError0=KErrPermissionDenied
EndBlock1=

[copy7]
Copy0=C:\private\102827c7\sec.db, C:\sec_copy.db
ExpectedError0=KErrPermissionDenied
EndBlock1=


// Concurrency tests


// Policy check tests

[policy1]
SPCreateL0=
SetDBPolicy1=ESchemaPolicy,ECapabilityWriteUserData
SetDBPolicy2=EReadPolicy,ECapabilityWriteUserData
SetPolicy3=ETable,names,EWritePolicy,ECapabilityAllFiles
SetPolicy4=ETable,names,EReadPolicy,ECapabilityAllFiles
CreateSP5=[102827c7]secpol.db
SPClose6=
Exec7=create table names(pkey int primary key, fname text, lname text, ref int);
Exec8=insert into names(pkey, fname, lname, ref) values(1, "tom", "jones", 2);
Exec9=insert into names(pkey, fname, lname, ref) values(2, "jim", "davies", 1);
Exec10=insert into names(pkey, fname, lname, ref) values(3, "bob", "smith", 1);
Exec11=insert into names(pkey, fname, lname, ref) values(4, "dave", "house", 3);
Exec12=insert into names(pkey, fname, lname, ref) values(5, "jane", "hobbs", 4);
Close13=
EndBlock14=

[policy2]
Open0=[102827c7]secpol.db
Prepare1=select count(*) from names;
ColumnIndex2=
Next3=
ColumnInt4=0,5
St_Close5=
Exec6=insert into names(pkey, fname, lname, ref) values(6, "new", "starter", 1);
Prepare7=select count(*) from names;
ColumnIndex8=
Next9=
ColumnInt10=0,6
St_Close11=
Close12=
EndBlock13=

[policy3]
// this test has been deferred as it has duplicated a developer test
SPCreateL0=
SetDBPolicy1=ESchemaPolicy,ECapabilityWriteUserData
SetDBPolicy2=EReadPolicy,ECapabilityWriteUserData
SetPolicy3=ETable,names,EWritePolicy,ECapabilityAllFiles
SetPolicy4=ETable,names,EReadPolicy,ECapabilityAllFiles
CreateSP5=[102827c7]secpol1.db

Exec7=create table names(pkey int primary key, fname text, lname text, ref int);
Exec8=insert into names(pkey, fname, lname, ref) values(1, "tom", "jones", 2);
Exec9=insert into names(pkey, fname, lname, ref) values(2, "jim", "davies", 1);
Exec10=insert into names(pkey, fname, lname, ref) values(3, "bob", "smith", 1);
Exec11=insert into names(pkey, fname, lname, ref) values(4, "dave", "house", 3);
Exec12=insert into names(pkey, fname, lname, ref) values(5, "jane", "hobbs", 4);
Close13=
Function14=SecurityPolicyCheck

SPClose6=
EndBlock14=


// Inernalize & Externalize tests

[External1]
SPCreate0=
SetDBPolicy1=ESchemaPolicy,ECapabilityAllFiles
SetDBPolicy2=EReadPolicy,ECapabilityAllFiles
SetPolicy3=ETable,names,EWritePolicy,ECapabilityAllFiles
Delete4=c:\ext.pol
ExpectedError4=KErrNotFound
SPExternalizeL5=c:\ext.pol
EndBlock6=

[External2]
SPCreate0=
SPInternalizeL1=c:\ext.pol
CreateSP2=[102827c7]ext.db
SPClose3=
Exec4=create table names(pkey int primary key, fname text, lname text, ref int);
Exec5=insert into names(pkey, fname, lname, ref) values(1, "tom", "jones", 2);
Exec6=insert into names(pkey, fname, lname, ref) values(2, "jim", "davies", 1);
Exec7=insert into names(pkey, fname, lname, ref) values(3, "bob", "smith", 1);
Exec8=insert into names(pkey, fname, lname, ref) values(4, "dave", "house", 3);
Exec9=insert into names(pkey, fname, lname, ref) values(5, "jane", "hobbs", 4);
Close10=
EndBlock11=

[External3]
Open0=[102827c7]ext.db
ExpectedError0=KErrPermissionDenied
Close1=[102827c7]ext.db
EndBlock2=

