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 ...
随机推荐
- LA 4253 Archery 二分
题意: x轴上方有若干条平行于x轴的线段 在x轴的区间\([0, \, W]\)内找一点发射一条射线,使其穿过所有线段. 问是否存在这样的点. 分析: 我们二分射线端点的坐标,将线段按纵坐标从小到大排 ...
- luogu1233 木棍加工
先排个序然后做最长上升子序列就行了. #include <algorithm> #include <iostream> #include <cstdio> usin ...
- Oracle 了解 DDL 操作与 REDO 的关系
目录 了解 DDL 操作与 REDO 的关系 DDL是否会产生REDO 通过 10046 trace 来分析create 和drop 如果drop失败,redo的变化 了解 DDL 操作与 REDO ...
- JAVA-两种后台页面跳转方式
1.请求转发 RequestDispatcher rd = request.getRequestDispatcher("url"); rd.forward(request, res ...
- javascript学习笔记-数据类型
一 数据类型 基本类型:undefined,null,boolean,number,string 保存在栈内存中 占用空间固定 变量直接从栈内存中存取的是该值 引用类型: ...
- Bind Enum To DropDownList ?
0. 准备测试数据 0.1 : 枚举 using System; using System.Collections.Generic; using System.Linq; using System.W ...
- Windows 上的 C++ 编译器
Windows 上的 C++ 编译器主要有: MinGW (Minimalist GNU for Windows) TDM-GCC (TDM 是 Twilight Dragon Media 的缩写) ...
- HUST——1110雪碧(简单DFS)
1110: 雪碧 时间限制: 1 Sec 内存限制: 128 MB 提交: 18 解决: 6 题目描述 杨神最近特别喜雪碧,他现在有两瓶,他大晚上的在街上走,他逢店加一倍(雪碧),逢摊吃大虾并喝一 ...
- 【bzoj3270】博物馆
同样是高斯消元,我写的版本就受到了歧视 我怎么又犯把 $j$ 打成 $i$ 这种 $sb$ 错误 题意 一张无向图,两个人分别从 $s_1$ 号点和 $s2$ 号点开始,每轮两人都会同时进行一次以下操 ...
- 【python自动化】python 常用时间获取方法
代码如下: import datetime import time DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S" DATE_FORMAT = &quo ...