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 ...
随机推荐
- poj 2676 数独问题 dfs
题意:完成数独程序,数独要求每行每列且每个3*3矩阵都必须是1~9的数字组成. 思路:dfs 用row[i][n] 记录第i行n存在 用col[j][n] 记录第j列n存在 grid[k][n] 记 ...
- HDU 4605 Magic Ball Game 主席树
题意: 给一棵\(n(1 \leq n \leq 10^5)\)个节点的二叉树,除叶子节点外,每个点都有左儿子和右儿子. 每个点上都有一个权值. 游戏规则是这样的:在根节点放一个权值为\(X\)的小球 ...
- LA 7048 Coprime 莫比乌斯反演
题意: 给出\(n(n \leq 10^5)\)个数字\(a_i(a_i \leq 10^5)\),从中选出\(3\)个数,使得这\(3\)个数两两互质或者两两不互质 分析: 可以说这是<训练指 ...
- C++ 指针的小知识
看个小例子: char* fun1(){ char * p = (char*)malloc(100); p = "helloww"; return p;} void fun2(ch ...
- python+selenium面试题
selenium中如何判断元素是否存在? selenium中没有提供原生的方法判断元素是否存在,一般我们可以通过定位元素+异常捕获的方式判断. # 判断元素是否存在 try: dr.find_elem ...
- 01-python进阶-拾遗
列表复习append(x)追交到链尾extend(L)追加一个列表 等价于 +=insert(i,x)在位置i处插入xremove(x) 删除一个值为x的元素 如果没有抛出异常sort() 直接修改列 ...
- Matplotlib中文乱码解决办法
Matplotlib中文乱码 解决方法如下: 首先设置源码文件编码方式为UTF-8 #-*- coding: utf-8 -*- 接着设置字体属性字典 font = {'family': 'SimHe ...
- Leetcode 440.字典序第k小的数字
字典序第k小的数字 给定整数 n 和 k,找到 1 到 n 中字典序第 k 小的数字. 注意:1 ≤ k ≤ n ≤ 109. 示例 : 输入: n: 13 k: 2 输出: 10 解释: 字典序的排 ...
- [python工具][1]sublime安装与配置
http://www.cnblogs.com/wind128/p/4409422.html 1 官网下载版本 http://www.sublimetext.com/3 选择 Windows - al ...
- 解决webstorm安装babel卡死问题
2017.07.16 现在大家可以直接使用yarn的方式安装包,可以解决babel目录过长导致webstorm卡死的问题. yarn的安装不会执行组件命令就不会导致node_modules下面继续嵌套 ...