sl@0
|
1 |
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// SQL DDL statements
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include "UQ_STD.H"
|
sl@0
|
19 |
|
sl@0
|
20 |
// Class CSqlCreateTableStatement
|
sl@0
|
21 |
|
sl@0
|
22 |
CDbIncremental* CSqlCreateTableStatement::ExecuteL(CDbDatabase& aDatabase,TDbTextComparison,TInt& aStep)
|
sl@0
|
23 |
{
|
sl@0
|
24 |
aDatabase.CreateTableL(iName,iColumns,0);
|
sl@0
|
25 |
aStep=0;
|
sl@0
|
26 |
return 0;
|
sl@0
|
27 |
}
|
sl@0
|
28 |
|
sl@0
|
29 |
// Class CSqlDropTableStatement
|
sl@0
|
30 |
|
sl@0
|
31 |
CDbIncremental* CSqlDropTableStatement::ExecuteL(CDbDatabase& aDatabase,TDbTextComparison,TInt& aStep)
|
sl@0
|
32 |
{
|
sl@0
|
33 |
return aDatabase.DropTableL(iName,aStep);
|
sl@0
|
34 |
}
|
sl@0
|
35 |
|
sl@0
|
36 |
// Class CSqlAlterTableStatement
|
sl@0
|
37 |
|
sl@0
|
38 |
CSqlAlterTableStatement::~CSqlAlterTableStatement()
|
sl@0
|
39 |
{
|
sl@0
|
40 |
iDrop.Close();
|
sl@0
|
41 |
}
|
sl@0
|
42 |
|
sl@0
|
43 |
CDbIncremental* CSqlAlterTableStatement::ExecuteL(CDbDatabase& aDatabase,TDbTextComparison,TInt& aStep)
|
sl@0
|
44 |
{
|
sl@0
|
45 |
CDbColSet* set=CDbColSet::NewLC();
|
sl@0
|
46 |
aDatabase.ColumnsL(*set,iName);
|
sl@0
|
47 |
TInt todrop=iDrop.Count();
|
sl@0
|
48 |
for (TDbColSetIter iter(*set);iter;++iter)
|
sl@0
|
49 |
{
|
sl@0
|
50 |
TInt ii=-1;
|
sl@0
|
51 |
for (;;)
|
sl@0
|
52 |
{
|
sl@0
|
53 |
if (++ii==todrop)
|
sl@0
|
54 |
{
|
sl@0
|
55 |
iAdd.AddL(*iter);
|
sl@0
|
56 |
break;
|
sl@0
|
57 |
}
|
sl@0
|
58 |
if (iter->iName.CompareF(iDrop[ii])==0)
|
sl@0
|
59 |
{
|
sl@0
|
60 |
iDrop.Remove(ii);
|
sl@0
|
61 |
--todrop;
|
sl@0
|
62 |
break;
|
sl@0
|
63 |
}
|
sl@0
|
64 |
}
|
sl@0
|
65 |
}
|
sl@0
|
66 |
if (todrop!=0)
|
sl@0
|
67 |
__LEAVE(KErrNotFound);
|
sl@0
|
68 |
CleanupStack::PopAndDestroy(); // set
|
sl@0
|
69 |
return aDatabase.AlterTableL(iName,iAdd,aStep);
|
sl@0
|
70 |
}
|
sl@0
|
71 |
|
sl@0
|
72 |
// Class CSqlCreateIndexStatement
|
sl@0
|
73 |
|
sl@0
|
74 |
CDbIncremental* CSqlCreateIndexStatement::ExecuteL(CDbDatabase& aDatabase,TDbTextComparison aComparison,TInt& aStep)
|
sl@0
|
75 |
{
|
sl@0
|
76 |
iKey.SetComparison(aComparison);
|
sl@0
|
77 |
return aDatabase.CreateIndexL(iName,iTable,iKey,aStep);
|
sl@0
|
78 |
}
|
sl@0
|
79 |
|
sl@0
|
80 |
// Class CSqlDropIndexStatement
|
sl@0
|
81 |
|
sl@0
|
82 |
CDbIncremental* CSqlDropIndexStatement::ExecuteL(CDbDatabase& aDatabase,TDbTextComparison,TInt& aStep)
|
sl@0
|
83 |
{
|
sl@0
|
84 |
return aDatabase.DropIndexL(iName,iTable,aStep);
|
sl@0
|
85 |
}
|