[sqlite] select query problem in symbian c++

2009-07-27 Thread rahul . makode
i am executing this query to get UserNamePasswordHash and i am setting
value of variable   UserID


err = stmt.Prepare(db, _L("SELECT UserNamePasswordHash FROM User WHERE
UserID=:UserID"));

//TInt err = stmt.Prepare(database, _L("SELECT BinaryField FROM 
Tbl1"));

TInt columnIndex = stmt.ColumnIndex(_L("UserNamePasswordHash"));

while((err = stmt.Next()) == KSqlAtRow)
{

TInt size = stmt. ColumnSize(columnIndex);

HBufC8* buf = HBufC8::NewL(size);

TPtr8 bufferPtr1 (buf->Des());


err = stmt.ColumnBinary(columnIndex,bufferPtr1);


iChitDemoAppUi->BinaryToString(bufferPtr1,usernamePasswordHash);

iChitDemoAppUi->Log(bufferPtr1);

delete buf;

}

query is executing properly but i am not getting data in buf
if i used hardcoded then it is executed properly in symbian


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] sqlite db2 error in symbian

2009-07-26 Thread rahul . makode
i am writing this query to insert data in symbian but i am getting
err1=-311 and sqldb2 error in symbia


{

TInt err1 =stmt.Prepare(db,_L("INSERT INTO
MyContacts(ServerContactID,UserName,FirstName,LastName,Country,IsBlocked,RequestStatus,MarkForDeletion)
VALUES(:ServerContactID,:UserName,:FirstName,:LastName,:Country,:IsBlocked,:RequestStatus,:MarkForDeletion)"));

//,:TimeStamp,:MobileNumber,:OfficePh,:Address1,:Address2,:Email,:HomePh

error.AppendNum(err1);

iChitDemoAppUi->Log(_L8("error code "));

iChitDemoAppUi->Log(error);

TInt paramIndex1 = 
stmt.ParameterIndex(_L(":ServerContactID"));


TInt paramIndex2 = stmt.ParameterIndex(_L(":UserName"));
TInt paramIndex3 = 
stmt.ParameterIndex(_L(":FirstName"));
TInt paramIndex4 = stmt.ParameterIndex(_L(":LastName"));
TInt paramIndex5 = stmt.ParameterIndex(_L(":Country"));
TInt paramIndex6 = 
stmt.ParameterIndex(_L(":IsBlocked"));
TInt paramIndex7 = 
stmt.ParameterIndex(_L(":RequestStatus"));
TInt paramIndex8 = 
stmt.ParameterIndex(_L(":MarkForDeletion"));


err1= stmt.BindInt(paramIndex1,userID);

error.AppendNum(err1);

iChitDemoAppUi->Log(_L8("error code  "));

iChitDemoAppUi->Log(error);

iChitDemoAppUi->Log(_L8("inside addContacts "));
err1 = stream.BindText(stmt, paramIndex2);
temp.Append(username);
stream.WriteL(temp);
temp.Zero();
stream.Close();

err1 = stream.BindText(stmt, paramIndex3);
temp.Append(firstName);
stream.WriteL(temp);
temp.Zero();
stream.Close();

err1 = stream.BindText(stmt, paramIndex4);
temp.Append(LastName);
stream.WriteL(temp);
temp.Zero();
stream.Close();

err1 = stream.BindText(stmt, paramIndex5);
temp.Append(CountryName);
stream.WriteL(temp);
temp.Zero();
stream.Close();

err1= stmt.BindInt(paramIndex6, isBlocked);

err1 = stream.BindText(stmt, paramIndex7);
temp.Append(requestStatus);
stream.WriteL(temp);
temp.Zero();
stream.Close();

err1= stmt.BindInt(paramIndex8,markForDeletion);


//TimeStamp,MobileNumber,OfficePh,Address1,Address2,Email,HomePh

err1 = stmt.Exec();
stream.Close();
stmt.Reset();

}


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users