Gossamer Forum
Quote Reply
Weird GT::SQL bug
Hi,

Got a bit of a weird bug with GT::SQL.

Here is some example code:

Code:
$DB->table('DomainAccounts')->add( {
Username => $in->{Their_Username},
URL => $in->{URL},
AccountExpDate => $exp_date,
IsLiveAccount => 1,
PaymentPeriod => $in->{PaymentPeriod},
AutoRecurringEnabled => $in->{AutoRecurringEnabled},
Reseller => $IN->param('Reseller');,
DateCreated => GT::Date::date_get(),
CompanyName => $in->{CompanyName}
}
) || die $GT::SQL::error;

Changing to this code works fine:

Code:
my $reseller = $IN->param('Reseller');
$DB->table('DomainAccounts')->add( {
Username => $in->{Their_Username},
URL => $in->{URL},
AccountExpDate => $exp_date,
IsLiveAccount => 1,
PaymentPeriod => $in->{PaymentPeriod},
AutoRecurringEnabled => $in->{AutoRecurringEnabled},
Reseller => $reseller,
DateCreated => GT::Date::date_get(),
CompanyName => $in->{CompanyName}
}
) || die $GT::SQL::error;


Basically, what seems to happen - is after the "Reseller" bit, it was "pushing" all the fields along.

So, instead of being:

Code:
Reseller => xxxx,
DateCreated => 2009-10-12,
CompanyName => something

...it seems to be getting passed in as:

Code:
Reseller => DateCreated
2009-10-12 => CompanyName
something => undef

Now, the only way I can seem to get around this - is by putting the "reseller" into a $reseller variable, and using that instead (rather than $IN)

Is this a bug, and if so - and chance of fixing it? =)

TIA

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Weird GT::SQL bug In reply to
You're calling $IN->param() in array context, and thus it return an array. Since reseller wasn't passed in, it returns an empty array. Not a bug in GT::SQL or GT::CGI, but a bug in your code. Do what you said, or call $IN->param() in scalar context (eg. scalar $IN->param('foo')).

Adrian
Quote Reply
Re: [brewt] Weird GT::SQL bug In reply to
Ah ok - thanks for the heads up :)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates