List:MySQL++« Previous MessageNext Message »
From:John Heinig Date:June 7 2005 10:54pm
Subject:Query Problems
View as plain text  
All my select queries seem to work fine.  However, when I want to
write something to the database it doesn't actually write to the
database.  If I type in this at the command line or through the mysql
Query Browser, the command will actually write to the database.

Here are the snipits of my code that are in question here:

sql_create_20(new_releases,
             1, 5,              // explained in the user manual
	int, id,
	string, source,
	int, owner, 
	string, name,
	string, announce,
	string, infohash,
	string, file_link,
	int, category,
	int, subcatagory,
	string, language,
	long int, size,
	mysqlpp::Date, added,
//	enum, type,
	string, type,
	int, numfiles,
	string, delete_reason,
	string, nuke_reason,
//	enum, deleted,
	string, deleted,
	int, strike,
	mysqlpp::Date, checked,
	int, downloaded
)


int main(int argc, char *argv[]) {

	int downloads=0;

...

	new_releases updatedRow = mainRows;
	new_releases origRow = mainRows;

	
	updatedRow.downloaded = downloads;
	cout << "Original Row: " << origRow.downloaded << " Updated Row: "
<<
updatedRow.downloaded <<"\nMax Downloads: " << downloads << endl;
	//writeQuery.update(origRow, updatedRow);
	//writeQuery.insert(updatedRow);
	writeQuery.replace(updatedRow);
	cout << "Write Query: " << writeQuery.preview() << endl<<flush;
	ResNSel a = writeQuery.execute();
	cout << a.success << " " << a.insert_id << " " << a.rows
<< " " <<
a.info << endl;


....

return 0;

}

The output from this segment of code:

Original Row: 600 Updated Row: 6
Max Downloads: 6
Write Query: REPLACE INTO new_releases
(id,source,owner,name,announce,infohash,file_link,category,subcatagory,language,size,added,type,numfiles,delete_reason,nuke_reason,deleted,strike,checked,downloaded)
VALUES
(33281,'bot',2,'Triple.Agente.CVCD.DVDrip.[www.TodoCVCD.com].mpg','http://tracker.prq.to/announce','5f4f6da7e3bad30bad2ccb7f51629a8d5abb41d1','http://thepiratebay.org/download.php/3316054/Triple.Agente.CVCD.DVDrip.%5Bwww.TodoCVCD.com%5D1.torrent',1,0,'Unknown',817402172,'2005-05-14','single',1,'','','no',1,'2005-05-14',6)
1 33281 2
Thread
Query ProblemsJohn Heinig8 Jun
  • Re: Query ProblemsWarren Young8 Jun
Re: Query ProblemsWarren Young8 Jun
Re: Query ProblemsWarren Young8 Jun
Re: Query ProblemsWarren Young8 Jun