gpt4 book ai didi

mysql - SQL奇怪错误默认值

转载 作者:行者123 更新时间:2023-11-29 18:15:14 26 4
gpt4 key购买 nike

我有一个需要数据库的应用程序。我将“pskinsurl”的数据库行设置为 none,然后收到此错误:

[2017-11-02 18:06:58.514] [ERROR] [default] - Strange error
[2017-11-02 18:06:58.515] [ERROR] [default] - { Error: ER_NO_DEFAULT_FOR_FIELD: Field 'pskinsurl' doesn't have a default value
at Query.Sequence._packetToError (/var/www/Bot/node_modules/mysql/lib/protoc ol/sequences/Sequence.js:52:14)
at Query.ErrorPacket (/var/www/Bot/node_modules/mysql/lib/protocol/sequences /Query.js:77:18)
at Protocol._parsePacket (/var/www/Bot/node_modules/mysql/lib/protocol/Proto col.js:279:23)
at Parser.write (/var/www/Bot/node_modules/mysql/lib/protocol/Parser.js:76:1 2)
at Protocol.write (/var/www/Bot/node_modules/mysql/lib/protocol/Protocol.js: 39:16)
at Socket.<anonymous> (/var/www/Bot/node_modules/mysql/lib/Connection.js:103 :28)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
--------------------
at Protocol._enqueue (/var/www/Bot/node_modules/mysql/lib/protocol/Protocol. js:145:48)
at Connection.query (/var/www/Bot/node_modules/mysql/lib/Connection.js:208:2 5)
at Query._callback (/var/www/Bot/cf.js:3293:26)
at Query.Sequence.end (/var/www/Bot/node_modules/mysql/lib/protocol/sequence s/Sequence.js:88:24)
at Query._handleFinalResultPacket (/var/www/Bot/node_modules/mysql/lib/proto col/sequences/Query.js:139:8)
at Query.EofPacket (/var/www/Bot/node_modules/mysql/lib/protocol/sequences/Q uery.js:123:8)
at Protocol._parsePacket (/var/www/Bot/node_modules/mysql/lib/protocol/Proto col.js:279:23)
at Parser.write (/var/www/Bot/node_modules/mysql/lib/protocol/Parser.js:76:1 2)
at Protocol.write (/var/www/Bot/node_modules/mysql/lib/protocol/Protocol.js: 39:16)
at Socket.<anonymous> (/var/www/Bot/node_modules/mysql/lib/Connection.js:103 :28)
code: 'ER_NO_DEFAULT_FOR_FIELD',
errno: 1364,
sqlMessage: 'Field \'pskinsurl\' doesn\'t have a default value',
sqlState: 'HY000',
index: 0,
sql: 'INSERT INTO games SET expire = 1509662218, cassetids = \'12530890030\', csteamid = \'76561198114317007\', cname = \'KnottyCord\', cavatar = \'https://st eamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/1d/1d3f34eee812968fd5 548f36ee281265373ddf91_full.jpg\', cskinsurl = \'-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWw KGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXU5A1PIYQNqhpOSV-fRPasw8rsVFx5KAVo5PSkKV4xhfG fKTgVvIXlxNPSwaOmMLiGwzgJvJMniO-Zoo_z2wXg-EVvfSmtc78HsNoy\', cskinsnames = \'Gam ma 2 Case\', cskinsprices = \'0.03\', cskins = 1, ctp = 0.03, cpick = \'t\', tcr eated = 1509660418.494, hash = \'adb9037cfd700a24544d4d774189a223\', bot = \'bot 1\'' }

我收到此错误,其值为“定义为 0”但如果我将其设置为 NULL,我会在 Google Dev Console 中收到此错误:

Uncaught TypeError: Cannot read property 'split' of null
at onMessage (app.js?v1509661538:353)
at r.<anonymous> (app.js?v1509661538:1280)
at r.emit (socket.io-1.4.5.js:sourcemap:1)
at r.onevent (socket.io-1.4.5.js:sourcemap:2)
at r.onpacket (socket.io-1.4.5.js:sourcemap:2)
at r.<anonymous> (socket.io-1.4.5.js:sourcemap:2)
at r.emit (socket.io-1.4.5.js:sourcemap:1)
at r.ondecoded (socket.io-1.4.5.js:sourcemap:1)
at s.<anonymous> (socket.io-1.4.5.js:sourcemap:2)
at s.r.emit (socket.io-1.4.5.js:sourcemap:1)

最佳答案

插入时,您需要指定一个值,至少所有没有默认值的字段都不允许为空。

您需要为这些字段指定一个值,或者更改该字段以允许为空或具有默认值。

关于mysql - SQL奇怪错误默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47085582/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com