更改数据库结构后更新旧存储过程

时间:2015-04-24 07:01:44

标签: mysql stored-procedures enums int

我正在更新一个存储过程,该过程接收_POST信息并将其保存到MySQL数据库。桌子的结构发生了变化;某些属性已从TINYINT(0,1)更改为ENUM(是/否)。

然而,当我更改程序以反映这一点时,我得到一个解析错误。这意味着我的新陈述写错了。我不确定我是怎么做错的。

代码在这里:

DROP PROCEDURE IF EXISTS DSSv3_SummaryInfo_insertPostInfo;
DELIMITER //
CREATE PROCEDURE DSSv3_SummaryInfo_insertPostInfo(
     IN InProjectID INT,
     IN InTimeframe VARCHAR(25),
     IN InDateSpent VARCHAR(3000),
     IN InDateSpentDesc VARCHAR(3000),
     IN InQaName INT,
     IN InWhyStoreDesc TEXT,
     IN InChannelTypeDesc TEXT,
     IN InOtherEntitiesDesc TEXT,
     IN InNetworkDiagramDesc TEXT,
     IN InScopingMethods TEXT,
     IN InScopingConfirmationMethods TEXT,
     IN InScopingMethodEvaluation TEXT,
     IN InScopingMethodDocumentation TEXT,
     IN InScopingMethodAccuracy TEXT,
     IN InScopingAssessorName INT,
     IN InEnvironmentPeople TEXT,
     IN InEnvironmentProcesses TEXT,
     IN InEnvironmentTechnologies TEXT,
     IN InEnvironmentLocations TEXT,
     IN InEnvironmentOther TEXT,
     IN InSegmentationUsed ENUM,
     IN InNoSegmentationAssessor INT,
     IN InSegmentationHow TEXT,
     IN InSegmentationTechnologies TEXT,
     IN InSegmentationValidate TEXT,
     IN InSegmentationFunction TEXT,
     IN InSegmentationIntegrity TEXT,
     IN InWithSegmentationAssessor INT,
     IN InCountriesEntityConductsBusiness TEXT,
     IN InWirelessVerify TEXT,
     IN InWirelessImpact TEXT,
     IN InSamplingNotUsedAssessor INT,
     IN InSamplingUsedAssessor INT,
     IN InSamplingRational TEXT,
     IN InSamplingStandardiseControl TEXT,
     IN InSamplingControlValidation TEXT,
     IN InThirdPartyAssessorPadss INT,
     IN InThirdPartyAssessorP2pe INT,
     IN InThirdPartyScopeReduction TEXT,
     IN InThirdPartyComments TEXT,
     IN InSpIsSp TINYINT,
     IN InSpIncludedRequirements VARCHAR(3000),
     IN InSpExcludedRequirements VARCHAR(3000),
     IN InSpAssessor INT,
     IN InSpIpAddr VARCHAR(1500),
     IN InSpCustomerIpAddr VARCHAR(1500),
     IN InQsInitial TINYINT,
     IN InQsAmount TINYINT,
     IN InQsPassAssessor INT,
     IN InQsDocumentAssessor TEXT,
     IN InQsCorrection TEXT,
     IN InQsAssessorComments TEXT,
     IN InQsAocAssessor TEXT
     )
BEGIN
    /*
    set all _POST data for executive summary
    InParam:
            All _POST data variables on executive summary form
            Excludes _FILES data

    */
    IF NOT EXISTS (SELECT 1 FROM SummaryInfo WHERE ProjectID = InProjectID) THEN
        INSERT INTO SummaryInfo(
             ProjectID,
             timeframe,
             date_spent,
             date_spent_desc,
             qa_name,
             why_store_desc,
             channel_type_desc,
             other_entities_desc,
             network_diagram_desc,

             scoping_methods,
             scoping_confirmation_methods,
             scoping_method_evaluation,
             scoping_method_documentation,
             scoping_method_accuracy,
             scoping_assessor_name,

             environment_people,
             environment_processes,
             environment_technologies,
             environment_locations,
             environment_other,

             segmentation_used,
             no_segmentation_assessor,
             segmentation_how,
             segmentation_technologies,
             segmentation_validate,
             segmentation_function,
             segmentation_integrity,
             with_segmentation_assessor,
             countries_entity_conducts_business,
             wireless_verify,
             wireless_impact,

             sampling_not_used_assessor,
             sampling_used_assessor,
             sampling_rational,
             sampling_standardise_control,
             sampling_control_validation,
             third_party_assessor_padss,
             third_party_assessor_p2pe,
             third_party_scope_reduction,
             third_party_comments,

             sp_is_sp,
             sp_included_requirements,
             sp_excluded_requirements,
             sp_assessor,
             sp_ip_addr,
             sp_customer_ip_addr,

             qs_initial,
             qs_amount,
             qs_pass_assessor,
             qs_document_assessor,
             qs_correction,
             qs_assessor_comments,
             qs_aoc_assessor
            ) 
        VALUES (
            InProjectID,
            InTimeframe,
            InDateSpent,
            InDateSpentDesc,
            InQaName,
            InWhyStoreDesc,
            InChannelTypeDesc,
            InOtherEntitiesDesc,
            InNetworkDiagramDesc,

            InScopingMethods,
            InScopingConfirmationMethods,
            InScopingMethodEvaluation,
            InScopingMethodDocumentation,
            InScopingMethodAccuracy,
            InScopingAssessorName,

            InEnvironmentPeople,
            InEnvironmentProcesses,
            InEnvironmentTechnologies,
            InEnvironmentLocations,
            InEnvironmentOther,

            InSegmentationUsed,
            InNoSegmentationAssessor,
            InSegmentationHow,
            InSegmentationTechnologies,
            InSegmentationValidate,
            InSegmentationFunction,
            InSegmentationIntegrity,
            InWithSegmentationAssessor,
            InCountriesEntityConductsBusiness,
            InWirelessVerify,
            InWirelessImpact,

            InSamplingNotUsedAssessor,
            InSamplingUsedAssessor,
            InSamplingRational,
            InSamplingStandardiseControl,
            InSamplingControlValidation,

            InThirdPartyAssessorPadss,
            InThirdPartyAssessorP2pe,
            InThirdPartyScopeReduction,
            InThirdPartyComments,

            InSpIsSp,
            InSpIncludedRequirements,
            InSpExcludedRequirements,
            InSpAssessor,
            InSpIpAddr,
            InSpCustomerIpAddr,

            InQsInitial,
            InQsAmount,
            InQsPassAssessor,
            InQsDocumentAssessor,
            InQsCorrection,
            InQsAssessorComments,
            InQsAocAssessor 
            );
    ELSE 
        UPDATE SummaryInfo SET
            timeframe = InTimeframe,
            date_spent = InDateSpent,
            date_spent_desc = InDateSpentDesc,
            qa_name = InQaName,
            why_store_desc = InWhyStoreDesc,
            channel_type_desc = InChannelTypeDesc,
            other_entities_desc = InOtherEntitiesDesc,
            network_diagram_desc = InNetworkDiagramDesc,

            scoping_methods = InScopingMethods,
            scoping_confirmation_methods = InScopingConfirmationMethods,
            scoping_method_evaluation = InScopingMethodEvaluation,
            scoping_method_documentation = InScopingMethodDocumentation,
            scoping_method_accuracy = InScopingMethodAccuracy,
            scoping_assessor_name = InScopingAssessorName,

            environment_people = InEnvironmentPeople,
            environment_processes = InEnvironmentProcesses,
            environment_technologies = InEnvironmentTechnologies,
            environment_locations = InEnvironmentLocations,
            environment_other = InEnvironmentOther,

            segmentation_used = InSegmentationUsed,
            no_segmentation_assessor = InNoSegmentationAssessor,
            segmentation_how = InSegmentationHow,
            segmentation_technologies = InSegmentationTechnologies,
            segmentation_validate = InSegmentationValidate,
            segmentation_function = InSegmentationFunction,
            segmentation_integrity = InSegmentationIntegrity,
            with_segmentation_assessor = InWithSegmentationAssessor,
            countries_entity_conducts_business = InCountriesEntityConductsBusiness,
            wireless_verify = InWirelessVerify,
            wireless_impact = InWirelessImpact,

            sampling_not_used_assessor = InSamplingNotUsedAssessor,
            sampling_used_assessor = InSamplingUsedAssessor,
            sampling_rational = InSamplingRational,
            sampling_standardise_control = InSamplingStandardiseControl,
            sampling_control_validation = InSamplingControlValidation,

            third_party_assessor_padss = InThirdPartyAssessorPadss,
            third_party_assessor_p2pe = InThirdPartyAssessorP2pe,
            third_party_scope_reduction = InThirdPartyScopeReduction,
            third_party_comments = InThirdPartyComments,

            sp_is_sp = InSpIsSp,
            sp_included_requirements = InSpIncludedRequirements,
            sp_excluded_requirements = InSpExcludedRequirements,
            sp_assessor = InSpAssessor,
            sp_ip_addr = InSpIpAddr,
            sp_customer_ip_addr = InSpCustomerIpAddr,

            qs_initial = InQsInitial,
            qs_amount = InQsAmount,
            qs_pass_assessor = InQsPassAssessor,
            qs_document_assessor = InQsDocumentAssessor,
            qs_correction = InQsCorrection,
            qs_assessor_comments = InQsAssessorComments,
            qs_aoc_assessor = InQsAocAssessor  

        WHERE
            ProjectID = InProjectID;
    END IF;
END//
DELIMITER ;

错误讯息:

  

#1064 - 您的SQL语法出错;检查与您的MySQL服务器版本相对应的手册,以便使用“InInNoSegmentationAssessor INT”附近的正确语法,IN InSegmentationH'在第22行

当我将ENUM更改回INT时,就像结构更改之前一样,存储过程加载时没有错误。但它当然不会起作用,因为它与数据库的结构不匹配。

我一直在寻找答案,但我确实知道我在这个特定情况下首先做错了什么。任何提示或建议都会很好。

是的,这是一个庞大的程序。这是遗留代码。是的它是一个ENUM。它是生成一份报告。

1 个答案:

答案 0 :(得分:0)

当您声明DataGrid时,您必须指定值。所以它应该是:

ENUM