2012-10-10 2 views
0

다음 SQL 설치 SQL 파일이 있습니다. 내가 뭘 하려는지 더 이상 31 설치 ID를 참조하지만 스크립트가 실행하려고하는 값으로 설정되어 있도록 수정하는 것입니다. 누구든지 도와 줄 수 있습니까?MYSQL의 값을 참조하십시오.

# Install Easy Populate Configuration for zen cart v1.5 
INSERT INTO admin_pages VALUES ('easyPopulate', 'BOX_TOOLS_EASY_POPULATE', 'FILENAME_EASYPOPULATE', '', 'tools', 'Y', '14'); 
INSERT INTO admin_pages_to_profiles VALUES ('1', 'easyPopulate'); 
INSERT INTO admin_pages VALUES ('easyPopulateConfig', 'BOX_CONFIGURATION_EASY_POPULATE', 'FILENAME_CONFIGURATION', 'gID=31', 'configuration', 'Y', '26'); 
INSERT INTO configuration_group VALUES ('', 'Easy Populate', 'Config options for Easy Populate', '31', '1'); 
INSERT INTO configuration VALUES 
('', 'Uploads Directory', 'EASYPOPULATE_CONFIG_TEMP_DIR', 'tempEP/', 'Name of directory for your uploads (default: tempEP/).', '31', '0', NULL, now(), NULL, NULL), 
('', 'Upload File Date Format', 'EASYPOPULATE_CONFIG_FILE_DATE_FORMAT', 'm-d-y', 'Choose order of date values that corresponds to your uploads file, usually generated by MS Excel. Raw dates in your uploads file (Eg 2005-09-26 09:00:00) are not affected, and will upload as they are.', '31', '1', NULL, now(), NULL, 'zen_cfg_select_option(array("m-d-y", "d-m-y", "y-m-d"),'), 
('', 'Default Raw Time', 'EASYPOPULATE_CONFIG_DEFAULT_RAW_TIME', '09:00:00', 'If no time value stipulated in upload file, use this value. Useful for ensuring specials begin after a specific time of the day (default: 09:00:00)', '31', '2', NULL, now(), NULL, NULL), 
('', 'Split File On # Records', 'EASYPOPULATE_CONFIG_SPLIT_MAX', '300', 'Default number of records for split-file uploads. Used to avoid timeouts on large uploads (default: 300).', '31', '3', NULL, now(), NULL, NULL), 
('', 'Maximum Category Depth', 'EASYPOPULATE_CONFIG_MAX_CATEGORY_LEVELS', '7', 'Maximum depth of categories required for your store. Is the number of category columns in downloaded file (default: 7).', '31', '4', NULL, now(), NULL, NULL), 
('', 'Upload/Download Prices Include Tax', 'EASYPOPULATE_CONFIG_PRICE_INC_TAX', 'false', 'Choose to include or exclude tax, depending on how you manage prices outside of Zen Cart.', '31', '5', NULL, now(), NULL, 'zen_cfg_select_option(array("true", "false"),'), 
('', 'Make Zero Qty Products Inactive', 'EASYPOPULATE_CONFIG_ZERO_QTY_INACTIVE', 'false', 'When uploading, make the status Inactive for products with zero qty (default: false).', '31', '6', NULL, now(), NULL, 'zen_cfg_select_option(array("true", "false"),'), 
('', 'Smart Tags Replacement of Newlines', 'EASYPOPULATE_CONFIG_SMART_TAGS', 'true', 'Allows your description fields in your uploads file to have carriage returns and/or new-lines converted to HTML line-breaks on uploading, thus preserving some rudimentary formatting (default: true).', '31', '7', NULL, now(), NULL, 'zen_cfg_select_option(array("true", "false"),'), 
('', 'Advanced Smart Tags', 'EASYPOPULATE_CONFIG_ADV_SMART_TAGS', 'false', 'Allow the use of complex regular expressions to format descriptions, making headings bold, add bullets, etc. Configuration is in ADMIN/easypopulate.php (default: false).', '31', '8', NULL, now(), NULL, 'zen_cfg_select_option(array("true", "false"),'), 
('', 'Debug Logging', 'EASYPOPULATE_CONFIG_DEBUG_LOGGING', 'true', 'Allow Easy Populate to generate an error log on errors only (default: true)', '31', '9', NULL, now(), NULL, 'zen_cfg_select_option(array("true", "false"),'), 
('', 'Custom Products Fields', 'EASYPOPULATE_CONFIG_CUSTOM_FIELDS', '', 'Enter a comma seperated list of fields to be automatically added to import/export file(ie: products_length, products_width). Please make sure field exists in PRODUCTS table.', '31' , '10', NULL, now(), NULL, NULL); 

추가 정보 : 가 (미안이 필수 항목)

나는 ID (31)을 사용하지 않도록 할 수있는 방법이 없을까? 31은 INSERT INTO configuration_group VALUES ('', 'Easy Populate', 'Config options for Easy Populate', '31', '1');. 명령에서 자동으로 생성 된 ID를 나타 내기로되어 있습니까?

+0

이 키워드는 'SET'키워드 사용과 관련이 있지만이 인스턴스에서 사용하는 방법을 잘 모르겠습니다. –

+0

여기서 무엇을하고 싶니? 새 값을 검색어로 대체 하시겠습니까? – tadman

+0

gID = 31은 일반적으로 자동 증가 문자 인 열에 삽입됩니다. 31 대신에 자동 삽입에서 리턴 된 값이 대신 사용되도록이 값을 변경하려고합니다. –

답변

1

당신은 주석으로 - 사용 SET :

SET @installId = '31'; 

그런 다음 '31'대신 @installId를 사용

INSERT INTO configuration_group VALUES ('', 'Easy Populate', 'Config options for Easy Populate', @installId, '1'); 

UPDATE

ID가 마지막으로 자동 증가하는 경우를 필드를 이전 INSERT 문에서 가져온 다음 LAST_INSERT_ID() 함수를 사용하여 검색 할 수 있습니다.

INSERT INTO configuration_group VALUES ('', 'Easy Populate', 'Config options for Easy Populate', NULL, '1'); 
SET @autoId = LAST_INSERT_ID(); 

그런 다음 위의 '31'대신에 @autoId 변수를 사용할 수 있습니다.

+0

추가 정보가있는 질문이 업데이트되었습니다. –

+0

그에 따라 답변이 업데이트되었습니다. – PinnyM

관련 문제