From php I call:
exec("\"/path/to/java/java.exe\" -cp \"/path/to/basex/BaseX.jar;/path/to/basex/lib/custom/*;/path/to/basex/lib/*\" -Xmx1200m org.basex.BaseXClient -Uadmin -Padmin -q\"db:optimize('000999~201807',true(), map { 'language':'Russian', 'ftindex': true(), 'textindex': true(), 'attrindex': true(), 'tokenindex': true() })\"");
 
And then from php I execute:
$session = new Session("127.0.0.1", $this->dbport, $dblogin, $dbpass);
$input = "db:open('~users')/users/user";
$query = $session->query($input);
while ($query->more()) {
$data = "">
}
$query->close();
$session->close();
 
The second code starts only after the first finished.
 
If in the first code I use "org.basex.BaseX" instead of "org.basex.BaseXClient" - the second code starts immediately.
 
 
30.01.2020, 11:05, "Christian Grün" <christian.gr...@gmail.com>:
Please provide us with a self-contained test case.
Thanks in advance
 
 
 
Ветошкин Владимир <en-tra...@yandex.ru> schrieb am Do., 30. Jan. 2020, 09:01:
Hmm..
If I run [basex -q"db:optimize('A')"], I can read from db 'B'.
But if I run [basexclient -Uadmin -Padmin -q"db:optimize('A')"], I can't read from db 'B'.
 
29.01.2020, 21:48, "Ветошкин Владимир" <en-tra...@yandex.ru>:
Yes, the system works on php and I can call basex only via php client of basex or exec function.
Now all functions work via php client of basex.
If I additionally will use exec with basexclient - it won't corrupt databases?
 
29.01.2020, 21:27, "Christian Grün" <christian.gr...@gmail.com>:
In the worst case, yes. If you prefer to call basex via php and exec, invoke basexclient instead of basex:
 
 
Ветошкин Владимир <en-tra...@yandex.ru> schrieb am Mi., 29. Jan. 2020, 19:23:
Yes, I have seen that wiki pages...
What kind of conflicts?
Do you mean "or may even lead to corrupt databases." ?
Now I only get error when I read updating database like "database is updating..."
 
29.01.2020, 21:11, "Christian Grün" <christian.gr...@gmail.com>:
As I can see, it solves my problems. Am I right doing so?
 
The 'basex' standalone client does not connect to the server instance of BaseX, so you may encounter conflicts. Did your the Wiki pages referenced by.. "first name last name"?
 
 
Ветошкин Владимир <en-tra...@yandex.ru> schrieb am Mi., 29. Jan. 2020, 19:05:
Hi, Christian! I hope you're well.
No, there is only one client at this time.
 
Today evening I have tried to call exec function (php) to run another basex client (basex -q"db:optimize...").
And while it was working I can read from other databases like a charm! :)
 
As I can see, it solves my problems. Am I right doing so?
 
29.01.2020, 20:28, "Christian Grün" <christian.gr...@gmail.com>:

Hi Владимир,
 

 But I want non-blocking read/write operations (in different databases) with php. Is it possible?
 Or I only have to wait finishing update operation?


I haven’t done anything with PHP for more than 10 years now, but maybe
you need to use parallel or pthreads and do the work via multiple
threads. Are you already working with several BaseX client instances?

Christian



On Wed, Jan 29, 2020 at 10:14 AM Ветошкин Владимир <en-tra...@yandex.ru> wrote:


 Thank you.

 29.01.2020, 12:02, "first name last name" <randomcod...@gmail.com>:

 But if you are willing to give up that GUI, you could instead use the DBA interface [2] in your browser, and write all your code there if you start BaseX's http server [1].
 However, the DBA interface will not give you auto-complete (and other nice things you see in the GUI), but you can still write code, run code, and save it to disk there.

 [1] http://docs.basex.org/wiki/Command-Line_Options#HTTP_Server
 [2] http://docs.basex.org/wiki/DBA


 On Wed, Jan 29, 2020 at 10:57 AM first name last name <randomcod...@gmail.com> wrote:

 "For example, if you only read data, you can easily run several clients (standalone, GUI, database clients) at the same time. If you update your data, however, you shouldn’t use the GUI or a standalone instance at the same time."
 [1] http://docs.basex.org/wiki/Startup#Concurrent_Operations

 On Wed, Jan 29, 2020 at 9:25 AM Ветошкин Владимир <en-tra...@yandex.ru> wrote:

 Hi, everybody!

 I use basex+php.
 When I call db:optimize('A') from basex gui I can read from db 'B'.
 But if I call db:optimize('A') from php (php cli) I can't read 'B' while the first query is working.
 Why? And how can I solve it?
 I wracked my brain...

 --
 С уважением,
 Ветошкин Владимир Владимирович




 --
 С уважением,
 Ветошкин Владимир Владимирович
 
 
 
--
С уважением,
Ветошкин Владимир Владимирович
 
 
 
--
С уважением,
Ветошкин Владимир Владимирович
 
 
 
--
С уважением,
Ветошкин Владимир Владимирович
 
 
 
-- 
С уважением,
Ветошкин Владимир Владимирович
 
 
 
-- 
С уважением,
Ветошкин Владимир Владимирович
 

Reply via email to