1. Steve Albin
  2. as Valentina DB Server
  3. Среда, Январь 07 2015, 04:21 AM
  4.  Подписаться через email
I'm a long time Valentina user for single client applications, but I've decided to play around with using the VServer to see where it might lead. Admittedly, I've not thoroughly read all the documentation but I've gotten some basic things working and now I'm getting an incorrect return on a simple SQL that I can't understand.

I'm using Valentina Studio 5.5.8 and the latest version of VServer on Mac.

I'm using the Valentina Studio to connect to a remote computer via my airport network. I can connect to the database and view all the tables and can also browse the records. The problem is when I do a simple SQL statement via the SQL editor.

This is the SQL statement:
SELECT * FROM artists WHERE lName LIKE 'Davis%'

When I do this via VS on a copy of the same database on my local computer, I get 35 records. When I execute this on the remote computer, I get 13 records.

Just for fun, I set up the VServer on my local computer and connect to another copy of this database. In this instance, I get the correct 35 records.

When I remove the "%" sign from the query, I get the correct 30 records returned from all 3 databases.

Why should I get different results? I know this is a bug in my usage, but I don't see any settings that would effect this. Is there differences in the SQL allowed over the network?
Комментарий
There are no comments made yet.
Ruslan Zasukhin Ответ принят
Hi Steve,

1) Local and remote computers have the same OS?

2) how this DB store indexes?
a) as separate volume .ind
b) inside of single volume

I am asking about indexes because may be they are built on another computer from scratch using other OS/locale settings?
Комментарий
There are no comments made yet.
Steve Albin Ответ принят
The local computer is running 10.9.5 while the remote computer is running 10.7.5 The database is 2 files with a separate .ind file.

When I originally copied the database to the remote and local servers, I copied the .vdb and the .ind files. After the SQL problem, I did a REINDEX via the VS command, but that did not help. Just now, to be sure, I stopped the server and deleted the .ind file. After restarting the server, I again did the reindex via VS and I can see the new index. But I still get the incorrect record count returned.

One thing odd that I notice is that my original database has a storage encoding of UTF-16, but the server copies both have a storage encoding of UTF-16BE. I just did a straight copy of the datebase, why should the encoding change?
Комментарий
There are no comments made yet.
Steve Albin Ответ принят
It seems that the problem is not with VServer, but something related to copying a database between two computers. I just did another experiment using a database that I provide to new users of my app via website download. I downloaded the database to the server computer and the local computer and installed them in the databases folder of both. I now get the same SQL results on both platforms.

Looking at the databases via VS, they both show the storage encoding of UTF-16 as they should.

By the way, doing a diagnose of the remote database that was returning incorrect records, it showed errors in the index on many of the object pointer fields. Reindexing does not help.

In the end, it seems that copying a database via the Finder from one computer to another corrupts the index. This doesn't make sense to me. When I get a problem like this, I know it must be something I'm doing wrong because copying a database has to be something commonly done. But, the obvious seems to be eluding me....
Комментарий
There are no comments made yet.
Ruslan Zasukhin Ответ принят
Fast guess - do you CLOSE db before copy it?

If you copy not closed db you can easy get corrupted copy, because changes can be cached in RAM yet.

if this is not a case, then we need think about other possibilities.
Комментарий
There are no comments made yet.
Ruslan Zasukhin Ответ принят
Next point - in 5.7 build - which is shipped 3 days ago,
there was FIX in the indexing in similar area.

So another advice -- please try install v5.7
Комментарий
There are no comments made yet.
Steve Albin Ответ принят
It appears that I am running VServer version 5.7. I only installed it yesterday. Do I need version 5.7 of Valentina Studio? If so, that's a deal breaker as my license is expired. As a hobbyist, I can't see renewing my license at this time just to investigate using the server.

I did have the database closed when I copied it.

I previously stated that a reindex did not fix the index problems reported by the diagnose. It appears I was wrong on that. The diagnose is not reporting problems now. But the database still shows at having an encoding of UTF-16BE. This encoding has caused me a problem in the past with indexing, but I don't understand how it would return just by copying the database over to the remote computer. I will try cloning to see if it fixes the problem.
Комментарий
There are no comments made yet.
Ruslan Zasukhin Ответ принят
5.7 should reindex fine. So if you have VServer 5.7 it must reindex okay.

================
About Encoding.

IMPORTANT:
* encoding is NOT stored in the database files.

Because when you work with VSERVER, each connected client can ask for encoding it wants.
For example, some client may asks UTF8, another UTF16, another Win-1251.
VServer on the fly will do conversation when send/get strings.
Valentina DB files are in UTF16.


So ... please make sure that in your code,
AFTER you made db.Open() or connection.Connect() you specify db.IOEncoding also.

btw, note that exists db.StorageEncoding, it is UTF16 always;
and db.IOEncoding.
Комментарий
There are no comments made yet.
Steve Albin Ответ принят
This is interesting about the encoding. I understand about setting this in my client software, but what about in Valentina Studio? I don't see that it can be done there. Am I missing something?

As yet, I don't have any client software. I am just using VS to figure out what is going on before I dive in to changing my app to use VServer.
Комментарий
There are no comments made yet.
Ruslan Zasukhin Ответ принят
Valentina Studio talks always in UTF16 encoding to VSERVER.

And wait for the next post from me please.
Комментарий
There are no comments made yet.
Ruslan Zasukhin Ответ принят
So let's find PROBLEM again.

But the database still shows at having an encoding of UTF-16BE. This encoding has caused me a problem in the past with indexing, but I don't understand how it would return just by copying the database over to the remote computer. I will try cloning to see if it fixes the problem.


Is this the current problem?

What encoding have DB before copy then?
What encoding works fine for you?
Комментарий
There are no comments made yet.
Steve Albin Ответ принят
Well, once again, looks like I'm a damn fool! :)

I redid all the steps again in copying the database and this time the encoding shows utf-16. Now the SQL works fine.

The database I copied yesterday still shows utf-16be and doesn't return correct data. I just don't understand how the encoding got changed as I never opened the database with anything but Valentina Studio after I copied it to the remote computer. But, if all is well now and I know what to look for to debug this problem, then all is good.

Thanks for your quick support.
Комментарий
There are no comments made yet.
  • Страница :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories