We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44231
    • 126 Posts
    hi there i need help with this query

    snippet code

    <?php
    $path = MODX_CORE_PATH . 'components/modx_tblbook/';
    $result = $modx->addPackage('modx_tblbook',$path . 'model/','modx_');
    
    $test1 = "test1";
    
    if ((isset($_GET['comid'])!=null)||($_GET['comid'])!=0){
    $urlresult = $_GET['comid'];
    }
    
    $query = $modx->newQuery('Tblbook');
            $query->select(array (
                'Tblbook.system_product_id',
                'Tblbook.system_brand_id',
                'Tblbook.brand_name',
                'Tbooks.content',
                'Tblbook.company',
                'Tblbook.form_class',
                'Tgen.system_generic_id',
        		'Tsec1.section1_id',
    			'Tsec2.section2_id',
    			'Tsec3.section3_id',
    			'Tsec4.section4_id'
    
            ));
       
            $query->innerJoin('Tblbooks', 'Tbooks', array("Tblbook.system_brand_id = Tbooks.system_brands_id")); 
            $query->innerJoin('Tblbrandgenericgroupsms','Tgen',array("Tblbook.system_brand_id = Tgen.system_brand_id"));
            $query->innerJoin('Tblproductsections', 'Tprodsec', array(" Tblbook.system_product_id = Tprodsec.system_product_id")); 
            $query->leftJoin('Tblsection', 'Tsec', array(" Tprodsec.system_section_id = Tsec.system_section_id")); 
            $query->leftJoin('Tblsection1', 'Tsec1', array(" Tsec.system_section1_id = Tsec1.system_section1_id"));
            $query->leftJoin('Tblsection2', 'Tsec2', array(" Tsec.system_section2_id = Tsec2.system_section2_id"));
            $query->leftJoin('Tblsection3', 'Tsec3', array(" Tsec.system_section3_id = Tsec3.system_section3_id"));
            $query->leftJoin('Tblsection4', 'Tsec4', array(" Tsec.system_section4_id = Tsec4.system_section4_id"));
            $query->where(array("Tblbook.system_company_id" => "$urlresult"));
            $query->groupBy('brand_name');
            $query->sortBy('brand_name','ASC');
            $products = $modx->getCollection('Tblbook',$query);
    
         foreach($products as $product){
             
    
            
             $display_content = substr($product->get('content'),0,80);
            if (strlen($product->get('content')) >= 80){
                $display_content .= '...'; 
                }
           
               $prod .=$product->get('system_product_id');
               $output .='<div id="display_drugs_inside">';
               $output .='<span id="display_drugs_content1">'.'<a href = "[[~3]]&alpha='.$product->get('system_brand_id').'&genid='.$product->get('system_generic_id').'&prodid='.$product->get('system_product_id').'">' . $product->get('brand_name') . '</a>' .'</span>'.'<span style="float:right;color:#5b5b5b;font-size:11px;font-family:Arial, sans-serif;">'.$product->get('form_class').'</span>'.'<br />';
               $output .='<span style="font-weight:bold;color:#5b5b5b;font-size:11px;font-family:Arial, sans-serif;">'.'Content: '.'</span>'.'<span id="display_drugs_contents">'. $display_content .'</span>'.'<br />';
               $output .='<span style="font-weight:bold;color:#5b5b5b;font-size:11px;font-family:Arial, sans-serif;">'.'PVET Drug Class: '.'</span>'.'<span id="display_drugs_contents">'.$product->get('section1_id').'/'.$product->get('section2_id').'/'.$product->get('section3_id').'/'.$product->get('section4_id').'</span>'.'<br />';
               $output .='<span style="font-weight:bold;color:#5b5b5b;font-size:11px;font-family:Arial, sans-serif;">'.'Company: '.'</span>'.'<span id="display_drugs_contents">'. $product->get('company') .'</span>';
               $output .='</div>';
               
         }        
    return $output;



    this is the mysql code

    SELECT tblbook.brand_name,
    tblbooks.content,
    tblsection1.section1_id,
    tblsection2.section2_id,
    tblsection3.section3_id,
    tblsection4.section4_id,
    tblbook.Company
    From tblbook
    INNER Join tblbooks ON tblbook.system_brand_id = tblbooks.system_brands_id
    INNER JOIN tblproductsections ON tblbook.system_product_id = tblproductsections.system_product_id
    LEFT JOIN tblsection ON tblproductsections.system_section_id = tblsection.system_section_id
    LEFT JOIN tblsection1 ON tblsection.system_section1_id = tblsection1.system_section1_id
    LEFT JOIN tblsection2 ON tblsection.system_section2_id = tblsection2.system_section2_id
    LEFT JOIN tblsection3 ON tblsection.system_section3_id = tblsection3.system_section3_id
    LEFT JOIN tblsection4 ON tblsection.system_section4_id = tblsection4.system_section4_id
    WHERE tblbook.system_company_id = '20010502' GROUP BY brand_name ORDER BY brand_name asc;


    the query time is 146.888s how can i make a little bit faster
    thanks in advance!!

      • 4172
      • 5,888 Posts
      this query-time is with how many results?
      are all involved fields properly indexed?

        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 44231
        • 126 Posts
        thanks for the reply

        its has 23 result
        and yes it was properly indexed
          • 44231
          • 126 Posts
          is there another way to solve this?
          i'm willing start over the query if i have to

          thanks
            • 4172
            • 5,888 Posts
            the query doesn't look that bad for me.
            Did you try to run the query with phpmyadmin?
            does it then take that long, too?
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 44231
              • 126 Posts
              yes it give same results
                • 42602
                • 81 Posts
                You have all indexed properly? That should run quite snappy if everything is ok, so first I would see if the all _id columns are properly indexed.

                You can also run command

                EXPLAIN SELECT tblbook.brand_name,
                tblbooks.content,
                tblsection1.section1_id,
                tblsection2.section2_id,
                tblsection3.section3_id,
                tblsection4.section4_id,
                tblbook.Company
                From tblbook
                INNER Join tblbooks ON tblbook.system_brand_id = tblbooks.system_brands_id
                INNER JOIN tblproductsections ON tblbook.system_product_id = tblproductsections.system_product_id
                LEFT JOIN tblsection ON tblproductsections.system_section_id = tblsection.system_section_id
                LEFT JOIN tblsection1 ON tblsection.system_section1_id = tblsection1.system_section1_id
                LEFT JOIN tblsection2 ON tblsection.system_section2_id = tblsection2.system_section2_id
                LEFT JOIN tblsection3 ON tblsection.system_section3_id = tblsection3.system_section3_id
                LEFT JOIN tblsection4 ON tblsection.system_section4_id = tblsection4.system_section4_id
                WHERE tblbook.system_company_id = '20010502' GROUP BY brand_name ORDER BY brand_name asc;


                in phpmyadmin to see if the query uses indexes. If 'type' column says ALL or 'key' column is NULL. The query is not using index for that table. The rows column will tell how many rows the part of query has to go through. There are loads of possibilities what is going wrong, but query is all together is pretty simple so explain can give good hints.
                  • 44231
                  • 126 Posts
                  thanks for the reply

                  there 2 rows which has a column 'type' says ALL and 'key' is null

                  what is the of this?what should I do?

                  sorry Im a newbie
                    • 4172
                    • 5,888 Posts
                    what is your xpdo-schema or better mysql-table-structure-dump of this tables?
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 44231
                      • 126 Posts
                      here is my schema

                      <?xml version="1.0" encoding="UTF-8"?>
                      <model package="modx_tblbook" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
                      	<object class="AccessActiondom" table="access_actiondom" extends="xPDOSimpleObject">
                      		<field key="target" dbtype="varchar" precision="100" phptype="string" null="false" default="" index="index" />
                      		<field key="principal_class" dbtype="varchar" precision="100" phptype="string" null="false" default="modPrincipal" index="index" />
                      		<field key="principal" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="authority" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="9999" index="index" />
                      		<field key="policy" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      
                      		<index alias="target" name="target" primary="false" unique="false" type="BTREE" >
                      			<column key="target" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal_class" name="principal_class" primary="false" unique="false" type="BTREE" >
                      			<column key="principal_class" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal" name="principal" primary="false" unique="false" type="BTREE" >
                      			<column key="principal" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="authority" name="authority" primary="false" unique="false" type="BTREE" >
                      			<column key="authority" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="policy" name="policy" primary="false" unique="false" type="BTREE" >
                      			<column key="policy" length="" collation="A" null="false" />
                      		</index>
                      	</object>
                      	<object class="AccessActions" table="access_actions" extends="xPDOSimpleObject">
                      		<field key="target" dbtype="varchar" precision="100" phptype="string" null="false" default="" index="index" />
                      		<field key="principal_class" dbtype="varchar" precision="100" phptype="string" null="false" default="modPrincipal" index="index" />
                      		<field key="principal" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="authority" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="9999" index="index" />
                      		<field key="policy" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      
                      		<index alias="target" name="target" primary="false" unique="false" type="BTREE" >
                      			<column key="target" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal_class" name="principal_class" primary="false" unique="false" type="BTREE" >
                      			<column key="principal_class" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal" name="principal" primary="false" unique="false" type="BTREE" >
                      			<column key="principal" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="authority" name="authority" primary="false" unique="false" type="BTREE" >
                      			<column key="authority" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="policy" name="policy" primary="false" unique="false" type="BTREE" >
                      			<column key="policy" length="" collation="A" null="false" />
                      		</index>
                      	</object>
                      	<object class="AccessCategory" table="access_category" extends="xPDOSimpleObject">
                      		<field key="target" dbtype="varchar" precision="100" phptype="string" null="false" default="" index="index" />
                      		<field key="principal_class" dbtype="varchar" precision="100" phptype="string" null="false" default="modPrincipal" index="index" />
                      		<field key="principal" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="authority" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="9999" index="index" />
                      		<field key="policy" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="context_key" dbtype="varchar" precision="100" phptype="string" null="false" default="" index="index" />
                      
                      		<index alias="target" name="target" primary="false" unique="false" type="BTREE" >
                      			<column key="target" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal_class" name="principal_class" primary="false" unique="false" type="BTREE" >
                      			<column key="principal_class" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal" name="principal" primary="false" unique="false" type="BTREE" >
                      			<column key="principal" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="authority" name="authority" primary="false" unique="false" type="BTREE" >
                      			<column key="authority" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="policy" name="policy" primary="false" unique="false" type="BTREE" >
                      			<column key="policy" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="context_key" name="context_key" primary="false" unique="false" type="BTREE" >
                      			<column key="context_key" length="" collation="A" null="false" />
                      		</index>
                      	</object>
                      	<object class="AccessContext" table="access_context" extends="xPDOSimpleObject">
                      		<field key="target" dbtype="varchar" precision="100" phptype="string" null="false" default="" index="index" />
                      		<field key="principal_class" dbtype="varchar" precision="100" phptype="string" null="false" default="modPrincipal" index="index" />
                      		<field key="principal" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="authority" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="9999" index="index" />
                      		<field key="policy" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      
                      		<index alias="target" name="target" primary="false" unique="false" type="BTREE" >
                      			<column key="target" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal_class" name="principal_class" primary="false" unique="false" type="BTREE" >
                      			<column key="principal_class" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal" name="principal" primary="false" unique="false" type="BTREE" >
                      			<column key="principal" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="authority" name="authority" primary="false" unique="false" type="BTREE" >
                      			<column key="authority" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="policy" name="policy" primary="false" unique="false" type="BTREE" >
                      			<column key="policy" length="" collation="A" null="false" />
                      		</index>
                      	</object>
                      	<object class="AccessElements" table="access_elements" extends="xPDOSimpleObject">
                      		<field key="target" dbtype="varchar" precision="100" phptype="string" null="false" default="" index="index" />
                      		<field key="principal_class" dbtype="varchar" precision="100" phptype="string" null="false" default="modPrincipal" index="index" />
                      		<field key="principal" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="authority" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="9999" index="index" />
                      		<field key="policy" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="context_key" dbtype="varchar" precision="100" phptype="string" null="false" default="" index="index" />
                      
                      		<index alias="target" name="target" primary="false" unique="false" type="BTREE" >
                      			<column key="target" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal_class" name="principal_class" primary="false" unique="false" type="BTREE" >
                      			<column key="principal_class" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal" name="principal" primary="false" unique="false" type="BTREE" >
                      			<column key="principal" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="authority" name="authority" primary="false" unique="false" type="BTREE" >
                      			<column key="authority" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="policy" name="policy" primary="false" unique="false" type="BTREE" >
                      			<column key="policy" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="context_key" name="context_key" primary="false" unique="false" type="BTREE" >
                      			<column key="context_key" length="" collation="A" null="false" />
                      		</index>
                      	</object>
                      	<object class="AccessMediaSource" table="access_media_source" extends="xPDOSimpleObject">
                      		<field key="target" dbtype="varchar" precision="100" phptype="string" null="false" default="" index="index" />
                      		<field key="principal_class" dbtype="varchar" precision="100" phptype="string" null="false" default="modPrincipal" index="index" />
                      		<field key="principal" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="authority" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="9999" index="index" />
                      		<field key="policy" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="context_key" dbtype="varchar" precision="100" phptype="string" null="false" default="" index="index" />
                      
                      		<index alias="target" name="target" primary="false" unique="false" type="BTREE" >
                      			<column key="target" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal_class" name="principal_class" primary="false" unique="false" type="BTREE" >
                      			<column key="principal_class" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal" name="principal" primary="false" unique="false" type="BTREE" >
                      			<column key="principal" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="authority" name="authority" primary="false" unique="false" type="BTREE" >
                      			<column key="authority" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="policy" name="policy" primary="false" unique="false" type="BTREE" >
                      			<column key="policy" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="context_key" name="context_key" primary="false" unique="false" type="BTREE" >
                      			<column key="context_key" length="" collation="A" null="false" />
                      		</index>
                      	</object>
                      	<object class="AccessMenus" table="access_menus" extends="xPDOSimpleObject">
                      		<field key="target" dbtype="varchar" precision="100" phptype="string" null="false" default="" index="index" />
                      		<field key="principal_class" dbtype="varchar" precision="100" phptype="string" null="false" default="modPrincipal" index="index" />
                      		<field key="principal" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="authority" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="9999" index="index" />
                      		<field key="policy" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      
                      		<index alias="target" name="target" primary="false" unique="false" type="BTREE" >
                      			<column key="target" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal_class" name="principal_class" primary="false" unique="false" type="BTREE" >
                      			<column key="principal_class" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal" name="principal" primary="false" unique="false" type="BTREE" >
                      			<column key="principal" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="authority" name="authority" primary="false" unique="false" type="BTREE" >
                      			<column key="authority" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="policy" name="policy" primary="false" unique="false" type="BTREE" >
                      			<column key="policy" length="" collation="A" null="false" />
                      		</index>
                      	</object>
                      	<object class="AccessPermissions" table="access_permissions" extends="xPDOSimpleObject">
                      		<field key="template" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="name" dbtype="varchar" precision="255" phptype="string" null="false" default="" index="index" />
                      		<field key="description" dbtype="text" phptype="string" null="false" />
                      		<field key="value" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="1" />
                      
                      		<index alias="template" name="template" primary="false" unique="false" type="BTREE" >
                      			<column key="template" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="name" name="name" primary="false" unique="false" type="BTREE" >
                      			<column key="name" length="" collation="A" null="false" />
                      		</index>
                      	</object>
                      	<object class="AccessPolicies" table="access_policies" extends="xPDOSimpleObject">
                      		<field key="name" dbtype="varchar" precision="255" phptype="string" null="false" index="unique" />
                      		<field key="description" dbtype="mediumtext" phptype="string" null="true" />
                      		<field key="parent" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="template" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="class" dbtype="varchar" precision="255" phptype="string" null="false" default="" index="index" />
                      		<field key="data" dbtype="text" phptype="string" null="true" />
                      		<field key="lexicon" dbtype="varchar" precision="255" phptype="string" null="false" default="permissions" />
                      
                      		<index alias="name" name="name" primary="false" unique="true" type="BTREE" >
                      			<column key="name" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="parent" name="parent" primary="false" unique="false" type="BTREE" >
                      			<column key="parent" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="class" name="class" primary="false" unique="false" type="BTREE" >
                      			<column key="class" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="template" name="template" primary="false" unique="false" type="BTREE" >
                      			<column key="template" length="" collation="A" null="false" />
                      		</index>
                      	</object>
                      	<object class="AccessPolicyTemplateGroups" table="access_policy_template_groups" extends="xPDOSimpleObject">
                      		<field key="name" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
                      		<field key="description" dbtype="mediumtext" phptype="string" null="true" />
                      	</object>
                      	<object class="AccessPolicyTemplates" table="access_policy_templates" extends="xPDOSimpleObject">
                      		<field key="template_group" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
                      		<field key="name" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
                      		<field key="description" dbtype="mediumtext" phptype="string" null="true" />
                      		<field key="lexicon" dbtype="varchar" precision="255" phptype="string" null="false" default="permissions" />
                      	</object>
                      	<object class="AccessResourceGroups" table="access_resource_groups" extends="xPDOSimpleObject">
                      		<field key="target" dbtype="varchar" precision="100" phptype="string" null="false" default="" index="index" />
                      		<field key="principal_class" dbtype="varchar" precision="100" phptype="string" null="false" default="modPrincipal" index="index" />
                      		<field key="principal" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="authority" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="9999" index="index" />
                      		<field key="policy" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="context_key" dbtype="varchar" precision="100" phptype="string" null="false" default="" index="index" />
                      
                      		<index alias="target" name="target" primary="false" unique="false" type="BTREE" >
                      			<column key="target" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal_class" name="principal_class" primary="false" unique="false" type="BTREE" >
                      			<column key="principal_class" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal" name="principal" primary="false" unique="false" type="BTREE" >
                      			<column key="principal" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="authority" name="authority" primary="false" unique="false" type="BTREE" >
                      			<column key="authority" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="policy" name="policy" primary="false" unique="false" type="BTREE" >
                      			<column key="policy" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="context_key" name="context_key" primary="false" unique="false" type="BTREE" >
                      			<column key="context_key" length="" collation="A" null="false" />
                      		</index>
                      	</object>
                      	<object class="AccessResources" table="access_resources" extends="xPDOSimpleObject">
                      		<field key="target" dbtype="varchar" precision="100" phptype="string" null="false" default="" index="index" />
                      		<field key="principal_class" dbtype="varchar" precision="100" phptype="string" null="false" default="modPrincipal" index="index" />
                      		<field key="principal" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="authority" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="9999" index="index" />
                      		<field key="policy" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="context_key" dbtype="varchar" precision="100" phptype="string" null="false" default="" index="index" />
                      
                      		<index alias="target" name="target" primary="false" unique="false" type="BTREE" >
                      			<column key="target" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal_class" name="principal_class" primary="false" unique="false" type="BTREE" >
                      			<column key="principal_class" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal" name="principal" primary="false" unique="false" type="BTREE" >
                      			<column key="principal" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="authority" name="authority" primary="false" unique="false" type="BTREE" >
                      			<column key="authority" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="policy" name="policy" primary="false" unique="false" type="BTREE" >
                      			<column key="policy" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="context_key" name="context_key" primary="false" unique="false" type="BTREE" >
                      			<column key="context_key" length="" collation="A" null="false" />
                      		</index>
                      	</object>
                      	<object class="AccessTemplatevars" table="access_templatevars" extends="xPDOSimpleObject">
                      		<field key="target" dbtype="varchar" precision="100" phptype="string" null="false" default="" index="index" />
                      		<field key="principal_class" dbtype="varchar" precision="100" phptype="string" null="false" default="modPrincipal" index="index" />
                      		<field key="principal" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="authority" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="9999" index="index" />
                      		<field key="policy" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="context_key" dbtype="varchar" precision="100" phptype="string" null="false" default="" index="index" />
                      
                      		<index alias="target" name="target" primary="false" unique="false" type="BTREE" >
                      			<column key="target" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal_class" name="principal_class" primary="false" unique="false" type="BTREE" >
                      			<column key="principal_class" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="principal" name="principal" primary="false" unique="false" type="BTREE" >
                      			<column key="principal" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="authority" name="authority" primary="false" unique="false" type="BTREE" >
                      			<column key="authority" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="policy" name="policy" primary="false" unique="false" type="BTREE" >
                      			<column key="policy" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="context_key" name="context_key" primary="false" unique="false" type="BTREE" >
                      			<column key="context_key" length="" collation="A" null="false" />
                      		</index>
                      	</object>
                      	<object class="Actiondom" table="actiondom" extends="xPDOSimpleObject">
                      		<field key="set" dbtype="int" precision="11" phptype="integer" null="false" default="0" index="index" />
                      		<field key="action" dbtype="int" precision="11" phptype="integer" null="false" default="0" index="index" />
                      		<field key="name" dbtype="varchar" precision="255" phptype="string" null="false" default="" index="index" />
                      		<field key="description" dbtype="text" phptype="string" null="true" />
                      		<field key="xtype" dbtype="varchar" precision="100" phptype="string" null="false" default="" />
                      		<field key="container" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
                      		<field key="rule" dbtype="varchar" precision="100" phptype="string" null="false" default="" />
                      		<field key="value" dbtype="text" phptype="string" null="false" />
                      		<field key="constraint" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
                      		<field key="constraint_field" dbtype="varchar" precision="100" phptype="string" null="false" default="" />
                      		<field key="constraint_class" dbtype="varchar" precision="100" phptype="string" null="false" default="" />
                      		<field key="active" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="1" index="index" />
                      		<field key="for_parent" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" index="index" />
                      		<field key="rank" dbtype="int" precision="11" phptype="integer" null="false" default="0" index="index" />
                      
                      		<index alias="set" name="set" primary="false" unique="false" type="BTREE" >
                      			<column key="set" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="action" name="action" primary="false" unique="false" type="BTREE" >
                      			<column key="action" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="name" name="name" primary="false" unique="false" type="BTREE" >
                      			<column key="name" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="active" name="active" primary="false" unique="false" type="BTREE" >
                      			<column key="active" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="for_parent" name="for_parent" primary="false" unique="false" type="BTREE" >
                      			<column key="for_parent" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="rank" name="rank" primary="false" unique="false" type="BTREE" >
                      			<column key="rank" length="" collation="A" null="false" />
                      		</index>
                      	</object>
                      	<object class="Actions" table="actions" extends="xPDOSimpleObject">
                      		<field key="namespace" dbtype="varchar" precision="100" phptype="string" null="false" default="core" index="index" />
                      		<field key="controller" dbtype="varchar" precision="255" phptype="string" null="false" index="index" />
                      		<field key="haslayout" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="1" />
                      		<field key="lang_topics" dbtype="text" phptype="string" null="false" />
                      		<field key="assets" dbtype="text" phptype="string" null="false" />
                      		<field key="help_url" dbtype="text" phptype="string" null="false" />
                      
                      		<index alias="namespace" name="namespace" primary="false" unique="false" type="BTREE" >
                      			<column key="namespace" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="controller" name="controller" primary="false" unique="false" type="BTREE" >
                      			<column key="controller" length="" collation="A" null="false" />
                      		</index>
                      	</object>
                      	<object class="ActionsFields" table="actions_fields" extends="xPDOSimpleObject">
                      		<field key="action" dbtype="int" precision="11" phptype="integer" null="false" default="0" index="index" />
                      		<field key="name" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
                      		<field key="type" dbtype="varchar" precision="100" phptype="string" null="false" default="field" index="index" />
                      		<field key="tab" dbtype="varchar" precision="255" phptype="string" null="false" default="" index="index" />
                      		<field key="form" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
                      		<field key="other" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
                      		<field key="rank" dbtype="int" precision="11" phptype="integer" null="false" default="0" />
                      
                      		<index alias="action" name="action" primary="false" unique="false" type="BTREE" >
                      			<column key="action" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="type" name="type" primary="false" unique="false" type="BTREE" >
                      			<column key="type" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="tab" name="tab" primary="false" unique="false" type="BTREE" >
                      			<column key="tab" length="" collation="A" null="false" />
                      		</index>
                      	</object>
                      	<object class="ActiveUsers" table="active_users" extends="xPDOObject">
                      		<field key="internalKey" dbtype="int" precision="9" phptype="integer" null="false" default="0" index="pk" />
                      		<field key="username" dbtype="varchar" precision="50" phptype="string" null="false" default="" />
                      		<field key="lasthit" dbtype="int" precision="20" phptype="integer" null="false" default="0" />
                      		<field key="id" dbtype="int" precision="10" phptype="integer" null="true" />
                      		<field key="action" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
                      		<field key="ip" dbtype="varchar" precision="20" phptype="string" null="false" default="" />
                      
                      		<index alias="PRIMARY" name="PRIMARY" primary="true" unique="true" type="BTREE" >
                      			<column key="internalKey" length="" collation="A" null="false" />
                      		</index>
                      	</object>
                      	<object class="BanneryAds" table="bannery_ads" extends="xPDOSimpleObject">
                      		<field key="name" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
                      		<field key="url" dbtype="varchar" precision="255" phptype="string" null="true" default="" />
                      		<field key="image" dbtype="varchar" precision="255" phptype="string" null="true" default="" />
                      		<field key="active" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
                      		<field key="description" dbtype="text" phptype="string" null="true" />
                      	</object>
                      	<object class="BanneryAdsPositions" table="bannery_ads_positions" extends="xPDOSimpleObject">
                      		<field key="ad" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" index="index" />
                      		<field key="position" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" index="index" />
                      		<field key="idx" dbtype="int" precision="10" phptype="integer" null="false" default="0" />
                      
                      		<index alias="ad" name="ad" primary="false" unique="false" type="BTREE" >
                      			<column key="ad" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="position" name="position" primary="false" unique="false" type="BTREE" >
                      			<column key="position" length="" collation="A" null="false" />
                      		</index>
                      	</object>
                      	<object class="BanneryClicks" table="bannery_clicks" extends="xPDOSimpleObject">
                      		<field key="ad" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" index="index" />
                      		<field key="position" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" index="index" />
                      		<field key="clickdate" dbtype="datetime" phptype="datetime" null="true" />
                      		<field key="referrer" dbtype="varchar" precision="255" phptype="string" null="false" />
                      		<field key="ip" dbtype="varchar" precision="39" phptype="string" null="false" />
                      
                      		<index alias="ad" name="ad" primary="false" unique="false" type="BTREE" >
                      			<column key="ad" length="" collation="A" null="false" />
                      		</index>
                      		<index alias="position" name="position" primary="false" unique="false" type="BTREE" >
                      			<column key="position" length="" collation="A" null="false" />
                      		</index>
                      	</object>
                      	<object class="BanneryPositions" table="bannery_positions" extends="xPDOSimpleObject">
                      		<field key="name" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
                      	</object>
                      	<object class="Book" table="book" extends="xPDOSimpleObject">
                      		<field key="bookname" dbtype="varchar" precision="100" phptype="string" null="false" />
                      		<field key="description" dbtype="mediumtext" phptype="string" null="true" />
                      	</object>
                      	<object class="Categories" table="categories" extends="xPDOSimpleObject">
                      		<field key="parent" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="true" default="0" index="index" />
                      		<field key="category" dbtype="varchar" precision="45" phptype="string" null="false" default="" index="unique" />
                      
                      		<index alias="category" name="category