public function columnCount()
    {

        switch ($this->mode) {

            case "mysql":
                $columns = $this->result->field_count;
                break;

            case "postgres":
            case "redshift":
                $columns = pg_num_fields($this->result);
                break;

            case "odbc":
                $columns = odbc_num_fields($this->result);
                break;

            case "sqlite":
                $columns = $this->result->numColumns();
                break;

            case "mssql":
                $columns = mssql_num_fields($this->result);
                break;

            case "mssqlsrv":
                $columns = sqlsrv_num_fields($this->result);
                break;
        }

        if ($columns === false || $columns < 0) {
            throw new \Exception("Failed to get the column count from the result set");
        }

        return $columns;
    }
public function columnCount()
    {

        switch ($this->mode) {

            case "mysql":
                $columns = $this->result->field_count;
                break;

            case "postgres":
            case "redshift":
                $columns = pg_num_fields($this->result);
                break;

            case "odbc":
                $columns = odbc_num_fields($this->result);
                break;

            case "sqlite":
                $columns = $this->result->numColumns();
                break;

            case "mssql":
                $columns = mssql_num_fields($this->result);
                break;

            case "mssqlsrv":
                $columns = sqlsrv_num_fields($this->result);
                break;
        }

        if ($columns === false || $columns < 0) {
            throw new \Exception("Failed to get the column count from the result set");
        }

        return $columns;
    }
public function columnCount ( ) { switch ( $ this -> mode ) { case "mysql" : $ columns = $ this -> result -> field_count ; break ; case "postgres" : case "redshift" : $ columns = pg_num_fields ( $ this -> result ) ; break ; case "odbc" : $ columns = odbc_num_fields ( $ this -> result ) ; break ; case "sqlite" : $ columns = $ this -> result -> numColumns ( ) ; break ; case "mssql" : $ columns = mssql_num_fields ( $ this -> result ) ; break ; case "mssqlsrv" : $ columns = sqlsrv_num_fields ( $ this -> result ) ; break ; } if ( $ columns === false || $ columns < 0 ) { throw new \ Exception ( "Failed to get the column count from the result set" ) ; } return $ columns ; }
Get the number of columns in the result set

@return int
Get the number of columns in the result set