FireDAC 出现Variable length column[*] overflow. Value length - [80], column maximum length
FireDAC 出现Variable length column[*] overflow. Value length - [80], column maximum length
FireDAC的 TFDQuery组件访问SQLlite数据库,使用insert into语句插入一条数据长度为80的字符串,但是用 select * from 查询的时候却出现异常:[FireDac][DatS]-32. Variable length column[Namee] overflow. Value length - [80], column maximum length - [40].,出现错误的原因我很清楚,数据库中字段长度是40,无法读取80个字节的数据,但是为什么插入的不提示错误,查询的时候才出现异常,这要是万一插入超长的数据,以后就没办法读取了,而且也不知道是那条数据超长了,因为只要表中有一条超长的数据,select * from 语句就会返回这个异常,根本无法读取整个表中的内容。
经过查询资料,多次测试,找到了下面两种解决方法
方法1:
修改TFDConnection下面的两个属性
- FormatOptions.OwnMapRules 设置为 True
- FormatOptions.MapRules 添加两个子项,第一个子项的两个属性 SourceDataType = dtWideString,TargetDataType = dtWideMemo;第二个子项的两个属性dtAnsiString, TargetDataType = dtWideMemo
上述方法是将字符串类型字段映射为Memo类型的字段,Memo类型的字段是不判断长度的,就不会出现这种异常了,使用TFDQuery.FieldByname('name').AsString可以获取完整的80个字符。
这种方法存在一个问题,在使用DBGrid显示这些数据的时候,会显示为TMemo也就是DBGrid不能直接将Memo类型显示出来。
方法2:
修改TFDConnection下面的1个属性
- FormatOptions.StrsTrim2Len 设置为True
FireDAC 出现Variable length column[*] overflow. Value length - [80], column maximum length的更多相关文章
- Maximum length of a table name in MySQL
http://dev.mysql.com/doc/refman/5.7/en/identifiers.html The following table describes the maximum le ...
- oracle 导入报错:field in data file exceeds maximum length
今天用sqlldr导入数据时候报错: " Record 1: Rejected - Error on table ks_test, column khname.Field in data f ...
- sqlldr Field in data file exceeds maximum length "
使用sqlldr导数时出现如下错误: " Record 1: Rejected - Error on table PC_PLANNAME, column PLANNAME.Field in ...
- [LeetCode] Maximum Length of Repeated Subarray 最长的重复子数组
Given two integer arrays A and B, return the maximum length of an subarray that appears in both arra ...
- [Swift]LeetCode718. 最长重复子数组 | Maximum Length of Repeated Subarray
Given two integer arrays A and B, return the maximum length of an subarray that appears in both arra ...
- [LeetCode]Maximum Length of Repeated Subarray
Maximum Length of Repeated Subarray: Given two integer arrays A and B, return the maximum length of ...
- LeetCode Maximum Length of Pair Chain
原题链接在这里:https://leetcode.com/problems/maximum-length-of-pair-chain/description/ 题目: You are given n ...
- 718. Maximum Length of Repeated Subarray
Given two integer arrays A and B, return the maximum length of an subarray that appears in both arra ...
- LN : leetcode 646 Maximum Length of Pair Chain
lc 646 Maximum Length of Pair Chain 646 Maximum Length of Pair Chain You are given n pairs of number ...
随机推荐
- UVALive - 8292 (法里数列)
参考博客:zro https://blog.csdn.net/alusang/article/details/81840944 orz 给你一个分母 m 和一个浮点数 x,让你求出一个分母不超过 m ...
- 大数据学习——spark-steaming学习
官网http://spark.apache.org/docs/latest/streaming-programming-guide.html 1.1. 用Spark Streaming实现实时Wor ...
- ef添加数据时出错 System.Data.Entity.Infrastructure.DbUpdateConcurrencyException”类型的异常
找半天才找到 ef添加数据时出错原因:数据库表中没有主键 ,就算表中有自增列 Added方法也会报错: - this._db.SaveChanges() “this._db.SaveCh ...
- 正则表达式 去除所有非ASCII字符
需求: 去除字符串中包含的所有外国字符 只能使用正则如下,找到包含非ASCII的记录 db=# select * from test where info ~ '[^(\x00-\x7f)]'; id ...
- Maven之scope详解
scope的分类 compile(编译范围) 默认就是compile,什么都不配置也就是意味着compile.compile表示被依赖项目需要参与当前项目的编译,当然后续的测试, 运行周期也参与其中, ...
- [git 学习篇] 修改文件
http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/0013743858312764d ...
- ACM-ICPC北京赛区2017网络同步赛
E: Cats and Fish 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 There are many homeless cats in PKU campus. T ...
- JQuery常用的HTML页控制取值、赋值
1,关于tab页签 获取当前页签的属性: var tabsSelect=$("#easytabs").tabs("getSelected"); var titl ...
- CodeForces839D[莫比乌斯反演] Codeforces Round #428 (Div. 2)
/*CodeForces839D[莫比乌斯反演]*/ #include <bits/stdc++.h> typedef long long LL; const LL MOD = 10000 ...
- 【Luogu】P2053修车(费用流)
题目链接 早上状态不好,虚树搞崩只好来刷网络流了qwq. (然后我犹豫几秒之后看了题解) 使用拆点大法把工人拆成n*m个点,然后每个点代表每个时间段的工人, 然后从车到每个工人点连一条边,权值是耽误的 ...