got a multi languagel site.
my aproach was to create
CREATE TABLE [dbo].[languages](
[lang] [nvarchar](3) NOT NULL,
[lang1] [nvarchar](200) NULL,
[lang2] [nvarchar](200) NULL,
[lang3] [nvarchar](200) NULL,
[lang4] [nvarchar](200) NULL,
........................
<SNIP>
........................
[lang310] [nvarchar](200) NULL
) ON [PRIMARY]
have first row language identifier ( [lang] [nvarchar](3) NOT NULL,) and
rest as language source so lang2 to lang310 would have translations
if i want to add another lang i would just add another row with that
language
and my calssic asp function is
getLang("lang1","en")
-----------------------------------------------------------------------------------------------
Function getLang(myInput,myLang)
Set MyCacheForLanguages = New DataCache
MyCacheForLanguages.ConnectionString = SqlConn
LanguagesSQL = "SELECT * FROM languages where lang='"&myLang&"'"
Set CacheRsForLanguages = MyCacheForLanguages.GetRecordset(LanguagesSQL)
Do While not CacheRsForLanguages.EOF
For i = 0 To CacheRsForLanguages.Fields.Count - 1
If CacheRsForLanguages.Fields.Item(i).name=myInput Then
getLang = CacheRsForLanguages.Fields.Item(i).value
Exit for
End if
Next
CacheRsForLanguages.MoveNext
Loop
Set CacheRsForLanguages = Nothing
Set MyCacheForLanguages = Nothing
End function
note New DataCache , it is memory caching class i use
----------------------------------------------------------------------------------------------
this combination works fine when i have couple of coulmns in language table
but i have over 300 columns and looping slowes server down.
i need another approach to make this combination faster. may be in function
or in select statement.
can anyone think of something faster without changing table stracture 5 1436
i thing
altering function as
getLang = CacheRsForLanguages.Fields.Item(myInput).value
and removing loop would do
".nLL" <no***@here.comwrote in message
news:c3*********************@newsfe17.ams2...
got a multi languagel site.
my aproach was to create
CREATE TABLE [dbo].[languages](
[lang] [nvarchar](3) NOT NULL,
[lang1] [nvarchar](200) NULL,
[lang2] [nvarchar](200) NULL,
[lang3] [nvarchar](200) NULL,
[lang4] [nvarchar](200) NULL,
........................
<SNIP>
........................
[lang310] [nvarchar](200) NULL
) ON [PRIMARY]
have first row language identifier ( [lang] [nvarchar](3) NOT NULL,) and
rest as language source so lang2 to lang310 would have translations
if i want to add another lang i would just add another row with that
language
and my calssic asp function is
getLang("lang1","en")
-----------------------------------------------------------------------------------------------
Function getLang(myInput,myLang)
Set MyCacheForLanguages = New DataCache
MyCacheForLanguages.ConnectionString = SqlConn
LanguagesSQL = "SELECT * FROM languages where lang='"&myLang&"'"
Set CacheRsForLanguages = MyCacheForLanguages.GetRecordset(LanguagesSQL)
Do While not CacheRsForLanguages.EOF
For i = 0 To CacheRsForLanguages.Fields.Count - 1
If CacheRsForLanguages.Fields.Item(i).name=myInput Then
getLang = CacheRsForLanguages.Fields.Item(i).value
Exit for
End if
Next
CacheRsForLanguages.MoveNext
Loop
Set CacheRsForLanguages = Nothing
Set MyCacheForLanguages = Nothing
End function
note New DataCache , it is memory caching class i use
----------------------------------------------------------------------------------------------
this combination works fine when i have couple of coulmns in language
table
but i have over 300 columns and looping slowes server down.
i need another approach to make this combination faster. may be in
function
or in select statement.
can anyone think of something faster without changing table stracture
".nLL" <no***@here.comwrote in message
news:c3*********************@newsfe17.ams2...
got a multi languagel site.
my aproach was to create
CREATE TABLE [dbo].[languages](
[lang] [nvarchar](3) NOT NULL,
[lang1] [nvarchar](200) NULL,
[lang2] [nvarchar](200) NULL,
[lang3] [nvarchar](200) NULL,
[lang4] [nvarchar](200) NULL,
........................
<SNIP>
........................
[lang310] [nvarchar](200) NULL
) ON [PRIMARY]
<snip>
How does one express profuse head-shaking using only 7-bit ASCII? Aaaaaargh!
Try applying some logic to the problem, and you'll find a far more elegant
'n' functional solution, infinitely easier to manage, and massively more
scalable.
CREATE TABLE Languages (
ID int IDENTITY(1,1) NOT NULL,
Lang nvarchar(5) NOT NULL,
Phrase nvarchar(200) NOT NULL)
......
FUNCTION getLang(iPhrase, sLang)
'--- assumes cDB is an already-established database connection
'--- input value sanitisation should be implemented!
sFunctionResult = ""
SET rsResult = cDB.Execute("SELECT Phrase FROM Languages WHERE ID=" &
iPhrase & " AND Lang='" & sLang & "'")
IF NOT rsResult.EOF THEN
sFunctionResult = rsResult("Phrase")
END IF
SET rsResult = NOTHING
getLang = sFunctionResult
END FUNCTION
Oops, force o' habit got in the way here; amended version follows at bottom.
"Bob Milutinovic" <co******@gmail.comwrote in message
news:O5**************@TK2MSFTNGP05.phx.gbl...
".nLL" <no***@here.comwrote in message
news:c3*********************@newsfe17.ams2...
>got a multi languagel site. my aproach was to create
CREATE TABLE [dbo].[languages]( [lang] [nvarchar](3) NOT NULL, [lang1] [nvarchar](200) NULL, [lang2] [nvarchar](200) NULL, [lang3] [nvarchar](200) NULL, [lang4] [nvarchar](200) NULL, ........................ <SNIP> ........................ [lang310] [nvarchar](200) NULL ) ON [PRIMARY]
<snip>
How does one express profuse head-shaking using only 7-bit ASCII?
Aaaaaargh!
Try applying some logic to the problem, and you'll find a far more elegant
'n' functional solution, infinitely easier to manage, and massively more
scalable.
CREATE TABLE Languages (
ID int IDENTITY(1,1) NOT NULL,
PhraseID int NOT NULL,
Lang nvarchar(5) NOT NULL,
Phrase nvarchar(200) NOT NULL)
......
FUNCTION getLang(iPhrase, sLang)
'--- assumes cDB is an already-established database connection
'--- input value sanitisation should be implemented!
sFunctionResult = ""
SET rsResult = cDB.Execute("SELECT Phrase FROM Languages WHERE PhraseID="
& iPhrase & " AND Lang='" & sLang & "'")
IF NOT rsResult.EOF THEN
sFunctionResult = rsResult("Phrase")
END IF
SET rsResult = NOTHING
getLang = sFunctionResult
END FUNCTION
"Bob Milutinovic" <co******@gmail.comwrote in message
news:e1**************@TK2MSFTNGP06.phx.gbl...
Oops, force o' habit got in the way here; amended version follows at
bottom.
>
"Bob Milutinovic" <co******@gmail.comwrote in message
news:O5**************@TK2MSFTNGP05.phx.gbl...
".nLL" <no***@here.comwrote in message
news:c3*********************@newsfe17.ams2...
got a multi languagel site.
my aproach was to create
CREATE TABLE [dbo].[languages](
[lang] [nvarchar](3) NOT NULL,
[lang1] [nvarchar](200) NULL,
[lang2] [nvarchar](200) NULL,
[lang3] [nvarchar](200) NULL,
[lang4] [nvarchar](200) NULL,
........................
<SNIP>
........................
[lang310] [nvarchar](200) NULL
) ON [PRIMARY]
<snip>
How does one express profuse head-shaking using only 7-bit ASCII?
Aaaaaargh!
Try applying some logic to the problem, and you'll find a far more
elegant
'n' functional solution, infinitely easier to manage, and massively more
scalable.
CREATE TABLE Languages (
ID int IDENTITY(1,1) NOT NULL,
PhraseID int NOT NULL,
Lang nvarchar(5) NOT NULL,
Phrase nvarchar(200) NOT NULL)
You can also ditch the ID column and place the PK across the PhraseID and
Lang columns. ;)
--
Anthony Jones - MVP ASP/ASP.NET
thank you very much
"Bob Milutinovic" <co******@gmail.comwrote in message
news:e1**************@TK2MSFTNGP06.phx.gbl...
Oops, force o' habit got in the way here; amended version follows at
bottom.
"Bob Milutinovic" <co******@gmail.comwrote in message
news:O5**************@TK2MSFTNGP05.phx.gbl...
>".nLL" <no***@here.comwrote in message news:c3*********************@newsfe17.ams2...
>>got a multi languagel site. my aproach was to create
CREATE TABLE [dbo].[languages]( [lang] [nvarchar](3) NOT NULL, [lang1] [nvarchar](200) NULL, [lang2] [nvarchar](200) NULL, [lang3] [nvarchar](200) NULL, [lang4] [nvarchar](200) NULL, ........................ <SNIP> ........................ [lang310] [nvarchar](200) NULL ) ON [PRIMARY] <snip>
How does one express profuse head-shaking using only 7-bit ASCII? Aaaaaargh!
Try applying some logic to the problem, and you'll find a far more elegant 'n' functional solution, infinitely easier to manage, and massively more scalable.
CREATE TABLE Languages (
ID int IDENTITY(1,1) NOT NULL,
PhraseID int NOT NULL,
Lang nvarchar(5) NOT NULL,
Phrase nvarchar(200) NOT NULL)
.....
FUNCTION getLang(iPhrase, sLang)
'--- assumes cDB is an already-established database connection
'--- input value sanitisation should be implemented!
sFunctionResult = ""
SET rsResult = cDB.Execute("SELECT Phrase FROM Languages WHERE
PhraseID=" & iPhrase & " AND Lang='" & sLang & "'")
IF NOT rsResult.EOF THEN
sFunctionResult = rsResult("Phrase")
END IF
SET rsResult = NOTHING
getLang = sFunctionResult
END FUNCTION
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: nmac |
last post by:
Hi all, hopefully someone can offer some sagely advice regarding
Production use of Jakarta's Tomcat.
First, some brief background.
My company have a servlet application that connects to a MySQL...
|
by: Tober |
last post by:
Anyone happen to know of any good books on performance tuning for
MS-SQL 2000? I am currently building a Cognos datawarehouse and would
like to ensure that the db is tuned for peak performance.
...
|
by: pheonix1t |
last post by:
hello,
I've been assigned to do performance tuning on an SQL2000 database
(around 10GB in size, several instances).
So far, I see a single RAID5 array, 4CPU (xeon 700MHZ), 4GB RAM.
I see the...
|
by: Fusheng Wang |
last post by:
Hi,
I have an insert intensive database, and it seems that the performance is a
problem.
Any suggestions on performance tuning on insert performance?
Thanks a lot!
Frank
|
by: sacha.prins |
last post by:
Hi,
I read a lot about DB2 INSERT performance here. I have a nice story as
well.
The thing is, I work on 2 installations of DB2 (on completely different
locations) which run on different (but...
|
by: Jeff S |
last post by:
I'm looking for guidance (tutorials, backgrounders, tips, or otherwise) on
measuring the performance of ASP.NET applications. I'm specifically
interested in acquiring the capability of generating...
|
by: hpw |
last post by:
Hi all,
i'm looking for a good book about .net Performance Tuning.
Things that should be covered by this book:
- Glean information about your program's behavior from profiling tools
-...
|
by: atlaste |
last post by:
Hi,
I'm currently developing an application that uses a lot of
computational power, disk access and memory caching (to be more exact:
an information retrieval platform). In these kind of...
|
by: Hevan |
last post by:
Sql performance tuning in DB2
Table Trans has multiplle records for each employee. I am updating id into lookup from trans .
Currently, it takes 3 minutes to update lookup table. Both lookup and...
|
by: 73k5blazer |
last post by:
Hello again all..
We have a giant application from a giant software vendor that has very
poor SQL.
It's a PLM CAD application, that makes a call to the db for every cad
node in the assembly.
So...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |