• 修改unidac findkey区分大小写的问题


    使用unidac的findkey时发现是区分大小写的,没找到在那可以设置,最后直接修改DBAccess.pas

    找到:function TCustomDADataSet.FindKey(const KeyValues: array of const): Boolean;

    将:Result := LocateEx(KeyFields, Values, FFindKeyOptions);

    修改为:Result := LocateEx(KeyFields, Values, [lxCaseInsensitive]);

    保存后重新编译应用就可以。

    function TCustomDADataSet.FindKey(const KeyValues: array of const): Boolean;

    function GetKeyValue(Index: integer): variant; // nearly copied from TField.AssignValue
    procedure Error;
    begin
    DatabaseErrorFmt(SFieldValueError, [IntToStr(Index)]);
    end;
    begin
    Result := Unassigned;

    with KeyValues[Index] do
    case VType of
    vtInteger:
    Result := Integer(VInteger);
    vtInt64:
    Result := VInt64^;
    vtBoolean:
    Result := Boolean(VBoolean);
    {$IFNDEF NEXTGEN}
    vtChar:
    Result := String(VChar);
    {$ENDIF}
    vtExtended:
    Result := Extended(VExtended^);
    {$IFNDEF NEXTGEN}
    vtString:
    Result := String(VString^);
    {$ENDIF}
    vtPointer, vtObject:
    if VPointer <> nil then Error;
    {$IFNDEF NEXTGEN}
    vtPChar:
    Result := String(VPChar);
    vtAnsiString:
    Result := String(VAnsiString);
    {$ENDIF}
    vtCurrency:
    Result := Currency(VCurrency^);
    vtVariant:
    if not VarIsClear(VVariant^) then
    Result := Variant(VVariant^);
    vtWideChar:
    Result := WideString(VWideChar);
    vtWideString:
    Result := WideString(VWideString);
    {$IFDEF VER12P}
    vtUnicodeString:
    Result := UnicodeString(VUnicodeString);
    {$ENDIF}
    else
    Error;
    end;
    end;

    var
    KeyFieldDescs: TFieldDescArray;
    Values: variant;
    KeyFieldsCount: integer;
    KeyFields: TFieldArray;
    i: integer;
    begin
    CheckBrowseMode;
    FIRecordSet.GetKeyFieldDescs(KeyFieldDescs);

    Values := Unassigned; // To prevent warning
    KeyFieldsCount := Length(KeyFieldDescs);
    SetLength(KeyFields, KeyFieldsCount);
    case KeyFieldsCount of
    0:
    DatabaseError(SKeyFieldsRequired);
    1: begin
    KeyFields[0] := GetField(KeyFieldDescs[0]);
    Values := GetKeyValue(0);
    end;
    else begin
    Values := VarArrayCreate([0, KeyFieldsCount - 1], varVariant);
    for i := 0 to KeyFieldsCount - 1 do begin
    KeyFields[i] := GetField(KeyFieldDescs[i]);

    if i <= High(KeyValues) then
    Values[i] := GetKeyValue(i)
    else
    Values[i] := Unassigned;
    end;
    end;
    end;


    // Result := LocateEx(KeyFields, Values, FFindKeyOptions);
    Result := LocateEx(KeyFields, Values, [lxCaseInsensitive]);

    end;

  • 相关阅读:
    Tsar 服务器系统和应用信息的采集报告工具
    mysqltuner
    MySQL性能监控工具-MONyog
    tuning-primer.sh mysql 报表
    mytop
    InnoTop
    mysql监控管理工具--innotop
    iotop,pt-ioprofile : mysql IO负载高的来源定位
    PERCONA-TOOLKIT 工具的安装与使用2
    PERCONA-TOOLKIT : pt-ioprofile分析IO情况
  • 原文地址:https://www.cnblogs.com/qiufeng2014/p/13964438.html
Copyright © 2020-2023  润新知