Click here to Skip to main content
15,913,101 members
Home / Discussions / Database
   

Database

 
AnswerRe: How to query exclusion? SQL Help needed Pin
Kyudos16-Aug-10 17:44
Kyudos16-Aug-10 17:44 
GeneralRe: How to query exclusion? SQL Help needed Pin
Mycroft Holmes16-Aug-10 18:22
professionalMycroft Holmes16-Aug-10 18:22 
GeneralRe: How to query exclusion? SQL Help needed Pin
Kyudos17-Aug-10 10:46
Kyudos17-Aug-10 10:46 
GeneralRe: How to query exclusion? SQL Help needed Pin
Kyudos17-Aug-10 13:18
Kyudos17-Aug-10 13:18 
GeneralRe: How to query exclusion? SQL Help needed Pin
Mycroft Holmes17-Aug-10 13:31
professionalMycroft Holmes17-Aug-10 13:31 
GeneralRe: How to query exclusion? SQL Help needed Pin
Kyudos18-Aug-10 11:10
Kyudos18-Aug-10 11:10 
GeneralRe: How to query exclusion? SQL Help needed Pin
Kyudos17-Aug-10 13:30
Kyudos17-Aug-10 13:30 
QuestionSelect and Update Pin
T.RATHA KRISHNAN15-Aug-10 20:53
T.RATHA KRISHNAN15-Aug-10 20:53 
Hi!
I've to read each name in a field from a table and do some string mangling and update each name into another field. I've to query the database from C++. I'm using SQLite. I used the following code to do this:

SQLManager SQLdb;
SQLdb.init("../../data/config/playerDatabase.db");
array<stringc> ctyLst = SQLdb.Query("Select DISTINCT Team from Test ORDER BY Team DESC");
array<stringc> playerLst;
core::stringc queryStr,updateTest;
for(u32 i = 0; i<ctyLst.size();i++)
{
 queryStr = L"Select Name From Test WHERE Team ='";
 queryStr += ctyLst[i].trim();
 queryStr += L"'";

 // queryStr += L" ORDER BY RANDOM() LIMIT 11";
 array<stringc> playerTmpLst;
 playerTmpLst = SQLdb.Query(queryStr);
 for(u32 j = 0; j < playerTmpLst.size(); j++)
 {
  playerLst.push_back(playerTmpLst[j].c_str());
 }
}


I'm doing string mangiling an updating as follows:

for(int j = 0; j<playerLst.size(); j++)
{
 updateTest = L"UPDATE Test SET MangledName ='";
 unsigned int t = time(NULL);
 srand(t);
 playerLst[j] = playerLst[j].trim();
 int index = playerLst[j].findLast(' ');
 stringc subStr1 = playerLst[j].subString(0,index);
 stringc subStr2 = playerLst[j].subString(index+1,15);
 subStr1.append(" ",1);
 subStr1.append(swapChars(subStr2).c_str(),subStr2.size());
 updateTest += subStr1.trim();
 updateTest += L"'";
 SQLdb.Query(updateTest);
 Sleep(10);
 cout<<subStr1.c_str()<<endl;
 t++;
}

While printing the result to a file, it prints correctly. But only the last name in the array is updated to all the records in the field. How to Select a single name at a time and do the string mangling and update the name to the database?
AnswerRe: Select and Update Pin
Luc Pattyn16-Aug-10 0:22
sitebuilderLuc Pattyn16-Aug-10 0:22 
Questionaccess database Pin
sharmakamal14-Aug-10 7:45
sharmakamal14-Aug-10 7:45 
AnswerRe: access database Pin
Luc Pattyn14-Aug-10 8:59
sitebuilderLuc Pattyn14-Aug-10 8:59 
GeneralRe: access database Pin
PIEBALDconsult14-Aug-10 15:19
mvePIEBALDconsult14-Aug-10 15:19 
GeneralRe: access database Pin
Luc Pattyn14-Aug-10 15:24
sitebuilderLuc Pattyn14-Aug-10 15:24 
GeneralRe: access database Pin
PIEBALDconsult14-Aug-10 16:13
mvePIEBALDconsult14-Aug-10 16:13 
GeneralRe: access database Pin
Corporal Agarn17-Aug-10 1:10
professionalCorporal Agarn17-Aug-10 1:10 
AnswerRe: access database Pin
Dr.Walt Fair, PE14-Aug-10 10:15
professionalDr.Walt Fair, PE14-Aug-10 10:15 
GeneralRe: access database Pin
Luc Pattyn14-Aug-10 10:44
sitebuilderLuc Pattyn14-Aug-10 10:44 
GeneralRe: access database Pin
Yusuf14-Aug-10 18:28
Yusuf14-Aug-10 18:28 
JokeRe: access database Pin
Dan Mos15-Aug-10 3:50
Dan Mos15-Aug-10 3:50 
AnswerRe: access database Pin
Mycroft Holmes14-Aug-10 12:45
professionalMycroft Holmes14-Aug-10 12:45 
JokeRe: access database Pin
Dan Mos15-Aug-10 2:40
Dan Mos15-Aug-10 2:40 
QuestionRestricting Database Login to a user Pin
saltcode14-Aug-10 1:19
professionalsaltcode14-Aug-10 1:19 
AnswerRe: Restricting Database Login to a user Pin
PIEBALDconsult14-Aug-10 7:30
mvePIEBALDconsult14-Aug-10 7:30 
GeneralRe: Restricting Database Login to a user Pin
saltcode15-Aug-10 2:08
professionalsaltcode15-Aug-10 2:08 
Questionfile no frequency in sql 2008 Pin
Jassim Rahma13-Aug-10 11:17
Jassim Rahma13-Aug-10 11:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.