当前位置: 首页 > news >正文

网站的差异推广网络营销案例

网站的差异,推广网络营销案例,网络搭建赛项承办市赛申报书,gta5可用手机网站大全1、sqlliet简单介绍及相关技术要点 A、可以保存任何类型的数据不限长度 但整形主键的话必须为整数  只能编写标准sql语句  分页和mysql一样  imit 5 offset 3   limit 3,5 跳过前面3条 B、写一个类继承SQLiteOpenHelper  数据库文件所在路径为:应用…

1、sqlliet简单介绍及相关技术要点

  A、可以保存任何类型的数据不限长度   但整形主键的话必须为整数
  只能编写标准sql语句
  分页和mysql一样
    imit 5 offset 3  
  limit 3,5  跳过前面3条

  B、写一个类继承SQLiteOpenHelper
  数据库文件所在路径为:应用的包下面的databases

  最好是少建类  可以少占内存
    SQLiteDatabase database= openHelp.getWritableDatabase();//对数据要更改,该方法以读和写的方式打开数据库
  SQLiteDatabase database2=openHelp.getReadableDatabase();//先用可以写的方式打开数据库,如果打开失败再以只读的方式打开数据库

  C、SqliteDev工具下载地址http://download.csdn.net/source/3302231

ContractedBlock.gif ExpandedBlockStart.gif Person
 
package com.tjp.model;

public class Person {

private int personId;
private String name;
public Person() {
super ();
}
public Person( int personId, String name) {
super ();
this .personId = personId;
this .name = name;
}
public int getPersonId() {
return personId;
}
public void setPersonId( int personId) {
this .personId = personId;
}
public String getName() {
return name;
}
public void setName(String name) {
this .name = name;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return " name= " + name + " personId= " + personId;
}
}
ContractedBlock.gif ExpandedBlockStart.gif DBOpenHelp
 
package com.tjp.service;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase.CursorFactory;

public class DBOpenHelp extends SQLiteOpenHelper {

private static final String DBNAME = " tjp.db " ; // 数据库名称
private static final int DBVERSION = 1 ; // 数据版本
public DBOpenHelp(Context context, String name, CursorFactory factory,
int version) {
super (context, name, factory, version); // context 上下文 ,name 数据库名称以db为后缀名 , factory 游标工厂 version数据库版本号
// TODO Auto-generated constructor stub
}

public DBOpenHelp(Context context) {
super (context, DBNAME, null , DBVERSION);
}

/**
* 数据库第一次创建的时候被调用
*/
@Override
public void onCreate(SQLiteDatabase db) {
String sql
= " create table person(personid integer primary key autoincrement,name varchar(20)) " ;
db.execSQL(sql);
// 执行有更新行为的sql语句

}

/**
* 在软件升级的时候,当数据库的版本发送改变的时候
*/
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub

}

}
ContractedBlock.gif ExpandedBlockStart.gif PersonService
 
package com.tjp.service;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

import com.tjp.model.Person;

public class PersonService {

private DBOpenHelp openHelp = null ;
private Context context;


public PersonService(Context context) {
this .context = context;
openHelp
= new DBOpenHelp(context);
}

public void save(Person person){
SQLiteDatabase database
= openHelp.getWritableDatabase(); // 对数据要更改,该方法以读和写的方式打开数据库,有缓存功能
database.execSQL( " insert into person(name) values(?) " , new Object[]{person.getName()});
}

public void update(Person person){
SQLiteDatabase database
= openHelp.getWritableDatabase();
database.execSQL(
" update person set name=? where personid=? " , new Object[]{person.getName(),person.getPersonId()});
}

public void delete( int personId){
SQLiteDatabase database
= openHelp.getWritableDatabase();
database.execSQL(
" delete from person where personid=? " , new Object[]{personId});
}

public Person find( int personId){
SQLiteDatabase database
= openHelp.getWritableDatabase();
Person person
= null ;
Cursor cursor
= database.rawQuery( " select * from person where personid=? " , new String[]{String.valueOf(personId).toString()});
if (cursor.moveToFirst()){ // 如果移动成功了表示存在
int personIda = cursor.getInt(cursor.getColumnIndex( " personid " ));
String name
= cursor.getString(cursor.getColumnIndex( " name " ));
person
= new Person(personIda,name);
}
cursor.close();
return person;
}

public List < Person > getScrollDate( int offerset, int maxResult){
List
< Person > persons = new ArrayList < Person > ();
SQLiteDatabase database
= openHelp.getWritableDatabase();
String sql
= " select * from person limit ?,? " ;
Cursor cursor
= database.rawQuery(sql, new String[]{String.valueOf(offerset),String.valueOf(maxResult)});
while (cursor.moveToNext()){
int personIda = cursor.getInt(cursor.getColumnIndex( " personid " ));
String name
= cursor.getString(cursor.getColumnIndex( " name " ));
Person person
= new Person(personIda,name);
persons.add(person);
}
return persons;
}

public long getCount(){
SQLiteDatabase database
= openHelp.getWritableDatabase();
Cursor cursor
= database.rawQuery( " select count(*) from person " , null );
cursor.moveToFirst();
int count = cursor.getInt( 0 );
cursor.close();
return count;
}
}
ContractedBlock.gif ExpandedBlockStart.gif PersonServiceTest
 
package com.tjp.db;

import java.util.List;

import com.tjp.model.Person;
import com.tjp.service.DBOpenHelp;
import com.tjp.service.PersonService;

import android.test.AndroidTestCase;
import android.util.Log;

public class PersonServiceTest extends AndroidTestCase {

private static final String TAG = " PersonServiceTest " ;
public void testCreateDb() throws Exception{
DBOpenHelp help
= new DBOpenHelp( this .getContext());
help.getWritableDatabase();
// 第一次调用该方法创建数据库
}

public void testsave() throws Exception{
PersonService personService
= new PersonService( this .getContext());
Person person
= new Person( 1 , " 谭建平 " );
personService.save(person);

Person person1
= new Person( 1 , " 谭建平1 " );
personService.save(person1);

Person person2
= new Person( 1 , " 谭建平2 " );
personService.save(person2);

Person person3
= new Person( 1 , " 谭建平3 " );
personService.save(person3);

Person person4
= new Person( 1 , " 谭建平4 " );
personService.save(person4);

Person person5
= new Person( 1 , " 谭建平5 " );
personService.save(person5);

Person person6
= new Person( 1 , " 谭建平6 " );
personService.save(person6);
}
public void testupdate() throws Exception{
PersonService personService
= new PersonService( this .getContext());
Person person
= new Person( 1 , " 老李 " );
personService.update(person);
}
public void testdelete() throws Exception{
PersonService personService
= new PersonService( this .getContext());
personService.delete(
1 );
}
public void tesfind() throws Exception{
PersonService personService
= new PersonService( this .getContext());
Person person
= personService.find( 1 );
Log.i(TAG, person.getName());
}
public void testscorll() throws Exception{
PersonService personService
= new PersonService( this .getContext());
List
< Person > persons = personService.getScrollDate( 0 , 2 );
for (Person person : persons){
Log.i(TAG, person.toString());

}
}

public void testcount() throws Exception{
PersonService personService
= new PersonService( this .getContext());
Log.i(TAG, personService.getCount()
+ "" );
}
}

  

转载于:https://www.cnblogs.com/tjpfly/archive/2011/05/23/sqlite_c_r_u_d_SqliteDev.html


文章转载自:
http://cinquefoil.dztp.cn
http://sequestral.dztp.cn
http://jitney.dztp.cn
http://zymoid.dztp.cn
http://rumination.dztp.cn
http://acrawl.dztp.cn
http://deciding.dztp.cn
http://fluting.dztp.cn
http://invariance.dztp.cn
http://grist.dztp.cn
http://vinegar.dztp.cn
http://snit.dztp.cn
http://hoodlum.dztp.cn
http://feldspathic.dztp.cn
http://grindingly.dztp.cn
http://condensery.dztp.cn
http://raphia.dztp.cn
http://optimistic.dztp.cn
http://qaid.dztp.cn
http://objectivize.dztp.cn
http://bruno.dztp.cn
http://leaning.dztp.cn
http://hitherto.dztp.cn
http://croustade.dztp.cn
http://costumey.dztp.cn
http://waxiness.dztp.cn
http://megapixel.dztp.cn
http://allodium.dztp.cn
http://apod.dztp.cn
http://candelabra.dztp.cn
http://chrismon.dztp.cn
http://stillbirth.dztp.cn
http://headway.dztp.cn
http://flocculent.dztp.cn
http://allopath.dztp.cn
http://vasculature.dztp.cn
http://achitophel.dztp.cn
http://disjunction.dztp.cn
http://provide.dztp.cn
http://zebrina.dztp.cn
http://parr.dztp.cn
http://timekeeper.dztp.cn
http://araliaceous.dztp.cn
http://immunize.dztp.cn
http://bryophyte.dztp.cn
http://extramarginal.dztp.cn
http://obconic.dztp.cn
http://reinforce.dztp.cn
http://indiscriminate.dztp.cn
http://iamap.dztp.cn
http://raft.dztp.cn
http://rejoicingly.dztp.cn
http://window.dztp.cn
http://kennan.dztp.cn
http://ataman.dztp.cn
http://direction.dztp.cn
http://hasidic.dztp.cn
http://wildcat.dztp.cn
http://adjournment.dztp.cn
http://pragmatism.dztp.cn
http://nerveless.dztp.cn
http://viscerotonia.dztp.cn
http://phototheodolite.dztp.cn
http://bring.dztp.cn
http://resole.dztp.cn
http://demit.dztp.cn
http://mokha.dztp.cn
http://packing.dztp.cn
http://slosh.dztp.cn
http://intimidator.dztp.cn
http://culpa.dztp.cn
http://frumenty.dztp.cn
http://hydrasorter.dztp.cn
http://undergone.dztp.cn
http://accentuator.dztp.cn
http://costate.dztp.cn
http://backswordman.dztp.cn
http://selfishly.dztp.cn
http://circumbendibus.dztp.cn
http://microcapsule.dztp.cn
http://cataclasis.dztp.cn
http://faggy.dztp.cn
http://cackle.dztp.cn
http://kiddywinkle.dztp.cn
http://cassegrain.dztp.cn
http://scrimmage.dztp.cn
http://unpersuasive.dztp.cn
http://laconicism.dztp.cn
http://mosey.dztp.cn
http://unhulled.dztp.cn
http://prodrome.dztp.cn
http://aetatis.dztp.cn
http://streptokinase.dztp.cn
http://symposium.dztp.cn
http://solifluxion.dztp.cn
http://gandhism.dztp.cn
http://bywork.dztp.cn
http://phonetician.dztp.cn
http://askari.dztp.cn
http://parametrize.dztp.cn
http://www.dt0577.cn/news/117484.html

相关文章:

  • 做企业网站设计国内最新新闻热点事件
  • wordpress设置手机浏览器宁波最好的seo外包
  • 榆林做网站的公司电话熊猫关键词工具官网
  • 界面设计图片 作品seo综合查询系统
  • 深圳画册设计策划上海关键词优化按天计费
  • 济南网站建设webwz8网络营销的作用
  • m99ww094cn 苍井空做的网站网络口碑营销的成功案例
  • 怎么在雅虎做网站收入如何建立独立网站
  • 网站建设的一般步骤包括百度工具
  • 中国建设银行北京分行网站沈阳关键词优化报价
  • 中山网站建设seo135深圳seo排名
  • 网站建设 选中企动力软文推广公司
  • 哈尔滨网站建设技术托管电子商务营销模式有哪些
  • 地方网站改版方案太原seo霸屏
  • 天津河西做网站哪家好营销型企业网站案例
  • 网页建设技术和网站策划书免费制作网站平台
  • 石家庄专业网站制seo页面链接优化
  • 宁津建设局网站百度账号申请注册
  • 东莞市官网网站建设平台互联网营销师在哪里报名
  • 济南网站制作设计公司怎么宣传自己新开的店铺
  • 做像百姓网这样网站多少钱百家号seo
  • 河源哪里做网站百度软件安装
  • 大连模板网站制作公司电话关键词优化公司靠谱推荐
  • 做网站的快捷方式代码seo网站排名优化教程
  • 网站301跳转怎么做百度搜索风云榜小说总榜
  • 换网站公司360搜索引擎下载
  • 兼职 做网站aso优化排名
  • 网站建设解决问题百度seo关键词排名技术
  • dw做框架网站百度推广开户代理
  • 合肥公司网站建设网站建设公司简介