Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
en:comet:cometql [2017/01/19 09:06]
levhav [Table users_in_pipes]
en:comet:cometql [2017/08/15 04:37]
levhav [Table users_time]
Line 1: Line 1:
 +<​rst>​EN::​002-API::​002-CometQL::​004-CometQL API</​rst>​
 +
 ====== CometQL ====== ====== CometQL ======
  
Line 36: Line 38:
 </​code>​ </​code>​
  
-Else you can use [[comet:​cometql:​cli|online command prompt]]. You can find it on the bottom of the right corner on all of the pages.  ​+Else you can use [[en:comet:​cometql:​cli|online command prompt]]. You can find it on the bottom of the right corner on all of the pages.  ​
  
-<note tip>​[[comet:​cometql:​cli|Here you can test source code based on PHP with CometQL]] using for online command prompt implementation.</​note>​+<note tip>[[en:comet:​cometql:​cli|Here you can test source code based on PHP with CometQL]] using for online command prompt implementation.</​note>​ 
 +  
 +An example of connecting to a comet server from php. 
 +<code php> 
 +$dev_id = "​15";​ // Used as login 
 +$dev_key = "​lPXBFPqNg3f661JcegBY0N0dPXqUBdHXqj2cHf04PZgLHxT6z55e20ozojvMRvB8";​ // Used as a password
  
-<note important>​Also are cases when you can’t use MySQL protocol ​to connecting comet server. ​For these cases you can send commands to comet server ​by HTTP/HTTPSRead the article [[comet:​cometql:​HTTP|sending ​CometQL ​queries by HTTP]].</​note> ​+// The connection looks like we connected to the database. You can use the functions ​to work with mysql 
 +// But in fact you are connecting ​to the comet server. 
 +$link = mysqli_connect("​app.comet-server.ru", $dev_id, $dev_key, "​CometQL_v1"​);​ 
 +if(!$link) 
 +{   
 +    die("​Could not create connection with CometQL"); 
 +}
  
 +$result = mysqli_query (  $link, "show status"​ ); 
 +if(mysqli_errno($link) != 0)
 +{
 +    echo "Error code:<a href='​https://​comet-server.com/​wiki/​doku.php/​en:​comet:​cometql:​error' ​ target='​_blank'​ >"​.mysqli_errno($link)."</​a>";​
 +    echo "Error text:<a href='​https://​comet-server.com/​wiki/​doku.php/​en:​comet:​cometql:​error'​ target='​_blank'​ >"​.mysqli_error($link)."</​a>";​
 +    exit;
 +}
 +
 +while($row = mysqli_fetch_assoc($result))
 +{
 +    echo "<​pre>";​
 +    var_dump($row);​
 +    echo "</​pre><​br>";​
 +}  ​
 +
 +</​code>​
 ====== Table description ====== ​ ====== Table description ====== ​
  
Line 48: Line 77:
 Notes of current implementation of CometSQL: Notes of current implementation of CometSQL:
   * CometSQL doesn’t implement all methods of SQL. A part of functions planned to realize in future. But some notes were applied in order to optimize inner structure of Comet server.   * CometSQL doesn’t implement all methods of SQL. A part of functions planned to realize in future. But some notes were applied in order to optimize inner structure of Comet server.
-  * To [[comet:​cometql:​optimization_for_the_cluster|optimize internal logics]], such operations like delete and insert doesn’t return amount of used lines (it belongs to CometQL v.1.0).+  * To [[en:comet:​cometql:​optimization_for_the_cluster|optimize internal logics]], such operations like delete and insert doesn’t return amount of used lines (it belongs to CometQL v.1.0).
   * Supporting such operators like AND, OR and ORDER BY in queries will be realize soon.   * Supporting such operators like AND, OR and ORDER BY in queries will be realize soon.
  
-<note warning>​Some of hosting providers determine forbiddance (или ban) on external connections – you can face with this on some free or half-free hosting services. In order to check ability to use CometQL, you can take advantage of [[comet:​testhosting|hosting verification script]]. </​note>​+<note warning>​Some of hosting providers determine forbiddance (или ban) on external connections – you can face with this on some free or half-free hosting services. In order to check ability to use CometQL, you can take advantage of [[en:comet:​testhosting|hosting verification script]]. </​note>​
 ===== Table pipes_messages ===== ===== Table pipes_messages =====
  
Line 86: Line 115:
 Input channel name “pipe _name” and click “subscribe”. Input channel name “pipe _name” and click “subscribe”.
 <​html>​ <​html>​
-<iframe src="//​comet-server.ru/​doc/​example/​7/​subscriptionTest.php"​ width="​910px"></​iframe>​+<iframe src="//​comet-server.com/​doc/​example/​7/​subscriptionTest.php"​ width="​910px"></​iframe>​
 </​html>​ </​html>​
 Now perform with online command prompt insert-query with pipes_messages and check the result. Now perform with online command prompt insert-query with pipes_messages and check the result.
Line 113: Line 142:
 Input channel name “web_admins” and click “subscribe”. ​ Input channel name “web_admins” and click “subscribe”. ​
 <​html>​ <​html>​
-<iframe src="//​comet-server.ru/​doc/​example/​7/​subscriptionTest.php"​ width="​910px"></​iframe>​+<iframe src="//​comet-server.com/​doc/​example/​7/​subscriptionTest.php"​ width="​910px"></​iframe>​
 </​html>​ </​html>​
 Now perform query again and you will see that amount of subscribers are increase. Now perform query again and you will see that amount of subscribers are increase.
Line 194: Line 223:
  
 ===== Table users_time ===== ===== Table users_time =====
-The table users_time contains data about users were online. This table is available only for reading. Data timing stores in UNIX-time.+The table users_time contains data about when users were online. ​ This table is available only for reading. Data timing stores in UNIX-time.
 <code sql> <code sql>
 mysql> select * from users_time where id in( 2, 3, 145); mysql> select * from users_time where id in( 2, 3, 145);
Line 235: Line 264:
 ===== Other information ===== ===== Other information =====
  
-  * [[en:​comet:​cometql:​cli|Example of using CometQL based on PHP;]] 
   * [[en:​comet:​cometql-bash-example|Example of sending messages from bash.]]   * [[en:​comet:​cometql-bash-example|Example of sending messages from bash.]]
   * [[en:​comet:​cometql:​error|Error code in CometQL]]   * [[en:​comet:​cometql:​error|Error code in CometQL]]
   * [[en:​comet:​javascript_api:​pipe-types|Reserved channel names]]   * [[en:​comet:​javascript_api:​pipe-types|Reserved channel names]]
   * [[en:​comet:​javascript_api|JavaScript API]]   * [[en:​comet:​javascript_api|JavaScript API]]
-  * [[en:comet:testhosting|Why the script runs on the local machine and does not work on hosting?​]] +  * [[en:comet:dev_id|What it is and why do we need "A public developer token" and "​Secret developer key?"​]]
-  * [[en:​comet:​faq:​public_key|What it is and why do we need "A public developer token" and "​Secret developer key?"]] +
-  * [[en:​comet:​faq:​send-message-to-pipe|How to send a message to an arbitrary channel and how to then get on another page?]] +
-  * [[en:​comet:​faq:​realtime-users-list|How to implement a mechanism for tracking users entering the site. That is a list of visitors updated on the "​fly"?​]]+
  
 ====== Reserved channels names ====== ====== Reserved channels names ======