dbTalk Databases Forums  

Query Problems

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss Query Problems in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
John Heinig
 
Posts: n/a

Default Query Problems - 06-07-2005 , 05:54 PM






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
=09int, id,
=09string, source,
=09int, owner,=20
=09string, name,
=09string, announce,
=09string, infohash,
=09string, file_link,
=09int, category,
=09int, subcatagory,
=09string, language,
=09long int, size,
=09mysqlpp:ate, added,
//=09enum, type,
=09string, type,
=09int, numfiles,
=09string, delete_reason,
=09string, nuke_reason,
//=09enum, deleted,
=09string, deleted,
=09int, strike,
=09mysqlpp:ate, checked,
=09int, downloaded
)


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

=09int downloads=3D0;

....

=09new_releases updatedRow =3D mainRows;
=09new_releases origRow =3D mainRows;

=09
=09updatedRow.downloaded =3D downloads;
=09cout << "Original Row: " << origRow.downloaded << " Updated Row: " <<
updatedRow.downloaded <<"\nMax Downloads: " << downloads << endl;
=09//writeQuery.update(origRow, updatedRow);
=09//writeQuery.insert(updatedRow);
=09writeQuery.replace(updatedRow);
=09cout << "Write Query: " << writeQuery.preview() << endl<<flush;
=09ResNSel a =3D writeQuery.execute();
=09cout << 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,lang=
uage,size,added,type,numfiles,delete_reason,nuke_r eason,deleted,strike,chec=
ked,downloaded)
VALUES (33281,'bot',2,'Triple.Agente.CVCD.DVDrip.[www.TodoCVCD.com].mpg','h=
ttp://tracker.prq.to/announce','5f4f6da7e3bad30bad2ccb7f51629a8d5abb41d 1','=
http://thepiratebay.org/download.php...D.DVDrip.%5Bw=
ww.TodoCVCD.com%5D1.torrent',1,0,'Unknown',8174021 72,'2005-05-14','single',=
1,'','','no',1,'2005-05-14',6)
1 33281 2

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw


Reply With Quote
  #2  
Old   
Warren Young
 
Posts: n/a

Default Re: Query Problems - 06-08-2005 , 07:00 AM






John Heinig wrote:
Quote:
1, 5, // explained in the user manual
Are you sure that these are the right numbers?

Quote:
writeQuery.replace(updatedRow);
You know that a replace query can either insert data, or replace it,
depending on your indexes, right? Have you checked that you aren't
simply replacing an existing row with the same key(s)?

Quote:
VALUES (33281,'bot',2,'Triple.Agente.CVCD.DVDrip.[www.TodoCVCD.com].mpg','http://tracker.prq.to/announce','5f4f6da7e3bad30bad2ccb7f51629a8d5abb41d 1','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)
You said you "typed" the query into another tool, but did you actually
cut and paste this exact query, or did you type something else?

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #3  
Old   
Warren Young
 
Posts: n/a

Default Re: Query Problems - 06-08-2005 , 11:25 AM



John Heinig wrote:
Quote:
On 6/8/05, Warren Young <mysqlpp (AT) etr-usa (DOT) com> wrote:

What difference would those first two numbers make on my use of the structure?
RTFM. It's covered in the SSQLS section of the Tutorial, under the
"Less-than comparable" subhead.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #4  
Old   
Warren Young
 
Posts: n/a

Default Re: Query Problems - 06-08-2005 , 11:51 AM



John Heinig wrote:
Quote:
I did. However, as far as I can tell, neither of these should be be
effecting my query at all, since I'm not comparing either one.
I agree, but plainly you've been copying code from the examples without
thinking about what needs to change. I wonder if there is another
needed change you have overlooked. That's the main reason I directed
you to the manual.

I'd put the odds of the problem being in MySQL++ instead of in your code
quite low. MySQL++ isn't perfect, but the basics are pretty darn solid.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #5  
Old   
Warren Young
 
Posts: n/a

Default Re: Query Problems - 06-08-2005 , 01:36 PM



John Heinig wrote:
Quote:
I have tried for hours and
hours to figure out what I was doing wrong.
I would suggest starting over, then. Run the samples. Do they work?
If so, modify them a small bit toward what your program needs to do.
Re-test, modify again, repeat. When it stops working, you will know
where the problem lies.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.