Porting over a better calendar module, can't seem to get DB install right

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Mateo1041
Forum Members
Forum Members
Posts: 37
Joined: Wed Nov 29, 2006 1:10 am

Porting over a better calendar module, can't seem to get DB install right

Post by Mateo1041 »

Hello,

I'm porting over a better calendar to CMSMS, but am running into trouble with the install.  Part of the issue is that I'm not that familiar with ADODB.

Here are some questions:

1) Do I need to use ADODB or can I use regular PHP SQL facilities instead?  All my calendar code is already in regular PHP SQL.

2) Does ADODB allow for a time field?  My calendar's database relies on one.

Here's the code I'm using for install:

Code: Select all

   function Install()
   {
      $db = $this->cms->db;
      // $db->debug = 1;
      $taboptarray = array('mysql' => 'TYPE=MyISAM');

      // Dictionary = DB table
      // Table: BlueCalendarCategory
      $dict = NewDataDictionary($db);
      $fields = "CalendarCategoryID I KEY,
          Name C,
          Color C(7)";
      $sqlarray = $dict->CreateTableSQL(cms_db_prefix() . 'BlueCalendarCategory', $fields, $taboptarray);
      $dict->ExecuteSQLArray($sqlarray);
      // Used to increment the key ID
      $db->CreateSequence(cms_db_prefix() . 'BlueCalendarCategory_seq');
      // Table: BlueCalendar
      $dict = NewDataDictionary($db);
      $fields = "CalendarID I KEY,
          CalendarCategoryID I,
          Type I(1) DEFAULT 1,
          DateStart Date,
          DateEnd Date,
          TimeStart Time,
          TimeEnd Time,
          Repeat I DEFAULT 0,
          RepeatEnd Date,
          Float I DEFAULT 0,
          FloatDay I DEFAULT 0,
          FloatStart Date,
          FloatEnd Date,
          Title C,
          Description X,
          Location C";
      $sqlarray = $dict->CreateTableSQL(cms_db_prefix() . 'BlueCalendar', $fields, $taboptarray);
      $dict->ExecuteSQLArray($sqlarray);
      // Used to increment the key ID
      $db->CreateSequence(cms_db_prefix() . 'BlueCalendar_seq');

      // Create the CMSMS permission field
      $this->CreatePermission('BlueCalendar Admin', 'Manage BlueCalendar');
   }
Am I doing something wrong?

Thanks,
- Matt
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm
Location: Finland

Re: Porting over a better calendar module, can't seem to get DB install right

Post by tsw »

using adodb* (meanin adodb and adodb_lite) you get compatibility with different databases with minimum effort.

iirc, adodb* has a T field which is either time or datetime
Mateo1041
Forum Members
Forum Members
Posts: 37
Joined: Wed Nov 29, 2006 1:10 am

Re: Porting over a better calendar module, can't seem to get DB install right

Post by Mateo1041 »

Let me rephrase...

1) Are the CMSMS DB config fields accessible from module code in case I didn't want to use ADODB?

2) Is the "T" field in 00:00:00 format?  This one I can probably figure out myself by just trying it.

Thanks,
- Matt
Post Reply

Return to “Modules/Add-Ons”