unit UsersDBProvider; interface //uses // System.Classes, BaseDataProvider, InterfaceDataProvider; // //type // TUsersDBProvider = class(TBaseDataProvider, IAppIconProvider) // protected // function GetTableName: string; override; // function GetCreateTableSQL: string; override; // public // procedure Insert(ATeamID, AUID: WideString); stdcall; // procedure Delete(ATeamID, AUID: WideString); overload; stdcall; // procedure Delete(ATeamID: WideString); overload; stdcall; // procedure Find(ATeamID, AUID: WideString); overload; stdcall; // procedure Find(ATeamID: WideString); overload; stdcall; // end; implementation //uses // FireDAC.Comp.Client, BaseDataModule, System.SysUtils, System.VarUtils, System.Variants, // Data.DB, LoggerImport; // //const // TABLE_NAME: string = 'Users'; // CREATE_TABLE: string = 'CREATE TABLE Users('+ // 'LoginName string(50), ' + // 'ServerID string(50), ' + // 'BranchID string(50), ' + // 'DisplayName string(50), ' + // 'TrueName string(50), ' + // 'Mobile string(50), ' + // 'Email string(50), ' + // 'HeadImageFileType integer, ' + // 'Province string(50), ' + // 'Company string(50), ' + // 'HeadImageHashValue string(50), ' + // 'Calling string(50), ' + // 'LeaveMessage string(50), ' + // 'Tel string(50), ' + // 'Watchword string(50), ' + // 'HomeAddress string(50), ' + // 'Post string(50), ' + // 'RemarkMobile string(50), ' + // 'Country string(50), ' + // 'Branch string(50), ' + // 'ShortMobile string(50), ' + // 'Sex integer, ' + // 'City string(50), ' + // 'Duty string(50), ' + // 'Intro string(50), ' + // 'HeadImageFile string(50), ' + // 'Version integer, ' + // 'CreateTime Double)'; // INSERT_ONE_SQL: string = 'INSERT INTO Users('+ // ':LoginName, ' + // ':ServerID, ' + // ':BranchID, ' + // ':DisplayName, ' + // ':TrueName, ' + // ':Mobile, ' + // ':Email, ' + // ':HeadImageFileType, ' + // ':Province, ' + // ':Company, ' + // ':HeadImageHashValue, ' + // ':Calling, ' + // ':LeaveMessage, ' + // ':Tel, ' + // ':Watchword, ' + // ':HomeAddress, ' + // ':Post, ' + // ':RemarkMobile, ' + // ':Country, ' + // ':Branch, ' + // ':ShortMobile, ' + // ':Sex, ' + // ':City, ' + // ':Duty, ' + // ':Intro, ' + // ':HeadImageFile, ' + // ':Version, ' + // ':CreateTime) VALUES('+ // ':LoginName, ' + // ':ServerID, ' + // ':BranchID, ' + // ':DisplayName, ' + // ':TrueName, ' + // ':Mobile, ' + // ':Email, ' + // ':HeadImageFileType, ' + // ':Province, ' + // ':Company, ' + // ':HeadImageHashValue, ' + // ':Calling, ' + // ':LeaveMessage, ' + // ':Tel, ' + // ':Watchword, ' + // ':HomeAddress, ' + // ':Post, ' + // ':RemarkMobile, ' + // ':Country, ' + // ':Branch, ' + // ':ShortMobile, ' + // ':Sex, ' + // ':City, ' + // ':Duty, ' + // ':Intro, ' + // ':HeadImageFile, ' + // ':Version, ' + // ':CreateTime)'; // DELETE_ONE_SQL: string = 'DELETE FROM Users WHERE ServerID = :ServerID and LoginName = :LoginName'; // DELETE_ALL: string = 'DELETE FROM Users WHERE ServerID = :ServerID'; // // //// public string TeamID { get; set; } //// public string UID { get; set; } //// public string Nickname { get; set; } //// public DateTime JoinDate { get; set; } //// public MemberType Type { get; set; } // //{ TAppIconProvider } // //procedure TUsersDBProvider.FindIcon(AAppKey: WideString; var ABuffer); stdcall; //var // AQuery: TFDQuery; // ACode: string; //begin // if (AAppKey = '') then // Exit; // ACode := Format('TAppIconProvider.FindIcon(%s)', [AAppKey]); // // try // AQuery := BaseDataModel.GetQuery; // AQuery.Connection.Connected := True; // AQuery.Open(APPICON_FINDICON, [AAppKey]); // AQuery.First; // if not AQuery.Eof then // TBytes(ABuffer) := AQuery.FieldByName('Icon').AsBytes; // except // on E: Exception do // begin // Error(E.Message, ACode); // BaseDataModel.GiveBackQuery(AQuery); // end; // end; // BaseDataModel.GiveBackQuery(AQuery); //end; // //function TUsersDBProvider.GetCreateTableSQL: string; //begin // Result := CREATE_TABLE; //end; // //function TUsersDBProvider.GetTableName: string; //begin // Result := TABLE_NAME; //end; // //procedure TUsersDBProvider.Insert(ATeamID, AUID: WideString); //var // AConnection: TFDCustomConnection; // ALen: Cardinal; //begin // ALen := Length(TBytes(ABuffer)); // if (AAppKey = '') or (ALen = 0) then // Exit; // AConnection := BaseDataModel.GetConnection; // try // AConnection.Connected := True; // AConnection.ExecSQL(APPICON_DELETE, [AAppKey]); // AConnection.ExecSQL(APPICON_INSERT, [AAppKey, TBytes(ABuffer), 0, Now]); // finally // BaseDataModel.GiveBackConnection(AConnection); // end; //end; end.