1. Beatrix Willius
  2. Valentina Server
  3. Thursday, February 27 2020, 07:34 AM
  4.  Subscribe via email
Ruslan recently mention that we should always use SQL when talking to server.

Is this true for everything?
Why should we do this?
What happens if you don't?

In my app I use a mixed approach. SQL is used mostly for selects and a few updates. But for adding records I use .AddRecord. Is that bad like in too slow?
There are no comments made yet.
Ruslan Zasukhin Accepted Answer
Hi Trixi,

you not must, but you should prefer it.

The bigger the distance between client and server, i.e. the longer time to get an answer from the remote db server, the more win you get if you send fewer commands.

This is true not only for Valentina Server but for everything in the client-server model.

Working with API, you will send many small commands. Working with SQL you can make single SQL questions, and get a single answer.

In a fast LOCAL ETHERNET network, it can be okay for API calls. This is why NoSQL was born - it works on server-side between a server-side-app (PHP, Java, ...) and a server-side-db


Let you have SELECT with WHERE f1 = 5 and f2 > 100 and f3 < 1000.
In API way you need for 3 Field.Find(), get 3 BitSets, Join them on client computer,
and later ask N times to load N found records.

In SQL way you send small text command, get back cursor with N records.
There are no comments made yet.
  1. more than a month ago
  2. Valentina Server
  3. # 1
Beatrix Willius Accepted Answer
Thanks for the information. This is what I'm working on today:

dim MailboxSQL as String = "select RecID, * from Mailbox where lower(MailboxPath) = lower(?)"
dim MailboxPrepared as VPreparedStatement = theArchive.Prepare(MailboxSQL)
MailboxPrepared.BindText(0, currentMailbox)
MailboxCursor = MailboxPrepared.SqlSelect(EVCursorLocation.kServerSide, EVLockType.kNoLocks, EVCursorDirection.kRandom)
if MailboxCursor = nil then Continue

'mailbox doesn't exist so create new
if MailboxCursor.RecordCount = 0 then
MailboxCursor.Field("MailboxPath";).SetString currentMailbox
call MailboxCursor.AddRecord
end if

The code checks if a record exists and then adds a new one if the record doesn't exist. As far as I can see I have 2 operations irregardless if I use SQL only or not, correct? Can I improve the code for VServer?
There are no comments made yet.
  1. more than a month ago
  2. Valentina Server
  3. # 2
  • Page :
  • 1

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


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