Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2509239
  • 博文数量: 308
  • 博客积分: 5547
  • 博客等级: 大校
  • 技术积分: 3782
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-24 09:47
个人简介

hello world.

文章分类

全部博文(308)

分类: LINUX

2011-10-10 12:46:50

    领导要求让我们往数据库中追加2000条记录,测试用,看插入后,数据库的大小是多少。我第一个想到了使用循环,我想到了使用shell编写一个脚本程序,循环输出2000条insert语句,然后用Linux中的管道,就可以实现。于是编写shell代码如下:

  1. #! /bin/bash

  2. x=1
  3. while [ $x -le 2000 ]
  4. do
  5. echo "INSERT INTO Contact_User_Info(user_id, true_name, ***, handset, telphone, org_id, e_mail, order_value) VALUES('peng', '######','男', '###########', '60303601', 'org_id_1', 'chengxiaopeng@xcysoft.com', 0);"
  6. echo -n
  7. x=$(( $x + 1 ))
  8. done
将此shell脚本保存为testData.sh文件。
在终端中进行执行操作
$ chmod a+x testData.sh
$ ./testData.sh | sqlite ltzx.db
慢慢的等待,即可将测试数据插入到ltzx.db数据库中。
阅读(5906) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~