Re: cvs: php4 /ext/fbsql php_fbsql.c
| From: | Andi Gutmans | Date: | Wed, 25 Apr 2001 20:18:25 +0000 |
| Subject: | Re: cvs: php4 /ext/fbsql php_fbsql.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-5262@lists.php.net to get a copy of this message | ||
Frank,
Don't forget not to use C++ comments.
Thanks,
Andi
At 06:01 PM 4/25/2001 +0000, Frank M. Kromann wrote:
fmk Wed Apr 25 11:01:23 2001 EDTModified files:/php4/ext/fbsql php_fbsql.cLog: make fbsql_field_flags return a value Index: php4/ext/fbsql/php_fbsql.c diff -u php4/ext/fbsql/php_fbsql.c:1.12 php4/ext/fbsql/php_fbsql.c:1.13--- php4/ext/fbsql/php_fbsql.c:1.12 Tue Apr 17 10:39:43 2001+++ php4/ext/fbsql/php_fbsql.c Wed Apr 25 11:01:22 2001 @@ -16,7 +16,7 @@+----------------------------------------------------------------------+*/ -/* $Id: php_fbsql.c,v 1.12 2001/04/17 17:39:43 fmk Exp $ */ +/* $Id: php_fbsql.c,v 1.13 2001/04/25 18:01:22 fmk Exp $ */ /* TODO: * @@ -525,7 +525,7 @@{ php_error(E_WARNING,"Cannot connect to host '%s'",hostName); php_error(E_WARNING,fbcehClassErrorMessage()); - return NULL; +// return NULL; } result = malloc(sizeof(PHPFBLink)); result->retainCount = 1;@@ -2780,17 +2780,16 @@add_property_string(return_value, "name", (char*)fbccmdLabelName(fbcmdColumnMetaDataAtIndex(result->metaData, column)),1); add_property_string(return_value, "table", (char*)fbccmdTableName(fbcmdColumnMetaDataAtIndex(result->metaData,column)),1); add_property_long(return_value, "max_length", fbcdmdLength(fbccmdDatatype(fbcmdColumnMetaDataAtIndex(result->metaData,column)))); - add_property_string(return_value, "type", (char*)fbcdmdDatatypeString (fbcmdDatatypeMetaDataAtIndex(result->metaData, column)),1); + add_property_string(return_value, "type", (char*)fbcdmdDatatypeString(fbcmdDatatypeMetaDataAtIndex(result->metaData, column)),1); + add_property_long(return_value, "not_null", !fbccmdIsNullable(fbcmdColumnMetaDataAtIndex(result->metaData, column))); /* Remember to add the rest */ -/* add_property_long(return_value, "not_null",IS_NOT_NULL(mysql_field->flags)?1:0); */ -/* add_property_long(return_value, "primary_key",IS_PRI_KEY(mysql_field->flags)?1:0); */ -/* add_property_long(return_value, "multiple_key",(mysql_field->flags&MULTIPLE_KEY_FLAG?1:0)); */ -/* add_property_long(return_value, "unique_key",(mysql_field->flags&UNIQUE_KEY_FLAG?1:0)); */ -/* add_property_long(return_value, "numeric",IS_NUM(mysql_field->type)?1:0); */ -/* add_property_long(return_value, "blob",IS_BLOB(mysql_field->flags)?1:0); */ -/* add_property_string(return_value, "type",php_mysql_get_field_name(mysql_field->type), 1); */ -/* add_property_long(return_value, "unsigned",(mysql_field->flags&UNSIGNED_FLAG?1:0)); */ -/* add_property_long(return_value, "zerofill",(mysql_field->flags&ZEROFILL_FLAG?1:0)); */ +/* add_property_long(return_value, "primary_key",IS_PRI_KEY(fbsql_field->flags)?1:0); */ +/* add_property_long(return_value, "multiple_key",(fbsql_field->flags&MULTIPLE_KEY_FLAG?1:0)); */ +/* add_property_long(return_value, "unique_key",(fbsql_field->flags&UNIQUE_KEY_FLAG?1:0)); */ +/* add_property_long(return_value, "numeric",IS_NUM(fbsql_field->type)?1:0); */ +/* add_property_long(return_value, "blob",IS_BLOB(fbsql_field->flags)?1:0); */ +/* add_property_long(return_value, "unsigned",(fbsql_field->flags&UNSIGNED_FLAG?1:0)); */ +/* add_property_long(return_value, "zerofill",(fbsql_field->flags&ZEROFILL_FLAG?1:0)); */} /* }}} */ @@ -2843,7 +2842,7 @@ /* }}} */ -/* {{{ proto string mysql_field_name(int result, int field_index) +/* {{{ proto string fbsql_field_name(int result, int field_index)*/PHP_FUNCTION(fbsql_field_name) { @@ -3069,7 +3068,7 @@ /* }}} */ -/* {{{ proto string fbsql_field_flags(int result, int field_index) +/* {{{ proto string string fbsql_field_flags(int result[, int field_index])*/PHP_FUNCTION(fbsql_field_flags) { @@ -3078,6 +3077,8 @@int resultIndex; PHPFBResult* result; int column; + char buf[512]; + int len; FBSQLLS_FETCH();resultIndex = FB_SQL_G(resultIndex);@@ -3109,12 +3110,51 @@RETURN_FALSE; } } - if (array_init(return_value)==FAILURE) - { - RETURN_FALSE; + strcpy(buf, ""); + if (!fbccmdIsNullable(fbcmdColumnMetaDataAtIndex(result->metaData, column))) { + strcat(buf, "not_null "); }- /* We should create the result -- currently empty */ - +#if 0+ if (IS_PRI_KEY(fbsql_field->flags)) { + strcat(buf, "primary_key "); + } + if (fbsql_field->flags&UNIQUE_KEY_FLAG) { + strcat(buf, "unique_key "); + } + if (fbsql_field->flags&MULTIPLE_KEY_FLAG) { + strcat(buf, "multiple_key "); + } + if (IS_BLOB(fbsql_field->flags)) { + strcat(buf, "blob "); + } + if (fbsql_field->flags&UNSIGNED_FLAG) { + strcat(buf, "unsigned "); + } + if (fbsql_field->flags&ZEROFILL_FLAG) { + strcat(buf, "zerofill "); + } + if (fbsql_field->flags&BINARY_FLAG) { + strcat(buf, "binary "); + } + if (fbsql_field->flags&ENUM_FLAG) { + strcat(buf, "enum "); + } + if (fbsql_field->flags&AUTO_INCREMENT_FLAG) { + strcat(buf, "auto_increment "); + } + if (fbsql_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;} /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-cvs-unsubscribe@lists.php.net For additional commands, e-mail: php-cvs-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net