ibx4laz vers.2.5.0: some thoughts lazarus / 21-General ---------------------------------------------------------------------- zoltanleo · 2022-08-24 21:35 Hi tonyw I'm downloaded and installed the new version 2.5.0 from the official site (unfortunately the OPM repository contains an "old version" from 2021). During the building process, I received an error compiling the package inlocaldb.lpk (see screenshot). After adding one more nil-element to the array, all packages were compiled and installed successfully. I was very happy to see the published property FirebirdLibraryPathName for TIBDatabase. IMHO, this is a huge step towards more userfriendly functionality. Thank you for this However, there are some old bugs that are automatically inherited from the ancestor component. For example, the "browse" button is still disabled, although I specified all the parameters of the connection string (see screenshot). It also seems logical to me to add "connection (local/remote)", "server", "protocol" and "port number"  publish properties, which can be set from the Object Inspector , and not just from the Database editor connection form. What is your opinion? ---------------------------------------------------------------------- rvk · 2022-08-24 22:05 Quote from: zoltanleo on August 24, 2022, 11:35:22 pmFor example, the "browse" button is still disabled, although I specified all the parameters of the connection string (see screenshot).Browse is normally not available for a server connection. If the security is correctly implement you shouldn't even have access via SMB to the server IP So browsing over IP is useless. And even if it was... Browsing via SMB is UNC and that path is different from the local path of the server. For instance... The database could be in C:\mydir\mydb.fdb The server connection string should be for example 192.168.1.55:C:\mydir\mydb.fdb When you browse to 192.168.1.55 the UNC will be \\192.168.1.55\sharename\mydb.fdb Those are not the same so browsing will NOT give you the correct path. So you see that browse with a remote server connection is useless (which is why browse is disabled as it should be). (Arguably you could implement it for 127.0.0.1 because that's on the same machine but normally you use it for a remote server location. But I don't consider this a bug.) Quote from: zoltanleo on August 24, 2022, 11:35:22 pmIt also seems logical to me to add "connection (local/remote)", "server", "protocol" and "port number"  publish properties, which can be set from the Object Inspector , and not just from the Database editor connection form. Firebird normally works with a connection string. You can see the Firebird documentation for what the posibilities are. I personally find this a very elegant solution and don't need separate options. When adding the seperate option the complete connection string should be automatically changed or disabled according to the set options in that case. But I think that's why that database connection editor is there for (to assemble a correct complete connection string according to the Firebird specs). And there a lot more options in there that set the correct settings (like username, password etc). And traditionally those go in the param settings. I think having multiple properties for the same setting would be confusing and bad for backwards compatibility (setting one value in param and other value in the new properties would be confusing). ---------------------------------------------------------------------- zoltanleo · 2022-08-25 08:21 Quote from: rvk on August 25, 2022, 12:05:15 amBrowse is normally not available for a server connection.... The server connection string should be for example 192.168.1.55:C:\mydir\mydb.fdb When you browse to 192.168.1.55 the UNC will be \\192.168.1.55\sharename\mydb.fdb Those are not the same so browsing will NOT give you the correct path. Hi rvk I have to disagree with your arguments. IMHO, the Database Editor dialog is purely for the developer and can/should only be used in design time. I doubt that a typical developer will strictly set the connection string (including the path to the database) at development time without the ability to change it at runtime. As a rule, at designtime the developer uses a local database on his PC. It seems to me that here we are seeing a case of "unnatural intelligence" of the component (this means that the component independently determines your actions, contrary to your opinion and experience. This is annoying, isn't it?) Thus, disabling the "browse" button doesn't make sense at all. Quote from: rvk on August 25, 2022, 12:05:15 amWhen adding the seperate option the complete connection string should be automatically changed or disabled according to the set options in that case. But I think that's why that database connection editor is there for (to assemble a correct complete connection string according to the Firebird specs). And there a lot more options in there that set the correct settings (like username, password etc). And traditionally those go in the param settings. I think having multiple properties for the same setting would be confusing and bad for backwards compatibility (setting one value in param and other value in the new properties would be confusing). If we look at the Object Inspector, we see the DatabaseName published property (in the current state it shows only the local path to the database), and not the ConnectionString. Where did the other connection settings go (i.g. connection protocol, port number,  server name/IP)? However, if I set the DatabaseName field to a valid connection string like (Named Pipes protocol) '\\localhost@31064\D:\Firebird_3_0_10_x64\help\help.fdb', then the connection to the database will be successful. In this case, it makes sense to rename the DatabaseName field to ConnectionString. It will be more logical. And, finally, about setting login/password/role/charset values. Formally, these parameters are separated strings of the TIBdatabase.Params property. I have never been able to remember all the details of the exact syntax of these options. It seems logical to me to introduce appropriate published properties so that the developer doesn't have to think about such trifles, since we are striving for a user-friendly UI. ---------------------------------------------------------------------- rvk · 2022-08-25 08:51 Quote from: zoltanleo on August 25, 2022, 10:21:16 amI doubt that a typical developer will strictly set the connection string (including the path to the database) at development time without the ability to change it at runtime.I have set the connectionstring in a .ini file in my program directory. So it's configurable for system administrators. But you seem to miss the point that "Browse" isn't possible for remote server connections! As I explained... you CAN'T get the LOCAL path to the database on the server. You can only get the UNC path with share name. So how would "Browse" make sense for remote connections then? Quote from: rvk on August 25, 2022, 12:05:15 amIf we look at the Object Inspector, we see the DatabaseName published property (in the current state it shows only the local path to the database), and not the ConnectionString. Where did the other connection settings go (i.g. connection protocol, port number,  server name/IP)? However, if I set the DatabaseName field to a valid connection string like (Named Pipes protocol) '\\localhost@31064\D:\Firebird_3_0_10_x64\help\help.fdb', then the connection to the database will be successful. In this case, it makes sense to rename the DatabaseName field to ConnectionString. It will be more logical. When you change things in the connection editor, the complete connection string will be visible in the Databasename. But I agree that this might be a misnomer. It should say Connectionstring instead of Databasename. I've always put the complete connectionstring into the databasename for this because I know it needs to go there. (And that's the way Firebird defined it in their docs) From the help of IBX for Delphi: QuoteSpecifies the name of the database to associate with this database component. Use DatabaseName to specify the name of the database to use with a database component. For local InterBase databases, this can be a filename. To connect to an InterBase database on a remote server using TCP/IP the syntax is :. To connect to an InterBase database on a remote server using NetBEUI, the syntax is: \\\. To connect to an InterBase database on a remote server using SPX, the syntax is: @. BTW What I did find confusing is that when you change some things in the connection editor and click OK, you get back to the form, the changes are not directly visible in the selected TIBDatabase. You need to select another component and click back to TIBDatabase to see those changes. They should be visible directly. Quote from: zoltanleo on August 25, 2022, 10:21:16 amAnd, finally, about setting login/password/role/charset values. Formally, these parameters are separated strings of the TIBdatabase.Params property. I have never been able to remember all the details of the exact syntax of these options. It seems logical to me to introduce appropriate published properties so that the developer doesn't have to think about such trifles, since we are striving for a user-friendly UI. I agree. The options could be expanded if they also change the Params automatically live. (But it's not a showstopper for me. I normally set all these options in code anyway  ) That said... you say you don't want to let the programmer set the Databasename hardcoded. Then why do you need these options in the object inspector? Only for the programmer (who has the knowledge about connections strings etc) for during programming/developing? OR do you want a TIBDatabase.AskUserForDatabaseSettings and that you can call this form at runtime for the actual end-user??? (That would make more sense but then the options in the object inspector would be less useful because they will be reset anyway during runtime) You could develop such a form yourself which generate the Connectionstring (or maybe the current form is accessible already). ---------------------------------------------------------------------- tonyw · 2022-08-25 09:03 Quote from: zoltanleo on August 24, 2022, 11:35:22 pmHi tonyw I'm downloaded and installed the new version 2.5.0 from the official site (unfortunately the OPM repository contains an "old version" from 2021). I didn't even know that such a site existed. Quote from: zoltanleo on August 24, 2022, 11:35:22 pmDuring the building process, I received an error compiling the package inlocaldb.lpk (see screenshot). After adding one more nil-element to the array, all packages were compiled and installed successfully. As the comment above the code said  {These six extra elements were added to the FPC fixes_3_2 branch in Q3 2021} The conditional is an attempt to ensure that anyone working with the fixes branch can compile IBX. My guess is that you are using an old version of the fixes branch. i.e. a branch where ftOraTimeStamp is declared but followed by a different number of additional elements. I have checked github and the TFieldType enumerated type appears unchanged from Oct 2021. Quote from: zoltanleo on August 24, 2022, 11:35:22 pm I was very happy to see the published property FirebirdLibraryPathName for TIBDatabase. IMHO, this is a huge step towards more userfriendly functionality. Thank you for this However, there are some old bugs that are automatically inherited from the ancestor component. For example, the "browse" button is still disabled, although I specified all the parameters of the connection string (see screenshot). The Browse button is only enabled when the connection type is local. This is intentional as you cannot browse for a file on a remote system. Quote from: zoltanleo on August 24, 2022, 11:35:22 pmIt also seems logical to me to add "connection (local/remote)", "server", "protocol" and "port number"  publish properties, which can be set from the Object Inspector , and not just from the Database editor connection form. What is your opinion? That is a fair point. The IBServicesConnection does expose the Port, Protocol and Server properties and which are derived from and update the ConnectString property. The problem here is that the original Borland IBX incorrectly (IMHO) uses a property named DatabaseName to hold the ConnectionString and it is not easy to do what you suggest without either changing the semantics of DatabaseName or using confusing property names. But I will think about it. ---------------------------------------------------------------------- jujibo · 2022-08-25 11:01 Quote from: tonyw on August 25, 2022, 11:03:12 amQuote from: zoltanleo on August 24, 2022, 11:35:22 pmHi tonyw I'm downloaded and installed the new version 2.5.0 from the official site (unfortunately the OPM repository contains an "old version" from 2021). I didn't even know that such a site existed. @tonyw  I have announced the new version of ibx4lazarus to be updated in OPM (OnlinePackageManager). https://forum.lazarus.freepascal.org/in dex.php/topic,34297.msg451312.html#msg451312 You can announce about new versions there,  everytime you release one. Regards ---------------------------------------------------------------------- zoltanleo · 2022-08-25 11:47 Quote from: tonywI didn't even know that such a site existed.I meant this site  http://www.mwasoftware.co.uk/ibx It is also listed in the OPM as a homepage for your component repo Quote from: tonywAs the comment above the code said My guess is that you are using an old version of the fixes branch. i.e. a branch where ftOraTimeStamp is declared but followed by a different number of additional elements. I have checked github and the TFieldType enumerated type appears unchanged from Oct 2021. I updated svn trunk ibx to v.406. The code in IBCustomDataset.pas is identical to what is distributed through the download page (I using FPC trunk) Quote from: tonywThe Browse button is only enabled when the connection type is local. This is intentional as you cannot browse for a file on a remote system. I do not want to be intrusive, but I will venture to express my opinion again. The Database Editor dialog is designed to quickly specify the path to a file on the developer's PC. It is assumed that the developer will not write the application code, all the time connecting to a remote PC. The "smart" developer will copy the database file to his computer and work with the "local" database. In extreme cases (e.g. invalid connection string), the server parser will generate an appropriate error when trying to connect. Then the developer will go to read the documentation I think the developer himself must decide whether he can specify the path to the local database using other protocols. And finally. I have long wanted to ask. Would you like to change the component icons to more modern ones? ---------------------------------------------------------------------- rvk · 2022-08-25 11:55 Quote from: zoltanleo on August 25, 2022, 01:47:19 pmI do not want to be intrusive, but I will venture to express my opinion again. The Database Editor dialog is designed to quickly specify the path to a file on the developer's PC. It is assumed that the developer will not write the application code, all the time connecting to a remote PC. The "smart" developer will copy the database file to his computer and work with the "local" database. And setting the connection to Local will enable the "Browse" button. Or is there a special reason you want to use Remote and 127.0.0.1 (which is much more work to setup in the editor). Just clicking Local, choosing the database and setting Remote and 127.0.0.1 will work too. The only thing I could say is that IBX could be changed to enable the Browse button if 127.0.0.1 or localhost is chosen for Remote connection. (it would be a simple change if if statement in the form-code) But for 192.168.x.x (or other internal network IP) Browse should stay disabled (otherwise you will only get more confusing). ---------------------------------------------------------------------- zoltanleo · 2022-08-25 12:07 Quote from: rvk on August 25, 2022, 01:55:07 pmAnd setting the connection to Local will enable the "Browse" button. Or is there a special reason you want to use Remote and 127.0.0.1 (which is much more work to setup in the editor). Just clicking Local, choosing the database and setting Remote and 127.0.0.1 will work too. The only thing I could say is that IBX could be changed to enable the Browse button if 127.0.0.1 or localhost is chosen for Remote connection. (it would be a simple change if if statement in the form-code) But for 192.168.x.x (or other internal network IP) Browse should stay disabled (otherwise you will only get more confusing). All these manipulations are very much like magic tricks. It's much easier to put a hint on the "browse" button when a developer selects a remote connection. And warn that UNС-paths are invalid in the connection string. In this case, it doesn't matter which database I will use. However, I don't have to stupidly copy-paste the path to the file or type it manually (sometimes the path can be quite convoluted) ---------------------------------------------------------------------- tonyw · 2022-08-25 17:10 Quote from: zoltanleo on August 25, 2022, 01:47:19 pmQuote from: tonywAs the comment above the code said My guess is that you are using an old version of the fixes branch. i.e. a branch where ftOraTimeStamp is declared but followed by a different number of additional elements. I have checked github and the TFieldType enumerated type appears unchanged from Oct 2021. I updated svn trunk ibx to v.406. The code in IBCustomDataset.pas is identical to what is distributed through the download page (I using FPC trunk) I've now checked the "main" branch on github, and yes there is one more element to TFieldType. The problem you are up against here is that the "main" branch of FPC represents the bleeding edge when it comes to FPC development and components such as IBX will always take time to catch up. It's best to stick with the production versions of FPC for Lazarus and Lazarus components and this is currently 3.2.2. ---------------------------------------------------------------------- tonyw · 2022-08-25 17:40 Quote from: zoltanleo on August 25, 2022, 02:07:16 pmQuote from: rvk on August 25, 2022, 01:55:07 pmAnd setting the connection to Local will enable the "Browse" button. Or is there a special reason you want to use Remote and 127.0.0.1 (which is much more work to setup in the editor). Just clicking Local, choosing the database and setting Remote and 127.0.0.1 will work too. The only thing I could say is that IBX could be changed to enable the Browse button if 127.0.0.1 or localhost is chosen for Remote connection. (it would be a simple change if if statement in the form-code) But for 192.168.x.x (or other internal network IP) Browse should stay disabled (otherwise you will only get more confusing). All these manipulations are very much like magic tricks. It's much easier to put a hint on the "browse" button when a developer selects a remote connection. And warn that UNС-paths are invalid in the connection string. In this case, it doesn't matter which database I will use. However, I don't have to stupidly copy-paste the path to the file or type it manually (sometimes the path can be quite convoluted) The TIBDatabase.DatabaseName property should be thought of having a different purpose at Design Time and at Run Time. IBX provides a different Login Dialog depending on whether it is at design time or run time. The first image shows the design time dialog, while the second shows the default run time dialog. When you are working at Design Time, the DatabaseName should be set to a development copy of your database. This is typically local, but does not have to be. Itt will often be opened at design time in order to (e.g.) generate SQL, test SQL statements, add field columns, etc. Note that the open dialog has a browse button for the database name (for local databases) and also includes the project name. The project name is important because the dialog uses the IDE config files (accessed using GetIDEConfigStorage) to save the most recent database and user name for each project - in order to help improve programmer productivity. At run time, you want to set the DatabaseName property to your operational database and to prompt for both user name and password. IBX provides a default login dialog, but you are free to write your own. You may even want to select between different operational copies of your database - depending on the application. The point is that almost always, you do not want the development and operational databasenames to be the same. My recommended usage is to use the Database Edit dialog to set the database parameters. You may set the databasename, but you do not have to. The first time that you open the database at design time, you will see the current databasename - but you can change this and the result is now saved separately in the IDE configuration database. You could now set the databasename property to the test database connect string. When you compile and run your program you are probably going to test it using this databasename. When your program is used in production, the databasename should now be set to the production copy of your database. If you have many users then each will have its own production copy - perhaps in a different location. In this case,  you will probably set the databasename property from some other source and in the OnBeforeConnect event handler. Perhaps from a local configuration file set up when the application is installed. Your program may make use of conditional statements ($IFDEF ... $ENDIF) to force different behaviour when testing and when in production use.