[RDD] Generic non-Rivendell MySQL question

Rob Landry 41001140 at interpring.com
Tue Jan 28 10:42:53 EST 2014

I write a lot of Perl scripts that interact with MySQL databases. When 
inserting anything into a non-numeric field, I always pre-process the data 

 	$data =~ s/'/\\'/g;

The single quote is used by MySQL as a field delimiter, so it needs to be 
escaped. I've never had trouble with any other characters.


On Tue, 28 Jan 2014, Cowboy wrote:

> A conversion project. ( hopefully, just a task )
> Not specifically Rivendell, but maybe one or two of you have
> run into a similar "problem" ?
> I need a way to extract a value, a single table entry, from
> one table, and copy/move/insert/update/replace ( whichever is
> appropriate. My lack of understanding ) into another table, into
> another column, preferably by bash script.
> There are "more than a few" table entries to deal with.   ;)
> These table entries may be a number, may be text.
> I fear the text entries may create a delimiter problem.
> So far, with everything I've tried, the text entries ( of
> random length and content ) have created delimiter issues.
> Some them contain single quotes, some contain double quotes.
> Some contain colons, and some semi-colons. Some contain
> backslashes, etc. So far, none contain certain characters that
> may be delimiter candidates, such as a vertical bar.
> Assume I can find a suitable delimiter.
> Unfortunately, with what I've tried, things like catenate the last
> column, ignoring delimiters, works for text in the last column,
> but some tables have another column after the text, so that doesn't
> always work so pretty good.
> With thousands of table entries to move/copy something like
> PHPAdmin or SIDU is impractical.
> Tried several things.
> Exporting a table as a spreadsheet, working on that, followed
> by importing the spreadsheet. Works sometimes.
> Columns containing zeros seem to cause various issues, like
> being ignored, so the following column ends up in the wrong place,
> or creating a null entry where a zero should be.
> Preferably, a "simple" loop, that can do something like
> for column A "has any entry at all" in table B do;
>  copy column C to table D column E.
> done
> In some cases
> where column A LIKE "something" AND column B LIKE "something else"
> copy column D into table Y column E
> Just seeking a relatively simple, generic loop, and I'll hack the details.
> Prefer BASH script. Can work with a PHP loop if absolutely necessary.
> Suggestions ?
> Since this isn't Rivendell ( but you go where you can find the best
> expertise ) off list is fine.
> Thanks...
> -- 
> Cowboy
> http://cowboy.cwf1.com
> So, what's with this guy Gideon, anyway?  And why can't he ever
> remember his Bible?
> _______________________________________________
> Rivendell-dev mailing list
> Rivendell-dev at lists.rivendellaudio.org
> http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev

More information about the Rivendell-dev mailing list