B4J Question What's wrong with my MySQL query?

LWGShane

Well-Known Member
Licensed User
Longtime User
Hi, I'm am doing some experiments with creating a sync server to work with my upcoming release of a new version of KeyValueStore.

I'm testing the following MySQL Query on SQLFiddle (to see if it actually works before using it in B4X):

B4X:
CREATE TABLE IF NOT EXISTS
  Main (`TableName` TEXT, `KeyName` TEXT, `ValueObj` BLOB, PRIMARY KEY(`TableName`, `KeyName`))
REPLACE INTO
  Main (TableName, KeyName, ValueObj)
  VALUES("", "", "")

However, it keeps throwing an error. (See attached screenshot.)

upload_2017-6-10_6-7-11.png
 

OliverA

Expert
Licensed User
Longtime User
TEXT columns cannot be indexed (nor BLOB) in MySQL. Use VARCHAR(x), where x = 1 through 65,535.
 
Upvote 0

imbault

Well-Known Member
Licensed User
Longtime User
Try
B4X:
CREATE TABLE IF NOT EXISTS
Main (TableName varchar(200), KeyName varchar(200), ValueObj BLOB,PRIMARY KEY (TableName,KeyName) );
INSERT  into Main (TableName, KeyName, ValueObj)
  VALUES('', '', '');
 
Upvote 0

LWGShane

Well-Known Member
Licensed User
Longtime User
@imbault - Thanks! I modified INSERT INTO to REPLACE INTO and it works with SQLFiddle.

MySQL is a much better choice for cloud DB storage.
 
Last edited:
Upvote 0
Top