修剪字符字段 [英] Trim Char fields

查看:56
本文介绍了修剪字符字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前正在将Delphi与Borland数据库一起使用.我们正计划从borland迁移到Firebird库(borland lib具有内存泄漏).

We are currently using Delphi with Borland database. We are planning to move from borland to Firebird libraries, (borland lib has mem leaks).

我们现在遇到的问题是,Firebird库返回一个带有尾随空格的char,以某种方式处理了borland库.我们编写了大量代码,没有任何修饰.

The problem that we are having now is, Firebird library returns a char with trailing spaces, which was somehow handled borland library. We have huge code written without any trimming.

因此现在如果将'abc'存储在char(10)字段中,它将返回'abc'.并且我们的代码失败.我想知道是否可以在数据库或firebird库上进行一些配置以自动修剪char字段.

So now if 'abc' is stored in char(10) field, it returns 'abc       '. and our code fails. I was wondering if there is some configuration that I can do on the DB or firebird library to automatically trim char fields.

推荐答案

  1. 为什么不只将数据库中的字段类型从CHAR更改为VARCHAR?
  2. 您可以在SELECT语句中使用TRIM()函数.
  3. 您可以对IBX源代码进行一些更改,以便调整CHAR字符串.

这篇关于修剪字符字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