Index: trunk/core/units/config_search/config_search_event_handler.php =================================================================== diff -u -N -r2711 -r3999 --- trunk/core/units/config_search/config_search_event_handler.php (.../config_search_event_handler.php) (revision 2711) +++ trunk/core/units/config_search/config_search_event_handler.php (.../config_search_event_handler.php) (revision 3999) @@ -77,64 +77,36 @@ */ function OnCreateCustomField(&$event) { - $cf_object =& $event->MasterEvent->getObject(); - - $is_new = $event->MasterEvent->getEventParam('IsNew'); + $custom_field =& $event->MasterEvent->getObject(); - // TODO: direct access to private attributes of object is prohibited - $cf_search = array(); - $cf_search['DisplayOrder'] = $cf_object->FieldValues['DisplayOrder']; - $cf_search['ElementType'] = $cf_object->FieldValues['ElementType']; - $cf_search['DisplayName'] = $cf_object->FieldValues['FieldLabel']; - $cf_search['FieldName'] = $cf_object->FieldValues['FieldName']; - $cf_search['Description'] = $cf_object->FieldValues['Prompt']; - $cf_search['ConfigHeader'] = 'la_Text_CustomFields'; - - $cf_search['TableName'] = "CustomField"; - $cf_search['ModuleName'] = "In-Commerce"; - $cf_search['ForeignField'] = "CustomMetaData.Value"; - $cf_search['JoinClause'] = "{ForeignTable}.ResourceId={LocalTable}.ResourceId"; + $sql = 'SELECT Module + FROM '.TABLE_PREFIX.'ItemTypes + WHERE ItemType = '.$custom_field->GetDBField('Type'); + $module_name = $this->Conn->GetOne($sql); - if($is_new) - { - - $live_id = $this->Conn->GetOne("SELECT CustomFieldId FROM ".TABLE_PREFIX."CustomField WHERE FieldName='".$cf_search['FieldName']."'"); - - $cf_search['CustomFieldId'] = $live_id; - - $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); - $confs_item = $event->getObject(); - $confs_item->SetFieldsFromHash($cf_search); - $confs_item->Create(); - - }else{ - - - $cf_search['CustomFieldId'] = $cf_object->FieldValues['CustomFieldId']; - - $search_config_id = $this->Conn->GetOne("SELECT SearchConfigId FROM ".TABLE_PREFIX."SearchConfig WHERE CustomFieldId='".$cf_object->FieldValues['CustomFieldId']."'"); - - $cf_search['SearchConfigId'] = $search_config_id; - - $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); - $confs_item = $event->getObject(); - $confs_item->SetFieldsFromHash($cf_search); - $confs_item->Update($search_config_id); - + $object =& $event->getObject( Array('skip_autoload' => true) ); + + $custom_id = $custom_field->GetID(); + if ($custom_id) { + $object->Load($custom_id, 'CustomFieldId'); + $object->SetDBField('CustomFieldId', $custom_id); // for cloning only } - } - - /** - * Enter description here... - * - * @param kEvent $event - */ - function OnDeleteCustomField(&$event){ + + $cf_search = Array(); + $cf_search['DisplayOrder'] = $custom_field->GetDBField('DisplayOrder'); + $cf_search['ElementType'] = $custom_field->GetDBField('ElementType'); + $cf_search['DisplayName'] = $custom_field->GetDBField('FieldLabel'); + $cf_search['FieldName'] = $custom_field->GetDBField('FieldName'); + $cf_search['Description'] = $custom_field->GetDBField('Prompt'); + $cf_search['ConfigHeader'] = $custom_field->GetDBField('Heading'); // 'la_Text_CustomFields'; + $cf_search['TableName'] = 'CustomField'; + $cf_search['ModuleName'] = $module_name; + $cf_search['ForeignField'] = 'CustomMetaData.Value'; + $cf_search['JoinClause'] = '{ForeignTable}.ResourceId={LocalTable}.ResourceId'; + $object->SetFieldsFromHash($cf_search); - $custom_field_id =&$event->MasterEvent->getEventParam('id'); - $this->Conn->Query("DELETE FROM ".TABLE_PREFIX."SearchConfig WHERE CustomFieldId=".$custom_field_id); - + $result = $object->isLoaded() ? $object->Update() : $object->Create(); } } Index: trunk/admin/install/inportal_schema.sql =================================================================== diff -u -N -r3983 -r3999 --- trunk/admin/install/inportal_schema.sql (.../inportal_schema.sql) (revision 3983) +++ trunk/admin/install/inportal_schema.sql (.../inportal_schema.sql) (revision 3999) @@ -460,7 +460,7 @@ IsNotWhere text, ContainsWhere text, NotContainsWhere text, - CustomFieldId int(11) NOT NULL default '0', + CustomFieldId int(11) default NULL, PRIMARY KEY (SearchConfigId) ) Index: trunk/core/units/custom_fields/custom_fields_config.php =================================================================== diff -u -N -r1795 -r3999 --- trunk/core/units/custom_fields/custom_fields_config.php (.../custom_fields_config.php) (revision 1795) +++ trunk/core/units/custom_fields/custom_fields_config.php (.../custom_fields_config.php) (revision 3999) @@ -51,15 +51,16 @@ 'ItemSQLs' => Array( ''=>'SELECT * FROM %s', ), + 'SubItems' => Array('confs-cf'), 'Fields' => Array( 'CustomFieldId' => Array('type' => 'int','not_null' => '1','default' => ''), 'Type' => Array('type' => 'int','not_null' => '1','default' => '0'), 'FieldName' => Array('required'=>'1', 'type' => 'string','not_null' => 1,'default' => ''), - 'FieldLabel' => Array('type' => 'string','default' => ''), - 'Heading' => Array('type' => 'string','default' => ''), + 'FieldLabel' => Array('type' => 'string', 'required' => 1, 'default' => ''), + 'Heading' => Array('type' => 'string', 'required' => 1, 'default' => ''), 'Prompt' => Array('type' => 'string','default' => ''), - 'ElementType' => Array('required'=>'1', 'type'=>'string', 'not_null'=>1, 'default'=>'NULL', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options'=>Array('' => 'la_EmptyValue', 'select' => 'la_type_select', 'label' => 'la_type_label', 'password' => 'la_type_password','radio' => 'la_type_radio', 'textarea' => 'la_type_textarea', 'text' => 'la_type_text')), + 'ElementType' => Array('required'=>'1', 'type'=>'string', 'not_null'=>1, 'default'=>'NULL', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options'=>Array('' => 'la_EmptyValue', 'text' => 'la_type_text', 'select' => 'la_type_select', 'radio' => 'la_type_radio', 'checkbox' => 'la_type_checkbox', 'password' => 'la_type_password', 'textarea' => 'la_type_textarea', 'label' => 'la_type_label')), 'ValueList' => Array('type' => 'string','default' => ''), 'DisplayOrder' => Array('type' => 'int','not_null' => '1','default' => '0'), 'OnGeneralTab' => Array('type' => 'int','not_null' => '1','default' => '0'), @@ -77,7 +78,7 @@ ), ), - ), + ), ); ?> \ No newline at end of file Index: trunk/kernel/units/custom_fields/custom_fields_config.php =================================================================== diff -u -N -r1795 -r3999 --- trunk/kernel/units/custom_fields/custom_fields_config.php (.../custom_fields_config.php) (revision 1795) +++ trunk/kernel/units/custom_fields/custom_fields_config.php (.../custom_fields_config.php) (revision 3999) @@ -51,15 +51,16 @@ 'ItemSQLs' => Array( ''=>'SELECT * FROM %s', ), + 'SubItems' => Array('confs-cf'), 'Fields' => Array( 'CustomFieldId' => Array('type' => 'int','not_null' => '1','default' => ''), 'Type' => Array('type' => 'int','not_null' => '1','default' => '0'), 'FieldName' => Array('required'=>'1', 'type' => 'string','not_null' => 1,'default' => ''), - 'FieldLabel' => Array('type' => 'string','default' => ''), - 'Heading' => Array('type' => 'string','default' => ''), + 'FieldLabel' => Array('type' => 'string', 'required' => 1, 'default' => ''), + 'Heading' => Array('type' => 'string', 'required' => 1, 'default' => ''), 'Prompt' => Array('type' => 'string','default' => ''), - 'ElementType' => Array('required'=>'1', 'type'=>'string', 'not_null'=>1, 'default'=>'NULL', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options'=>Array('' => 'la_EmptyValue', 'select' => 'la_type_select', 'label' => 'la_type_label', 'password' => 'la_type_password','radio' => 'la_type_radio', 'textarea' => 'la_type_textarea', 'text' => 'la_type_text')), + 'ElementType' => Array('required'=>'1', 'type'=>'string', 'not_null'=>1, 'default'=>'NULL', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options'=>Array('' => 'la_EmptyValue', 'text' => 'la_type_text', 'select' => 'la_type_select', 'radio' => 'la_type_radio', 'checkbox' => 'la_type_checkbox', 'password' => 'la_type_password', 'textarea' => 'la_type_textarea', 'label' => 'la_type_label')), 'ValueList' => Array('type' => 'string','default' => ''), 'DisplayOrder' => Array('type' => 'int','not_null' => '1','default' => '0'), 'OnGeneralTab' => Array('type' => 'int','not_null' => '1','default' => '0'), @@ -77,7 +78,7 @@ ), ), - ), + ), ); ?> \ No newline at end of file Index: trunk/admin/install/upgrades/inportal_upgrade_v1.1.8.sql =================================================================== diff -u -N --- trunk/admin/install/upgrades/inportal_upgrade_v1.1.8.sql (revision 0) +++ trunk/admin/install/upgrades/inportal_upgrade_v1.1.8.sql (revision 3999) @@ -0,0 +1,4 @@ +UPDATE SearchConfig SET CustomFieldId = NULL WHERE CustomFieldId = 0; +ALTER TABLE SearchConfig CHANGE CustomFieldId CustomFieldId INT(11) NULL DEFAULT NULL; + +UPDATE Modules SET Version = '1.1.8' WHERE Name = 'In-Portal'; \ No newline at end of file Index: trunk/core/units/config_search/config_search_config.php =================================================================== diff -u -N -r1682 -r3999 --- trunk/core/units/config_search/config_search_config.php (.../config_search_config.php) (revision 1682) +++ trunk/core/units/config_search/config_search_config.php (.../config_search_config.php) (revision 3999) @@ -2,6 +2,31 @@ $config = Array( 'Prefix' => 'confs', + + 'Clones' => Array( + 'confs-cf' => Array( + 'Prefix' => 'confs-cf', + 'ParentPrefix' => 'cf', + 'ParentTableKey' => 'CustomFieldId', // linked field in master table + 'ForeignKey' => 'CustomFieldId', // linked field in subtable + 'AutoClone' => false, // because OnCreateCustomField hook does the stuff + 'AutoDelete' => true, + + 'Hooks' => Array( + Array( + 'Mode' => hAFTER, + 'Conditional' => false, + 'HookToPrefix' => 'cf', + 'HookToSpecial' => '*', + 'HookToEvent' => Array('OnAfterItemCreate', 'OnAfterItemUpdate'), + 'DoPrefix' => 'confs-cf', + 'DoSpecial' => '*', + 'DoEvent' => 'OnCreateCustomField', + ), + ), + ), + ), + 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), 'EventHandlerClass' => Array('class'=>'ConfigSearchEventHandler','file'=>'config_search_event_handler.php','build_event'=>'OnBuild'), @@ -15,29 +40,6 @@ 4 => 'module', 5 => 'section', ), - - 'Hooks' => Array( - Array( - 'Mode' => hAFTER, - 'Conditional' => false, - 'HookToPrefix' => 'cf', - 'HookToSpecial' => '', - 'HookToEvent' => Array( 'OnSave' ), - 'DoPrefix' => 'confs', - 'DoSpecial' => '', - 'DoEvent' => 'OnCreateCustomField', - ), - Array( - 'Mode' => hAFTER, - 'Conditional' => false, - 'HookToPrefix' => 'cf', - 'HookToSpecial' => '-item', - 'HookToEvent' => Array( 'OnAfterItemDelete' ), - 'DoPrefix' => 'confs', - 'DoSpecial' => '', - 'DoEvent' => 'OnDeleteCustomField', - ), - ), 'IDField' => 'SearchConfigId', @@ -47,12 +49,18 @@ 'TableName' => TABLE_PREFIX.'SearchConfig', - 'ListSQLs' => Array(''=>'SELECT *, IF('.TABLE_PREFIX.'SearchConfig.CustomFieldId=0, 0, 1) AS IsCustom FROM '.TABLE_PREFIX.'SearchConfig'), + 'CalculatedFields' => Array( + '' => Array( + 'IsCustom' => 'IF(CustomFieldId IS NULL, 0, 1)', + ), + ), - 'ItemSQLs' => Array(''=>'SELECT * FROM '.TABLE_PREFIX.'SearchConfig'), + 'ListSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'), + + 'ItemSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'), - 'SubTables' => Array(), + 'Fields' => Array( 'TableName' => Array('type' => 'string','not_null' => '1','default' => ''), 'FieldName' => Array('type' => 'string','not_null' => '1','default' => ''), @@ -72,10 +80,12 @@ 'IsNotWhere' => Array('type' => 'string','default' => ''), 'ContainsWhere' => Array('type' => 'string','default' => ''), 'NotContainsWhere' => Array('type' => 'string','default' => ''), - 'CustomFieldId' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'CustomFieldId' => Array('type' => 'int', 'default' => ''), ), - 'VirtualFields' => Array(), + 'VirtualFields' => Array( + 'IsCustom' => Array('type' => 'int', 'default' => 0), + ), 'ListSortings' => Array( '' => Array( Index: trunk/kernel/units/config_search/config_search_config.php =================================================================== diff -u -N -r1682 -r3999 --- trunk/kernel/units/config_search/config_search_config.php (.../config_search_config.php) (revision 1682) +++ trunk/kernel/units/config_search/config_search_config.php (.../config_search_config.php) (revision 3999) @@ -2,6 +2,31 @@ $config = Array( 'Prefix' => 'confs', + + 'Clones' => Array( + 'confs-cf' => Array( + 'Prefix' => 'confs-cf', + 'ParentPrefix' => 'cf', + 'ParentTableKey' => 'CustomFieldId', // linked field in master table + 'ForeignKey' => 'CustomFieldId', // linked field in subtable + 'AutoClone' => false, // because OnCreateCustomField hook does the stuff + 'AutoDelete' => true, + + 'Hooks' => Array( + Array( + 'Mode' => hAFTER, + 'Conditional' => false, + 'HookToPrefix' => 'cf', + 'HookToSpecial' => '*', + 'HookToEvent' => Array('OnAfterItemCreate', 'OnAfterItemUpdate'), + 'DoPrefix' => 'confs-cf', + 'DoSpecial' => '*', + 'DoEvent' => 'OnCreateCustomField', + ), + ), + ), + ), + 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), 'EventHandlerClass' => Array('class'=>'ConfigSearchEventHandler','file'=>'config_search_event_handler.php','build_event'=>'OnBuild'), @@ -15,29 +40,6 @@ 4 => 'module', 5 => 'section', ), - - 'Hooks' => Array( - Array( - 'Mode' => hAFTER, - 'Conditional' => false, - 'HookToPrefix' => 'cf', - 'HookToSpecial' => '', - 'HookToEvent' => Array( 'OnSave' ), - 'DoPrefix' => 'confs', - 'DoSpecial' => '', - 'DoEvent' => 'OnCreateCustomField', - ), - Array( - 'Mode' => hAFTER, - 'Conditional' => false, - 'HookToPrefix' => 'cf', - 'HookToSpecial' => '-item', - 'HookToEvent' => Array( 'OnAfterItemDelete' ), - 'DoPrefix' => 'confs', - 'DoSpecial' => '', - 'DoEvent' => 'OnDeleteCustomField', - ), - ), 'IDField' => 'SearchConfigId', @@ -47,12 +49,18 @@ 'TableName' => TABLE_PREFIX.'SearchConfig', - 'ListSQLs' => Array(''=>'SELECT *, IF('.TABLE_PREFIX.'SearchConfig.CustomFieldId=0, 0, 1) AS IsCustom FROM '.TABLE_PREFIX.'SearchConfig'), + 'CalculatedFields' => Array( + '' => Array( + 'IsCustom' => 'IF(CustomFieldId IS NULL, 0, 1)', + ), + ), - 'ItemSQLs' => Array(''=>'SELECT * FROM '.TABLE_PREFIX.'SearchConfig'), + 'ListSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'), + + 'ItemSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'), - 'SubTables' => Array(), + 'Fields' => Array( 'TableName' => Array('type' => 'string','not_null' => '1','default' => ''), 'FieldName' => Array('type' => 'string','not_null' => '1','default' => ''), @@ -72,10 +80,12 @@ 'IsNotWhere' => Array('type' => 'string','default' => ''), 'ContainsWhere' => Array('type' => 'string','default' => ''), 'NotContainsWhere' => Array('type' => 'string','default' => ''), - 'CustomFieldId' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'CustomFieldId' => Array('type' => 'int', 'default' => ''), ), - 'VirtualFields' => Array(), + 'VirtualFields' => Array( + 'IsCustom' => Array('type' => 'int', 'default' => 0), + ), 'ListSortings' => Array( '' => Array( Index: trunk/kernel/units/config_search/config_search_event_handler.php =================================================================== diff -u -N -r2711 -r3999 --- trunk/kernel/units/config_search/config_search_event_handler.php (.../config_search_event_handler.php) (revision 2711) +++ trunk/kernel/units/config_search/config_search_event_handler.php (.../config_search_event_handler.php) (revision 3999) @@ -77,64 +77,36 @@ */ function OnCreateCustomField(&$event) { - $cf_object =& $event->MasterEvent->getObject(); - - $is_new = $event->MasterEvent->getEventParam('IsNew'); + $custom_field =& $event->MasterEvent->getObject(); - // TODO: direct access to private attributes of object is prohibited - $cf_search = array(); - $cf_search['DisplayOrder'] = $cf_object->FieldValues['DisplayOrder']; - $cf_search['ElementType'] = $cf_object->FieldValues['ElementType']; - $cf_search['DisplayName'] = $cf_object->FieldValues['FieldLabel']; - $cf_search['FieldName'] = $cf_object->FieldValues['FieldName']; - $cf_search['Description'] = $cf_object->FieldValues['Prompt']; - $cf_search['ConfigHeader'] = 'la_Text_CustomFields'; - - $cf_search['TableName'] = "CustomField"; - $cf_search['ModuleName'] = "In-Commerce"; - $cf_search['ForeignField'] = "CustomMetaData.Value"; - $cf_search['JoinClause'] = "{ForeignTable}.ResourceId={LocalTable}.ResourceId"; + $sql = 'SELECT Module + FROM '.TABLE_PREFIX.'ItemTypes + WHERE ItemType = '.$custom_field->GetDBField('Type'); + $module_name = $this->Conn->GetOne($sql); - if($is_new) - { - - $live_id = $this->Conn->GetOne("SELECT CustomFieldId FROM ".TABLE_PREFIX."CustomField WHERE FieldName='".$cf_search['FieldName']."'"); - - $cf_search['CustomFieldId'] = $live_id; - - $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); - $confs_item = $event->getObject(); - $confs_item->SetFieldsFromHash($cf_search); - $confs_item->Create(); - - }else{ - - - $cf_search['CustomFieldId'] = $cf_object->FieldValues['CustomFieldId']; - - $search_config_id = $this->Conn->GetOne("SELECT SearchConfigId FROM ".TABLE_PREFIX."SearchConfig WHERE CustomFieldId='".$cf_object->FieldValues['CustomFieldId']."'"); - - $cf_search['SearchConfigId'] = $search_config_id; - - $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); - $confs_item = $event->getObject(); - $confs_item->SetFieldsFromHash($cf_search); - $confs_item->Update($search_config_id); - + $object =& $event->getObject( Array('skip_autoload' => true) ); + + $custom_id = $custom_field->GetID(); + if ($custom_id) { + $object->Load($custom_id, 'CustomFieldId'); + $object->SetDBField('CustomFieldId', $custom_id); // for cloning only } - } - - /** - * Enter description here... - * - * @param kEvent $event - */ - function OnDeleteCustomField(&$event){ + + $cf_search = Array(); + $cf_search['DisplayOrder'] = $custom_field->GetDBField('DisplayOrder'); + $cf_search['ElementType'] = $custom_field->GetDBField('ElementType'); + $cf_search['DisplayName'] = $custom_field->GetDBField('FieldLabel'); + $cf_search['FieldName'] = $custom_field->GetDBField('FieldName'); + $cf_search['Description'] = $custom_field->GetDBField('Prompt'); + $cf_search['ConfigHeader'] = $custom_field->GetDBField('Heading'); // 'la_Text_CustomFields'; + $cf_search['TableName'] = 'CustomField'; + $cf_search['ModuleName'] = $module_name; + $cf_search['ForeignField'] = 'CustomMetaData.Value'; + $cf_search['JoinClause'] = '{ForeignTable}.ResourceId={LocalTable}.ResourceId'; + $object->SetFieldsFromHash($cf_search); - $custom_field_id =&$event->MasterEvent->getEventParam('id'); - $this->Conn->Query("DELETE FROM ".TABLE_PREFIX."SearchConfig WHERE CustomFieldId=".$custom_field_id); - + $result = $object->isLoaded() ? $object->Update() : $object->Create(); } } Index: trunk/admin/install/inportal_data.sql =================================================================== diff -u -N -r3983 -r3999 --- trunk/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 3983) +++ trunk/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 3999) @@ -226,7 +226,7 @@ INSERT INTO ItemTypes VALUES (1, 'In-Portal', 'c', 'Category', 'Name', 'CreatedById', NULL, NULL, 'la_ItemTab_Categories', 1, 'admin/category/addcategory.php', 'clsCategory', 'Category'); INSERT INTO ItemTypes VALUES (6, 'In-Portal', 'u', 'PortalUser', 'Login', 'PortalUserId', NULL, NULL, '', 0, '', 'clsPortalUser', 'User'); -INSERT INTO Modules (Name, Path, Var, Version, Loaded, LoadOrder, TemplatePath, RootCat, BuildDate) VALUES ('In-Portal', 'kernel/', 'm', '1.1.7', 1, 0, '', 0, '1054738405'); +INSERT INTO Modules (Name, Path, Var, Version, Loaded, LoadOrder, TemplatePath, RootCat, BuildDate) VALUES ('In-Portal', 'kernel/', 'm', '1.1.8', 1, 0, '', 0, '1054738405'); INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('CATEGORY.VIEW', 'lu_PermName_Category.View_desc', 'lu_PermName_Category.View_error', 'In-Portal'); INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('CATEGORY.ADD', 'lu_PermName_Category.Add_desc', 'lu_PermName_Category.Add_error', 'In-Portal'); Index: trunk/core/kernel/db/db_connection.php =================================================================== diff -u -N -r3834 -r3999 --- trunk/core/kernel/db/db_connection.php (.../db_connection.php) (revision 3834) +++ trunk/core/kernel/db/db_connection.php (.../db_connection.php) (revision 3999) @@ -68,6 +68,13 @@ var $debugMode=false; /** + * Last query to database + * + * @var string + */ + var $lastQuery = ''; + + /** * Initializes connection class with * db type to used in future * @@ -332,6 +339,7 @@ */ function Query($sql,$key_field = null) { + $this->lastQuery = $sql; if($this->debugMode) return $this->debugQuery($sql,$key_field); $query_func = $this->getMetaFunction('query'); $this->queryID = $query_func($sql,$this->connectionID);