From my MYSQL manager plugin:
PHP Code:
public bool:AskPluginLoad(Handle:myself, bool:late, String:Error[])
{
// General
CreateNative("DB_GetColumnId", Db_GetColumnId);
CreateNative("DB_EnableId", Db_EnableColumn);
CreateNative("DB_DisableId", Db_DisableColumn);
CreateNative("DB_ColumnType", ReturnColumnType);
CreateNative("DB_GetHandle", DB_ReturnHandle);
//CreateNative("DB_CreateRow", DB_CreateNewRow);
CreateNative("DB_SetInfo", SetColumnInfo);
CreateNative("DB_SetInfoString", SetColumnInfoString);
CreateNative("DB_GetColumn", GetColumnInfo);
CreateNative("DB_GetColumnString", GetColumnInfoString);
return true;
}
A simple native:
PHP Code:
//Client, column
public GetColumnInfo(Handle:plugin,argc){
if(argc==2){
new client = GetNativeCell(1);
if(client > MAXPLAYERS )
ThrowNativeError(0, "Invalid client!");
new column = GetNativeCell(2);
if(column > Totalcount )
ThrowNativeError(0, "Invalid column!");
switch( GetColumnType(column) ){
case DB_INT, DB_FLOAT: {
return GetArrayCell( GetArrayCell(adt_adress,column) , client);
}
case DB_STRING: ThrowNativeError(0, "Column is not a string!");
}
}
return -1;
}
//Client, column, sting, maxsize
public GetColumnInfoString(Handle:plugin,argc){
if(argc==4){
new client = GetNativeCell(1);
if(client > MAXPLAYERS )
ThrowNativeError(0, "Invalid client!");
new column = GetNativeCell(2);
if(column > Totalcount )
ThrowNativeError(0, "Invalid column!");
switch( GetColumnType(column) ){
case DB_INT, DB_FLOAT: ThrowNativeError(0, "Column is not a int/float!");
case DB_STRING: {
new size = GetNativeCell(4);
new String:temp[size];
GetArrayString( GetArrayCell(adt_adress,column) , column ,temp, size);
SetNativeString(3, temp, size);
}
}
}
}
and the page with the native functions:
http://sm.nican132.com/index.php?fas...le&id=1&type=&
__________________