Martin Lehmann escribió:

Not contained in latest nightly RPMS. Plz update.

Could you also provide mysql-update scripts?

Hi,

I managed to make the changes to MySQL tables (as does the script) the following way.

Created a function as mentioned here [1] to emulete PostgreSQL's split_part fuction.

[1] http://blog.fedecarg.com/2009/02/22/mysql-split-string-function/

If MySQL complains with the message "This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary" is because you're replicating databases (log-bin activated) Tou'll have to deactivate it first or follow this instructions [2]

http://www.ispirer.com/doc/sqlways39/Output/SQLWays-1-365.html

Below you'll find the script adapted. It doesn't prompt for the variables, you'd have to replace them in the script.

HTH,

--
Roberto


#!/bin/bash

username=mysqluser
hostname=mysqlhost
database=sogodatabase
indextable=sogo_folder_info

sqlscript=""

function addField() {
    oldIFS="$IFS"
    IFS=" "
part="`echo -e \" ALTER TABLE $table ADD COLUMN c_category VARCHAR(255);\\n\"`";
    sqlscript="$sqlscript$part"
    IFS="$oldIFS"
}

tables=`mysql -u $username -h $hostname -p $database -B -s -e "SELECT SPLIT_STR(c_quick_location, '/', 5) from sogo_folder_info where c_folder_type like 'Appointment';"`

for table in $tables;
do
   addField
done

echo "$sqlscript" | mysql -u $username -h $hostname $database -p

-- 
users@sogo.nu
https://inverse.ca/sogo/lists

Reply via email to