In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

Not able to use " (double quotes) in new version

Xailer English public forum
Responder
Milan Mehta
Mensajes: 132
Registrado: Dom Dic 27, 2009 9:54 am

Not able to use " (double quotes) in new version

Mensaje por Milan Mehta »

I have just updated my xailer Enterprise Edition.

While trying to recompile all my projects, I noticed one big change :
I am not allowed to use " (double quote) in the SQL.

I have used it extensively. In fact hb_vartoexp() function puts " mark in the result.

What is the way out ?

TIA
Milan.
Milan Mehta
Mensajes: 132
Registrado: Dom Dic 27, 2009 9:54 am

Re: Not able to use " (double quotes) in new version

Mensaje por Milan Mehta »

This is happening with SqLite Data Source only.

However, it is working fine with MySQL / Maria Databases.
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: Not able to use " (double quotes) in new version

Mensaje por ignacio »

Hello,

I had the same problem. Is a change of behaviour of SQLite:

Double-quoted String Literals Are Accepted
The SQL standard requires double-quotes around identifiers and single-quotes around string literals. For example:

"this is a legal SQL column name"
'this is an SQL string literal'
SQLite accepts both of the above. But, in an effort to be compatible with MySQL 3.x (which was one of the most widely used RDBMSes when SQLite was first being designed) SQLite will also interpret a double-quotes string as string literal if it does not match any valid identifier.

This misfeature means that a misspelled double-quoted identifier will be interpreted as a string literal, rather than generating an error. It also lures developers who are new to the SQL language into the bad habit of using double-quoted string literals when they really need to learn to use the correct single-quoted string literal form.

In hindsight, we should not have tried to make SQLite accept MySQL 3.x syntax, and should have never allowed double-quoted string literals. However, there are countless applications that make use of double-quoted string literals and so we continue to support that capability to avoid breaking legacy.

As of SQLite 3.27.0 (2019-02-07) the use of a double-quoted string literal causes a warning message to be sent to the error log.

As of SQLite 3.29.0 (2019-07-10) the use of double-quoted string literals can be disabled at run-time using the SQLITE_DBCONFIG_DQS_DDL and SQLITE_DBCONFIG_DQS_DML actions to sqlite3_db_config(). The default settings can be altered at compile-time using the -DSQLITE_DQS=N compile-time option. Application developers are encouraged to compile using -DSQLITE_DQS=0 in order to disable the double-quoted string literal misfeature by default. If that is not possible, then disable double-quoted string literals for individual database connections using C-code like this:

sqlite3_db_config(db, SQLITE_DBCONFIG_DQS_DDL, 0, (void*)0);
sqlite3_db_config(db, SQLITE_DBCONFIG_DQS_DML, 0, (void*)0);
Or, if double-quoted string literals are disabled by default, but need to be selectively enabled for some historical database connections, that can be done using the same C-code as shown above except with the third parameter changed from 0 to 1.
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Milan Mehta
Mensajes: 132
Registrado: Dom Dic 27, 2009 9:54 am

Re: Not able to use " (double quotes) in new version

Mensaje por Milan Mehta »

Can you please shed some more light on the following Statement:

"The default settings can be altered at compile-time using the -DSQLITE_DQS=N compile-time option. Application developers are encouraged to compile using -DSQLITE_DQS=0 in order to disable the double-quoted string literal misfeature by default."

I have tons of legacy programs in which I have used HB_ValToExp() function in the construction of SQL, which typically uses double-quotes. It is an almost impossible task to change them.

In order to compile such programs in the new Xailer, what command should I use at the time of compilation in Project -> Project Properties -> Harbour ?

Kindly guide.
TIA
Milan.
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: Not able to use " (double quotes) in new version

Mensaje por ignacio »

Hi,

Please test with the file attached. There is a new property on TSqlite class with the name: lDoubleQuotes. You must set its value to .T. before opening the datasource.

Just include the .O files in your project. Any feedback will be highly appreciated.

Regards,
Adjuntos
Sqlite.zip
(26.12 KiB) Descargado 135 veces
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Milan Mehta
Mensajes: 132
Registrado: Dom Dic 27, 2009 9:54 am

