1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
132 KErrArgument, bad argument, for example - the SQL string contains more than one SQL statements. |
132 KErrArgument, bad argument, for example - the SQL string contains more than one SQL statements. |
133 Note that the function may leave with some database specific errors categorised as |
133 Note that the function may leave with some database specific errors categorised as |
134 ESqlDbError or other system-wide error codes; |
134 ESqlDbError or other system-wide error codes; |
135 KErrNone Operation has completed successfully. |
135 KErrNone Operation has completed successfully. |
136 |
136 |
|
137 @panic SqlDb 7 In _DEBUG mode, invalid column count. |
|
138 |
137 @see CSqlStatementImpl::New() |
139 @see CSqlStatementImpl::New() |
138 */ |
140 */ |
139 template <class DES> TInt CSqlStatementImpl::Construct(CSqlDatabaseImpl& aDatabase, const DES& aSqlStmt) |
141 template <class DES> TInt CSqlStatementImpl::Construct(CSqlDatabaseImpl& aDatabase, const DES& aSqlStmt) |
140 { |
142 { |
141 TInt err = iSqlStmtSession.Prepare(aDatabase.Session(), aSqlStmt, iColumnCnt, iParamCnt); |
143 TInt err = iSqlStmtSession.Prepare(aDatabase.Session(), aSqlStmt, iColumnCnt, iParamCnt); |
142 if(err != KErrNone) |
144 if(err != KErrNone) |
143 { |
145 { |
144 return err; |
146 return err; |
145 } |
147 } |
146 if(iColumnCnt >= 0) |
148 __SQLASSERT(iColumnCnt >= 0, ESqlPanicInternalError); |
147 { |
149 err = iColumnValueBuf.SetCount(iColumnCnt); |
148 err = iColumnValueBuf.SetCount(iColumnCnt); |
150 if(err != KErrNone) |
149 if(err != KErrNone) |
151 { |
150 { |
152 return err; |
151 return err; |
153 } |
152 } |
154 iColumnValBufIt.Set(iColumnValueBuf); |
153 iColumnValBufIt.Set(iColumnValueBuf); |
|
154 } |
|
155 if(iParamCnt > 0) |
155 if(iParamCnt > 0) |
156 { |
156 { |
157 err = iParamValueBuf.SetCount(iParamCnt); |
157 err = iParamValueBuf.SetCount(iParamCnt); |
158 if(err != KErrNone) |
158 if(err != KErrNone) |
159 { |
159 { |