|
ZenCart_Documentation
1.5.0
http://www.collinsharper.com
|
00001 <?php 00010 define('HEADING_TITLE','SQL Query Executor'); 00011 define('HEADING_WARNING','BE SURE TO DO A FULL DATABASE BACKUP BEFORE RUNNING SCRIPTS HERE'); 00012 define('HEADING_WARNING2','If you are installing 3rd-party contributions, note that you do so at your own risk.<br />Zen Cart® makes no warranty as to the safety of scripts supplied by 3rd-party contributors. Test before using on your live database!'); 00013 define('HEADING_WARNING_INSTALLSCRIPTS', 'NOTE: Zen Cart database-upgrade scripts should NOT be run from this page.<br />Please upload the new <strong>zc_install</strong> folder and run the upgrade from there instead for better reliability.'); 00014 define('TEXT_QUERY_RESULTS','Query Results:'); 00015 define('TEXT_ENTER_QUERY_STRING','Enter the query <br />to be executed: <br /><br />Be sure to<br />end with ;'); 00016 define('TEXT_QUERY_FILENAME','Upload file:'); 00017 define('ERROR_NOTHING_TO_DO','Error: Nothing to do - no query or query-file specified.'); 00018 define('TEXT_CLOSE_WINDOW', '[ close window ]'); 00019 define('SQLPATCH_HELP_TEXT','The SQLPATCH tool lets you install system patches by pasting SQL code directly into the textarea '. 00020 'field here, or by uploading a supplied script (.SQL) file.<br />' . 00021 'When preparing scripts to be used by this tool, DO NOT include a table prefix, as this tool will ' . 00022 'automatically insert the required prefix for the active database, based on settings in the store\'s ' . 00023 'admin/includes/configure.php file (DB_PREFIX definition).<br /><br />' . 00024 'The commands entered or uploaded may only begin with the following statements, and MUST be in UPPERCASE:'. 00025 '<br /><ul><li>DROP TABLE IF EXISTS</li><li>CREATE TABLE</li><li>INSERT INTO</li><li>INSERT IGNORE INTO</li><li>ALTER TABLE</li>' . 00026 '<li>UPDATE (just a single table)</li><li>UPDATE IGNORE (just a single table)</li><li>DELETE FROM</li><li>DROP INDEX</li><li>CREATE INDEX</li>' . 00027 '<br /><li>SELECT </li></ul>' . 00028 '<h2>Advanced Methods</h2>The following methods can be used to issue more complex statements as necessary:<br /> 00029 To run some blocks of code together so that they are treated as one command by MySQL, you need the "<code>#NEXT_X_ROWS_AS_ONE_COMMAND:xxx</code>" value set. The parser will then treat X number of commands as one.<br /> 00030 If you are running this file thru phpMyAdmin or equivalent, the "#NEXT..." comment is ignored, and the script will process fine.<br /> 00031 <br /><strong>NOTE: </strong>SELECT.... FROM... and LEFT JOIN statements need the "FROM" or "LEFT JOIN" to be on a line by itself in order for the parse script to add the table prefix.<br /><br /> 00032 <em><strong>Examples:</strong></em> 00033 <ul><li><code>#NEXT_X_ROWS_AS_ONE_COMMAND:4<br /> 00034 SET @t1=0;<br /> 00035 SELECT (@t1:=configuration_value) as t1 <br /> 00036 FROM configuration <br /> 00037 WHERE configuration_key = \'KEY_NAME_HERE\';<br /> 00038 UPDATE product_type_layout SET configuration_value = @t1 WHERE configuration_key = \'KEY_NAME_TO_CHECK_HERE\';<br /> 00039 DELETE FROM configuration WHERE configuration_key = \'KEY_NAME_HERE\';<br /> </li> 00040 00041 <li>#NEXT_X_ROWS_AS_ONE_COMMAND:1<br /> 00042 INSERT INTO tablename <br /> 00043 (col1, col2, col3, col4)<br /> 00044 SELECT col_a, col_b, col_3, col_4<br /> 00045 FROM table2;<br /> </li> 00046 00047 <li>#NEXT_X_ROWS_AS_ONE_COMMAND:1<br /> 00048 INSERT INTO table1 <br /> 00049 (col1, col2, col3, col4 )<br /> 00050 SELECT p.othercol_a, p.othercol_b, po.othercol_c, pm.othercol_d<br /> 00051 FROM table2 p, table3 pm<br /> 00052 LEFT JOIN othercol_f po<br /> 00053 ON p.othercol_f = po.othercol_f<br /> 00054 WHERE p.othercol_f = pm.othercol_f;</li> 00055 </ul></code>' ); 00056 define('REASON_TABLE_ALREADY_EXISTS','Cannot create table %s because it already exists'); 00057 define('REASON_TABLE_DOESNT_EXIST','Cannot drop table %s because it does not exist.'); 00058 define('REASON_TABLE_NOT_FOUND','Cannot execute because table %s does not exist.'); 00059 define('REASON_CONFIG_KEY_ALREADY_EXISTS','Cannot insert configuration_key "%s" because it already exists'); 00060 define('REASON_COLUMN_ALREADY_EXISTS','Cannot ADD column %s because it already exists.'); 00061 define('REASON_COLUMN_DOESNT_EXIST_TO_DROP','Cannot DROP column %s because it does not exist.'); 00062 define('REASON_COLUMN_DOESNT_EXIST_TO_CHANGE','Cannot CHANGE column %s because it does not exist.'); 00063 define('REASON_PRODUCT_TYPE_LAYOUT_KEY_ALREADY_EXISTS','Cannot insert prod-type-layout configuration_key "%s" because it already exists'); 00064 define('REASON_INDEX_DOESNT_EXIST_TO_DROP','Cannot drop index %s on table %s because it does not exist.'); 00065 define('REASON_PRIMARY_KEY_DOESNT_EXIST_TO_DROP','Cannot drop primary key on table %s because it does not exist.'); 00066 define('REASON_INDEX_ALREADY_EXISTS','Cannot add index %s to table %s because it already exists.'); 00067 define('REASON_PRIMARY_KEY_ALREADY_EXISTS','Cannot add primary key to table %s because a primary key already exists.'); 00068 define('REASON_NO_PRIVILEGES','User '.DB_SERVER_USERNAME.'@'.DB_SERVER.' does not have %s privileges to database '.DB_DATABASE.'.'); 00069