Re: Not able to use " (double quotes) in new version

Mensaje por Milan Mehta »

I have linked both SQLite.o and lSQLite.o into the project.

I am getting following Error :

C:/Xailer7.1.3/Lib/libxailer.a(Win9XFiles.o):(.text+0x7a4): undefined reference to `_imp__FindNextFileX@8'
C:/Xailer7.1.3/Lib/libxailer.a(Win9XFiles.o):(.text+0x98f): undefined reference to `_imp__CreateFileX@28'
C:/Xailer7.1.3/Lib/libxailer.a(Win9XFiles.o):(.text+0x9a9): undefined reference to `_imp__GetFileAttributesX@4'
C:/Xailer7.1.3/Lib/libxailer.a(Win9XFiles.o):(.text+0x9bd): undefined reference to `_imp__SetFileAttributesX@8'
C:/Xailer7.1.3/Lib/libxailer.a(Win9XFiles.o):(.text+0x9dd): undefined reference to `_imp__DeleteFileX@4'
C:/Xailer7.1.3/Lib/libxailer.a(Win9XFiles.o):(.text+0x9f7): undefined reference to `_imp__MoveFileX@8'
C:/Xailer7.1.3/Lib/libxailer.a(Win9XFiles.o):(.text+0xa11): undefined reference to `_imp__CreateDirectoryX@8'
C:/Xailer7.1.3/Lib/libxailer.a(Win9XFiles.o):(.text+0xa25): undefined reference to `_imp__GetCurrentDirectoryX@8'
C:/Xailer7.1.3/Lib/libxailer.a(Win9XFiles.o):(.text+0xa45): undefined reference to `_imp__SetCurrentDirectoryX@4'
C:/Xailer7.1.3/Lib/libxailer.a(Win9XFiles.o):(.text+0xa5f): undefined reference to `_imp__RemoveDirectoryX@4'
C:/Xailer7.1.3/Lib/libxailer.a(Win9XFiles.o):(.text+0xa79): undefined reference to `_imp__GetTempFileNameX@16'
C:/Xailer7.1.3/Lib/libxailer.a(Win9XFiles.o):(.text+0xa8d): undefined reference to `_imp__GetTempPathX@8'
C:/Xailer7.1.3/Lib/libxailer.a(Win9XFiles.o):(.text+0xaa7): undefined reference to `_imp__FindFirstFileX@8'

Kindly guilde.
TIA
Milan Mehta.
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: Not able to use " (double quotes) in new version

Mensaje por ignacio »

Hi,

I'm not able to reproduce your error. Please try with a new sample project.
Imagen 349.png
Imagen 349.png (9.61 KiB) Visto 2443 veces
BTW, I can confirm that the new SQLITE class module handles correctly your problem with that new property.

Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Milan Mehta
Mensajes: 132
Registrado: Dom Dic 27, 2009 9:54 am

Re: Not able to use " (double quotes) in new version

Mensaje por Milan Mehta »

Please find attached a new small sample project.
Can you please try this ? It still gives me errors as above.

TIA
Milan.
Adjuntos
XailerDemo.rar
(99.26 KiB) Descargado 131 veces
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: Not able to use " (double quotes) in new version

Mensaje por ignacio »

Hi,

Working fine with some changes:

1) Updated datasource cConnect path value
2) Table does not exist, so I use 'acmast' instead
3) Changed fieldname to 'ecomoperator'. SQL string:

Código: Seleccionar todo

cSql := ' Select * from acmast where ' + HB_VALTOEXP(cField) + " = 'N' "
Result:
Imagen 350.png
Imagen 350.png (9.79 KiB) Visto 2428 veces
Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Milan Mehta
Mensajes: 132
Registrado: Dom Dic 27, 2009 9:54 am

Re: Not able to use " (double quotes) in new version

Mensaje por Milan Mehta »

The problem has been solved!
Many Many thanks.
Milan Mehta.
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: Not able to use " (double quotes) in new version

Mensaje por ignacio »

Great!!
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Responder