Native D MySQL Driver

Steve Teale steve.teale at britseyeview.com
Fri Nov 4 12:05:03 PDT 2011


On Fri, 04 Nov 2011 10:19:23 -0700, bls wrote:

> On 11/04/2011 09:25 AM, Steve Teale wrote:
>>   I don't think you need to worry
>> about changes while stepping through rows.
>

As in don't worry about something over which you have no control!

> However, there are always many ways to skin a cat. PostgreSQL, Firebird,
> MSSQL Server (not sure about MySQL) enable you to trigger server side
> events.
> Means the database server fires an update event (say employee deleted
> event) and a D function living in a secondary thread will catch this
> event and inform all interested parties (subscribers**) to refresh their
> RowSet. (and of course the UI)
> 
> Beside, this is the way we create mission critical,db-centric realtime
> apps. works fine.
> My 2 cents.

Bjoern
 
There's not a hint of that in the MySQL protocol. It'a purely command/
response. The commands are:

0x00   COM_SLEEP           (none, this is an internal thread state)
0x01   COM_QUIT            mysql_close
0x02   COM_INIT_DB         mysql_select_db 
0x03   COM_QUERY           mysql_real_query
0x04   COM_FIELD_LIST      mysql_list_fields
0x05   COM_CREATE_DB       mysql_create_db (deprecated)
0x06   COM_DROP_DB         mysql_drop_db (deprecated)
0x07   COM_REFRESH         mysql_refresh
0x08   COM_SHUTDOWN        mysql_shutdown
0x09   COM_STATISTICS      mysql_stat
0x0a   COM_PROCESS_INFO    mysql_list_processes
0x0b   COM_CONNECT         (none, this is an internal thread state)
0x0c   COM_PROCESS_KILL    mysql_kill
0x0d   COM_DEBUG           mysql_dump_debug_info
0x0e   COM_PING            mysql_ping
0x0f   COM_TIME            (none, this is an internal thread state)
0x10   COM_DELAYED_INSERT  (none, this is an internal thread state)
0x11   COM_CHANGE_USER     mysql_change_user
0x12   COM_BINLOG_DUMP     sent by the slave IO thread to request a binlog
0x13   COM_TABLE_DUMP      LOAD TABLE ... FROM MASTER (deprecated)
0x14   COM_CONNECT_OUT     (none, this is an internal thread state)
0x15   COM_REGISTER_SLAVE  sent by the slave to register ...)
0x16   COM_STMT_PREPARE    mysql_stmt_prepare
0x17   COM_STMT_EXECUTE    mysql_stmt_execute
0x18   COM_STMT_SEND_LONG_DATA mysql_stmt_send_long_data
0x19   COM_STMT_CLOSE      mysql_stmt_close
0x1a   COM_STMT_RESET      mysql_stmt_reset
0x1b   COM_SET_OPTION      mysql_set_server_option
0x1c   COM_STMT_FETCH      mysql_stmt_fetch

I don't see a 'let me know when something happens' command here. There is 
also no trace of it in the C API.

Maybe it's unsophisticated, but it's popular, and that's the beast I'm 
dealing with.

Your point is in fact in support of what I was saying. Why the hell allow 
the user to get 2^^64 rows when they're going to be out of date before 
they've been got together!

Steve


More information about the Digitalmars-d mailing list