the subject itself...
| Comment | File | Size | Author |
|---|---|---|---|
| #60 | interdiff-1055716-28-35.txt | 11.08 KB | ar-jan |
| #60 | interdiff-1055716-35-50.txt | 6.72 KB | ar-jan |
| #60 | interdiff-1055716-50-60.txt | 2.54 KB | ar-jan |
| #60 | dbtuner-port_to_d7-1055716-60.patch | 38.54 KB | ar-jan |
| #54 | dbtuner1-sah62.jpg | 42.74 KB | sah62 |
Comments
Comment #1
mikeytown2 commentedObviously I'm for this. Issue is I don't have any d7 sites...
I'm thinking a patch should be fairly straight forward. Some parts might work out of the box with this tool http://upgrade.boombatower.com/ Some of the heavy database operations like collations might not convert over correctly. I would think the views code would convert over though.
Comment #2
ogi commentedsubscribe
Comment #3
geek-merlinsub!
Comment #4
EndEd commentedSubscribe
Comment #5
drupa11y commentedSubscribe
Comment #6
tebb commentedFollowing.
Comment #7
tebb commentedMake module name visible in Dashboard.
Comment #8
acoustika commented+1
Comment #9
Barfly commentedsubscribes
Comment #10
ss81 commentedHi All!
I've started to migrate this module to D7, but have a problem.
This function works, but I'm worried about the query: I guess that SQL injection can't be implemented with $table->name variable, but I'm not sure... I can't use marker ":name" there because then Drupal add quotes to table name.
Could somebody help me with this question? Is it safe to have such SQL query in the code?
Comment #11
mikeytown2 commentedUnless you have a table in your DB that is named to be an mysql exploit you should be safe. In other words it's close to impossible.
U try out http://upgrade.boombatower.com/ ?
Comment #12
ss81 commentedHi Mike,
I agree that this is almost impossible, but it could be better to know that it's not only my opinion.
I haven't tried the http://upgrade.boombatower.com yet (I migrate modules based on API manual). Thanks for the link! I will check it soon. Especially that I want to migrate the http://drupal.org/project/xml_parser too.
Comment #13
jeffwidman commentedsubscribe
Comment #14
obrienmd commentedsubscribe
Comment #15
benrogmans commentedsubscribe
Comment #16
tripper54 commentedsubscribe
Comment #17
sachbearbeiter commentedsubscribe
Comment #18
Fidelix commentedSubscribing...
Comment #19
ar-jan commentedSubscribe. This would be great to have for D7, since using B&M caused me having mixed latin1_swedish_ci and utf8_general_ci tables and MyISAM/InnoDB on several sites.
Did anyone continue work on this?
Comment #20
sam mooreSubscribe
Comment #21
skizzo commentedsubscribing
Comment #22
mikefyfer commentedsub
Comment #23
roam2345 commentedtail -f
Comment #24
elianmsub
Comment #25
janel-1 commentedsubscribe
Comment #26
ar-jan commentedYou can now use the 'Follow' button on the top right of the page instead of commenting.
Comment #27
ar-jan commentedI don't really code, but I thought running it through upgrade.boombatower.com coder upgrade might get things rolling.
Here's the coding standards patch I ran first, as recommended (against 6.x-1.x-dev).
Comment #28
ar-jan commentedAnd here are the unmodified upgrade files (against the coding-standards adapted module):
This is the current status of the port:
ArrayViews Not InstalledFatal error: Call to undefined function db_fetch_array() in sites/all/modules/dbtuner/dbtuner.admin.inc on line 179Fatal error: Call to undefined function db_fetch_array() in sites/all/modules/dbtuner/dbtuner.admin.inc on line 52Fatal error: Call to undefined function db_fetch_array() in sites/all/modules/dbtuner/dbtuner.mysqltuner.inc on line 35Comment #29
ar-jan commentedAnyone? I hoped this would get things started!
Comment #30
virtuali1151 commentedsub
Comment #31
socialnicheguru commentedit looks like db_fetch_array has been replaced by db_query in D7
http://api.drupal.org/api/drupal/includes%21database%21database.inc/func...
Comment #32
darrenlambert commentedSubscribing
Comment #33
funana commentedinterested!
Comment #34
mgiffordLooks like we can take @ArjanLikesDrupal's patch replace db_fetch_array with db_query & maybe run out a dev version.
That sound right? Who wants to roll up the patch against the latest git repo?
Comment #35
sylv3st3r commentedTaken from ArjanLikesDrupal's dbtuner-7.x-1.x-dev.tar.gz. I fix all db query and render problem. Haven't tried to change engine and collocation as I did the fix on a live site :P
If anyone can test and post me any error, I'll try to fix it.
Comment #36
socialnicheguru commentedI notice that when I try to run optimize or repair commands on my database it does not work on innodb.
what will?
Comment #37
sylv3st3r commentedIf I remember correctly, InnoDB doesn't support repair
Comment #38
omega8cc commentedOPTIMIZEstill works for InnoDB, just in a different way - see http://stackoverflow.com/questions/2816044/optimize-innodb-tableFor
REPAIRrelated issues (if you think you need it) check also:http://stackoverflow.com/questions/226172/how-do-i-repair-an-innodb-table
http://www.mysqlperformanceblog.com/2008/07/04/recovering-innodb-table-c...
Comment #39
giorgio79 commentedHere is sg to include for innodb :) #817398: Provide a requirements warning when innodb_flush_log_at_trx_commit is set
Comment #40
yannickoo#35: You should replace
db_prefix_tableswithDatabase::getConnection()->prefixTablesin dbtuner.explain.inc line 131 so that you don't get a fatal error :)Comment #41
mgifford@sylv3st3r why didn't you just extend the patch? Usually easier that way to gain adoption.
Comment #42
sylv3st3r commentedWell.... I don't know ho to extend the patch :P
And I didn't see the author extending it into D7 yet. At least mine is working to some extend.
Thanks,
-r
Comment #43
mgiffordIt's pretty simple.
1) Pull down the latest code from git for DB Tuner.
2) Copy your files (uploaded into the zip) on-top of it.
3) Follow instructions here http://drupal.org/node/707484
Then it's easy to see what you've changed what you haven't.
Then the community can be involved in seeing it work better.
Comment #44
yannickooSo guys, it's a pain to see uploaded archives here so I created a patch based on the archive, try it and have fun ;)
Comment #45
Bhanuji commentedCan you please provide steps
How to get the code from git for DB Tuner..?
Thanks
Bhanu
Comment #46
yannickooTo clean that git repository up (because you don't need it) you can execute following after the steps above:
Comment #47
Bhanuji commentedBelow is the error when I am applying the patch
git.exe am --3way --ignore-space-change --keep-cr "D:\Meredith\dbtuner-port_to_d7-1055716-44.patch"
Patch format detection failed.
Comment #48
yannickooTry it like I said...
Comment #49
mgiffordI tried applying this patch to:
git clone --branch master http://git.drupal.org/project/dbtuner.gitAnd it failed. Then tried manually applying the patch (not through git) - and it also failed.
What version of the code did you build the patch against?
Comment #50
yannickooUpdated the patch. Please use the 6.x-1.x branch instead of the master branch.
Comment #51
janis_lv commentedwaiting for a d7 version
Comment #52
mgiffordPatch applies nicely. But going to /admin/modules I get this error:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'sites/all/modules/dbtuner/dbtuner.module' for key 'PRIMARY': INSERT INTO {system} (filename, name, type, owner, info) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => sites/all/modules/dbtuner/dbtuner.module [:db_insert_placeholder_1] => dbtuner [:db_insert_placeholder_2] => module [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => a:10:{s:4:"name";s:8:"DB Tuner";s:11:"description";s:44:"Adds indexes to fields used in views & more.";s:4:"core";s:3:"7.x";s:7:"package";s:27:"Performance and scalability";s:10:"recommends";a:1:{i:0;s:5:"views";}s:12:"dependencies";a:0:{}s:7:"version";N;s:3:"php";s:5:"5.2.4";s:5:"files";a:0:{}s:9:"bootstrap";i:0;} ) in system_update_files_database() (line 2307 of /DRUPAL7/modules/system/system.module).Comment #53
rooby commentedI know comment #10 was a long time ago but if that is still an issue use db_escape_table().
Comment #54
sah62 commentedI just followed the steps described in #46 and applied the patch from #50. There were no errors during installation, but what I'm seeing on the configuration pages looks a little strange. The Indexes page doesn't list any indexes (see attached image), and the Explain Views page is completely blank. The Collation page produces "The website encountered an unexpected error. Please try again later." Here's the error:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydb.drupal_drupal_access' doesn't exist: SHOW full fields FROM {drupal_access}; Array ( ) in dbtuner_collation_configuration() (line 66 of /mypath/public_html/sites/all/modules/dbtuner/dbtuner.admin.inc).The name of the table in my database is drupal_access, not drupal_drupal_access. Thoughts, anyone?
Comment #55
yannickooPatch does not follow the coding standards.
Comment #56
rooby commentedFor reference: Coding standards
Comment #57
sah62 commentedThis is line 66 of dbtuner.admin.inc:
$result = db_query("SHOW full fields FROM {".$table."}");The tables in my database are prefixed with "drupal_". The { and } braces cause the prefix to be appended to the table name, which turns "drupal_access" into "drupal_drupal_access". It seems like there's an error in the logic here: either this query shouldn't append the prefix, or the query that produced the tables names shouldn't have retrieved the prefixed names. Which should be modified to make this work?
Comment #58
rooby commentedI haven't actually used the patch but from a look at the patch the code does a SHOW TABLES query and then passes the results of that into other sql queries.
In this case you should not be using {} around the table name.
This is because the purpose of the {} is for drupal to apply the database table prefix if there is one, however when you do SHOW TABLES it returns the name of the table including the prefix.
That is why you are getting double prefix.
Comment #59
sah62 commentedI see what's causing this, but I'm not familiar enough with the Drupal 7 database API to know how to fix it. Function dbtuner_db_query in dbtuner.explain.inc calls db_prefix_tables() and _db_query_callback() and both have been deprecated in Drupal 7.
Is this function even needed in Drupal 7?
Comment #60
ar-jan commented@mgifford #52: looks like some of dbtuner's tables were already present while installing? I did not have this problem on a fresh Drupal 7.23 installation.
I tried changing database engine and collation using patch from #50, both still had errors.
I also wanted to get an overview of the earlier changes, some interdiffs of the earlier patches are attached.
Changing database engine and collation both work for me using the following updated patch (tested to/from MyISAM/InnoDB and to/from utf8_general_ci/ utf8_unicode_ci.
I'll have to look into the coding standards some more to see how to deal with those long sql statements etc., but I'll just post this first since it works for me.
Comment #61
sah62 commented@ar-jan: have you tried to look at the "Explain Views" functionality?
Comment #62
ar-jan commentedI just took a look but I'm not sure. It seems that _db_query_callback() only takes cares of placeholder substitutions, and this should be handled by the database layer in D7 (?). I don't see why db_prefix_tables() is used in dbtuner_db_query() (which is only called in line 99 to save the query for display, I think), but isn't used in line 104 for the actual EXPLAIN query
I tried removing the whole dbtuner_db_query() function and changing line 104 to
But this gives
PDOException: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound: EXPLAIN SELECT node.title AS node_title, node.nid AS nid, users_node__authmap.authname AS users_node__authmap_authname, users_node.mail AS users_node_mail, users_node.uid AS users_node_uid, comment_node.cid AS comment_node_cid, comment_node.nid AS comment_node_nid, node.created AS node_created FROM {node} node INNER JOIN {users} users_node ON node.uid = users_node.uid LEFT JOIN {comment} comment_node ON node.nid = comment_node.nid LEFT JOIN {authmap} users_node__authmap ON users_node.uid = users_node__authmap.uid WHERE (( (node.status = :db_condition_placeholder_0) )) ORDER BY node_created DESC /* test - default*/; Array ( ) in dbtuner_explain_get_views() (line 104 of modules/dbtuner/dbtuner.explain.inc).Is this because of the placeholders? Anyone know how this explain query should be run?
Comment #63
sah62 commentedI think so and that's exactly what I'm seeing. $query_args and $view->build_info['query_args'] are both arrays with 0 elements. Might this have something to do with a D6 to D7 change in the Views API?
Comment #64
nwom commentedIs the current patch stable enough to use in a test environment or is it still being worked on? I can't wait to try this out! Thanks for everyone's effort on this.