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

MySQL column def. in Install.pm

Quote Reply
MySQL column def. in Install.pm
Hey, Im trying to create a plugin and in install.pm im defining my sql table with an ID column that i need to auto_increment. Does anyone know how to do this? i tryed the following but it doesnt seem to work:

$c->cols (
'ID' => { pos => 1, type => 'INT', not_null => 1, auto_increment => 1 },
....

Any help is greatly appreciated.

Im using linkssql 2.1.2

Thanks

Hagai
Quote Reply
Re: [hagai] MySQL column def. in Install.pm In reply to
Hi. This should do it;

$c->ai('ID');

... you may also need to use $c->pk('') to set your Primary Key's up correctly too.

Hope that helps.

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] MySQL column def. in Install.pm In reply to
Andy, Thanks alot that did the trick.

BTW. is this in the plugin documentation? did i overlook it?
if not where can i find api docs?

I have another little issue you might be able to help me out with. I am adding a handler cgi file but since im using windows (i guess) the attributes arnt set properly (644) so everytime i install the plugin, i manually have to go to the cgi file and chmod a+x it. any ideas?

Thanks

Hagai
Quote Reply
Re: [hagai] MySQL column def. in Install.pm In reply to
Glad to hear it :)

Quote:
BTW. is this in the plugin documentation? did i overlook it?
if not where can i find api docs? (GT::SQL)

Sure. It should be in the "GT Module Documentation" section of the "Help" part in the admin panel.

Quote:
I have another little issue you might be able to help me out with. I am adding a handler cgi file but since im using windows (i guess) the attributes arnt set properly (644) so everytime i install the plugin, i manually have to go to the cgi file and chmod a+x it. any ideas?

I normally just use;

Code:
chmod($filename,755);

Hope that helps.

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!