• Welcome to SQLitening Support Forum.
 

News:

Welcome to the SQLitening support forums!

Main Menu

I need unicode version for SQLiteningU.Dll

Started by yctsai, May 19, 2011, 04:49:46 AM

Previous topic - Next topic

yctsai

Hello,

Recently I have tested the SQLiteningU.Dll, everything is ok.

The API on SQLiteningU.Dll only accept ASCII string, and can't accept UNICODE string.
As the result, we can't pass SQL statements with unicode format which are commonly used in multi-language software.

Is it possible to provide another DLL that use UNICODE version of the WIN32 API?

(Note, every WIN32 API has ASCII and UNICODE version)

Have a nice day!


Fred Meier

The latest version of PowerBasic (PB 10) has enhanced Unicode support.  I will consider adding that support after I get that version.  No immediate plans.

Jean-Pierre LEROY

Hi Fred,

PowerBASIC 10 is there since a few months now.

Will you consider to make SQLitening Unicode compliant ?

Thanks,
Jean-Pierre

Fred Meier

Sorry, I did not respond early.  I looked at it and am not sure what your are asking for.  SQLite, as delivered for Windows has no special Unicode support. You, of course can store and retrieve Unicode data now.

This is from SQLite Frequently Asked Questions:
Quote(18) Case-insensitive matching of Unicode characters does not work.The default configuration of SQLite only supports case-insensitive comparisons of ASCII characters. The reason for this is that doing full Unicode case-insensitive comparisons and case conversions requires tables and logic that would nearly double the size of the SQLite library. The SQLite developers reason that any application that needs full Unicode case support probably already has the necessary tables and functions and so SQLite should not take up space to duplicate this ability.Instead of providing full Unicode case support by default, SQLite provides the ability to link against external Unicode comparison and conversion routines. The application can overload the built-in NOCASE collating sequence (using sqlite3_create_collation()) and the built-in like(), upper(), and lower() functions (using sqlite3_create_function()). The SQLite source code includes an "ICU" extension that does these overloads. Or, developers can write their own overloads based on their own Unicode-aware comparison routines already contained within their project.

How can SQLitening better support Unicode in the current SQLite?


Jean-Pierre LEROY

Hi Fred,

I just start to convert one project to Unicode using the new PB Unicode string types : wString and wStringz.

I get an error message with some SQLitening functions like :

slGetFile() or slPutFile() where I can't use wString variables.

Jean-Pierre.

Fred Meier


Fred Meier

#6
SQLitening, nor the SQLite version used within, understand Unicode but both will store and retrieve Unicode data just fine.

There are two ways you can store/retrieve Unicode data using the WString PowerBasic data types:

1. Include the following declares in your program:
Declare Function slBuildBindDatW lib "SQLitening.Dll" alias "slBuildBindDat" (byref rsData as WString, optional byval rsModChars as String) as String
Declare Function slPutFileW lib "SQLitening.Dll" alias "slPutFile" (byref rsFileName as String, byref rsFileData as WString, optional byval rsModChars as String) as Long
Declare Function slGetFileW lib "SQLitening.Dll" alias "slGetFile" (byref rsFileName as String, byref wsFileData as WString, optional byval rsModChars as String) as Long
Declare Function slFNW lib "SQLitening.Dll" alias "slFN" (byref rsColumnName as String, optional byval rlSetNumber as Long) as WString
Declare Function slFNXW lib "SQLitening.Dll" alias "slFNX" (byref rsColumnName as String, optional byval rsModChars as String, optional byval rlSetNumber as Long) as WString

You may call the functions anything you like, I just suffixed each with a 'W'.  These declares allow you use the WString data type.

2. Use the following routines to copy your WString/String data types to String/WString data types before/after calling SQLitening.
Function CopyA2U(rsA as String) as WString
' This will copy the passed ANSI string to the retruning Unicode string without
' doing any conversion.
   
   Local lspU as WString Ptr

   lspU = varptr(rsA)
   function = @lspU
   
End Function

Function CopyU2A(rsU as WString) as String
' This will copy the passed Unicode string to the retruning ANSI string without
' doing any conversion.

   Local lspA as String Ptr

   lspA = varptr(rsU)
   function = @lspA
   
End Function


Either way will accomplish the same thing.  I prefer #1 cause it will perform a little better and is probably better documentation.

Let me know how this works and any opinions if I should add the declares to SQLitening.Inc.

Fred Meier

Jean-Pierre

Have you had a chance to try either of the two methods in the previous post?

Jean-Pierre LEROY

Hi Fred,

I'll do some tests this week-end and will give my feedback later.

Jean-Pierre

Jean-Pierre LEROY

I'm still doing some testing ... but so far so good with the new declares.

I'll report completely later.

Jean-Pierre

Jean-Pierre LEROY

Hi Fred,

I'm sorry to come to you so late on this subject.

I have two questions:

Q1. In the declare you mentioned the lib "AxSQLitening.dll"; I think it's "SQLitening.dll ?
Q2. For the functions slPutFileW() and slGetFileW() the FileName are still declared as string; is-it possible to declare them as wString ?

Thanks,
Jean-Pierre

Fred Meier

QuoteQ1. In the declare you mentioned the lib "AxSQLitening.dll"; I think it's "SQLitening.dll ?
You are right.  I have modified the above post.
QuoteQ2. For the functions slPutFileW() and slGetFileW() the FileName are still declared as string; is-it possible to declare them as wString ?
No, you would have to write new functions.