Showing posts with label Length. Show all posts
Showing posts with label Length. Show all posts

Various Sizes And Lengths In Database



But, it is suggested to use 30 as maximum column name length in SQL Server.

Feature, SQL Server 2000, Oracle 9i Database

database name length, 128, 8
column name length, 128, 30
index name length, 128, 30
table name length, 128, 30
view name length, 128, 30
stored procedure name length, 128, 30
max columns per index, 16, 32
max char() size 8000, 2000
max varchar() size, 8000, 4000
max columns per table, 1024, 1000
max table row length, 8036, 255000
max query size, 16777216, 16777216
recursive subqueries, 40, 64
constant string size in SELECT, 16777207, 4000
constant string size in WHERE, 8000, 4000


http://www.mssqlcity.com/Articles/Compare/sql_server_vs_oracle.htm

Stop Using for…in Loop Statement to Iterate Array In JavaScript

for…in loop statement is working fine. The problem is it does not work with Prototype. So standard loop statement is encouraged:

; for (var index=0; index { ; var item = myArray[index]
// Your code working on item here...
}

In addition, if the array is so large, each time to check the length will be so costly. Use following statement instead:

; for (var index=0, len=myArray.length; index { ; var item = myArray[index]
// Your code working on item here...
}


http://www.prototypejs.org/api/array

Number of Elements of Array

Number of elements of array is very usual, which can be used as control for the loop or other purposes. Function to get it in JavaScript is varArray.length. In PHP it is count($ varArray) or sizeof($ varArray). Since sizeof() is just an alias of count(), it is suggested using count(), since sizeof() has other meaning in other languages.

The problem happens when array is undefined/not exist. In JavaScript .length would generate a fatal error. So, for save play, it is suggested always using follow codes:

var len = 0;
if ('undefined'!=typeof(varArray)) len = varArray.length;

In PHP count() would generate a return value of 0 together with a non-fatal error message, which would cause even more serious problem because of its non-fatal nature. Fortunately, PHP provides an easy non-fatal error message suppress method “@”:

@count($varArray);

It is very useful because it enables you to always associate @ with count(). And please do so.

For multidimensional array, the usage will be exactly same; and can be used for particular dimension, such as varArray[i] or $varArray[i].

Labels