Start a new topic

trimming of tablenames

[This topic is migrated from our old forums. The original author name has been removed]

Hello, i'm generating tables in my application. The tablename comes from strings which can contain trailing blanks e.g. "TABLE_1 ". Some db-systems do a trim to the table-name by default, like db2, others don't like HSQL. I'm using HSQL and have tables, which contain spaces at the end. When it comes to displaying table data, dbvis reports an table-name not found error, because the tablename was trimmed. steps to reproduce (with HSQL) 1. create a table with the following statement CREATE TABLE "NAME WITH Blanks " ( id INTEGER ) 2. try to browse the table-data Is there a setting, where i can configure this behaviour? Other tools like SQL-Explorer (Eclipse Plugin) show me the table-data with no errors. regards Andreas Schmidt

[This reply is migrated from our old forums.]

Re: trimming of tablenames
Andreas, You are right that DbVisualizer automatically trims object names from leading and trailing spaces. The reason for this is that some databases when querying object information automatically adds blanks even though they weren't specified at object create. From a database tool perspective there is no excuse not supporting explicit spaces around object names (if the database supports it) and it is most likely a bug. However, my spontaneous and personal reaction having explicit blanks around the table name is that you are begging for big trouble! I am generally not a big fan of having mixed case object names or spaces in there. Simply because it always results in strange and unexpected situations. Again this is my personal opinion as DbVisualizer supports this already. Having explicit spaces around table names is a new situation/request and I am very interested to hear more about the background for this strategy. Regards Roger
[This reply is migrated from our old forums.]

Re: trimming of tablenames
Oh, I forgot to tell about how to make table names quoted automatically. - Goto Connection Properties - Select SQL Statements - Enter " in the Table Name Prefix/Suffix fields - Press Apply. Note that this will most likely only work for names with spaces/mixed case in them and not for tables names with leading/trailing blanks. Regards Roger
[This reply is migrated from our old forums. The original author name has been removed]

Re: trimming of tablenames
Hello Roger, i already told dbvisualizer to quote the names. But as you mentioned this won't work for names with leading/trailing blanks. The reason for using such names is, that i develop a simulating jdbcdriver proxy. It writes out all resultsets from selectstatements into tables together with the parameters used for retrieving when it is in write-mode. The tables will be created dynamic with the original statement as name. I could also name the created table with a sort of hash-value generated from the statement. But a value from a hashfunction is ambigous and the original statement is unambigous. When the proxy it is in read-mode it could be used to emulate the original database during write mode. This proxy is meant for debugging and testing. The application i tested uses selects with trailing blanks, so my table-names had trailing blanks too. As a workaround I removed trailing blanks and it worked. But it would be nice, if there would be an option for switching off trimming of table-names. This could be on the same place where you specify the prefix/suffix. regards Andreas
[This reply is migrated from our old forums.]

Re: trimming of tablenames
Andreas, I'll add your request to the list. Thanks! Regards Roger