forums › forums › SQLyog › SQLyog: Bugs / Feature Requests › Data Search –> Replace
- This topic is empty.
-
AuthorPosts
-
-
December 2, 2011 at 9:00 pm #12527Malte WittMember
Hey all,
SQLyog is a clearly a great piece of software, but there is one little feature I always miss. When using the data search feature I can't automatically search/replace the term.
For instance I need to move wordpress installations really often (like daily, migrating from stage to live etc. …) and now I always need to dump the db replace the url x thousand times using my local editor and then reupload the db again. So data search with search/replace would be the greatest feature ever for me. 🙂
Any chance to have this in SQLyog?
Greetings,
Malte
-
December 3, 2011 at 12:08 pm #32902peterlaursenParticipant
So you are requestion a 'BULK UPDATE' / 'BULK REPLACE' option so that all instances of 'this string' should be replaced with 'that string'? Such option would not only apply to Data Search then, but would be equally relevant in DATA tab and RESULT tab as well.
And what about other datatypes? It could very well end up being a pretty unsafe feature wiht integers in particular, I think.
-
December 3, 2011 at 5:56 pm #32903Malte WittMember
Thank's for your reply!
Yes, you understood correctly what I'm asking for and you are also right that this would be a feature that would have to be used wise. Actually an other big problem are applications that store serialized arrays in the database and when doing string replacement those get screwed cause the length doesn't match anymore … but all the problems you can imagine would also occur if you do string replacement in a sql dump file and that's what all the folks have to do in the moment as there is no other way of changing the url for applications that massively store their url in the database …
-
December 3, 2011 at 6:34 pm #32904ExzoMember
Just make a special script for that. The effort would pay off easily.
-
December 4, 2011 at 5:34 pm #32905Malte WittMember'Exzo' wrote:
Just make a special script for that. The effort would pay off easily.
hmmm … how should a sql script look like that does string translation in any table of a db? I can't think of a solution for that in sql. 🙂
-
December 4, 2011 at 6:16 pm #32906ExzoMember
PHP / Perl / Ruby / Python / whatever
Something like:
Code:loop thru (“SHOW TABLES”) {loop thru (“SHOW COLUMNS IN $table”) {
“UPDATE `$table` SET $field = REPLACE($field, '$srch', '$replc')”;
}
}Or even simpler – use `information_schema` .`COLUMNS`. This makes it possible to make stored procedure for SQL-only solution.
-
December 6, 2011 at 11:42 am #32907peterlaursenParticipant
I have added this reqeust here: http://code.google.com/p/sqlyog/issues/detail?id=1737
But I do not guarantee that we will ever implement it.
-
-
AuthorPosts
- You must be logged in to reply to this topic.