CVS update: php3/functions

From: Date: Sun, 04 Oct 1998 12:11:13 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-1647@lists.php.net to get a copy of this message
Date: Sunday October 4, 1998 @ 8:11 Author: kk Update of /repository/php3/functions In directory asf:/u2/tmp/cvs-serv2655/functions Modified Files: mysql.c Log Message: mysql_field_flags now reports all MySQL FLAG values. The output format has changed incompatibly, but is now easier to parse. Index: php3/functions/mysql.c diff -c php3/functions/mysql.c:1.168 php3/functions/mysql.c:1.169 *** php3/functions/mysql.c:1.168 Sun Oct 4 07:27:17 1998 --- php3/functions/mysql.c Sun Oct 4 08:11:12 1998 *************** *** 27,33 **** +----------------------------------------------------------------------+ */ ! /* $Id: mysql.c,v 1.168 1998/10/04 11:27:17 kk Exp $ */ /* TODO: --- 27,33 ---- +----------------------------------------------------------------------+ */ ! /* $Id: mysql.c,v 1.169 1998/10/04 12:11:12 kk Exp $ */ /* TODO: *************** *** 1678,1683 **** --- 1678,1685 ---- MYSQL_RES *mysql_result; MYSQL_FIELD *mysql_field; int type; + char buf[512]; + int len; MySQL_TLS_VARS; if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &result, &field)==FAILURE) { *************** *** 1724,1745 **** return_value->type = IS_STRING; break; case PHP3_MYSQL_FIELD_FLAGS: ! if (IS_NOT_NULL(mysql_field->flags) && IS_PRI_KEY(mysql_field->flags)) { ! return_value->value.str.val = estrndup("primary key not null",20); ! return_value->value.str.len = 20; ! return_value->type = IS_STRING; ! } else if (IS_NOT_NULL(mysql_field->flags)) { ! return_value->value.str.val = estrndup("not null",8); ! return_value->value.str.len = 8; ! return_value->type = IS_STRING; ! } else if (IS_PRI_KEY(mysql_field->flags)) { ! return_value->value.str.val = estrndup("primary key",11); ! return_value->value.str.len = 11; ! return_value->type = IS_STRING; ! } else { ! var_reset(return_value); } break; default: RETURN_FALSE; } --- 1726,1799 ---- return_value->type = IS_STRING; break; case PHP3_MYSQL_FIELD_FLAGS: ! strcpy(buf, ""); ! #ifdef IS_NOT_NULL ! if (IS_NOT_NULL(mysql_field->flags)) { ! strcat(buf, "not_null "); ! } ! #endif ! #ifdef IS_PRI_KEY ! if (IS_PRI_KEY(mysql_field->flags)) { ! strcat(buf, "primary_key "); ! } ! #endif ! #ifdef UNIQUE_KEY_FLAG ! if (mysql_field->flags&UNIQUE_KEY_FLAG) { ! strcat(buf, "unique_key "); ! } ! #endif ! #ifdef MULTIPLE_KEY_FLAG ! if (mysql_field->flags&MULTIPLE_KEY_FLAG) { ! strcat(buf, "multiple_key "); ! } ! #endif ! #ifdef IS_BLOB ! if (IS_BLOB(mysql_field->flags)) { ! strcat(buf, "blob "); ! } ! #endif ! #ifdef UNSIGNED_FLAG ! if (mysql_field->flags&UNSIGNED_FLAG) { ! strcat(buf, "unsigned "); ! } ! #endif ! #ifdef ZEROFILL_FLAG ! if (mysql_field->flags&ZEROFILL_FLAG) { ! strcat(buf, "zerofill "); } + #endif + #ifdef BINARY_FLAG + if (mysql_field->flags&BINARY_FLAG) { + strcat(buf, "binary "); + } + #endif + #ifdef ENUM_FLAG + if (mysql_field->flags&ENUM_FLAG) { + strcat(buf, "enum "); + } + #endif + #ifdef AUTO_INCREMENT_FLAG + if (mysql_field->flags&AUTO_INCREMENT_FLAG) { + strcat(buf, "auto_increment "); + } + #endif + #ifdef TIMESTAMP_FLAG + if (mysql_field->flags&TIMESTAMP_FLAG) { + strcat(buf, "timestamp "); + } + #endif + len = strlen(buf); + /* remove trailing space, if present */ + if (len && buf[len-1] == ' ') { + buf[len-1] = 0; + len--; + } + + return_value->value.str.len = len; + return_value->value.str.val = estrndup(buf, len); + return_value->type = IS_STRING; break; + default: RETURN_FALSE; } -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#1647) next »