Starting from v.5.0, you may get count of affected links (pair of records affected by LINK/UNLINK… statement) via QueryResult::get_AsULong()
Category: Valentina SQL
New WIKI Article: “DISTINCTROW in Valentina SQL”
[Imp] LINK/UNLINK commands now have optional suffix to suppress errors
Thorsten have point us that for his task it is not comfortable when command
LINK RECORD (1) OF T1 TO RECORDS(3, 7, 9) OF T2
throws error and stops, if link 1-7 already exists.
We have agree and improve these commands adding suffix
LINK … [IF NOT EXISTS]
UNLINK … [IF EXISTS]
This suffix is similar to CREATE/DROP commands. If it is specified, then error is not fired and command continue work for other pairs of links.
[Imp] CREATE BINARY LINK now does not accept SET NULL, SET DEFAULT by grammar. NO CASCADE added
Thorsten have point us that WIKI page about this command looks strange, because uses
Referential_action
: NO ACTION (alias to RESTRICT)
| RESTRICT
| SET NULL
| SET DEFAULT
| CASCADE
Now SQL grammar have one more rule vext_referential_action_for_link without “SET NULL”, “SET DEFAULT” and added “NO CADCADE” for Binary Links.
[IMP] Recursive query now can use RDB-link defined on the fly
While Valentina have very cool syntax for recursive queries, one Valentina developer have point us that it cannot be used in his task, because he do not have predefined link with name. Taking this into account, for v5.0 we have extend syntax of recursive query
from USING link_name
to USING (link_name | search_condtiion)
Continue reading [IMP] Recursive query now can use RDB-link defined on the fly
[IMP] SET PROPERTY now accepts bound values
This is expected improvement similar to INSERT and LINK commands. Now you can do
“SET PROPERTY x, y, z OF TABLE T TO :1, :2, :3”
Choosing appropriate database’s segment size
Each Valentina’s volume consists of set of segments, even internal service-data placed in such segments.
Database storage is implemented similar to some file system. There are volumes (.vdb, .dat, .blb, .ind, .tmp) and there are some embedded files on that volumes (all the data like field-data, indexes and so on go to that files). Each volume operates with own segment map – so we can find (and allocate new) segments for particular embedded file easy and fast.
Continue reading Choosing appropriate database’s segment size
[Imp] CLONE DATABASE now have suffix [WITH vext_set_property]
To improve CLONE command with ability to change some properties of cloned database we have extend CLONE DATABASE command with optional suffix [WITH vext_set_property] exactly like in CREATE DATABASE command.
Reason why we did this is described in details in the article “Choosing appropriate database’s segment size“.
[NEW] ORDER BY in aggregative functions First()/Last()
SQL Standard allows to SELECT only fields mentioned in the GROUP BY and expressions based on aggregative functions. You cannot SELECT a normal field. But sometimes you may very want to do this. Question is what to do in this case.
In this new Valentina Wiki article, we have describe in detail this problem and gave THREE solutions. The third solution is new for v5.0 and it works x400/ x50 times faster of the first two correspondently in tests on the database of our customer.
The third solution, uses idea from ORACLE database actually: FIRST()/LAST() functions with own ORDER BY to be used inside of each group. It seems mySQL and PostgreSQL do not have any way to resolve this task in such effective way.
[NEW] Valentina 5.0 adds Sequences.
Postgre/Oracle users are used to use Sequences to generate values of Primary Key of tables. mySQL/Access users are used to use auto increment flag on a PK field for the same task. Generally speaking Sequences are more powerful and flexible, but more verbose.
We have add Sequences into Valentina 5.0 in 99% same way as they work in PostgreSQL, so now Valentina developer can choose between auto-increment and sequences if they develop true Relational model.
You can read details here:
Reminder: If developer uses modern ObjectPtr and Binary links of Valentina DB, then he can avoid PK-FK headache at all.
[NEW] SQL Command – ALTER LINK … RENAME
We have add initial implementation of SQL command ‘ALTER LINK ‘, which allows to rename a Valentina Link. Details can be found in the Valentina WIKI here.
New Docs About ENUM Type in v5.0
Today I added new reference pages to the wiki of e.g. SQL grammar about a new feature of Valentina DB for 5.0: the ENUM type.
This is the first step towards a CREATE TYPE command based on the SQL 2003 standard. Next we can add composite types, collection types and inheritance.
We think that Valentina can have a more effective and flexible ENUM implementation compared to PostgreSQL or mySQL. One example is that Valentina can use 1 byte to store an enum value, while mySQL – 2, PostgreSQL – 4.
We are finishing now integration of this feature into Valentina Studio for both Valentina DB and PostgreSQL plugins. Database types in Valentina Studio are supported through a plugin architecture.
These are major entry points in the Valentina Wiki to check:
Changes in SQL parser for 5.0. Be prepared please.
Hi All,
We have remove couple of wrong things in 4.x VSQL parser. Please prepare your code to remove this deprecated syntax.
Continue reading Changes in SQL parser for 5.0. Be prepared please.
[NEW] Normalization of Unicode Text
We have realize problem of unicode text normalization and have implement tools into 4.9.1 to work with normalization issue. Detailed description of this issue is given on the following wiki page.
[TIP] Protection from SQL Injection Attack.
This tip is expired by article two-steps-forward-to-more-secure-applications. The First part of the article discusses SQL Injection Attack and how to develop code protected from it.
After read of the article you will know that to easy way for protection – is usage of SQL binding. Wow? One more reason to ALWAYS use SQL binding! Other well known reason are
- reduces CPU time as for client so for server, because no string concatenations on the client side, and less job for parser on the server side.
- enables usage of Query Pool, because SQL command is the same byte to byte.