<div dir="ltr"><br><div class="gmail_quote"><div dir="ltr">Em qua, 18 de nov de 2015 às 11:46, Gilles Caulier <<a href="mailto:caulier.gilles@gmail.com">caulier.gilles@gmail.com</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2015-11-18 14:33 GMT+01:00 Henrique Santos Fernandes <span dir="ltr"><<a href="mailto:sf.rique@gmail.com" target="_blank">sf.rique@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I dont understando that much but i have 2 questions.<div><br></div><div>Why dont create the index normaly instead of using this if exist procedure?</div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I don't know. I don't write the SQL code for MySQL. This have been done by an old contributor, few years ago...</div><div><br></div><div>If you look into this procedure code, it's sound complicated. I don't know why ?</div><div><br></div><div><div>CREATE PROCEDURE create_index_if_not_exists(table_name_vc varchar(50), index_name_vc varchar(50), field_list_vc varchar(1024))</div><div> BEGIN</div><div><br></div><div> set @Index_cnt = (</div><div> SELECT COUNT(1) cnt</div><div> FROM INFORMATION_SCHEMA.STATISTICS</div><div> WHERE CONVERT(DATABASE() USING latin1) = CONVERT(TABLE_SCHEMA USING latin1)</div><div> AND CONVERT(table_name USING latin1) = CONVERT(table_name_vc USING latin1)</div><div> AND CONVERT(index_name USING latin1) = CONVERT(index_name_vc USING latin1)</div><div> );</div><div><br></div><div> IF IFNULL(@Index_cnt, 0) = 0 THEN</div><div> set @index_sql = CONCAT( </div><div> CONVERT( 'ALTER TABLE ' USING latin1),</div><div> CONVERT( table_name_vc USING latin1),</div><div> CONVERT( ' ADD INDEX ' USING latin1),</div><div> CONVERT( index_name_vc USING latin1),</div><div> CONVERT( '(' USING latin1),</div><div> CONVERT( field_list_vc USING latin1),</div><div> CONVERT( ');' USING latin1)</div><div> );</div><div> PREPARE stmt FROM @index_sql;</div><div> EXECUTE stmt;</div><div> DEALLOCATE PREPARE stmt;</div><div> END IF;</div><div> END;</div></div><div><br></div><div>Calls of this procedure is done like this (for thumbnails DB for ex) :</div><div><br></div><div>CALL create_index_if_not_exists('UniqueHashes','id_uniqueHashes','thumbId');<br></div><div>CALL create_index_if_not_exists('FilePaths','id_filePaths','thumbId');<br></div><div>CALL create_index_if_not_exists('CustomIdentifiers','id_customIdentifiers','thumbId');<br></div><div><br></div><div>Why this complexity with this procedure. No idea...</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>If the procedure is really needed, you need to create it with digikam user?</div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>it's already the case with current code.</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>You should be able to create the procedure when seting up the databases, grant privilges and stuff. right?</div><div> <br></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div></div><div>So user digikam dont need to create the procedure right? the root/admin could do this..</div><div><br></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div>That i can see on Internet, procedure and function need Mysql grant priviledges to be executed, not created... But i'm not an expert...<br></div></div></div></div></div></blockquote><div><br></div><div>Can you try the explained ins thsi link and see if you have permissiosn?</div><div><a href="http://stackoverflow.com/questions/10089308/mysql-stored-procedure-permissions">http://stackoverflow.com/questions/10089308/mysql-stored-procedure-permissions</a><br></div><div><br></div><div>I guess it would be somethng like this:</div><div><pre class="lang-sql prettyprint prettyprinted" style="margin-top:0px;padding:5px;border:0px;font-size:13px;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;color:rgb(57,51,24);word-wrap:normal;background-color:rgb(238,238,238)"><code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:inherit"><span class="kwd" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">GRANT</span><span class="pln" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">EXECUTE</span><span class="pln" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">ON</span><span class="pln" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">PROCEDURE</span><span class="pln" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> digikamthumbsdb</span><span class="pun" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">.</span><span style="color:rgb(33,33,33);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px;white-space:normal;background-color:rgb(255,255,255)">create_index_if_not_exists</span><span class="pln" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">TO</span><span class="pln" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span class="str" style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">'digikam'</span><span class="pun" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">@</span><span class="str" style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">'localhost'</span><span class="pun" style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">;</span></code></pre></div><div>Read the comments, because the user said it needed to add something in this query!</div><div><br></div><div>You may add to all procedures as well..</div><div><a href="http://dba.stackexchange.com/questions/20221/mysql-user-permission-on-stored-procedure">http://dba.stackexchange.com/questions/20221/mysql-user-permission-on-stored-procedure</a><br></div><div><br></div><div>Hope this help!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div></div></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>Gilles Caulier</div></div></div></div>
_______________________________________________<br>
Digikam-users mailing list<br>
<a href="mailto:Digikam-users@kde.org" target="_blank">Digikam-users@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/digikam-users" rel="noreferrer" target="_blank">https://mail.kde.org/mailman/listinfo/digikam-users</a><br>
</blockquote></div></div>