#mysql
03 November 2007
Total 17 pages. You are browsing page 2/17.
First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last
01:11 <****> http://dev.mysql.com/doc/refman/5.0/en/user-variables.html
01:11 <****> auto-truncate :)
01:11 <****> ToeBee: It needs to be server wide and ideally difficult to change the value
01:13 <****> oh... server wide? hmm
01:13 <****> A table would work, I suppose
01:13 <****> Be easier to manage than a buncha functions
01:14 <****> Though I'd rather have something that gives a syntax error if the "constant" doesn't exist
01:18 <****> If you wanted to do that, then you could have the table the bad way for storing most data :)
01:19 <****> Instead of having
01:19 <****> ID - Constant name - Constant value
01:19 <****> Just have
01:19 <****> Constant 1 - Contstant 2 - Constant 3
01:19 <****> Server name - Server domain etc
01:19 <****> So then if they tried using a constant that wasn't in the table, it would give an invalid query :)
01:20 <****> Heh
01:20 <****> SELECT constant.server_name
01:20 <****> :)
01:20 <****> There might be a better way though, it's a bit of a work around but it would work
01:20 <****> Yeah, it's an idea at least
01:21 <****> I wonder if there's a way to make a function that runs during compile time, or something along those lines
01:21 <****> During compile time?
01:21 <****> Err, well
01:21 <****> Whatever it's called when mysql is parsing the syntax
01:22 <****> Well as ToeBee said, user variables are designed for that purpose but it doesn't exactly fit what you're looking for
01:22 <****> Yeah
01:22 <****> I was hoping there was some big feature I overlooked. Guess not :-/
01:23 <****> The table column idea is actually tempting, despite its evilness
01:24 <****> Or as you said, you could use the procedure idea
01:24 <****> But that would probably require editing the procedure everytime you wish to add a constant
01:24 <****> Yeah
01:24 <****> But then I suppose you could do something like CONSTANT(SERVER_NAME)
01:25 <****> Not much different from constant.server_name though
01:26 <****> :(
01:26 <****> SET GLOBAL TestingVar=999;
01:26 <****> #1193 - Unknown system variable 'athecksd_testvar'
01:27 <****> Pfft, ignore the var name
01:27 <****> haha
01:27 <****> Looks like no way to set the constants
01:28 <****> I wonder what it would take to add a new global
01:28 <****> Hacking the code? Writing some kind of plugin, module, something along those lines?
01:28 <****> Is it possible to make this statement (which works in PostgreSQL) work in MySQL?
01:28 <****> DELETE FROM Category AS c WHERE EXISTS (SELECT r.id FROM Course AS r WHERE r.id = c.id)
01:30 <****> RProgrammer: Perhaps: DELETE FROM Category c WHERE c.id IN (SELECT id FROM Course)
01:30 <****> Hmmm
01:30 <****> Did I read that right? You want to delete all the records from Category where there is a matching id in Course?
01:31 <****> Sure
01:31 <****> My point was that MySQL doesn't allow aliases for non-SELECT FROM's
01:32 <****> It doesn't?
01:32 <****> POW(c.id,2))
01:32 <****> There
01:33 <****> RProgrammer: I guess you have to fully qualify the table name instead of using an alias, then?
01:33 <****> I don't know for sure, sorry. Someone else might be able to answer more authoritatively.
01:34 <****> revdiablo: I think it would involve re-compiling MySQL, not sure on that but I think it would.
01:34 <****> RProgrammer: you cannot delete from a table that is referenced in a subquery. You can use a join instead.
01:34 <****> revdiablo: That goes for every time you want to change a CONSTANT ;) they have that name for a reason :)
01:35 <****> RProgrammer: like 'DELETE t1 FROM test AS t1 join test2 WHERE ...'
01:35 <****> Thecks: They could be constant after creation and still be reasonable called a constant
01:35 <****> Reasonably, even
01:36 <****> http://dev.mysql.com/doc/refman/5.0/en/delete.html
01:36 <****> Oh well... time to go home. I'll decide on monday
01:36 <****> revdiablo: Normally constants are initiated when the program loads, but even so.. it's not what MySQL was design for :)
01:36 <****> ki77a77: DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name
01:37 <****> tbl_name doesn't allow AS or JOIN, if I'm not mistaken
01:37 <****> RProgrammer: search on that page for JOIN
01:37 <****> Thecks: Well, whatever the definition of constant... I just need something that doesn't change easily, and gives me a symbolic name for a value, preferably with a syntax error if one tries to use a name that doesn't exist
01:37 <****> Hi. What's that command again that changes the password of a user from the commandline?
01:38 <****> brb
01:38 <****> ki77a77: It wouldn't delete the joined table?
01:38 <****> rather, delete rows from the joined table
01:39 <****> RProgrammer: it can, if you write it that way.
01:39 <****> RProgrammer: 'DELETE t1 FROM test AS t1 join test2 WHERE ...' doesn't
01:39 <****> RProgrammer: This does "DELETE t1, t2 FROM t1, t2, t3 WHERE t1.id=t2.id AND t2.id=t3.id;"
01:40 <****> The first wouldn't throw a syntax error?
01:41 <****> I'll take my answer off the air, I gotta run.
01:41 <****> What is this, talk radio?
01:42 * adaptr makes a sucking noise
01:46 <****> http://www.google.com/search?q=Unable+to+jump+to+row+0+on+MySQL+result+index&btnG=Search
01:47 <****> Can't find much of help there. I'm getting that error on this code:
01:47 <****> $x = mysql_result(mysql_query("select comment_id, datum from {$dbs['prefix']}comments where
01:47 <****> typ='".$typ."' and id='".$id."' group by datum desc limit 1"),0);
01:47 <****> Not sure what I did wrong...
01:50 <****> Unable to jump to row 0 on MySQL result index 23, is the error I'm getting.
01:51 <****> so remove the zero
01:53 <****> adaptr: Wrong parameter count for mysql_result()
01:53 <****> ah - so that wasn't it :)
01:54 <****> have you run the query with constants ?
01:54 <****> branstrom: there is no way for anyone here to tell if any of your php variables hold the values you think they do. Echo the sql statement and paste that.
01:54 <****> No I was about to. Hang on...
01:56 * adaptr stops hanging on, as his fingers are hurting
01:59 <****> select comment_id, datum from fmsweden.fm_comments where typ='1' and id='60' group by datum desc limit 1;
01:59 <****> +------------+------------+
01:59 <****> | comment_id | datum |
01:59 <****> +------------+------------+
01:59 <****> | 330 | 1162117657 |
01:59 <****> +------------+------------+
01:59 <****> 1 row in set (0.01 sec)
02:00 <****> so the query is not the issue - your variables are
02:00 <****> ..which was rather the obvious answer
02:00 <****> Hm... alright.
02:05 <****> branstrom: the php manual also notes "Note: Calls to mysql_result() should not be mixed with calls to other functions that deal with the result set." All of their examples put the mysql_query result into a variable before calling mysql_result. FWIW.
Total 17 pages. You are browsing page 2/17.
First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last
