嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元微信扫码支付:2 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
aSQLiteManager是一款适用于Android平台的SQLite 管理器。SQLite是一个软件库,用于实现自包含、非服务式、零配置、事务化的SQL数据库引擎。
SQLite是一个嵌入式SQL数据库引擎,与其它大多数SQL数据库不同的是,SQLite没有独立的服务进程。SQLite直接读写原始的磁盘文件,一个拥有多个表、索引、触发器和视图的完整SQL数据库就包含在一个独立的磁盘文件中。数据库文件的格式是跨平台的,你可以在32位和64位系统之间、甚至在Big-Endian和Little-Endian(译者注:这是两种不同的字节排序方式,Big-Endian是指一个word中的高位Byte是放在内存word区域的低地址处,而Little-Endian则与之相反)两种不同的架构间自由地拷贝数据库,这一特性让SQLite成为应用文件格式的一种流行选择。SQLite不能替代Oracle,但可以考虑作为fopen()的替代方法。
SQLite已经是世界上布署得最广泛的SQL数据库引擎,被用在无以计数的桌面电脑应用中,还有消费电子设备中,如移动电话、掌上电脑和MP3播放器等。SQLite的源码就放在公有领域(即WikiPedia的public domain)中。
该应用主要功能:
- 支持打开来自aSQLiteManager和其它文件管理器的数据库。(包括OI File Manager,Adao Teams File Manager,以及 Simplest File Manager )。
- 列出表单,视图,和索引。
- 显示表单和视图的数据单元格的内容可以拷贝到剪贴板上执行'Drop' / 'Create' SQL语句。
- 将所有可执行语句存储在开放式的数据库里(在一个称为aSQLiteManager的表单)
- 从查询表格中可以查询SQL历史记录。
- 开始事务,提交和回滚。
- 导出数据库的SQL脚本,支持脚本的数据库恢复。
- 导出为ASCII文件的查询结果。
- 开放式的数据库,无需重置配置。
- 执行SQL脚本,全脚本或单行脚本。
- 良好的排错功能。
- 支持编辑按钮来编辑数据表单表浏览器。
- 通过数据浏览器中的标题栏按钮来添加数据项。
- SQLite的数据录入过程中不validata数据类型。
新版本可能提供的功能:
- 通过点击标题可以对数据和查询结果进行分类。
- 支持对数据项进行更好的验证。
- 嵌入SQLites . 命令。
- 嵌入BLOBS字段。
- 支持脚本的编译器。
/**
* Part of aSQLiteManager (http://sourceforge.net/projects/asqlitemanager/)
* a a SQLite Manager by andsen (http://sourceforge.net/users/andsen)
*
* The mail class of the aSQLiteManager
*
* @author andsen
*
*/
package dk.andsen.asqlitemanager;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.os.Environment;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import dk.andsen.utils.NewFilePicker;
import dk.andsen.utils.Utils;
public class aSQLiteManager extends Activity implements OnClickListener {
/**
* True to enable functions under test
*/
private static final int MENU_OPT = 1;
private static final int MENU_HLP = 2;
private static final int MENU_RESET = 3;
final String WelcomeId = "ShowWelcome2.0b";
private Context _cont;
private String _recentFiles;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button open = (Button) this.findViewById(R.id.Open);
open.setOnClickListener(this);
Button about = (Button) this.findViewById(R.id.About);
about.setOnClickListener(this);
Button newDatabase = (Button) this.findViewById(R.id.NewDB);
newDatabase.setOnClickListener(this);
Button recently = (Button) this.findViewById(R.id.Recently);
recently.setOnClickListener(this);
TextView tv = (TextView) this.findViewById(R.id.Version);
tv.setText(getText(R.string.Version) " " getText(R.string.VersionNo));
_cont = this;
final SharedPreferences settings = getSharedPreferences("aSQLiteManager", MODE_PRIVATE);
// Show welcome screen if not disabled
//TODO change how the welcome screen is displayed. Store version no in
// in "VersionNo" and show welcome if versionNo has changed
if(settings.getBoolean(WelcomeId, true)) {
final Dialog dial = new Dialog(this);
dial.setContentView(R.layout.welcome);
dial.setTitle(R.string.Welcome);
Button _btOK = (Button)dial.findViewById(R.id.OK);
_btOK.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
CheckBox _remember = (CheckBox) dial.findViewById(R.id.ShowAtStartUp);
android.content.SharedPreferences.Editor edt = settings.edit();
edt.putBoolean(WelcomeId, _remember.isChecked());
edt.commit();
dial.hide();
} });
dial.show();
}
}
/* (non-Javadoc)
* @see android.view.View.OnClickListener#onClick(android.view.View)
*/
public void onClick(View v) {
int key = v.getId();
if (key == R.id.Open) {
Intent i = new Intent(this, NewFilePicker.class);
Utils.logD("Calling NewFilepicker");
// Utils.logD("Calling NewFilepicker for result");
// startActivityForResult(i, 1);
startActivity(i);
} else if (key == R.id.About) {
showAboutDialog();
} else if (key == R.id.NewDB) {
Utils.logD("Create new database");
newDatabase();
} else if (key == R.id.Recently) {
// Retrieve recently opened files
SharedPreferences settings = getSharedPreferences("aSQLiteManager", MODE_PRIVATE);
_recentFiles = settings.getString("Recently", null);
if (_recentFiles == null) {
Utils.showMessage("Recently files: ", _recentFiles, _cont);
} else {
String[] resently = _recentFiles.split(";");
Utils.logD(_recentFiles);
AlertDialog dial = new AlertDialog.Builder(this)
.setTitle(getString(R.string.Recently))
.setSingleChoiceItems(resently, 0, new ResentFileOnClickHandler() )
.create();
dial.show();
}
}
}
/**
* Open a the database clicked on from the recently opened file menu
*/
public class ResentFileOnClickHandler implements DialogInterface.OnClickListener {
public void onClick(DialogInterface dialog, int which) {
String[] files = _recentFiles.split(";");
String database = files[which];
//Utils.toastMsg(_cont, database);
dialog.dismiss();
Intent i = new Intent(_cont, DBViewer.class);
i.putExtra("db", database);
startActivity(i);
}
}
/**
* Display the about dialog
*/
private void showAboutDialog() {
Dialog dial = new Dialog(this);
dial.setContentView(R.layout.about);
dial.show();
}
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
Utils.logD("MainDriver main-activity got result from sub-activity");
if (resultCode == Activity.RESULT_CANCELED) {
Utils.logD("WidgetActivity was cancelled or encountered an error. resultcode == result_cancelled");
Utils.logD("WidgetActivity was cancelled - data =" data);
} else
switch (requestCode) {
case 1:
String msg = data.getStringExtra("returnedData");
Utils.showMessage("Returned file", msg, _cont);
break;
}
Utils.logD("MainDriver main-activity got result from sub-activity");
}
/**
* Create a new empty database
*/
private void newDatabase() {
final Dialog newDatabaseDialog = new Dialog(this);
newDatabaseDialog.setContentView(R.layout.new_database);
newDatabaseDialog.setTitle(getText(R.string.NewDBSDCard));
final EditText edNewDB = (EditText)newDatabaseDialog.findViewById(R.id.newCode);
edNewDB.setHint(getText(R.string.NewDBPath));
TextView tvMessage = (TextView) newDatabaseDialog.findViewById(R.id.newMessage);
tvMessage.setText(getText(R.string.Database));
newDatabaseDialog.show();
final Button btnMOK = (Button) newDatabaseDialog.findViewById(R.id.btnMOK);
btnMOK.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
String path;
if (v == btnMOK) {
if (Utils.isSDAvailable()) {
String fileName = edNewDB.getEditableText().toString();
path = Environment.getExternalStorageDirectory().getAbsolutePath();
path = "/" fileName;
if (fileName.equals("")) {
Utils.showMessage((String)getText(R.string.Error), (String)getText(R.string.NoFileName), _cont);
} else {
if (!path.endsWith(".sqlite"))
path = ".sqlite";
SQLiteDatabase.openOrCreateDatabase(path, null);
// Ask before??
Intent i = new Intent(_cont, DBViewer.class);
i.putExtra("db", path);
newDatabaseDialog.dismiss();
startActivity(i);
}
}
Utils.logD("Path: " edNewDB.getText().toString());
}
}
});
}
/*
* Creates the menu items
*/
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, MENU_OPT, 0, R.string.Option).setIcon(R.drawable.ic_menu_preferences);
menu.add(0, MENU_HLP, 0, R.string.Help).setIcon(R.drawable.ic_menu_help);
menu.add(0, MENU_RESET, 0, R.string.Reset).setIcon(R.drawable.ic_menu_close_clear_cancel);
return true;
}
/* (non-Javadoc) Handles item selections
* @see android.app.Activity#onOptionsItemSelected(android.view.MenuItem)
*/
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case MENU_OPT:
startActivity(new Intent(this, Prefs.class));
return true;
case MENU_HLP:
Intent i = new Intent(this, Help.class);
startActivity(i);
return true;
case MENU_RESET:
// Reset all settings to default
SharedPreferences settings = getSharedPreferences("aSQLiteManager", MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("FPJustOpen", false);
editor.putBoolean("JustOpen", false);
editor.putBoolean(WelcomeId, true);
editor.putString("Recently", null);
editor.commit();
settings = getSharedPreferences("dk.andsen.asqlitemanager_preferences", MODE_PRIVATE);
editor = settings.edit();
//TODO have had problems using Int but RecentFiles seens to work
editor.putInt("RecentFiles", 5);
editor.putString("PageSize", "20");
editor.putBoolean("SaveSQL", false);
editor.commit();
return false;
}
return false;
}
}