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');
}
Thanks,
- Matt