Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Deleting a table from the database?

Quote Reply
Deleting a table from the database?
Hi...I've just stumbled across a problem in a plugin I'm writing. At the moment, it creates a new table, called "News"...however, upon uninstallation of the plugin...I need this to be removed. I've looked in the GT docs...but could not see anything on how to acomplish this. Any help would be much appreciated.

Another problem I am having, is brining up an error when an entry has not been added. At the moment, it just carrys on happily, as if nothing was wrong. The reason I know it is not added, is because I set the column to a 'Unique' one....so only one new article could be added with that in mind...I just can't seem to grab the error, so the script knows it wasn't added :( Once again...any help would be much appreciated.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Deleting a table from the database? In reply to
I haven't played with LinksSQL for a bit ....
so

How about checking out GT::SQL::Editor docs?

Might be an answer in there.

openoffice + gimp + sketch ... Smile
Quote Reply
Re: [QooQ] Deleting a table from the database? In reply to
Doh...missed that part of the docs...cheers. Still would like to know about the 2nd question though Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Deleting a table from the database? In reply to
Use $GT::SQL::error as always

Laugh

openoffice + gimp + sketch ... Smile
Quote Reply
Re: [QooQ] Deleting a table from the database? In reply to
Ok..thats all working cool now...cheers Smile

Got another thing I would like to do. At the moment I am checking the validity of a date, by using;

if ($date =~ /\d\d\-\d\d\-\d\d\d\d/) { bla bla }

But that obviously is nowhere near good enough. I see there is a function in Links SQL's GT::Date function, called 'date_is_valid()'...but I can't find any documentation on how to implement it. At the moment I tried, date_is_valid($date_added); but that doesn't seem to work.

Any feedback is much appreciated :)

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Deleting a table from the database? In reply to
Man...none of the GT::Date things seem to work for me Unsure I'm using;

Code:
use GT::Date qw/:all/;

at the top, and then;

Code:
my $test = timlocal();
print $test;


but that just give me;


Quote:
A fatal error has occured:

(26626): Unknown method 'timlocal' called at /usr/local/psa/home/vhosts/ace-host.com/httpdocs/dumps/admin/Plugins/Ace_News.pm line 133.

Please enable debugging in setup for more details.

Has anyone used it, and got any ideas?

Thanks

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Deleting a table from the database? In reply to
If you had simply re-read your code you would know what the problem is.

Last edited by:

Paul: Aug 10, 2002, 8:01 AM
Quote Reply
Re: [Paul] Deleting a table from the database? In reply to
If you are thinking it is because I missed out the 'e', then that isn't right (unless the docs are wrong)...it clearly says;

timlocal
Takes the array returned by localtime() can returns a unix time stamp.

Frown

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Deleting a table from the database? In reply to
Well why not try timelocal and see what happens ;)
Quote Reply
Re: [Paul] Deleting a table from the database? In reply to
What the hell! I think GT should update their docs...that is rather confusing Frown

Cheers Paul.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Deleting a table from the database? In reply to
Hi. I'm having a problem here Unsure I keep getting a weird error...but can see no reason for getting it! The code is;

Code:
my $relation = $DB->table('News');
$relation->update ( { title => "$title",
short => "$short",
full => "$full",
date => "$date" },
date => "$date" ) or die ("Unable to update. Reason: $GT::SQL::error");

and the error given is;

Quote:
A fatal error has occured:

Can't use string ("1029012257") as a HASH ref while "strict refs" in use at (eval 3) line 42.

Please enable debugging in setup for more details.

Any help is much appreciated.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Deleting a table from the database? In reply to
Sigh.

You need to start double checking your code before you post. You are missing { } around date => $date and you don't have to quote all those variables Frown

Last edited by:

Paul: Aug 10, 2002, 9:34 AM
Quote Reply
Re: [Paul] Deleting a table from the database? In reply to
Man..these documents are getting me more and more confused Tongue

They say;

Quote:
my $result = $obj->update (
{
col1 => $val1,
col2 => $val2,
....
},
$condition
);

Notice the { } missing around the $condition part Unsure

Another one for them to update I think Wink

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Deleting a table from the database? In reply to
Yeah because you don't put braces around a condition, but if you are trying to pass in a hashref then you do Crazy

Last edited by:

Paul: Aug 10, 2002, 9:46 AM