Gossamer Forum
Home : Products : DBMan : Customization :

SQL Version variation conflicts

Quote Reply
SQL Version variation conflicts
I noticed in the SQL version that the userid does not allow numbers (just alpha) and the iud is formatted differently.

In the flat file version the iud for, say, admin would be something like "admin.90293748" but in the SQL version it is more like "admin87632"

Since I want to import users from my old flat version to SQL and some of the user names are alphanumeric I find myself in a jam. As it stands, user names like "John1" would be parsed as just "John" and thus would get an unauthorised action message.

Is there a reason for the change operation wise? Would it be a problem for me to tweak the code a bit to use the old format for the session id?

Incidently the date_to_unix proc was missing in the code (maybe it was corrected over the last few months) so I tweaked a copy to deal with the mSQL/mySQL date format variations.. this is the code for it.. so far it seems to work but I have not tested it intensely:

sub date_to_unix {
# --------------------------------------------------------
# This routine must take your date format and return the time a la UNIX time().
# Some things to be careful about..
# int your values just in case to remove spaces, etc.
# catch the fatal error timelocal will generate if you have a bad date..
# don't forget that the month is indexed from 0!
#
my ($date) = $_[0];
my (%months) = ("Jan" => 0, "Feb" => 1, "Mar" => 2, "Apr" => 3, "May" => 4, "Jun" => 5,
"Jul" => 6, "Aug" => 7, "Sep" => 8, "Oct" => 9, "Nov" => 10,"Dec" => 11);
my ($time);
my ($year, $mon, $day);
# Msql likes it's date: dd-MMM-yyyy
# Mysql likes it's date: yyyy-mm-dd
if ($db_msql) {
($day, $mon, $year) = split(/-/, $_[0]);
}
else {
($year, $mon, $day) = split(/-/, $_[0]);
}

unless ($day and $mon and $year) { return undef; }
if ($db_msql) {
unless (defined($months{$mon})) { return undef; }
}

use Time::Local;
eval {
$day = int($day); $year = int($year) - 1900;
if ($db_msql) {
$time = timelocal(0,0,0,$day, $months{$mon}, $year);
}
else {
$mon = int($mon)-1;
$time = timelocal(0,0,0,$day, $mon, $year);
}
};
if ($@) { return undef; } # Could return 0 if you want.{ return undef; }
return ($time);
}


-John
Quote Reply
Re: SQL Version variation conflicts In reply to
Basically, for organizing data in the MySQL tables. But you can change the type of field in the SQL configuration file before importing the data from the flat file to the MySQL tables.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------