#1 2015-04-28 06:59:05

milesyou
Member
Registered: 2015-03-04
Posts: 21

why don't create table?

TSQLres_shop = class(TSQLRecord)
  private
    fname: RawUTF8;
    factive: boolean;
    fcode: RawUTF8;
    fuser: RawUTF8;
    fpassword: RawUTF8;
    fphone: RawUTF8;
    ffax: RawUTF8;
    faddress: RawUTF8;
    fzip: RawUTF8;
    fplatform_id: integer;
    fcreate_uid: integer;
    fcreate_date: TCreateTime;
    fwrite_uid: integer;
    fwrite_date: TModTime;

  published
    property name: RawUTF8 index 32 read fname write fname;
    property active: boolean read factive write factive;
    property code: RawUTF8 index 16 read fcode write fcode;
    property user: RawUTF8 index 32 read fuser write fuser;
    property password: RawUTF8 index 32 read fpassword write fpassword;
    property phone: RawUTF8 index 32 read fphone write fphone;
    property fax: RawUTF8 index 32 read ffax write ffax;
    property address: RawUTF8 index 1024 read faddress write faddress;
    property zip: RawUTF8 index 20 read fzip write fzip;
    property platform_id: integer read fplatform_id write fplatform_id;
    property create_uid: integer read fcreate_uid write fcreate_uid;
    property create_date: TCreateTime read fcreate_date write fcreate_date;
    property write_uid: integer read fwrite_uid write fwrite_uid;
    property write_date: TModTime read fwrite_date write fwrite_date;

  end;

  this in ms SQL error,

Error SQLITE ERROR(1) using 3.8.9-'TSQLRestStorageExternal.Crete:unable to create external missing
field dbo.res.shop.name-SQL="ALTER TABLE dbo.res_shop ADD name nvarchar(32)"' extended_errcode=1.

Last edited by milesyou (2015-04-28 08:07:43)

Offline

#2 2015-04-28 09:04:43

DigDiver
Member
Registered: 2013-04-29
Posts: 137

Re: why don't create table?

property name: RawUTF8 index 32 read fname write fname;

name - reserved SQL word, generated SQL should be ALTER TABLE dbo.res_shop ADD [name] for MS SQL or ALTER TABLE dbo.res_shop ADD `name` for MySQL

Offline

#3 2015-04-28 09:19:05

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,662
Website

Re: why don't create table?

Map the "name" field with another identifier for the external table.
See http://synopse.info/files/html/Synopse% … l#TITL_120

You can even do it automatically.
See http://synopse.info/files/html/Synopse% … #TITLE_188

Offline

#4 2015-04-28 10:16:01

milesyou
Member
Registered: 2015-03-04
Posts: 21

Re: why don't create table?

  
TSQLcrm_customer = class(TSQLRecord)
  private
    fname: RawUTF8;
    factive: boolean;
    fphone1: RawUTF8;
    fphone2: RawUTF8;
    fmobile: RawUTF8;
    faddress: RawUTF8;
    fcreate_uid: integer;
    fcreate_date: TCreateTime;
    fwrite_uid: integer;
    fwrite_date: TModTime;

  published
    property name: RawUTF8 index 32 read fname write fname;
    property active: boolean index 32 read factive write factive;
    property phone1: RawUTF8 index 32 read fphone1 write fphone1;
    property phone2: RawUTF8 index 32 read fphone2 write fphone2;
    property mobile: RawUTF8 index 32 read fmobile write fmobile;
    property address: RawUTF8 index 1024 read faddress write faddress;
    property create_uid: integer read fcreate_uid write fcreate_uid;
    property create_date: TCreateTime read fcreate_date write fcreate_date;
    property write_uid: integer read fwrite_uid write fwrite_uid;
    property write_date: TModTime read fwrite_date write fwrite_date;

  end;

 

 

why this success ? this in 'name';

I change 'name' to 'name2' same error

I Test it,

I  change  TSQLres_shop to TSQLres_shop2   success ,pls check table name

why  res_shop as table name in mysql or ms sql  error ?

Last edited by milesyou (2015-04-28 10:39:27)

Offline

#5 2015-04-29 01:03:17

milesyou
Member
Registered: 2015-03-04
Posts: 21

Re: why don't create table?

I find the reason, in the class definition cannot include a 'user' name

Last edited by milesyou (2015-04-29 01:04:35)

Offline

Board footer

Powered by FluxBB