|
Query related QDB - Client API usage
|
03/20/2013 10:09 AM
post100040
|
Query related QDB - Client API usage
Hello Everyone,
I have created a "C Application" to play around with qdb and I have plan to use it in my actual project later.
I am facing the following issue - "database get results api returns - Input/Output error". I copied the DB to local
system and tried opening using SQLite Browser - "file is encrypted or is not a database" error.
Logic implemented in Application
1) Connect to database
2) Insert an data
3) Operate on that data(SELECT) and get the results of that operation. I followed the same code in "QDB Examples" of QNX
documentation.
Please provide some guidance to go ahead.
|
Associations: |
post101990:
Re: Query related QDB - Client API usage - Hello Gilles,
Iam also new to qdb.I had created the MME database tables sucessfully but through "qdbc" iam able to perform only few
sql commands like insert,pragma,update,delete etc.could you please share other valid commads for help,dump,to view
tables etc.I tried ".help",".tables" but it is giving syntax error.
#
#
# qdbc -d /dev/qdb/mme
Connected to "/dev/qdb/mme". Use 'ctrl-C' to end.
SQL>
>
> .help;
near ".": syntax error (S1)
SQL> ".help";
near ".": syntax error (S1)
SQL>
Thanks ,
Santhi - kandregula vijaya santhi
|
|
|
|
Re: Query related QDB - Client API usage
|
03/20/2013 10:14 AM
post100042
|
Re: Query related QDB - Client API usage
I don't think there is any details for use to help.
1) Is QDB running?
2) What does the output of "pidin arg" show?
3) What does the output of "ls -al /dev/qdb" show?
4) try using qdbc to run your query:
qdbc -d<name_of_db> "SELECT ...."
Regards,
Gilles
|
|
|
|
Re: Query related QDB - Client API usage
|
03/20/2013 11:30 AM
post100048
|
Re: Query related QDB - Client API usage
1) Is QDB running?
QDB process is running after executing the example code
2) What does the output of "pidin arg" show?
Displays that QDB process is running
3) What does the output of "ls -al /dev/qdb" show?
Shows the database which was created by my application and size of that file is 0.
Refer to attachement (ls_l_qdb_dev.jpg)
4) try using qdbc to run your query:
qdbc -d<name_of_db> "SELECT ...."
I tried using "INSERT INTO" command after executing the example code, got the following error
file is encrypted or is not a database(S26)
Refer to attcahment (INSERT_INTO.jpg)
|
|
|
|
Re: Query related QDB - Client API usage
|
03/20/2013 11:32 AM
post100049
|
Re: Query related QDB - Client API usage
Executing the same logic from command line interface before "application" execution, it works fine.
|
|
|
|
Re: Query related QDB - Client API usage
|
03/20/2013 12:37 PM
post100056
|
Re: Query related QDB - Client API usage
It sounds like your application is directly modifying the underlying DB
file.
Regards,
Gilles
|
|
|
|
Re: Query related QDB - Client API usage
|
03/20/2013 12:40 PM
post100057
|
Re: Query related QDB - Client API usage
Hi Gilles,
Thanks for your reply.
I am new to both DBMS and qdb.
I didn't understand your reply.
Could you please explain it little details.
|
|
|
|
Re: Query related QDB - Client API usage
|
05/01/2013 10:27 PM
post101072
|
Re: Query related QDB - Client API usage
Hi im a student trying to use QDB for the first time and i'm wondering where can i get qdbc? please enlighten me
|
|
|
|
Re: Query related QDB - Client API usage
|
05/01/2013 10:33 PM
post101073
|
Re: Query related QDB - Client API usage
qdbc is a standard QNX 6.5.0 binary. When you install the 6.5.0 runtime,
this binary should already be included.
Regards,
Gilles
|
|
|
|
Re: Query related QDB - Client API usage
|
06/04/2013 2:25 AM
post101990
|
Re: Query related QDB - Client API usage
> qdbc is a standard QNX 6.5.0 binary. When you install the 6.5.0 runtime,
> this binary should already be included.
>
> Regards,
> Gilles
>
Hello Gilles,
Iam also new to qdb.I had created the MME database tables sucessfully but through "qdbc" iam able to perform only few
sql commands like insert,pragma,update,delete etc.could you please share other valid commads for help,dump,to view
tables etc.I tried ".help",".tables" but it is giving syntax error.
#
#
# qdbc -d /dev/qdb/mme
Connected to "/dev/qdb/mme". Use 'ctrl-C' to end.
SQL>
>
> .help;
near ".": syntax error (S1)
SQL> ".help";
near ".": syntax error (S1)
SQL>
Thanks ,
Santhi
|
Associations: |
post103244:
Re: Query related QDB - Client API usage - Hello,
Please can anyone help me in reading the data after receiving MME_EVENT_MS_STATECHANGE.
I want to know the msid of the device.
I know that it is stored as mme_ms_statechange_t.
But i can get the data
below is my code snippet
case MME_EVENT_MS_STATECHANGE:
{
printf("MME_EVENT_MS_STATECHANGE\n");
mme_ms_statechange_t *tData =(mme_ms_statechange_t *)(mme_event->data);
printf("Data----:%ld\n",tData->msid);
}
But iam getting some unknown value for msid.
Please help me in this regard.
Thanks,
Vijaya Santhi - kandregula vijaya santhi
post27358:
Re: Deploying and running MME suite on QNX neutrino target - Hello Peter,
Currently iam configuring MME.Related the associated query i have one doubt .Do we need to add entry in the media store table or it will be automatically updated
Thanks
Santhi - kandregula vijaya santhi
post100040:
Query related QDB - Client API usage - Hello Gilles,
Iam also new to qdb.I had created the MME database tables sucessfully but through "qdbc" iam able to perform only few
sql commands like insert,pragma,update,delete etc.could you please share other valid commads for help,dump,to view
tables etc.I tried ".help",".tables" but it is giving syntax error.
#
#
# qdbc -d /dev/qdb/mme
Connected to "/dev/qdb/mme". Use 'ctrl-C' to end.
SQL>
>
> .help;
near ".": syntax error (S1)
SQL> ".help";
near ".": syntax error (S1)
SQL>
Thanks ,
Santhi - kandregula vijaya santhi
|
|
|
|
Re: Query related QDB - Client API usage
|
06/04/2013 8:28 AM
post101999
|
Re: Query related QDB - Client API usage
Hi Santhi,
With QDB you can only issue SQL commands, basically anything you see here:
http://www.sqlite.org/lang.html
Things like ".help" are sqlite3 shell commands, these are implemented by
the sqlite3 command line tool (not by the qdbc client). If you try
something like "SELECT * FROM ..." it should work if you fill in the
proper table names.
Regards,
Gilles
|
|
|
|
Re: Query related QDB - Client API usage
|
06/04/2013 8:35 AM
post102001
|
Re: Query related QDB - Client API usage
Thank You Very Much Gilles.
Is there any way to dump the database using qdbc?
|
|
|
|
Re: Query related QDB - Client API usage
|
06/04/2013 8:58 AM
post102002
|
Re: Query related QDB - Client API usage
Are you looking for the .dump command from the sqlite3 shell? qdbc doesn't
do this.
You could build the sqlite3 shell yourself for QNX by downloading the
sqlite3 source code.
Regards,
Gilles
On 13-06-04 8:35 AM, "kandregula vijaya santhi"
<community-noreply@qnx.com> wrote:
Thank You Very Much Gilles.
Is there any way to dump the database using qdbc?
_______________________________________________
Development
http://community.qnx.com/sf/go/post102001
To cancel your subscription to this discussion, please e-mail
development-multimedia-unsubscribe@community.qnx.com
|
|
|
|
Re: Query related QDB - Client API usage
|
06/04/2013 9:10 AM
post102004
|
Re: Query related QDB - Client API usage
Thank You Very Much.
I will try with Sqlite3 command line tool.
Could You Please help me in setting the MME on QNX target?
Actually still my membership request is pending and there is no option to post a query.
So iam using this already posted query which is relevant to my work.
Below is my query
---------------------
I followed the steps mentioned in the "quick start guide" section of IntroductionToMME.pdf
But iam unable to play the file using mmecli utility.It is giving error no 61.
iam having the following doubts
1.Do MME updates the database tables automatically? If yes which tables it will update.
2.which tables we need to enter manually to the database
3.How LIBRARY table is updated
Please find the attchments of my sql file
|
|
|
|
Re: Query related QDB - Client API usage
|
07/17/2013 6:10 AM
post103244
|
Re: Query related QDB - Client API usage
> Thank You Very Much.
> I will try with Sqlite3 command line tool.
>
> Could You Please help me in setting the MME on QNX target?
> Actually still my membership request is pending and there is no option to post
> a query.
> So iam using this already posted query which is relevant to my work.
>
> Below is my query
> ---------------------
> I followed the steps mentioned in the "quick start guide" section of
> IntroductionToMME.pdf
> But iam unable to play the file using mmecli utility.It is giving error no 61.
>
>
> iam having the following doubts
> 1.Do MME updates the database tables automatically? If yes which tables it
> will update.
> 2.which tables we need to enter manually to the database
> 3.How LIBRARY table is updated
>
> Please find the attchments of my sql file
>
>
Hello,
Please can anyone help me in reading the data after receiving MME_EVENT_MS_STATECHANGE.
I want to know the msid of the device.
I know that it is stored as mme_ms_statechange_t.
But i can get the data
below is my code snippet
case MME_EVENT_MS_STATECHANGE:
{
printf("MME_EVENT_MS_STATECHANGE\n");
mme_ms_statechange_t *tData =(mme_ms_statechange_t *)(mme_event->data);
printf("Data----:%ld\n",tData->msid);
}
But iam getting some unknown value for msid.
Please help me in this regard.
Thanks,
Vijaya Santhi
|
|
|
|
Re: Query related QDB - Client API usage
|
07/17/2013 11:12 AM
post103256
|
Re: Query related QDB - Client API usage
Is msid uint64_t? If so you need to print with "%llu", not "%ld"
Regards,
Gilles
|
Associations: |
post103276:
Re: Query related QDB - Client API usage - Thank you very much Gilles.
Now iam able to see correct msid.
Iam trying the following code snippet to get the slottype or the device for which the state change happened but always it is going to default.i have connected USB and its msid is 1 as seen in the slots table.Please let me know what is the error in the below code
qdb_hdl_t *hQDB = qdb_connect("/dev/qdb/mme", 0);
uint64_t msid=1;
char qdbBuf[64] ;
sprintf(qdbBuf,"SELECT slottype FROM slots WHERE msid=%llu",msid);
qdb_result_t* ptRes = qdb_query(hQDB, 0, qdbBuf);
if (ptRes)
{
if( 0 < qdb_rows(ptRes))
{
switch((unsigned short)(qdb_cell(ptRes, 0, 0)))
{
case MME_SLOTTYPE_USB:
printf("MME_SLOTTYPE_USB\n");
break;
case MME_SLOTTYPE_CD:
printf("MME_SLOTTYPE_CD Source\n");
break;
case MME_SLOTTYPE_MEDIAFS:
printf("MME_SLOTTYPE_MEDIAFS Source\n");
break;
case MME_SLOTTYPE_FILESYSTEM:
printf("MME_SLOTTYPE_FILESYSTEM Source or SD Card\n");
break;
case MME_SLOTTYPE_BLUETOOTH:
printf("MME_SLOTTYPE_MEDIAFS Source\n");
break;
default:
printf("Default Source\n");
break;
}
}
Also Could You Please let me know how i post a Query myself with out associating to any other query.
I tried but could not get any option to post. - kandregula vijaya santhi
|
|
|
|
Re: Query related QDB - Client API usage
|
07/18/2013 2:14 AM
post103276
|
Re: Query related QDB - Client API usage
Thank you very much Gilles.
Now iam able to see correct msid.
Iam trying the following code snippet to get the slottype or the device for which the state change happened but always
it is going to default.i have connected USB and its msid is 1 as seen in the slots table.Please let me know what is the
error in the below code
qdb_hdl_t *hQDB = qdb_connect("/dev/qdb/mme", 0);
uint64_t msid=1;
char qdbBuf[64] ;
sprintf(qdbBuf,"SELECT slottype FROM slots WHERE msid=%llu",msid);
qdb_result_t* ptRes = qdb_query(hQDB, 0, qdbBuf);
if (ptRes)
{
if( 0 < qdb_rows(ptRes))
{
switch((unsigned short)(qdb_cell(ptRes, 0, 0)))
{
case MME_SLOTTYPE_USB:
printf("MME_SLOTTYPE_USB\n");
break;
case MME_SLOTTYPE_CD:
printf("MME_SLOTTYPE_CD Source\n");
break;
case MME_SLOTTYPE_MEDIAFS:
printf("MME_SLOTTYPE_MEDIAFS Source\n");
break;
case MME_SLOTTYPE_FILESYSTEM:
printf("MME_SLOTTYPE_FILESYSTEM Source or SD Card\n");
break;
case MME_SLOTTYPE_BLUETOOTH:
printf("MME_SLOTTYPE_MEDIAFS Source\n");
break;
default:
printf("Default Source\n");
break;
}
}
Also Could You Please let me know how i post a Query myself with out associating to any other query.
I tried but could not get any option to post.
|
Associations: |
post103256:
Re: Query related QDB - Client API usage - Thank you very much Gilles.
Now iam able to see correct msid.
Iam trying the following code snippet to get the slottype or the device for which the state change happened but always it is going to default.i have connected USB and its msid is 1 as seen in the slots table.Please let me know what is the error in the below code
qdb_hdl_t *hQDB = qdb_connect("/dev/qdb/mme", 0);
uint64_t msid=1;
char qdbBuf[64] ;
sprintf(qdbBuf,"SELECT slottype FROM slots WHERE msid=%llu",msid);
qdb_result_t* ptRes = qdb_query(hQDB, 0, qdbBuf);
if (ptRes)
{
if( 0 < qdb_rows(ptRes))
{
switch((unsigned short)(qdb_cell(ptRes, 0, 0)))
{
case MME_SLOTTYPE_USB:
printf("MME_SLOTTYPE_USB\n");
break;
case MME_SLOTTYPE_CD:
printf("MME_SLOTTYPE_CD Source\n");
break;
case MME_SLOTTYPE_MEDIAFS:
printf("MME_SLOTTYPE_MEDIAFS Source\n");
break;
case MME_SLOTTYPE_FILESYSTEM:
printf("MME_SLOTTYPE_FILESYSTEM Source or SD Card\n");
break;
case MME_SLOTTYPE_BLUETOOTH:
printf("MME_SLOTTYPE_MEDIAFS Source\n");
break;
default:
printf("Default Source\n");
break;
}
}
Also Could You Please let me know how i post a Query myself with out associating to any other query.
I tried but could not get any option to post. - kandregula vijaya santhi
|
|
|
|
Re: Query related QDB - Client API usage
|
07/18/2013 10:26 AM
post103298
|
Re: Query related QDB - Client API usage
qdb_cell() returns a pointer (always). If it is a number, it will be a 64
bit number.
Try changing your switch statement to:
You need to change your switch statement to:
switch(*(uint64_t *)(qdb_cell(ptRes, 0, 0)))
There should be a button somewhere to create a new post?
Regards,
Gilles
|
|
|
|
Re: Query related QDB - Client API usage
|
07/19/2013 1:15 AM
post103314
|
Re: Query related QDB - Client API usage
Thank You Very Much Gilles.
Yes I missed the pointer.Now it is working.
|
|
|
|