sl@0: // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // SQL DDL statements sl@0: // sl@0: // sl@0: sl@0: #include "UQ_STD.H" sl@0: sl@0: // Class CSqlCreateTableStatement sl@0: sl@0: CDbIncremental* CSqlCreateTableStatement::ExecuteL(CDbDatabase& aDatabase,TDbTextComparison,TInt& aStep) sl@0: { sl@0: aDatabase.CreateTableL(iName,iColumns,0); sl@0: aStep=0; sl@0: return 0; sl@0: } sl@0: sl@0: // Class CSqlDropTableStatement sl@0: sl@0: CDbIncremental* CSqlDropTableStatement::ExecuteL(CDbDatabase& aDatabase,TDbTextComparison,TInt& aStep) sl@0: { sl@0: return aDatabase.DropTableL(iName,aStep); sl@0: } sl@0: sl@0: // Class CSqlAlterTableStatement sl@0: sl@0: CSqlAlterTableStatement::~CSqlAlterTableStatement() sl@0: { sl@0: iDrop.Close(); sl@0: } sl@0: sl@0: CDbIncremental* CSqlAlterTableStatement::ExecuteL(CDbDatabase& aDatabase,TDbTextComparison,TInt& aStep) sl@0: { sl@0: CDbColSet* set=CDbColSet::NewLC(); sl@0: aDatabase.ColumnsL(*set,iName); sl@0: TInt todrop=iDrop.Count(); sl@0: for (TDbColSetIter iter(*set);iter;++iter) sl@0: { sl@0: TInt ii=-1; sl@0: for (;;) sl@0: { sl@0: if (++ii==todrop) sl@0: { sl@0: iAdd.AddL(*iter); sl@0: break; sl@0: } sl@0: if (iter->iName.CompareF(iDrop[ii])==0) sl@0: { sl@0: iDrop.Remove(ii); sl@0: --todrop; sl@0: break; sl@0: } sl@0: } sl@0: } sl@0: if (todrop!=0) sl@0: __LEAVE(KErrNotFound); sl@0: CleanupStack::PopAndDestroy(); // set sl@0: return aDatabase.AlterTableL(iName,iAdd,aStep); sl@0: } sl@0: sl@0: // Class CSqlCreateIndexStatement sl@0: sl@0: CDbIncremental* CSqlCreateIndexStatement::ExecuteL(CDbDatabase& aDatabase,TDbTextComparison aComparison,TInt& aStep) sl@0: { sl@0: iKey.SetComparison(aComparison); sl@0: return aDatabase.CreateIndexL(iName,iTable,iKey,aStep); sl@0: } sl@0: sl@0: // Class CSqlDropIndexStatement sl@0: sl@0: CDbIncremental* CSqlDropIndexStatement::ExecuteL(CDbDatabase& aDatabase,TDbTextComparison,TInt& aStep) sl@0: { sl@0: return aDatabase.DropIndexL(iName,iTable,aStep); sl@0: }