From 0c3710e24eab2c23f86e6d2bffcb9a6524ba3155 Mon Sep 17 00:00:00 2001 From: dimitr Date: Fri, 3 Aug 2007 05:13:21 +0000 Subject: [PATCH] Fixed CORE-1398, CORE-1399, CORE-1400. --- src/utilities/gstat/dba.epp | 38 +++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/utilities/gstat/dba.epp b/src/utilities/gstat/dba.epp index d04cf335a7..e2b60db91d 100644 --- a/src/utilities/gstat/dba.epp +++ b/src/utilities/gstat/dba.epp @@ -540,20 +540,30 @@ int CLIB_ROUTINE main(int argc, char** argv) /* Open database and go to work */ - const char* local_inet_prefix = "localhost:"; - const char* local_wnet_prefix = "\\\\.\\"; - Firebird::PathName conn_str = name; - if (conn_str.find(local_inet_prefix) == 0) - name += strlen(local_inet_prefix); - else if (conn_str.find(local_wnet_prefix) == 0) - name += strlen(local_wnet_prefix); + Firebird::PathName fileName = name; + const Firebird::PathName connName = fileName; + Firebird::PathName tempStr; - Firebird::PathName temp_buf = name; - if (ResolveDatabaseAlias(temp_buf, temp_buf)) { - name = temp_buf.c_str(); +#ifdef WIN_NT + if (!ISC_analyze_pclan(fileName, tempStr)) +#endif + { + if (!ISC_analyze_tcp(fileName, tempStr)) + { +#ifndef NO_NFS + if (!ISC_analyze_nfs(fileName, tempStr)) +#endif + { + fileName = connName; + } + } } - dba_fil* current = db_open(name, strlen(name)); + if (ResolveDatabaseAlias(fileName, tempStr)) { + fileName = tempStr; + } + + dba_fil* current = db_open(fileName.c_str(), fileName.length()); tddba->page_size = sizeof(temp); tddba->global_buffer = (pag*) temp; tddba->page_number = -1; @@ -579,10 +589,10 @@ int CLIB_ROUTINE main(int argc, char** argv) char file_name[1024]; #if defined (WIN95) && !defined (SERVICE_THREAD) if (!fAnsiCP) - AnsiToOem(name, file_name); + AnsiToOem(fileName.c_str(), file_name); else #endif - strcpy(file_name, name); + strcpy(file_name, fileName.c_str()); dba_print(6, file_name, 0, 0, 0, 0); /* msg 6: \nDatabase \"%s\"\n */ @@ -664,7 +674,7 @@ int CLIB_ROUTINE main(int argc, char** argv) password, strlen((char*) password)); } - isc_attach_database(status_vector, 0, name, &DB, dpb.getBufferLength(), + isc_attach_database(status_vector, 0, connName.c_str(), &DB, dpb.getBufferLength(), reinterpret_cast(dpb.getBuffer())); if (status_vector[1]) dba_exit(FINI_ERROR, tddba);