public static object GetField(PhpResource resultHandle, int rowIndex, object field) { PhpSqlDbResult result = PhpSqlDbResult.ValidResult(resultHandle); ScriptContext context = ScriptContext.CurrentContext; if (result == null) { return(null); } string field_name; object field_value; if (field == null) { field_value = result.GetFieldValue(rowIndex, result.CurrentFieldIndex); } else if ((field_name = PhpVariable.AsString(field)) != null) { field_value = result.GetFieldValue(rowIndex, field_name); } else { field_value = result.GetFieldValue(rowIndex, Core.Convert.ObjectToInteger(field)); } return(Core.Convert.Quote(field_value, context)); }
public static string FieldType(PhpResource resultHandle, int fieldIndex) { PhpSqlDbResult result = PhpSqlDbResult.ValidResult(resultHandle); if (result == null) { return(null); } return(result.GetPhpFieldType(fieldIndex)); }
public static string FieldName(PhpResource resultHandle) { PhpSqlDbResult result = PhpSqlDbResult.ValidResult(resultHandle); if (result == null) { return(null); } return(result.GetFieldName()); }
public static bool FieldSeek(PhpResource resultHandle, int fieldOffset) { PhpSqlDbResult result = PhpSqlDbResult.ValidResult(resultHandle); if (result == null) { return(false); } return(result.SeekField(fieldOffset)); }
public static int GetRowCount(PhpResource resultHandle) { PhpSqlDbResult result = PhpSqlDbResult.ValidResult(resultHandle); if (result == null) { return(0); } return(result.RowCount); }
public static bool DataSeek(PhpResource resultHandle, int rowIndex) { PhpSqlDbResult result = PhpSqlDbResult.ValidResult(resultHandle); if (result == null) { return(false); } return(result.SeekRow(rowIndex)); }
public static PhpObject FetchObject(PhpResource resultHandle) { PhpSqlDbResult result = PhpSqlDbResult.ValidResult(resultHandle); if (result == null) { return(null); } return(result.FetchObject()); }
public static PhpObject FetchField(PhpResource resultHandle, int fieldIndex) { PhpSqlDbResult result = PhpSqlDbResult.ValidResult(resultHandle); if (result == null) { return(null); } return(FetchFieldInternal(result, fieldIndex)); }
public static int FieldLength(PhpResource resultHandle, int fieldIndex) { PhpSqlDbResult result = PhpSqlDbResult.ValidResult(resultHandle); if (result == null) { return(-1); } return(result.GetFieldLength(fieldIndex)); }
public static bool NextResult(PhpResource resultHandle) { PhpSqlDbResult result = PhpSqlDbResult.ValidResult(resultHandle); if (result == null) { return(false); } return(result.NextResultSet()); }
public static bool FreeResult(PhpResource resultHandle) { PhpSqlDbResult result = PhpSqlDbResult.ValidResult(resultHandle); if (result == null) { return(false); } result.Close(); return(true); }
internal static PhpSqlDbResult ValidResult(PhpResource handle) { PhpSqlDbResult result = handle as PhpSqlDbResult; if (result != null && result.IsValid) { return(result); } PhpException.Throw(PhpError.Warning, LibResources.GetString("invalid_result_resource")); return(null); }
/// <summary> /// Executes the procedure. /// </summary> /// <param name="skipResults">Whether to load the results.</param> /// <param name="success">Whether the execution succeeded.</param> /// <returns>Results or a <B>null</B> reference if results are not loaded or an error occured.</returns> public PhpSqlDbResult Execute(bool skipResults, out bool success) { PhpSqlDbResult result = (PhpSqlDbResult)connection.ExecuteProcedure(procedureName, PrepareParameters(), skipResults); success = connection.LastException == null; if (success) { WriteParametersBack(); } return(result); }
public static PhpResource Query(string query, PhpResource linkIdentifier, int batchSize) { PhpSqlDbConnection connection = PhpSqlDbConnection.ValidConnection(linkIdentifier); if (query == null || connection == null) { return(null); } PhpSqlDbResult result = (PhpSqlDbResult)connection.ExecuteQuery(query.Trim(), true); if (result == null) { return(null); } result.BatchSize = batchSize; return(result); }
public static PhpArray FetchArray(PhpResource resultHandle, QueryResultKeys resultType) { PhpSqlDbResult result = PhpSqlDbResult.ValidResult(resultHandle); if (result == null) { return(null); } switch (resultType) { case QueryResultKeys.ColumnNames: return(result.FetchArray(false, true)); case QueryResultKeys.Numbers: return(result.FetchArray(true, false)); case QueryResultKeys.Both: return(result.FetchArray(true, true)); } return(null); }
private static PhpObject FetchFieldInternal(PhpSqlDbResult /*!*/ result, int fieldIndex) { DataRow info = result.GetSchemaRowInfo(fieldIndex); if (info == null) { return(null); } string s; PhpObject obj = new stdClass(); string php_type = result.GetPhpFieldType(fieldIndex); obj.Add("name", result.GetFieldName(fieldIndex)); obj.Add("column_source", (s = info["BaseColumnName"] as string) != null ? s : ""); obj.Add("max_length", result.GetFieldLength(fieldIndex)); obj.Add("numeric", result.IsNumericType(php_type) ? 1 : 0); obj.Add("type", php_type); return(obj); }
public static object Execute(PhpResource statement, bool skipResults) { PhpSqlDbProcedure procedure = PhpSqlDbProcedure.ValidProcedure(statement); if (procedure == null) { return(false); } bool success; PhpSqlDbResult result = procedure.Execute(skipResults, out success); if (!success) { return(false); } if (skipResults) { return(true); } return(result); }
private static PhpObject FetchFieldInternal(PhpSqlDbResult/*!*/ result, int fieldIndex) { DataRow info = result.GetSchemaRowInfo(fieldIndex); if (info == null) return null; string s; PhpObject obj = new stdClass(); string php_type = result.GetPhpFieldType(fieldIndex); obj.Add("name", result.GetFieldName(fieldIndex)); obj.Add("column_source", (s = info["BaseColumnName"] as string) != null ? s : ""); obj.Add("max_length", result.GetFieldLength(fieldIndex)); obj.Add("numeric", result.IsNumericType(php_type) ? 1 : 0); obj.Add("type", php_type); return obj; }