SQLITEËÙ¶ÈÆÀ²â
SQLite ×÷Ϊһ¸öÇáÁ¿¼¶Ç¶ÈëʽÊý¾Ý¿â£¬»¹ÊǷdz£ºÃÓõġ£ÓêºÛ¼«Á¦ÍƼö~~~~~~
½ñÌìÓиöÅóÓѲâÊÔ SQLite£¬È»ºóµÃ³öµÄ½áÂÛÊÇ£ºSQLite ЧÂÊÌ«µÍ£¬ÅúÁ¿²åÈë1000Ìõ¼Ç¼£¬¾ÓÈ»ºÄʱ 2 ·ÖÖÓ£¡
ÏÂÃæÊÇËû·¢¸øÎҵIJâÊÔ´úÂë¡£ÎÒÔÎ~~~~~~
using System.Data;
using System.Data.Common;
using System.Data.SQLite;
// ´´½¨Êý¾Ý¿âÎļþ
File.Delete("test1.db3");
SQLiteConnection.CreateFile("test1.db3");
DbProviderFactory factory = SQLiteFactory.Instance;
using (DbConnection conn = factory.CreateConnection())
{
// Á¬½ÓÊý¾Ý¿â
conn.ConnectionString = "Data Source=test1.db3";
conn.Open();
// ´´½¨Êý¾Ý±í
string sql = "create table [test1] ([id] INTEGER PRIMARY KEY, [s] TEXT COLLATE NOCASE)";
DbCommand cmd = conn.CreateCommand();
cmd.Connection = conn;
cmd.CommandText = sql;
cmd.ExecuteNonQuery();
// Ìí¼Ó²ÎÊý
cmd.Parameters.Add(cmd.CreateParameter());
// ¿ªÊ¼¼Æʱ
Stopwatch watch = new Stopwatch();
watch.Start();
// Á¬Ðø²åÈë1000Ìõ¼Ç¼
for (int i = 0; i < 1000; i++)
{
cmd.CommandText = "insert into [test1] ([s]) values (?)";
cmd.Parameters[0].Value = i.ToString();
cmd.ExecuteNonQuery();
}
// Í£Ö¹¼Æʱ
watch.Stop();
Console.WriteLine(watch.Elapsed);
}
°¥~~~~ Ò»¸ö³£Ê¶ÐԵĴíÎó£¬ÎÒ¼Ó¼¸ÐдúÂë (ÐÂÔö´úÂë±ê¼Ç "// <-------------------")¡£
using System.Data;
using System.Data.Common;
using System.Data.SQLite;
// ´´½¨Êý¾Ý¿âÎļþ
File.Delete("test1.db3");
SQLiteConnection.CreateFile("test1.db3");
DbProviderFactory factory = SQLiteFactory.Instance;
using (DbConnection conn = factory.CreateConnection())
{
// Á¬½ÓÊý¾Ý¿â
conn.ConnectionString = "Data Source=test1.db3";
conn.Open();
Ïà¹ØÎĵµ£º
[±à¼±¾¶Î
]
SQLite¼ò½é
SQLite
µÚÒ»¸öAlpha°æ±¾µ®ÉúÓÚ2000Äê5ÔÂ. ÖÁ½ñÒѾÓÐ10¸öÄêÍ·ÁË. SQLiteÒ²ÓÀ´ÁËÒ»¸ö°æ±¾ SQLite 3ÒѾ·¢²¼.
¡¡¡¡SQLiteÊÇÒ»¿îÇáÐ͵ÄÊý¾Ý¿â£¬ÊÇ×ñÊØACIDµÄ¹ØÁªÊ½Êý¾Ý¿â¹ÜÀíϵͳ£¬ËüµÄÉè¼ÆÄ¿±êÊÇǶÈë
ʽµÄ£¬¶øÇÒÄ¿Ç°ÒѾÔںܶàǶÈëʽ²úÆ·ÖÐʹÓÃÁËËü£¬ËüÕ¼ÓÃ×ÊÔ´·Ç³£µÄµÍ£¬ÔÚǶÈëʽÉ豸ÖУ¬¿ ......
package com.jiao.sqlite;
import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widg ......
Ç°Ò»Õó×Ö×öÏîÄ¿(ǶÈëʽlinux)£¬ÓÉÓÚÒª±£´æ´óÁ¿µÄÊý¾Ý£¬¶øÇÒ×Ҫ±£´æ30ÌìµÄʱ¼ä¡£±¾À´´òËã±£´æµ½ÎļþÖУ¬Ã¿´ÎÆô¶¯Ó¦ÓóÌÐòµÄʱºòÖØнâÎöÒ»±é£¬¿ÉÊǵ±Êý¾ÝÁ¿ºÜ´óµÄʱºò£¬¾Í³öÏÖЧÂʵÄÎÊÌâÁË¡£ËùÒÔ×îºó»¹ÊÇ·ÅÆúÁËʹÓÃÎļþµÄ´òË㣬¾ö¶¨Ê¹ÓÃÊý¾Ý¿â´æÈ¡Êý¾Ý¡£
linuxϵÄÊý¾Ý¿âÒ²ºÜ¶à£¬ÓпªÔ´µÄ£¬Ò²ÓÐÊշѵġ£¶ÔÓÚÎÒÃÇÀ´Ëµ£¬¿Ï ......
sqlite3: Ò»¸öSQLiteÊý¾Ý¿âµÄÃüÁîÐнӿÚ
ÒëÕß×¢
ÔÎĵØÖ·£ºhttp://www.sqlite.org/sqlite.html
SQLite¿â°üº¬Ò»¸öÃû×Ö½Ð×ösqlite3 µÄÃüÁîÐÐ,Ëü¿ÉÒÔÈÃÓû§ÊÖ¹¤ÊäÈë²¢Ö´ÐÐÃæÏòSQLiteÊý¾Ý¿âµÄSQLÃüÁî¡£±¾ÎĵµÌṩһ¸öÑùʹÓÃsqlite3µÄ¼òҪ˵Ã÷¡£
¿ªÊ¼
Æô¶¯sqlite3 ³ÌÐò£¬½ö½öÐèÒªÇÃÈ ......
1£º¶¨Òå±íµÄ½á¹¹ºÍÃû×Ö£¬ÎÒʹÓÃÒÔÏ·½·¨£º
public interface Constatnts extends BaseColumns {
public static final String TABLE_NAME = "test";
public static final String TIME = "time";
public static final String TITLE = "title";
}
ÔÚÕâÀÎҼ̳Р......