In some small applications, you do not need to use large database software. You can use the database to manage your own SQL interpreter. This interpreter can explain commonly used SQL commands. You can add other functions on your own. & Lt ;? Php (as the mainstream development language) classDB_SyntaxHighlighter makes an SQL interpreter
In some small applications, there is no need to use large database software. You can use the database to manage your own SQL interpreter.
This interpreter can explain commonly used SQL commands. You can add other functions on your own.
Class DB_text {
Var $ conn;
Var $ classname = "db_text ";
Var $ database;
Function on_create (){
}
Function connect ($ database_name ){
$ This-> database = $ database_name;
If (! File_exists ($ database_name )){
$ This-> conn = array ();
$ This-> _ close ();
}
$ Fp = fopen ($ this-> database, "r ");
$ This-> conn = unserialize (fread ($ fp, filesize ($ this-> database )));
Fclose ($ fp );
}
Function & query ($ query ){
If (eregi ("select", $ query) return $ this-> _ select ($ query );
If (eregi ("insert", $ query) return $ this-> _ insert ($ query );
If (eregi ("delete", $ query) return $ this-> _ delete ($ query );
If (eregi ("update", $ query) return $ this-> _ update ($ query );
Return array ();
}
Function fetch_row (& $ result ){
If (list ($ key, $ value) = each ($ result ))
Return $ value;
Return false;
}
Function num_rows ($ result ){
Return count ($ result );
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.