Jump to content

FredS

Members
  • Content Count

    408
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by FredS

  1. FredS

    Solution to compare mysql schema via sql file

    I can show you an example but most of my code uses internal stuff. But let me make one thing clearer; the action after Beyond Compare is manual NOT automatic.. In short, after comparing the prior db creation script with the new one methods within the Patching unit are called manually.. This example increase the Size of a [N]Varchar Column using UniDAC, FB3/4 and SqlServer dbs: /// <summary> /// Increase the Size of a [N]Varchar Column /// </summary> /// <param name="NullKind"> /// Must be given else some dbs default to allowing nulls when you make changes /// </param> class procedure TExecSqlPatch.IncVarChar(const Con: TUniConnection; const ATable, AColumn: string; const NewSize: Word; const NullKind: TNullKind); {$REGION 'History'} // 29-Aug-2018 - ExecuteSQL does not return any usefull count for these Block calls {$ENDREGION} var sql: string; begin case Con.DbProvider of dbFirebird: begin sql := 'EXECUTE block as BEGIN ' + ' if (exists(select 1 from RDB$RELATION_FIELDS rf where rf.RDB$RELATION_NAME = :TableName and rf.RDB$FIELD_NAME = :ColumnName))' + CRLF + ' then execute statement ' + 'ALTER TABLE :TableRaw ALTER COLUMN :ColumnRaw Type VARCHAR(:NewSize)'.ToQuoted + SEMICOLON + CRLF + 'END'; sql.ReplaceParams([ATable.ToUpper, AColumn.ToUpper, ParamRaw + ATable.ToUpper, ParamRaw + AColumn.ToUpper, NewSize]).Error.Assert; Con.ExecuteSQL(sql); sql := 'EXECUTE block as BEGIN ' + ' if (exists(select 1 from RDB$RELATION_FIELDS rf where rf.RDB$RELATION_NAME = :TableName and rf.RDB$FIELD_NAME = :ColumnName))' + CRLF + ' then execute statement ' + 'ALTER TABLE :TableRaw ALTER :ColumnRaw :NullKind NOT NULL'.ToQuoted + SEMICOLON + CRLF + 'END'; sql.ReplaceParams([ATable.ToUpper, AColumn.ToUpper, ParamRaw + ATable.ToUpper, ParamRaw + AColumn.ToUpper, ParamRaw + cFB3NullKind[NullKind]]).Error.Assert; Con.ExecuteSQL(sql); end; dbSQLServer: begin sql := 'IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE [TABLE_NAME] = :Table AND [COLUMN_NAME] = :Column) ' + CRLF + 'BEGIN ' + CRLF + ' ALTER TABLE :TableRaw ALTER COLUMN :ColumnRaw NVARCHAR(:NewSize) :NullKind ' + CRLF + 'END '; sql.ReplaceParams([ATable.ToUpper, AColumn.ToUpper, ParamRaw + ATable.ToUpper, ParamRaw + AColumn.ToUpper, NewSize, ParamRaw + cMSSQLNullKind[NullKind]]).Error.Assert; Con.ExecuteSQL(sql); end; else raise ENotImplemented.Create('Not Implemented'); end; end;
  2. FredS

    Solution to compare mysql schema via sql file

    I wrapped most Alter statements into a 'SQL.Patching.pas' unit which fires what is needed depending on a version field at startup. Found the simplest way was to make all changes and then use Beyond Compare on the db creation script to generate an output which is used to call the methods in the Patching unit.
  3. I've seen that change when the Windows license is changed.
  4. FredS

    Amazon Linux 2

    Maybe you need to open the port in the Firewall(s)..
  5. FredS

    Partial Serial Number Verification System in Firemonkey

    Adding this to the unit worked for me: {$RANGECHECKS OFF}
  6. FredS

    LDAP connection

    I don't use that unit, you'll need to figure out how searches are made using it.
  7. FredS

    LDAP connection

    Use ldap_search_sW
  8. FredS

    LDAP connection

    Use the ldap_bind_sW function (winldap.h)
  9. FredS

    Parnassus Bookmarks for Delphi 11 Alexandria?

    Sure, sometimes I use Notepad++ bookmarks and its Editor.. 🙂
  10. FredS

    difference .optset and .dproj file

    IMO its best to stay away from those, still at least one open bug report RSP-17558, this one is the worst and nearly 5 years old: RSP-14723.
  11. FredS

    Several F2084 Internal Error on Delphi 10.4.2

    Or when you start using some of the IDE features meant to help you manage large projects..
  12. I just type garbage for the first two now, then try and read that idiotic picture on the third one..
  13. FredS

    Fill Class Variables from a table row??

    RSP-35486 TRttiField.SetValue breaks past bevaviour with Null and String
  14. Not if you you code it to respond to the Classes.SyncEvent : https://stackoverflow.com/a/61022449 I use both, in one case I have many threads collecting data and triggering updates to a form while getting ready to launch another Task I don't want to pause the updates so a call gets wrapped in an Async which uses the trick above.. but I try to only do that for single calls that are guaranteed to take a short time.
  15. This scenario doesn't sound like it needs Async at all. Start a thread with an OnTerminate Event Disable all user input and show a busy signal When the thread completes the event fires and all reverts back to normal For the few cases that Async is needed there is `MsgWaitForMultipleObjects`..
  16. FredS

    Parnassus Bookmarks for Delphi 11 Alexandria?

    Notepad++ next 🙂
  17. Nearly all forms I show modal return a result. At the most basic level all these forms are inherited from one base form which has this code: class function TBaseDialogForm.ShowDialog(AOwner: TComponent): Boolean; begin with Create(AOwner) do try Result := ShowModal = mrOK; finally Free; end; end; class function ShowDialog(AOwner: TComponent): Boolean; virtual;
  18. FredS

    Bookmarks dead?

    Maybe looking for a third MVP to help out 🙂
  19. FredS

    Parnassus Bookmarks for Delphi 11 Alexandria?

    To paraphrase a post; it now takes two MVPs to update a plug-in for D11 HighDPI..
  20. Sure, its only been what.. well under a decade 🙂
  21. FredS

    enable/disable the internet connection?

    Explains some complaints I've heard..
  22. FredS

    Firebird Admin Tool

    Always loved Flamerobin, one of the best functions in Flamerobin is their quick way to 'Generate rebuild script'..
  23. FredS

    UAC request minimized instead of full-screen

    I also ran a couple of tests and it made no diff; Zero, GetDesktopHandle, GetActiveWindow, Application.Handle and Mainform.handle all appeared as normal.
  24. Be happy with what you've got 🙂
  25. FredS

    UAC request minimized instead of full-screen

    My point was that your user can disable it which is why it may show up as you first described. Secondly, if an option can be set it can be read, that way at least you would be able to alert the user that such a thing might occur..
×