truncate()
来源:互联网 发布:淘宝所有订单不全 编辑:程序博客网 时间:2024/06/15 11:59
truncate指的是一种语言函数。
- 外文名
- truncate
- 相关函数
- open, ftruncate
- 表头文件
- #include <unistd.h>
- 使用方法
- truncate table table_name
目录
- 1C语言函数
- 2数据库操作的sql语句:
- ▪使用方法:
- ▪操作特性:
- 3smarty 截取字符串函数 truncate
- ▪smarty truncate 截取
- ▪例 截取:
- ▪输出结果:
C语言函数
编辑相关函数:open,ftruncate
表头文件:#include <unistd.h>
定义函数:int truncate(const char *path, off_t length);
函数说明:truncate()会将参数path指定的文件大小改为参数length指定的大小。 如果原来的文件大小比参数length大,则超过的部分会被删除
返回值:执行成功则返回0, 失败返回-1, 错误原因存于errno
错误代码:EACCESS 参数path所指定的文件无法存取
EROFS 欲写入的文件存在于只读文件系统内
EFAULT 参数path指针超出可存取空间
EINVAL 参数path包含不合法字符
ENAMETOOLONG 参数path太长
ENOTDIR 参数path路径并非一目录
EISDIR 参数path指向一目录
ETXTBUSY 参数path所指的文件为共享程序,而且正被执行中
ELOOP 参数path有过多符号连接问题
EIO I/O存取错误
数据库操作的sql语句:
编辑使用方法:
truncate table table_name;
操作特性:
truncate 只删除表中的所有数据,不删除表的结构;
truncate 使ddl操作立即生效,原数据不放到rollback segment中,不能回滚,操作不触发trigger;
truncate 语句缺省情况下将空间释放到 minextents个 extent,除非使用reuse storage;
truncate 会将高水线复位(回到最开始)。
smarty 截取字符串函数 truncate
编辑smarty truncate 截取
从字符串开始处截取某长度的字符.默认是80个。
你也可以指定第二个参数作为追加在截取字符串後面的文本字串.该追加字串被计算在截取长度中。
默认情况下,smarty会截取到一个词的末尾。
如果你想要精确的截取多少个字符,把第三个参数改为"true" 。
例 截取:
index.php:
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Two Sisters Reunite after Eighteen Years at Checkout Counter.');
$smarty->display('index.tpl');
index.tpl:
{$articleTitle}
{$articleTitle|truncate}
{$articleTitle|truncate:30}
{$articleTitle|truncate:30:""}
{$articleTitle|truncate:30:"---"}
{$articleTitle|truncate:30:"":true}
{$articleTitle|truncate:30:"...":true}
输出结果:
Two Sisters Reunite after Eighteen Years at Checkout Counter.
Two Sisters Reunite after Eighteen Years at Checkout Counter.
Two Sisters Reunite after...
Two Sisters Reunite after
Two Sisters Reunite after---
Two Sisters Reunite after Eigh
Two Sisters Reunite after E...
0 0
- truncate
- truncate
- TRUNCATE
- Truncate
- truncate()
- truncate MLOG$
- truncate delete
- TRUNCATE TABLE
- 关于TRUNCATE
- Truncate Table
- Truncate Table
- Truncate table
- Truncate小知識
- Truncate Table
- Truncate table
- truncate 介绍
- Truncate Table
- Truncate Table
- nrf51822 --- 串口通信
- 测试人员怎样避免背黑锅
- HTML5混编学习笔记:JavaScript简述(if/for/switch、function、BOM、DOM)
- 动态规划之 368Largest Divisible Subset
- android之ProgressBar使用总结
- truncate()
- MongoDB从不懂到装懂其二(C#操作MongoDB)
- hdu1172猜数字
- Is it Google Hacking? It's Google Dorking
- 生成随机数方法
- 操作系统面试知识点总结
- seq2seq模型
- Java SE基础知识点总结(四)
- Bitmap使用容易被忽略的一个小问题点