lib/ezdb/classes/ezdbinterface.php
function prepareSqlQuery( &$fd, &$buffer )
    {

        $sqlQueryArray = array();
        while( count( $sqlQueryArray ) == 0 && !feof( $fd ) )
        {
            $buffer  .= fread( $fd, 4096 );
            if ( $buffer )
            {
                // Fix SQL file by deleting all comments and newlines
                // eZDebug::writeDebug( $buffer, "read data" );
                $sqlQuery = preg_replace( array( "/^#.*\n" . "/m",
                                                 "#^/\*.*\*/\n" . "#m",
                                                 "/^--.*\n" . "/m",
                                                 "/\n|\r\n|\r/m" ),
                                          array( "",
                                                 "",
                                                 "",
                                                 "\n" ),
                                          $buffer );
//            eZDebug::writeDebug( $sqlQuery, "read data" );

                // Split the query into an array
                $sqlQueryArray = preg_split( "/;\n/m", $sqlQuery );

                if ( preg_match( '/;\n/m', $sqlQueryArray[ count( $sqlQueryArray ) -1 ] ) )
                {
                    $buffer = '';
                }
                else
                {
                    $buffer = $sqlQueryArray[ count( $sqlQueryArray ) -1 ];
                    array_splice( $sqlQueryArray, count( $sqlQueryArray ) -1 , 1 );
                }
            }
            else
            {
                return $sqlQueryArray;

            }
        }
        return $sqlQueryArray;
    }
function prepareSqlQuery( &$fd, &$buffer )
    {

        $sqlQueryArray = array();
        while( count( $sqlQueryArray ) == 0 && !feof( $fd ) )
        {
            $buffer  .= fread( $fd, 4096 );
            if ( $buffer )
            {
                // Fix SQL file by deleting all comments and newlines
                // eZDebug::writeDebug( $buffer, "read data" );
                $sqlQuery = preg_replace( array( "/^#.*\n" . "/m",
                                                 "#^/\*.*\*/\n" . "#m",
                                                 "/^--.*\n" . "/m",
                                                 "/\n|\r\n|\r/m" ),
                                          array( "",
                                                 "",
                                                 "",
                                                 "\n" ),
                                          $buffer );
//            eZDebug::writeDebug( $sqlQuery, "read data" );

                // Split the query into an array
                $sqlQueryArray = preg_split( "/;\n/m", $sqlQuery );

                if ( preg_match( '/;\n/m', $sqlQueryArray[ count( $sqlQueryArray ) -1 ] ) )
                {
                    $buffer = '';
                }
                else
                {
                    $buffer = $sqlQueryArray[ count( $sqlQueryArray ) -1 ];
                    array_splice( $sqlQueryArray, count( $sqlQueryArray ) -1 , 1 );
                }
            }
            else
            {
                return $sqlQueryArray;

            }
        }
        return $sqlQueryArray;
    }
function prepareSqlQuery ( & $ fd , & $ buffer ) { $ sqlQueryArray = array ( ) ; while ( count ( $ sqlQueryArray ) == 0 && ! feof ( $ fd ) ) { $ buffer .= fread ( $ fd , 4096 ) ; if ( $ buffer ) { // Fix SQL file by deleting all comments and newlines // eZDebug::writeDebug( $buffer, "read data" ); $ sqlQuery = preg_replace ( array ( "/^#.*\n" . "/m" , "#^/\*.*\*/\n" . "#m" , "/^--.*\n" . "/m" , "/\n|\r\n|\r/m" ) , array ( "" , "" , "" , "\n" ) , $ buffer ) ; //            eZDebug::writeDebug( $sqlQuery, "read data" ); // Split the query into an array $ sqlQueryArray = preg_split ( "/;\n/m" , $ sqlQuery ) ; if ( preg_match ( '/;\n/m' , $ sqlQueryArray [ count ( $ sqlQueryArray ) - 1 ] ) ) { $ buffer = '' ; } else { $ buffer = $ sqlQueryArray [ count ( $ sqlQueryArray ) - 1 ] ; array_splice ( $ sqlQueryArray , count ( $ sqlQueryArray ) - 1 , 1 ) ; } } else { return $ sqlQueryArray ; } } return $ sqlQueryArray ; }
Prepare the sql file so we can create the database.

@access private
@param resource $fd The file descriptor
@param string $buffer Reference to string buffer for SQL queries.
@return array
Prepare the sql file so we can create the database .