logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

RE: Backtick woes with mysql (4.0): msg#00015

Subject: RE: Backtick woes with mysql (4.0)
Oh... I just realized this is the Creole, not the Propel list. Sorry :)
Outlook showed them in the same group in the unread messages folder...

- David


> -----Original Message-----
> From: TRauMa [mailto:dtrauma-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx]
> Sent: Monday, May 16, 2005 10:21 PM
> To: users-IxL5lNO0W+8WBrYXtHbyV9i2O/JbrIOy@xxxxxxxxxxxxxxxx
> Subject: [creole] Backtick woes with mysql (4.0)
> 
> Hi,
> 
> I use Creole for a day now (and started to look into Propel), but I
> got some issues.
> 
>   1. I have to use table names that collide with ANSI99 and MySQL
> keywords, and the wannabe-DB MySQL runs without --ansi here (which i
> cant change). So to quote table field names, I /have/ to use ` instead
> of ". But, of course, I don't want to, because other DBs choke on such
> a deviation. Is there any way around this? (I already found out that
> with MySQL 4.1 I could set "ansi mode" per session, but I cant update
> the DB, either).
> 
>   2. Table name prefixes - I read about this in the archives of this
> list, but the method suggested there to prefix table names was, uhm, a
> bit clumsy. (table name prefixes are important to ppl who have to pay
> their provider per db and want to avoid collisions between webapps).
> 
> I figured that both of this could be solved with a quoting function
> for table names, which the user could choose to wrap around his
> queries.
> 
> e.g.:
> $query = "SELECT %s FROM %s WHERE %s = ? LIMIT 30";
> $query = sprintf($query, $con->tblName("monk"), $con->tblName("foo"),
> $con->tblName("bar"))
> 
> and $query would become
> 
> SELECT "monk" FROM "foo" WHERE "bar" = ? LIMIT 30
> on lets say postgres and
> SELECT `monk` FROM `foo` WHERE `bar` = ? LIMIT 30
> on mysql(i).
> 
> I know, ugly, clumsy, another layer of indirection... But you wouldn't
> be forced to use it, and when using it you wouldn't discover someday
> that "last" is a reserved keyword in db x , but not in y, which you
> used before.
> 
> What do you think?
> 
> regards,
>    Thomas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> users-unsubscribe-IxL5lNO0W+8WBrYXtHbyV9i2O/JbrIOy@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: 
> users-help-IxL5lNO0W+8WBrYXtHbyV9i2O/JbrIOy@xxxxxxxxxxxxxxxx
> 


<Prev in Thread] Current Thread [Next in Thread>