First contact with SharpHsql (pure C # open source database engine)

Source: Internet
Author: User
Tags website performance

On the blog of the source of inspiration in open source, I saw this article: Open Source pure C # lightweight Database Engine: SharpHSQL 1.0.3.0.
I have used many similar database engines, such as sqlite and MINOSSE. Sqlite is inconvenient for pure c in web applications, and minnosse cannot run normally.
The main reason I am looking for such a database engine is that I want to replace ACCESS in web projects to reduce website construction costs and improve website performance.
First, I will compare SharpHsql with SQL Server 2000, in which Hsql leads the way in creating and deleting tables. The speed of data modification and query is basically the same. SharpHsql takes a little longer to query, and SharpHsql uses the cache technology.
When data is inserted, the data in the table increases and the speed slows down. When 10 thousand rows of data are inserted, the speed slows down. This speed is much slower than that of SQL server;
The data I used to test access is basically 1/10 of SQL server, so the SharpHsql speed is very advantageous compared with Access, and the overall performance is more than six times that of ACCESS.

SharpHsql databases have a total of 4 files *. data, *. cfg, *. log, and *. backup. You will know what to do with the suffix.

Let's take a look at the functions he supports. I will extract a piece of code here. You will understand it after reading the code.

Switch (sToken)
{
Case "SELECT ":
RResult = p. ProcessSelect ();
Break;
Case "INSERT ":
RResult = p. ProcessInsert ();
Break;
Case "UPDATE ":
RResult = p. ProcessUpdate ();
Break;
Case "DELETE ":
RResult = p. ProcessDelete ();
Break;
Case "ALTER ":
RResult = p. ProcessAlter ();
Break;
Case "CREATE ":
RResult = ProcessCreate (c, channel );
Script = true;
Break;
Case "DROP ":
RResult = ProcessDrop (c, channel );
Script = true;
Break;
Case "GRANT ":
RResult = ProcessGrantOrRevoke (c, channel, true );
Script = true;
Break;
Case "REVOKE ":
RResult = ProcessGrantOrRevoke (c, channel, false );
Script = true;
Break;
Case "CONNECT ":
RResult = ProcessConnect (c, channel );
Break;
Case "DISCONNECT ":
RResult = ProcessDisconnect (c, channel );
Break;
Case "SET ":
RResult = ProcessSet (c, channel );
Script = true;
Break;
Case "SCRIPT ":
RResult = ProcessScript (c, channel );
Break;
Case "COMMIT ":
RResult = ProcessCommit (c, channel );
Script = true;
Break;
Case "ROLLBACK ":
RResult = ProcessRollback (c, channel );
Script = true;
Break;
Case "SHUTDOWN ":
RResult = ProcessShutdown (c, channel );
Break;
Case "CHECKPOINT ":
RResult = ProcessCheckpoint (channel );
Break;
Case "CALL ":
RResult = p. ProcessCall ();
Break;
Case "SHOW ":
RResult = ProcessShow (c, channel );
Break;
Case "DECLARE ":
RResult = p. ProcessDeclare ();
Script = true;
Break;
Case ";":
Continue;
Default:
Throw Trace. Error (Trace. UnexpectedToken, Token en );
}

Then, when DataReader is used, its DataReader does not implement the indexer. It can only be implemented using DataReader [Columnname] And DataReader. GetInt32 (0. Note that the column names in DataReader [Columnname] must be in uppercase, and all SharpHsql statements in the system must be in uppercase;
DataReader [Columnname] is implemented using HashTable. DataReader. GetInt32 (0) is implemented using object.

When SharpHsqlDataAdapter is used, non-SharpHsqlDataAdapter is found. an error is reported in the form of Fill (dataset), such as SharpHsqlDataAdapter. fill (dataset, tablename); To solve this problem, you only need to delete the SharpHsqlDataAdapter. the Fill Method in cs is enough. In fact, it does not need to be rewritten. Public override int Fill (DataSet dataSet)
{
Return base. Fill (dataSet );
}

The problems I have found are just like this.

By the way, his log4net system actually occupies space. I will remove it!

In general, the database engine is still relatively well-developed, but the driver write is relatively sloppy, and the data object names should not all be replaced with uppercase letters.

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.