diff --git a/geoapi/api/Api.php b/geoapi/api/Api.php index f11b630..efcceed 100644 --- a/geoapi/api/Api.php +++ b/geoapi/api/Api.php @@ -1,12 +1,12 @@ sqlManager) { - echo "bla"; - $this->sqlManager = new SQLManager(); + $this->sqlManager = new \database\SQLManager(); } + $this->connect(); parent::__construct(); } diff --git a/geoapi/api/SpsApi.php b/geoapi/api/SpsApi.php index 4b5b191..70890f8 100644 --- a/geoapi/api/SpsApi.php +++ b/geoapi/api/SpsApi.php @@ -1,10 +1,11 @@ sqlManager = new \database\SpsSqlManager(); parent::__construct(); } @@ -26,6 +28,15 @@ class SpsApi extends Api { parent::__destruct(); } + /** + * Method stert a sps-query + * @param array $queryArgs + * @return array[num] [assoc] + */ + public function sendSpsQuery($queryArgs = array()) { + return $this->sqlManager->sendSpsQuery($queryArgs); + } + } ?> diff --git a/geoapi/database/HelloApiSQLManager.php b/geoapi/database/HelloApiSQLManager.php deleted file mode 100644 index cab9eaf..0000000 --- a/geoapi/database/HelloApiSQLManager.php +++ /dev/null @@ -1,26 +0,0 @@ -query("SELECT * FROM sps"); - } - -} - -?> diff --git a/geoapi/database/SpsSqlManager.php b/geoapi/database/SpsSqlManager.php index df18854..f7dc7d2 100644 --- a/geoapi/database/SpsSqlManager.php +++ b/geoapi/database/SpsSqlManager.php @@ -1,31 +1,44 @@ query("SELECT * FROM sps Where alias = \"$alias\""); } + } ?> diff --git a/geoapi/database/SqlManager.php b/geoapi/database/SqlManager.php index 67d98f7..a805592 100644 --- a/geoapi/database/SqlManager.php +++ b/geoapi/database/SqlManager.php @@ -1,9 +1,9 @@ serverAddress = $sqlServer; $this->dbName = $sqlDBName; @@ -83,7 +83,7 @@ abstract class SqlManager { public function closeConnection() { if ($this->link) { mysql_close($this->link); - $this->link =null; + $this->link = null; } } diff --git a/geoapi/service/helloservice/.htaccess b/geoapi/service/helloservice/.htaccess deleted file mode 100644 index 450c0d1..0000000 --- a/geoapi/service/helloservice/.htaccess +++ /dev/null @@ -1,2 +0,0 @@ -RewriteEngine on -RewriteRule ^ index.php [QSA,L] \ No newline at end of file diff --git a/geoapi/service/helloservice/HelloApi.php b/geoapi/service/helloservice/HelloApi.php deleted file mode 100644 index 4e8965a..0000000 --- a/geoapi/service/helloservice/HelloApi.php +++ /dev/null @@ -1,34 +0,0 @@ -sqlManager = new HelloApiSQLManager(); - parent::__construct(); - } - - public function __destruct() { - parent::__destruct(); - } - - public function sendHelloQuery() { - return $this->sqlManager->sendHelloQuery(); - } - -} - -?> diff --git a/geoapi/service/helloservice/index.php b/geoapi/service/helloservice/index.php deleted file mode 100644 index f7d29d3..0000000 --- a/geoapi/service/helloservice/index.php +++ /dev/null @@ -1,16 +0,0 @@ -get('/hello/:name', function ($name) use ($app) { - $app->connect(); - print_r($app->sendHelloQuery()); - // print - echo "Hello, $name"; -}); - -$app->run(); -?> diff --git a/geoapi/service/sps/index.php b/geoapi/service/sps/index.php index 5dbe497..6f18ae0 100644 --- a/geoapi/service/sps/index.php +++ b/geoapi/service/sps/index.php @@ -3,7 +3,7 @@ include_once "../../global.inc.php"; require_once PATH_API . "/SpsApi.php"; -$app = new SpsApi(); +$app = new \api\SpsApi(); $app->get('/alias/:alias', function ($alias) use ($app) { $args =array();