Re: [sqlite] how to get the Trigger's Raise err in Application

2009-11-01 Thread Nataraj S Narayan
Hi

The problem is solved after a recompile of QT with  options:-

-system-sqlite  -v -I//sqlite-3.6.17 -L//sqlite-3.6.17/.libs ,

whereas previously i had compiled sqlite as plugin.

Now the trigger message is caught promptly by :-

 sqlite3 *handle = *static_cast(v.data());
if (handle != 0)
{ // check that it is not NULL
qDebug("Error: %s", sqlite3_errmsg(handle));
QMessageBox::about(0,"Trigger",sqlite3_errmsg(handle));
}

regards

Nataraj

On Fri, Oct 30, 2009 at 6:50 PM, greensparker
 wrote:
>
> Jan,
>my system dont have any file named llibsqlite , in my filesystem
> but i have
>   /usr/lib/libsqlite.so
>   /usr/lib/libsqlite.so.0
>   /usr/lib/libsqlite.so.0.8.6
>   /usr/lib/libsqlite3.so
>   /usr/lib/libsqlite3.so.0.8.6
>
> my pro file have
>
> LIBS += /usr/lib/libsqlite.so
> INCLUDE +=/usr/include
> QT += sql
> HEADERS += mainMenu.h
> SOURCES += main.cpp \
>mainMenu.cpp
>
> And getting the following err
> mainMenu.o: In function `mainMenu::createMainMenu()':
> /home/bala/test1/mainMenu.cpp:69: undefined reference to `sqlite3_errmsg'
> collect2: ld returned 1 exit status
> make: *** [test] Error 1
>
>
> jan-118 wrote:
>>
>> afaik on unix you need this
>>
>> LIBS += -L/usr/lib -llibsqlite
>>
>>
>>
>> greensparker schrieb:
>>> Im in Debian Linux.,
>>> This is my pro file
>>>
>>> QT += sql
>>> LIBS +=/usr/lib/libsqlite.so
>>> INCLUDE +=/usr/include
>>> HEADERS += mainMenu.h
>>> SOURCES += main.cpp \
>>> mainMenu.cpp
>>>
>>> headers in my mainMenu.cpp file
>>>
>>> #include "mainMenu.h"
>>> #include 
>>> #include "DBConnection.h"
>>> #include// path = usr/local/include/sqlite3.h
>>>
>>> same err im getting
>>> :69: undefined reference to `sqlite3_errmsg'
>>> collect2: ld returned 1 exit status
>>>
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/how-to-get-the-Trigger%27s-Raise-err-in-Application-tp26091341p26129984.html
> Sent from the SQLite mailing list archive at Nabble.com.
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to get the Trigger's Raise err in Application

2009-10-30 Thread greensparker

Jan, 
my system dont have any file named llibsqlite , in my filesystem
but i have
   /usr/lib/libsqlite.so
   /usr/lib/libsqlite.so.0
   /usr/lib/libsqlite.so.0.8.6
   /usr/lib/libsqlite3.so
   /usr/lib/libsqlite3.so.0.8.6

my pro file have

LIBS += /usr/lib/libsqlite.so
INCLUDE +=/usr/include
QT += sql
HEADERS += mainMenu.h
SOURCES += main.cpp \
mainMenu.cpp

And getting the following err
mainMenu.o: In function `mainMenu::createMainMenu()':
/home/bala/test1/mainMenu.cpp:69: undefined reference to `sqlite3_errmsg'
collect2: ld returned 1 exit status
make: *** [test] Error 1


jan-118 wrote:
> 
> afaik on unix you need this
> 
> LIBS += -L/usr/lib -llibsqlite
> 
> 
> 
> greensparker schrieb:
>> Im in Debian Linux.,
>> This is my pro file
>> 
>> QT += sql
>> LIBS +=/usr/lib/libsqlite.so
>> INCLUDE +=/usr/include
>> HEADERS += mainMenu.h
>> SOURCES += main.cpp \
>> mainMenu.cpp
>> 
>> headers in my mainMenu.cpp file
>> 
>> #include "mainMenu.h"
>> #include 
>> #include "DBConnection.h"
>> #include// path = usr/local/include/sqlite3.h
>> 
>> same err im getting 
>> :69: undefined reference to `sqlite3_errmsg'
>> collect2: ld returned 1 exit status
>> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/how-to-get-the-Trigger%27s-Raise-err-in-Application-tp26091341p26129984.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to get the Trigger's Raise err in Application

