I had just bought UniDDataBase 3.0. I had to convert CSV 2 UniDDatabase.
Row of my data is about 4000. DB Creat!
But!!! the error message → IndexOutOfRangeException: Array index is out of range…
DB TXT file size was over 7MB.
I will develop English Wordbook for iPhone / Android.
Your product is not covered by a large DB?
I’ve sent you several messages from my phone. They did not go through. I think the BlackBerry network is still having problems. I’m with my computer now. There’s a 99.9% probability you only have at least one extra comma in there. You can E-mail me a copy of your original file. I’ll take a look at it and resolve this for you today. You should be able to catch your own mistake if you look for the following. Let’s say for example. You have a table with 3 rows and two columns.
“Name”,“ID”,“Description”
“Bob”,1,“me,myself,and I”
“Andy”,2,“He’s a nice guy”
We see in the that me,myself, and I have 3 commas. However, it’s the same cell. The program will treat it as 3 fields. So instead of seing 3 columns. Any application with CSV import will treat it as 5 columns. To fix this problem I implemented the @Comma@. so to get the first one working correctly we need to do the following.
“Bob”,1,“me@Comma@myself@Comma@and I” By replacing the comma with the @Comma@ UniDDatabase will be aware of how to treat the data in the row correctly.
Unity Does not support International Languages at the moment. So Japanese, Korean, Arabic, or other languages that are not supported by Unity3d with not be supported by UniDDatabase. I will update the package in the Asset Store to reflect this fact.
hello friend, i didnt know it it was a very newbie question,
but i will be able to use your database to make searchs like a in the web with characters? Like in a search form, you insert 3 letters like “sku” and the dabase return tjhe record skull, like a regular recordset for web?
Also UniDDatabase 3.0 suport portuguese accents? Like “é”, or “ç”?
As you can see in the Attachment. Yes UniDDatabase does support those characters. I’m working on supporting other Eastern languages like (Chinese, Japanese,etc…) in Future versions. To enter those characters all you have to do is Copy and paste them in. That’s what I did. In future update I guess I should have a pop-up window with those characters.
Thanks namoricoo, for you quicky answer on saturday!, good to know thta it suportsportuguese characters
And about the search, i will be able to publish a software with a search via form, like you have in web?
“search via form” ???, can you be more specific. Are you trying to make games with Unity3d or Are you making forms with some other 3rd party program? All of my videos are with Unity3d.
Sorry, you are right, i was vague,
look this, is what im developing:
what i want to do with Uniddatabase is search muscles and bones inside the unity3D.
I want to insert a search box (with GUI.TextField ), so the person write “fem”, and click search, the uniddatabase return all the record that have “fem” in the rows:
femur (with transform.position in another colum)
femural muscles (with transform.position in another colum)
I know exactly how i can develp this for web, with a regular database.
Yes that will work. You would use the “contain” Keyword when searching for text. You can look at all of my Videos here. If you get stuck I give free tech support on ways to optimize Integration with UniDDatabase.
When you search for a part you can have it the correct body car auto-change color. UniDDatabase will search, you code to change the selected part. Would use a HashTable to store the Name of all of the body parts.
Thank you Namoricoo i will buy It now.
You are doing a very good work answering questions on saturday.
If i get stuck, i contact you.
Thanks!!
I always try to answer questions before I go to work. Let me know if you have any questions. Thank you for your encouragement.
Hello Namoricoo,
I really like your product, It is higly recommended,I start to build my first database, it will help me a lot.
Didi you have a javascript versions of the code to acess it?
More specifically of this one?
EzTextUpdate.cs
Just got home from work. PM me your e-mail and I’ll send you the Javascript version of the code tonorrow morning. It’s very similar. The UniDDatabase file is in the plug-in folder. It can be accessed from both javascript and C# due to Unity3d Execution order.
hello all,
i am new with unity.and i want to use sqlite for local database in my game for mobile.
i had create two scripts to do so and put them in my project/assets/plugin folder.please check the scripts below
//=================================
/*
Javascript class for accessing SQLite objects.
To use it, you need to make sure you COPY Mono.Data.SQLiteClient.dll from wherever it lives in your Unity directory
to your project’s Assets folder
Originally created by dklompmaker in 2009
http://forum.unity3d.com/threads/28500-SQLite-Class-Easier-Database-Stuff
Modified 2011 by Alan Chatham
*/
//import System.Data; // we import our data class
import Mono.Data.Sqlite; // we import sqlite
public class dbAccess
{
// variables for basic query access
// var localhost : String;
// var db : String;
// var name : String;
// var password : String;
// var Pooling : boolean;
// var connection : String;
var dbcon : IDbConnection;
var dbcmd : IDbCommand;
var reader : IDataReader;
// var tempPath : String = Application.persistentDataPath;
// function OpenDB(Server_Name,DatabaseName,Username,Password,Pooling)
function OpenDB(p : String)
{
Debug.Log(“in OprnDB()”);
// connection = Application.persistentDataPath + “/” + p;
// connection = “URI = File://Assets/StandardAssets/” + p;
// connection = Application.persistentDataPath + “/” + p;
connection = “URI=file:” + Application.dataPath + “/” + p;
// connection = “URI = File:” + p;
Debug.Log(“in OprnDB() → connection =” + connection);
dbcon = new SqliteConnection(connection);
dbcon.Open();
}
function BasicQuery(q : String, r : boolean) // run a basic Sqlite query
{
dbcmd = dbcon.CreateCommand(); // create empty command
dbcmd.CommandText = q; // fill the command
reader = dbcmd.ExecuteReader(); // execute command which returns a reader
if(r) // if we want to return the reader
{
return reader; // return the reader
}
}
// This returns a 2 dimensional ArrayList with all the
// data from the table requested
function ReadFullTable(tableName : String)
{
var query : String;
query = "SELECT * FROM " + tableName;
dbcmd = dbcon.CreateCommand();
dbcmd.CommandText = query;
reader = dbcmd.ExecuteReader();
var readArray = new ArrayList();
while(reader.Read())
{
var lineArray = new ArrayList();
for (var i : int = 0; i < reader.FieldCount; i++)
lineArray.Add(reader.GetValue(i)); // This reads the entries in a row
readArray.Add(lineArray); // This makes an array of all the rows
}
return readArray; // return matches
}
// This function deletes all the data in the given table. Forever. WATCH OUT! Use sparingly, if at all
function DeleteTableContents(tableName : String)
{
var query : String;
query = "DELETE FROM " + tableName;
dbcmd = dbcon.CreateCommand();
dbcmd.CommandText = query;
reader = dbcmd.ExecuteReader();
}
function CreateTable(name : String, col : Array, colType : Array) // Create a table, name, column array, column type array
{
var query : String;
query = "CREATE TABLE " + name + “(” + col[0] + " " + colType[0];
for(var i=1; i < col.length; i++)
{
query += ", " + col + " " + colType*;*
}
query += “)”;
dbcmd = dbcon.CreateCommand(); // create empty command
dbcmd.CommandText = query; // fill the command
reader = dbcmd.ExecuteReader(); //execute command which returns a reader
}
function InsertIntoSingle(tableName : String, colName : String, value : String) // single insert
{
var query : String;
query = "INSERT INTO " + tableName + “(” + colName + ") " + “VALUES (” + value + “)”;
dbcmd = dbcon.CreateCommand(); // create empty command
dbcmd.CommandText = query; // fill the command
reader = dbcmd.ExecuteReader(); // execute command which returns a reader
}
function InsertIntoSpecific(tableName : String, col : Array, values : Array) // Specific insert with col and values
{
var query : String;
query = "INSERT INTO " + tableName + “(” + col[0];
for(var i=1; i<col.length; i++)
{
query += ", " + col*;*
}
query += “) VALUES (” + values[0];
for(i=1; i<values.length; i++)
{
query += ", " + values*;*
}
query += “)”;
dbcmd = dbcon.CreateCommand();
dbcmd.CommandText = query;
reader = dbcmd.ExecuteReader();
}
function InsertInto(tableName : String, values : Array) // basic Insert with just values
{
* var query : String;*
query = “INSERT INTO " + tableName + " VALUES (” + values[0];
for(var i=1; i<values.length; i++)
{
query += ", " + values*;*
}
query += “)”;
dbcmd = dbcon.CreateCommand();
dbcmd.CommandText = query;
reader = dbcmd.ExecuteReader();
}
// This function reads a single column
// wCol is the WHERE column, wPar is the operator you want to use to compare with,
// and wValue is the value you want to compare against.
// Ex. - SingleSelectWhere(“puppies”, “breed”, “earType”, “=”, “floppy”)
// returns an array of matches from the command: SELECT breed FROM puppies WHERE earType = floppy;
function SingleSelectWhere(tableName : String, itemToSelect : String, wCol : String, wPar : String, wValue : String) // Selects a single Item
{
var query : String;
query = "SELECT " + itemToSelect + " FROM " + tableName + " WHERE " + wCol + wPar + wValue;
dbcmd = dbcon.CreateCommand();
dbcmd.CommandText = query;
reader = dbcmd.ExecuteReader();
var readArray = new Array();
while(reader.Read())
{
readArray.Push(reader.GetString(0)); // Fill array with all matches
}
return readArray; // return matches
}
function CloseDB()
{
reader.Close(); // clean everything up
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
dbcon = null;
}
}
and
other one to access this:-
//====
/* Script for testing out SQLite in Javascript
* This script is a GUI script - attach it to your main camera.*
It creates/opens a SQLite database, and with the GUI you can read and write to it.
*/
// This is the file path of the database file we want to use
// Right now, it’ll load TestDB.sqdb in the project’s root folder.
// If one doesn’t exist, it will be automatically created.
public var DatabaseName : String = “TestDB.sqdb”;
// This is the name of the table we want to use
//public var TableName : String = “TestTable”;
public var TableName : String = “TestTable”;
var db : dbAccess;
function Start()
{
* Debug.Log(“in TheDataBase → in Start()”);*
* Debug.Log(“in TheDataBase → in Start()” + Application.persistentDataPath);*
// Give ourselves a dbAccess object to work with, and open it
db = new dbAccess();
// db.OpenDB(Server,DatabaseName,Username,Password,false);
db.OpenDB(DatabaseName);
// Let’s make sure we’ve got a table to work with as well!
var tableName = TableName;
var columnNames = new Array(“firstName”,“lastName”);
var columnValues = new Array(“text”,“text”);
try
{
* db.CreateTable(tableName,columnNames,columnValues);*
* }*
catch(e)// Do nothing - our table was already created
{
//- we don’t care about the error, we just don’t want to see it
}
}
// These variables just hold info to display in our GUI
var firstName : String = “First Name”;
var lastName : String = “Last Name”;
var DatabaseEntryStringWidth = 100;
var scrollPosition : Vector2;
var databaseData : ArrayList = new ArrayList();
// This GUI provides us with a way to enter data into our database
// as well as a way to view it
function OnGUI()
{
GUI.Box(Rect (25,25,Screen.width - 50, Screen.height - 50),“”);
GUILayout.BeginArea(Rect(50, 50, Screen.width - 100, Screen.height - 100));
// This first block allows us to enter new entries into our table
* GUILayout.BeginHorizontal();*
* firstName = GUILayout.TextField(firstName, GUILayout.Width (DatabaseEntryStringWidth));*
* lastName = GUILayout.TextField(lastName, GUILayout.Width (DatabaseEntryStringWidth));*
* GUILayout.EndHorizontal();*
* if (GUILayout.Button(“Add to database”))*
* {*
* // Insert the data*
* InsertRow(firstName,lastName);*
* // And update the readout of the database*
* databaseData = ReadFullTable();*
* }*
* // This second block gives us a button that will display/refresh the contents of our database*
* GUILayout.BeginHorizontal();*
* if (GUILayout.Button (“Read Database”))*
* databaseData = ReadFullTable();*
* if (GUILayout.Button(“Clear”))*
* databaseData.Clear();*
* GUILayout.EndHorizontal();*
* GUILayout.Label(“Database Contents”);*
* scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Height(100));*
* for (var line : ArrayList in databaseData)*
* {*
* GUILayout.BeginHorizontal();*
* for (var s in line)*
* {*
* GUILayout.Label(s.ToString(), GUILayout.Width(DatabaseEntryStringWidth));*
* }*
* GUILayout.EndHorizontal();*
* }*
* GUILayout.EndScrollView();*
* if (GUILayout.Button(“Delete All Data”))*
* {*
* DeleteTableContents();*
* databaseData = ReadFullTable();*
* }*
* GUILayout.EndArea();*
}
// Wrapper function for inserting our specific entries into our specific database and table for this file
function InsertRow(firstName, lastName)
{
var values = new Array((“'”+firstName+“'”),(“'”+lastName+“'”));
db.InsertInto(TableName, values);
}
// Wrapper function, so we only mess with our table.
function ReadFullTable()
{
return db.ReadFullTable(TableName);
}
// Another wrapper function…
function DeleteTableContents()
{
db.DeleteTableContents(TableName);
}
//===============
but still it didn’t work on mobile.
on mobile it gives the error “create_culture_not_met”.
thanks
can anyone tell me the exact way to do so.
Why are you posting your code in other people’s messages. That’s why there’s a scripting section where people will answer your questions. The first thing you need to do is delete all of this junk from my UniDDatabase post. In the “Siaqodb - local database for Unity3D” dataase post you had enough sense to post an attachment.
2)I’m also the Engineer who wrote UniSqlite. It’s in the Asset Store for $75. It’s very popular with people who like Sqlite.
3) However, Sqlite will only work for Unity Pro Users. If you are not a Unity Pro user. You will not be able to use Sqlite in Unity.
4)After observing the limitations of Sqlite I developed UniDDatabase that addresses all of those problems people have with Sqlite.
Hello Namoricoo, or other UniDDatabase more advanced user than me…
I starting to write my first script using UniDDatabase,
I use, EzTextUpdateJs.js as template, and “stringPattern” as variable to make make the search, it work nice!
But i Have a problema with the second Column, i want to code it to search only in the colum one, and use the 2 colum to store data,
How can i change this code to loads the same rows in the array as the fist colum (first name?)
arrayOfGuiFirstName=UniDDatabaseCs.GetArrayOfTextInColumnByPattern(ddatabase,columnFirstName,searchOperation,stringPattern);
arrayOfGuiFirstNameKey=UniDDatabaseCs.GetArrayOfDdKeyInColumnByPattern(ddatabase,columnFirstName,searchOperation,stringPattern);
arrayOfGuiLastName=UniDDatabaseCs.GetArrayOfTextInColumnByPattern(ddatabase,columnLastName,searchOperation,stringPattern);
arrayOfGuiLastNameKey=UniDDatabaseCs.GetArrayOfDdKeyInColumnByPattern(ddatabase,columnLastName,searchOperation,stringPattern);
When you have questions you can E-mail me directly for customer support. Use the same e-mail you used last time. To search only one column. I have a hashtable function built into the script.If you open the “AlphabetTextureAndSoundCs” and I use Hashtable function there. I can’t post too much code in the public forum here.
In the start function you would use something like this.
tagOrNameHashtable=UniDDatabaseCs.InitializeString WithIndexHashtable(arrayOfGuiTagNames);
where the “tagOrNameHashtable” is a Hashtable of names Or Tags of the body parts. It will return the index to the row where the body part is located. If the body part is not present. You will check for null. Like I said b4. Can’t post too much code here. If you check my look at my “WWW” video you’ll be able to see a HashTable in action.
Hi Guys,
Please an somebody help. The plugin documentation is horrid and the JS examples are not working in the package. I’d like to understand a simple JS example of reading and writing from the database. I can verbose the column name - but I cannot seem to get the data out of a column/row.
Here is some example code:
Delete this part
“//arrayTitles=UniDDatabaseCs.GetArrayOfTextInColumnB yKey(ddatabase,getcoltitle,searchOperation,0,2);”
The syntax looks correct. Try opening up whatever file you have attached to the “ddatabase” in the editor and have a look at it and make sure it’s not empty.
In the example provided with the package: “EzTextSlideShow” , The file that’s attached in the inspector is “TextAndID.txt.” In all of the examples provided with the package people should not be trying to access column 1 because that’s where they ID of the row is. If you want to see stuff. Try column 0 or Column 2. The ID row does not display because it’s there for organizational purposes only. The examples are very straight forward. Try understanding the examples before you get creative…