equal
deleted
inserted
replaced
31 @panic SqlDb 4 In _DEBUG mode. Parameter index negative. |
31 @panic SqlDb 4 In _DEBUG mode. Parameter index negative. |
32 */ |
32 */ |
33 inline HSqlSrvStmtParamBuf* HSqlSrvStmtParamBuf::NewL(CSqlSrvStatement& aStatement, TInt aParamIndex, |
33 inline HSqlSrvStmtParamBuf* HSqlSrvStmtParamBuf::NewL(CSqlSrvStatement& aStatement, TInt aParamIndex, |
34 HSqlSrvStmtParamBuf::TDataType aDataType, HSqlSrvStmtParamBuf::TBufType aBufType) |
34 HSqlSrvStmtParamBuf::TDataType aDataType, HSqlSrvStmtParamBuf::TBufType aBufType) |
35 { |
35 { |
36 __SQLASSERT(aParamIndex >= 0, ESqlPanicBadArgument); |
36 __ASSERT_DEBUG(aParamIndex >= 0, __SQLPANIC2(ESqlPanicBadArgument)); |
37 HSqlSrvStmtParamBuf* self = new (ELeave) HSqlSrvStmtParamBuf(aStatement, aParamIndex, aDataType, aBufType); |
37 HSqlSrvStmtParamBuf* self = new (ELeave) HSqlSrvStmtParamBuf(aStatement, aParamIndex, aDataType, aBufType); |
38 self->PushL(); |
38 self->PushL(); |
39 self->ConstructL(); |
39 self->ConstructL(); |
40 CleanupStack::Pop(); |
40 CleanupStack::Pop(); |
41 return self; |
41 return self; |
51 |
51 |
52 @panic SqlDb 2 In _DEBUG mode. Invalid HSqlSrvStmtParamBuf object. |
52 @panic SqlDb 2 In _DEBUG mode. Invalid HSqlSrvStmtParamBuf object. |
53 */ |
53 */ |
54 inline void HSqlSrvStmtParamBuf::Reset(HSqlSrvStmtParamBuf::TDataType aDataType, HSqlSrvStmtParamBuf::TBufType aBufType) |
54 inline void HSqlSrvStmtParamBuf::Reset(HSqlSrvStmtParamBuf::TDataType aDataType, HSqlSrvStmtParamBuf::TBufType aBufType) |
55 { |
55 { |
56 __SQLASSERT(iBuf != NULL, ESqlPanicInvalidObj); |
56 __ASSERT_DEBUG(iBuf != NULL, __SQLPANIC(ESqlPanicInvalidObj)); |
57 |
57 |
58 iStatementFinalized = EFalse; |
58 iStatementFinalized = EFalse; |
59 iAlive = ETrue; |
59 iAlive = ETrue; |
60 iDataType = aDataType; |
60 iDataType = aDataType; |
61 iBufType = aBufType; |
61 iBufType = aBufType; |
63 |
63 |
64 iBuf->Delete(0, iBuf->Size()); |
64 iBuf->Delete(0, iBuf->Size()); |
65 if(iBuf->Capacity() > (HSqlSrvStmtParamBuf::EExpandSize * 2)) |
65 if(iBuf->Capacity() > (HSqlSrvStmtParamBuf::EExpandSize * 2)) |
66 { |
66 { |
67 TRAPD(err, iBuf->SetReserveL(HSqlSrvStmtParamBuf::EExpandSize * 2));//the buffer size is minimized, the call can't fail |
67 TRAPD(err, iBuf->SetReserveL(HSqlSrvStmtParamBuf::EExpandSize * 2));//the buffer size is minimized, the call can't fail |
68 __SQLASSERT_ALWAYS(err == KErrNone, ESqlPanicInternalError); |
68 __ASSERT_ALWAYS(err == KErrNone, __SQLPANIC(ESqlPanicInternalError)); |
69 } |
69 } |
70 Set(*iBuf, 0, MStreamBuf::ERead | MStreamBuf::EWrite); |
70 Set(*iBuf, 0, MStreamBuf::ERead | MStreamBuf::EWrite); |
71 } |
71 } |
72 |
72 |
73 /** |
73 /** |
81 @panic SqlDb 2 In _DEBUG mode. Invalid HSqlSrvStmtParamBuf object. |
81 @panic SqlDb 2 In _DEBUG mode. Invalid HSqlSrvStmtParamBuf object. |
82 @panic SqlDb 7 In _DEBUG mode. The buffer type is not HSqlSrvStmtParamBuf::EBufSimpleBind |
82 @panic SqlDb 7 In _DEBUG mode. The buffer type is not HSqlSrvStmtParamBuf::EBufSimpleBind |
83 */ |
83 */ |
84 inline const TPtrC8 HSqlSrvStmtParamBuf::SetDataL(const TDesC8& aData) |
84 inline const TPtrC8 HSqlSrvStmtParamBuf::SetDataL(const TDesC8& aData) |
85 { |
85 { |
86 __SQLASSERT(iBuf != NULL, ESqlPanicInvalidObj); |
86 __ASSERT_DEBUG(iBuf != NULL, __SQLPANIC(ESqlPanicInvalidObj)); |
87 __SQLASSERT(iBufType == HSqlSrvStmtParamBuf::EBufSimpleBind, ESqlPanicInternalError); |
87 __ASSERT_DEBUG(iBufType == HSqlSrvStmtParamBuf::EBufSimpleBind, __SQLPANIC(ESqlPanicInternalError)); |
88 iBuf->ResizeL(aData.Length()); |
88 iBuf->ResizeL(aData.Length()); |
89 iBuf->Write(0, aData); |
89 iBuf->Write(0, aData); |
90 return iBuf->Ptr(0); |
90 return iBuf->Ptr(0); |
91 } |
91 } |
92 |
92 |
97 |
97 |
98 @panic SqlDb 2 In _DEBUG mode. Invalid HSqlSrvStmtParamBuf object. |
98 @panic SqlDb 2 In _DEBUG mode. Invalid HSqlSrvStmtParamBuf object. |
99 */ |
99 */ |
100 inline const TPtrC8 HSqlSrvStmtParamBuf::Data() const |
100 inline const TPtrC8 HSqlSrvStmtParamBuf::Data() const |
101 { |
101 { |
102 __SQLASSERT(iBuf != NULL, ESqlPanicInvalidObj); |
102 __ASSERT_DEBUG(iBuf != NULL, __SQLPANIC(ESqlPanicInvalidObj)); |
103 return iBuf->Ptr(0); |
103 return iBuf->Ptr(0); |
104 } |
104 } |
105 |
105 |
106 /** |
106 /** |
107 @return Buffered parameter value type - binary, text8 or text16. |
107 @return Buffered parameter value type - binary, text8 or text16. |
118 |
118 |
119 @return Parameter index, zero based. |
119 @return Parameter index, zero based. |
120 */ |
120 */ |
121 inline TInt HSqlSrvStmtParamBuf::ParamIndex() const |
121 inline TInt HSqlSrvStmtParamBuf::ParamIndex() const |
122 { |
122 { |
123 __SQLASSERT(iParamIndex >= 0, ESqlPanicInternalError); |
123 __ASSERT_DEBUG(iParamIndex >= 0, __SQLPANIC(ESqlPanicInternalError)); |
124 return iParamIndex; |
124 return iParamIndex; |
125 } |
125 } |
126 |
126 |
127 /** |
127 /** |
128 Initializes the HSqlSrvStmtParamBuf instance data members. |
128 Initializes the HSqlSrvStmtParamBuf instance data members. |
178 @panic SqlDb 2 In _DEBUG mode. Invalid (not created) CSqlSrvStatement object. |
178 @panic SqlDb 2 In _DEBUG mode. Invalid (not created) CSqlSrvStatement object. |
179 @panic SqlDb 7 In _DEBUG mode. SQLITE internal error. (SQLITE_ERROR, followed by a sqlite3_reset(), which returns SQLITE_OK) |
179 @panic SqlDb 7 In _DEBUG mode. SQLITE internal error. (SQLITE_ERROR, followed by a sqlite3_reset(), which returns SQLITE_OK) |
180 */ |
180 */ |
181 inline TInt CSqlSrvStatement::Next() |
181 inline TInt CSqlSrvStatement::Next() |
182 { |
182 { |
183 __SQLASSERT(iStmtHandle != NULL, ESqlPanicInvalidObj); |
183 __ASSERT_DEBUG(iStmtHandle != NULL, __SQLPANIC(ESqlPanicInvalidObj)); |
184 TInt err = ::StmtNext(iStmtHandle); |
184 TInt err = ::StmtNext(iStmtHandle); |
185 iBufFlatType = static_cast <TSqlBufFlatType> (-1); |
185 iBufFlatType = static_cast <TSqlBufFlatType> (-1); |
186 iBufFlat.ResetAndMinimize(); |
186 iBufFlat.ResetAndMinimize(); |
187 return err; |
187 return err; |
188 } |
188 } |
198 |
198 |
199 @panic SqlDb 2 In _DEBUG mode. Invalid (not created) CSqlSrvStatement object. |
199 @panic SqlDb 2 In _DEBUG mode. Invalid (not created) CSqlSrvStatement object. |
200 */ |
200 */ |
201 inline TInt CSqlSrvStatement::Reset() |
201 inline TInt CSqlSrvStatement::Reset() |
202 { |
202 { |
203 __SQLASSERT(iStmtHandle != NULL, ESqlPanicInvalidObj); |
203 __ASSERT_DEBUG(iStmtHandle != NULL, __SQLPANIC(ESqlPanicInvalidObj)); |
204 iBufFlatType = static_cast <TSqlBufFlatType> (-1); |
204 iBufFlatType = static_cast <TSqlBufFlatType> (-1); |
205 iBufFlat.ResetAndMinimize(); |
205 iBufFlat.ResetAndMinimize(); |
206 return ::StmtReset(iStmtHandle); |
206 return ::StmtReset(iStmtHandle); |
207 } |
207 } |
208 |
208 |
217 @panic SqlDb 2 In _DEBUG mode. Invalid (not created) CSqlSrvStatement object. |
217 @panic SqlDb 2 In _DEBUG mode. Invalid (not created) CSqlSrvStatement object. |
218 @panic SqlDb 7 In _DEBUG mode. SQLITE internal error. (SQLITE_ERROR, followed by a sqlite3_reset(), which returns SQLITE_OK) |
218 @panic SqlDb 7 In _DEBUG mode. SQLITE internal error. (SQLITE_ERROR, followed by a sqlite3_reset(), which returns SQLITE_OK) |
219 */ |
219 */ |
220 inline TInt CSqlSrvStatement::Exec() |
220 inline TInt CSqlSrvStatement::Exec() |
221 { |
221 { |
222 __SQLASSERT(iStmtHandle != NULL, ESqlPanicInvalidObj); |
222 __ASSERT_DEBUG(iStmtHandle != NULL, __SQLPANIC(ESqlPanicInvalidObj)); |
223 TInt err = ::StmtExec(iStmtHandle); |
223 TInt err = ::StmtExec(iStmtHandle); |
224 iBufFlatType = static_cast <TSqlBufFlatType> (-1); |
224 iBufFlatType = static_cast <TSqlBufFlatType> (-1); |
225 iBufFlat.ResetAndMinimize(); |
225 iBufFlat.ResetAndMinimize(); |
226 return err; |
226 return err; |
227 } |
227 } |
229 /** |
229 /** |
230 @panic SqlDb 2 In _DEBUG mode. Invalid (not created) CSqlSrvStatement object. |
230 @panic SqlDb 2 In _DEBUG mode. Invalid (not created) CSqlSrvStatement object. |
231 */ |
231 */ |
232 inline const RSqlBufFlat& CSqlSrvStatement::BufFlatL(TSqlBufFlatType aWhat) const |
232 inline const RSqlBufFlat& CSqlSrvStatement::BufFlatL(TSqlBufFlatType aWhat) const |
233 { |
233 { |
234 __SQLASSERT(iStmtHandle != NULL, ESqlPanicInvalidObj); |
234 __ASSERT_DEBUG(iStmtHandle != NULL, __SQLPANIC(ESqlPanicInvalidObj)); |
235 if(aWhat != iBufFlatType) |
235 if(aWhat != iBufFlatType) |
236 { |
236 { |
237 __SQLLEAVE(KErrArgument); |
237 __SQLLEAVE(KErrArgument); |
238 } |
238 } |
239 return iBufFlat; |
239 return iBufFlat; |
258 |
258 |
259 @panic SqlDb 4 In _DEBUG mode. aDbHandle is NULL. |
259 @panic SqlDb 4 In _DEBUG mode. aDbHandle is NULL. |
260 */ |
260 */ |
261 inline void CSqlSrvStatement::ConstructL(sqlite3* aDbHandle, const TDesC16& aSqlStmt) |
261 inline void CSqlSrvStatement::ConstructL(sqlite3* aDbHandle, const TDesC16& aSqlStmt) |
262 { |
262 { |
263 __SQLASSERT(aDbHandle != NULL, ESqlPanicBadArgument); |
263 __ASSERT_DEBUG(aDbHandle != NULL, __SQLPANIC(ESqlPanicBadArgument)); |
264 iStmtHandle = ::StmtPrepare16L(aDbHandle, aSqlStmt); |
264 iStmtHandle = ::StmtPrepare16L(aDbHandle, aSqlStmt); |
265 DoCommonConstructL(); |
265 DoCommonConstructL(); |
266 } |
266 } |
267 |
267 |
268 /** |
268 /** |
278 |
278 |
279 @panic SqlDb 4 In _DEBUG mode. aDbHandle is NULL. |
279 @panic SqlDb 4 In _DEBUG mode. aDbHandle is NULL. |
280 */ |
280 */ |
281 inline void CSqlSrvStatement::ConstructL(sqlite3* aDbHandle, const TDesC8& aSqlStmt) |
281 inline void CSqlSrvStatement::ConstructL(sqlite3* aDbHandle, const TDesC8& aSqlStmt) |
282 { |
282 { |
283 __SQLASSERT(aDbHandle != NULL, ESqlPanicBadArgument); |
283 __ASSERT_DEBUG(aDbHandle != NULL, __SQLPANIC(ESqlPanicBadArgument)); |
284 iStmtHandle = ::StmtPrepare8L(aDbHandle, aSqlStmt); |
284 iStmtHandle = ::StmtPrepare8L(aDbHandle, aSqlStmt); |
285 DoCommonConstructL(); |
285 DoCommonConstructL(); |
286 } |
286 } |