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.)

 

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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…