Welcome Guest, Not a member yet? Register   Sign In
mssql - active records - field lengths
#1

[eluser]Keeshond Loekie[/eluser]
I'm using the mssql driver to connect to the database...

Current issue is that the fields in the result set are being truncated to 255...

as far as I have been able to trace it might not be an issue with codeigniter itself.

Quote: function _fetch_assoc()
{
return mssql_fetch_assoc($this->result_id);
}

the mssql_fetch_assoc returns the record with the fields already truncated.

I'm just wondering if someone else already has had the same issue and was able to resolve it.


Anyway, I was hoping someone could give some ideas on how to investigate and solve the issue.

Thanks
#2

[eluser]Keeshond Loekie[/eluser]
I have found the cause of the issue and the solution:

http://www.php.net/manual/en/ref.mssql.php

Quote:marc at NOSPAM dot durdin dot net
19-Nov-2004 04:19
Buried away in the mssql_field_length documentation is an important limitation that it is certainly worth knowing about *BEFORE* you do any database design:

Note to Win32 Users: Due to a limitation in the underlying API used by PHP (MS DbLib C API), the length of VARCHAR fields is limited to 255. If you need to store more data, use a TEXT field instead.

SQL Server natively supports VARCHAR up to 8000 characters. Note that TEXT fields have substantially poorer performance (and are much more limited) than VARCHAR so you may want to design your databases accordingly...

You can also work around this limitation with the following:

-- for example, with MyVarCharField VARCHAR(1000)
SELECT CAST(MyVarCharField AS TEXT) FROM MyTable




Theme © iAndrew 2016 - Forum software by © MyBB