Jump to content

Martyn Spencer

Members
  • Content Count

    27
  • Joined

  • Last visited

Everything posted by Martyn Spencer

  1. Martyn Spencer

    TFrame and VCL styles [solved]

    I been working on a VCL styled application developed initially by someone else and have just started using TFrames to rationalise some of the UI. It would appear that TFrames do not support VCL styles. Is this so? The main frame background appears to be rendered in whatever colour is set as the TFrame "Color" property. I am using Delphi 10.2.
  2. Martyn Spencer

    TFrame and VCL styles [solved]

    Works just fine, thanks 🙂
  3. Martyn Spencer

    TFrame and VCL styles [solved]

    Thanks Uwe. I will give that a go to see if it works.
  4. Martyn Spencer

    TFrame and VCL styles [solved]

    Thanks Anders. I have seen their skinning controls and they do seem better than the VCL themes (imo). I am having trouble finding something that offers consistently reliable and attractive themes, but that's probably not for this thread. Appreciate you taking the time to respond.
  5. Martyn Spencer

    TFrame and VCL styles [solved]

    Do you use a different styling system at all? I ask because I generally think that VCL styles look pretty darned ugly in most instances.
  6. Martyn Spencer

    TFrame and VCL styles [solved]

    Hi Anders. I did do a search before posting - I always do. I found some links that should allow the frame background to be transparent, but this simply caused there to be corrupted graphics where the frame background should be. Setting ParentBackground to True has no effect. The TFrame picks up the background that's set at design time and ignores the theme selection. One thing I have not tried is setting ParentBackground and attempting the use of transparency, so I'll give this a go.
  7. I rarely use Quickreport, preferring other report writers. I have to change an existing report so would appreciate any assistance. In a Quickreport detail band, I have a "description" TQRDBText and below this there is a "notes" TQRDBText. The "description" field is set to auto-stretch. How do I ensure that the top of the "notes" field shifts relative to the "description" field's height and will the detail band automatically increase its height based on changes to the positions and heights of these fields?
  8. My experience with SQL server is very limited and I generally use Postgresql or Oracle with very good results. I am part way through a project for a client where the existing system uses SQL server/ADO and I am moving to a Postgresql database and FireDAC. The system was created by a different developer and his approach was very different to mine. Having replaced old dynamically created queries with appropriate parametrised and more optimal queries, I find that the performance is not what I would expect. The existing SQL server database has a pretty poor design and no indexes. The Postgresql database is better designed, has appropriate indexes, and when accessed natively offers better performance to running equivalent queries on the SQL server database. With this in mind, I do not think that the issue is related to server performance, or the connection to the servers. The existing system makes extensive use of DevExpress tables and relies heavily on filtering provided by the grids. I generally do not work this way, preferring to provide more tailored functions depending on the specific work flow, etc. I will start by saying I think that the root of the problem is related to the amount of data being fetched from the database, potentially including metadata retrieval. Both databases are operating in a data centre and accessed over the Internet. This is not my preference, but it does demonstrate a significant performance difference between the two systems. Running against a local database shows little difference between the two. Experience tells me that the ADO based system is probably fetching records on demand, whereas I think FireDAC is fetching all rows and possibly metadata as well. Having read the FireDAC documentation, it does appear that I have more control but I would be interested in what settings would give comparative performance to the ADO based system, if any. My ideal is to only fetch data when the user pages through a grid. In the long-term, this will be less of a problem because I will be more specific in my queries, but I have a transitionary period where I would like to allow the users to make use of the existing grids with the lowest possible performance penalty.
  9. Martyn Spencer

    FireDAC Postgresql performance vs ADO SQL/Server performance

    Hi both. Thanks for your comments. It would appear that based on the settings identified, the grids are fetching all data so that the user can manipulate it based on the various grid functions (sorting, filtering etc). To answer the first question that @Attila Kovacs raises, 90+% of the time, the users view the top 10-20 rows in any given grid, but the original system design fetches anything from 2-10K records back "in case" the user wants to start applying filtering etc. This is not a work flow that I feel works well with any client/server system and would typically change the system so that it fetches relevant data based on pre-specified conditions and in the first instance only fetches records that are in view, with appropriate pagination. So, in reply, I would say that unless the user has specified any custom sorting, filtering etc, it would have been good to carry out just a partial fetch. Ultimately, I will be replacing these grids so I am looking for a short-term "fix". It looks as though all records are fetched. I am concerned with the initial fetch and was hoping to reduce the quantity of data. I was further hoping that filtering and sorting would result in modifications to the underlying query, rather than relying on a complete database fetch then client-based sorting/filtering. I think this is answered by what @Alexander Elagin suggests, I could try the "server mode" and see if this works more efficiently without restricting the user. I am asking what the nearest equivalent to ADO is with FireDAC, so am not sure. The default is fmAll, which clearly fetches everything. I believe that there is an on demand setting, but am not sure how well it works with the DevExpress grids. I am looking for the best option to return only visible records unless the user starts filtering or sorting. I appreciate that this may reduce functionality (as suggested above). Yes and testing demonstrates that this is not the issue. It really does appear to be the quantity of data returned by the initial fetch. I also note that when there are master detail relationships, ADO performance does seem to be better than FireDAC for some reason, even given that the ADO/SQL server based tables have no indexes and the Postgresql tables do (and are being used). Differences in the database engines, based on testing, do not appear to account for this. It just seems as though FireDAC has a greater overhead. It was monitoring that highlighted the number of fetches being made by FireDAC. I do not know of an equivalent way of monitoring ADO so any suggestions would be welcome.
  10. This is a bit of a general question and I may not be wording it particularly well. It's also pretty fundamental and in my time using Delphi, I have seen a number of approaches and I am just wondering what the general consensus is. I hope my explanation is clear enough. Let's take a simple example. Form class TfA, has a data aware control ctrl1. There is a data module class TdmB with a data source ds1 linked to a query q1. I want to allow multiple instances of TfA, each with it's own data module instance of TdmB. In of itself, this is really straightforward. I can create multiple instances of TfA and TfA can be responsible for creating its own instance of TdmB and the data source for ctrl1 can be set in code to the instance of TdmB's ds1. This seems to be how some programmers do it. With anything other than a simple form, this becomes a bit of a headache. I appreciate that some people would argue that the data source should be placed on TfA, not in TdmB. In fact, doing this could well simplify the process I am asking about, but I personally have a loathing for too many non-visual controls on a form (I know they can be hidden) and I prefer to see data sources and data sets on data modules. Delphi's documentation suggests that it is OK to work this way. When using the standard Delphi approach, the form designer creates an instance variable for form TfA (fA) and an instance variable for data module TdmB (dmB). When designing TfA, I can simply set the data source and field name for ctrl1 (dmB.ds1) and when the application runs, fA and dmB are auto-created. Delphi automatically handles the correct assignment. How is this handled internally by Delphi? Is it each data aware control that is responsible for picking up the appropriate data source? If not, does the form do it, or is it the data module? Is it the data link that forms part of a data aware control that handles it? The way that I have done this in the past (it works, but it could be considered rather ugly) is to remove Delphi's automatically defined instance variable for the form and data module. In the form class code, I create an instance of the data module, using the form as the owner. When the data module class is created, Delphi appears to automatically handle mapping of the control data sources and I then change the data module component name. This then means that when the next data module instance is created, it can use the default component name and mapping again appears to work correctly. This appears to work well, but I would very much like to be able to say to an existing form, that it should use a specific instance of a data module, on occasion. This may be, for example, if TfA creates a form TfB, which for simplicity's sake will use the data module that TfA created. TfB may be created some time after the TdmB instance has been created (and therefore renamed), so I do not think that the mapping is automatic. I appreciate that I could create an instance of TfB before renaming the data module, or I could temporarily rename it back, but this seems very messy. I am interested in how others do this. If anyone knows of a good reference source for best practices in this instance, it would be very helpful.
  11. Thanks for the extensive explanation, David. Fortunately I am aware of all that you describe and it is a good "understanding check" for me. I appreciate you taking the time to write it. All very useful info. I am working on a system that was written by a Delphi developer who clearly did not understand encapsulation and was quite happy to write code wherever the fancy took him. I still am quite happy that my question was answered before 🙂
  12. Hi David, Primarily I was looking to confirm my understanding of how the process worked internally. Your comment is in line with my findings and is pretty much how I handle things, in that if I create form A, with data module B, if B is created and owned by A, the data source fix-ups seem to be consistently applied and I don't observe any issues. Having said that, even though it always seemed to work, I was interested in how other developers handled the situation in case there was something I was missing. From what I read above, I think my understanding is OK. In the situation that you mention in your third paragraph, where a single DM may be shared by a form and maybe a popup that is generated by that form, there are problems and it requires the data module name to be as per what is specified in the designer. Some situations really don't merit a data module specific to the popup and it is here where I wanted to streamline the process of assigning controls to data sources. My reason for posing the question in the first place was that I took over maintenance of an existing program and really did not like how the original programmer worked and was trying to move more towards the methods that I currently use (and work). As part of this process, I thought it prudent to confirm my understanding of the process. Hope that provides more detail for you. I do actually think that my question has now been answered, and whilst I am interested in any discussion that arises from this, please don't feel the need to explain much more to me, as I think I am OK now. Best wishes, Martyn
  13. That would make sense. I definitely have a way forward. Thanks for your input, both.
  14. Thanks Uwe. I have found that if I create the associated data module instance on form creation, and set the owner correctly (this may be incidental and not important), the linkages work. I guess this is because the streaming of the form has not yet been initiated. I think I can work with what you gave me. Appreciated.
  15. Thanks Lars. This is a relatively simple CRUD application and in need of some tidying, rework, but not a major rewrite. I was hoping to learn a little about the internals so that I could manage the re-mapping using some generic code, if possible. What I have currently does work, but it feels like I am abusing the way that it is "meant to work". I generally prefer to avoid this as relying upon automatic behaviour that I cannot predict or control is prone to breaking without apparent reason. Your approach does sound interesting. In more recent apps, I have done something similar, in that the UI comprises basic dumb controls and I add the persistency as required. For new applications, I probably should look into some ORM frameworks, but I am a little unhappy to rely upon automated SQL generation in most instances. I am still trying to find where Delphi replaces component references. I think it could well be at the streaming stage.
  16. Martyn Spencer

    Delphi 10.2 / FireDAC / SQL Server

    Having problems connecting to a SQL server. It used to work fine, but after changes by the database host, I am now having issues. I want to rule out anything I am doing. One major change is that they are now using encryption (which they should have used before). I have the OLE DB Driver for SQL server installed (the most recent version, I believe). The log is shown below: ================================ Connection definition parameters ================================ Database=XXXXXXX User_Name=XXXXXXX Password=XXXXXXX Server=XXXXXXXX Encrypt=Yes ODBCAdvanced=TrustServerCertificate=yes DriverID=MSSQL Pooled=False ================================ FireDAC info ================================ Tool = RAD Studio 10.2 FireDAC = 16.0.0 (Build 88974) Platform = Windows 32 bit Defines = FireDAC_NOLOCALE_META;FireDAC_MONITOR ================================ Client info ================================ Loading driver MSSQL ... Loading odbc32.dll driver manager Creating ODBC environment handle Searching for ODBC driver ... Checking for ODBC driver [SQL SERVER NATIVE CLIENT 11.0] ... Checking for ODBC driver [ODBC DRIVER 13 FOR SQL SERVER] ... Checking for ODBC driver [ODBC DRIVER 11 FOR SQL SERVER] ... Checking for ODBC driver [SQL SERVER NATIVE CLIENT 10.0] ... Checking for ODBC driver [SQL NATIVE CLIENT] ... Checking for ODBC driver [SQL SERVER] ... Found [SQL Server] ================================ Session info ================================ Failed to connect to DBMS ! [FireDAC][Phys][ODBC][Microsoft][ODBC SQL Server Driver][DBNETLIB]SSL Security error
  17. Martyn Spencer

    Delphi 10.2 / FireDAC / SQL Server

    Thanks for the links, Lars. I'll have a read. I do not control the server and I am only pulling a small amount of data, so I don't have a great deal of information. I'll look at what you have posted and find out what I can then post back here with either more info, or how it was solved.
  18. Martyn Spencer

    ICS registration

    I see what I have done. I did not realise that the most recent version included the SSL files (should have read the explanatory text better) and I downloaded the separate (older) SSL files. Thanks for taking the time to clarify.
  19. Martyn Spencer

    ICS registration

    It was downloaded with the distribution from the web site, if I remember correctly.
  20. Martyn Spencer

    ICS registration

    I don't currently use ICS but was wondering about the SSL components. The ReadMeIcsSslSrc.txt implies that there is a fee to use it. Can you confirm what it is, please? It is not overly clear to me on the web site. Many thanks.
  21. Hi. I am not overly familiar with SQL server but need to extract some data on a reasonably regular basis. I planned to do this using FireDAC. The providers of my client's CRM have given me read only access to their database. Connecting to the server using FireDAC is proving inconsistent. It will connect on occasion and then not on others. Checking the FireDAC log, I see the below information and wondered if it is likely to be related to the problem - specifically the driver version being 10 and the server 14. Interestingly, FireDAC appears to find a driver version 11 but does not use it. Is anyone able to assist? Thanks. Checking session ... Warning: The client [10.0.0.0.0] and server [14.0.0.0.0] major versions difference > 1. Warning: SQL Server 2016 and compatibility level >= 130 may lead to DATETIME comparision failure. Current catalog = Current schema = dbo Driver name = SQLSRV32.DLL Driver version = 10.00.17134 Driver conformance = 3 DBMS name = Microsoft SQL Server DBMS version = 14.00.3048
  22. Martyn Spencer

    Unreliable connection to remote MS SQL Server database

    Thanks Lars.
  23. Martyn Spencer

    Unreliable connection to remote MS SQL Server database

    Thanks for the feedback.
  24. Martyn Spencer

    Unreliable connection to remote MS SQL Server database

    I have done some testing and the unreliability is server-side. I would still be quite happy to hear the best way to configure FireDAC to connect to SQL server, ideally directly if possible.
  25. Martyn Spencer

    Firedac and SQL Server DB with "." in name

    I am using Delphi 10.2 and I have been given a database to connect to and I have no control over its name. It is in the format xxxx.yyyy and when I create the connection definition, all is good and I can connect. I am specifying the database as xxxx.yyyy and setting the other various parameters appropriately (the same as I do for other databases). I can use the SQL tool in the connection editor to query the tables just fine. I create a simple TFDQuery consisting of a basic "select * from table" and when I attempt to run it, I am told that database xxxx is not in the list of valid servers and it should be added to sys.servers using sp_addlinkedserver. Clearly, what Firedac is passing to SQL server leads SQL server to interpret the xxxx as a server name. I have tried "select * from tablename", "select * from dbo.tablename", "select * from [xxxx.yyyy].tablename", "select * from [xxxx.yyyy].dbo.tablename" and other variations and still it refuses to work. I am setting no specific values for the components - I create the definition in the data explorer, test that it connects, test that I can use the "SQL script" tab to run various SQL statements. I then drag one of the tables onto the form designer (a quick test) and try to run the query and it fails with the message: "Could not find server 'xxxx' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinked server to add the server to sys.servers". I have tried removing the database name from the connection definition, in the hope that the default database has been set - this does not work. Any suggestions, please? I am unable to request that the database name be changed.
×