Skip to content
Permalink
Browse files

Datenbankstruktur

  • Loading branch information...
Oliver85
Oliver85 committed May 17, 2012
1 parent 2570342 commit cd377c291b51250c9abe0d735d53f8a5d8569834
Showing with 15,280 additions and 0 deletions.
  1. +67 −0 htdocs/doc/sql/examples/expertsearch1.php
  2. +31 −0 htdocs/doc/sql/examples/expertsearch10.php
  3. +34 −0 htdocs/doc/sql/examples/expertsearch11.php
  4. +61 −0 htdocs/doc/sql/examples/expertsearch12.php
  5. +62 −0 htdocs/doc/sql/examples/expertsearch13.php
  6. +50 −0 htdocs/doc/sql/examples/expertsearch2.php
  7. +51 −0 htdocs/doc/sql/examples/expertsearch3.php
  8. +50 −0 htdocs/doc/sql/examples/expertsearch4.php
  9. +49 −0 htdocs/doc/sql/examples/expertsearch5.php
  10. +48 −0 htdocs/doc/sql/examples/expertsearch6.php
  11. +48 −0 htdocs/doc/sql/examples/expertsearch7.php
  12. +40 −0 htdocs/doc/sql/examples/expertsearch8.php
  13. +33 −0 htdocs/doc/sql/examples/expertsearch9.php
  14. 0 htdocs/doc/sql/examples/index.html
  15. 0 htdocs/doc/sql/index.html
  16. +65 −0 htdocs/doc/sql/se2de-lift/data/00.01_new_cache_types.sql
  17. +230 −0 htdocs/doc/sql/se2de-lift/data/01_copy_users.sql
  18. +298 −0 htdocs/doc/sql/se2de-lift/data/02_copy_caches.sql
  19. +92 −0 htdocs/doc/sql/se2de-lift/data/03_copy_misc.sql
  20. +81 −0 htdocs/doc/sql/se2de-lift/data/04_copy_waypoint_and_note.sql
  21. +1 −0 htdocs/doc/sql/se2de-lift/data/10_podcache.sql
  22. +2 −0 htdocs/doc/sql/se2de-lift/data/11_rss.sql
  23. +1 −0 htdocs/doc/sql/se2de-lift/data/12_wheelchair.sql
  24. +60 −0 htdocs/doc/sql/se2de-lift/data/readme.txt
  25. +2 −0 htdocs/doc/sql/se2de-lift/structure/01_longer_password.sql
  26. +21 −0 htdocs/doc/sql/se2de-lift/structure/02_podcache.sql
  27. +17 −0 htdocs/doc/sql/se2de-lift/structure/03_coordinates.sql
  28. +18 −0 htdocs/doc/sql/se2de-lift/structure/04_archived_logs.sql
  29. +2 −0 htdocs/doc/sql/se2de-lift/structure/05_submenu.sql
  30. +2 −0 htdocs/doc/sql/se2de-lift/structure/06_cache_attrib.sql
  31. +8 −0 htdocs/doc/sql/se2de-lift/structure/07_rating_tops.sql
  32. +1 −0 htdocs/doc/sql/se2de-lift/structure/08_statpics.sql
  33. +1 −0 htdocs/doc/sql/se2de-lift/structure/09_countries_options.sql
  34. +8 −0 htdocs/doc/sql/se2de-lift/structure/10_user_statpic.sql
  35. +11,288 −0 htdocs/doc/sql/static-data/data.sql
  36. 0 htdocs/doc/sql/static-data/index.html
  37. +221 −0 htdocs/doc/sql/stored-proc/distance.php
  38. 0 htdocs/doc/sql/stored-proc/index.html
  39. +1,000 −0 htdocs/doc/sql/stored-proc/maintain.php
  40. +9 −0 htdocs/doc/sql/tables/attribute_categories.sql
  41. +10 −0 htdocs/doc/sql/tables/attribute_groups.sql
  42. +9 −0 htdocs/doc/sql/tables/cache_adoption.sql
  43. +23 −0 htdocs/doc/sql/tables/cache_attrib.sql
  44. +13 −0 htdocs/doc/sql/tables/cache_coordinates.sql
  45. +11 −0 htdocs/doc/sql/tables/cache_countries.sql
  46. +20 −0 htdocs/doc/sql/tables/cache_desc.sql
  47. +8 −0 htdocs/doc/sql/tables/cache_ignore.sql
  48. +20 −0 htdocs/doc/sql/tables/cache_location.sql
  49. +27 −0 htdocs/doc/sql/tables/cache_logs.sql
  50. +20 −0 htdocs/doc/sql/tables/cache_logs_archived.sql
  51. +8 −0 htdocs/doc/sql/tables/cache_logtype.sql
  52. +8 −0 htdocs/doc/sql/tables/cache_maps.sql
  53. +8 −0 htdocs/doc/sql/tables/cache_npa_areas.sql
  54. +8 −0 htdocs/doc/sql/tables/cache_rating.sql
  55. +9 −0 htdocs/doc/sql/tables/cache_report_reasons.sql
  56. +9 −0 htdocs/doc/sql/tables/cache_report_status.sql
  57. +15 −0 htdocs/doc/sql/tables/cache_reports.sql
  58. +12 −0 htdocs/doc/sql/tables/cache_size.sql
  59. +14 −0 htdocs/doc/sql/tables/cache_status.sql
  60. +14 −0 htdocs/doc/sql/tables/cache_type.sql
  61. +9 −0 htdocs/doc/sql/tables/cache_visits.sql
  62. +8 −0 htdocs/doc/sql/tables/cache_watches.sql
  63. +47 −0 htdocs/doc/sql/tables/caches.sql
  64. +8 −0 htdocs/doc/sql/tables/caches_attributes.sql
  65. +17 −0 htdocs/doc/sql/tables/coordinates.sql
  66. +10 −0 htdocs/doc/sql/tables/coordinates_type.sql
  67. +15 −0 htdocs/doc/sql/tables/countries.sql
  68. +8 −0 htdocs/doc/sql/tables/countries_list_default.sql
  69. +12 −0 htdocs/doc/sql/tables/countries_options.sql
  70. +13 −0 htdocs/doc/sql/tables/email_user.sql
  71. +13 −0 htdocs/doc/sql/tables/geodb_search.sql
  72. +15 −0 htdocs/doc/sql/tables/gk_item.sql
  73. +8 −0 htdocs/doc/sql/tables/gk_item_type.sql
  74. +8 −0 htdocs/doc/sql/tables/gk_item_waypoint.sql
  75. +16 −0 htdocs/doc/sql/tables/gk_move.sql
  76. +8 −0 htdocs/doc/sql/tables/gk_move_type.sql
  77. +8 −0 htdocs/doc/sql/tables/gk_move_waypoint.sql
  78. +8 −0 htdocs/doc/sql/tables/gk_user.sql
  79. +36 −0 htdocs/doc/sql/tables/gns_locations.sql
  80. +11 −0 htdocs/doc/sql/tables/gns_search.sql
  81. 0 htdocs/doc/sql/tables/index.html
  82. +13 −0 htdocs/doc/sql/tables/languages.sql
  83. +8 −0 htdocs/doc/sql/tables/languages_list_default.sql
  84. +16 −0 htdocs/doc/sql/tables/log_types.sql
  85. +11 −0 htdocs/doc/sql/tables/log_types_text.sql
  86. +14 −0 htdocs/doc/sql/tables/logentries.sql
  87. +8 −0 htdocs/doc/sql/tables/logentries_types.sql
  88. +7 −0 htdocs/doc/sql/tables/map2_data.sql
  89. +16 −0 htdocs/doc/sql/tables/map2_result.sql
  90. +8 −0 htdocs/doc/sql/tables/mapresult.sql
  91. +7 −0 htdocs/doc/sql/tables/mapresult_data.sql
  92. +21 −0 htdocs/doc/sql/tables/mp3.sql
  93. +11 −0 htdocs/doc/sql/tables/news.sql
  94. +9 −0 htdocs/doc/sql/tables/news_topics.sql
  95. +10 −0 htdocs/doc/sql/tables/nodes.sql
  96. +10 −0 htdocs/doc/sql/tables/notify_waiting.sql
  97. +11 −0 htdocs/doc/sql/tables/npa_areas.sql
  98. +10 −0 htdocs/doc/sql/tables/npa_types.sql
  99. +8 −0 htdocs/doc/sql/tables/nuts_codes.sql
  100. +12 −0 htdocs/doc/sql/tables/nuts_layer.sql
  101. +7 −0 htdocs/doc/sql/tables/object_types.sql
  102. +24 −0 htdocs/doc/sql/tables/pictures.sql
  103. +13 −0 htdocs/doc/sql/tables/profile_options.sql
  104. +11 −0 htdocs/doc/sql/tables/queries.sql
  105. +8 −0 htdocs/doc/sql/tables/rating_tops.sql
  106. +12 −0 htdocs/doc/sql/tables/removed_objects.sql
  107. +10 −0 htdocs/doc/sql/tables/replication.sql
  108. +8 −0 htdocs/doc/sql/tables/replication_notimported.sql
  109. +9 −0 htdocs/doc/sql/tables/replication_overwrite.sql
  110. +10 −0 htdocs/doc/sql/tables/replication_overwritetypes.sql
  111. +8 −0 htdocs/doc/sql/tables/search_doubles.sql
  112. +6 −0 htdocs/doc/sql/tables/search_ignore.sql
  113. +10 −0 htdocs/doc/sql/tables/search_index.sql
  114. +9 −0 htdocs/doc/sql/tables/search_index_times.sql
  115. +10 −0 htdocs/doc/sql/tables/search_words.sql
  116. +11 −0 htdocs/doc/sql/tables/stat_cache_logs.sql
  117. +15 −0 htdocs/doc/sql/tables/stat_caches.sql
  118. +11 −0 htdocs/doc/sql/tables/stat_user.sql
  119. +11 −0 htdocs/doc/sql/tables/statpics.sql
  120. +8 −0 htdocs/doc/sql/tables/sys_cron.sql
  121. +11 −0 htdocs/doc/sql/tables/sys_logins.sql
  122. +22 −0 htdocs/doc/sql/tables/sys_menu.sql
  123. +8 −0 htdocs/doc/sql/tables/sys_repl_exclude.sql
  124. +14 −0 htdocs/doc/sql/tables/sys_repl_slaves.sql
  125. +7 −0 htdocs/doc/sql/tables/sys_repl_timestamp.sql
  126. +10 −0 htdocs/doc/sql/tables/sys_sessions.sql
  127. +7 −0 htdocs/doc/sql/tables/sys_temptables.sql
  128. +9 −0 htdocs/doc/sql/tables/sys_trans.sql
  129. +9 −0 htdocs/doc/sql/tables/sys_trans_ref.sql
  130. +9 −0 htdocs/doc/sql/tables/sys_trans_text.sql
  131. +7 −0 htdocs/doc/sql/tables/sysconfig.sql
  132. +41 −0 htdocs/doc/sql/tables/user.sql
  133. +8 −0 htdocs/doc/sql/tables/user_delegates.sql
  134. +9 −0 htdocs/doc/sql/tables/user_options.sql
  135. +8 −0 htdocs/doc/sql/tables/user_statpic.sql
  136. +7 −0 htdocs/doc/sql/tables/watches_logqueue.sql
  137. +11 −0 htdocs/doc/sql/tables/watches_notified.sql
  138. +13 −0 htdocs/doc/sql/tables/watches_waiting.sql
  139. +7 −0 htdocs/doc/sql/tables/watches_waitingtypes.sql
  140. +11 −0 htdocs/doc/sql/tables/ws_sessions.sql
  141. +8 −0 htdocs/doc/sql/tables/ws_tan.sql
  142. +19 −0 htdocs/doc/sql/tables/xmlsession.sql
  143. +8 −0 htdocs/doc/sql/tables/xmlsession_data.sql
