Welcome, Guest
Username: Password: Remember me

TOPIC: Asynchronous behaviour of db while creating new token

Asynchronous behaviour of db while creating new token 1 year 2 months ago #99278

  • nicola86
  • nicola86's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 8
  • Karma: 0
Hi there,
I was wondering if the below method "updateToken" from the class /htdocs/application/models/Tokens_dynamic.php is an Asynchronous calling to the db. And what is the meaning of the return value?
function updateToken($tid,$newtoken)
{
 return Yii::app()->db->createCommand("UPDATE{$this->tableName()}SET token=:newtoken WHERE tid=:tid")
        ->bindParam(":newtoken", $newtoken, PDO::PARAM_STR)
        ->bindParam(":tid", $tid, PDO::PARAM_INT)
        ->execute();
    }
The administrator has disabled public write access.

Asynchronous behaviour of db while creating new token 1 year 2 months ago #99290

  • nicola86
  • nicola86's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 8
  • Karma: 0
The problem is that in my application I use the token just after creating it(with the remote control method add_partecipants). Doing that I've noticed that it is necessary some delay between the creation of the token and the compiling of survey(using the new token). So that I've discovered that the method that generate the token, makes an update on the db through that method "updateToken" and just after returns the generated token. So the question is: is the update on the db asyncronous? Because only this behaviour would justify the message that I got when I don't give the "necessary" delay between creation/using of the token(the message says that the token doesn't exist)
The administrator has disabled public write access.

Asynchronous behaviour of db while creating new token 1 year 1 month ago #99312

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6451
  • Thank you received: 844
  • Karma: 249
Hi,

I don't think you really need delay ?

You need to properly renew the $_SESSION with the new token. How do you start the survey after creation ?

Try adding newtest/Y in url
The administrator has disabled public write access.

Asynchronous behaviour of db while creating new token 1 year 1 month ago #99315

  • nicola86
  • nicola86's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 8
  • Karma: 0
Hi,
thanks for the answer. How do I renew the $_SESSION with the new token (through the remotecontrol of course)?
Try adding newtest/Y in url
You mean that I have to add to url of the survey "newtest/Y"
for example: SERVER_ADDRESS/index.php/survey/index/sid/ID_SURVEY/token/TOKEN/lang/LANGUAGE/newtest/Y
Is it right?

Thanks again,
Nicola
Last Edit: 1 year 1 month ago by nicola86.
The administrator has disabled public write access.

Asynchronous behaviour of db while creating new token 1 year 1 month ago #99405

  • nicola86
  • nicola86's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 8
  • Karma: 0
Sorry I forgot to answer to one of your questions.
How do you start the survey after creation ?
After adding the partecipant I dinamically create the link of the survey with the right parameters and then I access on that page.
Anyway it seems that adding at the end of the url of the survey the string that you gave me: "newtest/Y" it works. But what does it means that string?
The administrator has disabled public write access.

Asynchronous behaviour of db while creating new token 1 year 1 month ago #99452

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6451
  • Thank you received: 844
  • Karma: 249
nicola86 wrote:
Anyway it seems that adding at the end of the url of the survey the string that you gave me: "newtest/Y" it works. But what does it means that string?
It renew the survey SESSION.

A lot of survey answers and param are in SESSION, the if you come again to a survey but with different token: this one can not be renewed.

Nest is to always use newtest/Y

Newtest: Take a NEW survey on same browser
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.145 seconds
Donation Image