Yasuo Ohgaki wrote: > I forgot to send the patch to the maintainer > and the author, but I guess they > noticed patch in php-dev. > http://marc.theaimsgroup.com/?l=php-dev&m=100483599714646&w=2
I would like to hear from Jouni and Zeev how you think about async qeury and how it should be implemented. I didn't want to touch existing code as much as possible. I'll fix issues, such as clean up garbeges with async functions, later on when design is fixed :) It does not change existing code. Therefore, it's safe to apply to pgsql module to see how it can be useful. (Benchmark result is exellent even without async connect function) I would like to add features step by step so that I can get feedback one by one, but if you prefer to commit it at once, I can do that, too. If nobody is working for async qeury now, I'll implement it includingfail safe garbage handling, proper warnings, etc before 4.2.0RC hopefully. What do you think? -- Yasuo Ohgaki > Anyway, the patch only includes functions that is easy to > implement. I'll make any change if it is desired, name, coding > style, etc. I'll make following changes. Please let me know, if > you think other changes are needed. > - add '_' to function names to confirm naming standard. > - add a protorype function defined in pgsql.c > - use zend_parse_parameters instead of zeng_get_parameters > > I'm planning to implement following functions to pgsql module in > addition to the patch already sent. > > Comments/Objections are welcome. > > (I'll write functions that will be accepted or nobody start > writing. :) > > == async query == > resource pg_aconnect(string conn_str) > Connect to db. (nonblocking) > > int pg_poll(resouce conn) > Poll async connection status. Return current status as constant. > PG_POLLING_ACTIVE > PG_POLLING_READING > PG_POLLING_WRITING > PG_POLLING_FAILED, > PG_POLLING_OK, > > This function is not be avilable to Windows unless libpq is > compiled with WIN32_NON_BLOCKING_CONNECTIONS. > > I'm not going to write interface for PQgetLineAsync. > Anyone need PQgetLineAsync, also? > > == other libpq interface == > int pg_status([resource conn]) > Check connection status. Return value is connestion status constant. > PG_CONNECTION_STARTED - connecting > PG_CONNECTION_MADE - connected > PG_CONNECTION_AWAITING_RESPONSE - connecting > PG_CONNECTION_AUTH_OK - connecting > PG_CONNECTION_SETENV - connecting > > int pg_reset([resource conn]) > Reconnect to db with the same value when connection is broken for > some reason. Anyone need for async version? > > array pg_info([resource conn]) > Get connection info as array. Return contents of PQconninfoOption > struct. > > == utility functions == > array pg_metadata(resource conn, string table [, int type]) > Get metadata from system catalog. Returns > array('field_name' => > array('id' => int, > 'type' => int, (data type id) > 'len' => int, (length, -1 for variable length) > 'notnull' => bool, > 'hasdefault' => bool)); > Does anyone need other metadata? > > array pg_convert(resource conn, string table, array fields [, int > option]) > Convert values in assoc array fields = array(field_name => > field_value) to appropriate format for SQL statement. Returns > array converted. > > Add slashes to string. Add quotes around string. Set field_value > to "NULL" for empty string, etc. If field_value is not set/empty > and field default defined in system catalog, set default value. > Raise warning if value is invalid for the field. For example, > malformed date, string for integer is invalid. > "option" is conversion option, > PG_CONV_CHECK - check only > PG_CONV_STRICT - raise warning for non faital error > PG_CONV_QUOTE - add quote around values for vchar, text datetime. > PG_CONV_SLASH - add slashes if it needed. > PG_CONV_NULLCHK - check values are defined for NOT NULL fields. > PG_CONV_NO_DEFAULT - ignore default value even if value is empty > string. > > I also would like to implement pg_insert(), pg_update(), > pg_delete(), pg_select() for simple query. These function will use > pg_convert() and pg_metadata() internally. > > == other == > Provide ini entry to trun on/off async functions. > I don't want to implement this, but I'm sure there will users use > aysnc functions on persistent connection improper manner... > > libpq is thread safe from pgsql 7.0 as long as different > connection is used. > > -- > Yasuo Ohgaki > > _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]