X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=app%2Fdata%2Fmodules%2Fxml%2Fsml_data_sources_cache_db.php;fp=app%2Fdata%2Fmodules%2Fxml%2Fsml_data_sources_cache_db.php;h=9700fddde1224f55eb362fe88a5270e279886a0a;hb=7d287d32ecd625ad3c21e9aa2aa122c86f9ec671;hp=0000000000000000000000000000000000000000;hpb=dfb63819f6edd72089b4d3a4c8cce3d7cba7c015;p=mw_sourceml diff --git a/app/data/modules/xml/sml_data_sources_cache_db.php b/app/data/modules/xml/sml_data_sources_cache_db.php new file mode 100644 index 0000000..9700fdd --- /dev/null +++ b/app/data/modules/xml/sml_data_sources_cache_db.php @@ -0,0 +1,68 @@ +sgbd(); + $source_cache = array(); + if($rst = $sgbd->open_data("sml_source_cache")) + { while($v_rst = $sgbd->fetch_data($rst)) + { if(isset($v_rst)) + { if(isset($v_rst["id"])) $source_cache[$v_rst["id"]] = $v_rst; + } + else + { $source_cache = false; + $break; + } + } + $sgbd->close_data($rst); + } + else $source_cache = false; + return $source_cache; + } + + function source_cache_infos_db($url) + { $sgbd = $this->sgbd(); + $cache_infos = array(); + if($rst = $sgbd->open_data("sml_source_cache")) + { while($v_rst = $sgbd->fetch_data($rst)) + { if(isset($v_rst)) + { if(isset($v_rst["id"]) && isset($v_rst["url"])) + { if($v_rst["url"] == $url) + { $cache_infos = $v_rst; + $break; + } + } + } + else + { $cache_infos = false; + $break; + } + } + $sgbd->close_data($rst); + } + else $cache_infos = false; + return $cache_infos; + } + + function add_source_cache_db($url, $cache_index) + { $sgbd = $this->sgbd(); + return $sgbd->add_data + ( "sml_source_cache", + array + ( "url" => $url, + "id_source" => $cache_index, + "last_update" => date("Y-m-d H:i:s") + ) + ) ? true : false; + } + + function del_source_cache_db($id_cache_data) + { $sgbd = $this->sgbd(); + return $sgbd->del_data("sml_source_cache", $id_cache_data) ? true : false; + } + + } + +?> \ No newline at end of file