Database query hangs up, why?

Posted in Help the coder! on Aug 20, 2009 at 12:13 IST (11 months ago). Subscribe to this post Bookmark and Share Email
Showing comments 1 to 5 of total 5 on page 1 of 1
Post reply
« Previous1Next »

mathewge...
Rank: 107
Hello all,

I have a program that reads and uploads RTF files into a database. This program stores all the styles of the file to html format. ie, Its is like an rtf to html converter. What happens is that, when i convert large files (size: 2Mb or high), the query hangs up, ie, the program has to wait endlessly for that query to complete.

Any idea what is happening?
Posted by mathewgeorge on Thursday, August 20, 2009, 12:13 pm
  • Currently 0.00/5

0 votes

Thank this userFlag this comment

xtrmprgrmr
Rank: 7
Might be a connection or DB limitation. Why don't you do an insert first and then followed by concatenated updates to the same field?
Posted by xtrmprgrmr on Thursday, August 20, 2009, 2:07 pm
  • Currently 0.00/5

0 votes

Thank this userFlag this comment

mathewge...
Rank: 107
how do i do that? should i split the larger files into smaller chunks and insert them?
Posted by mathewgeorge on Thursday, August 20, 2009, 3:43 pm
  • Currently 0.00/5

0 votes

Thank this userFlag this comment

rad4die
Rank: 119

something like,

recordId = sql( "insert into tablename (fieldname) values( '' )" );
while( remaining != empty ) {
chunk = empty;
if( length( remaining ) > chunk_size ) {
chunk = first( remaining, chunk_size );
remaining = last( remaining, length( remaining ) - chunk_size );
}
else {
chunk = remaining;
remaining = empty;
}

sql( "update tablename set fieldname = '" + escape( chunk ) + "' where id = '" + recordId + "'" );
}

Thankful users: mathewgeorge
Posted by rad4die on Friday, August 21, 2009, 9:07 am
  • Currently 0.00/5

0 votes

Thank this userFlag this comment

mathewge...
Rank: 107
thank you rad.
Posted by mathewgeorge on Friday, August 21, 2009, 10:47 am
  • Currently 0.00/5

0 votes

Thank this userFlag this comment
Pages: « Previous1Next »

Post your comment (No registration required)

  Add my comment  

TechieDesi Community

Not signed in (Sign-in or Register)
Be a true TechieDesi!
Top 10 Users
Spread the word
Invite your friends
Fan stuff
Help us improve
Need Help
FAQ's
Search tips
Found a bug? Report!
Feeds and letters
Subscribe via RSS
Archives
Subscribe to newsletter
Unsubscribe e-mail
Miscellaneous
Privacy policy
Visit rootnerve
About us
About us
Support the development
Official Blog
Advertise with us
Careers
Copyright (c) 2008, TechieDesi.com. All rights reserved | About us | Do-Not-Disturb registry | Powered by rootnerve | Page rendered in 0.112 seconds