PHP Classes

this is pure shit, i mean who need this anyway?

Recommend this page to a friend!

      SQL Parsing  >  All threads  >  this is pure shit, i mean who need...  >  (Un) Subscribe thread alerts  
Subject:this is pure shit, i mean who need...
Summary:Package rating comment
Messages:5
Author:Timo Witte
Date:2010-02-10 14:40:06
Update:2010-02-11 17:40:35
 

Timo Witte rated this package as follows:

Utility: Bad
Consistency: Sufficient
Examples: Sufficient

  1. this is pure shit, i mean who need...   Reply   Report abuse  
Picture of Timo Witte Timo Witte - 2010-02-10 14:40:06
this is pure shit, i mean who need this anyway?

  2. Re: this is pure shit, i mean who need...   Reply   Report abuse  
Picture of Rupom Razzaque Rupom Razzaque - 2010-02-10 15:15:54 - In reply to message 1 from Timo Witte
What do you mean by "pure shit"? Try to understand its importance first. Lots people sent me good comments about this class. You may suggest me to modify this class, that would be appreciated. But you cant comment this way.

Thanks anyway.

  3. Re: this is pure shit, i mean who need...   Reply   Report abuse  
Picture of Timo Witte Timo Witte - 2010-02-10 15:44:40 - In reply to message 2 from Rupom Razzaque
i mean this class only does substr(...,-1) if you have added ; behind your query and executes line by line this could be done a lot more easily! like

function importSQLFile($file) {
$lines = explode("\n", file_get_contents($file));
foreach($lines as $sql) {
if(substr(trim($sql), 0, 3) != "---")
mysql_query(substr(trim($sql), -1, 1) ? substr(trim($sql), 0, -1) : trim($sql)) or throw new Exception(mysql_error());
}
}

class wrapped arround just one function?
itīs not really a Parser by the way.

  4. Re: this is pure shit, i mean who need...   Reply   Report abuse  
Picture of Rupom Razzaque Rupom Razzaque - 2010-02-10 16:00:57 - In reply to message 3 from Timo Witte
any suggestion is fine. thanks for your suggestion. but i don't see anything new in your code - you just converted 2 lines into one or so. simplicity is the best. my code targets the poorest developer who started PHP yesterday.

this class has few methods, not one. but a class can even consist only one method (should not call "function" when it is part of class).

thanks again.

  5. Re: this is pure shit, i mean who need...   Reply   Report abuse  
Picture of Zafar Iqbal Zafar Iqbal - 2010-02-11 17:40:35 - In reply to message 3 from Timo Witte
Hi Timo,

Your initial feedback is not exactly constructive. And very harsh. Your second message is more fair.

The best thing would be to contribute to the basic class and improve it.

And there is room for improvement. The original class and your function have serious flaws that would not help even a beginner programmer because it would confuse them more when the code breaks. They would rather do it from scratch and have something working and learn from writing their own code.

Cheers.