News:

Please note these forums are mostly a testing ground for my SMF work and I don't really use them otherwise.

Main Menu

Paste-1217697416:v:use_geshi-1:v:type-php

Started by Guest, Aug 02, 2008, 05:16 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Guest

   // Lets get the create statement directly from SQLite.
   $result = $smcFunc['db_query']('', '
      SELECT sql
      FROM sqlite_master
      WHERE type = {string:type}
         AND name = {string:table_name}',
      array(
         'type' => 'table',
         'table_name' => $tableName,
      )
   );
   list ($schema_create) = $smcFunc['db_fetch_row']($result);
   $smcFunc['db_free_result']($result);

   // Now the indexes.
   $result = $smcFunc['db_query']('', '
      SELECT sql
      FROM sqlite_master
      WHERE type = {string:type}
         AND tbl_name = {string:table_name}',
      array(
         'type' => 'index',
         'table_name' => $tableName,
      )
   );
   $indexes = array();
   while ($row = $smcFunc['db_fetch_assoc']($result))
      if (trim($row['sql']) != '')
         $indexes[] = $row['sql'];
   $smcFunc['db_free_result']($result);