--- T:\smk\test\demo-DRUPAL-6--1\database_mysql_dump.inc 2009-07-30 18:20:06.120623100 +0200 +++ database_mysql_dump.inc 2009-07-30 18:16:56.429839500 +0200 @@ -34,11 +34,13 @@ function demo_dump_db($filename, $option fwrite($fp, $header); foreach ($options['tables'] as $table => $dump_options) { - if ($dump_options['schema']) { - _demo_dump_table_schema($fp, $table); - } - if ($dump_options['data']) { - _demo_dump_table_data($fp, $table); + if (!_demo_table_is_view($table)) { + if ($dump_options['schema']) { + _demo_dump_table_schema($fp, $table); + } + if ($dump_options['data']) { + _demo_dump_table_data($fp, $table); + } } } @@ -222,3 +224,15 @@ function _demo_get_fields($result) { return $fields; } +/** + * Determine whether the given table is a VIEW. + */ +function _demo_table_is_view($table) { + static $tables = array(); + if (!isset($tables[$table])) { + $status = db_fetch_array(db_query("SHOW TABLE STATUS LIKE '%s'", $table)); + $tables[$table] = (strtoupper(substr($status['Comment'], 0, 4)) == 'VIEW'); + } + return $tables[$table]; +} +