2009-10-30 Thread Jan
afaik on unix you need this

LIBS += -L/usr/lib -llibsqlite



greensparker schrieb:
> Im in Debian Linux.,
> This is my pro file
> 
> QT += sql
> LIBS +=/usr/lib/libsqlite.so
> INCLUDE +=/usr/include
> HEADERS += mainMenu.h
> SOURCES += main.cpp \
> mainMenu.cpp
> 
> headers in my mainMenu.cpp file
> 
> #include "mainMenu.h"
> #include 
> #include "DBConnection.h"
> #include// path = usr/local/include/sqlite3.h
> 
> same err im getting 
> :69: undefined reference to `sqlite3_errmsg'
> collect2: ld returned 1 exit status
> 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to get the Trigger's Raise err in Application

2009-10-30 Thread greensparker

Im in Debian Linux.,
This is my pro file

QT += sql
LIBS +=/usr/lib/libsqlite.so
INCLUDE +=/usr/include
HEADERS += mainMenu.h
SOURCES += main.cpp \
mainMenu.cpp

headers in my mainMenu.cpp file

#include "mainMenu.h"
#include 
#include "DBConnection.h"
#include// path = usr/local/include/sqlite3.h

same err im getting 
:69: undefined reference to `sqlite3_errmsg'
collect2: ld returned 1 exit status

-- 
View this message in context: 
http://old.nabble.com/how-to-get-the-Trigger%27s-Raise-err-in-Application-tp26091341p26129536.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to get the Trigger's Raise err in Application

2009-10-30 Thread Jan
If your are on windows try this in your .pro file:

win32:LIBS += [yourpath]\libsqlite.lib
win32:INCLUDEPATH += [yourpath]\include

Check Qt docs on qmake for unix.

Jan

greensparker schrieb:
> jan Thnks fr ur support. I have included sqlite3.h.
> But getting the following err.
> 
> 69: undefined reference to`sqlite3_errmsg'
> 
> :-1: error: collect2: ld returned 1 exit status
> 
> How to resolve?
> 
> Thnks
> Bala
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to get the Trigger's Raise err in Application

2009-10-30 Thread greensparker

jan Thnks fr ur support. I have included sqlite3.h.
But getting the following err.

69: undefined reference to`sqlite3_errmsg'

:-1: error: collect2: ld returned 1 exit status

How to resolve?

Thnks
Bala
-- 
View this message in context: 
http://old.nabble.com/how-to-get-the-Trigger%27s-Raise-err-in-Application-tp26091341p26126588.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to get the Trigger's Raise err in Application

2009-10-29 Thread Jan
sqlite3.h

greensparker schrieb:
> what are the headers i need to add in QT , to get sqlite3 *handle syntax and
> sqlite3_errmsg working ??
> 
> 
> jan-118 wrote:
>> greensparker schrieb:
>>> i want the trigger's raise error in  QT call.
>> Try this in Qt:
>>
>> QString msg;
>> QVariant v = QSqlDatabase::database().driver()->handle();
>> sqlite3 *handle = *static_cast(v.data());
>> if (handle != 0)
>>  msg =sqlite3_errmsg(handle);
>>
>>
>> Jan
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>>
> 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to get the Trigger's Raise err in Application

2009-10-29 Thread greensparker

what are the headers i need to add in QT , to get sqlite3 *handle syntax and
sqlite3_errmsg working ??


