Ir para conteúdo

Featured Replies

Postado

alguém sabe me dizer porque essa query esta dando erro? a celula (attrs) é uma varchar(255),  eu olhei e olhei e a syntax parece certa...

 

 "INSERT INTO `market_offers` (`player_id`, `sale`, `itemtype`, `amount`, `price`, `created`, `anonymous`, `attrs`) VALUES (" << playerId << ", " << action << ", " << itemId << ", " << amount << ", " << price << ", " << time(NULL) << ", " << anonymous << ", " << attrs << ");";

 

erro que retorna

 

[11/03/2018 02:26:19] OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: near ")": syntax error (INSERT INTO "market_offers" ("player_id", "sale", "itemtype", "amount", "price", "created", "anonymous", "attrs") VALUES (10, 1, 2463, 1, 1000, 1520735179, 0, extraarmor_66|maxmanapoints_405|skilldist_2|skilldist_2|);)

 

Postado

sqlite

 

DROP TABLE IF EXISTS market_offers;
CREATE TABLE market_offers ( 
    id        INTEGER          PRIMARY KEY
                               NOT NULL,
    player_id INTEGER          NOT NULL,
    sale      BOOLEAN          NOT NULL
                               DEFAULT '0',
    itemtype  UNSIGNED INTEGER NOT NULL,
    amount    UNSIGNED INTEGER NOT NULL,
    created   UNSIGNED INTEGER NOT NULL,
    anonymous BOOLEAN          NOT NULL
                               DEFAULT '0',
    price     UNSIGNED INTEGER NOT NULL
                               DEFAULT '0',
    world_id  TINYINT( 4 )     NOT NULL
                               DEFAULT ( 0 ),
    FOREIGN KEY ( player_id ) REFERENCES players ( id ) ON DELETE CASCADE 
);

mysql

DROP TABLE IF EXISTS `market_offers`;
CREATE TABLE `market_offers` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `world_id` tinyint(4) unsigned NOT NULL DEFAULT '0',
  `player_id` int(11) NOT NULL,
  `sale` tinyint(1) NOT NULL DEFAULT '0',
  `itemtype` int(10) unsigned NOT NULL,
  `amount` smallint(5) unsigned NOT NULL,
  `created` bigint(20) unsigned NOT NULL,
  `anonymous` tinyint(1) NOT NULL DEFAULT '0',
  `price` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `sale` (`sale`,`itemtype`),
  KEY `created` (`created`),
  KEY `market_offers_ibfk_1` (`player_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

 

Postado
  • Autor

@Dragon Ball Hiper então man a tabela existe já,  oque eu to tentando fazer é adicionar um novo atributo e ela chamado attr esse erro que tava no  post eu descobri o problema era que o caracter | é reservado no query, então troquei o caracter para º e o erro mudou para: 

 

[11/03/2018 03:51:41] OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: no such column: blockchance_0º (INSERT INTO "market_offers" ("player_id", "sale", "itemtype", "amount", "price", "created", "anonymous", "attrs") VALUES (10, 1, 2471, 1, 1000, 1520740301, 0, blockchance_0º);)

falando que não existe a coluna blockchance_0º o problema é que isso não é uma coluna e sim um valor para a coluna attr como da pra ver nessa query

 

"INSERT INTO `market_offers` (`player_id`, `sale`, `itemtype`, `amount`, `price`, `created`, `anonymous`, `attrs`) VALUES (" << playerId << ", " << action << ", " << itemId << ", " << amount << ", " << price << ", " << time(NULL) << ", " << anonymous << ", " << attrss << ");"

 

Editado por vyctor17 (veja o histórico de edições)

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo