HyperNetDatabase






4.11/5 (14 votes)
Mar 18, 2004
4 min read

125654

820
HyperNetDatabase is a single process multithreading and blackout safe database
Introduction
This project was developed in order to help users that use databases like commercial ACCESS for small projects and then are subject to commercial laws. This is a simple solution for a database engine that can supply a good power to normal database tasks. This driver is free (GPL).
Using the code
Link the two DLLs HyperNetDatabase.DLL and NetFrmExts.DLL to your project and you'll be linked. Note use R2 Only, R1 is older and unstable.
To open a database and make a select:
using HyperNetDatabase.R2;
...
Database db = new Database();
db.Open("file.hnd"); // creates or opens database
...
..
DataTable result = db.Select(
new string[]{"SEQNAME"}, // fields as an array of strings
"$Sequences", // Name of the table
new object[,]{ {"SEQNAME","=",myseq} }
// pairs of filter conditions : ... WHERE SEQNAME=myseq AND ...
);
..
db.Close();
Public Static Methods
![]() |
Converts a Data Row in a
NameAndValue object with skipRows .
|
Public Instance Constructors
![]() |
Default constructor |
Public Instance Properties
![]() Filename |
Filename of the database |
|
Global lock, used to lock other thread to make concurrent queries. Example: Read and then insert. |
|
Connection state |
Public Instance Methods
|
Adds a field | ||||||||||||||
|
Adds a field if it not exists | ||||||||||||||
|
Adds a table | ||||||||||||||
|
Adds a table if it not exists | ||||||||||||||
|
Closes a database | ||||||||||||||
|
SQL DELETE query using HyperNetDatabase.R2;
...
Database db = new Database();
db.Open("file.hnd");
// creates or opens database
...
string StockName = "peppers";
DataTable result = db.Delete("Stock",
new object[,]{ {"NAME","=",StockName} }
);
...
Is the same as: WHERE expression: Is an C# expresion for making a where as a filter.
| ||||||||||||||
|
Removes a table | ||||||||||||||
|
Drops a table if the table exists | ||||||||||||||
|
Dumps pages state | ||||||||||||||
|
Returns true if the table exists | ||||||||||||||
|
Destroys in memory indexes. Do this if your were walking for many tables and you memory resources are low. | ||||||||||||||
|
Overloaded. More known as Update or Insert (Sets values by a
keyfield) Inserts if the condition does not match or updates if the condition
matches. db.ForcedInsert( "Stock", "NAME",
"Peppers", "Qty", 0.5m );
Is the same as: SELECT Count(*) FROM STOCK WHERE NAME="Peppers";
if count > 0 then
UPDATE STOCK SET Qty=0.5 WHERE NAME="Peppers";
else
INSERT INTO STOCK (NAME,Qty)
VALUES ("Peppers",0.5);
| ||||||||||||||
|
Obtains a value and if it not exists obtains it's default value | ||||||||||||||
|
Gets all tables in this database | ||||||||||||||
|
Fields for users | ||||||||||||||
|
Inserts data into a Table using HyperNetDatabase.R2;
...
Database db = new Database();
db.Open("file.hnd");
// creates or opens database
...
string StockName = "peppers";
DataTable result = db.Insert(
"Stock", new object[,]
{ {"NAME",StockName}, {"QTY",0.5m} } );
...
Is the same as: INSERT INTO Stock (NAME,QTY) VALUES (@StockName,0.5); SET expression: Is an C# expresion for indicate a FIELD with its
VALUE. new object[,]{ {"QTY",0.5m} }
new object[,]{ {"STRNAME","peppers"},
{"QTY",0.5m} }
| ||||||||||||||
![]() LogToFile (inherited from
LogSupport) |
Saves a string in the log file | ||||||||||||||
|
Open | ||||||||||||||
|
Preloads indexes for table to make reads faster | ||||||||||||||
|
SQL Select query. using HyperNetDatabase.R2;
...
Database db = new Database();
db.Open("file.hnd"); // creates or opens database
...
string StockName = "peppers";
DataTable result = db.Select(null,"Stock",
new object[,]{ {"NAME","=",StockName} }
);
...
result = db.Select(new string[]{"NAME"},"Stock",
new object[,]{ {"NAME","=",StockName} }
);
...
Is the same as:
| ||||||||||||||
|
Overloaded. Creates a sequence. | ||||||||||||||
|
Current sequence value | ||||||||||||||
|
Sequence drop | ||||||||||||||
|
Sequence exists? | ||||||||||||||
|
Next sequence value (and autoincrement) | ||||||||||||||
|
SQL UPDATE query using HyperNetDatabase.R2;
...
Database db = new Database();
db.Open("file.hnd"); // creates or opens database
...
string StockName = "peppers";
DataTable result = db.Update("Stock",
new object[,]{ {"NAME",StockName}, {"QTY",0.5m} },
new object[,]{ {"NAME","=","pepperoni"} }
);
...
Is the same as: UPDATE Stock SET NAME=@StockName, QTY=0.5 WHERE NAME=pepperoni WHERE expression: Is an C# expresion for making a where as a filter.
SET expression: Is an C# expresion for indicate a FIELD with its VALUE.
new object[,]{ {"QTY",0.5m} } new object[,]{ {"STRNAME","peppers"},
{"QTY",0.5m} } |
Points of Interest
- Support all SQL basic functions.
- Additional features.
- Protect from Blackouts
- Multithreading-safe
History
RELEASE VERSION 2.0.0 NOTES - 2004-03-17
Features:
- First stable version
- Support all SQL basic functions.
- Additional features.
- Protect from Blackouts
- Multithreading-safe