jan-118 wrote:
> 
> greensparker schrieb:
>> i want the trigger's raise error in  QT call.
> 
> Try this in Qt:
> 
> QString msg;
> QVariant v = QSqlDatabase::database().driver()->handle();
> sqlite3 *handle = *static_cast(v.data());
> if (handle != 0)
>   msg =sqlite3_errmsg(handle);
> 
> 
> Jan
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/how-to-get-the-Trigger%27s-Raise-err-in-Application-tp26091341p26112586.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to get the Trigger's Raise err in Application

2009-10-28 Thread Jan
greensparker schrieb:
> i want the trigger's raise error in  QT call.

Try this in Qt:

QString msg;
QVariant v = QSqlDatabase::database().driver()->handle();
sqlite3 *handle = *static_cast(v.data());
if (handle != 0)
msg =sqlite3_errmsg(handle);


Jan
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to get the Trigger's Raise err in Application

2009-10-28 Thread greensparker

thnks igor ,

the return type of q.exe is bool

bool QSqlQuery::exec ( const QString & query )

q.lasterror() returned 
QSqlError(19, "Unable to fetch row", "constraint failed") 

I dont know how to track this.
i want the trigger's raise error in  QT call.

Thnks
Bala


Igor Tandetnik wrote:
> 
> greensparker wrote:
>> im using QT4.5 and sqlite3
>> 
>> im using BEFORE INSERT TRIGGER for validation purpose
>> [is it good idea to put validation on before_insert_trigger???]
> 
> You could have a CHECK constraint in the table definition instead.
> 
>> IN QT  im inserting as
>> q.exec("insert into PARAM_DETAILS(PARAM_CODE,PARAM_VALUE)
>> values(12,'9789')");
>> 
>> when i execute this insert code in sqlite3 cmd prompt , i got the error.
>> 
>> but how to capture  this err in APPLICAITON?
> 
> Check the return value of QSqlQuery::exec, see also QSqlQuery::lastError
> 
> Igor Tandetnik
> 
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/how-to-get-the-Trigger%27s-Raise-err-in-Application-tp26091341p26093874.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to get the Trigger's Raise err in Application

2009-10-28 Thread Igor Tandetnik
greensparker wrote:
> im using QT4.5 and sqlite3
> 
> im using BEFORE INSERT TRIGGER for validation purpose
> [is it good idea to put validation on before_insert_trigger???]

You could have a CHECK constraint in the table definition instead.

> IN QT  im inserting as
> q.exec("insert into PARAM_DETAILS(PARAM_CODE,PARAM_VALUE)
> values(12,'9789')");
> 
> when i execute this insert code in sqlite3 cmd prompt , i got the error.
> 
> but how to capture  this err in APPLICAITON?

Check the return value of QSqlQuery::exec, see also QSqlQuery::lastError

Igor Tandetnik


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] how to get the Trigger's Raise err in Application

2009-10-28 Thread greensparker

hi,
im using QT4.5 and sqlite3 

im using BEFORE INSERT TRIGGER for validation purpose
[is it good idea to put validation on before_insert_trigger???]

im generating err , when the validation fails

like 

create TRIGGER MobileValid BEFORE INSERT on PARAM_DETAILS
when new.PARAM_CODE=12
BEGIN   
SELECT RAISE(ABORT,'First Digit Should Be 9') where
substr(new.PARAM_VALUE,1,1)<>'9' ;
SELECT RAISE(ABORT,'Length Should Be 10') where
length(new.PARAM_VALUE)<>10 ;
END;

This is working fine.

My question is , how to get this TRIGGER RAISE ERROR in QT application?


IN QT  im inserting as
q.exec("insert into PARAM_DETAILS(PARAM_CODE,PARAM_VALUE)
values(12,'9789')");

when i execute this insert code in sqlite3 cmd prompt , i got the error.

but how to capture  this err in APPLICAITON?

pls guide me?

bala



-- 
View this message in context: 
http://www.nabble.com/how-to-get-the-Trigger%27s-Raise-err-in-Application-tp26091341p26091341.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users