Quickblox - How to join objects into one query - quickblox

I got a question about this answer.
"At the moment QuickBlox doesn't provide 'JOIN' like operator in CustomObjects module. You should do 2 separate queries.
Instead of implementing JOIN query we are going to provide ability to upload queries code to server, so server will return result off all your scripts.
At the moment you can do 2 separate queries: - request all messages - choose user_ids and request users by users ids"
Does QuickBlox provide 'JOIN' like operator in CustomObjects for now?
Is there ability to upload queries code to server for now?
I don't want to do 2 separated queries, because i've too many ID's for second query and got an error "414 Request URI too long".
Thanks for any info

There is no way to do it now,
so you have to do 2 separate requests

Related

How to implement 'fields' paramenter for 'get' in REST API in server side

I would like to know, how to implement 'fields' paramenter for 'get' in REST API in server side.
for eg: http://example.com/user?fields=firstName,lastName
Here I have to get the firstName and lastName from users table.
Should I name the table fields like firstName, lastName and select all colums in the fields list or use aliases and find the column names from the aliases and select them?
I also have some secure fields like passwordHash, which should not be requested. So I need to put some restrictions also. So in server side I have to manually check for these fields (also the * or users.* etc). But these fields should be allowed for update.
Can anybody tell me the best approach for implementing this in terms of security, performance and clean code?
Guessing you have an usual web application, you could use a request without any query parameters for all requests and show/hide the columns on the client. You may return too much data on the first request but you don't need additional requests because all the data is there already.
Edit: Of course you should not include "passwordHash" or other sensible data in your query.

Asterisk Realtime and External SIP table

I'm having spleepless night thanks to Asterisk Realtime.
I have some trouble understanding the documentation ( like http://www.voip-info.org/wiki/view/Asterisk+RealTime+Sip ). Too many tables, many parameters, fragmented informations, no exhaustive tutorial.
I have simply to auto-register some users from an external MySQL's table ( id, user, chatkey ).
Which are the columns i HAVE to set to get it work? If there where simply a user and password column, I would have matched them with my.user and my.chatkey, but now I'm very confused.
Is there any side effects using VIEWS instead table + triggers?
You have set ALL columns. Minimum set is something like type,username, host,name,nat,allow,disallow.
You can do it using mysql view from your current tables.But if you do so, you have use cache of realtime friends or organize contact update(update&store of all fields below&including ipaddr). Otherwise your setup will not able determine where your sip devices.
I don't understand your issues. Wiki is very clear. For sip auth you need only one table sip_buddies
and need put in /etc/asterisk/extconfig.conf
sipusers => mysql,general,sip_buddies
sippeers => mysql,general,sip_buddies
note, general - name of already setuped(in /etc/asterisk/res_mysql.conf) database connection.
From your question i see you not understanding asterisk internals, so i recommending you read Orely's book "Asterisk the future of telephony" or hire expert. Otherwise resulting application will be not scalable and probably will work strange.

How can i succeed this complex CakePHP multimodel SQL request?

I need help to make a SQL request using CakePHP.
So I have a table publications:
Id
Network_id
User_id
Content
And I have 3 table linking:
Publication to users: publications_users
Publication to clans: publications_clans
Publication to alliances: publications_alliances
In input of this request I provide an array containing ID of clans, another containing ID of alliance, a User_id and a Network_id.
I need to make a CakePHP request that will give me all publications who belong to my array of clans && my array of alliances && my User_id && my Network_id.
The problem is that I don’t know how to create such a complex using CakePHP $this->Publication->find(« all »,array()) syntax.
Is it at least possible to do that this way?
Does anybody can help me succeed to do that please because I’m going to need to create a lot of such a complex request and I have no idea of how to do.
Thank you a lot in advance for your precious help.
Just use Containable behavior, read this http://book.cakephp.org/2.0/en/core-libraries/behaviors/containable.html
You could use proper Join Query and then parse using CakePHP function instead of using 2 or 3 different queries and then storing it in arrays.

Hibernate and use of criteria method setFirstResult

I'm trying to learn the hibernate criteria API but I'm puzzled by the criteria method setFirstResult.
I don't understand why I would want to use it except in the rarest of circumstances. It seems to me that when I retrieve information from a database, I'm only interested in establishing some criteria and then executing the query against the criteria. Why do I care from which index number in the database the results should be read. It is not something I normally do when I write sql queries yet I see this method all over the hibernate literature. Is this method something I always have to invoke when writing Hibernate queries or can I safely ignore it?
Thank you,
Elliott
This is typically used when displaying paginated results of a query. The first page goes from 0 to 19, the second page from 20 to 39, etc.
Well I use it in a bunch of places.. its unfortunate or outright lucky/dumb that you have run into a case where you needed to page your results in which case you generally right queries that pick from one index to another. consider the case where you want to display the audit log of an app that is stored for every write action on the page. in that case you will show the 20 results based on which page the user is and what field the audit log is sorted on.

Executing multiple queries in a single DB Call - SQL

I'm creating pdf reports with Data retrieved from Database (Oracle). For each report I'm making a DB Call. I want to optimize the call for multiple reports ( can have max of 500 reports). In current scenario, I am making 500 DB calls and this results in timeout of the Server.
I'm looking for solutions and answers.
1. Can I pass a list of data as input to a query ? (The query required 2 inputs.)
2. The entire set of data retrieval should happen in 1 DB Call not 500 separate calls.
3. The response should be accumulated result of 500 inputs.
Please suggest ways to solve or directions to the solve the issue ?
It is a Java based system. The DB call is from a Web App. DB : Oracle.
Thanks!!
If you want to get the data for an arbitrary number of "reports" in a single database call, then I would imagine you need to be calling a stored procedure that returns a very large nugget of XML or JSON text that you can then parse and display in your application. Oracle has built-in functions for constructing XML, and JSON is pretty easy to structure yourself (though I believe a 3rd party PL/SQL JSON package may be available).
there are a few ways of combining results from multiple queries.
UNION ALL -- lets you literally combine results between query1 UNION ALL query2
Make 1 more general query. -- this is the best answer if it can be done.
Join Sub queries and print the data horizontally if you can join them. select a., b. from (querya) a join (queryb) b on (id)
There are probably other ways as well. Such as a stored procedure etc.