Created
September 27, 2013 21:46
-
-
Save willmoss/6735670 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <orientdb-c/o_database_document.h> | |
#include <orientdb-c/o_document_value.h> | |
#include <string.h> | |
#include <stdio.h> | |
void o_db_error_handler_function(int code, char * error, void * custom_info) | |
{ | |
printf("code: message:%s",error); | |
} | |
void main() | |
{ | |
//instance error handler | |
struct o_database_error_handler *errorHandler = o_database_error_handler_new(o_db_error_handler_function, 0); | |
//instance the database instance. | |
struct o_database_document * db = o_database_document_new_error_handler("remote:127.0.0.1/tinkerpop", errorHandler); | |
//open the database with an user | |
o_database_document_open(db, "root", "EE42BFDBB69AFCC32EB0CEEC891360EF3341FC839FD0944EF87A62F8F761CC26"); | |
//create a new sql query. | |
struct o_query * q = o_query_sql("select from #11:2683"); | |
printf("create sql ok... \n"); | |
//execute the query on the database | |
struct o_list_document * ld = o_database_document_query(db, q); | |
// <---- this line is never reached | |
printf("document query ok... \n"); | |
//check that the query return a record. | |
if(o_list_document_size(ld) == 1){ | |
printf("%s"," record readed correctly \n"); | |
} else { | |
printf("cannot read record \n"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment