Blame view

pma/libraries/import/README 1.79 KB
a1684257   Administrator   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  This directory holds import plugins for phpMyAdmin. Plugin should
  basically look like following code. Official plugins need to have str*
  messages with their definition in language files, if you build some
  plugins for your use, you can use directly texts in plugin.
  
  <?php
  // vim: expandtab sw=4 ts=4 sts=4 ft=php:
  
  /* Demo import plugin for phpMyAdmin */
  
  if (isset($plugin_list)) {
      $plugin_list['name'] = array(           // set name of your plugin
          'text' => 'strName',                // text to be displayed as choice
          'extension' => '',                  // extension this plugin can handle
          'options' => array(                 // array of options for your plugin (optional)
              array('type' => '', 'name' => '', 'text' => ''), // type: bool or text, name: form element name, text: description in GUI, size: size of text element (optional). len: maximal size of input (optional)
          ),
          'options_text' => 'strNameImportOptions', // text to describe plugin options (must be set if options are used)
          );
  } else {
  /* We do not define function when plugin is just queried for information above */
      $buffer = '';
      while (!($finished && $i >= $len) && !$error && !$timeout_passed) {
          $data = PMA_importGetNextChunk();
          if ($data === false) {
              // subtract data we didn't handle yet and stop processing
              $offset -= strlen($buffer);
              break;
          } elseif ($data === true) {
              // Handle rest of buffer
          } else {
              // Append new data to buffer
              $buffer .= $data;
          }
          // PARSE $buffer here, post sql queries using:
          PMA_importRunQuery($sql, $verbose_sql_with_comments);
      } // End of import loop
      // Commit any possible data in buffers
      PMA_importRunQuery();
  }
  ?>