1. Giuseppe Luigi Punzi
  2. as Valentina DB Server
  3. Wednesday, October 26 2016, 11:52 AM
  4.  Subscribe via email
I'm trying to work with a project designed for MySQL, to work against Valentina Server, and I'm struggled in 2 errors, both SQL.

Somebody can help me to know why this SQL

CREATE TABLE IF NOT EXISTS membership_userrecords (recID bigint unsigned NOT NULL auto_increment, tableName varchar(100), pkValue varchar(255), memberID varchar(20), dateAdded bigint unsigned, dateUpdated bigint unsigned, groupID int, PRIMARY KEY (recID))


returns me:


Kernel error: 0x80501. Field name "recID" is not unique.
Comment
There are no comments made yet.
Sorry to post again, seems like I can't edit.
Against MySQL obviously works like a charm. All SQL sentences on new table creations, had an end of sentence .. "CHARSET utf8" I had to remove, seems is not compatible with Valentina.
Comment
There are no comments made yet.
  1. more than a month ago
  2. as Valentina DB Server
  3. # 1
Sergey Pashkov Accepted Answer
Hi Giuseppe,

RecID is a name of the internal field which always exists in the Valentina table.
Actually it is unique and identifies each record in the table, so can be used in place of the primary key without need to declare it explicitly. You can read more on this wiki page.

Of course, MySQL-way works too, but it is necessary to use different name, not recID (or OID)
Comment
There are no comments made yet.
  1. more than a month ago
  2. as Valentina DB Server
  3. # 2
Sergey Pashkov Accepted Answer
Also, AUTO_INCREMENT works differently in Valentina.
It creates a method with a RecID value, so values can't be changed.

Behaviour, more closer to MySQL, easier to get if declare Primary Key field as a Serial64.
Comment
There are no comments made yet.
  1. more than a month ago
  2. as Valentina DB Server
  3. # 3
I understand, lcase does not exists either, and I have to replace it in about 170 files.

I found too:

Function "isnull" - wrong param count. Function requires at least "2" arguments.


All of this in files I shouldn't change. :(
Comment
There are no comments made yet.
  1. more than a month ago
  2. as Valentina DB Server
  3. # 4
Sergey Pashkov Accepted Answer
There are a lot of non-standard things, which implemented differently in each DBMS.

LCASE can be replaced with LOWER.

ISNULL and IFNULL are synonyms in Valentina.

But we have standard IS NULL operator, which can be used in SELECT statements, as condition for IF statement in procedures and functions.
Comment
There are no comments made yet.
  1. more than a month ago
  2. as Valentina DB Server
  3. # 5
Ruslan Zasukhin Accepted Answer
All of this in files I shouldn't change.


Hi Giuseppe,

why you think so?

Sergey is right saying that each DBMS has a lots of own "unique" small or big features.

I am sure if you try LOAD that mySQL schema into e.g. PostgreSQL or SQLite or MS SQL
you will get the same problems.

It could work better if original schema was designed with strict follow to SQL Standard.

By the way, if you self made that DUMPs from mySQL,
you can check. I know that mySQL has option - produce dumps more close to SQL Standard
Comment
There are no comments made yet.
  1. more than a month ago
  2. as Valentina DB Server
  3. # 6
Ruslan Zasukhin Accepted Answer
Valentina DB have own great feature about RecID.
You can read docs for details.

Above mySQL table with RecID field AND primary key on that field,
in Valentina DB can be simpler


CREATE TABLE IF NOT EXISTS membership_userrecords (tableName varchar(100), pkValue varchar(255), memberID varchar(20), dateAdded bigint unsigned, dateUpdated bigint unsigned, groupID int)


as you can see I have remove RecID field and even PK,
because in Valentina RecID exists automatically, and it grows and reused automatically.

But I guess, this PrimaryKey is used in other tables of your DB for Foreign Keys...
So you cannot drop it so easy....
if to drop, then all FK fields must be yet replaced to ObjectPtr field.

All depends on your task. You want port only tables? yet records? yes some existing code around this?
Comment
There are no comments made yet.
  1. more than a month ago
  2. as Valentina DB Server
  3. # 7
Let me explain.

My project is generated by other application. I have control over my own SQL, but there are autogenerated files with SQL inside (a lot of them). If I change this files, when I generate my project again, this files will be overwriten.

About recid field, is a table of membership system that comes with this application. This don't worries too much. My main problem is other incompatibility with some functions used inside the code. As example, my project is generated using lcase(), and this gives an error because Valentina expects lower(). isnull() expects only one parametr, not two like Valentina, and so on.

I hope I explained my problem to use valentina. I asked developers to make some changes to the sofware, but first, I didn't get a reply yet, and second, I don't know when this will happen (if happens)
Comment
There are no comments made yet.
  1. more than a month ago
  2. as Valentina DB Server
  3. # 8
Ruslan Zasukhin Accepted Answer
Well, if you use Generator which targets mySQL,
and yet you must be able re-generate it many times,

then it is hard to image you can use this with other db except mySQL.
Comment
There are no comments made yet.
  1. more than a month ago
  2. as Valentina DB Server
  3. # 9
  • Page :
  • 1


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