64-bit zval type

php.internals

Ard Biesheuvel

23 years ago
Is there a 64-bit integer zval, or is it expected in the near future ? (Need it for BLOB handling in Interbase) Ard

(Marcus Börger)

23 years ago
Hello Ard, Sunday, August 17, 2003, 12:15:25 PM, you wrote: AB> Is there a 64-bit integer zval, or is it expected in the near future ? AB> (Need it for BLOB handling in Interbase) Only on 64bit machines there is. But you can use mumeric strings for that as ext/pgsql does.
-- Best regards, Marcus mailto:helly@php.net

Ard Biesheuvel

23 years ago
> AB> Is there a 64-bit integer zval, or is it expected in the near future ? > AB> (Need it for BLOB handling in Interbase) > > Only on 64bit machines there is.
You mean because long == int64 on 64-bit architectures, right ?
> But you can use mumeric strings for that as ext/pgsql does.
Not really, in my case. Right now, if you create a BLOB, the C-struct describing it internally is cast to a zval_string and returned to user-space. I think this is bad. Apart from the fact that you get memory adresses and stuff in the script context, it also means that the value returned has no meaning whatsoever to Interbase itself. Furthermore, if you try to insert a BLOB-value directly that has exactly the sizeof(C-struct), it will be cast as such, and a bogus BLOB handle will be inserted into the database. I would like to improve this by returning the Interbase-assigned BLOB handle directly. The stuff from the struct would have to be stored in a map<handle,C-struct>, probably implemented by using a hash. The size of a BLOB-handle is 64-bits. (Although currently implemented as a struct containing two int32's in Interbase) However, currently Interbase supports inserting strings into BLOB fields directly (which is very useful, BTW, apart from the abovementioned pitfal). If I use strings to represent BLOB handles as well as BLOBs themselves, I would have to distinguish between a BLOB handle and the BLOB itself by looking at the string. If the handle would be a real int64, that wouldn't be a problem. Ard

(Marcus Börger)

23 years ago
Hello Ard, Sunday, August 17, 2003, 1:04:05 PM, you wrote:
>> AB> Is there a 64-bit integer zval, or is it expected in the near future ? >> AB> (Need it for BLOB handling in Interbase) >> >> Only on 64bit machines there is.
AB> You mean because long == int64 on 64-bit architectures, right ? yes, so it's not portable
>> But you can use mumeric strings for that as ext/pgsql does.
AB> Not really, in my case. Anyway php is a weak typed language which means numeric strings and integers are interchangeably usable. As a consequence it is possible but with very much work at c level (i didn't say it's easy).
-- Best regards, Marcus mailto:helly@php.net