@@ -0,0 +1,67 @@
<?php
// Unicode Reminder メモ
$rootpath = '../../../';
require($rootpath . 'lib/common.inc.php');
require_once($rootpath . 'lib/sqldebugger.inc.php');
sqldbg_begin();
$sql_debug = true;
/*
(1) Füge alle Einträge die diesem Filter entsprechen der Ergebnisliste hinzu
Filtertyp: nach Entfernung
Koordinaten: N 48° 30.000' E 9°30.000'
Entfernung: 75 km
*/
//sql('CREATE TEMPORARY TABLE result_caches ENGINE=MEMORY SELECT (acos(cos(0.72431) * cos((90-`caches`.`latitude`) * 3.14159 / 180) + sin(0.72431) * sin((90-`caches`.`latitude`) * 3.14159 / 180) * cos((9.50000-`caches`.`longitude`) * 3.14159 / 180)) * 6370) `distance`, `caches`.`cache_id` `cache_id` FROM `caches` WHERE `longitude` > 8.48320014339 AND `longitude` < 10.5167998566 AND `latitude` > 47.8250539957 AND `latitude` < 49.1749460043 HAVING `distance` < 75');
sql('CREATE TEMPORARY TABLE result_caches ENGINE=MEMORY SELECT cache_id FROM caches');
sql('ALTER TABLE result_caches ADD PRIMARY KEY (cache_id)');
/*
(2) Entferne alle Einträge die diesem Filter entsprechen von der Ergebnisliste
Filtertyp: nach Finder
User: Team A
*/
sql('CREATE TEMPORARY TABLE remove_caches ENGINE=MEMORY SELECT DISTINCT result_caches.cache_id cache_id FROM result_caches, cache_logs WHERE result_caches.cache_id=cache_logs.cache_id AND cache_logs.user_id=101254');
sql('ALTER TABLE remove_caches ADD PRIMARY KEY (cache_id)');
sql('DELETE FROM result_caches WHERE cache_id IN (SELECT cache_id FROM remove_caches)');
sql('DROP TABLE remove_caches');
/*
(3) Entferne alle Einträge die diesem Filter entsprechen von der Ergebnisliste
Filtertyp: nach Finder
User: Team B
*/
sql('CREATE TEMPORARY TABLE remove_caches ENGINE=MEMORY SELECT DISTINCT result_caches.cache_id cache_id FROM result_caches, cache_logs WHERE result_caches.cache_id=cache_logs.cache_id AND cache_logs.user_id=101301');
sql('ALTER TABLE remove_caches ADD PRIMARY KEY (cache_id)');
sql('DELETE FROM result_caches WHERE cache_id IN (SELECT cache_id FROM remove_caches)');
sql('DROP TABLE remove_caches');
/*
(4) Entferne alle Einträge die nicht diesem Filter entsprechen von der Ergebnisliste
Filtertyp: nach status
Status: Kann gesucht werden
*/
sql('CREATE TEMPORARY TABLE remove_caches ENGINE=MEMORY SELECT result_caches.cache_id cache_id FROM result_caches, caches WHERE result_caches.cache_id=caches.cache_id AND caches.status!=1');
sql('ALTER TABLE remove_caches ADD PRIMARY KEY (cache_id)');
sql('DELETE FROM result_caches WHERE cache_id IN (SELECT cache_id FROM remove_caches)');
sql('DROP TABLE remove_caches');
/*
(5) Entferne alle Einträge die nicht diesem Filter entsprechen von der Ergebnisliste
Filtertyp: nach zeitaufwand
Zeitaufwand: kleiner 2h
*/
sql('CREATE TEMPORARY TABLE remove_caches ENGINE=MEMORY SELECT result_caches.cache_id cache_id FROM result_caches, caches WHERE result_caches.cache_id=caches.cache_id AND caches.search_time>2');
sql('ALTER TABLE remove_caches ADD PRIMARY KEY (cache_id)');
sql('DELETE FROM result_caches WHERE cache_id IN (SELECT cache_id FROM remove_caches)');
sql('DROP TABLE remove_caches');
sqldbg_end();
?>
@@ -0,0 +1,31 @@
<?php
// Unicode Reminder メモ
$rootpath = '../../../';
require($rootpath . 'lib/common.inc.php');
require_once($rootpath . 'lib/sqldebugger.inc.php');
sqldbg_begin();
$sql_debug = true;
/*
(1) Füge alle Einträge die diesem Filter entsprechen der Ergebnisliste hinzu
Filtertyp: nach Entfernung
Koordinaten: N 48° 30.000' E 9°30.000'
Entfernung: 75 km
*/
sql('CREATE TEMPORARY TABLE result_caches (`distance` double NOT NULL, `cache_id` int(11) NOT NULL, `search_time` double default NULL, `status` int(11) default NULL, PRIMARY KEY (cache_id)) ENGINE=MEMORY SELECT (acos(cos(0.72431) * cos((90-`caches`.`latitude`) * 3.14159 / 180) + sin(0.72431) * sin((90-`caches`.`latitude`) * 3.14159 / 180) * cos((9.50000-`caches`.`longitude`) * 3.14159 / 180)) * 6370) `distance`, `caches`.`cache_id` `cache_id`, `caches`.`search_time` `search_time`, `caches`.`status` `status` FROM `caches` WHERE `longitude` > 8.48320014339 AND `longitude` < 10.5167998566 AND `latitude` > 47.8250539957 AND `latitude` < 49.1749460043 HAVING `distance` < 75');
/*
(2) Entferne alle Einträge die diesem Filter entsprechen von der Ergebnisliste
Filtertyp: nach Finder
User: Team A
*/
sql('CREATE TEMPORARY TABLE remove_caches (`cache_id` int(11) NOT NULL, PRIMARY KEY (cache_id)) ENGINE=MEMORY SELECT DISTINCT result_caches.cache_id cache_id FROM result_caches, cache_logs WHERE result_caches.cache_id=cache_logs.cache_id AND cache_logs.user_id IN (101254, 101301)');
sql('DELETE FROM result_caches WHERE cache_id IN (SELECT cache_id FROM remove_caches) OR (status!=1) OR (search_time>2)');
sql('DROP TABLE remove_caches');
sqldbg_end();
?>
@@ -0,0 +1,34 @@
<?php
// Unicode Reminder メモ
$rootpath = '../../../';
require($rootpath . 'lib/common.inc.php');
require_once($rootpath . 'lib/sqldebugger.inc.php');
sqldbg_begin();
$sql_debug = true;
/*
Sortiert: nach Entfernung
Caches ausblenden: Eigene, Gefundene, Inaktive, Ignorierte
Cacheart: normaler Cache
Land: Deutschland
Alle Caches um N 48.0 E 9.0
*/
/* SQL-Command Nr 4 */
sql("CREATE TEMPORARY TABLE result_caches ENGINE=MEMORY SELECT (acos(cos(0.73304) * cos((90-`caches`.`latitude`) * 3.14159 / 180) + sin(0.73304) * sin((90-`caches`.`latitude`) * 3.14159 / 180) * cos((9.00000-`caches`.`longitude`) * 3.14159 / 180)) * 6370) `distance`, `caches`.`cache_id` `cache_id` FROM `caches` WHERE `longitude` > 6.98618696855 AND `longitude` < 11.0138130314 AND `latitude` > 46.6501079914 AND `latitude` < 49.3498920086 HAVING `distance` < 150");
/* SQL-Command Nr 5 */
sql("ALTER TABLE result_caches ADD PRIMARY KEY ( `cache_id` )");
/* SQL-Command Nr 6 */
sql("SELECT COUNT(`result_caches`.`cache_id`) `count` FROM `result_caches`, `caches` WHERE `caches`.`cache_id`=`result_caches`.`cache_id` AND `caches`.`user_id`!='1' AND `caches`.`cache_id` NOT IN (SELECT `cache_logs`.`cache_id` FROM `cache_logs` WHERE `cache_logs`.`user_id`='1' AND `cache_logs`.`type`=1) AND `caches`.`status`=1 AND `caches`.`cache_id` NOT IN (SELECT `cachelists_caches`.`cache_id` FROM `cachelists_caches`, `cachelist_user`, `cachelists` WHERE `cachelists`.`id`=`cachelists_caches`.`list_id` AND `cachelists`.`id`=`cachelist_user`.`list_id` AND `cachelists`.`type`='1' AND `cachelist_user`.`user_id`='1') AND `caches`.`country`='DE' AND `caches`.`type`='2'");
/* SQL-Command Nr 7 */
sql("SELECT acos(cos(0.73304) * cos((90-`caches`.`latitude`) * 3.14159 / 180) + sin(0.73304) * sin((90-`caches`.`latitude`) * 3.14159 / 180) * cos((9.00000-`caches`.`longitude`) * 3.14159 / 180)) * 6370 `distance`, `caches`.`name` `name`, `caches`.`status` `status`, `caches`.`longitude` `longitude`, `caches`.`latitude` `latitude`, `caches`.`difficulty` `difficulty`, `caches`.`terrain` `terrain`, `caches`.`desc_languages` `desc_languages`, `caches`.`date_created` `date_created`, `caches`.`type` `type`, `caches`.`cache_id` `cache_id`, `user`.`username` `username`, `user`.`user_id` `user_id`, `cache_type`.`icon_large` `icon_large` FROM `caches`, `user`, `cache_type` WHERE `caches`.`user_id`=`user`.`user_id` AND `caches`.`cache_id` IN (SELECT `result_caches`.`cache_id` FROM `result_caches`, `caches` WHERE `caches`.`cache_id`=`result_caches`.`cache_id` AND `caches`.`user_id`!='1' AND `caches`.`cache_id` NOT IN (SELECT `cache_logs`.`cache_id` FROM `cache_logs` WHERE `cache_logs`.`user_id`='1' AND `cache_logs`.`type`=1) AND `caches`.`status`=1 AND `caches`.`cache_id` NOT IN (SELECT `cachelists_caches`.`cache_id` FROM `cachelists_caches`, `cachelist_user`, `cachelists` WHERE `cachelists`.`id`=`cachelists_caches`.`list_id` AND `cachelists`.`id`=`cachelist_user`.`list_id` AND `cachelists`.`type`='1' AND `cachelist_user`.`user_id`='1') AND `caches`.`country`='DE' AND `caches`.`type`='2') AND `cache_type`.`id`=`caches`.`type` ORDER BY distance ASC LIMIT 0, 20");
sqldbg_end();
?>
@@ -0,0 +1,61 @@
<?php
// Unicode Reminder メモ
$rootpath = '../../../';
require($rootpath . 'lib/common.inc.php');
require_once($rootpath . 'lib/sqldebugger.inc.php');
sqldbg_begin();
$sql_debug = true;
/*
Sortiert: nach Entfernung
Caches ausblenden: Eigene, Gefundene, Inaktive, Ignorierte
Cacheart: normaler Cache
Land: Deutschland
Alle Caches um N 48.0 E 9.0
*/
/* SQL-Command Nr 4 */
sql("CREATE TEMPORARY TABLE result_caches ENGINE=MEMORY SELECT (acos(cos(0.73304) * cos((90-`caches`.`latitude`) * 3.14159 / 180) + sin(0.73304) * sin((90-`caches`.`latitude`) * 3.14159 / 180) * cos((9.00000-`caches`.`longitude`) * 3.14159 / 180)) * 6370) `distance`, `caches`.`cache_id` `cache_id` FROM `caches` FORCE INDEX (`latitude`) WHERE `longitude` > 6.98618696855 AND `longitude` < 11.0138130314 AND `latitude` > 46.6501079914 AND `latitude` < 49.3498920086 AND user_id != '1' AND `caches`.`status`=1 AND `caches`.`country`='DE' AND `caches`.`type`='2' HAVING `distance` < 150");
//sql("CREATE TEMPORARY TABLE result_caches ENGINE=MEMORY SELECT (acos(cos(0.73304) * cos((90-`caches`.`latitude`) * 3.14159 / 180) + sin(0.73304) * sin((90-`caches`.`latitude`) * 3.14159 / 180) * cos((9.00000-`caches`.`longitude`) * 3.14159 / 180)) * 6370) `distance`, `caches`.`cache_id` `cache_id` FROM `caches` WHERE user_id != '1' AND `caches`.`status`=1 AND `caches`.`country`='DE' AND `caches`.`type`='2'");
/* SQL-Command Nr 5 */
sql("ALTER TABLE result_caches ADD PRIMARY KEY ( `cache_id` )");
/* SQL-Command Nr 6 */
/*
sql("SELECT COUNT(`result_caches`.`cache_id`) `count` FROM `result_caches`, `caches`
WHERE `caches`.`cache_id`=`result_caches`.`cache_id` AND
`caches`.`cache_id` NOT IN (
)");
*/
sql("CREATE TEMPORARY TABLE remove_caches (cache_id INT(11), PRIMARY KEY (cache_id)) ENGINE=MEMORY
SELECT result_caches.cache_id
FROM result_caches
INNER JOIN cache_logs ON result_caches.cache_id=cache_logs.cache_id
WHERE `cache_logs`.`user_id`='1' AND `cache_logs`.`type`=1
");
sql("INSERT IGNORE INTO remove_caches
SELECT `cachelists_caches`.`cache_id` FROM `cachelists_caches`, `cachelist_user`, `cachelists`
WHERE `cachelists`.`id`=`cachelists_caches`.`list_id` AND
`cachelists`.`id`=`cachelist_user`.`list_id` AND
`cachelists`.`type`='1' AND
`cachelist_user`.`user_id`='1'");
sql("DELETE FROM result_caches WHERE cache_id IN (SELECT cache_id FROM remove_caches)");
sql("SELECT COUNT(*) FROM result_caches");
/* SQL-Command Nr 7 */
sql("SELECT acos(cos(0.73304) * cos((90-`caches`.`latitude`) * 3.14159 / 180) + sin(0.73304) * sin((90-`caches`.`latitude`) * 3.14159 / 180) * cos((9.00000-`caches`.`longitude`) * 3.14159 / 180)) * 6370 `distance`, `caches`.`name` `name`, `caches`.`status` `status`, `caches`.`longitude` `longitude`, `caches`.`latitude` `latitude`, `caches`.`difficulty` `difficulty`, `caches`.`terrain` `terrain`, `caches`.`desc_languages` `desc_languages`, `caches`.`date_created` `date_created`, `caches`.`type` `type`, `caches`.`cache_id` `cache_id`, `user`.`username` `username`, `user`.`user_id` `user_id`, `cache_type`.`icon_large` `icon_large`
FROM `result_caches`, `caches`, `user`, `cache_type`
WHERE `result_caches`.`cache_id`=`caches`.`cache_id` AND
`caches`.`user_id`=`user`.`user_id` AND
`cache_type`.`id`=`caches`.`type` ORDER BY distance ASC LIMIT 0, 20");
sqldbg_end();
?>
@@ -0,0 +1,62 @@
<?php
// Unicode Reminder メモ
$rootpath = '../../../';
require($rootpath . 'lib/common.inc.php');
require_once($rootpath . 'lib/sqldebugger.inc.php');
sqldbg_begin();
$sql_debug = true;
/*
Sortiert: nach Entfernung
Caches ausblenden: Eigene, Gefundene, Inaktive, Ignorierte
Cacheart: normaler Cache
Land: Deutschland
Alle Caches um N 48.0 E 9.0
*/
/* SQL-Command Nr 4 */
sql("CREATE TEMPORARY TABLE result_caches ENGINE=MEMORY SELECT (acos(cos(0.73304) * cos((90-`caches`.`latitude`) * 3.14159 / 180) + sin(0.73304) * sin((90-`caches`.`latitude`) * 3.14159 / 180) * cos((9.00000-`caches`.`longitude`) * 3.14159 / 180)) * 6370) `distance`, `caches`.`cache_id` `cache_id` FROM `caches` FORCE INDEX (`latitude`) WHERE `longitude` > 6.98618696855 AND `longitude` < 11.0138130314 AND `latitude` > 46.6501079914 AND `latitude` < 49.3498920086 AND user_id != '1' AND `caches`.`status`=1 AND `caches`.`country`='DE' AND `caches`.`type`='2' HAVING `distance` < 150");
//sql("CREATE TEMPORARY TABLE result_caches ENGINE=MEMORY SELECT (acos(cos(0.73304) * cos((90-`caches`.`latitude`) * 3.14159 / 180) + sin(0.73304) * sin((90-`caches`.`latitude`) * 3.14159 / 180) * cos((9.00000-`caches`.`longitude`) * 3.14159 / 180)) * 6370) `distance`, `caches`.`cache_id` `cache_id` FROM `caches` WHERE user_id != '1' AND `caches`.`status`=1 AND `caches`.`country`='DE' AND `caches`.`type`='2'");
/* SQL-Command Nr 5 */
sql("ALTER TABLE result_caches ADD PRIMARY KEY ( `cache_id` )");
/* SQL-Command Nr 6 */
/*
sql("SELECT COUNT(`result_caches`.`cache_id`) `count` FROM `result_caches`, `caches`
WHERE `caches`.`cache_id`=`result_caches`.`cache_id` AND
`caches`.`cache_id` NOT IN (
)");
*/
sql("CREATE TEMPORARY TABLE remove_caches (cache_id INT(11), PRIMARY KEY (cache_id)) ENGINE=MEMORY
SELECT result_caches.cache_id
FROM result_caches
INNER JOIN cache_logs ON result_caches.cache_id=cache_logs.cache_id
WHERE `cache_logs`.`user_id`='1' AND `cache_logs`.`type`=1
");
sql("INSERT IGNORE INTO remove_caches
SELECT `cachelists_caches`.`cache_id` FROM `result_caches`, `cachelists_caches`, `cachelist_user`, `cachelists`
WHERE `result_caches`.`cache_id`=`cachelists_caches`.`cache_id` AND
`cachelists`.`id`=`cachelists_caches`.`list_id` AND
`cachelists`.`id`=`cachelist_user`.`list_id` AND
`cachelists`.`type`='1' AND
`cachelist_user`.`user_id`='1'");
sql("DELETE result_caches FROM result_caches, remove_caches WHERE result_caches.cache_id=remove_caches.cache_id");
sql("SELECT COUNT(*) FROM result_caches");
/* SQL-Command Nr 7 */
sql("SELECT acos(cos(0.73304) * cos((90-`caches`.`latitude`) * 3.14159 / 180) + sin(0.73304) * sin((90-`caches`.`latitude`) * 3.14159 / 180) * cos((9.00000-`caches`.`longitude`) * 3.14159 / 180)) * 6370 `distance`, `caches`.`name` `name`, `caches`.`status` `status`, `caches`.`longitude` `longitude`, `caches`.`latitude` `latitude`, `caches`.`difficulty` `difficulty`, `caches`.`terrain` `terrain`, `caches`.`desc_languages` `desc_languages`, `caches`.`date_created` `date_created`, `caches`.`type` `type`, `caches`.`cache_id` `cache_id`, `user`.`username` `username`, `user`.`user_id` `user_id`, `cache_type`.`icon_large` `icon_large`
FROM `result_caches`, `caches`, `user`, `cache_type`
WHERE `result_caches`.`cache_id`=`caches`.`cache_id` AND
`caches`.`user_id`=`user`.`user_id` AND
`cache_type`.`id`=`caches`.`type` ORDER BY distance ASC LIMIT 0, 20");
sqldbg_end();
?>
@@ -0,0 +1,50 @@
<?php
// Unicode Reminder メモ
$rootpath = '../../../';
require($rootpath . 'lib/common.inc.php');
require_once($rootpath . 'lib/sqldebugger.inc.php');
sqldbg_begin();
$sql_debug = true;
/*
(1) Füge alle Einträge die diesem Filter entsprechen der Ergebnisliste hinzu
Filtertyp: nach Entfernung
Koordinaten: N 48° 30.000' E 9°30.000'
Entfernung: 75 km
*/
//sql('CREATE TEMPORARY TABLE result_caches ENGINE=MEMORY SELECT (acos(cos(0.72431) * cos((90-`caches`.`latitude`) * 3.14159 / 180) + sin(0.72431) * sin((90-`caches`.`latitude`) * 3.14159 / 180) * cos((9.50000-`caches`.`longitude`) * 3.14159 / 180)) * 6370) `distance`, `caches`.`cache_id` `cache_id` FROM `caches` WHERE `longitude` > 8.48320014339 AND `longitude` < 10.5167998566 AND `latitude` > 47.8250539957 AND `latitude` < 49.1749460043 HAVING `distance` < 75');
sql('CREATE TEMPORARY TABLE result_caches ENGINE=MEMORY SELECT cache_id, search_time, status FROM caches');
sql('ALTER TABLE result_caches ADD PRIMARY KEY (cache_id)');
/*
(2) Entferne alle Einträge die diesem Filter entsprechen von der Ergebnisliste
Filtertyp: nach Finder
User: Team A
*/
sql('CREATE TEMPORARY TABLE remove_caches ENGINE=MEMORY SELECT DISTINCT result_caches.cache_id cache_id FROM result_caches, cache_logs WHERE result_caches.cache_id=cache_logs.cache_id AND cache_logs.user_id IN (101254, 101301)');
sql('ALTER TABLE remove_caches ADD PRIMARY KEY (cache_id)');
sql('DELETE FROM result_caches WHERE cache_id IN (SELECT cache_id FROM remove_caches)');
sql('DROP TABLE remove_caches');
/*
(4) Entferne alle Einträge die nicht diesem Filter entsprechen von der Ergebnisliste
Filtertyp: nach status
Status: Kann gesucht werden
*/
sql('DELETE FROM result_caches WHERE status!=1');
/*
(5) Entferne alle Einträge die nicht diesem Filter entsprechen von der Ergebnisliste
Filtertyp: nach zeitaufwand
Zeitaufwand: kleiner 2h
*/
sql('DELETE FROM result_caches WHERE search_time>2');
sqldbg_end();
?>
@@ -0,0 +1,51 @@
<?php
// Unicode Reminder メモ
$rootpath = '../../../';
require($rootpath . 'lib/common.inc.php');
require_once($rootpath . 'lib/sqldebugger.inc.php');
sqldbg_begin();
$sql_debug = true;
/*
(1) Füge alle Einträge die diesem Filter entsprechen der Ergebnisliste hinzu
Filtertyp: nach Entfernung
Koordinaten: N 48° 30.000' E 9°30.000'
Entfernung: 75 km
*/
//sql('CREATE TEMPORARY TABLE result_caches ENGINE=MEMORY SELECT (acos(cos(0.72431) * cos((90-`caches`.`latitude`) * 3.14159 / 180) + sin(0.72431) * sin((90-`caches`.`latitude`) * 3.14159 / 180) * cos((9.50000-`caches`.`longitude`) * 3.14159 / 180)) * 6370) `distance`, `caches`.`cache_id` `cache_id` FROM `caches` WHERE `longitude` > 8.48320014339 AND `longitude` < 10.5167998566 AND `latitude` > 47.8250539957 AND `latitude` < 49.1749460043 HAVING `distance` < 75');
sql('CREATE TEMPORARY TABLE result_caches ENGINE=MEMORY SELECT cache_id, search_time, status FROM caches');
sql('ALTER TABLE result_caches ADD PRIMARY KEY (cache_id)');
/*
(2) Entferne alle Einträge die diesem Filter entsprechen von der Ergebnisliste
Filtertyp: nach Finder
User: Team A
*/
sql('CREATE TEMPORARY TABLE remove_caches (`cache_id` int(11) NOT NULL) ENGINE=MEMORY');
sql('INSERT INTO remove_caches SELECT DISTINCT result_caches.cache_id cache_id FROM result_caches, cache_logs WHERE result_caches.cache_id=cache_logs.cache_id AND cache_logs.user_id IN (101254, 101301)');
sql('ALTER TABLE remove_caches ADD PRIMARY KEY (cache_id)');
sql('DELETE FROM result_caches WHERE cache_id IN (SELECT cache_id FROM remove_caches)');
sql('DROP TABLE remove_caches');
/*
(4) Entferne alle Einträge die nicht diesem Filter entsprechen von der Ergebnisliste
Filtertyp: nach status
Status: Kann gesucht werden
*/
sql('DELETE FROM result_caches WHERE status!=1');
/*
(5) Entferne alle Einträge die nicht diesem Filter entsprechen von der Ergebnisliste
Filtertyp: nach zeitaufwand
Zeitaufwand: kleiner 2h
*/
sql('DELETE FROM result_caches WHERE search_time>2');
sqldbg_end();
?>
Oops, something went wrong.

0 comments on commit cd377c2

Please sign in to comment.
You can’t perform that action at this time.