How to Insert data into embedded Map in Orient DB? - orientdb

I have Class Name Contacts and it has following properties.
name, type string
phone, type embeddedMap , link type string..
I want insert data using a query..
Please assit me to do this.
Thank You.

create vertex Contacts set name="pippo",phone={"home":"55555555","mobile":"8888888"},link="http://qwertyuiop"

Related

Access how to show record count of a table on a form

I want to show a variable value (record count of a table) on an Access form. I tried with a textbox by defining its control source with the following and many other internal functions but all returned only errors. Anyone can help? Thanks
select count(*) from TableName
I would also suggest the DCount domain aggregate function as suggested by Andre, but to offer an alternative, if TableName is the Record Source for your form, you can also use:
=Count(*)
To count all records in the Record Source, or:
=Count([FieldName])
To count all non-null values of a particular field in the Record Source.
You need = and domain functions.
=DCount("*", "TableName")
should work as control source.

How to select a column from table/collection using odata URI?

I am using mongodb and odata.
I want to select name field alone for particular user id. (i.e) select name from userdata where userid=1;
/*my collection schema - userdata*/
{
id:number,
userid:string,
name:string,
data:object
}
I tried http://localhost:27017/userdata?$format=json&$filter=userid eq '1'&$select=name
Instead of getting name file alone I got whole object/document that matches userid=1. What I am doing wrong here?
I spoted the problem after the comment from #jps.
The issue is not with query, the problem is with data model which I am using is mismatching with my database schema (i.e) I missed out name field in model, so it is returning whole collection.
Now model is fixed, so the service is responding back with names for given userid.

Bulk insert in orientdb

I have two different classes: Record and Location. Record has a location property that links to Location class.
I want to create a record with a new location in one statement pretty much like this:
insert into record content {location:{name:"EDR"}}
I was hoping this would create new location with name EDR and link it to location property of record but it throws this exception.
com.orientechnologies.orient.core.exception.OValidationException: The field 'record.location' has been declared as LINK but the value is not a record or a record-id
Can anyone help me please?
You can use
insert into record set location = (insert into location(name) values ("EDR"))
you could also try this:
insert into Record set location = (insert into Location content {name:'EDR'})
Hope it helps
Seems the inner object is taken as MAP instead of document. However try to force the fact the inner object is a document and not a MAP (In OrientDB you can have both):
insert into record content {"#type":"d", "location":{"#type":"d", "name":"EDR"}}

I want to Dynamically access SQLite result set?

I want to dynamically access SQLite result set. Since webworks/javascript doesnt support "PRAGMA table_info(table_name); I am saving all newly created tables information in a single two column table called schema. schema has two columns, table_name and column_name.
So I created a function to access table data dynamically. I use the item=results.rows.item(i) and than access row data with item.column.
column is a variable that is assigned the value from schema, representing the column_name. When I alert(column) I get the correct column_name, but when I used item.column my results are "undefined".
any advice on how to resolve this matter.
If I understand you correctly, column is a variable that holds the value of a column name, and you want to access that column from the results item. If that's the case, then this might help:
//Assuming "var column" has already been defined,
//and given the value of the column name to be accessed in the results item.//
var item = results.rows.item(i);
var columnValue = item[column];
I struggled with this too, and this is what I found/use. You put in brackets the variable containing the column name, and that's how you access it.
EDIT: This is obviously Javascript stuff, and what I used for accessing SQLite in PhoneGap. Hopefully it helps.

Where is Contact Type stored? (google/ phone)

I am trying to find where Contact type ( Google/Phone) is stored and how to access it. I thought I could access the class in the android.provider.contacts.contact.commonDatakinds package. However i could not find any information on the data field. Any help on contactscontact data field documentation and Contact Type would be greatly appreciated
Maybe you can query to RawContacts's content_uri with Rawcontacts.ACCOUNT_NAME and RawContacts.ACCOUNT_TYPE to get it.