Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82141

mDataProp on Server-side with Oracle

$
0
0
I'm using the default server-side script for oracle but am having trouble getting mDataProp to work with it... I'm new to oracle so I'm not quite sure I've added all of the necessary mDataProp statements to my server-side script.

Here's a debugger output: http://debug.datatables.net/iloviy

So far, I've changed the following sections like so:
/*
     * Ordering
     */
      
     
    if ( isset( $_POST['iSortCol_0'] ) )
    {
        $sOrder = "ORDER BY ";
         
        //Go over all sorting cols
        for ( $i=0 ; $i<intval( $_POST['iSortingCols'] ) ; $i++ )
        {
            //If need to sort by current col
            if ( $_POST[ 'bSortable_'.intval($_POST['iSortCol_'.$i]) ] == "true" )
            {
                //Add to the order by clause
		  $iColumnIndex = $_POST['mDataProp_'.$_POST['iSortCol_'.$i]];
                //$sOrder .= $aColumns[ intval( $_POST['iSortCol_'.$i] ) ];
                $sOrder .= $aColumns[ intval( $iColumnIndex ) ];
 
                //Determine if it is sorted asc or desc
                if (strcasecmp(( $_POST['sSortDir_'.$i] ), "asc") == 0)
                {
                    $sOrder .=" asc, ";
                }else
                {
                    $sOrder .=" desc, ";
                }
            }
        }
        
         
        //Remove the last space / comma
        $sOrder = substr_replace( $sOrder, "", -2 );
         
        //Check if there is an order by clause
        if ( $sOrder == "ORDER BY" )
        {
            /*
            * If there is no order by clause - ORDER BY INDEX COLUMN!!! DON'T DELETE IT!
            * If there is no order by clause there might be bugs in table display.
            * No order by clause means that the db is not responsible for the data ordering,
            * which means that the same row can be displayed in two pages - while
            * another row will not be displayed at all.
            */
            $sOrder = "ORDER BY ".$sIndexColumn;
             
        }
    }

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
/* Individual column filtering */
    $sWhereSpecificArray = array();
    $sWhereSpecificArrayCount = 0;
    for ( $i=0 ; $i<count($aColumns) ; $i++ )
    {
        if ( $_POST['bSearchable_'.$i] == "true" && $_POST['sSearch_'.$i] != '' )
        {
            //If there was no where clause
            if ( $sWhere == "" )
            {
                $sWhere = "WHERE ";
            }
            else
            {
                $sWhere .= " AND ";
            }
             
            //Add the clause of the specific col to the where clause
	     $iColumnIndex = $_POST['mDataProp_'.$_POST['iSortCol_'.$i]];
            $sWhere .= $aColumns[$iColumnIndex]." LIKE '%' || :whereSpecificParam".$sWhereSpecificArrayCount." || '%' ";
             
            //Inc sWhereSpecificArrayCount. It is needed for the bind var.
            //We could just do count($sWhereSpecificArray) - but that would be less efficient.
            $sWhereSpecificArrayCount++;
             
            //Add current search param to the array for later use (binding).
            $sWhereSpecificArray[] =  $_POST['sSearch_'.$i];
             
        }
    }
     
    //If there is still no where clause - set a general - always true where clause
    if ( $sWhere == "" )
    {
        $sWhere = "WHERE 1=1";
    }



Viewing all articles
Browse latest Browse all 82141

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>