[rt-users] How to update CF via scripted mySQL commands

Thomas Sibley trs at bestpractical.com
Fri Jul 19 13:28:05 EDT 2013


On 07/19/2013 06:10 AM, scott.dalzell wrote:
> i have got abit further with this issue and i have got a perl script that
> does what i need it to do and edit the mysl database, however when i add
> this code into RT as a scrip i get the following error in the error.log.

Updating the RT database via raw SQL statements is a recipe for
disaster.  Do not do it.  Use the Perl API RT provides.  If you don't,
you WILL corrupt your RT database.

> [Fri Jul 19 12:38:40 2013] [error]: Scrip 491 Prepare failed: Global symbol
> "@row" requires explicit package name at (eval 646) line 74.
> Global symbol "$sqlQuery" requires explicit package name at (eval 646) line
> 74.
> Global symbol "@row" requires explicit package name at (eval 646) line 75.
> Global symbol "$dbh" requires explicit package name at (eval 646) line 87.
> Global symbol "$query_master2" requires explicit package name at (eval 646)
> line 92.
> Global symbol "$sqlQuery" requires explicit package name at (eval 646) line
> 98. (/opt/rt4/sbin/../lib/RT/Action/UserDefined.pm:65)
> [Fri Jul 19 12:38:40 2013] [warning]: Use of uninitialized value $Default in
> join or string at /opt/rt4/share/html/Elements/EditCustomFieldWikitext line
> 52. (/opt/rt4/share/html/Elements/EditCustomFieldWikitext:52)
> 
> i prosume this means i am missing some "USE xyz"'s at the start of the
> code(see below) to allow RT to understand all the variables like perl can
> via the command line

No, those errors are because RT runs under strict.  Put "use strict;" at
the top of your command-line code and fix the errors first.




More information about the rt-users mailing list