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 ...
随机推荐
- 数据结构和算法(What Why How)
数据结构和算法是什么? 从广义上讲,数据结构就是指一组数据的存储结构.算法就是操作数据的一组方法. 从狭义上讲,是指某些著名的数据结构和算法,比如队列.堆.栈.二分查找.动态规划等. 数据结构和算法有 ...
- BZOJ 3257: 树的难题
树形DP #include<cstdio> #include<algorithm> #define rep(i,x,y) for (int i=x; i<=y; i++) ...
- navicat for mysql 在win7下设置定时计划之导出数据处理
navicat for mysql 在win7下设置定时计划之导出数据处理 博客分类: mysql navitcatmysql定时任务导出 前两篇记录了,navicat for mysql计划的入门 ...
- Linux内存cache/buffer剖析
查询linux系统中空闲内存/内存使用状态查看/剩余内存查看 如何计算内存的使用量及空闲量 物理已用内存 = 实际已用内存 - 缓冲 - 缓存 = 24752 - 283 ...
- hnust 不爱学习的小w
问题 C: 不爱学习的小W 时间限制: 2 Sec 内存限制: 64 MB提交: 1431 解决: 102[提交][状态][讨论版] 题目描述 “叮铃铃”上课了,同学们都及时到了教室坐到了座位上, ...
- 【mysql 优化 4】嵌套连接优化
原文地址:Nested Join Optimization 与SQL标准相比,table_factor的语法被扩展.后者仅接受table_reference,而不是一对括号内的列表.如果我们将tabl ...
- 【Luogu】P2515软件安装(树形DP)
题目链接 这么水的题我一遍没A,而且前两次提交都只有十分.气死我了.本来我的博客拒收水题来着. Tarjan缩点之后跑树形DP即可. #include<cstdio> #include&l ...
- NOJ——1649Find Sum(二分查找)
[1649] Find Sum 时间限制: 1000 ms 内存限制: 65535 K 问题描述 This problem is really boring. You are given a numb ...
- 刷题总结——regular words(hdu1502 dp+高精度加法+压位)
题目: Problem Description Consider words of length 3n over alphabet {A, B, C} . Denote the number of o ...
- java面试题之数据基本类型各占几个字节
类型 位数 字节数 short 2*8 2 char 2*8 2 int 4*8 4 float 4*8 4 long 8*8 8 double 8*8 8