Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » MySqlSession::EnumTables -> why uppercase?
MySqlSession::EnumTables -> why uppercase? [message #5284] Tue, 12 September 2006 14:46 Go to next message
nicomesas is currently offline  nicomesas
Messages: 104
Registered: September 2006
Location: Barcelona, Spain
Experienced Member
Hi
I'm develop a small test on MySQL and I get the table names with the function MySqlSession::EnumTables. Well it's work fine, but I have seen that in the code the names of the tables change to uppercase. (line 169 on MySql/MySql.cpp)

Vector<String> MySqlSession::EnumTables(String database)
{
	Vector<String> out;
	Sql cursor(*this);
	if(cursor.Execute("show tables from " + database))
		out = FetchList(cursor, true);
	return out;
}


Soon attempt to make a SELECT on a table (that I have created with another application in windoz) and it select nothing:
I see the session.GetLastError() "skorg_dsrllo_v3.ACTIVIDADES' doesn't exist".

It is rare because the table ' actividades' if it exists, but in lower case. I suppose that this in windoz is no problem because the system is case-insensitive, but not in linux.

I am in the certain thing? I am mistaken? Perhaps I am the only person whom it likes to write the names of the tables in lower case in MySQL?

Good, I propose to so change line 169 of the file MySQL/MySQL.cpp that it so preserve the names of the tables and as the adminstrator decided at its moment.

Nico

[Updated on: Tue, 12 September 2006 14:48]

Report message to a moderator

Re: MySqlSession::EnumTables -> why uppercase? [message #5285 is a reply to message #5284] Tue, 12 September 2006 15:01 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Interesting. I always thought that in SQL, all identifiers are case insensitive.

Mirek
Re: MySqlSession::EnumTables -> why uppercase? [message #5287 is a reply to message #5284] Tue, 12 September 2006 15:25 Go to previous messageGo to next message
nicomesas is currently offline  nicomesas
Messages: 104
Registered: September 2006
Location: Barcelona, Spain
Experienced Member
I also believed it, but I read in a magazine few days ago there was an error of security in MySQL, by means of which a remote user could create an equal data base to another existing one as long as he used a different capitalization, and this problem did not exist now in Windows because his file system is case-insensitive.

This means that if db exists one called "anything" a malicious user could create a call "AnyThing".


I have been several years working with MySQL in Windows and it had never had problems of this type, but with the same DB in Linux, if I have a called table 'actividades' and do one "SELECT * FROM ACTIVIVADES" says to me that the table does not exist. This did not happen in Windows, I think.

It excuses my English so bad one.

Nico
Re: MySqlSession::EnumTables -> why uppercase? [message #5288 is a reply to message #5287] Tue, 12 September 2006 15:32 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Actually, as MySQL uses separate file for each table, named the same as the table, it seems to make the sense.

Well, try this (MySql.cpp)

Vector<String> MySqlSession::EnumTables(String database)
{
	Vector<String> out;
	Sql cursor(*this);
	if(cursor.Execute("show tables from " + database))
		out = FetchList(cursor, false); //<< Here is the change
	return out;
}


(When the author of MySql interface code is available once again, I will ask him what he meant by uppercasing these names Smile

Mirek
Re: MySqlSession::EnumTables -> why uppercase? [message #5290 is a reply to message #5284] Tue, 12 September 2006 15:42 Go to previous message
nicomesas is currently offline  nicomesas
Messages: 104
Registered: September 2006
Location: Barcelona, Spain
Experienced Member
Thanks, I finish it proving and works perfect.
Nico
Previous Topic: OkCommit problem
Next Topic: select(*)
Goto Forum:
  


Current Time: Mon Apr 29 04:39:35 CEST 2024

Total time taken to generate the page: 0.04353 seconds