我有这个 mysql 查询插入查询,它给出了下面提到的错误,我无法弄清楚为什么
INSERT INTO wp_widget_custom (name,centers,description)
VALUES ('glasgow', 'glasgow*edinburgh' ,'Loreum ipsim'),
VALUES ('edinburgh', 'edinburgh*glasgow' ,'Loreum ipsim'),
VALUES ('newcastle', 'newcastle*middles-brough' ,'Loreum ipsim'),
VALUES ('leeds', 'leeds' ,'Loreum ipsim'),
VALUES ('manchester', 'manchester' ,'Loreum ipsim'),
VALUES ('nottingham', 'nottinghamshire*lichfield' ,'Loreum ipsim'),
VALUES ('lichfield', 'lichfield*birmingham*nottinghamshire' ,'Loreum ipsim'),
VALUES ('birmingham', 'lichfield*birmingham*milton-keynes' ,'Loreum ipsim'),
VALUES ('milton-keynes', 'milton-keynes*hemel-hempstead*hertfordshire' ,'Loreum ipsim'),
VALUES ('cardiff', 'cardiff*bristol-international' ,'Loreum ipsim'),
VALUES ('bristol', 'bristol-international*bristol*cardiff' ,'Loreum ipsim'),
VALUES ('plymouth', 'plymouth' ,'Loreum ipsim'),
VALUES ('southampton', 'southampton*hemel-hempstead*reading*maidenhead*slough' ,'Loreum ipsim'),
VALUES ('reading', 'hemel-hempstead*hertfordshire*reading*maidenhead*slough*guildford' ,'Loreum ipsim'),
VALUES ('slough', 'surrey*hertfordshire*hemel-hempstead*reading' ,'Loreum ipsim'),
VALUES ('hemel-hempstead', 'slough*surrey*guildford*bromley*london*billericay*hertfordshire*hemel' ,'Loreum ipsim'),
VALUES ('london', 'hempstead*maidenhead' ,'Loreum ipsim'),
VALUES ('crawley', 'crawley*bromley*guildford*surrey*london' ,'Loreum ipsim'),
VALUES ('bromley', 'billericay*crawley*london*billiericay*bromley' ,'Loreum ipsim'),
VALUES ('upminster', 'crawley' ,'Loreum ipsim'),
VALUES ('billericay', 'billericay*london*bromley' ,'Loreum ipsim'),
VALUES ('livingston', 'edinburgh*glasgow' ,'Loreum ipsim'),
VALUES ('renfrewshire', 'edinburgh*glasgow' ,'Loreum ipsim'),
VALUES ('northumberland', 'newcastle' ,'Loreum ipsim'),
VALUES ('west-yorkshire', 'leeds' ,'Loreum ipsim'),
VALUES ('cheshire', 'manchester' ,'Loreum ipsim'),
VALUES ('nottinghamshire', 'nottinghamshire' ,'Loreum ipsim'),
VALUES ('staffordshire', 'lichfield*birmingham*nottinghamshire' ,'Loreum ipsim'),
VALUES ('warwickshire', 'milton-keynes*birmingham' ,'Loreum ipsim'),
VALUES ('northamptonshire', 'milton-keynes' ,'Loreum ipsim'),
VALUES ('south-gloucestershire', 'bristol-international*bristol*cardiff' ,'Loreum ipsim'),
VALUES ('north-somerset', 'bristol*bristol-international*cardiff' ,'Loreum ipsim'),
VALUES ('devon', 'plymouth' ,'Loreum ipsim'),
VALUES ('hampshire', 'southampton*guildford*surrey*reading*maidenhead*slough' ,'Loreum ipsim'),
VALUES ('berkshire', 'southampton*maidenhead*reading*slough*surrey' ,'Loreum ipsim'),
VALUES ('maidenhead', 'guildford*hemel-hempstead*hertfordshire' ,'Loreum ipsim'),
VALUES ('surrey', 'surrey*guildford*reading*slough' ,'Loreum ipsim'),
VALUES ('sussex', 'bromley*crawley' ,'Loreum ipsim'),
VALUES ('kent', 'crawley' ,'Loreum ipsim'),
VALUES ('essex', 'bromley*sittingbourne*london*london*billericay*bromley' ,'Loreum ipsim'),
VALUES ('hertfordshire', 'hemel-hempstead*hertfordshire*slough*milton-keynes*maidenhead*slough' ,'Loreum ipsim'),
VALUES ('buckinghamshire', 'hemel-hempstead*hertfordshire' ,'Loreum ipsim'),
VALUES ('oxfordshire', 'milton-keynes' ,'Loreum ipsim'),
VALUES ('leicestershire', 'lichfield*nottinghamshire' ,'Loreum ipsim'),
VALUES ('derbyshire', 'nottinghamshire*lichfield' ,'Loreum ipsim'),
VALUES ('portsmouth', 'southampton' ,'Loreum ipsim'),
VALUES ('gloucester', 'bristol*milton-keynes*birmingham*lichfield' ,'Loreum ipsim'),
VALUES ('coventry', 'nottinghamshire' ,'Loreum ipsim'),
VALUES ('stoke-on-trent', 'manchester*lichfield*nottinghamshire' ,'Loreum ipsim'),
VALUES ('bolton', 'manchester*leeds' ,'Loreum ipsim'),
VALUES ('huddersfield', 'leeds' ,'Loreum ipsim'),
VALUES ('liverpool', 'manchester' ,'Loreum ipsim'),
VALUES ('merseyside', 'manchester' ,'Loreum ipsim'),
VALUES ('leicester', 'birmingham*nottinghamshire' ,'Loreum ipsim'),
VALUES ('bradford', 'leeds' ,'Loreum ipsim'),
VALUES ('wolverhampton', 'birmingham*lichfield*nottinghamshire' ,'Loreum ipsim'),
VALUES ('dudley', 'birmingham*lichfield*nottinghamshire*hemel-hempstead*hertfordshire*slough' ,'Loreum ipsim'),
VALUES ('luton', 'maidenhead' ,'Loreum ipsim'),
VALUES ('preston', 'manchester' ,'Loreum ipsim'),
VALUES ('sunderland', 'newcastle*middlesbrough*birmingham*lichfield*nottinghamshire' ,'Loreum ipsim'),
VALUES ('walsall', 'manchester' ,'Loreum ipsim'),
VALUES ('swansea', 'cardiff' ,'Loreum ipsim'),
VALUES ('norfolk', 'thetford-forest' ,'Loreum ipsim'),
VALUES ('norwich', 'thetford-forest' ,'Loreum ipsim'),
VALUES ('hull', 'hull' ,'Loreum ipsim');
enter code here
最佳答案
INSERT INTO wp_widget_custom (name,centers,description) VALUES
('glasgow', 'glasgow*edinburgh' ,'Loreum ipsim'),
('edinburgh', 'edinburgh*glasgow' ,'Loreum ipsim'),
('newcastle', 'newcastle*middles-brough' ,'Loreum ipsim'),
('leeds', 'leeds' ,'Loreum ipsim'),
('manchester', 'manchester' ,'Loreum ipsim'),
('nottingham', 'nottinghamshire*lichfield' ,'Loreum ipsim'),
('lichfield', 'lichfield*birmingham*nottinghamshire' ,'Loreum ipsim'),
('birmingham', 'lichfield*birmingham*milton-keynes' ,'Loreum ipsim'),
('milton-keynes', 'milton-keynes*hemel-hempstead*hertfordshire' ,'Loreum ipsim'),
('cardiff', 'cardiff*bristol-international' ,'Loreum ipsim'),
('bristol', 'bristol-international*bristol*cardiff' ,'Loreum ipsim'),
('plymouth', 'plymouth' ,'Loreum ipsim'),
('southampton', 'southampton*hemel-hempstead*reading*maidenhead*slough' ,'Loreum ipsim'),
('reading', 'hemel-hempstead*hertfordshire*reading*maidenhead*slough*guildford' ,'Loreum ipsim'),
('slough', 'surrey*hertfordshire*hemel-hempstead*reading' ,'Loreum ipsim'),
('hemel-hempstead', 'slough*surrey*guildford*bromley*london*billericay*hertfordshire*hemel' ,'Loreum ipsim'),
('london', 'hempstead*maidenhead' ,'Loreum ipsim'),
('crawley', 'crawley*bromley*guildford*surrey*london' ,'Loreum ipsim'),
('bromley', 'billericay*crawley*london*billiericay*bromley' ,'Loreum ipsim'),
('upminster', 'crawley' ,'Loreum ipsim'),
('billericay', 'billericay*london*bromley' ,'Loreum ipsim'),
('livingston', 'edinburgh*glasgow' ,'Loreum ipsim'),
('renfrewshire', 'edinburgh*glasgow' ,'Loreum ipsim'),
('northumberland', 'newcastle' ,'Loreum ipsim'),
('west-yorkshire', 'leeds' ,'Loreum ipsim'),
('cheshire', 'manchester' ,'Loreum ipsim'),
('nottinghamshire', 'nottinghamshire' ,'Loreum ipsim'),
('staffordshire', 'lichfield*birmingham*nottinghamshire' ,'Loreum ipsim'),
('warwickshire', 'milton-keynes*birmingham' ,'Loreum ipsim'),
('northamptonshire', 'milton-keynes' ,'Loreum ipsim'),
('south-gloucestershire', 'bristol-international*bristol*cardiff' ,'Loreum ipsim'),
('north-somerset', 'bristol*bristol-international*cardiff' ,'Loreum ipsim'),
('devon', 'plymouth' ,'Loreum ipsim'),
('hampshire', 'southampton*guildford*surrey*reading*maidenhead*slough' ,'Loreum ipsim'),
('berkshire', 'southampton*maidenhead*reading*slough*surrey' ,'Loreum ipsim'),
('maidenhead', 'guildford*hemel-hempstead*hertfordshire' ,'Loreum ipsim'),
('surrey', 'surrey*guildford*reading*slough' ,'Loreum ipsim'),
('sussex', 'bromley*crawley' ,'Loreum ipsim'),
('kent', 'crawley' ,'Loreum ipsim'),
('essex', 'bromley*sittingbourne*london*london*billericay*bromley' ,'Loreum ipsim'),
('hertfordshire', 'hemel-hempstead*hertfordshire*slough*milton-keynes*maidenhead*slough' ,'Loreum ipsim'),
('buckinghamshire', 'hemel-hempstead*hertfordshire' ,'Loreum ipsim'),
('oxfordshire', 'milton-keynes' ,'Loreum ipsim'),
('leicestershire', 'lichfield*nottinghamshire' ,'Loreum ipsim'),
('derbyshire', 'nottinghamshire*lichfield' ,'Loreum ipsim'),
('portsmouth', 'southampton' ,'Loreum ipsim'),
('gloucester', 'bristol*milton-keynes*birmingham*lichfield' ,'Loreum ipsim'),
('coventry', 'nottinghamshire' ,'Loreum ipsim'),
('stoke-on-trent', 'manchester*lichfield*nottinghamshire' ,'Loreum ipsim'),
('bolton', 'manchester*leeds' ,'Loreum ipsim'),
('huddersfield', 'leeds' ,'Loreum ipsim'),
('liverpool', 'manchester' ,'Loreum ipsim'),
('merseyside', 'manchester' ,'Loreum ipsim'),
('leicester', 'birmingham*nottinghamshire' ,'Loreum ipsim'),
('bradford', 'leeds' ,'Loreum ipsim'),
('wolverhampton', 'birmingham*lichfield*nottinghamshire' ,'Loreum ipsim'),
('dudley', 'birmingham*lichfield*nottinghamshire*hemel-hempstead*hertfordshire*slough' ,'Loreum ipsim'),
('luton', 'maidenhead' ,'Loreum ipsim'),
('preston', 'manchester' ,'Loreum ipsim'),
('sunderland', 'newcastle*middlesbrough*birmingham*lichfield*nottinghamshire' ,'Loreum ipsim'),
('walsall', 'manchester' ,'Loreum ipsim'),
('swansea', 'cardiff' ,'Loreum ipsim'),
('norfolk', 'thetford-forest' ,'Loreum ipsim'),
('norwich', 'thetford-forest' ,'Loreum ipsim'),
('hull', 'hull' ,'Loreum ipsim');
关于Mysql插入查询待修复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10905002/
我正在用Ruby编写一个简单的程序来检查域列表是否被占用。基本上它循环遍历列表,并使用以下函数进行检查。require'rubygems'require'whois'defcheck_domain(domain)c=Whois::Client.newc.query("google.com").available?end程序不断出错(即使我在google.com中进行硬编码),并打印以下消息。鉴于该程序非常简单,我已经没有什么想法了-有什么建议吗?/Library/Ruby/Gems/1.8/gems/whois-2.0.2/lib/whois/server/adapters/base.
我知道我可以指定某些字段来使用pluck查询数据库。ids=Item.where('due_at但是我想知道,是否有一种方法可以指定我想避免从数据库查询的某些字段。某种反拔?posts=Post.where(published:true).do_not_lookup(:enormous_field) 最佳答案 Model#attribute_names应该返回列/属性数组。您可以排除其中一些并传递给pluck或select方法。像这样:posts=Post.where(published:true).select(Post.attr
文章目录一、概述简介原理模块二、配置Mysql使用版本环境要求1.操作系统2.mysql要求三、配置canal-server离线下载在线下载上传解压修改配置单机配置集群配置分库分表配置1.修改全局配置2.实例配置垂直分库水平分库3.修改group-instance.xml4.启动监听四、配置canal-adapter1修改启动配置2配置映射文件3启动ES数据同步查询所有订阅同步数据同步开关启动4.验证五、配置canal-admin一、概述简介canal是Alibaba旗下的一款开源项目,Java开发。基于数据库增量日志解析,提供增量数据订阅&消费。Git地址:https://github.co
我正在尝试查询我的Rails数据库(Postgres)中的购买表,我想查询时间范围。例如,我想知道在所有日期的下午2点到3点之间进行了多少次购买。此表中有一个created_at列,但我不知道如何在不搜索特定日期的情况下完成此操作。我试过:Purchases.where("created_atBETWEEN?and?",Time.now-1.hour,Time.now)但这最终只会搜索今天与那些时间的日期。 最佳答案 您需要使用PostgreSQL'sdate_part/extractfunction从created_at中提取小时
我正在尝试创建一个带有项目符号字符的Ruby1.9.3字符串。str="•"+"helloworld"但是,当我输入它时,我收到有关非ASCII字符的语法错误。我该怎么做? 最佳答案 你可以把Unicode字符放在那里。str="\u2022"+"helloworld" 关于ruby-如何在Ruby字符串中插入项目符号字符?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/1195
我看到其他人也遇到过类似的问题,但没有一个解决方案对我有用。0.3.14gem与其他gem文件一起存在。我已经完全按照此处指示完成了所有操作:https://github.com/brianmario/mysql2.我仍然得到以下信息。我不知道为什么安装程序指示它找不到include目录,因为我已经检查过它存在。thread.h文件存在,但不在ruby目录中。相反,它在这里:C:\RailsInstaller\DevKit\lib\perl5\5.8\msys\CORE\我正在运行Windows7并尝试在Aptana3中构建我的Rails项目。我的Ruby是1.9.3。$gemin
我在Rails上使用带有ruby的solr。一切正常,我只需要知道是否有任何现有代码来清理用户输入,比如以?开头的查询。或* 最佳答案 我不知道执行此操作的任何代码,但理论上可以通过查看parsingcodeinLucene来完成并搜索thrownewParseException(只有16个匹配!)。在实践中,我认为您最好只捕获代码中的任何solr异常并显示“无效查询”消息或类似信息。编辑:这里有几个“sanitizer”:http://pivotallabs.com/users/zach/blog/articles/937-s
我正在为锦标赛开发一个Rails应用程序。我在这个查询中使用了三个模型:classPlayertruehas_and_belongs_to_many:tournamentsclassTournament:destroyclassPlayerMatch"Player",:foreign_key=>"player_one"belongs_to:player_two,:class_name=>"Player",:foreign_key=>"player_two"在tournaments_controller的显示操作中,我调用以下查询:Tournament.where(:id=>params
我想用sunspot重现以下原始solr查询q=exact_term_text:fooORterm_textv:foo*ORalternate_text:bar*但我无法通过标准的太阳黑子界面理解这是否可能以及如何实现,因为看起来:fulltext方法似乎不接受多个文本/搜索字段参数我不知道将什么参数作为第一个参数传递给fulltext,就好像我通过了"foo"或"bar"结果不匹配如果我传递一个空参数,我得到一个q=*:*范围过滤器(例如with(:term).starting_with('foo*')(顾名思义)作为过滤器查询应用,因此不参与评分。似乎可以手动编写字符串(或者可能使
我已经开始使用mysql2gem。我试图弄清楚一些基本的事情——其中之一是如何明确地执行事务(对于批处理操作,比如多个INSERT/UPDATE查询)。在旧的ruby-mysql中,这是我的方法:client=Mysql.real_connect(...)inserts=["INSERTINTO...","UPDATE..WHEREid=..",#etc]client.autocommit(false)inserts.eachdo|ins|beginclient.query(ins)rescue#handleerrorsorabortentirelyendendclient.commi